From f826880f7502e8bbf1ad96eca53d4882c9cdd355 Mon Sep 17 00:00:00 2001 From: wjm Date: Tue, 8 Jun 2021 04:28:41 +0800 Subject: [PATCH 001/226] fix sc --- ge/graph/preprocess/graph_preprocess.cc | 119 ++++++++++++--------- ge/graph/preprocess/graph_preprocess.h | 3 +- ge/ir_build/ge_ir_build.cc | 2 +- .../graph/preprocess/graph_preprocess_unittest.cc | 15 +++ 4 files changed, 84 insertions(+), 55 deletions(-) diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 0c4adeea..a73c6a96 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1420,9 +1420,10 @@ Status GraphPrepare::AdjustDataOpOutput(const NodePtr &node) { return SUCCESS; } -Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc, bool tune_flag) { +Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc) { auto format = desc.GetFormat(); auto origin_format = desc.GetOriginFormat(); + auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); bool need_check_internal_format = (!IsTansDataOpData(input_node)) && (!options_.is_single_op) && (!tune_flag); if (need_check_internal_format) { bool is_internal = TypeUtils::IsInternalFormat(format) || TypeUtils::IsInternalFormat(origin_format); @@ -1439,6 +1440,63 @@ Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTens return SUCCESS; } +Status GraphPrepare::UpdateDataInputOutputDesc(GeAttrValue::INT index, OpDescPtr &op, GeTensorDesc &desc) { + auto data_type = desc.GetDataType(); + uint32_t length = 1; + bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); + if (!type_ret) { + std::string reason = "Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "] of index:" + + std::to_string(index) + " input tensor is not support"; + REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); + GELOGE(PARAM_INVALID, "[Check][Param] Input datatype %s is not support.", + TypeUtils::DataTypeToSerialString(data_type).c_str()); + return FAILED; + } + int64_t desc_shape = desc.GetShape().GetShapeSize(); + FMK_INT64_UINT32_MULCHECK(desc_shape, length); + int64_t shape_size = desc_shape * length; + GE_IF_BOOL_EXEC(shape_size == 0 && desc.GetShape().GetDimNum() == 0, shape_size = static_cast(length)); + int64_t size = 0; + GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(desc, size) != GRAPH_SUCCESS, + REPORT_CALL_ERROR("E19999", "Get size of user input tensor failed, index:%ld", index); + GELOGE(INTERNAL_ERROR, "[Get][Size] of user input tensor failed, index:%ld", index); return FAILED); + bool size_check = (size != 0 && shape_size != size); + if (size_check) { + std::string reason = "input tensor[index:" + std::to_string(index) + "]'s data size[" + std::to_string(size) + + "] != shape_size[" + std::to_string(size) + "], check invalid"; + REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); + GELOGE(PARAM_INVALID, "[Check][Param] input data size = %ld, shape_size = %ld.", size, shape_size); + return FAILED; + } + ge::TensorUtils::SetSize(desc, shape_size); + + auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); + if (!tune_flag) { + graphStatus graph_ret = op->UpdateInputDesc(0, desc); + if (graph_ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + GELOGE(graph_ret, "[Update][InputDesc] of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + return graph_ret; + } + // Size will be recalculated in the build stage + ge::TensorUtils::SetSize(desc, 0); + graph_ret = op->UpdateOutputDesc(0, desc); + if (graph_ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update output desc of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + GELOGE(graph_ret, "[Update][OutputDesc] of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + return graph_ret; + } + } else { + GELOGI("data %s skip update info in tune mode", op->GetName().c_str()); + } + + return SUCCESS; +} + Status GraphPrepare::UpdateInput(const std::vector &user_input, const std::map &graph_option) { // Get shape range of input in dynamic_execute mode @@ -1471,63 +1529,18 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input, } GeTensorDesc desc(user_input[index].GetTensorDesc()); // data maybe internal format [FRACTAL_NZ] at singleop process such as GEMM. - auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); - ret = CheckInternalFormat(input_node, desc, tune_flag); + ret = CheckInternalFormat(input_node, desc); if (ret != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Check][InternalFormat] on %s failed", op->GetName().c_str()); return ret; } - auto data_type = desc.GetDataType(); - uint32_t length = 1; - bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); - if (!type_ret) { - std::string reason = "Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "] of index:" + - std::to_string(index) + " input tensor is not support"; - REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); - GELOGE(PARAM_INVALID, "[Check][Param] Input datatype %s is not support.", - TypeUtils::DataTypeToSerialString(data_type).c_str()); - return FAILED; - } - int64_t desc_shape = desc.GetShape().GetShapeSize(); - FMK_INT64_UINT32_MULCHECK(desc_shape, length); - int64_t shape_size = desc_shape * length; - GE_IF_BOOL_EXEC(shape_size == 0 && desc.GetShape().GetDimNum() == 0, shape_size = static_cast(length)); - int64_t size = 0; - GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(desc, size) != GRAPH_SUCCESS, - REPORT_CALL_ERROR("E19999", "Get size of user input tensor failed, index:%ld", index); - GELOGE(INTERNAL_ERROR, "[Get][Size] of user input tensor failed, index:%ld", index); - return FAILED); - bool size_check = (size != 0 && shape_size != size); - if (size_check) { - std::string reason = "input tensor[index:" + std::to_string(index) + "]'s data size[" + std::to_string(size) + - "] != shape_size[" + std::to_string(size) + "], check invalid"; - REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); - GELOGE(PARAM_INVALID, "[Check][Param] input data size = %ld, shape_size = %ld.", size, shape_size); - return FAILED; - } - ge::TensorUtils::SetSize(desc, shape_size); - if (!tune_flag) { - graphStatus graph_ret = op->UpdateInputDesc(0, desc); - if (graph_ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - GELOGE(graph_ret, "[Update][InputDesc] of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - return graph_ret; - } - // Size will be recalculated in the build stage - ge::TensorUtils::SetSize(desc, 0); - graph_ret = op->UpdateOutputDesc(0, desc); - if (graph_ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Update output desc of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - GELOGE(graph_ret, "[Update][OutputDesc] of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - return graph_ret; - } - } else { - GELOGI("data %s skip update info in tune mode", op->GetName().c_str()); + + ret = UpdateDataInputOutputDesc(index, op, desc); + if (ret != SUCCESS) { + GELOGE(FAILED, "[Update][DataInputOutputDesc] on %s failed", op->GetName().c_str()); + return ret; } + if (!dynamic_shape_range_vec.empty()) { ret = UpdateDynamicInputShapeRange(index, dynamic_shape_range_vec, op, desc); GE_CHK_STATUS_RET(ret, "[Update][DynamicInputShapeRange] on %s failed.", op->GetName().c_str()); diff --git a/ge/graph/preprocess/graph_preprocess.h b/ge/graph/preprocess/graph_preprocess.h index 584f4d16..22bc566c 100755 --- a/ge/graph/preprocess/graph_preprocess.h +++ b/ge/graph/preprocess/graph_preprocess.h @@ -63,7 +63,8 @@ class GraphPrepare { Status CheckRefOp(); Status SetRtContext(rtContext_t rt_context, rtCtxMode_t mode); Status AdjustDataOpOutput(const NodePtr &node); - Status CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc, bool tune_flag); + Status CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc); + Status UpdateDataInputOutputDesc(GeAttrValue::INT index, OpDescPtr &op, GeTensorDesc &desc); Status UpdateInput(const std::vector &user_input, const std::map &graph_option); Status CheckAndUpdateInput(const std::vector &user_input, const std::map &graph_option); Status CheckConstOp(); diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 21db83aa..befffa93 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -559,8 +559,8 @@ graphStatus Impl::Init(const Graph &graph, const std::map user_input = {input1}; + std::map graph_option; + auto ret = graph_prepare.UpdateInput(user_input, graph_option); + EXPECT_EQ(ret, ge::FAILED); +} + TEST_F(UtestGraphPreproces, test_check_user_input) { ge::GraphPrepare graph_prepare; graph_prepare.compute_graph_ = BuildGraph1(); From 2abf8be62178511bf6c073ff821b309a8e2817ee Mon Sep 17 00:00:00 2001 From: wjm Date: Tue, 8 Jun 2021 04:28:41 +0800 Subject: [PATCH 002/226] fix sc --- ge/graph/preprocess/graph_preprocess.cc | 119 ++++++++++++--------- ge/graph/preprocess/graph_preprocess.h | 3 +- ge/ir_build/ge_ir_build.cc | 2 +- .../graph/preprocess/graph_preprocess_unittest.cc | 15 +++ 4 files changed, 84 insertions(+), 55 deletions(-) diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 0c4adeea..a73c6a96 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1420,9 +1420,10 @@ Status GraphPrepare::AdjustDataOpOutput(const NodePtr &node) { return SUCCESS; } -Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc, bool tune_flag) { +Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc) { auto format = desc.GetFormat(); auto origin_format = desc.GetOriginFormat(); + auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); bool need_check_internal_format = (!IsTansDataOpData(input_node)) && (!options_.is_single_op) && (!tune_flag); if (need_check_internal_format) { bool is_internal = TypeUtils::IsInternalFormat(format) || TypeUtils::IsInternalFormat(origin_format); @@ -1439,6 +1440,63 @@ Status GraphPrepare::CheckInternalFormat(const NodePtr &input_node, const GeTens return SUCCESS; } +Status GraphPrepare::UpdateDataInputOutputDesc(GeAttrValue::INT index, OpDescPtr &op, GeTensorDesc &desc) { + auto data_type = desc.GetDataType(); + uint32_t length = 1; + bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); + if (!type_ret) { + std::string reason = "Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "] of index:" + + std::to_string(index) + " input tensor is not support"; + REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); + GELOGE(PARAM_INVALID, "[Check][Param] Input datatype %s is not support.", + TypeUtils::DataTypeToSerialString(data_type).c_str()); + return FAILED; + } + int64_t desc_shape = desc.GetShape().GetShapeSize(); + FMK_INT64_UINT32_MULCHECK(desc_shape, length); + int64_t shape_size = desc_shape * length; + GE_IF_BOOL_EXEC(shape_size == 0 && desc.GetShape().GetDimNum() == 0, shape_size = static_cast(length)); + int64_t size = 0; + GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(desc, size) != GRAPH_SUCCESS, + REPORT_CALL_ERROR("E19999", "Get size of user input tensor failed, index:%ld", index); + GELOGE(INTERNAL_ERROR, "[Get][Size] of user input tensor failed, index:%ld", index); return FAILED); + bool size_check = (size != 0 && shape_size != size); + if (size_check) { + std::string reason = "input tensor[index:" + std::to_string(index) + "]'s data size[" + std::to_string(size) + + "] != shape_size[" + std::to_string(size) + "], check invalid"; + REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); + GELOGE(PARAM_INVALID, "[Check][Param] input data size = %ld, shape_size = %ld.", size, shape_size); + return FAILED; + } + ge::TensorUtils::SetSize(desc, shape_size); + + auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); + if (!tune_flag) { + graphStatus graph_ret = op->UpdateInputDesc(0, desc); + if (graph_ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + GELOGE(graph_ret, "[Update][InputDesc] of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + return graph_ret; + } + // Size will be recalculated in the build stage + ge::TensorUtils::SetSize(desc, 0); + graph_ret = op->UpdateOutputDesc(0, desc); + if (graph_ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update output desc of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + GELOGE(graph_ret, "[Update][OutputDesc] of op:%s(%s) failed, index:0", + op->GetName().c_str(), op->GetType().c_str()); + return graph_ret; + } + } else { + GELOGI("data %s skip update info in tune mode", op->GetName().c_str()); + } + + return SUCCESS; +} + Status GraphPrepare::UpdateInput(const std::vector &user_input, const std::map &graph_option) { // Get shape range of input in dynamic_execute mode @@ -1471,63 +1529,18 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input, } GeTensorDesc desc(user_input[index].GetTensorDesc()); // data maybe internal format [FRACTAL_NZ] at singleop process such as GEMM. - auto tune_flag = (options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_BUILDER); - ret = CheckInternalFormat(input_node, desc, tune_flag); + ret = CheckInternalFormat(input_node, desc); if (ret != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Check][InternalFormat] on %s failed", op->GetName().c_str()); return ret; } - auto data_type = desc.GetDataType(); - uint32_t length = 1; - bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); - if (!type_ret) { - std::string reason = "Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "] of index:" + - std::to_string(index) + " input tensor is not support"; - REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); - GELOGE(PARAM_INVALID, "[Check][Param] Input datatype %s is not support.", - TypeUtils::DataTypeToSerialString(data_type).c_str()); - return FAILED; - } - int64_t desc_shape = desc.GetShape().GetShapeSize(); - FMK_INT64_UINT32_MULCHECK(desc_shape, length); - int64_t shape_size = desc_shape * length; - GE_IF_BOOL_EXEC(shape_size == 0 && desc.GetShape().GetDimNum() == 0, shape_size = static_cast(length)); - int64_t size = 0; - GE_IF_BOOL_EXEC(ge::TensorUtils::GetSize(desc, size) != GRAPH_SUCCESS, - REPORT_CALL_ERROR("E19999", "Get size of user input tensor failed, index:%ld", index); - GELOGE(INTERNAL_ERROR, "[Get][Size] of user input tensor failed, index:%ld", index); - return FAILED); - bool size_check = (size != 0 && shape_size != size); - if (size_check) { - std::string reason = "input tensor[index:" + std::to_string(index) + "]'s data size[" + std::to_string(size) + - "] != shape_size[" + std::to_string(size) + "], check invalid"; - REPORT_INPUT_ERROR("E19025", std::vector({"reason"}), std::vector({reason})); - GELOGE(PARAM_INVALID, "[Check][Param] input data size = %ld, shape_size = %ld.", size, shape_size); - return FAILED; - } - ge::TensorUtils::SetSize(desc, shape_size); - if (!tune_flag) { - graphStatus graph_ret = op->UpdateInputDesc(0, desc); - if (graph_ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - GELOGE(graph_ret, "[Update][InputDesc] of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - return graph_ret; - } - // Size will be recalculated in the build stage - ge::TensorUtils::SetSize(desc, 0); - graph_ret = op->UpdateOutputDesc(0, desc); - if (graph_ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Update output desc of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - GELOGE(graph_ret, "[Update][OutputDesc] of op:%s(%s) failed, index:0", - op->GetName().c_str(), op->GetType().c_str()); - return graph_ret; - } - } else { - GELOGI("data %s skip update info in tune mode", op->GetName().c_str()); + + ret = UpdateDataInputOutputDesc(index, op, desc); + if (ret != SUCCESS) { + GELOGE(FAILED, "[Update][DataInputOutputDesc] on %s failed", op->GetName().c_str()); + return ret; } + if (!dynamic_shape_range_vec.empty()) { ret = UpdateDynamicInputShapeRange(index, dynamic_shape_range_vec, op, desc); GE_CHK_STATUS_RET(ret, "[Update][DynamicInputShapeRange] on %s failed.", op->GetName().c_str()); diff --git a/ge/graph/preprocess/graph_preprocess.h b/ge/graph/preprocess/graph_preprocess.h index 584f4d16..22bc566c 100755 --- a/ge/graph/preprocess/graph_preprocess.h +++ b/ge/graph/preprocess/graph_preprocess.h @@ -63,7 +63,8 @@ class GraphPrepare { Status CheckRefOp(); Status SetRtContext(rtContext_t rt_context, rtCtxMode_t mode); Status AdjustDataOpOutput(const NodePtr &node); - Status CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc, bool tune_flag); + Status CheckInternalFormat(const NodePtr &input_node, const GeTensorDesc &desc); + Status UpdateDataInputOutputDesc(GeAttrValue::INT index, OpDescPtr &op, GeTensorDesc &desc); Status UpdateInput(const std::vector &user_input, const std::map &graph_option); Status CheckAndUpdateInput(const std::vector &user_input, const std::map &graph_option); Status CheckConstOp(); diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 21db83aa..befffa93 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -559,8 +559,8 @@ graphStatus Impl::Init(const Graph &graph, const std::map user_input = {input1}; + std::map graph_option; + auto ret = graph_prepare.UpdateInput(user_input, graph_option); + EXPECT_EQ(ret, ge::FAILED); +} + TEST_F(UtestGraphPreproces, test_check_user_input) { ge::GraphPrepare graph_prepare; graph_prepare.compute_graph_ = BuildGraph1(); From c7f3b08445e1e45fde7f9a1483dfa2ab23940356 Mon Sep 17 00:00:00 2001 From: wjm Date: Wed, 9 Jun 2021 06:28:07 +0800 Subject: [PATCH 003/226] mark original input --- ge/generator/ge_generator.cc | 1 + metadef | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 24b35bca..505b1908 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -205,6 +205,7 @@ static Status AddInputs(const ComputeGraphPtr &graph, const NodePtr &node, const } (void)AttrUtils::SetBool(data_op, "_is_single_op", true); + (void)AttrUtils::SetBool(data_op, ATTR_NAME_IS_ORIGINAL_INPUT, true); GE_CHK_BOOL_EXEC(data_op->AddInputDesc(tensor) == GRAPH_SUCCESS, REPORT_CALL_ERROR("E19999", "AddInputDesc failed for node:%s", data_op->GetName().c_str()); diff --git a/metadef b/metadef index 310610e5..2ad00e17 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 310610e5392e01659d214ad380e9ed2c39f9f5a3 +Subproject commit 2ad00e17886fd06c0d00f8a8cf370783a3d31818 From 96ecc01cbe7286888b57852226771d7a9e1f3e1a Mon Sep 17 00:00:00 2001 From: wjm Date: Thu, 10 Jun 2021 11:47:43 +0800 Subject: [PATCH 004/226] fix safe --- ge/common/dump/exception_dumper.cc | 1 + ge/graph/build/model_builder.cc | 2 +- ge/graph/load/model_manager/task_info/kernel_task_info.cc | 2 ++ ge/graph/preprocess/insert_op/util_insert_aipp_op.cc | 1 + ge/hybrid/model/hybrid_model_builder.cc | 1 + ge/plugin/engine/engine_manage.cc | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ge/common/dump/exception_dumper.cc b/ge/common/dump/exception_dumper.cc index c8ec3d35..c41da551 100644 --- a/ge/common/dump/exception_dumper.cc +++ b/ge/common/dump/exception_dumper.cc @@ -161,6 +161,7 @@ Status ExceptionDumper::DumpExceptionInfo(const std::vector &ex uint64_t proto_size = dump_data.ByteSizeLong(); std::unique_ptr proto_msg(new (std::nothrow) char[proto_size]); + GE_CHECK_NOTNULL(proto_msg); bool ret = dump_data.SerializeToArray(proto_msg.get(), proto_size); if (!ret || proto_size == 0) { REPORT_INNER_ERROR("E19999", "Serialize proto to string fail"); diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index d38e89fe..e35e4e7d 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -707,7 +707,7 @@ Status ModelBuilder::SaveDataToModel(ge::Model &model, ge::GeModel &ge_model) { if (!kernel_name.empty() && (kernel_buffer.GetSize() > 0)) { GE_CHECK_NOTNULL(kernel_buffer.GetData()); std::vector data(kernel_buffer.GetData(), kernel_buffer.GetData() + kernel_buffer.GetSize()); - tbe_kernel = std::make_shared(kernel_name, std::move(data)); + tbe_kernel = MakeShared(kernel_name, std::move(data)); GE_CHECK_NOTNULL(tbe_kernel); GELOGI("Node [%s][%s] start recovery extra attr %s from %s", node_op_desc->GetName().c_str(), node_op_desc->GetType().c_str(), ge::OP_EXTATTR_NAME_TBE_KERNEL, ATTR_NAME_TBE_KERNEL_NAME.c_str()); diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_task_info.cc index bfb6e24b..07ad63ca 100755 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.cc @@ -645,6 +645,7 @@ Status KernelTaskInfo::InitTVMTask(uint16_t offset, const domi::KernelDef &kerne GE_CHECK_NOTNULL(op_desc); args_addr = std::unique_ptr(new (std::nothrow) uint8_t[args_size_]); + GE_CHECK_NOTNULL(args_addr); errno_t sec_ret = memcpy_s(args_addr.get(), args_size_, kernel_def.args().data(), args_size_); if (sec_ret != EOK) { REPORT_CALL_ERROR("E19999", "Call memcpy_s fail, size:%u, ret:0x%X", args_size_, sec_ret); @@ -1000,6 +1001,7 @@ Status KernelTaskInfo::InitAicpuTask(uint32_t op_index, const domi::KernelDef &k // copy args to new host memory args_addr = std::unique_ptr(new (std::nothrow) uint8_t[args_size_]); + GE_CHECK_NOTNULL(args_addr); GE_PRINT_DYNAMIC_MEMORY(new, "cce task physical memory.", sizeof(uint8_t) * args_size_) errno_t sec_ret = memcpy_s(args_addr.get(), args_size_, kernel_def.args().data(), args_size_); if (sec_ret != EOK) { diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 3cd26139..cc7f276e 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -568,6 +568,7 @@ Status InsertNewOpUtil::GetDataRelatedNode(NodePtr &node, std::map aipp_params(new (std::nothrow) domi::AippOpParams()); + GE_CHECK_NOTNULL(aipp_params); ge::GeAttrValue::NAMED_ATTRS aipp_attr; GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(data_op, ATTR_NAME_AIPP, aipp_attr), ACL_ERROR_GE_AIPP_NOT_EXIST, "[Get][Attr] %s from op:%s failed", ATTR_NAME_AIPP.c_str(), data_op->GetName().c_str()); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index e80d9b90..554ddbbb 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -1044,6 +1044,7 @@ Status HybridModelBuilder::InitConstantOps() { } else { var_tensor.reset(new(std::nothrow)TensorValue(nullptr, 0)); } + GE_CHECK_NOTNULL(var_tensor); } else { GE_CHK_STATUS_RET_NOLOG(VarNodeToTensor(var_node, var_tensor)); GELOGD("Init const op tensor. name = %s, size = %ld", var_name.c_str(), var_tensor->GetSize()); diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 0e129526..9cc37fd6 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -38,7 +38,7 @@ Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePt if (engine_map_ == nullptr) { engine_map_.reset(new (std::nothrow) std::map()); } - + GE_CHECK_NOTNULL(engine_map_); auto it = engine_map_->find(engine_name); if (it != engine_map_->end()) { GELOGW("engine %s already exist.", engine_name.c_str()); From 3e68c392878a9161d9a4ff291469e50487949c78 Mon Sep 17 00:00:00 2001 From: wjm Date: Thu, 10 Jun 2021 13:01:01 +0800 Subject: [PATCH 005/226] fix --- ge/plugin/engine/engine_manage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 9cc37fd6..0e129526 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -38,7 +38,7 @@ Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePt if (engine_map_ == nullptr) { engine_map_.reset(new (std::nothrow) std::map()); } - GE_CHECK_NOTNULL(engine_map_); + auto it = engine_map_->find(engine_name); if (it != engine_map_->end()) { GELOGW("engine %s already exist.", engine_name.c_str()); From 4c398c9f8b7f1259a67b0526b29c38cbc0692c32 Mon Sep 17 00:00:00 2001 From: wjm Date: Thu, 10 Jun 2021 18:34:11 +0800 Subject: [PATCH 006/226] update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 9c9907b7..3e14f92d 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 9c9907b76a457f456072af96b8cbcfb7943beccc +Subproject commit 3e14f92d47abc9a2e703be2171f047553f7597e0 diff --git a/parser b/parser index 15a27afe..4151e330 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 15a27afefe45f2abdb78787d629163aab9437599 +Subproject commit 4151e33028c518057289b569b36cd4069af362a4 From bdbfe5eea44e4d40b8a6940c69ab6a26cc2c0efb Mon Sep 17 00:00:00 2001 From: wjm Date: Thu, 10 Jun 2021 23:45:20 +0800 Subject: [PATCH 007/226] fix --- ge/ge_opt_info/ge_opt_info.h | 1 + ge/graph/load/model_manager/task_info/memcpy_async_task_info.h | 2 +- ge/graph/preprocess/graph_preprocess.cc | 4 ++-- ge/hybrid/executor/hybrid_model_pipeline_executor.cc | 1 + ge/hybrid/node_executor/hccl/hccl_node_executor.h | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ge/ge_opt_info/ge_opt_info.h b/ge/ge_opt_info/ge_opt_info.h index 935dff25..5cc1063a 100644 --- a/ge/ge_opt_info/ge_opt_info.h +++ b/ge/ge_opt_info/ge_opt_info.h @@ -24,6 +24,7 @@ namespace ge { class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { public: GeOptInfo() = default; + ~GeOptInfo() = default; static Status SetOptInfo(); }; } // namespace ge diff --git a/ge/graph/load/model_manager/task_info/memcpy_async_task_info.h b/ge/graph/load/model_manager/task_info/memcpy_async_task_info.h index 728305ff..4ae03967 100755 --- a/ge/graph/load/model_manager/task_info/memcpy_async_task_info.h +++ b/ge/graph/load/model_manager/task_info/memcpy_async_task_info.h @@ -47,7 +47,7 @@ class MemcpyAsyncTaskInfo : public TaskInfo { uint64_t count_; uint32_t kind_; vector io_addrs_; - int64_t fixed_addr_offset_; + int64_t fixed_addr_offset_ = 0; DavinciModel *davinci_model_ = nullptr; uint32_t args_offset_ = 0; }; diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index bc8646e7..d7f33b4b 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1756,8 +1756,8 @@ Status GraphPrepare::CtrlFlowPreProcess() { PassManager graph_pass; // After InferShape Mark v1 control flow for unknown shape. - auto mark_force_unknown_pass = new (std::nothrow) MarkForceUnknownForCondPass; - GE_CHK_STATUS_RET(graph_pass.AddPass("PreRun::MarkForceUnknownForCondPass", mark_force_unknown_pass)); + GE_CHK_STATUS_RET(graph_pass.AddPass("PreRun::MarkForceUnknownForCondPass", + new (std::nothrow) MarkForceUnknownForCondPass)); GE_CHK_STATUS_RET(graph_pass.Run(compute_graph_)); return SUCCESS; diff --git a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc index b5e66628..57ba20d4 100644 --- a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc +++ b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc @@ -188,6 +188,7 @@ HybridModelPipelineExecutor::HybridModelPipelineExecutor(HybridModel *model, uin config_.num_executors = kNumExecutors; config_.num_stages = model_->GetRootGraphItem()->NumGroups(); config_.device_id = device_id_; + config_.iteration_end = 0; } Status StageExecutor::InitExecutionContext() { diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.h b/ge/hybrid/node_executor/hccl/hccl_node_executor.h index b020208d..757f7593 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.h +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.h @@ -62,7 +62,7 @@ class RdmaNodeTask : public NodeTask { int32_t local_index_ = 0; std::mutex hccl_mutex_; std::condition_variable cond_; - bool skip_flag_; + bool skip_flag_ = false; }; From 478bb52093857f881d722ed12ca99053ffcbe2e7 Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 01:44:03 +0800 Subject: [PATCH 008/226] fix --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index e5663fb8..d343f9fe 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -136,8 +136,7 @@ Status KnownNodeTask::Init(TaskContext &context) { Status KnownNodeTask::InitDavinciModel(const HybridModel &model, TensorBuffer *weight_buffer) { GELOGD("[Init][DavinciModel] start"); davinci_model_->InitRuntimeParams(); - GE_CHK_STATUS_RET(davinci_model_->InitVariableMem(), - "[Init][VariableMem] failed"); + GE_CHK_STATUS_RET(davinci_model_->InitVariableMem(), "[Init][VariableMem] failed"); int32_t device_id = 0; GE_CHK_RT_RET(rtGetDevice(&device_id)); davinci_model_->SetDeviceId(static_cast(device_id)); @@ -181,7 +180,7 @@ Status KnownNodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) cons } Status KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr &node, - std::shared_ptr &davinci_model) const { + std::shared_ptr &davinci_model) const { // set known node flag as true davinci_model->SetKnownNode(true); davinci_model->SetId(model.GetModelId()); From 52964f64bc3bc25694c6a608980150828c581270 Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 03:30:49 +0800 Subject: [PATCH 009/226] fix --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index d343f9fe..8b3c691f 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -247,8 +247,7 @@ Status KnownNodeExecutor::ParseAttrForAllocatingOutputs(NodeItem &node_item, Com GE_CHECK_NOTNULL(net_output_desc); std::map connected_inputs; std::map data_indices; - GE_CHK_STATUS_RET(GetDataNodes(graph, data_indices), - "[%s] Failed to get data node indices", + GE_CHK_STATUS_RET(GetDataNodes(graph, data_indices), "[%s] Failed to get data node indices", node_item.NodeName().c_str()); for (const auto &in_data_anchor : net_output_node->GetAllInDataAnchors()) { auto out_data_anchor = in_data_anchor->GetPeerOutAnchor(); From 195d299596c579dc96d77c4cf1f818aa1dc083f3 Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 04:03:34 +0800 Subject: [PATCH 010/226] update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 2f89122e..84e7ab39 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 2f89122e1fa26b3633a8efa4bf0a0269bebf537e +Subproject commit 84e7ab39b0daf7ca2b2f5549e3279647da7875e2 diff --git a/parser b/parser index 4151e330..ffd94df4 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 4151e33028c518057289b569b36cd4069af362a4 +Subproject commit ffd94df471f7dd2b1928cc8d27e43e7210aaa7e7 From d8ba1fb2c0d85436d43d5b0fe132a8c2e2d1724d Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Fri, 11 Jun 2021 09:42:50 +0800 Subject: [PATCH 011/226] remove graph ut form ge --- cmake/external_libs/protobuf_shared.cmake | 12 +-- cmake/external_libs/protobuf_static.cmake | 10 +- cmake/external_libs/protoc.cmake | 12 +-- metadef | 2 +- parser | 2 +- .../testcase/ge_graph/ge_graph_anchor_unittest.cc | 112 --------------------- .../ge_graph/ge_model_serialize_unittest.cc | 3 +- .../graph/testcase/ge_graph/ge_tensor_unittest.cc | 18 +--- tests/ut/ge/CMakeLists.txt | 1 + .../partition/dynamic_shape_partition_unittest.cc | 5 +- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 3 +- 11 files changed, 26 insertions(+), 154 deletions(-) diff --git a/cmake/external_libs/protobuf_shared.cmake b/cmake/external_libs/protobuf_shared.cmake index 6334c8a3..dfdb0606 100755 --- a/cmake/external_libs/protobuf_shared.cmake +++ b/cmake/external_libs/protobuf_shared.cmake @@ -11,14 +11,14 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.") endif() if (GE_PB_PKG) - set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz") + set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.13.0.tar.gz") else() if (ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz") - set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236") + set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz") + set(MD5 "f4489cb88922ad9c58cbe3308d59cee5") else() - set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz") - set(MD5 "3d9e32700639618a4d2d342c99d4507a") + set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz") + set(MD5 "1a6274bc4a65b55a6fa70e264d796490") endif () endif() @@ -58,7 +58,7 @@ target_include_directories(ascend_protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/ set(INSTALL_BASE_DIR "") set(INSTALL_LIBRARY_DIR lib) -install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.8.0.0 OPTIONAL +install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.13.0.0 OPTIONAL DESTINATION ${INSTALL_LIBRARY_DIR}) install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so OPTIONAL DESTINATION ${INSTALL_LIBRARY_DIR}) diff --git a/cmake/external_libs/protobuf_static.cmake b/cmake/external_libs/protobuf_static.cmake index 22f537cf..b8ff90bb 100755 --- a/cmake/external_libs/protobuf_static.cmake +++ b/cmake/external_libs/protobuf_static.cmake @@ -16,11 +16,11 @@ if(GE_PB_PKG) set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz") else() if (ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz") - set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236") + set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz") + set(MD5 "f4489cb88922ad9c58cbe3308d59cee5") else() - set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz") - set(MD5 "3d9e32700639618a4d2d342c99d4507a") + set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz") + set(MD5 "1a6274bc4a65b55a6fa70e264d796490") endif () endif() @@ -29,8 +29,6 @@ set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static) ExternalProject_Add(protobuf_static_build URL ${REQ_URL} - #URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz - #SOURCE_DIR ${METADEF_DIR}/../../third_party/protobuf/src/protobuf-3.8.0 TLS_VERIFY OFF CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} diff --git a/cmake/external_libs/protoc.cmake b/cmake/external_libs/protoc.cmake index 421f2632..f16f5e22 100755 --- a/cmake/external_libs/protoc.cmake +++ b/cmake/external_libs/protoc.cmake @@ -13,14 +13,14 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR endif() if(GE_PB_PKG) - set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz") + set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.13.0.tar.gz") else() if (ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz") - set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236") + set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz") + set(MD5 "f4489cb88922ad9c58cbe3308d59cee5") else() - set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz") - set(MD5 "3d9e32700639618a4d2d342c99d4507a") + set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz") + set(MD5 "1a6274bc4a65b55a6fa70e264d796490") endif () endif() @@ -28,8 +28,6 @@ set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fst set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") ExternalProject_Add(protoc_build URL ${REQ_URL} - #URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz - #SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0 TLS_VERIFY OFF CONFIGURE_COMMAND ${CMAKE_COMMAND} -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protoc /cmake BUILD_COMMAND $(MAKE) diff --git a/metadef b/metadef index b27915cd..c6030152 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit b27915cd37919430a61953f8998b7acce4a60177 +Subproject commit c6030152c6dc05515115765babb5d64fde649df4 diff --git a/parser b/parser index e75eda62..155d3262 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit e75eda62de2b51a0bded5481ca81eb8fc7bf376e +Subproject commit 155d3262ba17f800094abb58b6a809b041cf0a74 diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc index 5cf7569b..85328b27 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_graph_anchor_unittest.cc @@ -272,115 +272,3 @@ TEST_F(UtestGeAnchor, graph_utils_test) { EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_SUCCESS); EXPECT_EQ(GraphUtils::RemoveEdge(conv_node->GetOutDataAnchor(0), bn_node->GetInControlAnchor()), GRAPH_FAILED); } - -TEST_F(UtestGeAnchor, data_anchor_replace_peer) { - ComputeGraphPtr graph_ptr = std::make_shared("graph"); - OpDescPtr in_op_ptr = std::make_shared("in_op_1", "float"); - in_op_ptr->AddInputDesc("x1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddInputDesc("x2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddInputDesc("x3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - NodePtr node1 = graph_ptr->AddNode(in_op_ptr); - NodePtr node2 = graph_ptr->AddNode(in_op_ptr); - NodePtr node3 = graph_ptr->AddNode(in_op_ptr); - - OutDataAnchorPtr out_data_anchor = node1->GetOutDataAnchor(1); - InDataAnchorPtr in_data_anchor = node2->GetInDataAnchor(1); - EXPECT_EQ(out_data_anchor != nullptr, true); - EXPECT_EQ(in_data_anchor != nullptr, true); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(0)), GRAPH_SUCCESS); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(1)), GRAPH_SUCCESS); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(2)), GRAPH_SUCCESS); - - size_t out_idx = 0; - for (; out_idx < out_data_anchor->peer_anchors_.size(); out_idx++) { - if (out_data_anchor->peer_anchors_[out_idx].lock() == in_data_anchor) { - break; - } - } - EXPECT_EQ(out_idx, 1); - - size_t in_idx = 0; - for (; in_idx < in_data_anchor->peer_anchors_.size(); in_idx++) { - if (in_data_anchor->peer_anchors_[in_idx].lock() == out_data_anchor) { - break; - } - } - EXPECT_EQ(in_idx, 0); - - out_data_anchor->ReplacePeer(in_data_anchor, node3->GetInDataAnchor(1), node3->GetOutDataAnchor(1)); - - size_t out_idx1 = 0; - for (; out_idx1 < out_data_anchor->peer_anchors_.size(); out_idx1++) { - if (out_data_anchor->peer_anchors_[out_idx1].lock() == node3->GetInDataAnchor(1)) { - break; - } - } - EXPECT_EQ(out_idx1, out_idx); - - size_t in_idx1 = 0; - for (; in_idx1 < in_data_anchor->peer_anchors_.size(); in_idx1++) { - if (in_data_anchor->peer_anchors_[in_idx1].lock() == node3->GetOutDataAnchor(1)) { - break; - } - } - EXPECT_EQ(in_idx1, in_idx); -} - -TEST_F(UtestGeAnchor, graph_utils_insert_node) { - ComputeGraphPtr graph_ptr = std::make_shared("graph"); - OpDescPtr in_op_ptr = std::make_shared("in_op_1", "float"); - in_op_ptr->AddInputDesc("x1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddInputDesc("x2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddInputDesc("x3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y1", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y2", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - in_op_ptr->AddOutputDesc("y3", GeTensorDesc(GeShape({1, 32, 8, 8}), FORMAT_NCHW)); - NodePtr node1 = graph_ptr->AddNode(in_op_ptr); - NodePtr node2 = graph_ptr->AddNode(in_op_ptr); - NodePtr node3 = graph_ptr->AddNode(in_op_ptr); - - OutDataAnchorPtr out_data_anchor = node1->GetOutDataAnchor(1); - InDataAnchorPtr in_data_anchor = node2->GetInDataAnchor(1); - EXPECT_EQ(out_data_anchor != nullptr, true); - EXPECT_EQ(in_data_anchor != nullptr, true); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(0)), GRAPH_SUCCESS); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(1)), GRAPH_SUCCESS); - EXPECT_EQ(node1->GetOutDataAnchor(1)->LinkTo(node2->GetInDataAnchor(2)), GRAPH_SUCCESS); - - size_t out_idx = 0; - for (; out_idx < out_data_anchor->peer_anchors_.size(); out_idx++) { - if (out_data_anchor->peer_anchors_[out_idx].lock() == in_data_anchor) { - break; - } - } - EXPECT_EQ(out_idx, 1); - - size_t in_idx = 0; - for (; in_idx < in_data_anchor->peer_anchors_.size(); in_idx++) { - if (in_data_anchor->peer_anchors_[in_idx].lock() == out_data_anchor) { - break; - } - } - EXPECT_EQ(in_idx, 0); - - GraphUtils::InsertNodeBetweenDataAnchors(out_data_anchor, in_data_anchor, node3); - - size_t out_idx1 = 0; - for (; out_idx1 < out_data_anchor->peer_anchors_.size(); out_idx1++) { - if (out_data_anchor->peer_anchors_[out_idx1].lock() == node3->GetInDataAnchor(0)) { - break; - } - } - EXPECT_EQ(out_idx1, out_idx); - - size_t in_idx1 = 0; - for (; in_idx1 < in_data_anchor->peer_anchors_.size(); in_idx1++) { - if (in_data_anchor->peer_anchors_[in_idx1].lock() == node3->GetOutDataAnchor(0)) { - break; - } - } - EXPECT_EQ(in_idx1, in_idx); -} diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc index 0366446c..c91f68df 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_model_serialize_unittest.cc @@ -30,6 +30,7 @@ #include "graph/model_serialize.h" #include "graph/detail/model_serialize_imp.h" +#include "graph/node_impl.h" #include "graph/ge_attr_value.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" @@ -1062,7 +1063,7 @@ TEST(UtestGeModelSerialize, test_model_serialize_imp_invalid_param) { auto graph = std::make_shared("test_graph"); auto node = graph->AddNode(std::make_shared()); - node->op_ = nullptr; + node->impl_->op_ = nullptr; ge::proto::ModelDef model_def; Model model; model.SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph)); 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 aa43ac99..838df735 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 @@ -25,6 +25,7 @@ #include "graph/ge_attr_value.h" #include "graph/tensor.h" #include "graph/utils/tensor_utils.h" +#include "graph/ge_tensor_impl.h" #undef private #undef protected @@ -196,23 +197,6 @@ TEST_F(UtestGeTensor, test_shape_copy_move) { EXPECT_EQ(shape4.GetDimNum(), 3); } -TEST_F(UtestGeTensor, test_tensor_desc_invalid_null) { - GeTensorDesc tensor_desc(nullptr, nullptr); - EXPECT_EQ(tensor_desc.GetDataType(), DT_UNDEFINED); - EXPECT_EQ(tensor_desc.GetFormat(), FORMAT_RESERVED); - EXPECT_EQ(tensor_desc.MutableShape().shape_def_.GetProtoMsg(), nullptr); - - GeTensorDesc tensor_desc2; - EXPECT_EQ(tensor_desc2.GetDataType(), DT_FLOAT); - EXPECT_EQ(tensor_desc2.GetFormat(), FORMAT_ND); - - tensor_desc2.SetDataType(DT_DUAL_SUB_INT8); - EXPECT_EQ(tensor_desc2.GetDataType(), DT_DUAL_SUB_INT8); - - TensorUtils::SetWeightSize(tensor_desc, 100); - EXPECT_EQ(TensorUtils::GetWeightSize(tensor_desc), 0); -} - TEST_F(UtestGeTensor, test_tensor_invalid_null) { ProtoMsgOwner msg_owner; GeTensor tensor(msg_owner, nullptr); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 63579109..0d1ae079 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -121,6 +121,7 @@ set(GRAPH_SRC_FILES "${GE_CODE_DIR}/metadef/register/op_tiling.cpp" "${GE_CODE_DIR}/metadef/graph/utils/tuning_utils.cc" "${GE_CODE_DIR}/metadef/register/op_tiling_registry.cpp" + "${GE_CODE_DIR}/metadef/register/op_tiling_registry_impl.cpp" ) set(PARSER_SRC_FILES diff --git a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc index c8abadb5..ec1caebd 100644 --- a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc +++ b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc @@ -20,6 +20,7 @@ #define protected public #include "graph/partition/dynamic_shape_partition.h" #include "compute_graph.h" +#include "graph/compute_graph_impl.h" #include "inc/framework/common/types.h" #include "utils/graph_utils.h" #include "graph/debug/ge_attr_define.h" @@ -111,9 +112,9 @@ TEST_F(UtestDynamicShapePartition, merge_control_flow_group) { (void)AttrUtils::SetBool(merge->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); (void)AttrUtils::SetInt(merge->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3); - EXPECT_EQ(graph->sub_graph_.size(), 0); + EXPECT_EQ(graph->impl_->sub_graph_.size(), 0); DynamicShapePartitioner partitioner(graph); EXPECT_EQ(partitioner.Partition(), SUCCESS); - EXPECT_EQ(graph->sub_graph_.size(), 1); + EXPECT_EQ(graph->impl_->sub_graph_.size(), 1); } } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 7a2a5dfe..f6c75d50 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -40,6 +40,7 @@ #include "graph/types.h" #include "graph/utils/tensor_utils.h" #include "graph/testcase/ge_graph/graph_builder_utils.h" +#include "graph/op_desc_impl.h" #undef private #undef protected @@ -736,7 +737,7 @@ TEST_F(UtestGeHybrid, TestParseDependencies) { std::vector deps; deps.push_back("Data"); auto op_desc = netoutput->GetOpDesc(); - op_desc->input_name_idx_["Data"] = 0; + op_desc->impl_->input_name_idx_["Data"] = 0; auto data_desc = data->GetOpDesc(); auto tensor = std::make_shared(); auto tensor_desc = data_desc->MutableInputDesc(0); From fa1d5b78b6d9c2fa0729a75ba915728949311afc Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 06:47:47 +0800 Subject: [PATCH 012/226] fix coverity --- ge/graph/load/model_manager/model_manager.cc | 4 +++- ge/graph/load/model_manager/task_info/hccl_task_info.cc | 2 +- ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc | 2 +- ge/graph/load/model_manager/task_info/kernel_task_info.cc | 2 +- ge/graph/load/model_manager/zero_copy_offset.cc | 6 ++++-- ge/hybrid/model/hybrid_model_builder.cc | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 45540ba0..8b44daea 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -569,6 +569,7 @@ Status ModelManager::DataInputTensor(uint32_t model_id, const std::vector(cur_dynamic_dims.size() * sizeof(int32_t)); GE_CHK_BOOL_EXEC(memcpy_s(data.data, length, cur_dynamic_dims.data(), length) == EOK, REPORT_CALL_ERROR("E19999", "memcpy data failed, size:%u", length); + delete[] reinterpret_cast(data.data); return INTERNAL_ERROR, "[Memcpy][Data] failed, size:%u.", length); data.length = length; input_data.blobs.push_back(data); @@ -1790,7 +1791,8 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector &aicpu_op std::vector op_name; op_name.clear(); op_name.resize(kOpNameMaxSize); - GE_CHK_RT(rtMemcpy(op_name.data(), aicpu_info.opLen, reinterpret_cast(aicpu_info.opType), + GE_CHK_RT(rtMemcpy(op_name.data(), aicpu_info.opLen, + reinterpret_cast(static_cast(aicpu_info.opType)), aicpu_info.opLen, RT_MEMCPY_DEVICE_TO_HOST)); std::string kernel_type = (static_cast(aicpu_info.kernelsType) == TF_KERNEL) ? "TF_KERNEL" : "CPU_KERNEL"; diff --git a/ge/graph/load/model_manager/task_info/hccl_task_info.cc b/ge/graph/load/model_manager/task_info/hccl_task_info.cc index c3c5c8b7..a3cef836 100644 --- a/ge/graph/load/model_manager/task_info/hccl_task_info.cc +++ b/ge/graph/load/model_manager/task_info/hccl_task_info.cc @@ -329,7 +329,7 @@ void HcclTaskInfo::GetPrivateDefByTaskDef(const domi::TaskDef &task) { // Get privateDef and opsKernelStorePtr from taskDef and save them in taskInfo GELOGI("get custom info in modelTaskDef."); ops_kernel_store_ = nullptr; - void *ops_kernel_store_name_temp = reinterpret_cast(task.ops_kernel_store_ptr()); + void *ops_kernel_store_name_temp = reinterpret_cast(static_cast(task.ops_kernel_store_ptr())); if (ops_kernel_store_name_temp != nullptr) { ops_kernel_store_ = std::move(ops_kernel_store_name_temp); std::string private_def_temp = task.private_def(); diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc index a4b3de75..1257b192 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc @@ -420,7 +420,7 @@ Status KernelExTaskInfo::Distribute() { // xxxxxxxx xxxxxxxx xxxxxxxx xx10xxxx: HOST_ONLY // xxxxxxxx xxxxxxxx xxxxxxxx xx11xxxx: HOST_FIRST if (topic_type_flag_ > 0) { - dump_flag_ = dump_flag_ | topic_type_flag_; + dump_flag_ = dump_flag_ | static_cast(topic_type_flag_); } rtError_t rt_ret = rtKernelLaunchEx(kernel_buf_, kernel_buf_size_, dump_flag_, stream_); if (rt_ret != RT_ERROR_NONE) { diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_task_info.cc index 07ad63ca..e4514d55 100755 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.cc @@ -436,7 +436,7 @@ Status KernelTaskInfo::Distribute() { // xxxxxxxx xxxxxxxx xxxxxxxx xx01xxxx: DEVICE_FIRST // xxxxxxxx xxxxxxxx xxxxxxxx xx10xxxx: HOST_ONLY // xxxxxxxx xxxxxxxx xxxxxxxx xx11xxxx: HOST_FIRST - dump_flag_ = dump_flag_ | topic_type_flag_; + dump_flag_ = dump_flag_ | static_cast(topic_type_flag_); } GELOGI("distribute task info kernel_type %d, flag %d", kernel_type_, dump_flag_); // blockDim is reserved parameter, set to 1 diff --git a/ge/graph/load/model_manager/zero_copy_offset.cc b/ge/graph/load/model_manager/zero_copy_offset.cc index 4a57a899..2a0423c7 100644 --- a/ge/graph/load/model_manager/zero_copy_offset.cc +++ b/ge/graph/load/model_manager/zero_copy_offset.cc @@ -62,7 +62,8 @@ Status ZeroCopyOffset::InitInputDataInfo(int64_t output_size, void *virtual_addr for (size_t index = 0; index < zero_copy_basic_offset_.size(); ++index) { if (zero_copy_basic_offset_.at(index) == virtual_addr_offset) { out_count++; - uint64_t out_offset = reinterpret_cast(virtual_addr) + zero_copy_relative_offset_.at(index); + uint64_t out_offset = static_cast(reinterpret_cast(virtual_addr)) + + zero_copy_relative_offset_.at(index); data_info_.emplace_back(output_size, reinterpret_cast(static_cast(out_offset))); relative_offset_.emplace_back(zero_copy_relative_offset_.at(index)); GELOGI("[ZCPY] virtual_addr: %p has been l2-fusion to %lu, need copy data_size is %ld.", basic_addr_, @@ -117,7 +118,8 @@ Status ZeroCopyOffset::InitOutputDataInfo(const vector &input_size_list for (size_t index = 0; index < zero_copy_basic_offset_.size(); ++index) { if (zero_copy_basic_offset_.at(index) == virtual_addr_offset) { in_count++; - uint64_t in_offset = reinterpret_cast(virtual_addr_list[idx]) + zero_copy_relative_offset_.at(index); + uint64_t in_offset = static_cast(reinterpret_cast(virtual_addr_list[idx])) + + zero_copy_relative_offset_.at(index); int64_t real_data_size = ModelUtils::GetInputSize(op_desc).at(idx); data_info_.emplace_back(real_data_size, reinterpret_cast(static_cast(in_offset))); relative_offset_.emplace_back(zero_copy_relative_offset_.at(index)); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 554ddbbb..62e941eb 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -945,7 +945,7 @@ Status HybridModelBuilder::VarNodeToTensor(const NodePtr &var_node, std::unique_ } int64_t var_size = CalcVarSizeInBytes(*tensor_desc); - // var size is only for checking, will not allocate any memory by it + GE_CHECK_GE(var_size, 0); tensor.reset(new(std::nothrow)TensorValue(dev_mem, static_cast(var_size))); GE_CHECK_NOTNULL(tensor); GELOGI("Get var memory addr %p for node %s, size = %ld, mem_type=%u", dev_mem, var_name.c_str(), var_size, mem_type); From 84cb4ad61655e6867be8cddca024f1890cedc5ce Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 17:36:52 +0800 Subject: [PATCH 013/226] fix --- .../formats/format_transfers/format_transfer_fractal_nz.cc | 4 ++++ .../formats/format_transfers/format_transfer_fractal_zz.cc | 4 ++++ .../node_executor/compiledsubgraph/known_node_executor.cc | 11 +++-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc index 24be6023..798ec55a 100755 --- a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc @@ -185,6 +185,7 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con auto src_offset = (src_h_head + w1_idx * w0) * size; auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { @@ -202,6 +203,7 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con auto src_offset = (src_h_head + src_w_idx) * size; auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { @@ -267,6 +269,7 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con auto dst_offset = (dst_h_head + w1_idx * w0) * size; auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { @@ -285,6 +288,7 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con auto dst_offset = (dst_h_head + dst_w_idx) * size; auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc b/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc index 1cb142b3..14315084 100755 --- a/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc @@ -193,6 +193,7 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { @@ -213,6 +214,7 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { @@ -284,6 +286,7 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { @@ -304,6 +307,7 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 8b3c691f..b4e26332 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -260,11 +260,8 @@ Status KnownNodeExecutor::ParseAttrForAllocatingOutputs(NodeItem &node_item, Com GE_CHECK_NOTNULL(op_desc); auto src_op_type = src_node->GetType(); auto output_index = in_data_anchor->GetIdx(); - GELOGD("Node %s, output %d, src node = %s, src node type = %s", - node_item.NodeName().c_str(), - output_index, - src_node->GetName().c_str(), - src_op_type.c_str()); + GELOGD("Node %s, output %d, src node = %s, src node type = %s", node_item.NodeName().c_str(), output_index, + src_node->GetName().c_str(), src_op_type.c_str()); // parse reuse outputs std::string input_key = std::to_string(op_desc->GetId()) + "_" + std::to_string(out_data_anchor->GetIdx()); auto it = connected_inputs.find(input_key); @@ -285,9 +282,7 @@ Status KnownNodeExecutor::ParseAttrForAllocatingOutputs(NodeItem &node_item, Com GELOGD("[%s] output[%u] reuses input[%d]", node_item.NodeName().c_str(), output_index, data_index); } else if (src_op_type == CONSTANTOP || src_op_type == CONSTANT || src_op_type == VARIABLE) { node_item.ref_outputs.emplace(output_index, src_node); - GELOGD("[%s] output[%d] ref to node [%s]", - node_item.NodeName().c_str(), - output_index, + GELOGD("[%s] output[%d] ref to node [%s]", node_item.NodeName().c_str(), output_index, src_node->GetName().c_str()); } } From 16c5ba59006b40a1fd7f0c1fa9a23fa42bd78117 Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 18:20:07 +0800 Subject: [PATCH 014/226] add --- ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc | 1 + ge/common/formats/format_transfers/format_transfer_fractal_nz.cc | 2 +- ge/common/formats/format_transfers/format_transfer_fractal_z.cc | 3 +++ ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc | 1 + ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc | 1 + ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc | 1 + ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc | 1 + ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc | 1 + ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc | 1 + ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc | 1 + ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc | 1 + ge/common/formats/format_transfers/format_transfer_transpose.cc | 1 + 12 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc b/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc index ce271c6d..aae95584 100644 --- a/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc +++ b/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc @@ -123,6 +123,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc index 798ec55a..4f597e32 100755 --- a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc @@ -59,7 +59,7 @@ bool CheckShape(Format format, const ShapeVector &shape) { return CheckShapeValid(shape, kDimSize4D); default: std::string error = "Trans format between " + FmtToStr(TypeUtils::FormatToSerialString(format)) + - " and FORMAT_FRACTAL_NZ is not supported."; + " and FORMAT_FRACTAL_NZ is not supported."; GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_FORMAT_INVALID, error.c_str()); return false; } diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc index 38125979..882a2a68 100644 --- a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc @@ -226,6 +226,7 @@ Status TransFormatFromNchwToFz(const TransArgs &args, TransResult &result) { auto protected_size = dst_size - offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); errno_t ret = EOK; if (need_pad_zero) { ret = memset_s(dst.get() + offset, static_cast(protected_size), 0, static_cast(size)); @@ -390,6 +391,7 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) { auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto pad_zero = ((c1i * c0 + c0i) >= c) || (n1n0i >= n); errno_t ret = EOK; if (pad_zero) { @@ -474,6 +476,7 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) { auto protected_size = dst_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto pad_zero = ((c1i * c0 + c0i) >= c) || (n1n0i >= n); errno_t ret = EOK; if (pad_zero) { diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc index f6af7534..abe6263b 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc @@ -128,6 +128,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto dst_offset = dst_idx * size; auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc b/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc index aaeca490..58073397 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc @@ -130,6 +130,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto dst_offset = dst_idx * size; auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc b/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc index 1e71ea09..3122f137 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc @@ -128,6 +128,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size auto dst_offset = dst_idx * size; auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { 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 cb7f889b..c597cde0 100755 --- a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc @@ -149,6 +149,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); int64_t c_idx = c0_idx + c1_idx * c0; int64_t src_idx = h_idx * wcn + w_idx * cn + c_idx * n + n_idx; auto src_offset = src_idx * size; diff --git a/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc b/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc index 09ff45d9..c442bee9 100755 --- a/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc +++ b/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc @@ -129,6 +129,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc b/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc index e9e41cd1..603ddffa 100755 --- a/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc +++ b/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc @@ -129,6 +129,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { diff --git a/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc b/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc index ea2b1d7f..5cab311d 100755 --- a/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc @@ -144,6 +144,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); int64_t cIdx = c0_idx + c1_idx * c0; int64_t srcIdx = n_idx * chw + cIdx * hw + h_idx * w + w_idx; auto src_offset = srcIdx * size; diff --git a/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc b/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc index 518790b6..939c967c 100755 --- a/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc @@ -149,6 +149,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in auto protected_size = total_size - dst_offset < static_cast(SECUREC_MEM_MAX_LEN) ? total_size - dst_offset : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); int64_t c_idx = c0_idx + c1_idx * c0; int64_t src_idx = n_idx * hwc + h_idx * wc + w_idx * c + c_idx; auto src_offset = src_idx * size; diff --git a/ge/common/formats/format_transfers/format_transfer_transpose.cc b/ge/common/formats/format_transfers/format_transfer_transpose.cc index 54c5444b..9a4d3fd6 100755 --- a/ge/common/formats/format_transfers/format_transfer_transpose.cc +++ b/ge/common/formats/format_transfers/format_transfer_transpose.cc @@ -171,6 +171,7 @@ Status Transpose(const uint8_t *src, const std::vector &src_shape, Data auto protected_size = dst_size - dst_offset_bytes < static_cast(SECUREC_MEM_MAX_LEN) ? dst_size - dst_offset_bytes : static_cast(SECUREC_MEM_MAX_LEN); + GE_CHECK_GE(protected_size, 0); auto ret = memcpy_s(dst.get() + dst_offset_bytes, static_cast(protected_size), src + src_offset, static_cast(data_size)); if (ret != EOK) { From 92c6de14f384d4f81e4129a5aa2d7b202be7647b Mon Sep 17 00:00:00 2001 From: wjm Date: Fri, 11 Jun 2021 18:21:39 +0800 Subject: [PATCH 015/226] add --- .../node_executor/compiledsubgraph/known_node_executor.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index b4e26332..8b3c691f 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -260,8 +260,11 @@ Status KnownNodeExecutor::ParseAttrForAllocatingOutputs(NodeItem &node_item, Com GE_CHECK_NOTNULL(op_desc); auto src_op_type = src_node->GetType(); auto output_index = in_data_anchor->GetIdx(); - GELOGD("Node %s, output %d, src node = %s, src node type = %s", node_item.NodeName().c_str(), output_index, - src_node->GetName().c_str(), src_op_type.c_str()); + GELOGD("Node %s, output %d, src node = %s, src node type = %s", + node_item.NodeName().c_str(), + output_index, + src_node->GetName().c_str(), + src_op_type.c_str()); // parse reuse outputs std::string input_key = std::to_string(op_desc->GetId()) + "_" + std::to_string(out_data_anchor->GetIdx()); auto it = connected_inputs.find(input_key); @@ -282,7 +285,9 @@ Status KnownNodeExecutor::ParseAttrForAllocatingOutputs(NodeItem &node_item, Com GELOGD("[%s] output[%u] reuses input[%d]", node_item.NodeName().c_str(), output_index, data_index); } else if (src_op_type == CONSTANTOP || src_op_type == CONSTANT || src_op_type == VARIABLE) { node_item.ref_outputs.emplace(output_index, src_node); - GELOGD("[%s] output[%d] ref to node [%s]", node_item.NodeName().c_str(), output_index, + GELOGD("[%s] output[%d] ref to node [%s]", + node_item.NodeName().c_str(), + output_index, src_node->GetName().c_str()); } } From bdee8d1e058bd29ec778b90cc8fd7a3da8675e0d Mon Sep 17 00:00:00 2001 From: wjm Date: Sat, 12 Jun 2021 05:43:45 +0800 Subject: [PATCH 016/226] fix --- .../format_transfers/format_transfer_fracz_hwcn.cc | 16 +++++----- ge/common/helper/model_cache_helper.cc | 7 +++++ ge/hybrid/node_executor/hccl/hccl_node_executor.cc | 34 ++++++++++++---------- 3 files changed, 33 insertions(+), 24 deletions(-) mode change 100755 => 100644 ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc old mode 100755 new mode 100644 index abe6263b..ed3a062c --- a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc @@ -17,6 +17,7 @@ #include "common/formats/format_transfers/format_transfer_fracz_hwcn.h" #include + #include #include "common/formats/utils/formats_definitions.h" @@ -35,8 +36,8 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { auto dst_shape = args.dst_shape; if (args.src_format != FORMAT_FRACTAL_Z || args.dst_format != FORMAT_HWCN) { std::string error = "Dose not support trans format from " + - FmtToStr(TypeUtils::FormatToSerialString(args.src_format)) + " to " + - FmtToStr(TypeUtils::FormatToSerialString(args.dst_format)); + FmtToStr(TypeUtils::FormatToSerialString(args.src_format)) + " to " + + FmtToStr(TypeUtils::FormatToSerialString(args.dst_format)); GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_FORMAT_INVALID, error.c_str()); return ACL_ERROR_GE_FORMAT_INVALID; } @@ -52,15 +53,13 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { if (!CheckShapeValid(src_shape, kFracZDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s", ShapeToString(src_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Src shape %s check invalid", - ShapeToString(src_shape).c_str()); + REPORT_CALL_ERROR("E19999", "Src shape %s check invalid", ShapeToString(src_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid", - ShapeToString(dst_shape).c_str()); + REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } int64_t c0 = GetCubeSizeByDataType(args.src_data_type); @@ -71,9 +70,8 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { int64_t n0 = Ceil(dst_shape.at(kHwcnN), static_cast(kNiSize)); if (src_shape.at(kFracZHWC1) != dst_shape.at(kHwcnH) * dst_shape.at(kHwcnW) * c1 || src_shape.at(kFracZC0) != c0 || src_shape.at(kFracZNi) != kNiSize || src_shape.at(kFracZN0) != n0) { - std::string error = "Failed to check relationship between src shape" + - FmtToStr(ShapeToString(src_shape)) + " and dst shape" + - FmtToStr(ShapeToString(dst_shape)); + std::string error = "Failed to check relationship between src shape" + FmtToStr(ShapeToString(src_shape)) + + " and dst shape" + FmtToStr(ShapeToString(dst_shape)); GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc index 9cd88ef1..0e6c6329 100755 --- a/ge/common/helper/model_cache_helper.cc +++ b/ge/common/helper/model_cache_helper.cc @@ -1679,6 +1679,13 @@ Status ModelCacheHelper::LoadOmModelFromCache(GeModelPtr &ge_model) const { GELOGW("LoadOmModelFromCache: Load model from file failed. ret = %u", ret); return ret; } + std::function callback = [&]() { + if (model_data.model_data != nullptr) { + delete[] reinterpret_cast(model_data.model_data); + model_data.model_data = nullptr; + } + }; + GE_MAKE_GUARD(release, callback); ModelHelper model_helper; ret = model_helper.LoadModel(model_data); diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc index 31f2c7a1..6be9849c 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc @@ -15,15 +15,16 @@ */ #include "hybrid/node_executor/hccl/hccl_node_executor.h" + #include "common/ge/plugin_manager.h" #include "common/math/math_util.h" #include "external/graph/attr_value.h" +#include "external/graph/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/util/hcom_util.h" #include "graph/utils/type_utils.h" -#include "external/graph/types.h" -#include "hybrid/executor/hybrid_execution_context.h" #include "hccl/hcom.h" +#include "hybrid/executor/hybrid_execution_context.h" #include "runtime/event.h" namespace ge { @@ -267,14 +268,16 @@ Status RdmaNodeTask::ExtractTensor(TaskContext &context, vector do } Status BuildAllToAllVparams(TaskContext &context, HcomAllToAllVParams ¶ms) { - void **input_addrs[kAllToAllVInputNums] = {¶ms.sendbuf, ¶ms.sendcounts, ¶ms.sdispls, - ¶ms.recvcounts, ¶ms.rdispls}; + void **input_addrs[kAllToAllVInputNums] = {¶ms.sendbuf, ¶ms.sendcounts, ¶ms.sdispls, ¶ms.recvcounts, + ¶ms.rdispls}; for (size_t i = 0; i < kAllToAllVInputNums; ++i) { auto addr = context.MutableInput(i); GE_CHECK_NOTNULL(addr); @@ -383,13 +386,14 @@ Status BuildAllToAllVparams(TaskContext &context, HcomAllToAllVParams ¶ms) { } params.sendtype = iter->second; params.recvtype = iter->second; + params.group = nullptr; return SUCCESS; } Status BuildGatherAllToAllParams(TaskContext &context, HcomGatherAllToAllVParams ¶ms) { - void **input_addrs[kGatherAllToAllVInputNums] = {¶ms.addrInfo, ¶ms.addrInfoCountPerRank, - ¶ms.recvcounts, ¶ms.rdispls}; + void **input_addrs[kGatherAllToAllVInputNums] = {¶ms.addrInfo, ¶ms.addrInfoCountPerRank, ¶ms.recvcounts, + ¶ms.rdispls}; for (size_t i = 0; i < kGatherAllToAllVInputNums; ++i) { auto addr = context.MutableInput(i); GE_CHECK_NOTNULL(addr); @@ -418,8 +422,9 @@ Status BuildGatherAllToAllParams(TaskContext &context, HcomGatherAllToAllVParams params.recvtype = iter->second; int64_t addr_len = 0; - (void) ge::AttrUtils::GetInt(op_desc, "addr_length", addr_len); + (void)ge::AttrUtils::GetInt(op_desc, "addr_length", addr_len); params.addrLength = static_cast(addr_len); + params.group = nullptr; return SUCCESS; } @@ -428,7 +433,7 @@ Status AllToAllNodeTask::ExecuteAsync(TaskContext &context, std::functionGetNodeName()); p_ctx->SetStatus(FAILED); @@ -460,7 +465,6 @@ Status AllToAllNodeTask::ExecuteAsync(TaskContext &context, std::function Date: Sun, 13 Jun 2021 19:44:48 +0800 Subject: [PATCH 017/226] Optimize performance of single_op executor. --- ge/hybrid/executor/hybrid_model_executor.cc | 14 ++++---- ge/hybrid/executor/hybrid_model_executor.h | 3 +- ge/single_op/single_op_model.cc | 38 +++++++++++++++++++++- .../hybrid_model_async_executor_unittest.cc | 5 ++- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 1 + 5 files changed, 49 insertions(+), 12 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index d8939175..b3c2c471 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -41,6 +41,8 @@ HybridModelExecutor::~HybridModelExecutor() { Status HybridModelExecutor::Init() { GELOGD("Start to init HybridGraphEngine."); GE_CHK_STATUS_RET_NOLOG(InitExecutionContext()); + root_graph_executor_.reset(new (std::nothrow) SubgraphExecutor(model_->GetRootGraphItem(), &context_)); + GE_CHECK_NOTNULL(root_graph_executor_); GELOGD("HybridGraphEngine initialized successfully."); return SUCCESS; } @@ -60,8 +62,7 @@ Status HybridModelExecutor::Execute(HybridModelExecutor::ExecuteArgs &args) { GE_CHK_RT_RET(rtMemcpyAsync(context_.global_step, sizeof(uint64_t), &context_.iteration, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE_EX, context_.stream)); } - SubgraphExecutor executor(model_->GetRootGraphItem(), &context_); - auto ret = ExecuteGraphInternal(executor, args); + auto ret = ExecuteGraphInternal(args); Cleanup(); RECORD_MODEL_EXECUTION_EVENT(&context_, "[Cleanup] End"); GELOGD("Model executed successfully."); @@ -79,8 +80,7 @@ Status HybridModelExecutor::Execute(HybridModelExecutor::ExecuteArgs &args) { return SUCCESS; } -Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, - HybridModelExecutor::ExecuteArgs &args) { +Status HybridModelExecutor::ExecuteGraphInternal(HybridModelExecutor::ExecuteArgs &args) { RECORD_MODEL_EXECUTION_EVENT(&context_, "[InitContext] Start"); GE_CHK_STATUS_RET_NOLOG(ResetExecutionContext(context_)); RECORD_MODEL_EXECUTION_EVENT(&context_, "[InitContext] End"); @@ -94,7 +94,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, GE_CHK_STATUS_RET_NOLOG(prof_mgr.ProfileStepInfo(index_id, model_id, 0, stream_, device_id)); } - HYBRID_CHK_STATUS_RET(executor.ExecuteAsync(args.inputs, args.input_desc, args.outputs), + HYBRID_CHK_STATUS_RET(root_graph_executor_->ExecuteAsync(args.inputs, args.input_desc, args.outputs), "Failed to execute partitioned call."); RECORD_MODEL_EXECUTION_EVENT(&context_, "[ExecuteAsync] End"); @@ -103,7 +103,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, } if (!model_->IsSingleOp()) { - Status ret = executor.Synchronize(); + Status ret = root_graph_executor_->Synchronize(); if (ret != ge::SUCCESS) { auto model_manager = ModelManager::GetInstance(); GE_CHECK_NOTNULL(model_manager); @@ -123,7 +123,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, } args.outputs.clear(); - HYBRID_CHK_STATUS_RET(executor.GetOutputs(args.outputs, args.output_desc), "Failed to get outputs"); + HYBRID_CHK_STATUS_RET(root_graph_executor_->GetOutputs(args.outputs, args.output_desc), "Failed to get outputs"); RECORD_MODEL_EXECUTION_EVENT(&context_, "[GetOutput] End"); return SUCCESS; } diff --git a/ge/hybrid/executor/hybrid_model_executor.h b/ge/hybrid/executor/hybrid_model_executor.h index 566043d9..102e4f8b 100644 --- a/ge/hybrid/executor/hybrid_model_executor.h +++ b/ge/hybrid/executor/hybrid_model_executor.h @@ -48,7 +48,7 @@ class HybridModelExecutor { Status Execute(ExecuteArgs &args); private: - Status ExecuteGraphInternal(SubgraphExecutor &executor, ExecuteArgs &args); + Status ExecuteGraphInternal(ExecuteArgs &args); Status Cleanup(); Status InitExecutionContext(); static Status ResetExecutionContext(GraphExecutionContext &context); @@ -58,6 +58,7 @@ class HybridModelExecutor { uint32_t device_id_; rtStream_t stream_; GraphExecutionContext context_; + std::unique_ptr root_graph_executor_; }; } // namespace hybrid } // namespace ge diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 67642f2e..3c0f7972 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -44,20 +44,56 @@ using std::vector; namespace ge { namespace { const size_t kDataOutputNum = 1; +const uint32_t kInputIndexOfData = 0; const uint32_t kOutputIndexOfData = 0; constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; +Status CheckHostMem(const std::vector &dependencies, const NodePtr &node, bool &flag) { + for (const auto &input_name : dependencies) { + auto op_desc = node->GetOpDesc(); + int input_index = op_desc->GetInputIndexByName(input_name); + if (input_index < 0) { + GELOGE(INTERNAL_ERROR, "[Get][InputIndex]failed, node:[%s] inputname: %s.", + node->GetName().c_str(), input_name.c_str()); + REPORT_CALL_ERROR("E19999", "GetInputIndexByName failed, node:[%s] inputname: %s.", + node->GetName().c_str(), input_name.c_str()); + return INTERNAL_ERROR; + } + + const auto &in_anchor = node->GetInDataAnchor(input_index); + GE_CHECK_NOTNULL(in_anchor); + const auto &peer_out_anchor = in_anchor->GetPeerOutAnchor(); + GE_CHECK_NOTNULL(peer_out_anchor); + const auto &src_node = peer_out_anchor->GetOwnerNode(); + GE_CHECK_NOTNULL(src_node); + auto src_op_desc = src_node->GetOpDesc(); + GE_CHECK_NOTNULL(src_op_desc); + if (src_op_desc->GetType() == DATA) { + auto tensor = src_op_desc->MutableInputDesc(kInputIndexOfData); + if (AttrUtils::HasAttr(tensor, ATTR_NAME_VALUE)) { + GELOGD("Get hostmem from node %s, inputname: %s.", src_node->GetName().c_str(), input_name.c_str()); + continue; + } + } + flag = false; + return SUCCESS; + } + flag = true; + return SUCCESS; +} + Status IfInferDepend(GeModelPtr &ge_model, bool &flag) { auto comp_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); GE_CHECK_NOTNULL(comp_graph); for (const auto &node : comp_graph->GetAllNodes()) { + GE_CHECK_NOTNULL(node); auto op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); const auto &depends = op_desc->GetOpInferDepends(); bool support_dynamic_shape = false; (void)AttrUtils::GetBool(op_desc, kAttrSupportDynamicShape, support_dynamic_shape); if (!depends.empty() && support_dynamic_shape) { - flag = true; + CheckHostMem(depends, node, flag); return SUCCESS; } } diff --git a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc index d2679439..52537ee2 100644 --- a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc @@ -92,16 +92,15 @@ TEST_F(UtestHybridModelAsyncExecutor, Test_execute_internal) { GeRootModelPtr ge_root_model = make_shared(graph); ge_root_model->SetModelName("test_name"); HybridModel hybrid_model(ge_root_model); + hybrid_model.root_graph_item_.reset(new GraphItem); HybridModelExecutor executor(&hybrid_model, 0, nullptr); ASSERT_EQ(executor.Init(), SUCCESS); auto &context = executor.context_; - GraphItem graph_item; - SubgraphExecutor subgraph_executor(&graph_item, &context); HybridModelExecutor::ExecuteArgs args; std::pair> eof_entry; eof_entry.first = nullptr; context.callback_manager->callback_queue_.Push(eof_entry); - ASSERT_EQ(executor.ExecuteGraphInternal(subgraph_executor, args), SUCCESS); + ASSERT_EQ(executor.ExecuteGraphInternal(args), SUCCESS); } } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 7a2a5dfe..088aec50 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -330,6 +330,7 @@ TEST_F(UtestGeHybrid, hybrid_model_executor) { ComputeGraphPtr compute_graph = MakeShared("abc"); GeRootModelPtr root_model = MakeShared(compute_graph); HybridModel model(root_model); + model.root_graph_item_.reset(new GraphItem); HybridModel *model_ptr = &model; uint32_t device_id = 0; From 13c98395e2c7c578375780afa4884887018d49a0 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 14 Jun 2021 20:09:00 +0800 Subject: [PATCH 018/226] Add ut. --- tests/ut/ge/single_op/single_op_model_unittest.cc | 33 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index a2c1cb02..1cb2b22c 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -17,12 +17,11 @@ #include #include +#define protected public +#define private public #include "graph/load/model_manager/model_utils.h" #include "graph/utils/graph_utils.h" #include "runtime/rt.h" - -#define protected public -#define private public #include "single_op/single_op_model.h" #include "single_op/task/tbe_task_builder.h" #include "single_op/task/rts_kernel_task_builder.h" @@ -30,14 +29,18 @@ #include "framework/common/helper/model_helper.h" #include "single_op/single_op.h" #include "single_op/stream_resource.h" +#include "graph/passes/graph_builder_utils.h" #undef private #undef protected -#include "graph/passes/graph_builder_utils.h" using namespace std; using namespace testing; using namespace ge; +namespace { +constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; +} // namespace + class UtestSingleOpModel : public testing::Test { protected: void SetUp() {} @@ -208,12 +211,28 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { model.model_helper_.model_ = ge::MakeShared(); // make graph - auto compute_graph = make_shared("graph"); - auto data_op = make_shared("Data", DATA); - auto data_node = compute_graph->AddNode(data_op); + ut::GraphBuilder builder = ut::GraphBuilder("graph"); + auto data = builder.AddNode("Data", "Data", 0, 1); + auto transdata = builder.AddNode("Transdata", "Transdata", 1, 1); + auto netoutput = builder.AddNode("Netoutput", "NetOutput", 1, 0); + builder.AddDataEdge(data, 0, transdata, 0); + builder.AddDataEdge(transdata, 0, netoutput, 0); + auto compute_graph = builder.GetGraph(); + auto graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); model.model_helper_.model_->SetGraph(graph); + auto op_desc = transdata->GetOpDesc(); + op_desc->input_name_idx_["Data"] = 0; + const vector depend_names = { "Data" }; + op_desc->SetOpInferDepends(depend_names); + (void)AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); + + auto tensor = std::make_shared(); + auto data_desc = data->GetOpDesc(); + auto tensor_desc = data_desc->MutableInputDesc(0); + AttrUtils::SetTensor(tensor_desc, "_value", tensor); + // set task_def auto model_task_def = make_shared(); domi::TaskDef *task_def = model_task_def->add_task(); From 1ab9ae32dc4520be393242297ce900beeb9d2564 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 10:00:19 +0800 Subject: [PATCH 019/226] Add ut. --- ge/single_op/single_op_model.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 3c0f7972..4a7638b1 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -48,7 +48,7 @@ const uint32_t kInputIndexOfData = 0; const uint32_t kOutputIndexOfData = 0; constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; -Status CheckHostMem(const std::vector &dependencies, const NodePtr &node, bool &flag) { +Status CheckHostMem(const std::vector &dependencies, const NodePtr &node, bool &is_host_mem) { for (const auto &input_name : dependencies) { auto op_desc = node->GetOpDesc(); int input_index = op_desc->GetInputIndexByName(input_name); @@ -75,14 +75,14 @@ Status CheckHostMem(const std::vector &dependencies, const NodePtr &node continue; } } - flag = false; + is_host_mem = false; return SUCCESS; } - flag = true; + is_host_mem = true; return SUCCESS; } -Status IfInferDepend(GeModelPtr &ge_model, bool &flag) { +Status CheckInferDepend(GeModelPtr &ge_model, bool &is_infer_depend, bool &is_host_mem) { auto comp_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); GE_CHECK_NOTNULL(comp_graph); for (const auto &node : comp_graph->GetAllNodes()) { @@ -93,16 +93,18 @@ Status IfInferDepend(GeModelPtr &ge_model, bool &flag) { bool support_dynamic_shape = false; (void)AttrUtils::GetBool(op_desc, kAttrSupportDynamicShape, support_dynamic_shape); if (!depends.empty() && support_dynamic_shape) { - CheckHostMem(depends, node, flag); - return SUCCESS; + is_infer_depend = true; + return CheckHostMem(depends, node, is_host_mem); } } return SUCCESS; } Status NeedHybridModel(GeModelPtr &ge_model, bool &flag) { - bool infer_depend_flag = false; - GE_CHK_STATUS_RET(IfInferDepend(ge_model, infer_depend_flag), "[Check][InferDepend] failed."); + bool is_infer_depend = false; + bool is_host_mem = false; + GE_CHK_STATUS_RET(CheckInferDepend(ge_model, is_infer_depend, is_host_mem), "[Check][InferDepend] failed."); + bool need_d2h_cpy = is_infer_depend && !is_host_mem; auto tasks = ge_model->GetModelTaskDefPtr()->task(); int32_t kernel_task_num = 0; for (int i = 0; i < tasks.size(); ++i) { @@ -112,7 +114,7 @@ Status NeedHybridModel(GeModelPtr &ge_model, bool &flag) { tasks[i].kernel_with_handle().context(); auto kernel_type = static_cast(context.kernel_type()); if (kernel_type == ccKernelType::TE) { - if (infer_depend_flag) { + if (need_d2h_cpy) { flag = true; return SUCCESS; } @@ -553,7 +555,8 @@ Status SingleOpModel::BuildOp(StreamResource &resource, SingleOp &single_op) { auto ge_model = model_helper_.GetGeModel(); GE_CHECK_NOTNULL(ge_model); bool infer_depend_flag = false; - GE_CHK_STATUS_RET(IfInferDepend(ge_model, infer_depend_flag), "[Check][InferDepend] failed."); + bool is_host_mem = false; + GE_CHK_STATUS_RET(CheckInferDepend(ge_model, infer_depend_flag, is_host_mem)), "[Check][InferDepend] failed."); if (infer_depend_flag) { // construct single_op, do single op with HybridModelExecutor GELOGD("Init hybrid model params of single op, and will do execute with hybrid model executor."); From b35412f5eaa40705adc2bdd014d62ebc32a0f898 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 10:07:43 +0800 Subject: [PATCH 020/226] Add ut. --- ge/single_op/single_op_model.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 4a7638b1..182d1466 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -556,7 +556,7 @@ Status SingleOpModel::BuildOp(StreamResource &resource, SingleOp &single_op) { GE_CHECK_NOTNULL(ge_model); bool infer_depend_flag = false; bool is_host_mem = false; - GE_CHK_STATUS_RET(CheckInferDepend(ge_model, infer_depend_flag, is_host_mem)), "[Check][InferDepend] failed."); + GE_CHK_STATUS_RET(CheckInferDepend(ge_model, infer_depend_flag, is_host_mem), "[Check][InferDepend] failed."); if (infer_depend_flag) { // construct single_op, do single op with HybridModelExecutor GELOGD("Init hybrid model params of single op, and will do execute with hybrid model executor."); From e85bbe218143a8e02ab17884da223447a11a440e Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 12 Jun 2021 12:00:01 +0800 Subject: [PATCH 021/226] Fix dynamic shape partition --- ge/graph/common/omg_util.cc | 15 -- ge/graph/common/omg_util.h | 9 - ge/graph/partition/dynamic_shape_partition.cc | 23 ++- ge/graph/partition/dynamic_shape_partition.h | 2 +- .../passes/mark_force_unknown_for_cond_pass.cc | 38 +--- ge/graph/passes/mark_graph_unknown_status_pass.cc | 6 + ge/graph/passes/merge_to_stream_merge_pass.cc | 5 +- ge/graph/passes/next_iteration_pass.cc | 10 +- ge/graph/passes/switch_to_stream_switch_pass.cc | 16 +- ge/hybrid/executor/node_state.cc | 57 +++++- ge/hybrid/executor/node_state.h | 4 + ge/hybrid/executor/subgraph_context.cc | 2 +- ge/hybrid/executor/subgraph_context.h | 4 +- ge/hybrid/executor/subgraph_executor.cc | 18 +- ge/hybrid/executor/subgraph_executor.h | 1 - ge/hybrid/model/node_item.cc | 5 +- ge/hybrid/model/node_item.h | 5 +- ge/hybrid/node_executor/task_context.cc | 17 +- ge/hybrid/node_executor/task_context.h | 4 +- .../partition/dynamic_shape_partition_unittest.cc | 194 ++++++++++++++++----- .../executor/worker/execution_engine_unittest.cc | 8 +- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 8 +- .../ge_local/ge_local_node_executor_unittest.cc | 5 - .../node_executor/rts/rts_node_task_unittest.cc | 40 ----- 24 files changed, 283 insertions(+), 213 deletions(-) diff --git a/ge/graph/common/omg_util.cc b/ge/graph/common/omg_util.cc index 52e6cb9c..b2017e4d 100644 --- a/ge/graph/common/omg_util.cc +++ b/ge/graph/common/omg_util.cc @@ -275,21 +275,6 @@ bool IsUnknownShapeTensor(const GeTensorDesc &tensor_desc) { } /// -/// @brief Set Op _force_unknown_shape flag -/// @param [in] node -/// @param [in] force_unknown, set attribute if true -/// @param [in] group_index, condition group index of node. -/// @return -/// -void MarkForceUnknownShape(const NodePtr &node, bool force_unknown, int64_t group_index) { - if (!force_unknown) { - return; - } - - SetControlFlowGroup(node, group_index); -} - -/// /// @brief Set Op _control_flow_group flag /// @param [in] node /// @param [in] group, condition group index of node. diff --git a/ge/graph/common/omg_util.h b/ge/graph/common/omg_util.h index 148e4102..edaafa45 100644 --- a/ge/graph/common/omg_util.h +++ b/ge/graph/common/omg_util.h @@ -126,15 +126,6 @@ Status GetMemorySize(const NodePtr &node, int64_t &output_size); bool IsUnknownShapeTensor(const GeTensorDesc &tensor_desc); /// -/// @brief Set Op _force_unknown_shape flag -/// @param [in] node -/// @param [in] force_unknown, set attribute if true -/// @param [in] group_index, condition group index of node. -/// @return -/// -void MarkForceUnknownShape(const NodePtr &node, bool force_unknown, int64_t group_index); - -/// /// @brief Set Op _control_flow_group flag /// @param [in] node /// @param [in] group, condition group index of node. diff --git a/ge/graph/partition/dynamic_shape_partition.cc b/ge/graph/partition/dynamic_shape_partition.cc index 055b2aa4..1db47498 100755 --- a/ge/graph/partition/dynamic_shape_partition.cc +++ b/ge/graph/partition/dynamic_shape_partition.cc @@ -364,6 +364,7 @@ static std::string ToString(const std::vector &clusters) { } void DynamicShapePartitioner::MergeClustersControlFlow() { + std::unordered_set all_merged_clusters; for (const auto &item : control_clusters_) { const auto &control_cluster = item.second; auto rit = control_cluster.rbegin(); @@ -373,17 +374,32 @@ void DynamicShapePartitioner::MergeClustersControlFlow() { } const auto &cluster = *rit; + if (all_merged_clusters.count(cluster) > 0) { + continue; + } + + bool is_unknown_cluster = cluster->IsUnknownShape(); for (++rit; rit != control_cluster.rend(); ++rit) { const auto &cluster_from = *rit; + if (all_merged_clusters.count(cluster_from) > 0) { + continue; + } + auto merged_clusters = cluster->MergeAllPathFrom(cluster_from); GELOGD("Merge all path cluster from %lu to %lu %s.", cluster_from->Id(), cluster->Id(), ToString(merged_clusters).c_str()); for (const auto &merged_cluster : merged_clusters) { + all_merged_clusters.emplace(merged_cluster); for (const auto &node : merged_cluster->Nodes()) { node_2_cluster_[node] = cluster; } } } + + if (!is_unknown_cluster && cluster->IsUnknownShape()) { + GELOGD("Add to ordered cluster: %s", cluster->DebugString().c_str()); + ordered_cluster_.push_back(cluster); + } } } @@ -703,7 +719,12 @@ void Cluster::Merge(ClusterPtr other) { if (other->min_ < min_) { min_ = other->min_; } -}; + + if (!IsUnknownShape() && other->IsUnknownShape()) { + type_ = UNKNOWN_SHAPE; + } +} + bool Cluster::TryMerge(ClusterPtr other) { std::queue forward_reached; forward_reached.push(other); diff --git a/ge/graph/partition/dynamic_shape_partition.h b/ge/graph/partition/dynamic_shape_partition.h index a17c4e4b..bd3b128f 100644 --- a/ge/graph/partition/dynamic_shape_partition.h +++ b/ge/graph/partition/dynamic_shape_partition.h @@ -161,7 +161,7 @@ class DynamicShapePartitioner { ge::ComputeGraphPtr root_graph_; // The original graph to partition std::unordered_map> node_2_cluster_; // Record nodes and the cluster it belongs to // V1 control flow cluster, need merge to one Graph. - std::unordered_map>> control_clusters_; + std::map>> control_clusters_; // topological sorted clusters, this field will change with the splitting. // When partitioning UNKNOWN_SHAPE cluster, it is a collection of all topological sorted UNKNOWN_SHAPE clusters // When partitioning KNOWN_SHAPE cluster, it is a collection of all topological sorted KNOWN_SHAPE clusters diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index 08b358ee..74babadc 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -132,39 +132,17 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const NodePtr &node, std: /// @return /// void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::map> &switch_groups) { - std::function callback = [](const NodePtr &n) { - return n->GetOpDesc()->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP); - }; - - for (auto it1 = switch_groups.begin(); it1 != switch_groups.end(); ++it1) { - const auto &op_node1 = it1->first; - const auto &op_desc1 = op_node1->GetOpDesc(); - if (op_desc1->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP)) { + for (auto it = switch_groups.begin(); it != switch_groups.end(); ++it) { + const auto &op_node = it->first; + const auto &op_desc = op_node->GetOpDesc(); + if (op_desc->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP)) { continue; } - if (IsUnknownShapeTensor(op_desc1->GetOutputDesc(0))) { - int64_t group_index = op_desc1->GetId(); - GELOGI("Mark %s as unknown shape control flow, group index: %ld", op_desc1->GetName().c_str(), group_index); - MarkForceUnknownShape(op_node1, true, group_index); - for (const auto &n : it1->second) { - MarkForceUnknownShape(n, true, group_index); - } - - for (auto it2 = switch_groups.begin(); it2 != switch_groups.end(); ++it2) { - const auto &op_node2 = it2->first; - const auto &op_desc2 = op_node2->GetOpDesc(); - if (op_desc2->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP)) { - continue; - } - - if (std::any_of(it2->second.begin(), it2->second.end(), callback)) { - MarkForceUnknownShape(op_node2, true, group_index); - for (const auto &n : it2->second) { - MarkForceUnknownShape(n, true, group_index); - } - } - } + int64_t group_index = op_desc->GetId(); + SetControlFlowGroup(op_node, group_index); + for (const auto &n : it->second) { + SetControlFlowGroup(n, group_index); } } } diff --git a/ge/graph/passes/mark_graph_unknown_status_pass.cc b/ge/graph/passes/mark_graph_unknown_status_pass.cc index 2d7b179b..9e460fc7 100644 --- a/ge/graph/passes/mark_graph_unknown_status_pass.cc +++ b/ge/graph/passes/mark_graph_unknown_status_pass.cc @@ -40,6 +40,12 @@ Status MarkGraphUnknownStatusPass::Run(ComputeGraphPtr graph) { } } + const auto &node = graph->GetParentNode(); + if (!is_unknown_shape && node != nullptr && node->GetType() == PARTITIONEDCALL) { + GE_CHK_GRAPH_STATUS_RET(NodeUtils::GetNodeUnknownShapeStatus(*node, is_unknown_shape), + "[Get][ShapeStatus] of node[%s] failed!", node->GetName().c_str()); + } + for (const auto &node : graph->GetDirectNode()) { GELOGD("Set OwnerGraphIsUnknown attr to node[%s]", node->GetName().c_str()); (void)AttrUtils::SetBool(node->GetOpDesc(), kOwnerGraphIsUnknown, is_unknown_shape); diff --git a/ge/graph/passes/merge_to_stream_merge_pass.cc b/ge/graph/passes/merge_to_stream_merge_pass.cc index 0b383911..dbcff620 100644 --- a/ge/graph/passes/merge_to_stream_merge_pass.cc +++ b/ge/graph/passes/merge_to_stream_merge_pass.cc @@ -89,8 +89,7 @@ Status MergeToStreamMergePass::AddActiveNodes(const ComputeGraphPtr &graph, cons REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); return FAILED, "[Check][Param] Param of pre node is nullptr."); int64_t group_index = -1; - bool force_unknown = AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); - MarkForceUnknownShape(node, force_unknown, group_index); + (void)AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); for (const InDataAnchorPtr &in_data_anchor : node->GetAllInDataAnchors()) { OutDataAnchorPtr peer_out_anchor = in_data_anchor->GetPeerOutAnchor(); GE_IF_BOOL_EXEC(peer_out_anchor == nullptr, continue); @@ -109,7 +108,7 @@ Status MergeToStreamMergePass::AddActiveNodes(const ComputeGraphPtr &graph, cons GELOGE(FAILED, "[Set][ActiveLabelList] for node %s failed.", active_node->GetName().c_str()); return FAILED; } - MarkForceUnknownShape(active_node, force_unknown, group_index); + SetControlFlowGroup(active_node, group_index); } return SUCCESS; diff --git a/ge/graph/passes/next_iteration_pass.cc b/ge/graph/passes/next_iteration_pass.cc index 67735b8b..fb8f8627 100644 --- a/ge/graph/passes/next_iteration_pass.cc +++ b/ge/graph/passes/next_iteration_pass.cc @@ -284,13 +284,21 @@ Status NextIterationPass::HandleWhileGroup(ComputeGraphPtr &graph) { /// @return void /// void NextIterationPass::HandleSwitchExitNodes(const LoopCondGroup &loop_group, int64_t group_index) { + std::string node_type; for (const auto &switch_node : loop_group.switch_nodes) { SetControlFlowGroup(switch_node, group_index); for (const auto &node : switch_node->GetOutDataNodes()) { - std::string node_type; (void)GetOriginalType(node, node_type); if (kExitOpTypes.count(node_type) > 0) { SetControlFlowGroup(node, group_index); + } else { + // For: Switch -> Cast -> Exit + for (const auto &n : node->GetOutDataNodes()) { + (void)GetOriginalType(n, node_type); + if (kExitOpTypes.count(node_type) > 0) { + SetControlFlowGroup(n, group_index); + } + } } } } diff --git a/ge/graph/passes/switch_to_stream_switch_pass.cc b/ge/graph/passes/switch_to_stream_switch_pass.cc index e7743130..e4ab0111 100644 --- a/ge/graph/passes/switch_to_stream_switch_pass.cc +++ b/ge/graph/passes/switch_to_stream_switch_pass.cc @@ -395,8 +395,8 @@ NodePtr SwitchToStreamSwitchPass::CreateStreamSwitchNode(const ComputeGraphPtr & peer_cond_anchor->GetOwnerNode()->GetName().c_str(), stream_switch->GetName().c_str()); int64_t group_index = -1; - bool force_unknown = AttrUtils::GetInt(switch_node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); - MarkForceUnknownShape(stream_switch, force_unknown, group_index); + (void)AttrUtils::GetInt(switch_node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); + SetControlFlowGroup(stream_switch, group_index); return stream_switch; } @@ -491,8 +491,8 @@ int64_t SwitchToStreamSwitchPass::GetGroupId(const NodePtr &node) { Status SwitchToStreamSwitchPass::CombineSwitchNode(const ComputeGraphPtr &graph) { for (auto iter = cond_node_map_.begin(); iter != cond_node_map_.end(); ++iter) { for (auto group_iter = iter->second.begin(); group_iter != iter->second.end(); ++group_iter) { - std::list false_switch_list = group_iter->second[SWITCH_FALSE_OUTPUT]; - std::list true_switch_list = group_iter->second[SWITCH_TRUE_OUTPUT]; + const std::list &false_switch_list = group_iter->second[SWITCH_FALSE_OUTPUT]; + const std::list &true_switch_list = group_iter->second[SWITCH_TRUE_OUTPUT]; std::set same_cond_switch; same_cond_switch.insert(false_switch_list.begin(), false_switch_list.end()); same_cond_switch.insert(true_switch_list.begin(), true_switch_list.end()); @@ -524,13 +524,13 @@ Status SwitchToStreamSwitchPass::CombineSwitchNode(const ComputeGraphPtr &graph) std::function callback = [&group_index](const NodePtr &n) { return AttrUtils::GetInt(n->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); }; - bool is_unknown_shape = std::any_of(same_cond_switch.begin(), same_cond_switch.end(), callback); - MarkForceUnknownShape(active_node, is_unknown_shape, group_index); + (void)std::any_of(same_cond_switch.begin(), same_cond_switch.end(), callback); + SetControlFlowGroup(active_node, group_index); const std::string &cond_group = cond_node->GetName(); for (uint32_t i = 0; i < SWITCH_OUTPUT_NUM; ++i) { bool true_branch_flag = (i == SWITCH_TRUE_OUTPUT); - std::list &switch_list = (true_branch_flag ? true_switch_list : false_switch_list); + const std::list &switch_list = (true_branch_flag ? true_switch_list : false_switch_list); GE_IF_BOOL_EXEC(switch_list.empty(), continue); // select first stream_switch @@ -559,7 +559,7 @@ Status SwitchToStreamSwitchPass::CombineSwitchNode(const ComputeGraphPtr &graph) "[Add][Edge] between %s and %s failed.", cast_node->GetName().c_str(), stream_switch->GetName().c_str()); - MarkForceUnknownShape(stream_switch, is_unknown_shape, group_index); + SetControlFlowGroup(stream_switch, group_index); for (const NodePtr &node : switch_list) { GE_IF_BOOL_EXEC(node != stream_switch, { GE_CHK_STATUS(GraphUtils::RemoveEdge(peer_cond_anchor, node->GetInDataAnchor(0)), diff --git a/ge/hybrid/executor/node_state.cc b/ge/hybrid/executor/node_state.cc index 313a2934..42e08811 100644 --- a/ge/hybrid/executor/node_state.cc +++ b/ge/hybrid/executor/node_state.cc @@ -19,8 +19,9 @@ #include "framework/common/debug/log.h" #include "graph/compute_graph.h" #include "graph/utils/tensor_utils.h" -#include "hybrid_execution_context.h" -#include "subgraph_context.h" +#include "hybrid/executor/hybrid_execution_context.h" +#include "hybrid/executor/subgraph_context.h" +#include "hybrid/node_executor/task_context.h" #define INC_ITERATION_COUNT(iteration) \ do { \ @@ -258,6 +259,8 @@ ShapeFuture::ShapeFuture(NodeState *src_node, NodeState::NodeState(const NodeItem &node_item, SubgraphContext *subgraph_context) : node_item_(&node_item), shape_inference_state_(node_item), subgraph_context_(subgraph_context) { this->op_desc_ = node_item.node->GetOpDesc(); + auto unique_task_context = TaskContext::Create(this, subgraph_context_); + task_context_ = std::shared_ptr(unique_task_context.release()); } Status NodeState::AwaitInputTensors(GraphExecutionContext &context) const { @@ -314,15 +317,53 @@ std::shared_ptr NodeState::GetTaskContext() { return task_context_; } +void NodeState::SavePersistTensor(int input_idx, const TensorValue &tensor) { + if (node_item_->root_data_.count(input_idx) > 0) { + GELOGD("[%s] Save Root input tensor: %d", GetName().c_str(), input_idx); + root_tensor_values_[input_idx] = tensor; + } + + if (node_item_->enter_data_.count(input_idx) > 0) { + GELOGD("[%s] Save Enter input tensor: %d", GetName().c_str(), input_idx); + root_tensor_values_[input_idx] = tensor; + } +} + +void NodeState::UpdatePersistTensor(int input_idx) { + const auto it = root_tensor_values_.find(input_idx); + if (it == root_tensor_values_.end()) { + GELOGW("[%s] Not found saved tensor: %d", GetName().c_str(), input_idx); + return; + } + + auto tensor = task_context_->MutableInput(input_idx); + if (tensor == nullptr) { + GELOGW("[%s] Not found input tensor: %d", GetName().c_str(), input_idx); + return; + } + + *tensor = it->second; + GELOGD("[%s] Update input tensor: %d", GetName().c_str(), input_idx); +} + void NodeState::ResetContext(uint64_t iteration) { switch_index_ = -1; subgraph_context_->ResetContext(node_item_->node); - if (iteration == 0) { - data_scheduled_ = static_cast(node_item_->root_data_.size()); - ctrl_scheduled_ = static_cast(node_item_->root_ctrl_.size()); - } else { - data_scheduled_ = static_cast(node_item_->root_data_.size() + node_item_->enter_data_.size()); - ctrl_scheduled_ = static_cast(node_item_->root_ctrl_.size() + node_item_->enter_ctrl_.size()); + auto unique_task_context = TaskContext::Create(this, subgraph_context_); + task_context_ = std::shared_ptr(unique_task_context.release()); + + data_scheduled_ = static_cast(node_item_->root_data_.size()); + ctrl_scheduled_ = static_cast(node_item_->root_ctrl_.size()); + for (auto item : node_item_->root_data_) { + UpdatePersistTensor(item.first); + } + + if (iteration > 0) { + data_scheduled_ += static_cast(node_item_->enter_data_.size()); + ctrl_scheduled_ += static_cast(node_item_->enter_ctrl_.size()); + for (auto item : node_item_->enter_data_) { + UpdatePersistTensor(item.first); + } } iteration_count_ = iteration; diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index 9dd29846..72e2b90e 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -129,6 +129,8 @@ struct NodeState { void RunStreamActive(); void RunNextIteration(); + void SavePersistTensor(int input_idx, const TensorValue &tensor); + Status NodeScheduled(const std::function &ready) const; void SetScheduleFuture(std::future &&future); @@ -187,6 +189,7 @@ struct NodeState { void SetCtrlSchedule(const NodeState &node_state, const std::function &ready); void ResetContext(uint64_t iteration); void ScheduleContext(const NodeState &node_state); + void UpdatePersistTensor(int input_idx); const NodeItem *node_item_ = nullptr; std::shared_ptr kernel_task_ = nullptr; @@ -199,6 +202,7 @@ struct NodeState { std::future schedule_future_; std::shared_ptr frame_state_; + std::map root_tensor_values_; uint64_t active_count_ = 0; uint64_t iteration_count_ = 0; uint32_t ctrl_scheduled_ = 0; diff --git a/ge/hybrid/executor/subgraph_context.cc b/ge/hybrid/executor/subgraph_context.cc index b6763ffd..41ada9af 100644 --- a/ge/hybrid/executor/subgraph_context.cc +++ b/ge/hybrid/executor/subgraph_context.cc @@ -19,7 +19,7 @@ namespace ge { namespace hybrid { -SubgraphContext::SubgraphContext(const GraphItem *graph_item, const GraphExecutionContext *execution_context) +SubgraphContext::SubgraphContext(const GraphItem *graph_item, GraphExecutionContext *execution_context) : graph_item_(graph_item), execution_context_(execution_context) { } diff --git a/ge/hybrid/executor/subgraph_context.h b/ge/hybrid/executor/subgraph_context.h index a43cd210..d11d00d7 100644 --- a/ge/hybrid/executor/subgraph_context.h +++ b/ge/hybrid/executor/subgraph_context.h @@ -30,7 +30,7 @@ namespace ge { namespace hybrid { class SubgraphContext { public: - explicit SubgraphContext(const GraphItem *graph_item, const GraphExecutionContext *execution_context); + explicit SubgraphContext(const GraphItem *graph_item, GraphExecutionContext *execution_context); ~SubgraphContext(); Status Init(); @@ -54,7 +54,7 @@ class SubgraphContext { FrameStatePtr GetOrCreateFrameState(const NodeItem &node_item); // no lock friend class TaskContext; const GraphItem *graph_item_; - const GraphExecutionContext *execution_context_; + GraphExecutionContext *execution_context_; mmRWLock_t rw_lock_; std::vector all_inputs_; std::vector all_outputs_; diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 612e7565..7429acc5 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -175,16 +175,12 @@ Status SubgraphExecutor::ExecuteAsyncForKnownShape(const std::vectorSetKernelTask(node_item->kernel_task); - known_shape_task_context_ = TaskContext::Create(node_state.get(), context_, subgraph_context_.get()); - GE_CHECK_NOTNULL(known_shape_task_context_); - node_state->SetTaskContext(known_shape_task_context_); - std::function callback; GE_CHK_STATUS_RET_NOLOG(InitCallback(node_state.get(), callback)); - HYBRID_CHK_STATUS_RET(ExecutionEngine::ExecuteAsync(*node_state, known_shape_task_context_, *context_, callback), + HYBRID_CHK_STATUS_RET(ExecutionEngine::ExecuteAsync(*node_state, node_state->GetTaskContext(), *context_, callback), "[%s] Failed to execute node [%s] for known subgraph.", graph_item_->GetName().c_str(), - known_shape_task_context_->GetNodeName()); + node_state->GetName().c_str()); GELOGD("[%s] Done execute non-dynamic subgraph successfully.", graph_item_->GetName().c_str()); return SUCCESS; @@ -271,16 +267,12 @@ Status SubgraphExecutor::PrepareNode(const NodeItem &node_item, int group) { } else { node_state->SetKernelTask(node_item.kernel_task); } - auto unique_task_context = TaskContext::Create(node_state.get(), context_, subgraph_context_.get()); - GE_CHECK_NOTNULL(unique_task_context); const auto &task = node_state->GetKernelTask(); if (task == nullptr) { GELOGE(INTERNAL_ERROR, "[Get][KernelTask] failed for[%s], NodeTask is null.", node_state->GetName().c_str()); REPORT_CALL_ERROR("E19999", "GetKernelTask failed for %s, nodetask is null.", node_state->GetName().c_str()); return INTERNAL_ERROR; } - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); GE_CHK_STATUS_RET_NOLOG(NodeEnqueue(p_node_state)); return AfterPrepared(p_node_state); } @@ -480,19 +472,15 @@ Status SubgraphExecutor::PrepareForExecution(GraphExecutionContext *ctx, NodeSta } else { node_state.SetKernelTask(node_item.kernel_task); } - auto unique_task_context = TaskContext::Create(&node_state, context_, subgraph_context_.get()); - GE_CHECK_NOTNULL(unique_task_context); const auto &task = node_state.GetKernelTask(); if (task == nullptr) { GELOGE(INTERNAL_ERROR, "[Invoke][GetKernelTask] failed for[%s], NodeTask is null.", node_state.GetName().c_str()); REPORT_CALL_ERROR("E19999", "invoke GetKernelTask failed for %s, NodeTask is null.", node_state.GetName().c_str()); return INTERNAL_ERROR; } - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state.SetTaskContext(shared_task_context); GE_CHK_RT_RET(rtCtxSetCurrent(ctx->rt_context)); RECORD_COMPILE_EVENT(ctx, node_item.NodeName().c_str(), "[UpdateTilingData] start"); - GE_CHK_STATUS_RET_NOLOG(task->UpdateTilingData(*shared_task_context)); // update op_desc before alloc ws + GE_CHK_STATUS_RET_NOLOG(task->UpdateTilingData(*node_state.GetTaskContext())); // update op_desc before alloc ws RECORD_COMPILE_EVENT(ctx, node_item.NodeName().c_str(), "[UpdateTilingData] end"); return SUCCESS; } diff --git a/ge/hybrid/executor/subgraph_executor.h b/ge/hybrid/executor/subgraph_executor.h index 758bf426..e4c0debe 100644 --- a/ge/hybrid/executor/subgraph_executor.h +++ b/ge/hybrid/executor/subgraph_executor.h @@ -125,7 +125,6 @@ class SubgraphExecutor { ThreadPool pre_run_pool_; BlockingQueue ready_queue_; std::unique_ptr shape_inference_engine_; - std::shared_ptr known_shape_task_context_; std::mutex mu_; // Guard for prepare_queues_. std::map> prepare_queues_; diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index b339e630..cef06fc6 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -398,12 +398,11 @@ void NodeItem::SetDataSend(NodeItem *node_item, int anchor_index) { data_send_.emplace(node_item); node_item->data_recv_[this] = anchor_index; if (is_root_node_) { - node_item->root_data_.emplace(this); + node_item->root_data_[anchor_index] = this; } // If Enter feed Not Merge, take as root Node. if (IsEnterOp() && (node_item->node_type != STREAMMERGE)) { - node_item->enter_data_.emplace(this); - node_item->enter_inside_.emplace(anchor_index); + node_item->enter_data_[anchor_index] = this; } GELOGI("Node[%s] will control node[%s]", NodeName().c_str(), node_item->NodeName().c_str()); } diff --git a/ge/hybrid/model/node_item.h b/ge/hybrid/model/node_item.h index 8de15952..ec66f094 100644 --- a/ge/hybrid/model/node_item.h +++ b/ge/hybrid/model/node_item.h @@ -148,15 +148,14 @@ struct NodeItem { int64_t frame_index_ = -1; int64_t parent_frame_ = -1; std::set root_ctrl_; // Recv ctrl from root node - std::set root_data_; // Recv data from root node + std::map root_data_; // Recv data from root node std::set enter_ctrl_; // Recv ctrl from Enter node - std::set enter_data_; // Recv data from Enter node + std::map enter_data_; // Recv data from Enter node std::set data_send_; // Send data notify to std::map data_recv_; // Recv data notify from std::set ctrl_send_; // Send ctrl notify to std::set ctrl_recv_; // Recv ctrl notify from std::vector> switch_groups_; // Send ctrl notify to - std::set enter_inside_; // Enter feed loop inside Node, Not cross Merge. std::shared_ptr kernel_task; std::unique_ptr fused_subgraph; diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index 14eb1222..fe580c1e 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -52,9 +52,7 @@ void TaskContext::ReleaseWorkspace() { } } -std::unique_ptr TaskContext::Create(NodeState *node_state, - GraphExecutionContext *execution_context, - SubgraphContext *subgraph_context) { +std::unique_ptr TaskContext::Create(NodeState *node_state, SubgraphContext *subgraph_context) { const NodeItem &node_item = *node_state->GetNodeItem(); GELOGI("[%s] To create task context, input start = %d, num_inputs = %d, output start = %d, num_outputs = %d.", node_item.NodeName().c_str(), @@ -75,7 +73,7 @@ std::unique_ptr TaskContext::Create(NodeState *node_state, } auto task_context = std::unique_ptr( - new(std::nothrow)TaskContext(execution_context, node_state, subgraph_context)); + new(std::nothrow)TaskContext(subgraph_context->execution_context_, node_state, subgraph_context)); if (task_context == nullptr) { REPORT_CALL_ERROR("E19999", "Create TaskContext failed for [%s].", node_item.NodeName().c_str()); GELOGE(MEMALLOC_FAILED, "[Create][TaskContext] failed for [%s].", node_item.NodeName().c_str()); @@ -85,7 +83,7 @@ std::unique_ptr TaskContext::Create(NodeState *node_state, task_context->node_item_ = &node_item; task_context->inputs_start_ = subgraph_context->all_inputs_.data() + node_item.input_start; task_context->outputs_start_ = subgraph_context->all_outputs_.data() + node_item.output_start; - task_context->iteration_ = execution_context->iteration; + task_context->iteration_ = subgraph_context->execution_context_->iteration; return task_context; } @@ -460,6 +458,10 @@ Status TaskContext::PropagateOutputs() { subgraph_context_->all_inputs_[input_offset].SetName( node_item_->NodeName() + "_in_" + std::to_string(dst_input_idx)); } + + auto dst_node_state = subgraph_context_->GetOrCreateNodeState(dst_node_item); + GE_CHECK_NOTNULL(dst_node_state); + dst_node_state->SavePersistTensor(dst_input_idx, *tensor); } } (void)guard; @@ -489,11 +491,6 @@ void TaskContext::ReleaseInputsAndOutputs() { } void TaskContext::ReleaseInput(int index) { - if (node_item_->enter_inside_.count(index) > 0) { - GELOGD("[%s] Tensor of input[%d] is enter, keep it", GetNodeName(), index); - return; - } - auto input_tensor = MutableInput(index); if (input_tensor != nullptr) { input_tensor->Destroy(); diff --git a/ge/hybrid/node_executor/task_context.h b/ge/hybrid/node_executor/task_context.h index ba4c62e6..c96e194e 100644 --- a/ge/hybrid/node_executor/task_context.h +++ b/ge/hybrid/node_executor/task_context.h @@ -36,9 +36,7 @@ class SubgraphContext; class TaskContext { public: - static std::unique_ptr Create(NodeState *node_state, - GraphExecutionContext *execution_context, - SubgraphContext *subgraph_context); + static std::unique_ptr Create(NodeState *node_state, SubgraphContext *subgraph_context); ~TaskContext(); diff --git a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc index ec1caebd..da1abd0f 100644 --- a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc +++ b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc @@ -24,6 +24,7 @@ #include "inc/framework/common/types.h" #include "utils/graph_utils.h" #include "graph/debug/ge_attr_define.h" +#include "graph/common/omg_util.h" namespace ge { namespace { @@ -38,33 +39,33 @@ GeTensorDescPtr CreateTensorDesc(std::initializer_list shape, Format fo } class NodeBuilder { - public: - NodeBuilder(const std::string &name, const std::string &type) { op_desc_ = std::make_shared(name, type); } - - NodeBuilder &AddInputDesc(std::initializer_list shape = {1, 1, 224, 224}, Format format = FORMAT_NCHW, - DataType data_type = DT_FLOAT) { - op_desc_->AddInputDesc(CreateTensorDesc(shape, format, data_type)->Clone()); - return *this; - } - - NodeBuilder &AddOutputDesc(std::initializer_list shape = {1, 1, 224, 224}, Format format = FORMAT_NCHW, - DataType data_type = DT_FLOAT) { - op_desc_->AddOutputDesc(CreateTensorDesc(shape, format, data_type)->Clone()); - return *this; - } - - NodeBuilder &AddOutputDesc(GeTensorDescPtr tensor_desc) { - op_desc_->AddOutputDesc(tensor_desc->Clone()); - return *this; - } - - NodePtr Build(const ComputeGraphPtr &graph) { - NodePtr node = graph->AddNode(op_desc_); - return node; - } - - private: - OpDescPtr op_desc_; + public: + NodeBuilder(const std::string &name, const std::string &type) { op_desc_ = std::make_shared(name, type); } + + NodeBuilder &AddInputDesc(std::initializer_list shape = {1, 1, 224, 224}, Format format = FORMAT_NCHW, + DataType data_type = DT_FLOAT) { + op_desc_->AddInputDesc(CreateTensorDesc(shape, format, data_type)->Clone()); + return *this; + } + + NodeBuilder &AddOutputDesc(std::initializer_list shape = {1, 1, 224, 224}, Format format = FORMAT_NCHW, + DataType data_type = DT_FLOAT) { + op_desc_->AddOutputDesc(CreateTensorDesc(shape, format, data_type)->Clone()); + return *this; + } + + NodeBuilder &AddOutputDesc(GeTensorDescPtr tensor_desc) { + op_desc_->AddOutputDesc(tensor_desc->Clone()); + return *this; + } + + NodePtr Build(const ComputeGraphPtr &graph) { + NodePtr node = graph->AddNode(op_desc_); + return node; + } + + private: + OpDescPtr op_desc_; }; } // namespace @@ -93,28 +94,137 @@ TEST_F(UtestDynamicShapePartition, single_op_scene_success) { EXPECT_EQ(partitioner.Partition(), SUCCESS); } +/******************************************************************************* + * | + * Merge1 + * Active / \ Active + * / \. + * / \. + * Merge2 \. + * Active/ \Active \. + * / \ \. + * Add Sub Relu + * | | | + * | | | + * Switch_f2 Switch_t2 | + * \ / | + * \ / | + * Less2 | + * | | + * | | + * Switch_f Switch_t + * | \ / | + * | Active | + * | | | + * | Less1 | + * | / \ | + * | / \ | + * Data Data + ******************************************************************************/ TEST_F(UtestDynamicShapePartition, merge_control_flow_group) { ComputeGraphPtr graph = std::make_shared("default"); AttrUtils::SetStr(*graph, ATTR_NAME_SESSION_GRAPH_ID, "session_graph_id"); - NodePtr data1 = NodeBuilder("data1", DATA).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); - NodePtr data2 = NodeBuilder("data2", DATA).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); - NodePtr merge = NodeBuilder("node2", MERGE).AddInputDesc({1}).AddInputDesc({1}) - .AddOutputDesc({1}).AddOutputDesc({}).Build(graph); - - GraphUtils::AddEdge(data1->GetOutDataAnchor(0), merge->GetInDataAnchor(0)); - GraphUtils::AddEdge(data2->GetOutDataAnchor(0), merge->GetInDataAnchor(1)); - - (void)AttrUtils::SetBool(data1->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); - (void)AttrUtils::SetInt(data1->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3); - (void)AttrUtils::SetBool(data2->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); - (void)AttrUtils::SetInt(data2->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3); - (void)AttrUtils::SetBool(merge->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); - (void)AttrUtils::SetInt(merge->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, 3); + auto data1 = NodeBuilder("data1", DATA).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto data2 = NodeBuilder("data2", DATA).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + + auto less1 = NodeBuilder("less1", LESS).AddInputDesc({1}).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto active1 = NodeBuilder("active1", STREAMACTIVE).Build(graph); + auto switch_t = NodeBuilder("switch_t", STREAMSWITCH).AddInputDesc({1}).AddInputDesc({1}).Build(graph); + auto switch_f = NodeBuilder("switch_f", STREAMSWITCH).AddInputDesc({1}).AddInputDesc({1}).Build(graph); + auto const_01 = NodeBuilder("const_01", CONSTANT).AddOutputDesc({1}).Build(graph); + auto const_11 = NodeBuilder("const_11", CONSTANT).AddOutputDesc({1}).Build(graph); + + + auto less2 = NodeBuilder("less2", LESS).AddInputDesc({1}).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto active2 = NodeBuilder("active2", STREAMACTIVE).Build(graph); + auto switch_t2 = NodeBuilder("switch_t2", STREAMSWITCH).AddInputDesc({1}).AddInputDesc({1}).Build(graph); + auto switch_f2 = NodeBuilder("switch_f2", STREAMSWITCH).AddInputDesc({1}).AddInputDesc({1}).Build(graph); + auto const_02 = NodeBuilder("const_02", CONSTANT).AddOutputDesc({1}).Build(graph); + auto const_12 = NodeBuilder("const_12", CONSTANT).AddOutputDesc({1}).Build(graph); + + auto add2 = NodeBuilder("add2", ADD).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto sub2 = NodeBuilder("sub2", SUB).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto merge2 = NodeBuilder("merge2", STREAMMERGE).AddInputDesc({1}).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto active_f2 = NodeBuilder("active_f2", STREAMACTIVE).Build(graph); + auto active_t2 = NodeBuilder("active_t2", STREAMACTIVE).Build(graph); + + auto relu1 = NodeBuilder("relu1", RELU).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto merge1 = NodeBuilder("merge1", STREAMMERGE).AddInputDesc({1}).AddInputDesc({1}).AddOutputDesc({1}).Build(graph); + auto active_f1 = NodeBuilder("active_f1", STREAMACTIVE).Build(graph); + auto active_t1 = NodeBuilder("active_t1", STREAMACTIVE).Build(graph); + + auto output1 = NodeBuilder("noutput1", NETOUTPUT).AddInputDesc({1}).Build(graph); + + GraphUtils::AddEdge(data1->GetOutDataAnchor(0), less1->GetInDataAnchor(0)); + GraphUtils::AddEdge(data2->GetOutDataAnchor(0), less1->GetInDataAnchor(1)); + GraphUtils::AddEdge(less1->GetOutDataAnchor(0), switch_t->GetInDataAnchor(0)); + GraphUtils::AddEdge(less1->GetOutDataAnchor(0), switch_f->GetInDataAnchor(0)); + GraphUtils::AddEdge(const_01->GetOutDataAnchor(0), switch_t->GetInDataAnchor(1)); + GraphUtils::AddEdge(const_11->GetOutDataAnchor(0), switch_f->GetInDataAnchor(1)); + GraphUtils::AddEdge(less1->GetOutControlAnchor(), active1->GetInControlAnchor()); + GraphUtils::AddEdge(active1->GetOutControlAnchor(), switch_t->GetInControlAnchor()); + GraphUtils::AddEdge(active1->GetOutControlAnchor(), switch_f->GetInControlAnchor()); + + + GraphUtils::AddEdge(data1->GetOutDataAnchor(0), less2->GetInDataAnchor(0)); + GraphUtils::AddEdge(less1->GetOutDataAnchor(0), less2->GetInDataAnchor(1)); + GraphUtils::AddEdge(less2->GetOutDataAnchor(0), switch_t2->GetInDataAnchor(0)); + GraphUtils::AddEdge(less2->GetOutDataAnchor(0), switch_f2->GetInDataAnchor(0)); + GraphUtils::AddEdge(const_02->GetOutDataAnchor(0), switch_t2->GetInDataAnchor(1)); + GraphUtils::AddEdge(const_12->GetOutDataAnchor(0), switch_f2->GetInDataAnchor(1)); + GraphUtils::AddEdge(less2->GetOutControlAnchor(), active2->GetInControlAnchor()); + GraphUtils::AddEdge(active2->GetOutControlAnchor(), switch_t2->GetInControlAnchor()); + GraphUtils::AddEdge(active2->GetOutControlAnchor(), switch_f2->GetInControlAnchor()); + + + GraphUtils::AddEdge(switch_f2->GetOutControlAnchor(), add2->GetInControlAnchor()); + GraphUtils::AddEdge(less2->GetOutDataAnchor(0), add2->GetInDataAnchor(0)); + GraphUtils::AddEdge(add2->GetOutDataAnchor(0), merge2->GetInDataAnchor(0)); + GraphUtils::AddEdge(add2->GetOutControlAnchor(), active_f2->GetInControlAnchor()); + GraphUtils::AddEdge(active_f2->GetOutControlAnchor(), merge2->GetInControlAnchor()); + + GraphUtils::AddEdge(switch_t2->GetOutControlAnchor(), sub2->GetInControlAnchor()); + GraphUtils::AddEdge(less2->GetOutDataAnchor(0), sub2->GetInDataAnchor(0)); + GraphUtils::AddEdge(sub2->GetOutDataAnchor(0), merge2->GetInDataAnchor(1)); + GraphUtils::AddEdge(sub2->GetOutControlAnchor(), active_t2->GetInControlAnchor()); + GraphUtils::AddEdge(active_t2->GetOutControlAnchor(), merge2->GetInControlAnchor()); + + GraphUtils::AddEdge(switch_t->GetOutControlAnchor(), less2->GetInControlAnchor()); + GraphUtils::AddEdge(switch_f->GetOutControlAnchor(), relu1->GetInControlAnchor()); + + + GraphUtils::AddEdge(merge2->GetOutDataAnchor(0), merge1->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge2->GetOutControlAnchor(), active_f1->GetInControlAnchor()); + GraphUtils::AddEdge(active_f1->GetOutControlAnchor(), merge1->GetInControlAnchor()); + + GraphUtils::AddEdge(data2->GetOutDataAnchor(0), relu1->GetInDataAnchor(1)); + GraphUtils::AddEdge(relu1->GetOutDataAnchor(0), merge1->GetInDataAnchor(0)); + GraphUtils::AddEdge(relu1->GetOutControlAnchor(), active_t1->GetInControlAnchor()); + GraphUtils::AddEdge(active_t1->GetOutControlAnchor(), merge1->GetInControlAnchor()); + + GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), output1->GetInDataAnchor(0)); + + AttrUtils::SetBool(merge2->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); + EXPECT_EQ(graph->TopologicalSorting(), GRAPH_SUCCESS); + + SetControlFlowGroup(merge2, merge2->GetOpDesc()->GetId()); + SetControlFlowGroup(switch_f2, merge2->GetOpDesc()->GetId()); + SetControlFlowGroup(switch_t2, merge2->GetOpDesc()->GetId()); + SetControlFlowGroup(active2, merge2->GetOpDesc()->GetId()); + SetControlFlowGroup(active_t2, merge2->GetOpDesc()->GetId()); + SetControlFlowGroup(active_f2, merge2->GetOpDesc()->GetId()); + + SetControlFlowGroup(merge1, merge1->GetOpDesc()->GetId()); + SetControlFlowGroup(switch_f, merge1->GetOpDesc()->GetId()); + SetControlFlowGroup(switch_t, merge1->GetOpDesc()->GetId()); + SetControlFlowGroup(active1, merge1->GetOpDesc()->GetId()); + SetControlFlowGroup(active_f1, merge1->GetOpDesc()->GetId()); + SetControlFlowGroup(active_t1, merge1->GetOpDesc()->GetId()); EXPECT_EQ(graph->impl_->sub_graph_.size(), 0); DynamicShapePartitioner partitioner(graph); EXPECT_EQ(partitioner.Partition(), SUCCESS); - EXPECT_EQ(graph->impl_->sub_graph_.size(), 1); + EXPECT_EQ(graph->impl_->sub_graph_.size(), 3); // input less1 uknown } } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc index 07022230..e0ccbfa5 100644 --- a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc +++ b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc @@ -84,9 +84,6 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_kernel_task) { 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); @@ -119,14 +116,11 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { SubgraphContext subgraph_context(nullptr, &execution_context); NodeState node_state(*node_item, &subgraph_context); - auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); uint32_t task_id = 0; uint32_t stream_id = 1; std::string task_type = "rts"; uint32_t block_dim = 0; - task_context->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim); - auto shared_task_context = std::shared_ptr(task_context.release()); - node_state.SetTaskContext(shared_task_context); + node_state.GetTaskContext()->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim); ExecutionEngine execution_engine; ASSERT_TRUE(node_state.GetTaskContext() != nullptr); diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index f6c75d50..d634ed14 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -161,10 +161,8 @@ TEST_F(UtestGeHybrid, task_update_tiling_info) { GraphExecutionContext execution_context; SubgraphContext subgraph_context(nullptr, &execution_context); NodeState node_state(*node_item, &subgraph_context); - auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); - ASSERT_TRUE(task_context != nullptr); ASSERT_EQ(aicore_task->InitTilingInfo(*op_desc), SUCCESS); - ASSERT_EQ(aicore_task->UpdateTilingInfo(*task_context), SUCCESS); + ASSERT_EQ(aicore_task->UpdateTilingInfo(*node_state.GetTaskContext()), SUCCESS); } TEST_F(UtestGeHybrid, index_taskdefs_failed) { @@ -482,7 +480,7 @@ TEST_F(UtestGeHybrid, TestTaskContext) { subgraph_context.all_outputs_.resize(1); NodeState node_state(*node_item, &subgraph_context); - auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); + auto task_context = node_state.GetTaskContext(); ASSERT_TRUE(task_context != nullptr); auto desc = task_context->MutableInputDesc(2); ASSERT_TRUE(desc == nullptr); @@ -527,7 +525,7 @@ TEST_F(UtestGeHybrid, hybrid_model_executor_update_args) { subgraph_context.all_outputs_.resize(1); NodeState node_state(*node_item, &subgraph_context); - auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); + auto task_context = node_state.GetTaskContext(); int32_t buffer[1]; aicore_task->tiling_buffer_ = TensorBuffer::Create(buffer, sizeof(buffer)); diff --git a/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc index a7a407a4..e4d211f9 100644 --- a/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc @@ -97,11 +97,6 @@ TEST_F(UtestGeLocalNodeExecutor, test_no_op_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - NodeTaskPtr task = nullptr; GeLocalNodeExecutor node_executor; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), SUCCESS); diff --git a/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc b/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc index 44b2f37f..109e5192 100644 --- a/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc @@ -96,11 +96,6 @@ TEST_F(UtestRtsNodeTask, test_stream_switch_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - uint64_t value_0 = 110; uint64_t value_1 = 120; TensorValue in_tensor0(&value_0, sizeof(value_0)); @@ -153,11 +148,6 @@ TEST_F(UtestRtsNodeTask, test_stream_active_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - NodeTaskPtr task = nullptr; RtsNodeExecutor node_executor; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), SUCCESS); @@ -203,11 +193,6 @@ TEST_F(UtestRtsNodeTask, test_stream_merge_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - uint64_t value_0 = 110; TensorValue in_tensor0(&value_0, sizeof(value_0)); subgraph_context.SetInput(*node_item, 0, in_tensor0); @@ -271,11 +256,6 @@ TEST_F(UtestRtsNodeTask, test_memcpy_async_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - uint64_t value_0 = 110; TensorValue in_tensor0(&value_0, sizeof(value_0)); subgraph_context.SetInput(*node_item, 0, in_tensor0); @@ -328,11 +308,6 @@ TEST_F(UtestRtsNodeTask, test_pass_through_task) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - uint64_t value_0 = 110; TensorValue in_tensor0(&value_0, sizeof(value_0)); subgraph_context.SetInput(*node_item, 0, in_tensor0); @@ -384,11 +359,6 @@ TEST_F(UtestRtsNodeTask, test_unsupport_label_set) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - NodeTaskPtr task = nullptr; RtsNodeExecutor node_executor; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), SUCCESS); @@ -428,11 +398,6 @@ TEST_F(UtestRtsNodeTask, test_unsupport_label_goto) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - NodeTaskPtr task = nullptr; RtsNodeExecutor node_executor; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), SUCCESS); @@ -472,11 +437,6 @@ TEST_F(UtestRtsNodeTask, test_unsupport_label_switch) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - NodeTaskPtr task = nullptr; RtsNodeExecutor node_executor; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), SUCCESS); From 8852766766ec531f47227d237706b04fc53dff8d Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 12 Jun 2021 13:16:42 +0800 Subject: [PATCH 022/226] Fix hccl_node_executor_unittest --- .../node_executor/hccl/hccl_node_executor_unittest.cc | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tests/ut/ge/hybrid/node_executor/hccl/hccl_node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/hccl/hccl_node_executor_unittest.cc index afaf067e..8e6630f6 100644 --- a/tests/ut/ge/hybrid/node_executor/hccl/hccl_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/hccl/hccl_node_executor_unittest.cc @@ -94,18 +94,17 @@ TEST_F(UtestHcclNodeExecutor, test_rdmatask_extract_tensor) { tensor.SetData(data); ctx->SetTensor(1, 0, tensor.Clone()); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); vector addr_infos; shared_ptr task = MakeShared(); task->remote_index_ = {1, 0}; - ASSERT_EQ(task->ExtractTensor(*unique_task_context, addr_infos), PARAM_INVALID); + ASSERT_EQ(task->ExtractTensor(*node_state->GetTaskContext(), addr_infos), PARAM_INVALID); Shape s2({1}); TensorDesc tensor_desc2(s2); Tensor tensor2(tensor_desc2); ctx->SetTensor(1, 0, tensor2.Clone()); - task->ExtractTensor(*unique_task_context, addr_infos); - ASSERT_EQ(task->ExtractTensor(*unique_task_context, addr_infos), PARAM_INVALID); + task->ExtractTensor(*node_state->GetTaskContext(), addr_infos); + ASSERT_EQ(task->ExtractTensor(*node_state->GetTaskContext(), addr_infos), PARAM_INVALID); RuntimeInferenceContext::DestroyContext(std::to_string(graph_context.context_id)); } @@ -140,11 +139,6 @@ TEST_F(UtestHcclNodeExecutor, gatheralltoallv_execute) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - for (int i=0; i<4; ++i) { uint64_t value_0 = 512; TensorValue in_tensor0(&value_0, sizeof(value_0)); @@ -206,11 +200,6 @@ TEST_F(UtestHcclNodeExecutor, alltoallv_execute) { auto node_state = subgraph_context.GetOrCreateNodeState(node_item); ASSERT_NE(node_state, nullptr); - auto unique_task_context = TaskContext::Create(node_state.get(), &graph_context, &subgraph_context); - ASSERT_NE(unique_task_context, nullptr); - auto shared_task_context = std::shared_ptr(unique_task_context.release()); - node_state->SetTaskContext(shared_task_context); - for (int i=0; i<5; ++i) { uint64_t value_0 = 512; TensorValue in_tensor0(&value_0, sizeof(value_0)); From ab65075326c2758b5054abb766ca3275b0e26e94 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 12 Jun 2021 17:52:12 +0800 Subject: [PATCH 023/226] Add Init to NodeState --- ge/hybrid/executor/node_state.cc | 9 +++++++++ ge/hybrid/executor/node_state.h | 10 ++-------- ge/hybrid/executor/subgraph_context.cc | 25 ++++++++++++++++++------- ge/hybrid/executor/subgraph_context.h | 1 + 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/ge/hybrid/executor/node_state.cc b/ge/hybrid/executor/node_state.cc index 42e08811..468c84e6 100644 --- a/ge/hybrid/executor/node_state.cc +++ b/ge/hybrid/executor/node_state.cc @@ -259,8 +259,16 @@ ShapeFuture::ShapeFuture(NodeState *src_node, NodeState::NodeState(const NodeItem &node_item, SubgraphContext *subgraph_context) : node_item_(&node_item), shape_inference_state_(node_item), subgraph_context_(subgraph_context) { this->op_desc_ = node_item.node->GetOpDesc(); +} + +Status NodeState::Init(int group, const shared_ptr &frame_state) { + GE_CHECK_NOTNULL(frame_state); + group_ = group; + frame_state_ = frame_state; auto unique_task_context = TaskContext::Create(this, subgraph_context_); + GE_CHECK_NOTNULL(unique_task_context); task_context_ = std::shared_ptr(unique_task_context.release()); + return SUCCESS; } Status NodeState::AwaitInputTensors(GraphExecutionContext &context) const { @@ -350,6 +358,7 @@ void NodeState::ResetContext(uint64_t iteration) { switch_index_ = -1; subgraph_context_->ResetContext(node_item_->node); auto unique_task_context = TaskContext::Create(this, subgraph_context_); + GE_CHECK_NOTNULL_JUST_RETURN(unique_task_context); task_context_ = std::shared_ptr(unique_task_context.release()); data_scheduled_ = static_cast(node_item_->root_data_.size()); diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index 72e2b90e..85f9e4c3 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -100,6 +100,8 @@ struct NodeState { NodeState(const NodeItem &node_item, SubgraphContext *subgraph_context); ~NodeState() = default; + Status Init(int group, const shared_ptr &frame_state); + OpDesc *GetOpDesc() const { return op_desc_.get(); } @@ -152,18 +154,10 @@ struct NodeState { return merge_index_; } - void SetGroup(int group) { - group_ = group; - } - int GetGroup() const { return group_; } - void SetFrameState(const shared_ptr &frame_state) { - frame_state_ = frame_state; - } - const shared_ptr &GetKernelTask() const { return kernel_task_; } diff --git a/ge/hybrid/executor/subgraph_context.cc b/ge/hybrid/executor/subgraph_context.cc index 41ada9af..5e97a9a2 100644 --- a/ge/hybrid/executor/subgraph_context.cc +++ b/ge/hybrid/executor/subgraph_context.cc @@ -79,20 +79,31 @@ NodeStatePtr SubgraphContext::GetOrCreateNodeState(const NodeItem *node_item) { return nullptr; } + return CreateNodeState(node_item); +} + +NodeStatePtr SubgraphContext::CreateNodeState(const NodeItem *node_item) { GELOGD("[%s] lock for write", node_item->NodeName().c_str()); if (mmRWLockWRLock(&rw_lock_) != EN_OK) { REPORT_CALL_ERROR("E19999", "[Node:%s] Lock for write failed", node_item->NodeName().c_str()); GELOGE(INTERNAL_ERROR, "[RWLock][Lock][Node:%s] Lock for write failed", node_item->NodeName().c_str()); return nullptr; } + auto &node_state = node_states_[node_item]; - if (node_state == nullptr) { - const auto &guard = node_item->MutexGuard("GetOrCreateNodeState"); - node_state.reset(new(std::nothrow)NodeState(*node_item, this)); - node_state->SetFrameState(GetOrCreateFrameState(*node_item)); - node_state->SetGroup(group_); - (void)guard; - } + do { + if (node_state == nullptr) { + const auto &guard = node_item->MutexGuard("GetOrCreateNodeState"); + node_state.reset(new(std::nothrow)NodeState(*node_item, this)); + if (node_state == nullptr || node_state->Init(group_, GetOrCreateFrameState(*node_item)) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "[Create][NodeState] failed for[%s].", node_item->NodeName().c_str()); + REPORT_CALL_ERROR("E19999", "Create NodeState failed for %s.", node_item->NodeName().c_str()); + break; + } + (void)guard; + } + } while (0); + GELOGD("[%s] unlock for write", node_item->NodeName().c_str()); if (mmWRLockUnLock(&rw_lock_) != EN_OK) { REPORT_CALL_ERROR("E19999", "[Node:%s] Unlock for write failed", node_item->NodeName().c_str()); diff --git a/ge/hybrid/executor/subgraph_context.h b/ge/hybrid/executor/subgraph_context.h index d11d00d7..023be981 100644 --- a/ge/hybrid/executor/subgraph_context.h +++ b/ge/hybrid/executor/subgraph_context.h @@ -51,6 +51,7 @@ class SubgraphContext { void NodeDone(const NodePtr &node); private: + NodeStatePtr CreateNodeState(const NodeItem *node_item); FrameStatePtr GetOrCreateFrameState(const NodeItem &node_item); // no lock friend class TaskContext; const GraphItem *graph_item_; From f578e8fff4f958e1ec52b8e0c73b6dbc95e7c77d Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 12 Jun 2021 18:36:32 +0800 Subject: [PATCH 024/226] Fix NodeState for UT --- .../executor/worker/execution_engine_unittest.cc | 23 +++++++++++----------- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 20 +++++++++++-------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc index e0ccbfa5..cc20d614 100644 --- a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc +++ b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc @@ -83,15 +83,14 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_kernel_task) { execution_context.profiling_level = 1; SubgraphContext subgraph_context(nullptr, &execution_context); - NodeState node_state(*node_item, &subgraph_context); - - ExecutionEngine execution_engine; - ASSERT_TRUE(node_state.GetTaskContext() != nullptr); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); + ASSERT_TRUE(node_state->GetTaskContext() != nullptr); std::function callback; SubgraphExecutor executor(hybrid_model.GetRootGraphItem(), &execution_context); - executor.InitCallback(&node_state, callback); - EXPECT_EQ(execution_engine.ExecuteAsync(node_state, node_state.GetTaskContext(), execution_context, callback), INTERNAL_ERROR); + executor.InitCallback(node_state.get(), callback); + ExecutionEngine execution_engine; + EXPECT_EQ(execution_engine.ExecuteAsync(*node_state, node_state->GetTaskContext(), execution_context, callback), INTERNAL_ERROR); } TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { @@ -115,18 +114,18 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { execution_context.model = &hybrid_model; SubgraphContext subgraph_context(nullptr, &execution_context); - NodeState node_state(*node_item, &subgraph_context); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); uint32_t task_id = 0; uint32_t stream_id = 1; std::string task_type = "rts"; uint32_t block_dim = 0; - node_state.GetTaskContext()->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim); + node_state->GetTaskContext()->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim); - ExecutionEngine execution_engine; - ASSERT_TRUE(node_state.GetTaskContext() != nullptr); + ASSERT_TRUE(node_state->GetTaskContext() != nullptr); std::function callback; SubgraphExecutor executor(hybrid_model.GetRootGraphItem(), &execution_context); - executor.InitCallback(&node_state, callback); - EXPECT_EQ(execution_engine.ExecuteAsync(node_state, node_state.GetTaskContext(), execution_context, callback), INTERNAL_ERROR); + executor.InitCallback(node_state.get(), callback); + ExecutionEngine execution_engine; + EXPECT_EQ(execution_engine.ExecuteAsync(*node_state, node_state->GetTaskContext(), execution_context, callback), INTERNAL_ERROR); } diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index d634ed14..228af832 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -160,9 +160,9 @@ TEST_F(UtestGeHybrid, task_update_tiling_info) { GraphExecutionContext execution_context; SubgraphContext subgraph_context(nullptr, &execution_context); - NodeState node_state(*node_item, &subgraph_context); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); ASSERT_EQ(aicore_task->InitTilingInfo(*op_desc), SUCCESS); - ASSERT_EQ(aicore_task->UpdateTilingInfo(*node_state.GetTaskContext()), SUCCESS); + ASSERT_EQ(aicore_task->UpdateTilingInfo(*node_state->GetTaskContext()), SUCCESS); } TEST_F(UtestGeHybrid, index_taskdefs_failed) { @@ -475,12 +475,14 @@ TEST_F(UtestGeHybrid, TestTaskContext) { node_item->output_start = 0; GraphExecutionContext execution_context; - SubgraphContext subgraph_context(nullptr, &execution_context); + GraphItem graph_item; + SubgraphContext subgraph_context(&graph_item, &execution_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); subgraph_context.all_inputs_.resize(2); subgraph_context.all_outputs_.resize(1); - NodeState node_state(*node_item, &subgraph_context); - auto task_context = node_state.GetTaskContext(); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); + auto task_context = node_state->GetTaskContext(); ASSERT_TRUE(task_context != nullptr); auto desc = task_context->MutableInputDesc(2); ASSERT_TRUE(desc == nullptr); @@ -520,12 +522,14 @@ TEST_F(UtestGeHybrid, hybrid_model_executor_update_args) { node_item->output_start = 0; GraphExecutionContext execution_context; - SubgraphContext subgraph_context(nullptr, &execution_context); + GraphItem graph_item; + SubgraphContext subgraph_context(&graph_item, &execution_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); subgraph_context.all_inputs_.resize(2); subgraph_context.all_outputs_.resize(1); - NodeState node_state(*node_item, &subgraph_context); - auto task_context = node_state.GetTaskContext(); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); + auto task_context = node_state->GetTaskContext(); int32_t buffer[1]; aicore_task->tiling_buffer_ = TensorBuffer::Create(buffer, sizeof(buffer)); From 367774c5b009edc3d8838163629a37925692e611 Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Tue, 15 Jun 2021 14:44:44 +0800 Subject: [PATCH 025/226] enable optimization --- ge/graph/optimize/graph_optimize.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ge/graph/optimize/graph_optimize.cc b/ge/graph/optimize/graph_optimize.cc index 835e257b..55f374eb 100644 --- a/ge/graph/optimize/graph_optimize.cc +++ b/ge/graph/optimize/graph_optimize.cc @@ -336,10 +336,8 @@ Status GraphOptimize::OptimizeAfterStage1(ComputeGraphPtr &compute_graph) { GELOGI("[OptimizeAfterStage1]: engine type will exclude:%s.", exclude_core_type.c_str()); continue; } -#ifndef ONLY_COMPILE_OPEN_SRC GELOGI("Begin to optimize graph after stage1 by engine %s.", iter->first.c_str()); ret = (iter->second)->OptimizeAfterStage1(*compute_graph); -#endif if (ret != SUCCESS) { REPORT_INNER_ERROR("E19999", "Call OptimizeAfterStage1 failed, ret:%d, engine_name:%s, " "graph_name:%s.", ret, iter->first.c_str(), compute_graph->GetName().c_str()); From 181cd5891bd97b4aca9f28330e1f0a20def75e69 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 16:46:28 +0800 Subject: [PATCH 026/226] Release context in execute end. --- ge/hybrid/executor/hybrid_model_executor.cc | 1 + ge/hybrid/executor/subgraph_executor.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index b3c2c471..b4173407 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -125,6 +125,7 @@ Status HybridModelExecutor::ExecuteGraphInternal(HybridModelExecutor::ExecuteArg args.outputs.clear(); HYBRID_CHK_STATUS_RET(root_graph_executor_->GetOutputs(args.outputs, args.output_desc), "Failed to get outputs"); RECORD_MODEL_EXECUTION_EVENT(&context_, "[GetOutput] End"); + root_graph_executor_->ResetContext(); return SUCCESS; } diff --git a/ge/hybrid/executor/subgraph_executor.h b/ge/hybrid/executor/subgraph_executor.h index 758bf426..0f54e4ca 100644 --- a/ge/hybrid/executor/subgraph_executor.h +++ b/ge/hybrid/executor/subgraph_executor.h @@ -41,6 +41,8 @@ class SubgraphExecutor { Status PartialExecuteAsync(int task_group); + void ResetContext() { subgraph_context_.release(); } + /** * Execute subgraph async, output tensor address(not data) and output tensor descriptions are * valid after this method returned From ab7334ed780343a80c885a1b064d1a42fa51faf0 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 16:50:40 +0800 Subject: [PATCH 027/226] Release context in execute end. --- ge/hybrid/executor/hybrid_model_executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index b4173407..2abd9cd6 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -70,6 +70,7 @@ Status HybridModelExecutor::Execute(HybridModelExecutor::ExecuteArgs &args) { context_.profiler->Dump(std::cout); context_.profiler->Reset(); } + root_graph_executor_->ResetContext(); context_.iteration += 1; if (ret == END_OF_SEQUENCE) { @@ -125,7 +126,6 @@ Status HybridModelExecutor::ExecuteGraphInternal(HybridModelExecutor::ExecuteArg args.outputs.clear(); HYBRID_CHK_STATUS_RET(root_graph_executor_->GetOutputs(args.outputs, args.output_desc), "Failed to get outputs"); RECORD_MODEL_EXECUTION_EVENT(&context_, "[GetOutput] End"); - root_graph_executor_->ResetContext(); return SUCCESS; } From 492d36b237ec601da5644054ab3eed4c4fbfd6d7 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 20:01:06 +0800 Subject: [PATCH 028/226] Fix ut. --- tests/ut/ge/single_op/single_op_model_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index 1cb2b22c..fb772c33 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -223,7 +223,7 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { model.model_helper_.model_->SetGraph(graph); auto op_desc = transdata->GetOpDesc(); - op_desc->input_name_idx_["Data"] = 0; + op_desc->impl_->input_name_idx_["Data"] = 0; const vector depend_names = { "Data" }; op_desc->SetOpInferDepends(depend_names); (void)AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); From 0c2d07eb7250e5cad532a906691f48b4dd48b552 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 21:44:09 +0800 Subject: [PATCH 029/226] Fix ut. --- ge/hybrid/executor/subgraph_executor.cc | 9 ++++++--- ge/hybrid/executor/worker/shape_inference_engine.cc | 2 +- tests/ut/ge/single_op/single_op_model_unittest.cc | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 612e7565..4f0566b4 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -100,9 +100,12 @@ Status SubgraphExecutor::InitInputsForUnknownShape(const std::vectorGetOrCreateNodeState(input_node); - GE_CHECK_NOTNULL(node_state); - node_state->GetShapeInferenceState().UpdateInputShape(0, *tensor_desc); + auto op_desc = input_node->GetOpDesc(); + GE_CHECK_NOTNULL(op_desc); + auto output_desc = op_desc->MutableOutputDesc(kDataInputIndex); + output_desc.SetShape(tensor_desc->GetShape()); + output_desc.SetOriginShape(tensor_desc->GetOriginShape()); + output_desc.SetDataType(tensor_desc->GetDataType()); } } diff --git a/ge/hybrid/executor/worker/shape_inference_engine.cc b/ge/hybrid/executor/worker/shape_inference_engine.cc index a2efbb25..4dc5b79c 100755 --- a/ge/hybrid/executor/worker/shape_inference_engine.cc +++ b/ge/hybrid/executor/worker/shape_inference_engine.cc @@ -69,7 +69,7 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) { // Do shape inference GELOGD("[%s] Start to invoke InferShapeAndType", node_item.NodeName().c_str()); - { + if (node_state.GetType() != DATA_TYPE && node_state.GetType() != AIPP_DATA_TYPE) { RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start"); GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true), "[Invoke][InferShapeAndType] for %s failed.", node_item.NodeName().c_str()); diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index fb772c33..cb0b497d 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -30,6 +30,7 @@ #include "single_op/single_op.h" #include "single_op/stream_resource.h" #include "graph/passes/graph_builder_utils.h" +#include "graph/op_desc_impl.h" #undef private #undef protected From 7ce31b2e0ec853582645d45336874c1262424b44 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 22:06:11 +0800 Subject: [PATCH 030/226] Fix ut. --- ge/hybrid/executor/subgraph_executor.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 4f0566b4..b474c5dd 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -103,9 +103,10 @@ Status SubgraphExecutor::InitInputsForUnknownShape(const std::vectorGetOpDesc(); GE_CHECK_NOTNULL(op_desc); auto output_desc = op_desc->MutableOutputDesc(kDataInputIndex); - output_desc.SetShape(tensor_desc->GetShape()); - output_desc.SetOriginShape(tensor_desc->GetOriginShape()); - output_desc.SetDataType(tensor_desc->GetDataType()); + GE_CHECK_NOTNULL(output_desc); + output_desc->SetShape(tensor_desc->GetShape()); + output_desc->SetOriginShape(tensor_desc->GetOriginShape()); + output_desc->SetDataType(tensor_desc->GetDataType()); } } From 24eedfa3b4df7eb41fbb13f36759f7537500209a Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 15 Jun 2021 22:09:17 +0800 Subject: [PATCH 031/226] Fix ut. --- ge/hybrid/executor/worker/shape_inference_engine.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/ge/hybrid/executor/worker/shape_inference_engine.cc b/ge/hybrid/executor/worker/shape_inference_engine.cc index 4dc5b79c..18fed710 100755 --- a/ge/hybrid/executor/worker/shape_inference_engine.cc +++ b/ge/hybrid/executor/worker/shape_inference_engine.cc @@ -68,6 +68,7 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) { } // Do shape inference + // Skipping infer shape of input node. GELOGD("[%s] Start to invoke InferShapeAndType", node_item.NodeName().c_str()); if (node_state.GetType() != DATA_TYPE && node_state.GetType() != AIPP_DATA_TYPE) { RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start"); From b64048a39f53e30fcc69491bf0c93c805bdec3b8 Mon Sep 17 00:00:00 2001 From: xchu42 Date: Sat, 12 Jun 2021 14:01:24 +0800 Subject: [PATCH 032/226] Init NodeExecutor on demand --- ge/hybrid/node_executor/node_executor.cc | 75 +++++++-------- ge/hybrid/node_executor/node_executor.h | 7 +- tests/ut/ge/CMakeLists.txt | 2 + .../hybrid/node_executor/node_executor_unittest.cc | 103 +++++++++++++++++++++ 4 files changed, 143 insertions(+), 44 deletions(-) create mode 100644 tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index 5f3d6e45..04225557 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -58,8 +58,8 @@ Status NodeExecutor::CompileTask(const HybridModel &model, const NodePtr &node, } Status NodeExecutorManager::EnsureInitialized() { - GE_CHK_STATUS_RET(InitializeExecutors()); std::lock_guard lk(mu_); + ++ref_count_; if (initialized_) { return SUCCESS; } @@ -115,17 +115,14 @@ NodeExecutorManager::ExecutorType NodeExecutorManager::ResolveExecutorType(Node return it->second; } -Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) const { +Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) { auto executor_type = ResolveExecutorType(node); + GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); const auto it = executors_.find(executor_type); if (it == executors_.end()) { - REPORT_INNER_ERROR("E19999", "Failed to get executor by type: %d.", static_cast(executor_type)); - GELOGE(INTERNAL_ERROR, "[Check][ExecutorType]Failed to get executor by type: %d.", - static_cast(executor_type)); - return INTERNAL_ERROR; + return GetOrCreateExecutor(executor_type, executor); } - GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); *executor = it->second.get(); return SUCCESS; } @@ -178,51 +175,50 @@ Status NodeExecutorManager::CalcOpRunningParam(Node &node) const { return OpsKernelBuilderManager::Instance().CalcOpRunningParam(node); } -Status NodeExecutorManager::InitializeExecutors() { +Status NodeExecutorManager::GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **out_executor) { std::lock_guard lk(mu_); - if (executor_initialized_) { - ++ref_count_; - GELOGI("Executor is already initialized. add ref count to [%d]", ref_count_); + const auto executor_it = executors_.find(executor_type); + if (executor_it != executors_.end()) { + *out_executor = executor_it->second.get(); return SUCCESS; } - GELOGI("Start to Initialize NodeExecutors"); - for (auto &it : builders_) { - auto engine_type = it.first; - auto build_fn = it.second; - GE_CHECK_NOTNULL(build_fn); - auto executor = std::unique_ptr(build_fn()); - if (executor == nullptr) { - REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for engine type = %d", - static_cast(engine_type)); - GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(engine_type)); - return INTERNAL_ERROR; - } + GELOGI("Start to Initialize NodeExecutor, type = %d", static_cast(executor_type)); + auto it = builders_.find(executor_type); + if (it == builders_.end()) { + REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", + static_cast(executor_type)); + GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for executor type = %d", static_cast(executor_type)); + return INTERNAL_ERROR; + } - GELOGD("Executor of engine type = %d was created successfully", static_cast(engine_type)); - auto ret = executor->Initialize(); - if (ret != SUCCESS) { - REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(engine_type)); - GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(engine_type)); - for (auto &executor_it : executors_) { - executor_it.second->Finalize(); - } - executors_.clear(); - return ret; - } + auto build_fn = it->second; + GE_CHECK_NOTNULL(build_fn); + auto executor = std::unique_ptr(build_fn()); + if (executor == nullptr) { + REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", + static_cast(executor_type)); + GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(executor_type)); + return INTERNAL_ERROR; + } - executors_.emplace(engine_type, std::move(executor)); + GELOGD("Executor of engine type = %d was created successfully", static_cast(executor_type)); + auto ret = executor->Initialize(); + if (ret != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(executor_type)); + GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(executor_type)); + return ret; } - ++ref_count_; - executor_initialized_ = true; - GELOGI("Initializing NodeExecutors successfully."); + *out_executor = executor.get(); + executors_.emplace(executor_type, std::move(executor)); + GELOGI("Initializing NodeExecutor successfully, type = %d", static_cast(executor_type)); return SUCCESS; } void NodeExecutorManager::FinalizeExecutors() { std::lock_guard lk(mu_); - if (!executor_initialized_) { + if (ref_count_ <= 0) { GELOGD("No need for finalizing for not initialized."); return; } @@ -237,7 +233,6 @@ void NodeExecutorManager::FinalizeExecutors() { it.second->Finalize(); } executors_.clear(); - executor_initialized_ = false; GELOGD("Done invoking Finalize successfully."); } diff --git a/ge/hybrid/node_executor/node_executor.h b/ge/hybrid/node_executor/node_executor.h index fffd4e7d..97c9cee9 100644 --- a/ge/hybrid/node_executor/node_executor.h +++ b/ge/hybrid/node_executor/node_executor.h @@ -179,8 +179,6 @@ class NodeExecutorManager { */ Status EnsureInitialized(); - Status InitializeExecutors(); - void FinalizeExecutors(); /** @@ -196,7 +194,7 @@ class NodeExecutorManager { * @param executor executor * @return SUCCESS on success, error code otherwise */ - Status GetExecutor(Node &node, const NodeExecutor **executor) const; + Status GetExecutor(Node &node, const NodeExecutor **executor); /** * Resolve executor type by node @@ -206,12 +204,13 @@ class NodeExecutorManager { ExecutorType ResolveExecutorType(Node &node) const; private: + Status GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **executor); + std::map> executors_; std::map> builders_; std::map engine_mapping_; std::mutex mu_; bool initialized_ = false; - bool executor_initialized_ = false; int ref_count_ = 0; }; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 63579109..cd3d541c 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -836,6 +836,7 @@ set(HYBRID_TEST_FILES "hybrid/executor/subgraph_executor_unittest.cc" "hybrid/executor/worker/execution_engine_unittest.cc" "hybrid/model/hybrid_model_builder_unittest.cc" + "hybrid/node_executor/node_executor_unittest.cc" "hybrid/node_executor/rts/rts_node_task_unittest.cc" "hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc" "hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc" @@ -843,6 +844,7 @@ set(HYBRID_TEST_FILES "hybrid/executor/hybrid_model_async_executor_unittest.cc" "hybrid/executor/hybrid_model_pipeline_executor_unittest.cc" "hybrid/node_executor/aicore/aicore_task_compiler_unittest.cc" + ) set(OTHERS_TEST_FILES diff --git a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc new file mode 100644 index 00000000..8a1240d3 --- /dev/null +++ b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc @@ -0,0 +1,103 @@ +/** + * 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 + +#define private public +#define protected public +#include "hybrid/node_executor/node_executor.h" +#undef protected +#undef private + +using namespace std; +using namespace testing; + +namespace ge { +using namespace hybrid; + +namespace { + bool finalized = false; +} + +class NodeExecutorTest : public testing::Test { + protected: + void SetUp() {} + void TearDown() { } +}; + +class FailureNodeExecutor : public NodeExecutor { + public: + Status Initialize() override { + return INTERNAL_ERROR; + } +}; + +class SuccessNodeExecutor : public NodeExecutor { + public: + Status Initialize() override { + initialized = true; + finalized = false; + return SUCCESS; + } + + Status Finalize() override { + finalized = true; + } + + bool initialized = false; +}; + +REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICORE, FailureNodeExecutor); +REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICPU_TF, SuccessNodeExecutor); + +TEST_F(NodeExecutorTest, TestGetOrCreateExecutor) { + auto &manager = NodeExecutorManager::GetInstance(); + const NodeExecutor *executor = nullptr; + Status ret = SUCCESS; + // no builder + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::RESERVED, &executor); + ASSERT_EQ(ret, INTERNAL_ERROR); + // initialize failure + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICORE, &executor); + ASSERT_EQ(ret, INTERNAL_ERROR); + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); +} + +TEST_F(NodeExecutorTest, TestInitAndFinalize) { + auto &manager = NodeExecutorManager::GetInstance(); + manager.FinalizeExecutors(); + manager.EnsureInitialized(); + manager.EnsureInitialized(); + const NodeExecutor *executor = nullptr; + auto ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); + manager.FinalizeExecutors(); + ASSERT_FALSE(manager.executors_.empty()); + manager.FinalizeExecutors(); + ASSERT_TRUE(manager.executors_.empty()); + ASSERT_TRUE(finalized); +} +} // namespace ge From d1eba02e1e972da774c2ddd474fef242f31b14d5 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 09:28:41 +0800 Subject: [PATCH 033/226] Fix ut. --- tests/ut/ge/single_op/single_op_model_unittest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index fb772c33..cb0b497d 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -30,6 +30,7 @@ #include "single_op/single_op.h" #include "single_op/stream_resource.h" #include "graph/passes/graph_builder_utils.h" +#include "graph/op_desc_impl.h" #undef private #undef protected From 69da59b6b790cd76dca11413b5e342aab6a56caa Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 09:40:26 +0800 Subject: [PATCH 034/226] Fix ut. --- ge/hybrid/executor/subgraph_executor.cc | 5 ++++- tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc | 4 ++-- tests/ut/ge/single_op/single_op_model_unittest.cc | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 7081c8f4..c26eac9b 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -100,13 +100,16 @@ Status SubgraphExecutor::InitInputsForUnknownShape(const std::vectorGetOrCreateNodeState(input_node); + GE_CHECK_NOTNULL(node_state); + node_state->GetShapeInferenceState().UpdateInputShape(0, *tensor_desc); auto op_desc = input_node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); auto output_desc = op_desc->MutableOutputDesc(kDataInputIndex); GE_CHECK_NOTNULL(output_desc); output_desc->SetShape(tensor_desc->GetShape()); output_desc->SetOriginShape(tensor_desc->GetOriginShape()); - output_desc->SetDataType(tensor_desc->GetDataType()); + output_desc->SetDataType(tensor_desc->GetDataType()); } } diff --git a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc index 52537ee2..98bb78f2 100644 --- a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc @@ -87,7 +87,7 @@ TEST_F(UtestHybridModelAsyncExecutor, BuildDeviceTensor) { ASSERT_EQ(size, 100); } -TEST_F(UtestHybridModelAsyncExecutor, Test_execute_internal) { +TEST_F(UtestHybridModelAsyncExecutor, Test_execute) { ComputeGraphPtr graph = std::make_shared("test"); GeRootModelPtr ge_root_model = make_shared(graph); ge_root_model->SetModelName("test_name"); @@ -101,6 +101,6 @@ TEST_F(UtestHybridModelAsyncExecutor, Test_execute_internal) { std::pair> eof_entry; eof_entry.first = nullptr; context.callback_manager->callback_queue_.Push(eof_entry); - ASSERT_EQ(executor.ExecuteGraphInternal(args), SUCCESS); + ASSERT_EQ(executor.Execute(args), SUCCESS); } } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index cb0b497d..63a3eafe 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -224,7 +224,6 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { model.model_helper_.model_->SetGraph(graph); auto op_desc = transdata->GetOpDesc(); - op_desc->impl_->input_name_idx_["Data"] = 0; const vector depend_names = { "Data" }; op_desc->SetOpInferDepends(depend_names); (void)AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); @@ -247,6 +246,9 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { DynamicSingleOp dynamic_single_op(0, &stream_mu_, nullptr); StreamResource res((uintptr_t)1); model.BuildDynamicOp(res, dynamic_single_op); + + op_desc->impl_->input_name_idx_["Data"] = 0; + model.BuildDynamicOp(res, dynamic_single_op); } TEST_F(UtestSingleOpModel, test_host_mem) { From 58086ab1872f2fc7374dc7b969a3fdcb206b7841 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 11:14:05 +0800 Subject: [PATCH 035/226] Release mem. --- ge/hybrid/executor/subgraph_executor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/hybrid/executor/subgraph_executor.h b/ge/hybrid/executor/subgraph_executor.h index 7e1c2d0b..35f6e67e 100644 --- a/ge/hybrid/executor/subgraph_executor.h +++ b/ge/hybrid/executor/subgraph_executor.h @@ -41,7 +41,7 @@ class SubgraphExecutor { Status PartialExecuteAsync(int task_group); - void ResetContext() { subgraph_context_.release(); } + void ResetContext() { subgraph_context_.reset(nullptr); } /** * Execute subgraph async, output tensor address(not data) and output tensor descriptions are From 116167dc88160c6f6c10703f0ad3c8bd570b48eb Mon Sep 17 00:00:00 2001 From: zhou_lili Date: Tue, 15 Jun 2021 11:49:11 +0800 Subject: [PATCH 036/226] ge code for 1981 --- ge/CMakeLists.txt | 2 + ge/executor/CMakeLists.txt | 1 + ge/graph/build/label_allocator.cc | 5 + ge/graph/build/logical_stream_allocator.cc | 5 + ge/graph/build/stream_allocator.cc | 11 +- ge/graph/build/task_generator.cc | 32 +- ge/graph/build/task_generator.h | 1 + ge/graph/load/model_manager/davinci_model.cc | 207 ++++++++--- ge/graph/load/model_manager/davinci_model.h | 6 + .../load/model_manager/task_info/ffts_task_info.cc | 393 +++++++++++++++++++++ .../load/model_manager/task_info/ffts_task_info.h | 66 ++++ ge/graph/partition/graph_partition.cc | 21 +- metadef | 2 +- parser | 2 +- tests/depends/runtime/src/runtime_stub.cc | 4 + tests/ut/ge/CMakeLists.txt | 2 + tests/ut/ge/graph/load/davinci_model_unittest.cc | 140 ++++++++ tests/ut/ge/graph/load/ffts_task_info_unittest.cc | 212 +++++++++++ third_party/fwkacllib/inc/runtime/rt.h | 1 + third_party/fwkacllib/inc/runtime/rt_ffts.h | 185 ++++++++++ third_party/fwkacllib/inc/runtime/rt_model.h | 1 + 21 files changed, 1235 insertions(+), 64 deletions(-) create mode 100644 ge/graph/load/model_manager/task_info/ffts_task_info.cc create mode 100644 ge/graph/load/model_manager/task_info/ffts_task_info.h create mode 100644 tests/ut/ge/graph/load/ffts_task_info_unittest.cc create mode 100755 third_party/fwkacllib/inc/runtime/rt_ffts.h diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 215d2832..81e2d539 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -174,6 +174,7 @@ set(TRAIN_SRC_LIST "graph/load/model_manager/task_info/model_exit_task_info.cc" "graph/load/model_manager/task_info/event_record_task_info.cc" "graph/load/model_manager/task_info/event_wait_task_info.cc" + "graph/load/model_manager/task_info/ffts_task_info.cc" "graph/load/model_manager/task_info/fusion_start_task_info.cc" "graph/load/model_manager/task_info/fusion_stop_task_info.cc" "graph/load/model_manager/task_info/hccl_task_info.cc" @@ -662,6 +663,7 @@ set(INFER_SRC_LIST "graph/load/model_manager/task_info/task_info.cc" "graph/load/model_manager/task_info/event_record_task_info.cc" "graph/load/model_manager/task_info/event_wait_task_info.cc" + "graph/load/model_manager/task_info/ffts_task_info.cc" "graph/load/model_manager/task_info/fusion_start_task_info.cc" "graph/load/model_manager/task_info/fusion_stop_task_info.cc" "graph/load/model_manager/task_info/kernel_ex_task_info.cc" diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index f1267c1e..b04216b8 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -37,6 +37,7 @@ set(SRC_LIST "../graph/load/model_manager/task_info/task_info.cc" "../graph/load/model_manager/task_info/event_record_task_info.cc" "../graph/load/model_manager/task_info/event_wait_task_info.cc" + "../graph/load/model_manager/task_info/ffts_task_info.cc" "../graph/load/model_manager/task_info/fusion_start_task_info.cc" "../graph/load/model_manager/task_info/fusion_stop_task_info.cc" "../graph/load/model_manager/task_info/kernel_ex_task_info.cc" diff --git a/ge/graph/build/label_allocator.cc b/ge/graph/build/label_allocator.cc index 32bdd0a3..dd7ee828 100644 --- a/ge/graph/build/label_allocator.cc +++ b/ge/graph/build/label_allocator.cc @@ -86,6 +86,11 @@ bool LabelAllocator::CollectFunctionalNode(ComputeGraphPtr &graph, std::setGetOpDesc() != nullptr && func_node->GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH)) { + GELOGD("Graph[%s] is ffts subgraph, skip label allocator.", graph->GetName().c_str()); + return true; + } + ComputeGraphPtr owner_graph = func_node->GetOwnerComputeGraph(); if (owner_graph == nullptr) { REPORT_INNER_ERROR("E19999", "ComputeGraph owner not set in node:%s(%s), graph:%s", diff --git a/ge/graph/build/logical_stream_allocator.cc b/ge/graph/build/logical_stream_allocator.cc index c74cdf7a..58763aa9 100644 --- a/ge/graph/build/logical_stream_allocator.cc +++ b/ge/graph/build/logical_stream_allocator.cc @@ -474,6 +474,11 @@ Status UpdateForSkippedEnginePass::Run(ComputeGraphPtr graph, const vectorGetDirectNode()) { auto op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); + if (op_desc->HasAttr(ATTR_NAME_THREAD_SCOPE_ID)) { + op_desc->SetStreamId(kInvalidStream); + GELOGI("Ffts node %s of type %s reassign to invalid stream.", node->GetName().c_str(), node->GetType().c_str()); + continue; + } int64_t stream_id = op_desc->GetStreamId(); if (ops_without_label.find(op_desc) != ops_without_label.end()) { if (AreAllPredStreamsInvalid(node) && op_desc->GetSubgraphInstanceNames().empty()) { diff --git a/ge/graph/build/stream_allocator.cc b/ge/graph/build/stream_allocator.cc index dae36b83..d896925c 100644 --- a/ge/graph/build/stream_allocator.cc +++ b/ge/graph/build/stream_allocator.cc @@ -432,7 +432,11 @@ Status StreamAllocator::SetActiveStreamsForSubgraphs() { // Insert the send/recv event id to the graph Status StreamAllocator::InsertSyncEvents() { - for (const auto &cur_node : whole_graph_->GetNodes(whole_graph_->GetGraphUnknownFlag())) { + auto ffts_filter = [](const Node &node, const char *, const ComputeGraphPtr &) { + return !node.GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH); + }; + + for (const auto &cur_node : whole_graph_->GetNodes(whole_graph_->GetGraphUnknownFlag(), nullptr, ffts_filter)) { // Take the adjacent points, then judge whether need to insert the event for (const OutDataAnchorPtr &anchor : cur_node->GetAllOutDataAnchors()) { for (const InDataAnchorPtr &peer_in_anchor : anchor->GetPeerInDataAnchors()) { @@ -531,6 +535,11 @@ Status StreamAllocator::InsertOneEventInTwoNodes(const NodePtr &cur_node, const Status StreamAllocator::InsertEventsForSubgraph() { for (const auto &subgraph : whole_graph_->GetAllSubgraphs()) { GE_CHECK_NOTNULL(subgraph); + const auto parent_node = subgraph->GetParentNode(); + if (parent_node != nullptr && parent_node->GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH)) { + GELOGD("Skip ffts subgraph, parent node is %s.", parent_node->GetName().c_str()); + continue; + } for (const auto &node : subgraph->GetDirectNode()) { auto op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 12da803d..f9456aab 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -354,7 +354,10 @@ Status TaskGenerator::GenerateTask(RunContext &run_context, ComputeGraphPtr &gra }; GE_MAKE_GUARD(release, callback); - for (auto &node : graph->GetNodes(graph->GetGraphUnknownFlag())) { + auto ffts_filter = [](const Node &node, const char *, const ComputeGraphPtr &) { + return !node.GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH); + }; + for (auto &node : graph->GetNodes(graph->GetGraphUnknownFlag(), nullptr, ffts_filter)) { OpDescPtr op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); node_index++; @@ -380,10 +383,8 @@ Status TaskGenerator::GenerateTask(RunContext &run_context, ComputeGraphPtr &gra GELOGI("Fusion node[name:%s, type:%s] do not need generate task again.", name.c_str(), type.c_str()); continue; } - if (op_kernel_lib_name.empty()) { - GELOGI("Node[name:%s, type:%s] does not need to generate task.", name.c_str(), type.c_str()); - continue; - } + GE_CHK_BOOL_EXEC_INFO(!op_kernel_lib_name.empty(), continue, + "Node[name:%s, type:%s] does not need to generate task.", name.c_str(), type.c_str()); auto kernel_info_store = ops_kernel_manager.GetOpsKernelInfoStore(op_kernel_lib_name); if (kernel_info_store == nullptr) { REPORT_INNER_ERROR("E19999", "Get ops kernel info store failed for op:%s(%s), op_kernel_name:%s", @@ -394,6 +395,10 @@ Status TaskGenerator::GenerateTask(RunContext &run_context, ComputeGraphPtr &gra } GE_CHK_STATUS_RET(UpdateAnchorStatus(node), "[Call][UpdateAnchorStatus] node:%s(%s) failed", name.c_str(), type.c_str()); + if (node->GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH)) { + GE_CHK_STATUS_RET(UpdateAnchorStatusForFfts(node), "[Call][UpdateAnchorStatusForFfts] node:%s(%s) failed", + name.c_str(), type.c_str()); + } // Profiling task size_t task_list_size_before = task_def_list.size(); GE_CHK_STATUS_RET(InsertProfilingTaskBefore(op_desc, profiling_point, all_reduce_nodes, node_index, task_def_list)); @@ -571,7 +576,24 @@ Status TaskGenerator::GenerateTaskForFusionNode(FusionTaskInfo &fusion_task_info return ret; } +Status TaskGenerator::UpdateAnchorStatusForFfts(const NodePtr &node) { + GELOGD("Start UpdateAnchorStatusForFfts for %s.", node->GetName().c_str()); + if (!node->GetOpDesc()->GetSubgraphInstanceNames().empty()) { + for (size_t i = 0; i < node->GetOpDesc()->GetSubgraphInstanceNames().size(); ++i) { + auto sub_graph = NodeUtils::GetSubgraph(*node, i); + GE_CHECK_NOTNULL(sub_graph); + GELOGD("Start update anchor status for %s.", sub_graph->GetName().c_str()); + for (auto &ffts_node : sub_graph->GetDirectNode()) { + GE_CHK_STATUS_RET(UpdateAnchorStatus(ffts_node), "[Call][UpdateAnchorStatus] node:%s(%s) failed", + ffts_node->GetName().c_str(), ffts_node->GetType().c_str()); + } + } + } + return SUCCESS; +} + Status TaskGenerator::UpdateAnchorStatus(const NodePtr &node) { + GELOGD("Start UpdateAnchorStatus for %s.", node->GetName().c_str()); if (NodeUtils::SetAllAnchorStatus(node) != GRAPH_SUCCESS) { REPORT_CALL_ERROR("E19999", "SetAllAnchorStatus fail for op:%s(%s)", node->GetName().c_str(), node->GetType().c_str()); diff --git a/ge/graph/build/task_generator.h b/ge/graph/build/task_generator.h index 9f12d568..40cef3ba 100755 --- a/ge/graph/build/task_generator.h +++ b/ge/graph/build/task_generator.h @@ -80,6 +80,7 @@ class TaskGenerator { Status FindProfilingNodeIndex(const ComputeGraphPtr &graph, ProfilingPoint &profiling_point, std::vector &all_reduce_nodes); private: + Status UpdateAnchorStatusForFfts(const NodePtr &node); Status UpdateAnchorStatus(const NodePtr &node); Status UpdateOpIsVarAttr(const OpDescPtr &op_desc, uint64_t session_id); diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 5b67c205..97238a4a 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -99,6 +99,9 @@ const uint32_t kEndOfSequenceNew = 507005; const int32_t kModelAbortNormal = 0x0704000e; const int32_t kModelAbortNormalNew = 507024; const uint32_t kInteval = 2; +const uint32_t kFftsTbeHandleElementSize = 2; +const uint32_t kNonTailBlock = 0; +const uint32_t kTailBlock = 1; const char *const kModelName = "model_name"; const char *const kModeleId = "model_id"; const char *const kLoadStartTime = "load_start_time"; @@ -116,14 +119,15 @@ const char *const kWorkSpaceSize = "workspace_size"; const char *const kTotalSize = "total_size"; const char *const kTaskCount = "task_count"; const char *const kTaskId = "task_id"; -const char* const kRequestId = "request_id"; -const char* const kThreadId = "thread_id"; -const char* const kInputBeginTime = "input_begin_time"; -const char* const kInputEndTime = "input_end_time"; -const char* const kInferBeginTime = "infer_begin_time"; -const char* const kInferEndTime = "infer_end_time"; -const char* const kOutputBeginTime = "output_start_time"; -const char* const kOutputEndTime = "output_end_time"; +const char *const kRequestId = "request_id"; +const char *const kThreadId = "thread_id"; +const char *const kInputBeginTime = "input_begin_time"; +const char *const kInputEndTime = "input_end_time"; +const char *const kInferBeginTime = "infer_begin_time"; +const char *const kInferEndTime = "infer_end_time"; +const char *const kOutputBeginTime = "output_start_time"; +const char *const kOutputEndTime = "output_end_time"; +const char *const kStubFuncName = "_register_stub_func"; const uint32_t kStringHeadElems = 2; const uint32_t kPlacementHostData = 0; const size_t kAlignment = 64; @@ -902,10 +906,8 @@ Status DavinciModel::InitNodes(const ComputeGraphPtr &compute_graph) { SetLabelForDynamic(node); auto it = op_desc_handle.find(op_desc->GetType()); if (it != op_desc_handle.end()) { - if ((this->*it->second)(op_desc) != SUCCESS) { - GELOGE(PARAM_INVALID, "[Init][Node] failed, Name:%s", op_desc->GetName().c_str()); - return PARAM_INVALID; - } + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((this->*it->second)(op_desc) != SUCCESS, return PARAM_INVALID, + "[Init][Node] failed, Name:%s", op_desc->GetName().c_str()); continue; } @@ -935,7 +937,8 @@ Status DavinciModel::InitNodes(const ComputeGraphPtr &compute_graph) { GE_TIMESTAMP_RESTART(InitTbeHandle); if (IsTbeTask(op_desc)) { - Status status = InitTbeHandle(op_desc); + Status status = + op_desc->HasAttr(ATTR_NAME_THREAD_SCOPE_ID) ? InitTbeHandleWithFfts(op_desc) : InitTbeHandle(op_desc); if (status != SUCCESS) { GELOGE(status, "[Init][TbeHandle] failed. op:%s", op_desc->GetName().c_str()); return status; @@ -3700,6 +3703,7 @@ Status DavinciModel::InitConstant(const OpDescPtr &op_desc) { /// @return Status /// Status DavinciModel::InitTbeHandle(const OpDescPtr &op_desc) { + string bin_file = op_desc->GetName(); auto kernel = ge_model_->GetTBEKernelStore().FindKernel(op_desc->GetName()); auto tbe_kernel = (kernel != nullptr) ? kernel : op_desc->TryGetExtAttr(OP_EXTATTR_NAME_TBE_KERNEL, TBEKernelPtr()); if (tbe_kernel == nullptr) { @@ -3708,12 +3712,61 @@ Status DavinciModel::InitTbeHandle(const OpDescPtr &op_desc) { GELOGE(INTERNAL_ERROR, "[Check][Param] TBE: %s can't find tvm bin file!", op_desc->GetName().c_str()); return INTERNAL_ERROR; } + GE_CHK_STATUS_RET(FunctionRegister(op_desc, bin_file, tbe_kernel, false), "Function register of bin file: %s failed", + bin_file.c_str()); + return SUCCESS; +} - std::string session_graph_model_id; - GetUniqueId(op_desc, session_graph_model_id); - const char *bin_file_key = GetRegisterStub(op_desc->GetName(), session_graph_model_id); // from set, always valid. - TBEHandleStore &kernel_store = TBEHandleStore::GetInstance(); +Status DavinciModel::InitTbeHandleWithFfts(const OpDescPtr &op_desc) { + std::vector tbe_kernel; + tbe_kernel = op_desc->TryGetExtAttr(OP_EXTATTR_NAME_THREAD_TBE_KERNEL, tbe_kernel); + GELOGD("Kernel bin ptr vec size is %zu.", tbe_kernel.size()); + if (tbe_kernel.size() != kFftsTbeHandleElementSize) { + REPORT_INNER_ERROR("E19999", "Get tbe_kernel for op:%s(%s) fail, model_id:%u", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), model_id_); + GELOGE(INTERNAL_ERROR, "[Check][Param] TBE: %s can't find tvm bin file, size is %zu when ffts", + op_desc->GetName().c_str(), tbe_kernel.size()); + return INTERNAL_ERROR; + } + if (tbe_kernel[0] == nullptr || tbe_kernel[1] == nullptr) { + REPORT_INNER_ERROR("E19999", "Tbe kernel for op:%s is nullptr.", op_desc->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Check][Param] TBE: tvm bin file of %s is nullptr when ffts.", op_desc->GetName().c_str()); + return INTERNAL_ERROR; + } + vector bin_file_keys; + (void)AttrUtils::GetListStr(op_desc, kStubFuncName, bin_file_keys); + if (bin_file_keys.size() != kFftsTbeHandleElementSize) { + REPORT_INNER_ERROR("E19999", "Get bin_file for op:%s(%s) fail.", op_desc->GetName().c_str(), + op_desc->GetType().c_str()); + GELOGE(INTERNAL_ERROR, "[Check][Param] TBE: %s can't find bin file keys, size is %zu when ffts", + op_desc->GetName().c_str(), bin_file_keys.size()); + return INTERNAL_ERROR; + } + GE_CHK_STATUS_RET(FunctionRegister(op_desc, bin_file_keys[kNonTailBlock], tbe_kernel[kNonTailBlock], true, + kNonTailBlock), + "Function register of first bin file %s failed.", bin_file_keys[kNonTailBlock].c_str()); + GE_CHK_STATUS_RET(FunctionRegister(op_desc, bin_file_keys[kTailBlock], tbe_kernel[kTailBlock], true, kTailBlock), + "Function register of second bin file %s failed.", bin_file_keys[kTailBlock].c_str()); + return SUCCESS; +} +Status DavinciModel::FunctionRegister(const OpDescPtr &op_desc, string &bin_file, OpKernelBinPtr &tbe_kernel, + bool is_ffts, size_t thread_index) { + if (thread_index > 1) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed. Thread index: %zu should less than 1.", thread_index); + return INTERNAL_ERROR; + } + const char *bin_file_key; + if (is_ffts) { + bin_file_key = GetRegisterStub(bin_file, ""); + GELOGI("Node:%s inherit func name:%s directly.", op_desc->GetName().c_str(), bin_file_key); + } else { + std::string session_graph_model_id; + GetUniqueId(op_desc, session_graph_model_id); + bin_file_key = GetRegisterStub(bin_file, session_graph_model_id); // from set, always valid. + } + + TBEHandleStore &kernel_store = TBEHandleStore::GetInstance(); std::lock_guard lock(tvm_bin_mutex_); if (rtQueryFunctionRegistered(bin_file_key) != RT_ERROR_NONE) { void *bin_handle = nullptr; @@ -3721,59 +3774,115 @@ Status DavinciModel::InitTbeHandle(const OpDescPtr &op_desc) { GELOGD("TBE: can't find the kernel_name[%s] in HandleMap", bin_file_key); rtDevBinary_t binary; - std::string json_string; - GE_IF_BOOL_EXEC(AttrUtils::GetStr(op_desc, TVM_ATTR_NAME_MAGIC, json_string), - GELOGD("Get original type of session_graph_id.")); - if (json_string == "RT_DEV_BINARY_MAGIC_ELF_AICPU") { - binary.magic = RT_DEV_BINARY_MAGIC_ELF_AICPU; - } else if (json_string == "RT_DEV_BINARY_MAGIC_ELF") { - binary.magic = RT_DEV_BINARY_MAGIC_ELF; - } else if (json_string == "RT_DEV_BINARY_MAGIC_ELF_AIVEC") { - binary.magic = RT_DEV_BINARY_MAGIC_ELF_AIVEC; - } else if (json_string == "RT_DEV_BINARY_MAGIC_ELF_AICUBE") { - binary.magic = RT_DEV_BINARY_MAGIC_ELF_AICUBE; - } else { - REPORT_INNER_ERROR("E19999", "Attr:%s value:%s in op:%s(%s), model_id:%u, check invalid", - TVM_ATTR_NAME_MAGIC.c_str(), json_string.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str(), model_id_); - GELOGE(PARAM_INVALID, "[Check][Param] Attr:%s value:%s in op:%s(%s), model_id:%u, check invalid", - TVM_ATTR_NAME_MAGIC.c_str(), json_string.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str(), model_id_); - return PARAM_INVALID; - } - + GE_CHK_STATUS_RET(InitBinaryMagic(op_desc, is_ffts, thread_index, binary), "Init binary magic of %s failed.", + op_desc->GetName().c_str()); binary.version = 0; binary.data = tbe_kernel->GetBinData(); binary.length = tbe_kernel->GetBinDataSize(); - GELOGD("TBE: binary.length: %lu", binary.length); GE_CHK_RT_RET(rtDevBinaryRegister(&binary, &bin_handle)); - std::string meta_data; - GE_IF_BOOL_EXEC(AttrUtils::GetStr(op_desc, TVM_ATTR_NAME_METADATA, meta_data), - GELOGI("Get original type of json_string")); - GELOGD("TBE: meta data: %s", meta_data.empty() ? "null" : meta_data.c_str()); - GE_IF_BOOL_EXEC(!meta_data.empty(), GE_CHK_RT_RET(rtMetadataRegister(bin_handle, meta_data.c_str()))); - + GE_CHK_STATUS_RET(InitMetaData(op_desc, is_ffts, thread_index, bin_handle), "Init tvm meta data of %s failed.", + op_desc->GetName().c_str()); kernel_store.StoreTBEHandle(bin_file_key, bin_handle, tbe_kernel); } else { GELOGI("TBE: find the kernel_name[%s] in HandleMap", bin_file_key); kernel_store.ReferTBEHandle(bin_file_key); } - std::string kernel_name; - GE_IF_BOOL_EXEC(AttrUtils::GetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name), - GELOGD("Get original type of kernel_name")); + GE_CHK_STATUS_RET(InitKernelName(op_desc, is_ffts, thread_index, kernel_name), "Init kernel name of %s failed.", + op_desc->GetName().c_str()); GE_CHK_RT_RET(rtFunctionRegister(bin_handle, bin_file_key, bin_file_key, kernel_name.c_str(), 0)); used_tbe_handle_map_[bin_file_key] = 1; // Init used num to 1. return SUCCESS; } - // Kernel registed, Increase used num in store. StoreTbeHandle(bin_file_key); return SUCCESS; } +Status DavinciModel::InitBinaryMagic(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, + rtDevBinary_t &binary) { + string json_string; + const string &tvm_magic = is_ffts ? TVM_ATTR_NAME_THREAD_MAGIC : TVM_ATTR_NAME_MAGIC; + const static std::map binary_magics = { + {"RT_DEV_BINARY_MAGIC_ELF_AICPU", RT_DEV_BINARY_MAGIC_ELF_AICPU}, + {"RT_DEV_BINARY_MAGIC_ELF", RT_DEV_BINARY_MAGIC_ELF}, + {"RT_DEV_BINARY_MAGIC_ELF_AIVEC", RT_DEV_BINARY_MAGIC_ELF_AIVEC}, + {"RT_DEV_BINARY_MAGIC_ELF_AICUBE", RT_DEV_BINARY_MAGIC_ELF_AICUBE} + }; + if (is_ffts) { + vector json_list; + (void)AttrUtils::GetListStr(op_desc, tvm_magic, json_list); + if (json_list.size() != kFftsTbeHandleElementSize) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed. Attr is %s, thread index is %zu, json list size is %zu.", + tvm_magic.c_str(), thread_index, json_list.size()); + return INTERNAL_ERROR; + } + json_string = json_list[thread_index]; + } else { + (void)AttrUtils::GetStr(op_desc, tvm_magic, json_string); + } + auto iter = binary_magics.find(json_string); + if (iter == binary_magics.end()) { + REPORT_INNER_ERROR("E19999", "Attr:%s value:%s in op:%s(%s), model_id:%u, check invalid", + tvm_magic.c_str(), json_string.c_str(), op_desc->GetName().c_str(), + op_desc->GetType().c_str(), model_id_); + GELOGE(PARAM_INVALID, "[Check][Param] Attr:%s value:%s in op:%s(%s), model_id:%u, check invalid", + TVM_ATTR_NAME_MAGIC.c_str(), json_string.c_str(), + op_desc->GetName().c_str(), op_desc->GetType().c_str(), model_id_); + return PARAM_INVALID; + } + binary.magic = iter->second; + return SUCCESS; +} + +Status DavinciModel::InitMetaData(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, void *bin_handle) { + string meta_data; + const string &tvm_metadata = is_ffts ? TVM_ATTR_NAME_THREAD_METADATA : TVM_ATTR_NAME_METADATA; + if (is_ffts) { + vector meta_data_list; + (void)AttrUtils::GetListStr(op_desc, tvm_metadata, meta_data_list); + if (meta_data_list.size() != kFftsTbeHandleElementSize) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed, attr is %s, thread index is %zu, meta data list size is %zu.", + tvm_metadata.c_str(), thread_index, meta_data_list.size()); + return INTERNAL_ERROR; + } + meta_data = meta_data_list[thread_index]; + } else { + (void)AttrUtils::GetStr(op_desc, tvm_metadata, meta_data); + } + GELOGD("TBE: meta data: %s", meta_data.empty() ? "null" : meta_data.c_str()); + if (!meta_data.empty()) { + GE_CHK_RT_RET(rtMetadataRegister(bin_handle, meta_data.c_str())); + } + return SUCCESS; +} + +Status DavinciModel::InitKernelName(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, string &kernel_name) { + if (is_ffts) { + // delete prefix, eg: *sgt_graph_nodes*/loss_scale/gradient/fp32_vals/Mean_grad/Tile + vector kernel_name_list; + auto pos = op_desc->GetName().find("/"); + if (pos == std::string::npos) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed, subgraph node name: %s.", op_desc->GetName().c_str()); + return INTERNAL_ERROR; + } + string attr_kernel_name = op_desc->GetName().substr(pos + 1) + "_thread_kernelname"; + (void)AttrUtils::GetListStr(op_desc, attr_kernel_name, kernel_name_list); + if (kernel_name_list.size() != kFftsTbeHandleElementSize) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed, attr is %s, thread index is %zu, kernel name list size is %zu.", + attr_kernel_name.c_str(), thread_index, kernel_name_list.size()); + return INTERNAL_ERROR; + } + kernel_name = kernel_name_list[thread_index]; + } else { + string attr_kernel_name = op_desc->GetName() + "_kernelname"; + (void)AttrUtils::GetStr(op_desc, attr_kernel_name, kernel_name); + } + return SUCCESS; +} + void DavinciModel::StoreTbeHandle(const std::string &handle_key) { // Online mode FE may call rtFunctionRegister. TBEHandleStore &kernel_store = TBEHandleStore::GetInstance(); diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index 819a2ea2..4c06ad98 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -771,6 +771,12 @@ class DavinciModel { /// @return Status /// Status InitTbeHandle(const OpDescPtr &op_desc); + Status InitTbeHandleWithFfts(const OpDescPtr &op_desc); + Status FunctionRegister(const OpDescPtr &op_desc, string &bin_file, OpKernelBinPtr &tbe_kernel, bool is_ffts, + size_t thread_index = 0); + Status InitBinaryMagic(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, rtDevBinary_t &binary); + Status InitMetaData(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, void *bin_handle); + Status InitKernelName(const OpDescPtr &op_desc, bool is_ffts, size_t thread_index, string &kernel_name); void StoreTbeHandle(const string &handle_key); void CleanTbeHandle(); diff --git a/ge/graph/load/model_manager/task_info/ffts_task_info.cc b/ge/graph/load/model_manager/task_info/ffts_task_info.cc new file mode 100644 index 00000000..e311ccac --- /dev/null +++ b/ge/graph/load/model_manager/task_info/ffts_task_info.cc @@ -0,0 +1,393 @@ +/** + * 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 "graph/load/model_manager/task_info/ffts_task_info.h" + +#include + +#include "graph/load/model_manager/davinci_model.h" + +namespace { +constexpr uint32_t kAddrLen = sizeof(void *); +} +namespace ge { +FftsTaskInfo::~FftsTaskInfo() { + GE_FREE_RT_LOG(args_); +} + +Status FftsTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) { + GELOGI("FftsTaskInfo Init Start."); + GE_CHECK_NOTNULL(davinci_model); + davinci_model_ = davinci_model; + GE_CHK_STATUS_RET_NOLOG(SetStream(task_def.stream_id(), davinci_model_->GetStreamList())); + + const domi::FftsTaskDef &ffts_task_def = task_def.ffts_task(); + OpDescPtr op_desc = davinci_model_->GetOpByIndex(ffts_task_def.op_index()); + GE_CHECK_NOTNULL(op_desc); + + if ((ffts_task_def.sub_task_size() > static_cast(RT_FFTS_MAX_SUB_TASK_NUM)) || + (ffts_task_def.ticket_cache_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_NUM))) { + GELOGE(INTERNAL_ERROR, "[Check][Param] failed. Node: %s, sub task desc size: %d, ticket cache size: %d", + op_desc->GetName().c_str(), ffts_task_def.sub_task_size(), ffts_task_def.ticket_cache_size()); + return INTERNAL_ERROR; + } + args_size_ = kAddrLen * ffts_task_def.addr_size(); + GE_CHK_RT_RET(rtMalloc(&args_, args_size_, RT_MEMORY_HBM)); + InitFftsDescInfo(ffts_task_def.ffts_desc(), sub_task_info_.fftsDesc); + + sub_task_info_.fftsType = static_cast(ffts_task_def.ffts_type()); + sub_task_info_.subTaskNum = ffts_task_def.sub_task_size(); + for (int idx = 0; idx < ffts_task_def.sub_task_size(); ++idx) { + GE_CHK_STATUS_RET_NOLOG(InitSubTaskInfo(ffts_task_def.sub_task(idx), sub_task_info_.subTask[idx])); + } + + sub_task_info_.tickCacheNum = ffts_task_def.ticket_cache_size(); + for (int idx = 0; idx < ffts_task_def.ticket_cache_size(); ++idx) { + GE_CHK_STATUS_RET_NOLOG(InitTicketCache(ffts_task_def.ticket_cache(idx), sub_task_info_.ticketCache[idx])); + } + + size_t data_size = kAddrLen * io_addrs_.size(); + GE_CHK_RT_RET(rtMemcpy(args_, args_size_, io_addrs_.data(), data_size, RT_MEMCPY_HOST_TO_DEVICE)); + GELOGI("FftsTaskInfo::Init Success. Node: %s, input/output size: %zu", op_desc->GetName().c_str(), io_addrs_.size()); + return SUCCESS; +} + +void FftsTaskInfo::InitFftsDescInfo(const domi::FftsDescInfoDef &ffts_desc_def, rtFftsDescInfo_t &ffts_desc) { + ffts_desc.tm = static_cast(ffts_desc_def.tm()); + ffts_desc.di = static_cast(ffts_desc_def.di()); + ffts_desc.dw = static_cast(ffts_desc_def.dw()); + ffts_desc.df = static_cast(ffts_desc_def.df()); + ffts_desc.dataSplitUnit = static_cast(ffts_desc_def.data_split_unit()); + ffts_desc.prefetchOstNum = static_cast(ffts_desc_def.prefetch_ost_num()); + ffts_desc.cacheMaintainOstNum = static_cast(ffts_desc_def.cache_maintain_ost_num()); + ffts_desc.aicPrefetchUpper = static_cast(ffts_desc_def.aic_prefetch_upper()); + ffts_desc.aicPrefetchLower = static_cast(ffts_desc_def.aic_prefetch_lower()); + ffts_desc.aivPrefetchUpper = static_cast(ffts_desc_def.aiv_prefetch_upper()); + ffts_desc.aivPrefetchLower = static_cast(ffts_desc_def.aiv_prefetch_lower()); +} + +Status FftsTaskInfo::InitSubTaskInfo(const domi::FftsSubTaskDef &sub_task_def, rtFftsSubTaskInfo_t &sub_task_desc) { + if ((sub_task_def.dst_tick_cache_id_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK)) || + (sub_task_def.src_tick_cache_id_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK))) { + GELOGE(FAILED, "[Check][Param] Invalid FftsSubTaskInfo, dst tick cache id size: %d, src tick cache id size: %d", + sub_task_def.dst_tick_cache_id_size(), sub_task_def.src_tick_cache_id_size()); + return FAILED; + } + + if (sub_task_def.has_auto_thread_aic_aiv() == sub_task_def.has_manual_thread_aic_aiv()) { + GELOGE(FAILED, "[Check][Param] Invalid FftsSubTaskInfo, auto thread aic/aiv: %d, manual thread aic/aiv: %d", + sub_task_def.has_auto_thread_aic_aiv(), sub_task_def.has_manual_thread_aic_aiv()); + return FAILED; + } + + thread_dim_ = sub_task_def.thread_dim(); + GE_CHK_BOOL_RET_STATUS(thread_dim_ != 0, FAILED, "[Get][thread_dim] failed, Invalid thread dim: %u!", thread_dim_); + + sub_task_desc.subTaskType = static_cast(sub_task_def.sub_task_type()); + sub_task_desc.threadDim = sub_task_def.thread_dim(); + + sub_task_desc.dstTickCacheVldBitmap = sub_task_def.dst_tick_cache_vld_bitmap(); + sub_task_desc.srcTickCacheVldBitmap = sub_task_def.src_tick_cache_vld_bitmap(); + sub_task_desc.srcDataOutOfSubGraphBitmap = sub_task_def.src_data_out_of_subgraph_bitmap(); + + for (int idx = 0; idx < sub_task_def.dst_tick_cache_id_size(); ++idx) { + sub_task_desc.dstTickCacheID[idx] = sub_task_def.dst_tick_cache_id(idx); + } + + for (int idx = 0; idx < sub_task_def.src_tick_cache_id_size(); ++idx) { + sub_task_desc.srcTickCacheID[idx] = sub_task_def.src_tick_cache_id(idx); + } + + if (sub_task_def.has_auto_thread_aic_aiv()) { + GE_CHK_STATUS_RET_NOLOG(InitAutoAicAiv(sub_task_def.auto_thread_aic_aiv(), sub_task_desc.custom.autoThreadAicAiv)); + } + + if (sub_task_def.has_manual_thread_aic_aiv()) { + GE_CHK_STATUS_RET_NOLOG( + InitManualAicAiv(sub_task_def.manual_thread_aic_aiv(), sub_task_desc.custom.manualThreadAicAiv)); + } + + if (sub_task_def.has_manual_thread_nop()) { + GE_CHK_STATUS_RET_NOLOG(InitManualNop(sub_task_def.manual_thread_nop(), sub_task_desc.custom.manualThreadNop)); + } + + return SUCCESS; +} + +Status FftsTaskInfo::InitTicketCache(const domi::TicketCacheDef &ticket_cache_def, rtTicketCache_t &ticket_cache) { + if (ticket_cache_def.has_auto_thread_cache() == ticket_cache_def.has_manual_thread_cache()) { + GELOGE(FAILED, "[Check][Param] Invalid TicketCacheDef, has auto thread cache: %d, has manual thread cache: %d", + ticket_cache_def.has_auto_thread_cache(), ticket_cache_def.has_manual_thread_cache()); + return FAILED; + } + + ticket_cache.cacheOption = static_cast(ticket_cache_def.cache_option()); + ticket_cache.ticketCacheWindow = ticket_cache_def.ticket_cache_window(); + + if (ticket_cache_def.has_auto_thread_cache()) { + InitAutoCacheInfo(ticket_cache_def.auto_thread_cache(), ticket_cache.custom.autoThreadCache); + } + if (ticket_cache_def.has_manual_thread_cache()) { + GE_CHK_STATUS_RET_NOLOG( + InitManualCacheInfo(ticket_cache_def.manual_thread_cache(), ticket_cache.custom.manualThreadCache)); + } + + return SUCCESS; +} + +// task_addr = {0,200,700,1000,2000, 3500} +// task_addr_offset = {20,40,2,100,200} +template +Status FftsTaskInfo::InitIoAddrs(const RuntimeParam &rts_param, const T &aic_aiv_def, uint32_t thread_dim, + uint32_t addr_count) { + for (uint32_t i = 0; i < addr_count; ++i) { + uintptr_t logic_addr = aic_aiv_def.task_addr(i) + thread_dim * aic_aiv_def.task_addr_offset(i); + uint8_t *io_addr = nullptr; + if (ModelUtils::GetRtAddress(rts_param, logic_addr, io_addr) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "[Check][GetRtAddress]GetRtAddress failed."); + return INTERNAL_ERROR; + } + GELOGD("aic_aiv_def task base addr is %ld, offset is %ld, thread is %d, logic addrs is 0x%lx, io addr is %p", + aic_aiv_def.task_addr(i), aic_aiv_def.task_addr_offset(i), thread_dim, logic_addr, io_addr); + io_addrs_.emplace_back(io_addr); + } + return SUCCESS; +} + +Status FftsTaskInfo::InitAutoAicAiv(const domi::AutoThreadAicAivDef &aic_aiv_def, rtAutoThreadAicAivInfo_t &aic_aiv) { + if (aic_aiv_def.src_prefetch_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK)) { + GELOGE(FAILED, "[Check][Param] Invalid AutoThreadAicAivInfo, prefetch size: %d", aic_aiv_def.src_prefetch_size()); + return FAILED; + } + + aic_aiv.taskParamAddr = reinterpret_cast(args_) + kAddrLen * io_addrs_.size(); + GELOGD("AutoThreadAicAivDef: task param addr is %lu.", aic_aiv.taskParamAddr); + const auto &rts_param = davinci_model_->GetRuntimeParam(); + for (uint32_t i = 0; i < thread_dim_ - 1; ++i) { + GE_CHK_STATUS_RET_NOLOG(InitIoAddrs(rts_param, aic_aiv_def, i, + static_cast(aic_aiv_def.task_addr_offset_size()))); + } + GE_CHK_STATUS_RET_NOLOG(InitIoAddrs(rts_param, aic_aiv_def, thread_dim_ - 1, aic_aiv_def.input_output_count())); + int last_thread_workspace_size = aic_aiv_def.task_addr_size() - aic_aiv_def.task_addr_offset_size(); + for (int k = 0; k < last_thread_workspace_size; ++k) { + uintptr_t logic_addr = aic_aiv_def.task_addr(aic_aiv_def.task_addr_offset_size() + k); + uint8_t *io_addr = nullptr; + GE_CHK_STATUS_RET_NOLOG(ModelUtils::GetRtAddress(rts_param, logic_addr, io_addr)); + GELOGD("logic addr is 0x%lx, io addr is %p.", logic_addr, io_addr); + io_addrs_.emplace_back(io_addr); + } + + aic_aiv.taskParamOffset = aic_aiv_def.task_param_offset(); + GELOGD("args_: %p, io_addrs size: %zu, task param offset: %u.", args_, io_addrs_.size(), aic_aiv.taskParamOffset); + aic_aiv.satMode = aic_aiv_def.sat_mode(); + aic_aiv.scheduleMode = aic_aiv_def.schedule_mode(); + aic_aiv.iCachePrefetchCnt = aic_aiv_def.cache_prefetch_cnt(); + + aic_aiv.prefetchEnableBitmap = aic_aiv_def.prefetch_enable_bitmap(); + aic_aiv.prefetchOnceBitmap = aic_aiv_def.prefetch_once_bitmap(); + + aic_aiv.tailBlkDim = aic_aiv_def.tail_blk_dim(); + aic_aiv.nonTailBlkDim = aic_aiv_def.non_tail_blk_dim(); + + aic_aiv.nonTailTaskFuncStub = davinci_model_->GetRegisterStub(aic_aiv_def.non_tail_task_func_stub(), ""); + aic_aiv.tailTaskFuncStub = davinci_model_->GetRegisterStub(aic_aiv_def.tail_task_func_stub(), ""); + + GELOGI("Set func name[%s][%s] succ.", aic_aiv.nonTailTaskFuncStub, aic_aiv.tailTaskFuncStub); + for (int idx = 0; idx < aic_aiv_def.src_prefetch_size(); ++idx) { + InitAutoPrefetch(aic_aiv_def.src_prefetch(idx), aic_aiv.srcPrefetch[idx]); + } + + return SUCCESS; +} + +void FftsTaskInfo::InitAutoCacheInfo(const domi::AutoThreadCacheDef &cache_def, rtAutoThreadCacheInfo_t &cache) { + cache.dataAddr = cache_def.data_addr(); + cache.dataAddrOffset = cache_def.data_addr_offset(); + cache.nonTailDataLen = cache_def.non_tail_data_len(); + cache.tailDataLen = cache_def.tail_data_len(); + cache.ticketCacheRefCnt = cache_def.ticket_cache_ref_cnt(); +} + +void FftsTaskInfo::InitAutoPrefetch(const domi::AutoThreadPrefetchDef &prefetch_def, rtAutoThreadPrefetch_t &prefetch) { + prefetch.dataAddr = prefetch_def.data_addr(); + prefetch.dataAddrOffset = prefetch_def.data_addr_offset(); + prefetch.nonTailDataLen = prefetch_def.non_tail_data_len(); + prefetch.tailDataLen = prefetch_def.tail_data_len(); +} + +Status FftsTaskInfo::InitManualAicAiv(const domi::ManualThreadAicAivDef &aic_aiv_def, + rtManualThreadAicAivInfo_t &aic_aiv) { + if ((aic_aiv_def.thread_prefetch_dmu_idx_size() > static_cast(RT_FFTS_MAX_MANUAL_THREAD_NUM)) || + (aic_aiv_def.thread_blk_dim_size() > static_cast(RT_FFTS_MAX_MANUAL_THREAD_NUM)) || + (aic_aiv_def.thread_task_func_stub_size() > static_cast(RT_FFTS_MAX_MANUAL_THREAD_NUM)) || + (aic_aiv_def.src_dep_tbl_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK))) { + GELOGE(FAILED, "[Check][Param] Invalid ManualThreadAicAivInfo, thread prefetch dmu desc size: %d, " + "thread blk dim size: %d, thread task func stub size: %d, src dep tbl size: %d", + aic_aiv_def.thread_prefetch_dmu_idx_size(), aic_aiv_def.thread_blk_dim_size(), + aic_aiv_def.thread_task_func_stub_size(), aic_aiv_def.src_dep_tbl_size()); + return FAILED; + } + aic_aiv.taskParamAddr = reinterpret_cast(args_) + kAddrLen * io_addrs_.size(); + GELOGD("ManualThreadAicAivDef: task param addr is %lu.", aic_aiv.taskParamAddr); + const auto &rts_param = davinci_model_->GetRuntimeParam(); + for (uint32_t i = 0; i < thread_dim_ - 1; ++i) { + GE_CHK_STATUS_RET_NOLOG(InitIoAddrs(rts_param, aic_aiv_def, i, + static_cast(aic_aiv_def.task_addr_offset_size()))); + } + GE_CHK_STATUS_RET_NOLOG(InitIoAddrs(rts_param, aic_aiv_def, thread_dim_ - 1, aic_aiv_def.input_output_count())); + int last_thread_workspace_size = aic_aiv_def.task_addr_size() - aic_aiv_def.task_addr_offset_size(); + for (int k = 0; k < last_thread_workspace_size; ++k) { + uintptr_t logic_addr = aic_aiv_def.task_addr(aic_aiv_def.task_addr_offset_size() + k); + uint8_t *io_addr = nullptr; + GE_CHK_STATUS_RET_NOLOG(ModelUtils::GetRtAddress(rts_param, logic_addr, io_addr)); + io_addrs_.emplace_back(io_addr); + } + aic_aiv.taskParamOffset = aic_aiv_def.task_param_offset(); + + aic_aiv.satMode = aic_aiv_def.sat_mode(); + aic_aiv.scheduleMode = aic_aiv_def.schedule_mode(); + aic_aiv.iCachePrefetchCnt = aic_aiv_def.cache_prefetch_cnt(); + + aic_aiv.prefetchEnableBitmap = aic_aiv_def.prefetch_enable_bitmap(); // 8 bit bitmap 1 0 1 0 + aic_aiv.prefetchOnceBitmap = aic_aiv_def.prefetch_once_bitmap(); // 8 bit bitmap 1 0 1 0 + aic_aiv.prefetchOnceDmuNum = aic_aiv_def.prefetch_once_dmu_num(); + + for (int idx = 0; idx < aic_aiv_def.thread_prefetch_dmu_idx_size(); ++idx) { + aic_aiv.threadPrefetchDmuIdx[idx] = aic_aiv_def.thread_prefetch_dmu_idx(idx); + } + for (int idx = 0; idx < aic_aiv_def.thread_blk_dim_size(); ++idx) { + aic_aiv.threadBlkDim[idx] = aic_aiv_def.thread_blk_dim(idx); + } + for (int idx = 0; idx < aic_aiv_def.thread_task_func_stub_size(); ++idx) { + aic_aiv.threadTaskFuncStub[idx] = aic_aiv_def.thread_task_func_stub(idx).c_str(); + } + + InitManualDmuInfo(aic_aiv_def, aic_aiv.prefetchList); + for (int idx = 0; idx < aic_aiv_def.src_dep_tbl_size(); ++idx) { + GE_CHK_STATUS_RET_NOLOG(InitManualDependency(aic_aiv_def.src_dep_tbl(idx), aic_aiv.srcDepTbl[idx])); + } + + return SUCCESS; +} + +Status FftsTaskInfo::InitManualCacheInfo(const domi::ManualThreadCacheDef &cache_def, + rtManualThreadCacheInfo_t &cache_info) { + if ((cache_def.slice_dmu_idx_size() > static_cast(RT_FFTS_MAX_MANUAL_THREAD_NUM)) || + (cache_def.ticket_cache_ref_cnt_tbl_size() > static_cast(RT_FFTS_MAX_MANUAL_THREAD_NUM))) { + GELOGE(FAILED, "[Check][Param] Invalid ManualThreadCacheInfo slice dum desc index %d, ticket cache ref cnt %d", + cache_def.slice_dmu_idx_size(), cache_def.ticket_cache_ref_cnt_tbl_size()); + return FAILED; + } + + InitManualDmuInfo(cache_def, cache_info.dmuList); + for (int idx = 0; idx < cache_def.slice_dmu_idx_size(); ++idx) { + cache_info.sliceDmuIdx[idx] = cache_def.slice_dmu_idx(idx); + } + + for (int idx = 0; idx < cache_def.ticket_cache_ref_cnt_tbl_size(); ++idx) { + cache_info.ticketCacheRefCntTbl[idx] = cache_def.ticket_cache_ref_cnt_tbl(idx); + } + + return SUCCESS; +} + +Status FftsTaskInfo::InitManualDependency(const domi::ManualThreadDependencyDef &dependency_def, + rtManualThreadDependency_t &dependency) { + if (dependency_def.dependency_size() > static_cast(RT_FFTS_MANUAL_SRC_DEPEND_TBL_LEN)) { + GELOGE(FAILED, "[Check][Param] Invalid ManualThreadDependency size: %d", dependency_def.dependency_size()); + return FAILED; + } + + for (int idx = 0; idx < dependency_def.dependency_size(); ++idx) { + dependency.dependency[idx] = dependency_def.dependency(idx); + } + + return SUCCESS; +} + +Status FftsTaskInfo::InitManualNop(const domi::ManualThreadNopDef &nop_def, rtManualThreadNopInfo_t &nop_info) { + if (nop_def.src_dep_tbl_size() > static_cast(RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK)) { + GELOGE(FAILED, "[Check][Param] Invalid ManualThreadNopInfo, src dep tbl size: %d", nop_def.src_dep_tbl_size()); + return FAILED; + } + + for (int idx = 0; idx < nop_def.src_dep_tbl_size(); ++idx) { + GE_CHK_STATUS_RET_NOLOG(InitManualDependency(nop_def.src_dep_tbl(idx), nop_info.srcDepTbl[idx])); + } + + return SUCCESS; +} + +void FftsTaskInfo::InitManualDmuInfo(const domi::ManualThreadAicAivDef &aic_aiv_def, rtManualThreadDmuInfo_t *&dmu) { + if (aic_aiv_def.prefetch_list().empty()) { + return; + } + + std::vector buffer(sizeof(rtManualThreadDmuInfo_t) * aic_aiv_def.prefetch_list_size()); + dmu = reinterpret_cast(buffer.data()); + for (int idx = 0; idx < aic_aiv_def.prefetch_list_size(); ++idx) { + InitManualDmuInfo(aic_aiv_def.prefetch_list(idx), dmu[idx]); + } +} + +void FftsTaskInfo::InitManualDmuInfo(const domi::ManualThreadCacheDef &cache_def, rtManualThreadDmuInfo_t *&dmu) { + if (cache_def.dmu_list().empty()) { + return; + } + + std::vector buffer(sizeof(rtManualThreadDmuInfo_t) * cache_def.dmu_list_size()); + dmu = reinterpret_cast(buffer.data()); + for (int idx = 0; idx < cache_def.dmu_list_size(); ++idx) { + InitManualDmuInfo(cache_def.dmu_list(idx), dmu[idx]); + } +} + +void FftsTaskInfo::InitManualDmuInfo(const domi::ManualThreadDmuDef &dmu_def, rtManualThreadDmuInfo_t &dmu) { + dmu.dataAddr = dmu_def.data_addr(); + dmu.numOuter = dmu_def.num_outer(); + dmu.numInner = dmu_def.num_inner(); + dmu.strideOuter = dmu_def.stride_outer(); + dmu.lenInner = dmu_def.len_inner(); + dmu.strideInner = dmu_def.stride_inner(); +} + +Status FftsTaskInfo::CalculateArgs(const domi::TaskDef &task_def, DavinciModel *davinci_model) { + return SUCCESS; +} + +Status FftsTaskInfo::UpdateArgs() { + GE_CHECK_NOTNULL(davinci_model_); + std::vector io_addrs = io_addrs_; + davinci_model_->UpdateKnownZeroCopyAddr(io_addrs); + auto addr_size = kAddrLen * io_addrs.size(); + GE_CHK_RT_RET(rtMemcpy(args_, args_size_, io_addrs.data(), addr_size, RT_MEMCPY_HOST_TO_DEVICE)); + return SUCCESS; +} + +Status FftsTaskInfo::Distribute() { + GELOGI("FftsTaskInfo Distribute Start."); + rtError_t rt_ret = rtFftsTaskLaunch(&sub_task_info_, stream_); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "[Check][RT_ret] Call rtFftsTaskLaunch failed, ret: 0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + + GELOGI("FftsTaskInfo Distribute Success."); + return SUCCESS; +} + +REGISTER_TASK_INFO(RT_MODEL_TASK_FFTS_TASK, FftsTaskInfo); +} // namespace ge diff --git a/ge/graph/load/model_manager/task_info/ffts_task_info.h b/ge/graph/load/model_manager/task_info/ffts_task_info.h new file mode 100644 index 00000000..ffc286f9 --- /dev/null +++ b/ge/graph/load/model_manager/task_info/ffts_task_info.h @@ -0,0 +1,66 @@ +/** + * 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. + */ + +#ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_FFTS_TASK_INFO_H_ +#define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_FFTS_TASK_INFO_H_ + +#include "graph/load/model_manager/task_info/task_info.h" +#include "graph/op_desc.h" + +namespace ge { +class FftsTaskInfo : public TaskInfo { + public: + FftsTaskInfo() = default; + ~FftsTaskInfo() override; + + Status Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) override; + + Status Distribute() override; + + Status UpdateArgs() override; + + Status CalculateArgs(const domi::TaskDef &task_def, DavinciModel *davinci_model) override; + + private: + void InitFftsDescInfo(const domi::FftsDescInfoDef &ffts_desc_def, rtFftsDescInfo_t &ffts_desc); + Status InitSubTaskInfo(const domi::FftsSubTaskDef &task_def, rtFftsSubTaskInfo_t &task); + Status InitTicketCache(const domi::TicketCacheDef &cache_def, rtTicketCache_t &cache); + + Status InitAutoAicAiv(const domi::AutoThreadAicAivDef &aic_aiv_def, rtAutoThreadAicAivInfo_t &aic_aiv); + void InitAutoCacheInfo(const domi::AutoThreadCacheDef &cache_def, rtAutoThreadCacheInfo_t &cache); + void InitAutoPrefetch(const domi::AutoThreadPrefetchDef &prefetch_def, rtAutoThreadPrefetch_t &prefetch); + + Status InitManualAicAiv(const domi::ManualThreadAicAivDef &aic_aiv_def, rtManualThreadAicAivInfo_t &aic_aiv); + Status InitManualCacheInfo(const domi::ManualThreadCacheDef &cache_def, rtManualThreadCacheInfo_t &cache); + Status InitManualDependency(const domi::ManualThreadDependencyDef &depend_def, rtManualThreadDependency_t &depend); + Status InitManualNop(const domi::ManualThreadNopDef &nop_def, rtManualThreadNopInfo_t &nop); + + void InitManualDmuInfo(const domi::ManualThreadDmuDef &dmu_def, rtManualThreadDmuInfo_t &dmu); + void InitManualDmuInfo(const domi::ManualThreadCacheDef &cache_def, rtManualThreadDmuInfo_t *&dmu); + void InitManualDmuInfo(const domi::ManualThreadAicAivDef &aic_aiv_def, rtManualThreadDmuInfo_t *&dmu); + + template + Status InitIoAddrs(const RuntimeParam &rts_param, const T &aic_aiv_def, uint32_t thread_dim, uint32_t addr_count); + + DavinciModel *davinci_model_{nullptr}; + rtFftsTaskInfo_t sub_task_info_; + std::vector io_addrs_; + uint32_t thread_dim_{0}; + void *args_{nullptr}; // runtime args memory + uint32_t args_size_{0}; // runtime args memory length +}; +} // namespace ge +#endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_FFTS_TASK_INFO_H_ diff --git a/ge/graph/partition/graph_partition.cc b/ge/graph/partition/graph_partition.cc index c3f9480d..a810aab0 100755 --- a/ge/graph/partition/graph_partition.cc +++ b/ge/graph/partition/graph_partition.cc @@ -179,6 +179,7 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr GELOGE(ret, "[Merge][SubGraph] Failed, ret:%d", ret); } GE_CHECK_NOTNULL(original_compute_graph); + output_merged_compute_graph->SetName(original_compute_graph->GetName()); // partition sub graph for (const auto &sub_graph : original_compute_graph->GetAllSubgraphs()) { ComputeGraphPtr merged_sub_graph = nullptr; @@ -188,8 +189,16 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr GELOGE(ret, "[Merge][SubGraph] Failed, ret:%d", ret); continue; } + // this means subgraph added in optimize subgraph and without partitions, so just add to root graph + if (merged_sub_graph == sub_graph) { + GELOGI("Just add subgraph %s (parent node is %s) to root graph %s.", sub_graph->GetName().c_str(), + sub_graph->GetParentNode()->GetName().c_str(), output_merged_compute_graph->GetName().c_str()); + sub_graph->SetParentGraph(sub_graph->GetParentNode()->GetOwnerComputeGraph()); + GE_IF_BOOL_EXEC(output_merged_compute_graph->AddSubgraph(sub_graph->GetName(), merged_sub_graph) != SUCCESS, + return FAILED;) + continue; + } // add sub graph - output_merged_compute_graph->SetName(original_compute_graph->GetName()); merged_sub_graph->SetName(sub_graph->GetName()); merged_sub_graph->SetInputSize(sub_graph->GetInputSize()); merged_sub_graph->SetOutputSize(sub_graph->GetOutputSize()); @@ -245,12 +254,9 @@ Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_co } if ((graph_2_graph_partition_info_.find(original_compute_graph) == graph_2_graph_partition_info_.end()) || (graph_2_subgraph_list_.find(original_compute_graph) == graph_2_subgraph_list_.end())) { - REPORT_INNER_ERROR("E19999", "original_compute_graph:%s is not find in graph_2_graph_partition_info_.", - original_compute_graph->GetName().c_str()); - GELOGE(GE_GRAPH_NULL_INPUT, - "[Check][Param] original_compute_graph:%s is not find in graph_2_graph_partition_info_.", - original_compute_graph->GetName().c_str()); - return FAILED; + GELOGW("[GraphPartition]: compute_graph has not found, just return original."); + output_merged_compute_graph = original_compute_graph; + return SUCCESS; } GraphPartitionInfo &subgraph_info = graph_2_graph_partition_info_[original_compute_graph]; const auto &sub_graph_list = graph_2_subgraph_list_[original_compute_graph]; @@ -708,6 +714,7 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vectorGetName()); + (void)sub_graph->SetExtAttr("part_src_graph", compute_graph); GELOGD("set attr success. subgraph(%s) with parent graph(%s)", sub_graph->GetName().c_str(), compute_graph->GetName().c_str()); GE_DUMP(sub_graph, sub_graph->GetName() + "_" + mode_2_str_[graph_info_.mode_]); diff --git a/metadef b/metadef index c6030152..00c0c12e 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit c6030152c6dc05515115765babb5d64fde649df4 +Subproject commit 00c0c12eede6c7bce93a1eda5f0bb437ae80a7ec diff --git a/parser b/parser index 155d3262..3073129b 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 155d3262ba17f800094abb58b6a809b041cf0a74 +Subproject commit 3073129b68c0fae12a8b7531d60782e39128a28c diff --git a/tests/depends/runtime/src/runtime_stub.cc b/tests/depends/runtime/src/runtime_stub.cc index 2b1af23c..0c9e2c27 100644 --- a/tests/depends/runtime/src/runtime_stub.cc +++ b/tests/depends/runtime/src/runtime_stub.cc @@ -456,6 +456,10 @@ rtError_t rtDebugRegisterForStream(rtStream_t stream, uint32_t flag, const void rtError_t rtDebugUnRegisterForStream(rtStream_t stream) { return RT_ERROR_NONE; } + +rtError_t rtFftsTaskLaunch(rtFftsTaskInfo_t *fftsTaskInfo, rtStream_t stream) { + return RT_ERROR_NONE; +} #ifdef __cplusplus } #endif diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 0d1ae079..8b024820 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -437,6 +437,7 @@ set(DISTINCT_GRAPH_LOAD_SRC_FILES "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/stream_active_task_info.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/end_graph_task_info.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/model_exit_task_info.cc" + "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/ffts_task_info.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" "${GE_CODE_DIR}/ge/model/ge_model.cc" @@ -649,6 +650,7 @@ set(DISTINCT_GRAPH_LOAD_TEST_FILES "graph/load/hccl_task_info_unittest.cc" "graph/load/kernel_ex_task_info_unittest.cc" "graph/load/kernel_task_info_unittest.cc" + "graph/load/ffts_task_info_unittest.cc" "graph/load/memcpy_addr_async_task_info_unittest.cc" "graph/load/memcpy_async_task_info_unittest.cc" "graph/load/cpu_queue_schedule_unittest.cc" diff --git a/tests/ut/ge/graph/load/davinci_model_unittest.cc b/tests/ut/ge/graph/load/davinci_model_unittest.cc index 3f9cc850..ddf241ff 100644 --- a/tests/ut/ge/graph/load/davinci_model_unittest.cc +++ b/tests/ut/ge/graph/load/davinci_model_unittest.cc @@ -1059,4 +1059,144 @@ TEST_F(UtestDavinciModel, get_total_memsize_exclude_zero_copy) { EXPECT_EQ(model.GetTotalMemSizeExcludeZeroCopy(total_useful_size), SUCCESS); EXPECT_EQ(total_useful_size, 512); } + +// test InitTbeHandle +TEST_F(UtestDavinciModel, init_tbe_handle) { + DavinciModel model(0, nullptr); + OpDescPtr op_desc = CreateOpDesc("data", DATA); + model.ge_model_ = make_shared(); + // without kernel + EXPECT_EQ(model.InitTbeHandle(op_desc), INTERNAL_ERROR); + vector buffer; + string key = op_desc->GetName(); + TBEKernelPtr tbe_kernel_ptr = std::make_shared(key, std::move(buffer)); + op_desc->SetExtAttr(OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel_ptr); + string attr_kernel_name = op_desc->GetName() + "_kernelname"; + string kernel_name = "kernel_name"; + AttrUtils::SetStr(op_desc, attr_kernel_name, kernel_name); + EXPECT_EQ(model.InitTbeHandle(op_desc), SUCCESS); + // rtQueryFunctionRegistered(bin_file_key) failed + EXPECT_EQ(model.used_tbe_handle_map_.size(), 0); +} + +// test InitTbeHandleWithFfts +TEST_F(UtestDavinciModel, init_tbe_handle_with_ffts) { + DavinciModel model(0, nullptr); + OpDescPtr op_desc = CreateOpDesc("data", DATA); + model.ge_model_ = make_shared(); + // without tbe_kernel + EXPECT_EQ(model.InitTbeHandleWithFfts(op_desc), INTERNAL_ERROR); + + std::vector tbe_kernel; + vector buffer; + string key = op_desc->GetName(); + OpKernelBinPtr tbe_kernel_ptr0 = std::make_shared(key, std::move(buffer)); + OpKernelBinPtr tbe_kernel_ptr1 = std::make_shared(key, std::move(buffer)); + tbe_kernel.push_back(tbe_kernel_ptr0); + tbe_kernel.push_back(tbe_kernel_ptr1); + op_desc->SetExtAttr(OP_EXTATTR_NAME_THREAD_TBE_KERNEL, tbe_kernel); + // without _register_stub_func + EXPECT_EQ(model.InitTbeHandleWithFfts(op_desc), INTERNAL_ERROR); + + vector bin_file_keys; + bin_file_keys.emplace_back(op_desc->GetName() + "_0"); + bin_file_keys.emplace_back(op_desc->GetName() + "_1"); + AttrUtils::SetListStr(op_desc, "_register_stub_func", bin_file_keys); + + EXPECT_EQ(model.InitTbeHandleWithFfts(op_desc), SUCCESS); + // rtQueryFunctionRegistered(bin_file_key) failed + EXPECT_EQ(model.used_tbe_handle_map_.size(), 0); +} + +// test InitBinaryMagic +TEST_F(UtestDavinciModel, init_binary_magic) { + DavinciModel model(0, nullptr); + rtDevBinary_t binary; + OpDescPtr op_desc = CreateOpDesc("data", DATA); + bool is_ffts = true; + vector json_list; + AttrUtils::SetListStr(op_desc, TVM_ATTR_NAME_THREAD_MAGIC, json_list); + // without tvm_magic + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 0, binary), INTERNAL_ERROR); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF_AICPU"); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF"); + op_desc->DelAttr(TVM_ATTR_NAME_THREAD_MAGIC); + AttrUtils::SetListStr(op_desc, TVM_ATTR_NAME_THREAD_MAGIC, json_list); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 0, binary), SUCCESS); + EXPECT_EQ(binary.magic, RT_DEV_BINARY_MAGIC_ELF_AICPU); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 1, binary), SUCCESS); + EXPECT_EQ(binary.magic, RT_DEV_BINARY_MAGIC_ELF); + + json_list.clear(); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF_AIVEC"); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF_AICUBE"); + op_desc->DelAttr(TVM_ATTR_NAME_THREAD_MAGIC); + AttrUtils::SetListStr(op_desc, TVM_ATTR_NAME_THREAD_MAGIC, json_list); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 0, binary), SUCCESS); + EXPECT_EQ(binary.magic, RT_DEV_BINARY_MAGIC_ELF_AIVEC); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 1, binary), SUCCESS); + EXPECT_EQ(binary.magic, RT_DEV_BINARY_MAGIC_ELF_AICUBE); + + // with invalid json type + json_list.clear(); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF_INVALID"); + json_list.emplace_back("RT_DEV_BINARY_MAGIC_ELF_INVALID"); + op_desc->DelAttr(TVM_ATTR_NAME_THREAD_MAGIC); + AttrUtils::SetListStr(op_desc, TVM_ATTR_NAME_THREAD_MAGIC, json_list); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 0, binary), PARAM_INVALID); + + // test unffts + is_ffts = false; + string json_string = "RT_DEV_BINARY_MAGIC_ELF_AIVEC"; + AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, json_string); + EXPECT_EQ(model.InitBinaryMagic(op_desc, is_ffts, 0, binary), SUCCESS); + EXPECT_EQ(binary.magic, RT_DEV_BINARY_MAGIC_ELF_AIVEC); +} + +// test InitMetaData +TEST_F(UtestDavinciModel, init_meta_data) { + DavinciModel model(0, nullptr); + void *bin_handle; + OpDescPtr op_desc = CreateOpDesc("data", DATA); + bool is_ffts = true; + vector meta_data_list; + // with empty meta_data + EXPECT_EQ(model.InitMetaData(op_desc, is_ffts, 0, bin_handle), INTERNAL_ERROR); + meta_data_list.emplace_back("meta_data_0"); + meta_data_list.emplace_back("meta_data_1"); + AttrUtils::SetListStr(op_desc, TVM_ATTR_NAME_THREAD_METADATA, meta_data_list); + EXPECT_EQ(model.InitMetaData(op_desc, is_ffts, 0, bin_handle), SUCCESS); + + is_ffts = false; + string meta_data = "meta_data"; + AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_METADATA, meta_data); + EXPECT_EQ(model.InitMetaData(op_desc, is_ffts, 0, bin_handle), SUCCESS); +} + +// test InitKernelName +TEST_F(UtestDavinciModel, init_kernel_name) { + DavinciModel model(0, nullptr); + string kernel_name; + OpDescPtr op_desc = CreateOpDesc("data", DATA); + bool is_ffts = true; + // failed when name is invalid + EXPECT_EQ(model.InitKernelName(op_desc, is_ffts, 0, kernel_name), INTERNAL_ERROR); + OpDescPtr op_desc1 = CreateOpDesc("sgt_graph_nodes/loss_scale", SCALE); + string attr_kernel_name = "loss_scale_thread_kernelname"; + vector kernel_name_list; + AttrUtils::SetListStr(op_desc, attr_kernel_name, kernel_name_list); + // failed without kernel_name + EXPECT_EQ(model.InitKernelName(op_desc, is_ffts, 0, kernel_name), INTERNAL_ERROR); + kernel_name_list.emplace_back("kernel_name_0"); + kernel_name_list.emplace_back("kernel_name_1"); + AttrUtils::SetListStr(op_desc1, attr_kernel_name, kernel_name_list); + EXPECT_EQ(model.InitKernelName(op_desc1, is_ffts, 0, kernel_name), SUCCESS); + + // without ffts + is_ffts = false; + attr_kernel_name = "data_kernelname"; + kernel_name = "kernel_name"; + AttrUtils::SetStr(op_desc, attr_kernel_name, kernel_name); + EXPECT_EQ(model.InitKernelName(op_desc, is_ffts, 0, kernel_name), SUCCESS); +} } // namespace ge diff --git a/tests/ut/ge/graph/load/ffts_task_info_unittest.cc b/tests/ut/ge/graph/load/ffts_task_info_unittest.cc new file mode 100644 index 00000000..25838f7e --- /dev/null +++ b/tests/ut/ge/graph/load/ffts_task_info_unittest.cc @@ -0,0 +1,212 @@ +/** + * 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 + +#define private public +#define protected public + +#include "graph/load/model_manager/task_info/ffts_task_info.h" +#include "cce/aicpu_engine_struct.h" +#include "common/ge/ge_util.h" +#include "common/properties_manager.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/fmk_error_codes.h" +#include "graph/attr_value.h" +#include "graph/load/model_manager/davinci_model.h" +#include "graph/load/model_manager/model_manager.h" +#include "runtime/rt_ffts.h" + +namespace ge { +extern OpDescPtr CreateOpDesc(string name, string type); + +class UtestFftsTaskInfo : public testing::Test { +protected: + void SetUp() {} + + void TearDown() {} + +public: + void CreateFftsTaskInfo(DavinciModel &davinci_model, domi::TaskDef &task_def, FftsTaskInfo &ffts_task_info) { + rtStream_t stream = nullptr; + rtStreamCreate(&stream, 0); + davinci_model.stream_list_ = { stream }; + task_def.set_stream_id(0); + + domi::FftsTaskDef *ffts_task_def = task_def.mutable_ffts_task(); + davinci_model.op_list_[0] = CreateOpDesc("test", PARTITIONEDCALL); + ffts_task_def->set_op_index(0); + ffts_task_def->set_addr_size(2); + domi::FftsDescInfoDef *ffts_desc = ffts_task_def->mutable_ffts_desc(); + ffts_desc->set_tm(0); + rtFftsTaskInfo_t sub_task_info; + ffts_task_info.sub_task_info_ = sub_task_info; + ffts_task_def->set_ffts_type(RT_FFTS_TYPE_AUTO_THREAD); + } +}; + +// test FftsTaskInfo Init with no subtask and no ticket cache +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_without_subtask) { + DavinciModel davinci_model(0, nullptr); + rtStream_t stream = nullptr; + rtStreamCreate(&stream, 0); + davinci_model.stream_list_ = { stream }; + domi::TaskDef task_def; + task_def.set_stream_id(0); + + domi::FftsTaskDef *ffts_task_def = task_def.mutable_ffts_task(); + FftsTaskInfo ffts_task_info; + // init failed when model without op_desc + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), PARAM_INVALID); + + davinci_model.op_list_[0] = CreateOpDesc("test", PARTITIONEDCALL); + ffts_task_def->set_op_index(0); + ffts_task_def->set_addr_size(2); + domi::FftsDescInfoDef *ffts_desc = ffts_task_def->mutable_ffts_desc(); + ffts_desc->set_tm(0); + rtFftsTaskInfo_t sub_task_info; + ffts_task_info.sub_task_info_ = sub_task_info; + ffts_task_def->set_ffts_type(RT_FFTS_TYPE_AUTO_THREAD); + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Init with subtask and no ticket cache: AutoThreadAicAivDef +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_with_auto_thread_subgraph) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + CreateFftsTaskInfo(davinci_model, task_def, ffts_task_info); + domi::FftsSubTaskDef *ffts_sub_task_def = task_def.mutable_ffts_task()->add_sub_task(); + ffts_sub_task_def->set_thread_dim(static_cast(1)); + //sub_task_def.has_auto_thread_aic_aiv() == sub_task_def.has_manual_thread_aic_aiv() + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), FAILED); + + domi::AutoThreadAicAivDef *auto_thread_aic_aiv_def = ffts_sub_task_def->mutable_auto_thread_aic_aiv(); + domi::AutoThreadPrefetchDef *src_prefetch = auto_thread_aic_aiv_def->add_src_prefetch(); + // without InitIoAddrs + ffts_task_info.thread_dim_ = 0; + RuntimeParam runtime_param; + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Init with subtask and no ticket cache: ManualThreadAicAivDef +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_with_manual_thread_subgraph) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + CreateFftsTaskInfo(davinci_model, task_def, ffts_task_info); + domi::FftsSubTaskDef *ffts_sub_task_def = task_def.mutable_ffts_task()->add_sub_task(); + ffts_sub_task_def->set_thread_dim(static_cast(1)); + //sub_task_def.has_auto_thread_aic_aiv() == sub_task_def.has_manual_thread_aic_aiv() + + domi::ManualThreadAicAivDef *manual_thread_aic_aiv_def = ffts_sub_task_def->mutable_manual_thread_aic_aiv(); + manual_thread_aic_aiv_def->add_thread_prefetch_dmu_idx(static_cast(0)); + manual_thread_aic_aiv_def->add_thread_blk_dim(static_cast(0)); + manual_thread_aic_aiv_def->add_thread_task_func_stub("ffts"); + domi::ManualThreadDmuDef *prefetch_list = manual_thread_aic_aiv_def->add_prefetch_list(); + prefetch_list->set_data_addr(static_cast(0)); + // without InitIoAddrs + ffts_task_info.thread_dim_ = 0; + RuntimeParam runtime_param; + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Init with subtask and no ticket cache: ManualThreadNopDef +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_with_manual_thread_nop_subgraph) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + CreateFftsTaskInfo(davinci_model, task_def, ffts_task_info); + + domi::FftsSubTaskDef *ffts_sub_task_def = task_def.mutable_ffts_task()->add_sub_task(); + ffts_sub_task_def->set_thread_dim(static_cast(1)); + domi::AutoThreadAicAivDef *auto_thread_aic_aiv_def = ffts_sub_task_def->mutable_auto_thread_aic_aiv(); + domi::ManualThreadNopDef *manual_thread_nop = ffts_sub_task_def->mutable_manual_thread_nop(); + domi::ManualThreadDependencyDef *src_dep_tbl = manual_thread_nop->add_src_dep_tbl(); + src_dep_tbl->add_dependency(static_cast(0)); + + // without InitIoAddrs + ffts_task_info.thread_dim_ = 0; + RuntimeParam runtime_param; + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Init with no subtask and ticket cache:AutoThreadCacheDef +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_with_auto_thread_ticket_cache) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + CreateFftsTaskInfo(davinci_model, task_def, ffts_task_info); + + domi::TicketCacheDef *ticket_cache_def = task_def.mutable_ffts_task()->add_ticket_cache(); + //ticket_cache_def.has_auto_thread_cache() == ticket_cache_def.has_manual_thread_cache() + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), FAILED); + domi::AutoThreadCacheDef *auto_thread_cache = ticket_cache_def->mutable_auto_thread_cache(); + + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Init with no subtask and ticket cache:ManualThreadCacheDef +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_with_manual_thread_ticket_cache) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + CreateFftsTaskInfo(davinci_model, task_def, ffts_task_info); + + domi::TicketCacheDef *ticket_cache_def = task_def.mutable_ffts_task()->add_ticket_cache(); + domi::ManualThreadCacheDef *manual_thread_cache = ticket_cache_def->mutable_manual_thread_cache(); + manual_thread_cache->add_slice_dmu_idx(static_cast(0)); + manual_thread_cache->add_ticket_cache_ref_cnt_tbl(static_cast(0)); + domi::ManualThreadDmuDef *dmu_list = manual_thread_cache->add_dmu_list(); + + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.Init(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo UpdateArgs +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_update_args) { + DavinciModel davinci_model(0, nullptr); + FftsTaskInfo ffts_task_info; + ffts_task_info.davinci_model_ = &davinci_model; + ffts_task_info.io_addrs_ = { (void*)0x12345678, (void*)0x22345678 }; + EXPECT_EQ(ffts_task_info.UpdateArgs(), SUCCESS); +} + +// test FftsTaskInfo CalculateArgs +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_calculate_args) { + DavinciModel davinci_model(0, nullptr); + domi::TaskDef task_def; + FftsTaskInfo ffts_task_info; + EXPECT_EQ(ffts_task_info.CalculateArgs(task_def, &davinci_model), SUCCESS); +} + +// test FftsTaskInfo Distribute +TEST_F(UtestFftsTaskInfo, success_ffts_task_info_distribute) { + DavinciModel davinci_model(0, nullptr); + FftsTaskInfo ffts_task_info; + rtFftsTaskInfo_t sub_task_info; + ffts_task_info.sub_task_info_ = sub_task_info; + rtStream_t stream = nullptr; + rtStreamCreate(&stream, 0); + ffts_task_info.stream_ = stream; + EXPECT_EQ(ffts_task_info.Distribute(), SUCCESS); +} +} // namespace ge \ No newline at end of file diff --git a/third_party/fwkacllib/inc/runtime/rt.h b/third_party/fwkacllib/inc/runtime/rt.h index 83cafa3c..aa394eea 100644 --- a/third_party/fwkacllib/inc/runtime/rt.h +++ b/third_party/fwkacllib/inc/runtime/rt.h @@ -27,5 +27,6 @@ #include "mem.h" #include "rt_model.h" #include "stream.h" +#include "rt_ffts.h" #endif // __CCE_RUNTIME_RT_H__ diff --git a/third_party/fwkacllib/inc/runtime/rt_ffts.h b/third_party/fwkacllib/inc/runtime/rt_ffts.h new file mode 100755 index 00000000..720da7cd --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_ffts.h @@ -0,0 +1,185 @@ +/* + * Copyright (c) Huawei Technologies Co. , Ltd. 2021. All rights reserved. + * Description: ffts interface + */ + +#ifndef __CCE_RUNTIME_FFTS_H +#define __CCE_RUNTIME_FFTS_H + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#define RT_FFTS_MAX_SUB_TASK_NUM 32U +#define RT_FFTS_MAX_TICKET_CACHE_NUM 64U +#define RT_FFTS_MAX_MANUAL_THREAD_NUM 16U +#define RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK 8U +#define RT_FFTS_MANUAL_SRC_DEPEND_TBL_LEN 32U + +typedef enum tagFftsType { + RT_FFTS_TYPE_AUTO_THREAD = 2, // ffts auto thread mode, same as ffts define + RT_FFTS_TYPE_MANUAL_THREAD = 3, // ffts manual thread mode, same as ffts define +} rtFftsType_t; + +typedef enum tagFftsSubTaskType { + RT_FFTS_SUB_TASK_TYPE_AIC = 0, + RT_FFTS_SUB_TASK_TYPE_AIV = 1, + RT_FFTS_SUB_TASK_TYPE_NOP = 2, + RT_FFTS_SUB_TASK_TYPE_NOTIFY_WAIT = 3, + RT_FFTS_SUB_TASK_TYPE_NOTIFY_RECORD = 4, + RT_FFTS_SUB_TASK_TYPE_WRITE_VALUE = 5, + RT_FFTS_SUB_TASK_TYPE_MIX_AIC = 6, + RT_FFTS_SUB_TASK_TYPE_MIX_AIV = 7, + RT_FFTS_SUB_TASK_TYPE_SDMA = 8, + RT_FFTS_SUB_TASK_TYPE_RESERVED, +} rtFftsSubTaskType_t; + +typedef struct tagManualThreadDmuInfo { + uint64_t dataAddr; // device mem + uint16_t numOuter; + uint16_t numInner; + uint32_t strideOuter; + uint32_t lenInner; + uint32_t strideInner; +} rtManualThreadDmuInfo_t; + +typedef struct tagManualThreadDependency { + uint8_t dependency[RT_FFTS_MANUAL_SRC_DEPEND_TBL_LEN]; +} rtManualThreadDependency_t; + +typedef struct tagManualThreadAicAivInfo { + uint64_t taskParamAddr; // device mem + uint16_t taskParamOffset; + // when satMode=1 and FP16 computation with none INF inputs overflows/underflows, results will be +/-INF of FP16 + // when satMode=0 and FP16 computation with none INF inputs overflows/underflows + // results will be saturated to +/- MAX of FP16 + uint8_t satMode; + uint8_t scheduleMode; // 0:normal mode, 1:batch mode, 2:sync mode, 3: reserved + uint8_t iCachePrefetchCnt; // units is 2K + uint8_t prefetchEnableBitmap; // 8 bit bitmap 1 0 1 0 + uint8_t prefetchOnceBitmap; // 8 bit bitmap 1 0 1 0 + uint16_t prefetchOnceDmuNum; // prefetch_once_dmu_descriptor_index in ffts + // num: thread0_prefetch_dmu_descriptor_index - prefetch_once_dmu_descriptor_index + uint16_t threadPrefetchDmuIdx[RT_FFTS_MAX_MANUAL_THREAD_NUM]; // max valid is threadDim + uint16_t threadBlkDim[RT_FFTS_MAX_MANUAL_THREAD_NUM]; + const char *threadTaskFuncStub[RT_FFTS_MAX_MANUAL_THREAD_NUM]; + + rtManualThreadDmuInfo_t *prefetchList; // dmu desc 0-64k, length is the last threadPrefetchDmuIdx[threadDim - 1] + rtManualThreadDependency_t srcDepTbl[RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK]; +} rtManualThreadAicAivInfo_t; + +typedef struct tagAutoThreadPrefetch { + uint64_t dataAddr; // device mem + uint32_t dataAddrOffset; + uint32_t nonTailDataLen; + uint32_t tailDataLen; +} rtAutoThreadPrefetch_t; + +typedef struct tagAutoThreadAicAivInfo { + uint64_t taskParamAddr; // device mem + uint16_t taskParamOffset; + // when satMode=1 and FP16 computation with none INF inputs overflows/underflows, results will be +/-INF of FP16 + // when satMode=0 and FP16 computation with none INF inputs overflows/underflows + // results will be saturated to +/- MAX of FP16 + uint8_t satMode; + uint8_t scheduleMode; // 0:normal mode, 1:batch mode, 2:sync mode, 3: reserved + uint8_t iCachePrefetchCnt; // units is 2K + uint8_t prefetchEnableBitmap; // 8 bit bitmap + uint8_t prefetchOnceBitmap; // 8 bit bitmap + + uint16_t tailBlkDim; + uint16_t nonTailBlkDim; + + const char *nonTailTaskFuncStub; + const char *tailTaskFuncStub; + + // for prefetch, valid num is prefetchEnableBitmap bit count + // if prefetchEnableBitmap = '00010011', need prefetch number is 3, srcPrefetch is only 0, 1, 2 is valid + rtAutoThreadPrefetch_t srcPrefetch[RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK]; +} rtAutoThreadAicAivInfo_t; + +typedef struct tagAutoThreadCacheInfo { + uint64_t dataAddr; // device mem + uint32_t dataAddrOffset; + uint32_t nonTailDataLen; + uint32_t tailDataLen; + uint16_t ticketCacheRefCnt; +} rtAutoThreadCacheInfo_t; + +typedef struct tagManualThreadCacheInfo { + rtManualThreadDmuInfo_t *dmuList; // 0-64k + uint16_t dmuNum; + uint16_t sliceDmuIdx[RT_FFTS_MAX_MANUAL_THREAD_NUM]; + uint16_t ticketCacheRefCntTbl[RT_FFTS_MAX_MANUAL_THREAD_NUM]; +} rtManualThreadCacheInfo_t; + +typedef enum tagCacheOp { + RT_CACHE_OP_NONE = 0, + RT_CACHE_OP_FLUSH = 1, + RT_CACHE_OP_INVALIDATE = 2, + RT_CACHE_OP_WRITE_BACK = 3, +} rtCacheOp_t; + +typedef struct tagTicketCache { + rtCacheOp_t cacheOption; + uint8_t ticketCacheWindow; + union { + rtAutoThreadCacheInfo_t autoThreadCache; + rtManualThreadCacheInfo_t manualThreadCache; + } custom; +} rtTicketCache_t; + +typedef struct tagManualThreadNopInfo { + // depend srcTickCacheVldBitmap in rtFftsSubTaskInfo_t + rtManualThreadDependency_t srcDepTbl[RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK]; +} rtManualThreadNopInfo_t; + +typedef struct tagFftsSubTaskInfo { + rtFftsSubTaskType_t subTaskType; + uint16_t threadDim; + uint8_t dstTickCacheVldBitmap; + uint8_t srcTickCacheVldBitmap; + uint8_t srcDataOutOfSubGraphBitmap; + uint8_t dstTickCacheID[RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK]; + uint8_t srcTickCacheID[RT_FFTS_MAX_TICKET_CACHE_PER_SUBTASK]; + union { + rtAutoThreadAicAivInfo_t autoThreadAicAiv; + rtManualThreadAicAivInfo_t manualThreadAicAiv; + rtManualThreadNopInfo_t manualThreadNop; + } custom; +} rtFftsSubTaskInfo_t; + +typedef struct tagFftsDescInfo { + uint8_t tm; // thread subtask kickstart mode, 0:order, 1:disorder + uint8_t di; // discard invalidate + uint8_t dw; // discard write back + uint8_t df; // discard flush + uint8_t dataSplitUnit; // split source or ticket cache by 2~dataSplitUnit MB + uint8_t prefetchOstNum; + uint8_t cacheMaintainOstNum; + uint8_t aicPrefetchUpper; + uint8_t aicPrefetchLower; + uint8_t aivPrefetchUpper; + uint8_t aivPrefetchLower; +} rtFftsDescInfo_t; + +typedef struct tagFftsTaskInfo { + rtFftsType_t fftsType; + uint16_t subTaskNum; + uint16_t tickCacheNum; + rtFftsDescInfo_t fftsDesc; + // sub task desc, real num is subTaskNum + rtFftsSubTaskInfo_t subTask[RT_FFTS_MAX_SUB_TASK_NUM]; + + // ticket cache, real number is ticketCacheNum + rtTicketCache_t ticketCache[RT_FFTS_MAX_TICKET_CACHE_NUM]; +} rtFftsTaskInfo_t; + +RTS_API rtError_t rtFftsTaskLaunch(rtFftsTaskInfo_t *fftsTaskInfo, rtStream_t stream); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif +#endif //__CCE_RUNTIME_FFTS_H diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 6481f655..74539222 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -50,6 +50,7 @@ typedef enum tagModelTaskType { RT_MODEL_TASK_STREAM_LABEL_SWITCH_BY_INDEX, RT_MODEL_TASK_STREAM_LABEL_GOTO, RT_MODEL_TASK_MODEL_EXIT, + RT_MODEL_TASK_FFTS_TASK, RT_MODEL_TASK_ALL_KERNEL, } rtModelTaskType_t; From 6927a8eef3663007b74d3cc6905ff7cf60633d91 Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Wed, 16 Jun 2021 11:15:37 +0800 Subject: [PATCH 037/226] modif dump config --- ge/common/dump/dump_manager.cc | 4 ++-- tests/ut/ge/common/dump_manager_unittest.cc | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index a6944fc6..ebe16fed 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -33,7 +33,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpManager &DumpManager::GetIn bool DumpManager::NeedDoDump(const DumpConfig &dump_config, DumpProperties &dump_properties) { if (dump_config.dump_status.empty() && dump_config.dump_debug.empty()) { - dump_properties_map_.emplace(kInferSessionId, dump_properties); + dump_properties_map_[kInferSessionId] = dump_properties; GELOGI("Dump does not open"); return false; } @@ -41,7 +41,7 @@ bool DumpManager::NeedDoDump(const DumpConfig &dump_config, DumpProperties &dump if ((dump_config.dump_status == kDumpoff || dump_config.dump_status == kDumpOFF) && dump_config.dump_debug == kDumpoff) { dump_properties.ClearDumpPropertyValue(); - dump_properties_map_.emplace(kInferSessionId, dump_properties); + dump_properties_map_[kInferSessionId] = dump_properties; return false; } if (dump_config.dump_status == kDumpOn && dump_config.dump_debug == kDumpOn) { diff --git a/tests/ut/ge/common/dump_manager_unittest.cc b/tests/ut/ge/common/dump_manager_unittest.cc index 50eabc4a..7a242997 100644 --- a/tests/ut/ge/common/dump_manager_unittest.cc +++ b/tests/ut/ge/common/dump_manager_unittest.cc @@ -16,6 +16,8 @@ #include +#define protected public +#define private public #include "common/dump/dump_manager.h" #include "common/debug/log.h" #include "common/ge_inner_error_codes.h" @@ -102,4 +104,13 @@ TEST_F(UTEST_dump_manager, is_dump_single_op_close_success) { auto dump = DumpManager::GetInstance().GetDumpProperties(0); DumpManager::GetInstance().RemoveDumpProperties(0); } + + TEST_F(UTEST_dump_manager, not_need_do_dump) { + DumpConfig dump_config; + dump_config.dump_status = "off"; + dump_config.dump_debug = "off"; + DumpProperties dump_properties; + bool ret = DumpManager::GetInstance().NeedDoDump(dump_config, dump_properties); + EXPECT_EQ(ret, false); + } } // namespace ge \ No newline at end of file From 23c8a0d5811f5e808c610ca1f7efa1f9e75d4cd9 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 20:13:41 +0800 Subject: [PATCH 038/226] Fix ut. --- ge/hybrid/executor/hybrid_model_executor.cc | 2 +- ge/hybrid/executor/node_state.h | 5 +++++ ge/hybrid/executor/subgraph_executor.cc | 1 + ge/hybrid/executor/subgraph_executor.h | 2 +- ge/hybrid/executor/worker/shape_inference_engine.cc | 2 +- ge/single_op/single_op_model.cc | 8 ++------ tests/ut/ge/single_op/single_op_model_unittest.cc | 13 +++++++------ 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 2abd9cd6..9bf70d26 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -70,7 +70,7 @@ Status HybridModelExecutor::Execute(HybridModelExecutor::ExecuteArgs &args) { context_.profiler->Dump(std::cout); context_.profiler->Reset(); } - root_graph_executor_->ResetContext(); + root_graph_executor_->ReleaseContext(); context_.iteration += 1; if (ret == END_OF_SEQUENCE) { diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index 85f9e4c3..e8ccd416 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -177,6 +177,10 @@ struct NodeState { void SetTaskContext(std::shared_ptr &task_context); std::shared_ptr GetTaskContext(); + void SetSkipInferShape(bool skip_infershape) { skip_infershape_ = skip_infershape; } + + bool GetSkipInferShape() const { return skip_infershape_; } + private: bool IsScheduleReady() const; void SetDataSchedule(const NodeState &node_state, const std::function &ready); @@ -204,6 +208,7 @@ struct NodeState { int merge_index_ = -1; // Use for Execute (Reset after Executed). int switch_index_ = -1; // Use for Schedule (Reset after Prepared). int group_ = -1; + bool skip_infershape_ = false; }; } // namespace hybrid } // namespace ge diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index c26eac9b..6979d05f 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -110,6 +110,7 @@ Status SubgraphExecutor::InitInputsForUnknownShape(const std::vectorSetShape(tensor_desc->GetShape()); output_desc->SetOriginShape(tensor_desc->GetOriginShape()); output_desc->SetDataType(tensor_desc->GetDataType()); + node_state->SetSkipInferShape(true); } } diff --git a/ge/hybrid/executor/subgraph_executor.h b/ge/hybrid/executor/subgraph_executor.h index 35f6e67e..76732c37 100644 --- a/ge/hybrid/executor/subgraph_executor.h +++ b/ge/hybrid/executor/subgraph_executor.h @@ -41,7 +41,7 @@ class SubgraphExecutor { Status PartialExecuteAsync(int task_group); - void ResetContext() { subgraph_context_.reset(nullptr); } + void ReleaseContext() { subgraph_context_.reset(nullptr); } /** * Execute subgraph async, output tensor address(not data) and output tensor descriptions are diff --git a/ge/hybrid/executor/worker/shape_inference_engine.cc b/ge/hybrid/executor/worker/shape_inference_engine.cc index 18fed710..96959b80 100755 --- a/ge/hybrid/executor/worker/shape_inference_engine.cc +++ b/ge/hybrid/executor/worker/shape_inference_engine.cc @@ -70,7 +70,7 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) { // Do shape inference // Skipping infer shape of input node. GELOGD("[%s] Start to invoke InferShapeAndType", node_item.NodeName().c_str()); - if (node_state.GetType() != DATA_TYPE && node_state.GetType() != AIPP_DATA_TYPE) { + if (node_state.GetSkipInferShape()) { RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start"); GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true), "[Invoke][InferShapeAndType] for %s failed.", node_item.NodeName().c_str()); diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 182d1466..90a6362c 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -49,8 +49,8 @@ const uint32_t kOutputIndexOfData = 0; constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; Status CheckHostMem(const std::vector &dependencies, const NodePtr &node, bool &is_host_mem) { + auto op_desc = node->GetOpDesc(); for (const auto &input_name : dependencies) { - auto op_desc = node->GetOpDesc(); int input_index = op_desc->GetInputIndexByName(input_name); if (input_index < 0) { GELOGE(INTERNAL_ERROR, "[Get][InputIndex]failed, node:[%s] inputname: %s.", @@ -60,11 +60,7 @@ Status CheckHostMem(const std::vector &dependencies, const NodePtr &node return INTERNAL_ERROR; } - const auto &in_anchor = node->GetInDataAnchor(input_index); - GE_CHECK_NOTNULL(in_anchor); - const auto &peer_out_anchor = in_anchor->GetPeerOutAnchor(); - GE_CHECK_NOTNULL(peer_out_anchor); - const auto &src_node = peer_out_anchor->GetOwnerNode(); + const auto &src_node = NodeUtils::GetInDataNodeByIndex(*node, input_index); GE_CHECK_NOTNULL(src_node); auto src_op_desc = src_node->GetOpDesc(); GE_CHECK_NOTNULL(src_op_desc); diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index 63a3eafe..1975f9f4 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -213,7 +213,7 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { // make graph ut::GraphBuilder builder = ut::GraphBuilder("graph"); - auto data = builder.AddNode("Data", "Data", 0, 1); + auto data = builder.AddNode("Data", "Data", 1, 1); auto transdata = builder.AddNode("Transdata", "Transdata", 1, 1); auto netoutput = builder.AddNode("Netoutput", "NetOutput", 1, 0); builder.AddDataEdge(data, 0, transdata, 0); @@ -228,11 +228,6 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { op_desc->SetOpInferDepends(depend_names); (void)AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); - auto tensor = std::make_shared(); - auto data_desc = data->GetOpDesc(); - auto tensor_desc = data_desc->MutableInputDesc(0); - AttrUtils::SetTensor(tensor_desc, "_value", tensor); - // set task_def auto model_task_def = make_shared(); domi::TaskDef *task_def = model_task_def->add_task(); @@ -249,6 +244,12 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { op_desc->impl_->input_name_idx_["Data"] = 0; model.BuildDynamicOp(res, dynamic_single_op); + + auto tensor = std::make_shared(); + auto data_desc = data->GetOpDesc(); + auto tensor_desc = data_desc->MutableInputDesc(0); + AttrUtils::SetTensor(tensor_desc, "_value", tensor); + model.BuildDynamicOp(res, dynamic_single_op); } TEST_F(UtestSingleOpModel, test_host_mem) { From b17eafe3dbf2dbf0a0f921d8941445425d2fae26 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 21:52:13 +0800 Subject: [PATCH 039/226] Fix bug. --- ge/hybrid/executor/node_state.h | 2 +- ge/hybrid/executor/worker/shape_inference_engine.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index e8ccd416..002e07ab 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -179,7 +179,7 @@ struct NodeState { void SetSkipInferShape(bool skip_infershape) { skip_infershape_ = skip_infershape; } - bool GetSkipInferShape() const { return skip_infershape_; } + bool SkipInferShape() const { return skip_infershape_; } private: bool IsScheduleReady() const; diff --git a/ge/hybrid/executor/worker/shape_inference_engine.cc b/ge/hybrid/executor/worker/shape_inference_engine.cc index 96959b80..753818bc 100755 --- a/ge/hybrid/executor/worker/shape_inference_engine.cc +++ b/ge/hybrid/executor/worker/shape_inference_engine.cc @@ -70,7 +70,7 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) { // Do shape inference // Skipping infer shape of input node. GELOGD("[%s] Start to invoke InferShapeAndType", node_item.NodeName().c_str()); - if (node_state.GetSkipInferShape()) { + if (!node_state.SkipInferShape()) { RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start"); GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true), "[Invoke][InferShapeAndType] for %s failed.", node_item.NodeName().c_str()); From 4bc0f6f2af291635ec162cea483c1974b8976d35 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 16 Jun 2021 22:00:50 +0800 Subject: [PATCH 040/226] Fix bug. --- ge/hybrid/executor/node_state.h | 2 +- ge/hybrid/executor/worker/shape_inference_engine.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index 002e07ab..b80b60b0 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -179,7 +179,7 @@ struct NodeState { void SetSkipInferShape(bool skip_infershape) { skip_infershape_ = skip_infershape; } - bool SkipInferShape() const { return skip_infershape_; } + bool MaySkipShapeInference() const { return skip_infershape_; } private: bool IsScheduleReady() const; diff --git a/ge/hybrid/executor/worker/shape_inference_engine.cc b/ge/hybrid/executor/worker/shape_inference_engine.cc index 753818bc..50dc389c 100755 --- a/ge/hybrid/executor/worker/shape_inference_engine.cc +++ b/ge/hybrid/executor/worker/shape_inference_engine.cc @@ -70,7 +70,7 @@ Status ShapeInferenceEngine::InferShape(NodeState &node_state) { // Do shape inference // Skipping infer shape of input node. GELOGD("[%s] Start to invoke InferShapeAndType", node_item.NodeName().c_str()); - if (!node_state.SkipInferShape()) { + if (!node_state.MaySkipShapeInference()) { RECORD_SHAPE_INFERENCE_EVENT(execution_context_, node_item.NodeName().c_str(), "[InferShapeAndType] Start"); GE_CHK_STATUS_RET(ShapeRefiner::InferShapeAndTypeForRunning(node_item.node, true), "[Invoke][InferShapeAndType] for %s failed.", node_item.NodeName().c_str()); From 5bcb04dfb797158bc460fd43a2dc6c4058c41b6b Mon Sep 17 00:00:00 2001 From: wq160 Date: Thu, 17 Jun 2021 09:43:45 +0800 Subject: [PATCH 041/226] update submodule --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index 00c0c12e..8c5fd448 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 00c0c12eede6c7bce93a1eda5f0bb437ae80a7ec +Subproject commit 8c5fd4486f870d8b63213565aa39fdf1ba1e497a From 246d7e4fd8455f5ed5332b434b82d85b67f15358 Mon Sep 17 00:00:00 2001 From: y00500818 Date: Thu, 17 Jun 2021 10:36:12 +0800 Subject: [PATCH 042/226] bugfix for restore context --- ge/generator/ge_generator.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 575afb35..58047c89 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -674,6 +674,12 @@ Status GeGenerator::GenerateModel(const Graph &graph, const string &file_name_pr GELOGD("Current ctx is null."); ctx = nullptr; } + std::function callback = [&]() { + if (ctx != nullptr) { + (void)rtCtxSetCurrent(ctx); + } + }; + GE_MAKE_GUARD(restore, callback); GeRootModelPtr ge_root_model = nullptr; GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID); @@ -712,11 +718,6 @@ Status GeGenerator::GenerateModel(const Graph &graph, const string &file_name_pr } return ret; } - - if (ctx != nullptr) { - (void)rtCtxSetCurrent(ctx); - } - return SUCCESS; } From 1bed26c72e9b8a7386703b8d698a4d55c379bb3f Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 17 Jun 2021 11:28:14 +0800 Subject: [PATCH 043/226] Remove reduplicated useless proto --- ge/client/proto/ge_api.proto | 1 - ge/client/proto/ge_ir.proto | 193 --- ge/client/proto/insert_op.proto | 140 -- ge/client/proto/om.proto | 396 ----- ge/client/proto/task.proto | 179 --- ge/common/proto/ge_ir.proto | 193 --- ge/common/proto/insert_op.proto | 140 -- ge/common/proto/om.proto | 396 ----- ge/common/proto/op_mapping.proto | 75 - ge/common/proto/task.proto | 179 --- ge/common/proto/tensorflow/attr_value.proto | 70 - ge/common/proto/tensorflow/function.proto | 108 -- ge/common/proto/tensorflow/graph.proto | 64 - ge/common/proto/tensorflow/graph_library.proto | 22 - ge/common/proto/tensorflow/node_def.proto | 71 - ge/common/proto/tensorflow/op_def.proto | 172 -- ge/common/proto/tensorflow/resource_handle.proto | 37 - ge/common/proto/tensorflow/tensor.proto | 102 -- ge/common/proto/tensorflow/tensor_shape.proto | 53 - ge/common/proto/tensorflow/types.proto | 82 - ge/common/proto/tensorflow/versions.proto | 39 - ge/executor/proto/dump_task.proto | 113 -- ge/executor/proto/ge_ir.proto | 193 --- ge/executor/proto/insert_op.proto | 140 -- ge/executor/proto/om.proto | 396 ----- ge/executor/proto/op_mapping.proto | 75 - ge/executor/proto/task.proto | 179 --- ge/ge_local_engine/proto/task.proto | 179 --- ge/offline/proto/ge_ir.proto | 193 --- ge/offline/proto/insert_op.proto | 140 -- ge/offline/proto/om.proto | 396 ----- ge/offline/proto/task.proto | 179 --- ge/proto/caffe/caffe.proto | 1829 ---------------------- ge/proto/dump_task.proto | 113 -- ge/proto/fusion_model.proto | 21 - ge/proto/fwk_adapter.proto | 37 - ge/proto/ge_api.proto | 88 -- ge/proto/ge_ir.proto | 193 --- ge/proto/insert_op.proto | 140 -- ge/proto/om.proto | 396 ----- ge/proto/op_mapping.proto | 75 - ge/proto/optimizer_priority.proto | 7 - ge/proto/task.proto | 179 --- ge/proto/tensorflow/attr_value.proto | 70 - ge/proto/tensorflow/function.proto | 108 -- ge/proto/tensorflow/graph.proto | 64 - ge/proto/tensorflow/graph_library.proto | 22 - ge/proto/tensorflow/node_def.proto | 71 - ge/proto/tensorflow/op_def.proto | 172 -- ge/proto/tensorflow/resource_handle.proto | 37 - ge/proto/tensorflow/tensor.proto | 102 -- ge/proto/tensorflow/tensor_shape.proto | 53 - ge/proto/tensorflow/types.proto | 82 - ge/proto/tensorflow/versions.proto | 39 - 54 files changed, 8793 deletions(-) delete mode 100644 ge/client/proto/ge_api.proto delete mode 100644 ge/client/proto/ge_ir.proto delete mode 100644 ge/client/proto/insert_op.proto delete mode 100755 ge/client/proto/om.proto delete mode 100644 ge/client/proto/task.proto delete mode 100644 ge/common/proto/ge_ir.proto delete mode 100644 ge/common/proto/insert_op.proto delete mode 100644 ge/common/proto/om.proto delete mode 100644 ge/common/proto/op_mapping.proto delete mode 100644 ge/common/proto/task.proto delete mode 100644 ge/common/proto/tensorflow/attr_value.proto delete mode 100644 ge/common/proto/tensorflow/function.proto delete mode 100644 ge/common/proto/tensorflow/graph.proto delete mode 100644 ge/common/proto/tensorflow/graph_library.proto delete mode 100644 ge/common/proto/tensorflow/node_def.proto delete mode 100644 ge/common/proto/tensorflow/op_def.proto delete mode 100644 ge/common/proto/tensorflow/resource_handle.proto delete mode 100644 ge/common/proto/tensorflow/tensor.proto delete mode 100644 ge/common/proto/tensorflow/tensor_shape.proto delete mode 100644 ge/common/proto/tensorflow/types.proto delete mode 100644 ge/common/proto/tensorflow/versions.proto delete mode 100644 ge/executor/proto/dump_task.proto delete mode 100644 ge/executor/proto/ge_ir.proto delete mode 100644 ge/executor/proto/insert_op.proto delete mode 100644 ge/executor/proto/om.proto delete mode 100644 ge/executor/proto/op_mapping.proto delete mode 100644 ge/executor/proto/task.proto delete mode 100644 ge/ge_local_engine/proto/task.proto delete mode 100644 ge/offline/proto/ge_ir.proto delete mode 100644 ge/offline/proto/insert_op.proto delete mode 100644 ge/offline/proto/om.proto delete mode 100644 ge/offline/proto/task.proto delete mode 100644 ge/proto/caffe/caffe.proto delete mode 100644 ge/proto/dump_task.proto delete mode 100755 ge/proto/fusion_model.proto delete mode 100644 ge/proto/fwk_adapter.proto delete mode 100755 ge/proto/ge_api.proto delete mode 100644 ge/proto/ge_ir.proto delete mode 100644 ge/proto/insert_op.proto delete mode 100644 ge/proto/om.proto delete mode 100644 ge/proto/op_mapping.proto delete mode 100644 ge/proto/optimizer_priority.proto delete mode 100644 ge/proto/task.proto delete mode 100644 ge/proto/tensorflow/attr_value.proto delete mode 100644 ge/proto/tensorflow/function.proto delete mode 100644 ge/proto/tensorflow/graph.proto delete mode 100644 ge/proto/tensorflow/graph_library.proto delete mode 100644 ge/proto/tensorflow/node_def.proto delete mode 100644 ge/proto/tensorflow/op_def.proto delete mode 100644 ge/proto/tensorflow/resource_handle.proto delete mode 100644 ge/proto/tensorflow/tensor.proto delete mode 100644 ge/proto/tensorflow/tensor_shape.proto delete mode 100644 ge/proto/tensorflow/types.proto delete mode 100644 ge/proto/tensorflow/versions.proto diff --git a/ge/client/proto/ge_api.proto b/ge/client/proto/ge_api.proto deleted file mode 100644 index 26d705fe..00000000 --- a/ge/client/proto/ge_api.proto +++ /dev/null @@ -1 +0,0 @@ -../../proto/ge_api.proto \ No newline at end of file diff --git a/ge/client/proto/ge_ir.proto b/ge/client/proto/ge_ir.proto deleted file mode 100644 index c0ef3071..00000000 --- a/ge/client/proto/ge_ir.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package ge.proto; - -enum DataType -{ - DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. - DT_FLOAT = 1; // float type - DT_FLOAT16 = 2; // fp16 type - DT_INT8 = 3; // int8 type - DT_UINT8 = 4; // uint8 type - DT_INT16 = 5; // int16 type - DT_UINT16 = 6; // uint16 type - DT_INT32 = 7; // - DT_INT64 = 8; // int64 type - DT_UINT32 = 9; // unsigned int32 - DT_UINT64 = 10; // unsigned int64 - DT_BOOL = 11; // bool type - DT_DOUBLE = 12; // double type - DT_STRING = 13; // string type - DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ - DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ - DT_COMPLEX64 = 16; // complex64 type - DT_COMPLEX128 = 17; // complex128 type - DT_QINT8 = 18; // qint8 type - DT_QINT16 = 19; // qint16 type - DT_QINT32 = 20; // qint32 type - DT_QUINT8 = 21; // quint8 type - DT_QUINT16 = 22; // quint16 type - DT_RESOURCE = 23; // resource type - 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 -{ - message ListValue - { - enum ListValueType{ - VT_LIST_NONE = 0; - VT_LIST_STRING = 1; - VT_LIST_INT = 2; - VT_LIST_FLOAT = 3; - VT_LIST_BOOL = 4; - VT_LIST_BYTES = 5; - VT_LIST_TENSOR_DESC = 6; - VT_LIST_TENSOR = 7; - VT_LIST_GRAPH = 8; - VT_LIST_NAMED_ATTRS = 9; - VT_LIST_DATA_TYPE = 10; - } - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3; // "list(int)" - repeated float f = 4; // "list(float)" - repeated bool b = 5; // "list(bool)" - repeated bytes bt = 7; - repeated TensorDescriptor td = 8; - repeated TensorDef t = 9; - repeated GraphDef g = 10; - repeated NamedAttrs na = 11; - repeated int64 dt = 12; // list ge::DataType - - ListValueType val_type = 20; - } - - message ListListInt{ - message ListInt{ - repeated int64 list_i = 1; // list int - } - repeated ListInt list_list_i = 1; // list list int - } - - oneof value - { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; // Used to support attr nesting - TensorDescriptor td = 11; // GeTensorDesc type - TensorDef t = 12; // GeTensor type - GraphDef g = 13; // Graph type - ListListInt list_list_int = 14; // List List Int type - int64 dt = 15; // ge::DataType - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs -{ - string name = 1; - map attr = 2; -} - -// Shape / dimension description, using row-major order -message ShapeDef -{ - repeated int64 dim = 1; // Size of each dimension -} - -// Multidimensional data description -message TensorDescriptor -{ - string name = 1; // Optional parameter, tensor name - - DataType dtype = 2; // tensor datatype - ShapeDef shape = 3; // Shape / dimension - string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" - - bool has_out_attr = 9; - int64 size = 10; - int64 weight_size = 11; - bool reuse_input = 12; - bool output_tensor = 13; - string device_type = 14; - bool input_tensor =15; - int64 real_dim_cnt = 16; - int64 reuse_input_index = 17; - int64 data_offset = 18; - int64 cmps_size = 19; - string cmps_tab = 20; - int64 cmps_tab_offset = 21; - - map attr = 5; // Set of extra parameter fields -} - -// GeTensor definition -message TensorDef -{ - TensorDescriptor desc = 1; // Tensor description - bytes data = 2; // Tensor data -} - - -// Operator description -message OpDef -{ - string name = 1; // name - string type = 2; // type - - repeated string input = 5; // input original op name + outgoing index. op_name:index - - map attr = 10; // Set of operator parameter fields - - bool has_out_attr = 20; - int64 id = 21; - int64 stream_id =22; - repeated string input_name = 23; - repeated string src_name = 24; - repeated int64 src_index = 25; - repeated string dst_name = 26; - repeated int64 dst_index = 27; - repeated int64 input_i = 28; - repeated int64 output_i = 29; - repeated int64 workspace = 30; - repeated int64 workspace_bytes = 31; - repeated bool is_input_const = 32; - repeated TensorDescriptor input_desc = 33; - repeated TensorDescriptor output_desc = 34; - repeated string subgraph_name = 35; -} - -// Graph definition -message GraphDef -{ - string name = 1; // name - - repeated string input = 4; // Graph input - repeated string output = 5; // Graph output - - repeated OpDef op = 6; // List of operators - - map attr = 11; // Extended field -} - -// model definition -message ModelDef -{ - string name = 1; // name - uint32 version = 2; // IR Proto verion - string custom_version = 3; // User model version number, passed in by user - - repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef - - map attr = 11; // Extended field -} - diff --git a/ge/client/proto/insert_op.proto b/ge/client/proto/insert_op.proto deleted file mode 100644 index 7d708865..00000000 --- a/ge/client/proto/insert_op.proto +++ /dev/null @@ -1,140 +0,0 @@ -syntax = "proto3"; - -package domi; - -message InsertNewOps { - repeated AippOpParams aipp_op = 1; - repeated MultiShapeOpParams multi_shape_op = 2; -} - -message AippOpParams { - enum InputFormat { - UNDEFINED = 0; - YUV420SP_U8 = 1; - XRGB8888_U8 = 2; - RGB888_U8 = 3; - YUV400_U8 = 4; - NC1HWC0DI_FP16 = 5; - NC1HWC0DI_S8 = 6; - ARGB8888_U8 = 7; - YUYV_U8 = 8; - YUV422SP_U8 = 9; - AYUV444_U8 = 10; - RAW10 = 11; - RAW12 = 12; - RAW16 = 13; - RAW24 = 14; - RGB16 = 15; - RGB20 = 16; - RGB24 = 17; - RGB8_IR = 18; - RGB16_IR = 19; - RGB24_IR = 20; - } - - enum AippMode { - undefined = 0; - static = 1; - dynamic = 2; - } - - // AIPPģʽ־̬AIPPͶ̬AIPP - AippMode aipp_mode = 1; - - // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 - // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 - uint32 related_input_rank = 2; - - // related_input_name is optional and the top name of data node which inserts aipp - string related_input_name = 6; - - // input_edge_idxΪѡΪͣ÷ΧΪ>=0 - // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP - // ֵ <= Dataߵĸ - repeated uint32 input_edge_idx = 3; - - // [Begin] ̬AIPPþ̬AIPPʱЧ - uint32 max_src_image_size = 4; - - // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ - bool support_rotation = 5; - - // [End] ̬AIPP - - - // [Begin] ̬AIPPö̬AIPPʱЧ - InputFormat input_format = 51; - bool csc_switch = 52; - float cpadding_value = 53; - bool rbuv_swap_switch = 54; - bool ax_swap_switch = 55; - bool single_line_mode = 56; - - int32 src_image_size_w = 57; - int32 src_image_size_h = 58; - - bool crop = 59; - int32 load_start_pos_w = 60; - int32 load_start_pos_h = 61; - int32 crop_size_w = 62; - int32 crop_size_h = 63; - - bool resize = 64; - int32 resize_output_w = 65; - int32 resize_output_h = 66; - - bool padding = 67; - int32 left_padding_size = 68; - int32 right_padding_size = 69; - int32 top_padding_size = 70; - int32 bottom_padding_size = 71; - float padding_value = 72; - - int32 mean_chn_0 = 10; - int32 mean_chn_1 = 11; - int32 mean_chn_2 = 12; - int32 mean_chn_3 = 19; - float min_chn_0 = 13; - float min_chn_1 = 14; - float min_chn_2 = 15; - float min_chn_3 = 20; - repeated float var_reci_chn_0 = 16; - repeated float var_reci_chn_1 = 17; - repeated float var_reci_chn_2 = 18; - repeated float var_reci_chn_3 = 21; - - repeated int32 matrix_r0c0 = 30; - repeated int32 matrix_r0c1 = 31; - repeated int32 matrix_r0c2 = 32; - repeated int32 matrix_r1c0 = 33; - repeated int32 matrix_r1c1 = 34; - repeated int32 matrix_r1c2 = 35; - repeated int32 matrix_r2c0 = 36; - repeated int32 matrix_r2c1 = 37; - repeated int32 matrix_r2c2 = 38; - repeated int32 output_bias_0 = 39; - repeated int32 output_bias_1 = 40; - repeated int32 output_bias_2 = 41; - repeated int32 input_bias_0 = 42; - repeated int32 input_bias_1 = 43; - repeated int32 input_bias_2 = 44; - - // [End] ̬AIPP - - // The n number that is used for raw/rgbir data into f16 transformation. - // The transformation equation is x/(2^n). If set to 0, no transform is performed. - uint32 raw_rgbir_to_f16_n = 45; -} - -message MultiShapeOpParams { - enum MultiShapeMode { - batch = 0; //̬batch - resolution = 1; //ֱ̬ʣչ - } - - MultiShapeMode mode = 1; //ģʽ - uint32 related_input_rank = 2; //Ӳ뵽ĸ - - - repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ -} diff --git a/ge/client/proto/om.proto b/ge/client/proto/om.proto deleted file mode 100755 index e15e5f80..00000000 --- a/ge/client/proto/om.proto +++ /dev/null @@ -1,396 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -enum TargetType -{ - MINI = 0; - TINY = 1; - LITE = 2; -} - -// offline model -message ModelDef { - string name = 1; - uint32 version = 2; - - uint64 memory_size = 10; - uint32 stream_num = 11; - uint32 event_num = 12; - uint64 weight_size = 13; - uint32 label_num = 15; - repeated OpDef op = 20; - TargetType target_type = 23; - - map attr = 30; -}; - -// operator define -message OpDef { - string name = 1; - string type = 2; - - uint32 id = 3; - uint32 stream_id = 4; - - repeated string input_name = 5; - - repeated string src_name = 8; - repeated int32 src_index = 9; - repeated int64 input = 10; - repeated int64 output = 11; - repeated TensorDescriptor input_desc = 12; - repeated TensorDescriptor output_desc = 13; - repeated WeightDef weights = 14; - repeated string dst_name = 15; - repeated int32 dst_index = 16; - - repeated int64 workspace = 20; - repeated uint32 workspace_bytes = 21; - - repeated string weight_name = 22; - repeated bool is_input_const = 23; - - map attr = 30; - - QuantizeFactorParams quantize_factor = 31; - - oneof op_params { - // start at 100 here - SendOpParams sender_param = 100; - RecvOpParams receiver_param = 200; - ConvolutionOpParams convolution_param = 300; - PoolingOpParams pooling_param = 400; - EltwiseOpParams eltwise_param = 500; - BatchNormOpParams batchnorm_param = 600; - ScaleOpParams scale_param = 700; - FullConnectionOpParams full_connection_param = 800; - SoftmaxOpParams softmax_param = 900; - ActivationOpParams activation_param = 1000; - ReshapeOpParams reshape_param = 1100; - } -}; - -message SendOpParams { - uint32 event_id = 1; -}; - -message RecvOpParams { - uint32 event_id = 1; -}; - -enum QuantizeScaleType -{ - VECTOR_SCALE = 0; - SCALAR_SCALE = 1; -} - -enum QuantizeScaleMode -{ - NORMAL_MODE = 0; - SQRT_MODE = 1; -} - -enum QuantizeAlgorithm -{ - NON_OFFSET_ALGO = 0; - HALF_OFFSET_ALGO = 1; - ALL_OFFSET_ALGO = 2; -} -message QuantizeFactor -{ - QuantizeScaleMode scale_mode = 1; - bytes scale_value = 2; - int64 scale_offset = 3; - bytes offset_data_value = 4; - int64 offset_data_offset = 5; - bytes offset_weight_value = 6; - int64 offset_weight_offset = 7; - bytes offset_pad_value = 8; - int64 offset_pad_offset = 9; -}; - -message QuantizeCalcFactor -{ - bytes offsetw = 1; - int64 offsetw_offset = 2; - bytes offsetd = 3; - int64 offsetd_offset = 4; - bytes scalereq = 5; - int64 scaledreq_offset = 6; - bytes offsetdnext = 7; - int64 offsetdnext_offset = 8; -} - -message QuantizeFactorParams -{ - QuantizeAlgorithm quantize_algo = 1; - QuantizeScaleType scale_type = 2; - QuantizeFactor quantize_param = 3; - QuantizeFactor dequantize_param = 4; - QuantizeFactor requantize_param = 5; - QuantizeCalcFactor quantizecalc_param = 6; -}; - -message ConvolutionOpParams { - int32 mode = 1; - int32 algo = 2; - int32 pad_mode = 3; - uint32 group = 4; - uint32 num_output = 5; - - repeated uint32 pad = 10; - repeated uint32 stride = 11; - repeated uint32 dilation = 12; - repeated uint32 kernel = 13; - - float alpha = 20; - float beta = 21; - - WeightDef filter = 40; - WeightDef bias = 41; - - bool relu_flag = 62; - repeated uint32 adj = 70; - repeated uint32 target_shape = 71; - repeated uint32 before_pad = 72; -}; - -message PoolingOpParams { - int32 mode = 1; - int32 nan_opt = 2; - int32 pad_mode = 3; - bool global_pooling = 4; - - repeated uint32 window = 10; - repeated uint32 pad = 11; - repeated uint32 stride = 12; - bool ceil_mode = 13; - int32 data_mode = 14; - - float alpha = 20; - float beta = 21; - repeated uint32 before_pad = 22; -}; - -message EltwiseOpParams { - int32 mode = 1; - repeated float coeff = 2; - float alpha = 3; - float beta = 4; - repeated WeightDef weight = 5; - bool relu_flag = 6; -}; - -message ActivationOpParams { - int32 mode = 1; - float coef = 2; - float alpha = 3; - float beta = 4; -}; - -message BatchNormOpParams { - int32 mode = 1; - - float alpha = 2; - float beta = 3; - double epsilon = 4;//optinal,[default = 1e-5] - bool use_global_stats = 5; //optinal,by default true,testing mode - float moving_average_fraction = 6; //optinal,[default = .999]; - - WeightDef estimated_mean = 7; - WeightDef estimated_variance = 8; - - WeightDef scale = 9; - WeightDef bias = 10; -}; - -message ScaleOpParams { - WeightDef scale = 1; - WeightDef bias = 2; -}; - -message ReshapeOpParams { - float alpha = 1; - float beta = 2; - ShapeDef shape = 3; - int32 axis = 4; - int32 num_axes = 5; - int32 format = 6; -}; - -message SoftmaxOpParams { - int32 algo = 1; - int32 mode = 2; - float alpha = 3; - float beta = 4; -}; - -message FullConnectionOpParams { - WeightDef filter = 1; - WeightDef bias = 2; - uint32 num_output = 3; - bool relu_flag = 12; -}; - -message FlattenOpParams { - float alpha = 1; - float beta = 2; - int32 start_axis = 3; - int32 end_axis = 4; -} - -message AddLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message MulLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message AddOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message MulOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message SubOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message BiasAddOpParams { - float alpha = 1; - float beta = 2; - - WeightDef bias = 10; -}; - -message MatMulOpParams { - float alpha = 1; - float beta = 2; - bool transposeX = 3; - bool transposeW = 4; - - WeightDef filter = 10; - WeightDef bias = 12; -}; - -message RsqrtOpParams { - float alpha = 1; - float beta = 2; -}; - - -message WeightDef { - int32 format = 1; - int32 data_type = 2; - ShapeDef shape = 3; - bytes data = 4; - int64 data_offset = 5; - uint32 cmps_size = 6; - bytes cmps_tab = 7; - int64 cmps_tab_offset = 10; - CompressInfo cmps_info = 8; - AllOffsetQuantizeInfo alloffset_quantize_info = 11; -} - -message ShapeDef { - repeated int64 dim = 1; -} - -enum DeviceType { - NPU = 0; // In default, we will use NPU. - CPU = 1; // CPU -} - -message AllOffsetQuantizeInfo { - float scale = 1; - int32 offset = 2; -} - -message TensorDescriptor { - int32 format = 1; - int32 data_type = 2; - repeated int64 dim = 3; - uint32 size = 4; - bool reuse_input = 5; - bool output_tensor = 7; - DeviceType device_type = 8; - bool input_tensor = 9; - uint32 real_dim_cnt = 10; - uint32 reuse_input_index = 11; - AllOffsetQuantizeInfo alloffset_quantize_info = 12; -} - -message CompressInfo { - int32 blockRow = 1; // block row - int32 blockCol = 2; // block col - int32 fractalK = 3; // fractal K - int32 fractalN = 4; // fractal N - int32 lastFractalK = 5; // K of last fractal - int32 lastFractalN = 6; // N of last fractal - int32 cubeSize = 7; // cube's length - int32 loadDir = 8; // data load directtiono 0:col load 1:row load -} - -message AttrDef { - message ListValue { - repeated string s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated uint32 u = 6 [packed = true]; // "list(uint)" - repeated bytes bt = 7; - } - - oneof value { - string s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - uint32 u = 6; // "uint32" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs { - string name = 1; - map attr = 2; -} - diff --git a/ge/client/proto/task.proto b/ge/client/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/client/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/common/proto/ge_ir.proto b/ge/common/proto/ge_ir.proto deleted file mode 100644 index c0ef3071..00000000 --- a/ge/common/proto/ge_ir.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package ge.proto; - -enum DataType -{ - DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. - DT_FLOAT = 1; // float type - DT_FLOAT16 = 2; // fp16 type - DT_INT8 = 3; // int8 type - DT_UINT8 = 4; // uint8 type - DT_INT16 = 5; // int16 type - DT_UINT16 = 6; // uint16 type - DT_INT32 = 7; // - DT_INT64 = 8; // int64 type - DT_UINT32 = 9; // unsigned int32 - DT_UINT64 = 10; // unsigned int64 - DT_BOOL = 11; // bool type - DT_DOUBLE = 12; // double type - DT_STRING = 13; // string type - DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ - DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ - DT_COMPLEX64 = 16; // complex64 type - DT_COMPLEX128 = 17; // complex128 type - DT_QINT8 = 18; // qint8 type - DT_QINT16 = 19; // qint16 type - DT_QINT32 = 20; // qint32 type - DT_QUINT8 = 21; // quint8 type - DT_QUINT16 = 22; // quint16 type - DT_RESOURCE = 23; // resource type - 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 -{ - message ListValue - { - enum ListValueType{ - VT_LIST_NONE = 0; - VT_LIST_STRING = 1; - VT_LIST_INT = 2; - VT_LIST_FLOAT = 3; - VT_LIST_BOOL = 4; - VT_LIST_BYTES = 5; - VT_LIST_TENSOR_DESC = 6; - VT_LIST_TENSOR = 7; - VT_LIST_GRAPH = 8; - VT_LIST_NAMED_ATTRS = 9; - VT_LIST_DATA_TYPE = 10; - } - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3; // "list(int)" - repeated float f = 4; // "list(float)" - repeated bool b = 5; // "list(bool)" - repeated bytes bt = 7; - repeated TensorDescriptor td = 8; - repeated TensorDef t = 9; - repeated GraphDef g = 10; - repeated NamedAttrs na = 11; - repeated int64 dt = 12; // list ge::DataType - - ListValueType val_type = 20; - } - - message ListListInt{ - message ListInt{ - repeated int64 list_i = 1; // list int - } - repeated ListInt list_list_i = 1; // list list int - } - - oneof value - { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; // Used to support attr nesting - TensorDescriptor td = 11; // GeTensorDesc type - TensorDef t = 12; // GeTensor type - GraphDef g = 13; // Graph type - ListListInt list_list_int = 14; // List List Int type - int64 dt = 15; // ge::DataType - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs -{ - string name = 1; - map attr = 2; -} - -// Shape / dimension description, using row-major order -message ShapeDef -{ - repeated int64 dim = 1; // Size of each dimension -} - -// Multidimensional data description -message TensorDescriptor -{ - string name = 1; // Optional parameter, tensor name - - DataType dtype = 2; // tensor datatype - ShapeDef shape = 3; // Shape / dimension - string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" - - bool has_out_attr = 9; - int64 size = 10; - int64 weight_size = 11; - bool reuse_input = 12; - bool output_tensor = 13; - string device_type = 14; - bool input_tensor =15; - int64 real_dim_cnt = 16; - int64 reuse_input_index = 17; - int64 data_offset = 18; - int64 cmps_size = 19; - string cmps_tab = 20; - int64 cmps_tab_offset = 21; - - map attr = 5; // Set of extra parameter fields -} - -// GeTensor definition -message TensorDef -{ - TensorDescriptor desc = 1; // Tensor description - bytes data = 2; // Tensor data -} - - -// Operator description -message OpDef -{ - string name = 1; // name - string type = 2; // type - - repeated string input = 5; // input original op name + outgoing index. op_name:index - - map attr = 10; // Set of operator parameter fields - - bool has_out_attr = 20; - int64 id = 21; - int64 stream_id =22; - repeated string input_name = 23; - repeated string src_name = 24; - repeated int64 src_index = 25; - repeated string dst_name = 26; - repeated int64 dst_index = 27; - repeated int64 input_i = 28; - repeated int64 output_i = 29; - repeated int64 workspace = 30; - repeated int64 workspace_bytes = 31; - repeated bool is_input_const = 32; - repeated TensorDescriptor input_desc = 33; - repeated TensorDescriptor output_desc = 34; - repeated string subgraph_name = 35; -} - -// Graph definition -message GraphDef -{ - string name = 1; // name - - repeated string input = 4; // Graph input - repeated string output = 5; // Graph output - - repeated OpDef op = 6; // List of operators - - map attr = 11; // Extended field -} - -// model definition -message ModelDef -{ - string name = 1; // name - uint32 version = 2; // IR Proto verion - string custom_version = 3; // User model version number, passed in by user - - repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef - - map attr = 11; // Extended field -} - diff --git a/ge/common/proto/insert_op.proto b/ge/common/proto/insert_op.proto deleted file mode 100644 index 7d708865..00000000 --- a/ge/common/proto/insert_op.proto +++ /dev/null @@ -1,140 +0,0 @@ -syntax = "proto3"; - -package domi; - -message InsertNewOps { - repeated AippOpParams aipp_op = 1; - repeated MultiShapeOpParams multi_shape_op = 2; -} - -message AippOpParams { - enum InputFormat { - UNDEFINED = 0; - YUV420SP_U8 = 1; - XRGB8888_U8 = 2; - RGB888_U8 = 3; - YUV400_U8 = 4; - NC1HWC0DI_FP16 = 5; - NC1HWC0DI_S8 = 6; - ARGB8888_U8 = 7; - YUYV_U8 = 8; - YUV422SP_U8 = 9; - AYUV444_U8 = 10; - RAW10 = 11; - RAW12 = 12; - RAW16 = 13; - RAW24 = 14; - RGB16 = 15; - RGB20 = 16; - RGB24 = 17; - RGB8_IR = 18; - RGB16_IR = 19; - RGB24_IR = 20; - } - - enum AippMode { - undefined = 0; - static = 1; - dynamic = 2; - } - - // AIPPģʽ־̬AIPPͶ̬AIPP - AippMode aipp_mode = 1; - - // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 - // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 - uint32 related_input_rank = 2; - - // related_input_name is optional and the top name of data node which inserts aipp - string related_input_name = 6; - - // input_edge_idxΪѡΪͣ÷ΧΪ>=0 - // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP - // ֵ <= Dataߵĸ - repeated uint32 input_edge_idx = 3; - - // [Begin] ̬AIPPþ̬AIPPʱЧ - uint32 max_src_image_size = 4; - - // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ - bool support_rotation = 5; - - // [End] ̬AIPP - - - // [Begin] ̬AIPPö̬AIPPʱЧ - InputFormat input_format = 51; - bool csc_switch = 52; - float cpadding_value = 53; - bool rbuv_swap_switch = 54; - bool ax_swap_switch = 55; - bool single_line_mode = 56; - - int32 src_image_size_w = 57; - int32 src_image_size_h = 58; - - bool crop = 59; - int32 load_start_pos_w = 60; - int32 load_start_pos_h = 61; - int32 crop_size_w = 62; - int32 crop_size_h = 63; - - bool resize = 64; - int32 resize_output_w = 65; - int32 resize_output_h = 66; - - bool padding = 67; - int32 left_padding_size = 68; - int32 right_padding_size = 69; - int32 top_padding_size = 70; - int32 bottom_padding_size = 71; - float padding_value = 72; - - int32 mean_chn_0 = 10; - int32 mean_chn_1 = 11; - int32 mean_chn_2 = 12; - int32 mean_chn_3 = 19; - float min_chn_0 = 13; - float min_chn_1 = 14; - float min_chn_2 = 15; - float min_chn_3 = 20; - repeated float var_reci_chn_0 = 16; - repeated float var_reci_chn_1 = 17; - repeated float var_reci_chn_2 = 18; - repeated float var_reci_chn_3 = 21; - - repeated int32 matrix_r0c0 = 30; - repeated int32 matrix_r0c1 = 31; - repeated int32 matrix_r0c2 = 32; - repeated int32 matrix_r1c0 = 33; - repeated int32 matrix_r1c1 = 34; - repeated int32 matrix_r1c2 = 35; - repeated int32 matrix_r2c0 = 36; - repeated int32 matrix_r2c1 = 37; - repeated int32 matrix_r2c2 = 38; - repeated int32 output_bias_0 = 39; - repeated int32 output_bias_1 = 40; - repeated int32 output_bias_2 = 41; - repeated int32 input_bias_0 = 42; - repeated int32 input_bias_1 = 43; - repeated int32 input_bias_2 = 44; - - // [End] ̬AIPP - - // The n number that is used for raw/rgbir data into f16 transformation. - // The transformation equation is x/(2^n). If set to 0, no transform is performed. - uint32 raw_rgbir_to_f16_n = 45; -} - -message MultiShapeOpParams { - enum MultiShapeMode { - batch = 0; //̬batch - resolution = 1; //ֱ̬ʣչ - } - - MultiShapeMode mode = 1; //ģʽ - uint32 related_input_rank = 2; //Ӳ뵽ĸ - - - repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ -} diff --git a/ge/common/proto/om.proto b/ge/common/proto/om.proto deleted file mode 100644 index e15e5f80..00000000 --- a/ge/common/proto/om.proto +++ /dev/null @@ -1,396 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -enum TargetType -{ - MINI = 0; - TINY = 1; - LITE = 2; -} - -// offline model -message ModelDef { - string name = 1; - uint32 version = 2; - - uint64 memory_size = 10; - uint32 stream_num = 11; - uint32 event_num = 12; - uint64 weight_size = 13; - uint32 label_num = 15; - repeated OpDef op = 20; - TargetType target_type = 23; - - map attr = 30; -}; - -// operator define -message OpDef { - string name = 1; - string type = 2; - - uint32 id = 3; - uint32 stream_id = 4; - - repeated string input_name = 5; - - repeated string src_name = 8; - repeated int32 src_index = 9; - repeated int64 input = 10; - repeated int64 output = 11; - repeated TensorDescriptor input_desc = 12; - repeated TensorDescriptor output_desc = 13; - repeated WeightDef weights = 14; - repeated string dst_name = 15; - repeated int32 dst_index = 16; - - repeated int64 workspace = 20; - repeated uint32 workspace_bytes = 21; - - repeated string weight_name = 22; - repeated bool is_input_const = 23; - - map attr = 30; - - QuantizeFactorParams quantize_factor = 31; - - oneof op_params { - // start at 100 here - SendOpParams sender_param = 100; - RecvOpParams receiver_param = 200; - ConvolutionOpParams convolution_param = 300; - PoolingOpParams pooling_param = 400; - EltwiseOpParams eltwise_param = 500; - BatchNormOpParams batchnorm_param = 600; - ScaleOpParams scale_param = 700; - FullConnectionOpParams full_connection_param = 800; - SoftmaxOpParams softmax_param = 900; - ActivationOpParams activation_param = 1000; - ReshapeOpParams reshape_param = 1100; - } -}; - -message SendOpParams { - uint32 event_id = 1; -}; - -message RecvOpParams { - uint32 event_id = 1; -}; - -enum QuantizeScaleType -{ - VECTOR_SCALE = 0; - SCALAR_SCALE = 1; -} - -enum QuantizeScaleMode -{ - NORMAL_MODE = 0; - SQRT_MODE = 1; -} - -enum QuantizeAlgorithm -{ - NON_OFFSET_ALGO = 0; - HALF_OFFSET_ALGO = 1; - ALL_OFFSET_ALGO = 2; -} -message QuantizeFactor -{ - QuantizeScaleMode scale_mode = 1; - bytes scale_value = 2; - int64 scale_offset = 3; - bytes offset_data_value = 4; - int64 offset_data_offset = 5; - bytes offset_weight_value = 6; - int64 offset_weight_offset = 7; - bytes offset_pad_value = 8; - int64 offset_pad_offset = 9; -}; - -message QuantizeCalcFactor -{ - bytes offsetw = 1; - int64 offsetw_offset = 2; - bytes offsetd = 3; - int64 offsetd_offset = 4; - bytes scalereq = 5; - int64 scaledreq_offset = 6; - bytes offsetdnext = 7; - int64 offsetdnext_offset = 8; -} - -message QuantizeFactorParams -{ - QuantizeAlgorithm quantize_algo = 1; - QuantizeScaleType scale_type = 2; - QuantizeFactor quantize_param = 3; - QuantizeFactor dequantize_param = 4; - QuantizeFactor requantize_param = 5; - QuantizeCalcFactor quantizecalc_param = 6; -}; - -message ConvolutionOpParams { - int32 mode = 1; - int32 algo = 2; - int32 pad_mode = 3; - uint32 group = 4; - uint32 num_output = 5; - - repeated uint32 pad = 10; - repeated uint32 stride = 11; - repeated uint32 dilation = 12; - repeated uint32 kernel = 13; - - float alpha = 20; - float beta = 21; - - WeightDef filter = 40; - WeightDef bias = 41; - - bool relu_flag = 62; - repeated uint32 adj = 70; - repeated uint32 target_shape = 71; - repeated uint32 before_pad = 72; -}; - -message PoolingOpParams { - int32 mode = 1; - int32 nan_opt = 2; - int32 pad_mode = 3; - bool global_pooling = 4; - - repeated uint32 window = 10; - repeated uint32 pad = 11; - repeated uint32 stride = 12; - bool ceil_mode = 13; - int32 data_mode = 14; - - float alpha = 20; - float beta = 21; - repeated uint32 before_pad = 22; -}; - -message EltwiseOpParams { - int32 mode = 1; - repeated float coeff = 2; - float alpha = 3; - float beta = 4; - repeated WeightDef weight = 5; - bool relu_flag = 6; -}; - -message ActivationOpParams { - int32 mode = 1; - float coef = 2; - float alpha = 3; - float beta = 4; -}; - -message BatchNormOpParams { - int32 mode = 1; - - float alpha = 2; - float beta = 3; - double epsilon = 4;//optinal,[default = 1e-5] - bool use_global_stats = 5; //optinal,by default true,testing mode - float moving_average_fraction = 6; //optinal,[default = .999]; - - WeightDef estimated_mean = 7; - WeightDef estimated_variance = 8; - - WeightDef scale = 9; - WeightDef bias = 10; -}; - -message ScaleOpParams { - WeightDef scale = 1; - WeightDef bias = 2; -}; - -message ReshapeOpParams { - float alpha = 1; - float beta = 2; - ShapeDef shape = 3; - int32 axis = 4; - int32 num_axes = 5; - int32 format = 6; -}; - -message SoftmaxOpParams { - int32 algo = 1; - int32 mode = 2; - float alpha = 3; - float beta = 4; -}; - -message FullConnectionOpParams { - WeightDef filter = 1; - WeightDef bias = 2; - uint32 num_output = 3; - bool relu_flag = 12; -}; - -message FlattenOpParams { - float alpha = 1; - float beta = 2; - int32 start_axis = 3; - int32 end_axis = 4; -} - -message AddLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message MulLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message AddOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message MulOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message SubOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message BiasAddOpParams { - float alpha = 1; - float beta = 2; - - WeightDef bias = 10; -}; - -message MatMulOpParams { - float alpha = 1; - float beta = 2; - bool transposeX = 3; - bool transposeW = 4; - - WeightDef filter = 10; - WeightDef bias = 12; -}; - -message RsqrtOpParams { - float alpha = 1; - float beta = 2; -}; - - -message WeightDef { - int32 format = 1; - int32 data_type = 2; - ShapeDef shape = 3; - bytes data = 4; - int64 data_offset = 5; - uint32 cmps_size = 6; - bytes cmps_tab = 7; - int64 cmps_tab_offset = 10; - CompressInfo cmps_info = 8; - AllOffsetQuantizeInfo alloffset_quantize_info = 11; -} - -message ShapeDef { - repeated int64 dim = 1; -} - -enum DeviceType { - NPU = 0; // In default, we will use NPU. - CPU = 1; // CPU -} - -message AllOffsetQuantizeInfo { - float scale = 1; - int32 offset = 2; -} - -message TensorDescriptor { - int32 format = 1; - int32 data_type = 2; - repeated int64 dim = 3; - uint32 size = 4; - bool reuse_input = 5; - bool output_tensor = 7; - DeviceType device_type = 8; - bool input_tensor = 9; - uint32 real_dim_cnt = 10; - uint32 reuse_input_index = 11; - AllOffsetQuantizeInfo alloffset_quantize_info = 12; -} - -message CompressInfo { - int32 blockRow = 1; // block row - int32 blockCol = 2; // block col - int32 fractalK = 3; // fractal K - int32 fractalN = 4; // fractal N - int32 lastFractalK = 5; // K of last fractal - int32 lastFractalN = 6; // N of last fractal - int32 cubeSize = 7; // cube's length - int32 loadDir = 8; // data load directtiono 0:col load 1:row load -} - -message AttrDef { - message ListValue { - repeated string s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated uint32 u = 6 [packed = true]; // "list(uint)" - repeated bytes bt = 7; - } - - oneof value { - string s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - uint32 u = 6; // "uint32" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs { - string name = 1; - map attr = 2; -} - diff --git a/ge/common/proto/op_mapping.proto b/ge/common/proto/op_mapping.proto deleted file mode 100644 index d626eb49..00000000 --- a/ge/common/proto/op_mapping.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; -package toolkit.aicpu.dump; - -message Shape { - repeated uint64 dim = 1; -} - -message Output { - int32 data_type = 1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - string original_name = 5; - int32 original_output_index = 6; - int32 original_output_data_type = 7; - int32 original_output_format = 8; - uint64 size = 9; - Shape origin_shape = 10; -} - -message Input { - int32 data_type =1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - uint64 size = 5; - Shape origin_shape = 6; -} - -enum BufferType { - L1 = 0; -} - -message OpBuffer { - BufferType buffer_type = 1; - uint64 address = 2; - uint64 size = 3; -} - -message Op { - string op_name = 1; - string op_type = 2; -} - -message Task { - uint32 task_id = 1; - uint32 stream_id = 2; - Op op = 3; - repeated Output output = 4; - bool end_graph = 5; - repeated Input input = 6; - repeated OpBuffer buffer = 7; -} - -message OpMappingInfo { - string dump_path = 1; - oneof model_name_param { - string model_name = 2; - } - oneof model_id_param { - uint32 model_id = 3; - } - oneof step_id { - uint64 step_id_addr = 4; - } - oneof iterations_per_loop { - uint64 iterations_per_loop_addr = 5; - } - oneof loop_cond { - uint64 loop_cond_addr = 6; - } - uint32 flag = 7; // 0x01 load, 0x00 unload - repeated Task task = 8; - string dump_step = 9; -} \ No newline at end of file diff --git a/ge/common/proto/task.proto b/ge/common/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/common/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/common/proto/tensorflow/attr_value.proto b/ge/common/proto/tensorflow/attr_value.proto deleted file mode 100644 index 438d7163..00000000 --- a/ge/common/proto/tensorflow/attr_value.proto +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "AttrValueProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "tensor.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing the value for an attr used to configure an Op. -// Comment indicates the corresponding attr type. Only the field matching the -// attr type may be filled. -message AttrValue { - // LINT.IfChange - message ListValue { - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated DataType type = 6 [packed = true]; // "list(type)" - repeated TensorShapeProto shape = 7; // "list(shape)" - repeated TensorProto tensor = 8; // "list(tensor)" - repeated NameAttrList func = 9; // "list(attr)" - } - // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) - - oneof value { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - DataType type = 6; // "type" - TensorShapeProto shape = 7; // "shape" - TensorProto tensor = 8; // "tensor" - ListValue list = 1; // any "list(...)" - - // "func" represents a function. func.name is a function's name or - // a primitive op's name. func.attr.first is the name of an attr - // defined for that function. func.attr.second is the value for - // that attr in the instantiation. - NameAttrList func = 10; - - // This is a placeholder only used in nodes defined inside a - // function. It indicates the attr value will be supplied when - // the function is instantiated. For example, let us suppose a - // node "N" in function "FN". "N" has an attr "A" with value - // placeholder = "foo". When FN is instantiated with attr "foo" - // set to "bar", the instantiated node N's attr A will have been - // given the value "bar". - string placeholder = 9; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NameAttrList { - string name = 1; - map attr = 2; -} diff --git a/ge/common/proto/tensorflow/function.proto b/ge/common/proto/tensorflow/function.proto deleted file mode 100644 index 44681e32..00000000 --- a/ge/common/proto/tensorflow/function.proto +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "FunctionProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "node_def.proto"; -import "op_def.proto"; - -// A library is a set of named functions. -message FunctionDefLibrary { - repeated FunctionDef function = 1; - repeated GradientDef gradient = 2; -} - -// A function can be instantiated when the runtime can bind every attr -// with a value. When a GraphDef has a call to a function, it must -// have binding for every attr defined in the signature. -// * device spec, etc. -message FunctionDef { - // The definition of the function's name, arguments, return values, - // attrs etc. - OpDef signature = 1; - - // Attributes specific to this function definition. - map attr = 5; - - // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. - reserved 2; - - // In both of the following fields, there is the need to specify an - // output that is used as either the input to another node (in - // `node_def`) or as a return value of the function (in `ret`). - // Unlike the NodeDefs in GraphDef, we need to be able to specify a - // list in some cases (instead of just single outputs). Also, we - // need to be able to deal with lists of unknown length (so the - // output index may not be known at function definition time). So - // we use the following format instead: - // * "fun_in" where "fun_in" is the name of a function input arg in - // the `signature` field above. This represents that input, whether - // it is a single tensor or a list. - // * "fun_in:0" gives the first element of a function input arg (a - // non-list input is considered a list of length 1 for these - // purposes). - // * "node:out" where "node" is the name of a node in `node_def` and - // "out" is the name one of its op's output arguments (the name - // comes from the OpDef of the node's op). This represents that - // node's output, whether it is a single tensor or a list. - // Note: We enforce that an op's output arguments are never - // renamed in the backwards-compatibility test. - // * "node:out:0" gives the first element of a node output arg (a - // non-list output is considered a list of length 1 for these - // purposes). - // - // NOT CURRENTLY SUPPORTED (but may be in the future): - // * "node:out:-1" gives last element in a node output list - // * "node:out:1:" gives a list with all but the first element in a - // node output list - // * "node:out::-1" gives a list with all but the last element in a - // node output list - - // The body of the function. Unlike the NodeDefs in a GraphDef, attrs - // may have values of type `placeholder` and the `input` field uses - // the "output" format above. - - // By convention, "op" in node_def is resolved by consulting with a - // user-defined library first. If not resolved, "func" is assumed to - // be a builtin op. - repeated NodeDef node_def = 3; - - // A mapping from the output arg names from `signature` to the - // outputs from `node_def` that should be returned by the function. - map ret = 4; -} - -// GradientDef defines the gradient function of a function defined in -// a function library. -// -// A gradient function g (specified by gradient_func) for a function f -// (specified by function_name) must follow the following: -// -// The function 'f' must be a numerical function which takes N inputs -// and produces M outputs. Its gradient function 'g', which is a -// function taking N + M inputs and produces N outputs. -// -// I.e. if we have -// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), -// then, g is -// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, -// dL/dy1, dL/dy2, ..., dL/dy_M), -// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the -// loss function). dL/dx_i is the partial derivative of L with respect -// to x_i. -message GradientDef { - string function_name = 1; // The function name. - string gradient_func = 2; // The gradient function's name. -} diff --git a/ge/common/proto/tensorflow/graph.proto b/ge/common/proto/tensorflow/graph.proto deleted file mode 100644 index 73bfc6ee..00000000 --- a/ge/common/proto/tensorflow/graph.proto +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "GraphProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "node_def.proto"; -import "function.proto"; -import "versions.proto"; - -// Represents the graph of operations -message GraphDef { - repeated NodeDef node = 1; - - // Compatibility versions of the graph. See core/public/version.h for version - // history. The GraphDef version is distinct from the TensorFlow version, and - // each release of TensorFlow will support a range of GraphDef versions. - VersionDef versions = 4; - - // Deprecated single version field; use versions above instead. Since all - // GraphDef changes before "versions" was introduced were forward - // compatible, this field is entirely ignored. - int32 version = 3 [deprecated = true]; - - // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. - // - // "library" provides user-defined functions. - // - // Naming: - // * library.function.name are in a flat namespace. - // NOTE: We may need to change it to be hierarchical to support - // different orgs. E.g., - // { "/google/nn", { ... }}, - // { "/google/vision", { ... }} - // { "/org_foo/module_bar", { ... }} - // map named_lib; - // * If node[i].op is the name of one function in "library", - // node[i] is deemed as a function call. Otherwise, node[i].op - // must be a primitive operation supported by the runtime. - // - // - // Function call semantics: - // - // * The callee may start execution as soon as some of its inputs - // are ready. The caller may want to use Tuple() mechanism to - // ensure all inputs are ready in the same time. - // - // * The consumer of return values may start executing as soon as - // the return values the consumer depends on are ready. The - // consumer may want to use Tuple() mechanism to ensure the - // consumer does not start until all return values of the callee - // function are ready. - FunctionDefLibrary library = 2; -}; diff --git a/ge/common/proto/tensorflow/graph_library.proto b/ge/common/proto/tensorflow/graph_library.proto deleted file mode 100644 index 7bca0838..00000000 --- a/ge/common/proto/tensorflow/graph_library.proto +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; - -import "graph.proto"; - -message GeGraphDef { - string name = 1; - GraphDef graph = 2; -} - -message GraphDefLibrary { - repeated GeGraphDef graph_def = 1; -}; \ No newline at end of file diff --git a/ge/common/proto/tensorflow/node_def.proto b/ge/common/proto/tensorflow/node_def.proto deleted file mode 100644 index 50cf5cac..00000000 --- a/ge/common/proto/tensorflow/node_def.proto +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "NodeProto"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; - -message NodeDef { - // The name given to this operator. Used for naming inputs, - // logging, visualization, etc. Unique within a single GraphDef. - // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". - string name = 1; - - // The operation name. There may be custom parameters in attrs. - // Op names starting with an underscore are reserved for internal use. - string op = 2; - - // Each input is "node:src_output" with "node" being a string name and - // "src_output" indicating which output tensor to use from "node". If - // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs - // may optionally be followed by control inputs that have the format - // "^node". - repeated string input = 3; - - // A (possibly partial) specification for the device on which this - // node should be placed. - // The expected syntax for this string is as follows: - // - // DEVICE_SPEC ::= PARTIAL_SPEC - // - // PARTIAL_SPEC ::= ("/" CONSTRAINT) * - // CONSTRAINT ::= ("job:" JOB_NAME) - // | ("replica:" [1-9][0-9]*) - // | ("task:" [1-9][0-9]*) - // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) - // - // Valid values for this string include: - // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) - // * "/job:worker/device:GPU:3" (partial specification) - // * "" (no specification) - // - // If the constraints do not resolve to a single device (or if this - // field is empty or not present), the runtime will attempt to - // choose a device automatically. - string device = 4; - - // Operation-specific graph-construction-time configuration. - // Note that this should include all attrs defined in the - // corresponding OpDef, including those with a value matching - // the default -- this allows the default to change and makes - // NodeDefs easier to interpret on their own. However, if - // an attr with a default is not specified in this list, the - // default will be used. - // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and - // one of the names from the corresponding OpDef's attr field). - // The values must have a type matching the corresponding OpDef - // attr's type field. - // Add some examples here showing best practices. - map attr = 5; -}; diff --git a/ge/common/proto/tensorflow/op_def.proto b/ge/common/proto/tensorflow/op_def.proto deleted file mode 100644 index 7f0e8ce2..00000000 --- a/ge/common/proto/tensorflow/op_def.proto +++ /dev/null @@ -1,172 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "OpDefProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "types.proto"; - -// Defines an operation. A NodeDef in a GraphDef specifies an Op by -// using the "op" field which should match the name of a OpDef. -// LINT.IfChange -message OpDef { - // Op names starting with an underscore are reserved for internal use. - // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". - string name = 1; - - // For describing inputs and outputs. - message ArgDef { - // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". - string name = 1; - - // Human readable description. - string description = 2; - - // Describes the type of one or more tensors that are accepted/produced - // by this input/output arg. The only legal combinations are: - // * For a single tensor: either the "type" field is set or the - // "type_attr" field is set to the name of an attr with type "type". - // * For a sequence of tensors with the same type: the "number_attr" - // field will be set to the name of an attr with type "int", and - // either the "type" or "type_attr" field will be set as for - // single tensors. - // * For a sequence of tensors, the "type_list_attr" field will be set - // to the name of an attr with type "list(type)". - DataType type = 3; - string type_attr = 4; // if specified, attr must have type "type" - string number_attr = 5; // if specified, attr must have type "int" - // If specified, attr must have type "list(type)", and none of - // type, type_attr, and number_attr may be specified. - string type_list_attr = 6; - - // For inputs: if true, the inputs are required to be refs. - // By default, inputs can be either refs or non-refs. - // For outputs: if true, outputs are refs, otherwise they are not. - bool is_ref = 16; - }; - - // Description of the input(s). - repeated ArgDef input_arg = 2; - - // Description of the output(s). - repeated ArgDef output_arg = 3; - - // Description of the graph-construction-time configuration of this - // Op. That is to say, this describes the attr fields that will - // be specified in the NodeDef. - message AttrDef { - // A descriptive name for the argument. May be used, e.g. by the - // Python client, as a keyword argument name, and so should match - // the regexp "[a-z][a-z0-9_]+". - string name = 1; - - // One of the type names from attr_value.proto ("string", "list(string)", - // "int", etc.). - string type = 2; - - // A reasonable default for this attribute if the user does not supply - // a value. If not specified, the user must supply a value. - AttrValue default_value = 3; - - // Human-readable description. - string description = 4; - - - // --- Constraints --- - // These constraints are only in effect if specified. Default is no - // constraints. - - // For type == "int", this is a minimum value. For "list(___)" - // types, this is the minimum length. - bool has_minimum = 5; - int64 minimum = 6; - - // The set of allowed values. Has type that is the "list" version - // of the "type" field above (uses the "list" field of AttrValue). - // If type == "type" or "list(type)" above, then the "type" field - // of "allowed_values.list" has the set of allowed DataTypes. - // If type == "string" or "list(string)", then the "s" field of - // "allowed_values.list" has the set of allowed strings. - AttrValue allowed_values = 7; - } - repeated AttrDef attr = 4; - - // Optional deprecation based on GraphDef versions. - OpDeprecation deprecation = 8; - - // One-line human-readable description of what the Op does. - string summary = 5; - - // Additional, longer human-readable description of what the Op does. - string description = 6; - - // ------------------------------------------------------------------------- - // Which optimizations this operation can participate in. - - // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) - bool is_commutative = 18; - - // If is_aggregate is true, then this operation accepts N >= 2 - // inputs and produces 1 output all of the same type. Should be - // associative and commutative, and produce output with the same - // shape as the input. The optimizer may replace an aggregate op - // taking input from multiple devices with a tree of aggregate ops - // that aggregate locally within each device (and possibly within - // groups of nearby devices) before communicating. - bool is_aggregate = 16; // for things like add - - // Other optimizations go here, like - // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. - - // ------------------------------------------------------------------------- - // Optimization constraints. - - // Ops are marked as stateful if their behavior depends on some state beyond - // their input tensors (e.g. variable reading op) or if they have - // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops - // must always produce the same output for the same input and have - // no side-effects. - // - // By default Ops may be moved between devices. Stateful ops should - // either not be moved, or should only be moved if that state can also - // be moved (e.g. via some sort of save / restore). - // Stateful ops are guaranteed to never be optimized away by Common - // Subexpression Elimination (CSE). - bool is_stateful = 17; // for things like variables, queue - - // ------------------------------------------------------------------------- - // Non-standard options. - - // By default, all inputs to an Op must be initialized Tensors. Ops - // that may initialize tensors for the first time should set this - // field to true, to allow the Op to take an uninitialized Tensor as - // input. - bool allows_uninitialized_input = 19; // for Assign, etc. -}; -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) - -// Information about version-dependent deprecation of an op -message OpDeprecation { - // First GraphDef version at which the op is disallowed. - int32 version = 1; - - // Explanation of why it was deprecated and what to use instead. - string explanation = 2; -}; - -// A collection of OpDefs -message OpList { - repeated OpDef op = 1; -}; diff --git a/ge/common/proto/tensorflow/resource_handle.proto b/ge/common/proto/tensorflow/resource_handle.proto deleted file mode 100644 index 91c46c9a..00000000 --- a/ge/common/proto/tensorflow/resource_handle.proto +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "ResourceHandle"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Protocol buffer representing a handle to a tensorflow resource. Handles are -// not valid across executions, but can be serialized back and forth from within -// a single run. -message ResourceHandleProto { - // Unique name for the device containing the resource. - string device = 1; - - // Container in which this resource is placed. - string container = 2; - - // Unique name of this resource. - string name = 3; - - // Hash code for the type of the resource. Is only valid in the same device - // and in the same execution. - uint64 hash_code = 4; - - // For debug-only, the name of the type pointed to by this handle, if - // available. - string maybe_type_name = 5; -}; diff --git a/ge/common/proto/tensorflow/tensor.proto b/ge/common/proto/tensorflow/tensor.proto deleted file mode 100644 index 48eeb6c4..00000000 --- a/ge/common/proto/tensorflow/tensor.proto +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TensorProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "resource_handle.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing a tensor. -message TensorProto { - DataType dtype = 1; - - // Shape of the tensor. - TensorShapeProto tensor_shape = 2; - - // Only one of the representations below is set, one of "tensor_contents" and - // the "xxx_val" attributes. We are not using oneof because as oneofs cannot - // contain repeated fields it would require another extra set of messages. - - // Version number. - // - // In version 0, if the "repeated xxx" representations contain only one - // element, that element is repeated to fill the shape. This makes it easy - // to represent a constant Tensor with a single value. - int32 version_number = 3; - - // Serialized raw tensor content from either Tensor::AsProtoTensorContent or - // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation - // can be used for all tensor types. The purpose of this representation is to - // reduce serialization overhead during RPC call by avoiding serialization of - // many repeated small items. - bytes tensor_content = 4; - - // Type specific representations that make it easy to create tensor protos in - // all languages. Only the representation corresponding to "dtype" can - // be set. The values hold the flattened representation of the tensor in - // row major order. - - // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll - // have some pointless zero padding for each value here. - repeated int32 half_val = 13 [packed = true]; - - // DT_FLOAT. - repeated float float_val = 5 [packed = true]; - - // DT_DOUBLE. - repeated double double_val = 6 [packed = true]; - - // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. - repeated int32 int_val = 7 [packed = true]; - - // DT_STRING - repeated bytes string_val = 8; - - // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real - // and imaginary parts of i-th single precision complex. - repeated float scomplex_val = 9 [packed = true]; - - // DT_INT64 - repeated int64 int64_val = 10 [packed = true]; - - // DT_BOOL - repeated bool bool_val = 11 [packed = true]; - - // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real - // and imaginary parts of i-th double precision complex. - repeated double dcomplex_val = 12 [packed = true]; - - // DT_RESOURCE - repeated ResourceHandleProto resource_handle_val = 14; - - // DT_VARIANT - repeated VariantTensorDataProto variant_val = 15; - - // DT_UINT32 - repeated uint32 uint32_val = 16 [packed = true]; - - // DT_UINT64 - repeated uint64 uint64_val = 17 [packed = true]; -}; - -// Protocol buffer representing the serialization format of DT_VARIANT tensors. -message VariantTensorDataProto { - // Name of the type of objects being serialized. - string type_name = 1; - // Portions of the object that are not Tensors. - bytes metadata = 2; - // Tensors contained within objects being serialized. - repeated TensorProto tensors = 3; -} diff --git a/ge/common/proto/tensorflow/tensor_shape.proto b/ge/common/proto/tensorflow/tensor_shape.proto deleted file mode 100644 index 3a6d8c5a..00000000 --- a/ge/common/proto/tensorflow/tensor_shape.proto +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -// Protocol buffer representing the shape of tensors. - -syntax = "proto3"; -option cc_enable_arenas = true; -option java_outer_classname = "TensorShapeProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -package domi.tensorflow; - -// Dimensions of a tensor. -message TensorShapeProto { - // One dimension of the tensor. - message Dim { - // Size of the tensor in that dimension. - // This value must be >= -1, but values of -1 are reserved for "unknown" - // shapes (values of -1 mean "unknown" dimension). Certain wrappers - // that work with TensorShapeProto may fail at runtime when deserializing - // a TensorShapeProto containing a dim value of -1. - int64 size = 1; - - // Optional name of the tensor dimension. - string name = 2; - }; - - // Dimensions of the tensor, such as {"input", 30}, {"output", 40} - // for a 30 x 40 2D tensor. If an entry has size -1, this - // corresponds to a dimension of unknown size. The names are - // optional. - // - // The order of entries in "dim" matters: It indicates the layout of the - // values in the tensor in-memory representation. - // - // The first entry in "dim" is the outermost dimension used to layout the - // values, the last entry is the innermost dimension. This matches the - // in-memory layout of RowMajor Eigen tensors. - // - // If "dim.size()" > 0, "unknown_rank" must be false. - repeated Dim dim = 2; - - // If true, the number of dimensions in the shape is unknown. - // - // If true, "dim.size()" must be 0. - bool unknown_rank = 3; -}; diff --git a/ge/common/proto/tensorflow/types.proto b/ge/common/proto/tensorflow/types.proto deleted file mode 100644 index f40e49cb..00000000 --- a/ge/common/proto/tensorflow/types.proto +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TypesProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// LINT.IfChange -enum DataType { - // Not a legal value for DataType. Used to indicate a DataType field - // has not been set. - DT_INVALID = 0; - - // Data types that all computation devices are expected to be - // capable to support. - DT_FLOAT = 1; - DT_DOUBLE = 2; - DT_INT32 = 3; - DT_UINT8 = 4; - DT_INT16 = 5; - DT_INT8 = 6; - DT_STRING = 7; - DT_COMPLEX64 = 8; // Single-precision complex - DT_INT64 = 9; - DT_BOOL = 10; - DT_QINT8 = 11; // Quantized int8 - DT_QUINT8 = 12; // Quantized uint8 - DT_QINT32 = 13; // Quantized int32 - DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. - DT_QINT16 = 15; // Quantized int16 - DT_QUINT16 = 16; // Quantized uint16 - DT_UINT16 = 17; - DT_COMPLEX128 = 18; // Double-precision complex - DT_HALF = 19; - DT_RESOURCE = 20; - DT_VARIANT = 21; // Arbitrary C++ data types - DT_UINT32 = 22; - DT_UINT64 = 23; - - // Do not use! These are only for parameters. Every enum above - // should have a corresponding value below (verified by types_test). - DT_FLOAT_REF = 101; - DT_DOUBLE_REF = 102; - DT_INT32_REF = 103; - DT_UINT8_REF = 104; - DT_INT16_REF = 105; - DT_INT8_REF = 106; - DT_STRING_REF = 107; - DT_COMPLEX64_REF = 108; - DT_INT64_REF = 109; - DT_BOOL_REF = 110; - DT_QINT8_REF = 111; - DT_QUINT8_REF = 112; - DT_QINT32_REF = 113; - DT_BFLOAT16_REF = 114; - DT_QINT16_REF = 115; - DT_QUINT16_REF = 116; - DT_UINT16_REF = 117; - DT_COMPLEX128_REF = 118; - DT_HALF_REF = 119; - DT_RESOURCE_REF = 120; - DT_VARIANT_REF = 121; - DT_UINT32_REF = 122; - DT_UINT64_REF = 123; -} -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/c/c_api.h, -// https://www.tensorflow.org/code/tensorflow/go/tensor.go, -// https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.h, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, -// https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, -// https://www.tensorflow.org/code/tensorflow/python/framework/function.py) diff --git a/ge/common/proto/tensorflow/versions.proto b/ge/common/proto/tensorflow/versions.proto deleted file mode 100644 index 4e81548f..00000000 --- a/ge/common/proto/tensorflow/versions.proto +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "VersionsProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Version information for a piece of serialized data -// -// There are different types of versions for each type of data -// (GraphDef, etc.), but they all have the same common shape -// described here. -// -// Each consumer has "consumer" and "min_producer" versions (specified -// elsewhere). A consumer is allowed to consume this data if -// -// producer >= min_producer -// consumer >= min_consumer -// consumer not in bad_consumers -// -message VersionDef { - // The version of the code that produced this data. - int32 producer = 1; - - // Any consumer below this version is not allowed to consume this data. - int32 min_consumer = 2; - - // Specific consumer versions which are disallowed (e.g. due to bugs). - repeated int32 bad_consumers = 3; -}; diff --git a/ge/executor/proto/dump_task.proto b/ge/executor/proto/dump_task.proto deleted file mode 100644 index a2411ddb..00000000 --- a/ge/executor/proto/dump_task.proto +++ /dev/null @@ -1,113 +0,0 @@ -syntax = "proto3"; -package toolkit.dump; - -enum OutputDataType { - DT_UNDEFINED = 0; - DT_FLOAT = 1; - DT_FLOAT16 = 2; - DT_INT8 = 3; - DT_UINT8 = 4; - DT_INT16 = 5; - DT_UINT16 = 6; - DT_INT32 = 7; - DT_INT64 = 8; - DT_UINT32 = 9; - DT_UINT64 = 10; - DT_BOOL = 11; - DT_DOUBLE = 12; - DT_STRING = 13; - DT_DUAL_SUB_INT8 = 14; - DT_DUAL_SUB_UINT8 = 15; - DT_COMPLEX64 = 16; - DT_COMPLEX128 = 17; - DT_QINT8 = 18; - DT_QINT16 = 19; - DT_QINT32 = 20; - DT_QUINT8 = 21; - DT_QUINT16 = 22; - DT_RESOURCE = 23; - DT_STRING_REF = 24; - DT_DUAL = 25; - DT_VARIANT = 26; -} - -enum OutputFormat { - FORMAT_NCHW = 0; - FORMAT_NHWC = 1; - FORMAT_ND = 2; - FORMAT_NC1HWC0 = 3; - FORMAT_FRACTAL_Z = 4; - FORMAT_NC1C0HWPAD = 5; - FORMAT_NHWC1C0 = 6; - FORMAT_FSR_NCHW = 7; - FORMAT_FRACTAL_DECONV = 8; - FORMAT_C1HWNC0 = 9; - FORMAT_FRACTAL_DECONV_TRANSPOSE = 10; - FORMAT_FRACTAL_DECONV_SP_STRIDE_TRANS = 11; - FORMAT_NC1HWC0_C04 = 12; - FORMAT_FRACTAL_Z_C04 = 13; - FORMAT_CHWN = 14; - FORMAT_FRACTAL_DECONV_SP_STRIDE8_TRANS = 15; - FORMAT_HWCN = 16; - FORMAT_NC1KHKWHWC0 = 17; - FORMAT_BN_WEIGHT = 18; - FORMAT_FILTER_HWCK = 19; - FORMAT_HASHTABLE_LOOKUP_LOOKUPS=20; - FORMAT_HASHTABLE_LOOKUP_KEYS = 21; - FORMAT_HASHTABLE_LOOKUP_VALUE = 22; - FORMAT_HASHTABLE_LOOKUP_OUTPUT = 23; - FORMAT_HASHTABLE_LOOKUP_HITS=24; - FORMAT_C1HWNCoC0 = 25; - FORMAT_MD = 26; - FORMAT_NDHWC = 27; - FORMAT_FRACTAL_ZZ = 28; - FORMAT_FRACTAL_NZ = 29; - FORMAT_RESERVED = 30; -} - -message OriginalOp { - string name = 1; - uint32 output_index = 2; - OutputDataType data_type = 3; - OutputFormat format = 4; -} - -message Shape { - repeated uint64 dim = 1; -} - -message OpOutput { - OutputDataType data_type = 1; - OutputFormat format = 2; - Shape shape = 3; - OriginalOp original_op = 4; // the original op corresponding to the output - bytes data = 5; - uint64 size = 6; -} - -message OpInput { - OutputDataType data_type = 1; - OutputFormat format = 2; - Shape shape = 3; - bytes data = 4; - uint64 size = 5; -} - -enum BufferType { - L1 = 0; -} - -message OpBuffer { - BufferType buffer_type = 1; - bytes data = 2; - uint64 size = 3; -} - -message DumpData{ - string version = 1; - uint64 dump_time = 2; - repeated OpOutput output = 3; - repeated OpInput input = 4; - repeated OpBuffer buffer = 5; - string op_name = 6; -} diff --git a/ge/executor/proto/ge_ir.proto b/ge/executor/proto/ge_ir.proto deleted file mode 100644 index c0ef3071..00000000 --- a/ge/executor/proto/ge_ir.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package ge.proto; - -enum DataType -{ - DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. - DT_FLOAT = 1; // float type - DT_FLOAT16 = 2; // fp16 type - DT_INT8 = 3; // int8 type - DT_UINT8 = 4; // uint8 type - DT_INT16 = 5; // int16 type - DT_UINT16 = 6; // uint16 type - DT_INT32 = 7; // - DT_INT64 = 8; // int64 type - DT_UINT32 = 9; // unsigned int32 - DT_UINT64 = 10; // unsigned int64 - DT_BOOL = 11; // bool type - DT_DOUBLE = 12; // double type - DT_STRING = 13; // string type - DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ - DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ - DT_COMPLEX64 = 16; // complex64 type - DT_COMPLEX128 = 17; // complex128 type - DT_QINT8 = 18; // qint8 type - DT_QINT16 = 19; // qint16 type - DT_QINT32 = 20; // qint32 type - DT_QUINT8 = 21; // quint8 type - DT_QUINT16 = 22; // quint16 type - DT_RESOURCE = 23; // resource type - 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 -{ - message ListValue - { - enum ListValueType{ - VT_LIST_NONE = 0; - VT_LIST_STRING = 1; - VT_LIST_INT = 2; - VT_LIST_FLOAT = 3; - VT_LIST_BOOL = 4; - VT_LIST_BYTES = 5; - VT_LIST_TENSOR_DESC = 6; - VT_LIST_TENSOR = 7; - VT_LIST_GRAPH = 8; - VT_LIST_NAMED_ATTRS = 9; - VT_LIST_DATA_TYPE = 10; - } - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3; // "list(int)" - repeated float f = 4; // "list(float)" - repeated bool b = 5; // "list(bool)" - repeated bytes bt = 7; - repeated TensorDescriptor td = 8; - repeated TensorDef t = 9; - repeated GraphDef g = 10; - repeated NamedAttrs na = 11; - repeated int64 dt = 12; // list ge::DataType - - ListValueType val_type = 20; - } - - message ListListInt{ - message ListInt{ - repeated int64 list_i = 1; // list int - } - repeated ListInt list_list_i = 1; // list list int - } - - oneof value - { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; // Used to support attr nesting - TensorDescriptor td = 11; // GeTensorDesc type - TensorDef t = 12; // GeTensor type - GraphDef g = 13; // Graph type - ListListInt list_list_int = 14; // List List Int type - int64 dt = 15; // ge::DataType - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs -{ - string name = 1; - map attr = 2; -} - -// Shape / dimension description, using row-major order -message ShapeDef -{ - repeated int64 dim = 1; // Size of each dimension -} - -// Multidimensional data description -message TensorDescriptor -{ - string name = 1; // Optional parameter, tensor name - - DataType dtype = 2; // tensor datatype - ShapeDef shape = 3; // Shape / dimension - string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" - - bool has_out_attr = 9; - int64 size = 10; - int64 weight_size = 11; - bool reuse_input = 12; - bool output_tensor = 13; - string device_type = 14; - bool input_tensor =15; - int64 real_dim_cnt = 16; - int64 reuse_input_index = 17; - int64 data_offset = 18; - int64 cmps_size = 19; - string cmps_tab = 20; - int64 cmps_tab_offset = 21; - - map attr = 5; // Set of extra parameter fields -} - -// GeTensor definition -message TensorDef -{ - TensorDescriptor desc = 1; // Tensor description - bytes data = 2; // Tensor data -} - - -// Operator description -message OpDef -{ - string name = 1; // name - string type = 2; // type - - repeated string input = 5; // input original op name + outgoing index. op_name:index - - map attr = 10; // Set of operator parameter fields - - bool has_out_attr = 20; - int64 id = 21; - int64 stream_id =22; - repeated string input_name = 23; - repeated string src_name = 24; - repeated int64 src_index = 25; - repeated string dst_name = 26; - repeated int64 dst_index = 27; - repeated int64 input_i = 28; - repeated int64 output_i = 29; - repeated int64 workspace = 30; - repeated int64 workspace_bytes = 31; - repeated bool is_input_const = 32; - repeated TensorDescriptor input_desc = 33; - repeated TensorDescriptor output_desc = 34; - repeated string subgraph_name = 35; -} - -// Graph definition -message GraphDef -{ - string name = 1; // name - - repeated string input = 4; // Graph input - repeated string output = 5; // Graph output - - repeated OpDef op = 6; // List of operators - - map attr = 11; // Extended field -} - -// model definition -message ModelDef -{ - string name = 1; // name - uint32 version = 2; // IR Proto verion - string custom_version = 3; // User model version number, passed in by user - - repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef - - map attr = 11; // Extended field -} - diff --git a/ge/executor/proto/insert_op.proto b/ge/executor/proto/insert_op.proto deleted file mode 100644 index 7d708865..00000000 --- a/ge/executor/proto/insert_op.proto +++ /dev/null @@ -1,140 +0,0 @@ -syntax = "proto3"; - -package domi; - -message InsertNewOps { - repeated AippOpParams aipp_op = 1; - repeated MultiShapeOpParams multi_shape_op = 2; -} - -message AippOpParams { - enum InputFormat { - UNDEFINED = 0; - YUV420SP_U8 = 1; - XRGB8888_U8 = 2; - RGB888_U8 = 3; - YUV400_U8 = 4; - NC1HWC0DI_FP16 = 5; - NC1HWC0DI_S8 = 6; - ARGB8888_U8 = 7; - YUYV_U8 = 8; - YUV422SP_U8 = 9; - AYUV444_U8 = 10; - RAW10 = 11; - RAW12 = 12; - RAW16 = 13; - RAW24 = 14; - RGB16 = 15; - RGB20 = 16; - RGB24 = 17; - RGB8_IR = 18; - RGB16_IR = 19; - RGB24_IR = 20; - } - - enum AippMode { - undefined = 0; - static = 1; - dynamic = 2; - } - - // AIPPģʽ־̬AIPPͶ̬AIPP - AippMode aipp_mode = 1; - - // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 - // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 - uint32 related_input_rank = 2; - - // related_input_name is optional and the top name of data node which inserts aipp - string related_input_name = 6; - - // input_edge_idxΪѡΪͣ÷ΧΪ>=0 - // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP - // ֵ <= Dataߵĸ - repeated uint32 input_edge_idx = 3; - - // [Begin] ̬AIPPþ̬AIPPʱЧ - uint32 max_src_image_size = 4; - - // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ - bool support_rotation = 5; - - // [End] ̬AIPP - - - // [Begin] ̬AIPPö̬AIPPʱЧ - InputFormat input_format = 51; - bool csc_switch = 52; - float cpadding_value = 53; - bool rbuv_swap_switch = 54; - bool ax_swap_switch = 55; - bool single_line_mode = 56; - - int32 src_image_size_w = 57; - int32 src_image_size_h = 58; - - bool crop = 59; - int32 load_start_pos_w = 60; - int32 load_start_pos_h = 61; - int32 crop_size_w = 62; - int32 crop_size_h = 63; - - bool resize = 64; - int32 resize_output_w = 65; - int32 resize_output_h = 66; - - bool padding = 67; - int32 left_padding_size = 68; - int32 right_padding_size = 69; - int32 top_padding_size = 70; - int32 bottom_padding_size = 71; - float padding_value = 72; - - int32 mean_chn_0 = 10; - int32 mean_chn_1 = 11; - int32 mean_chn_2 = 12; - int32 mean_chn_3 = 19; - float min_chn_0 = 13; - float min_chn_1 = 14; - float min_chn_2 = 15; - float min_chn_3 = 20; - repeated float var_reci_chn_0 = 16; - repeated float var_reci_chn_1 = 17; - repeated float var_reci_chn_2 = 18; - repeated float var_reci_chn_3 = 21; - - repeated int32 matrix_r0c0 = 30; - repeated int32 matrix_r0c1 = 31; - repeated int32 matrix_r0c2 = 32; - repeated int32 matrix_r1c0 = 33; - repeated int32 matrix_r1c1 = 34; - repeated int32 matrix_r1c2 = 35; - repeated int32 matrix_r2c0 = 36; - repeated int32 matrix_r2c1 = 37; - repeated int32 matrix_r2c2 = 38; - repeated int32 output_bias_0 = 39; - repeated int32 output_bias_1 = 40; - repeated int32 output_bias_2 = 41; - repeated int32 input_bias_0 = 42; - repeated int32 input_bias_1 = 43; - repeated int32 input_bias_2 = 44; - - // [End] ̬AIPP - - // The n number that is used for raw/rgbir data into f16 transformation. - // The transformation equation is x/(2^n). If set to 0, no transform is performed. - uint32 raw_rgbir_to_f16_n = 45; -} - -message MultiShapeOpParams { - enum MultiShapeMode { - batch = 0; //̬batch - resolution = 1; //ֱ̬ʣչ - } - - MultiShapeMode mode = 1; //ģʽ - uint32 related_input_rank = 2; //Ӳ뵽ĸ - - - repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ -} diff --git a/ge/executor/proto/om.proto b/ge/executor/proto/om.proto deleted file mode 100644 index e15e5f80..00000000 --- a/ge/executor/proto/om.proto +++ /dev/null @@ -1,396 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -enum TargetType -{ - MINI = 0; - TINY = 1; - LITE = 2; -} - -// offline model -message ModelDef { - string name = 1; - uint32 version = 2; - - uint64 memory_size = 10; - uint32 stream_num = 11; - uint32 event_num = 12; - uint64 weight_size = 13; - uint32 label_num = 15; - repeated OpDef op = 20; - TargetType target_type = 23; - - map attr = 30; -}; - -// operator define -message OpDef { - string name = 1; - string type = 2; - - uint32 id = 3; - uint32 stream_id = 4; - - repeated string input_name = 5; - - repeated string src_name = 8; - repeated int32 src_index = 9; - repeated int64 input = 10; - repeated int64 output = 11; - repeated TensorDescriptor input_desc = 12; - repeated TensorDescriptor output_desc = 13; - repeated WeightDef weights = 14; - repeated string dst_name = 15; - repeated int32 dst_index = 16; - - repeated int64 workspace = 20; - repeated uint32 workspace_bytes = 21; - - repeated string weight_name = 22; - repeated bool is_input_const = 23; - - map attr = 30; - - QuantizeFactorParams quantize_factor = 31; - - oneof op_params { - // start at 100 here - SendOpParams sender_param = 100; - RecvOpParams receiver_param = 200; - ConvolutionOpParams convolution_param = 300; - PoolingOpParams pooling_param = 400; - EltwiseOpParams eltwise_param = 500; - BatchNormOpParams batchnorm_param = 600; - ScaleOpParams scale_param = 700; - FullConnectionOpParams full_connection_param = 800; - SoftmaxOpParams softmax_param = 900; - ActivationOpParams activation_param = 1000; - ReshapeOpParams reshape_param = 1100; - } -}; - -message SendOpParams { - uint32 event_id = 1; -}; - -message RecvOpParams { - uint32 event_id = 1; -}; - -enum QuantizeScaleType -{ - VECTOR_SCALE = 0; - SCALAR_SCALE = 1; -} - -enum QuantizeScaleMode -{ - NORMAL_MODE = 0; - SQRT_MODE = 1; -} - -enum QuantizeAlgorithm -{ - NON_OFFSET_ALGO = 0; - HALF_OFFSET_ALGO = 1; - ALL_OFFSET_ALGO = 2; -} -message QuantizeFactor -{ - QuantizeScaleMode scale_mode = 1; - bytes scale_value = 2; - int64 scale_offset = 3; - bytes offset_data_value = 4; - int64 offset_data_offset = 5; - bytes offset_weight_value = 6; - int64 offset_weight_offset = 7; - bytes offset_pad_value = 8; - int64 offset_pad_offset = 9; -}; - -message QuantizeCalcFactor -{ - bytes offsetw = 1; - int64 offsetw_offset = 2; - bytes offsetd = 3; - int64 offsetd_offset = 4; - bytes scalereq = 5; - int64 scaledreq_offset = 6; - bytes offsetdnext = 7; - int64 offsetdnext_offset = 8; -} - -message QuantizeFactorParams -{ - QuantizeAlgorithm quantize_algo = 1; - QuantizeScaleType scale_type = 2; - QuantizeFactor quantize_param = 3; - QuantizeFactor dequantize_param = 4; - QuantizeFactor requantize_param = 5; - QuantizeCalcFactor quantizecalc_param = 6; -}; - -message ConvolutionOpParams { - int32 mode = 1; - int32 algo = 2; - int32 pad_mode = 3; - uint32 group = 4; - uint32 num_output = 5; - - repeated uint32 pad = 10; - repeated uint32 stride = 11; - repeated uint32 dilation = 12; - repeated uint32 kernel = 13; - - float alpha = 20; - float beta = 21; - - WeightDef filter = 40; - WeightDef bias = 41; - - bool relu_flag = 62; - repeated uint32 adj = 70; - repeated uint32 target_shape = 71; - repeated uint32 before_pad = 72; -}; - -message PoolingOpParams { - int32 mode = 1; - int32 nan_opt = 2; - int32 pad_mode = 3; - bool global_pooling = 4; - - repeated uint32 window = 10; - repeated uint32 pad = 11; - repeated uint32 stride = 12; - bool ceil_mode = 13; - int32 data_mode = 14; - - float alpha = 20; - float beta = 21; - repeated uint32 before_pad = 22; -}; - -message EltwiseOpParams { - int32 mode = 1; - repeated float coeff = 2; - float alpha = 3; - float beta = 4; - repeated WeightDef weight = 5; - bool relu_flag = 6; -}; - -message ActivationOpParams { - int32 mode = 1; - float coef = 2; - float alpha = 3; - float beta = 4; -}; - -message BatchNormOpParams { - int32 mode = 1; - - float alpha = 2; - float beta = 3; - double epsilon = 4;//optinal,[default = 1e-5] - bool use_global_stats = 5; //optinal,by default true,testing mode - float moving_average_fraction = 6; //optinal,[default = .999]; - - WeightDef estimated_mean = 7; - WeightDef estimated_variance = 8; - - WeightDef scale = 9; - WeightDef bias = 10; -}; - -message ScaleOpParams { - WeightDef scale = 1; - WeightDef bias = 2; -}; - -message ReshapeOpParams { - float alpha = 1; - float beta = 2; - ShapeDef shape = 3; - int32 axis = 4; - int32 num_axes = 5; - int32 format = 6; -}; - -message SoftmaxOpParams { - int32 algo = 1; - int32 mode = 2; - float alpha = 3; - float beta = 4; -}; - -message FullConnectionOpParams { - WeightDef filter = 1; - WeightDef bias = 2; - uint32 num_output = 3; - bool relu_flag = 12; -}; - -message FlattenOpParams { - float alpha = 1; - float beta = 2; - int32 start_axis = 3; - int32 end_axis = 4; -} - -message AddLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message MulLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message AddOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message MulOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message SubOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message BiasAddOpParams { - float alpha = 1; - float beta = 2; - - WeightDef bias = 10; -}; - -message MatMulOpParams { - float alpha = 1; - float beta = 2; - bool transposeX = 3; - bool transposeW = 4; - - WeightDef filter = 10; - WeightDef bias = 12; -}; - -message RsqrtOpParams { - float alpha = 1; - float beta = 2; -}; - - -message WeightDef { - int32 format = 1; - int32 data_type = 2; - ShapeDef shape = 3; - bytes data = 4; - int64 data_offset = 5; - uint32 cmps_size = 6; - bytes cmps_tab = 7; - int64 cmps_tab_offset = 10; - CompressInfo cmps_info = 8; - AllOffsetQuantizeInfo alloffset_quantize_info = 11; -} - -message ShapeDef { - repeated int64 dim = 1; -} - -enum DeviceType { - NPU = 0; // In default, we will use NPU. - CPU = 1; // CPU -} - -message AllOffsetQuantizeInfo { - float scale = 1; - int32 offset = 2; -} - -message TensorDescriptor { - int32 format = 1; - int32 data_type = 2; - repeated int64 dim = 3; - uint32 size = 4; - bool reuse_input = 5; - bool output_tensor = 7; - DeviceType device_type = 8; - bool input_tensor = 9; - uint32 real_dim_cnt = 10; - uint32 reuse_input_index = 11; - AllOffsetQuantizeInfo alloffset_quantize_info = 12; -} - -message CompressInfo { - int32 blockRow = 1; // block row - int32 blockCol = 2; // block col - int32 fractalK = 3; // fractal K - int32 fractalN = 4; // fractal N - int32 lastFractalK = 5; // K of last fractal - int32 lastFractalN = 6; // N of last fractal - int32 cubeSize = 7; // cube's length - int32 loadDir = 8; // data load directtiono 0:col load 1:row load -} - -message AttrDef { - message ListValue { - repeated string s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated uint32 u = 6 [packed = true]; // "list(uint)" - repeated bytes bt = 7; - } - - oneof value { - string s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - uint32 u = 6; // "uint32" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs { - string name = 1; - map attr = 2; -} - diff --git a/ge/executor/proto/op_mapping.proto b/ge/executor/proto/op_mapping.proto deleted file mode 100644 index d626eb49..00000000 --- a/ge/executor/proto/op_mapping.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; -package toolkit.aicpu.dump; - -message Shape { - repeated uint64 dim = 1; -} - -message Output { - int32 data_type = 1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - string original_name = 5; - int32 original_output_index = 6; - int32 original_output_data_type = 7; - int32 original_output_format = 8; - uint64 size = 9; - Shape origin_shape = 10; -} - -message Input { - int32 data_type =1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - uint64 size = 5; - Shape origin_shape = 6; -} - -enum BufferType { - L1 = 0; -} - -message OpBuffer { - BufferType buffer_type = 1; - uint64 address = 2; - uint64 size = 3; -} - -message Op { - string op_name = 1; - string op_type = 2; -} - -message Task { - uint32 task_id = 1; - uint32 stream_id = 2; - Op op = 3; - repeated Output output = 4; - bool end_graph = 5; - repeated Input input = 6; - repeated OpBuffer buffer = 7; -} - -message OpMappingInfo { - string dump_path = 1; - oneof model_name_param { - string model_name = 2; - } - oneof model_id_param { - uint32 model_id = 3; - } - oneof step_id { - uint64 step_id_addr = 4; - } - oneof iterations_per_loop { - uint64 iterations_per_loop_addr = 5; - } - oneof loop_cond { - uint64 loop_cond_addr = 6; - } - uint32 flag = 7; // 0x01 load, 0x00 unload - repeated Task task = 8; - string dump_step = 9; -} \ No newline at end of file diff --git a/ge/executor/proto/task.proto b/ge/executor/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/executor/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/ge_local_engine/proto/task.proto b/ge/ge_local_engine/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/ge_local_engine/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/offline/proto/ge_ir.proto b/ge/offline/proto/ge_ir.proto deleted file mode 100644 index c0ef3071..00000000 --- a/ge/offline/proto/ge_ir.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package ge.proto; - -enum DataType -{ - DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. - DT_FLOAT = 1; // float type - DT_FLOAT16 = 2; // fp16 type - DT_INT8 = 3; // int8 type - DT_UINT8 = 4; // uint8 type - DT_INT16 = 5; // int16 type - DT_UINT16 = 6; // uint16 type - DT_INT32 = 7; // - DT_INT64 = 8; // int64 type - DT_UINT32 = 9; // unsigned int32 - DT_UINT64 = 10; // unsigned int64 - DT_BOOL = 11; // bool type - DT_DOUBLE = 12; // double type - DT_STRING = 13; // string type - DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ - DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ - DT_COMPLEX64 = 16; // complex64 type - DT_COMPLEX128 = 17; // complex128 type - DT_QINT8 = 18; // qint8 type - DT_QINT16 = 19; // qint16 type - DT_QINT32 = 20; // qint32 type - DT_QUINT8 = 21; // quint8 type - DT_QUINT16 = 22; // quint16 type - DT_RESOURCE = 23; // resource type - 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 -{ - message ListValue - { - enum ListValueType{ - VT_LIST_NONE = 0; - VT_LIST_STRING = 1; - VT_LIST_INT = 2; - VT_LIST_FLOAT = 3; - VT_LIST_BOOL = 4; - VT_LIST_BYTES = 5; - VT_LIST_TENSOR_DESC = 6; - VT_LIST_TENSOR = 7; - VT_LIST_GRAPH = 8; - VT_LIST_NAMED_ATTRS = 9; - VT_LIST_DATA_TYPE = 10; - } - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3; // "list(int)" - repeated float f = 4; // "list(float)" - repeated bool b = 5; // "list(bool)" - repeated bytes bt = 7; - repeated TensorDescriptor td = 8; - repeated TensorDef t = 9; - repeated GraphDef g = 10; - repeated NamedAttrs na = 11; - repeated int64 dt = 12; // list ge::DataType - - ListValueType val_type = 20; - } - - message ListListInt{ - message ListInt{ - repeated int64 list_i = 1; // list int - } - repeated ListInt list_list_i = 1; // list list int - } - - oneof value - { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; // Used to support attr nesting - TensorDescriptor td = 11; // GeTensorDesc type - TensorDef t = 12; // GeTensor type - GraphDef g = 13; // Graph type - ListListInt list_list_int = 14; // List List Int type - int64 dt = 15; // ge::DataType - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs -{ - string name = 1; - map attr = 2; -} - -// Shape / dimension description, using row-major order -message ShapeDef -{ - repeated int64 dim = 1; // Size of each dimension -} - -// Multidimensional data description -message TensorDescriptor -{ - string name = 1; // Optional parameter, tensor name - - DataType dtype = 2; // tensor datatype - ShapeDef shape = 3; // Shape / dimension - string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" - - bool has_out_attr = 9; - int64 size = 10; - int64 weight_size = 11; - bool reuse_input = 12; - bool output_tensor = 13; - string device_type = 14; - bool input_tensor =15; - int64 real_dim_cnt = 16; - int64 reuse_input_index = 17; - int64 data_offset = 18; - int64 cmps_size = 19; - string cmps_tab = 20; - int64 cmps_tab_offset = 21; - - map attr = 5; // Set of extra parameter fields -} - -// GeTensor definition -message TensorDef -{ - TensorDescriptor desc = 1; // Tensor description - bytes data = 2; // Tensor data -} - - -// Operator description -message OpDef -{ - string name = 1; // name - string type = 2; // type - - repeated string input = 5; // input original op name + outgoing index. op_name:index - - map attr = 10; // Set of operator parameter fields - - bool has_out_attr = 20; - int64 id = 21; - int64 stream_id =22; - repeated string input_name = 23; - repeated string src_name = 24; - repeated int64 src_index = 25; - repeated string dst_name = 26; - repeated int64 dst_index = 27; - repeated int64 input_i = 28; - repeated int64 output_i = 29; - repeated int64 workspace = 30; - repeated int64 workspace_bytes = 31; - repeated bool is_input_const = 32; - repeated TensorDescriptor input_desc = 33; - repeated TensorDescriptor output_desc = 34; - repeated string subgraph_name = 35; -} - -// Graph definition -message GraphDef -{ - string name = 1; // name - - repeated string input = 4; // Graph input - repeated string output = 5; // Graph output - - repeated OpDef op = 6; // List of operators - - map attr = 11; // Extended field -} - -// model definition -message ModelDef -{ - string name = 1; // name - uint32 version = 2; // IR Proto verion - string custom_version = 3; // User model version number, passed in by user - - repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef - - map attr = 11; // Extended field -} - diff --git a/ge/offline/proto/insert_op.proto b/ge/offline/proto/insert_op.proto deleted file mode 100644 index 7d708865..00000000 --- a/ge/offline/proto/insert_op.proto +++ /dev/null @@ -1,140 +0,0 @@ -syntax = "proto3"; - -package domi; - -message InsertNewOps { - repeated AippOpParams aipp_op = 1; - repeated MultiShapeOpParams multi_shape_op = 2; -} - -message AippOpParams { - enum InputFormat { - UNDEFINED = 0; - YUV420SP_U8 = 1; - XRGB8888_U8 = 2; - RGB888_U8 = 3; - YUV400_U8 = 4; - NC1HWC0DI_FP16 = 5; - NC1HWC0DI_S8 = 6; - ARGB8888_U8 = 7; - YUYV_U8 = 8; - YUV422SP_U8 = 9; - AYUV444_U8 = 10; - RAW10 = 11; - RAW12 = 12; - RAW16 = 13; - RAW24 = 14; - RGB16 = 15; - RGB20 = 16; - RGB24 = 17; - RGB8_IR = 18; - RGB16_IR = 19; - RGB24_IR = 20; - } - - enum AippMode { - undefined = 0; - static = 1; - dynamic = 2; - } - - // AIPPģʽ־̬AIPPͶ̬AIPP - AippMode aipp_mode = 1; - - // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 - // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 - uint32 related_input_rank = 2; - - // related_input_name is optional and the top name of data node which inserts aipp - string related_input_name = 6; - - // input_edge_idxΪѡΪͣ÷ΧΪ>=0 - // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP - // ֵ <= Dataߵĸ - repeated uint32 input_edge_idx = 3; - - // [Begin] ̬AIPPþ̬AIPPʱЧ - uint32 max_src_image_size = 4; - - // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ - bool support_rotation = 5; - - // [End] ̬AIPP - - - // [Begin] ̬AIPPö̬AIPPʱЧ - InputFormat input_format = 51; - bool csc_switch = 52; - float cpadding_value = 53; - bool rbuv_swap_switch = 54; - bool ax_swap_switch = 55; - bool single_line_mode = 56; - - int32 src_image_size_w = 57; - int32 src_image_size_h = 58; - - bool crop = 59; - int32 load_start_pos_w = 60; - int32 load_start_pos_h = 61; - int32 crop_size_w = 62; - int32 crop_size_h = 63; - - bool resize = 64; - int32 resize_output_w = 65; - int32 resize_output_h = 66; - - bool padding = 67; - int32 left_padding_size = 68; - int32 right_padding_size = 69; - int32 top_padding_size = 70; - int32 bottom_padding_size = 71; - float padding_value = 72; - - int32 mean_chn_0 = 10; - int32 mean_chn_1 = 11; - int32 mean_chn_2 = 12; - int32 mean_chn_3 = 19; - float min_chn_0 = 13; - float min_chn_1 = 14; - float min_chn_2 = 15; - float min_chn_3 = 20; - repeated float var_reci_chn_0 = 16; - repeated float var_reci_chn_1 = 17; - repeated float var_reci_chn_2 = 18; - repeated float var_reci_chn_3 = 21; - - repeated int32 matrix_r0c0 = 30; - repeated int32 matrix_r0c1 = 31; - repeated int32 matrix_r0c2 = 32; - repeated int32 matrix_r1c0 = 33; - repeated int32 matrix_r1c1 = 34; - repeated int32 matrix_r1c2 = 35; - repeated int32 matrix_r2c0 = 36; - repeated int32 matrix_r2c1 = 37; - repeated int32 matrix_r2c2 = 38; - repeated int32 output_bias_0 = 39; - repeated int32 output_bias_1 = 40; - repeated int32 output_bias_2 = 41; - repeated int32 input_bias_0 = 42; - repeated int32 input_bias_1 = 43; - repeated int32 input_bias_2 = 44; - - // [End] ̬AIPP - - // The n number that is used for raw/rgbir data into f16 transformation. - // The transformation equation is x/(2^n). If set to 0, no transform is performed. - uint32 raw_rgbir_to_f16_n = 45; -} - -message MultiShapeOpParams { - enum MultiShapeMode { - batch = 0; //̬batch - resolution = 1; //ֱ̬ʣչ - } - - MultiShapeMode mode = 1; //ģʽ - uint32 related_input_rank = 2; //Ӳ뵽ĸ - - - repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ -} diff --git a/ge/offline/proto/om.proto b/ge/offline/proto/om.proto deleted file mode 100644 index e15e5f80..00000000 --- a/ge/offline/proto/om.proto +++ /dev/null @@ -1,396 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -enum TargetType -{ - MINI = 0; - TINY = 1; - LITE = 2; -} - -// offline model -message ModelDef { - string name = 1; - uint32 version = 2; - - uint64 memory_size = 10; - uint32 stream_num = 11; - uint32 event_num = 12; - uint64 weight_size = 13; - uint32 label_num = 15; - repeated OpDef op = 20; - TargetType target_type = 23; - - map attr = 30; -}; - -// operator define -message OpDef { - string name = 1; - string type = 2; - - uint32 id = 3; - uint32 stream_id = 4; - - repeated string input_name = 5; - - repeated string src_name = 8; - repeated int32 src_index = 9; - repeated int64 input = 10; - repeated int64 output = 11; - repeated TensorDescriptor input_desc = 12; - repeated TensorDescriptor output_desc = 13; - repeated WeightDef weights = 14; - repeated string dst_name = 15; - repeated int32 dst_index = 16; - - repeated int64 workspace = 20; - repeated uint32 workspace_bytes = 21; - - repeated string weight_name = 22; - repeated bool is_input_const = 23; - - map attr = 30; - - QuantizeFactorParams quantize_factor = 31; - - oneof op_params { - // start at 100 here - SendOpParams sender_param = 100; - RecvOpParams receiver_param = 200; - ConvolutionOpParams convolution_param = 300; - PoolingOpParams pooling_param = 400; - EltwiseOpParams eltwise_param = 500; - BatchNormOpParams batchnorm_param = 600; - ScaleOpParams scale_param = 700; - FullConnectionOpParams full_connection_param = 800; - SoftmaxOpParams softmax_param = 900; - ActivationOpParams activation_param = 1000; - ReshapeOpParams reshape_param = 1100; - } -}; - -message SendOpParams { - uint32 event_id = 1; -}; - -message RecvOpParams { - uint32 event_id = 1; -}; - -enum QuantizeScaleType -{ - VECTOR_SCALE = 0; - SCALAR_SCALE = 1; -} - -enum QuantizeScaleMode -{ - NORMAL_MODE = 0; - SQRT_MODE = 1; -} - -enum QuantizeAlgorithm -{ - NON_OFFSET_ALGO = 0; - HALF_OFFSET_ALGO = 1; - ALL_OFFSET_ALGO = 2; -} -message QuantizeFactor -{ - QuantizeScaleMode scale_mode = 1; - bytes scale_value = 2; - int64 scale_offset = 3; - bytes offset_data_value = 4; - int64 offset_data_offset = 5; - bytes offset_weight_value = 6; - int64 offset_weight_offset = 7; - bytes offset_pad_value = 8; - int64 offset_pad_offset = 9; -}; - -message QuantizeCalcFactor -{ - bytes offsetw = 1; - int64 offsetw_offset = 2; - bytes offsetd = 3; - int64 offsetd_offset = 4; - bytes scalereq = 5; - int64 scaledreq_offset = 6; - bytes offsetdnext = 7; - int64 offsetdnext_offset = 8; -} - -message QuantizeFactorParams -{ - QuantizeAlgorithm quantize_algo = 1; - QuantizeScaleType scale_type = 2; - QuantizeFactor quantize_param = 3; - QuantizeFactor dequantize_param = 4; - QuantizeFactor requantize_param = 5; - QuantizeCalcFactor quantizecalc_param = 6; -}; - -message ConvolutionOpParams { - int32 mode = 1; - int32 algo = 2; - int32 pad_mode = 3; - uint32 group = 4; - uint32 num_output = 5; - - repeated uint32 pad = 10; - repeated uint32 stride = 11; - repeated uint32 dilation = 12; - repeated uint32 kernel = 13; - - float alpha = 20; - float beta = 21; - - WeightDef filter = 40; - WeightDef bias = 41; - - bool relu_flag = 62; - repeated uint32 adj = 70; - repeated uint32 target_shape = 71; - repeated uint32 before_pad = 72; -}; - -message PoolingOpParams { - int32 mode = 1; - int32 nan_opt = 2; - int32 pad_mode = 3; - bool global_pooling = 4; - - repeated uint32 window = 10; - repeated uint32 pad = 11; - repeated uint32 stride = 12; - bool ceil_mode = 13; - int32 data_mode = 14; - - float alpha = 20; - float beta = 21; - repeated uint32 before_pad = 22; -}; - -message EltwiseOpParams { - int32 mode = 1; - repeated float coeff = 2; - float alpha = 3; - float beta = 4; - repeated WeightDef weight = 5; - bool relu_flag = 6; -}; - -message ActivationOpParams { - int32 mode = 1; - float coef = 2; - float alpha = 3; - float beta = 4; -}; - -message BatchNormOpParams { - int32 mode = 1; - - float alpha = 2; - float beta = 3; - double epsilon = 4;//optinal,[default = 1e-5] - bool use_global_stats = 5; //optinal,by default true,testing mode - float moving_average_fraction = 6; //optinal,[default = .999]; - - WeightDef estimated_mean = 7; - WeightDef estimated_variance = 8; - - WeightDef scale = 9; - WeightDef bias = 10; -}; - -message ScaleOpParams { - WeightDef scale = 1; - WeightDef bias = 2; -}; - -message ReshapeOpParams { - float alpha = 1; - float beta = 2; - ShapeDef shape = 3; - int32 axis = 4; - int32 num_axes = 5; - int32 format = 6; -}; - -message SoftmaxOpParams { - int32 algo = 1; - int32 mode = 2; - float alpha = 3; - float beta = 4; -}; - -message FullConnectionOpParams { - WeightDef filter = 1; - WeightDef bias = 2; - uint32 num_output = 3; - bool relu_flag = 12; -}; - -message FlattenOpParams { - float alpha = 1; - float beta = 2; - int32 start_axis = 3; - int32 end_axis = 4; -} - -message AddLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message MulLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message AddOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message MulOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message SubOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message BiasAddOpParams { - float alpha = 1; - float beta = 2; - - WeightDef bias = 10; -}; - -message MatMulOpParams { - float alpha = 1; - float beta = 2; - bool transposeX = 3; - bool transposeW = 4; - - WeightDef filter = 10; - WeightDef bias = 12; -}; - -message RsqrtOpParams { - float alpha = 1; - float beta = 2; -}; - - -message WeightDef { - int32 format = 1; - int32 data_type = 2; - ShapeDef shape = 3; - bytes data = 4; - int64 data_offset = 5; - uint32 cmps_size = 6; - bytes cmps_tab = 7; - int64 cmps_tab_offset = 10; - CompressInfo cmps_info = 8; - AllOffsetQuantizeInfo alloffset_quantize_info = 11; -} - -message ShapeDef { - repeated int64 dim = 1; -} - -enum DeviceType { - NPU = 0; // In default, we will use NPU. - CPU = 1; // CPU -} - -message AllOffsetQuantizeInfo { - float scale = 1; - int32 offset = 2; -} - -message TensorDescriptor { - int32 format = 1; - int32 data_type = 2; - repeated int64 dim = 3; - uint32 size = 4; - bool reuse_input = 5; - bool output_tensor = 7; - DeviceType device_type = 8; - bool input_tensor = 9; - uint32 real_dim_cnt = 10; - uint32 reuse_input_index = 11; - AllOffsetQuantizeInfo alloffset_quantize_info = 12; -} - -message CompressInfo { - int32 blockRow = 1; // block row - int32 blockCol = 2; // block col - int32 fractalK = 3; // fractal K - int32 fractalN = 4; // fractal N - int32 lastFractalK = 5; // K of last fractal - int32 lastFractalN = 6; // N of last fractal - int32 cubeSize = 7; // cube's length - int32 loadDir = 8; // data load directtiono 0:col load 1:row load -} - -message AttrDef { - message ListValue { - repeated string s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated uint32 u = 6 [packed = true]; // "list(uint)" - repeated bytes bt = 7; - } - - oneof value { - string s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - uint32 u = 6; // "uint32" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs { - string name = 1; - map attr = 2; -} - diff --git a/ge/offline/proto/task.proto b/ge/offline/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/offline/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/proto/caffe/caffe.proto b/ge/proto/caffe/caffe.proto deleted file mode 100644 index 20615fed..00000000 --- a/ge/proto/caffe/caffe.proto +++ /dev/null @@ -1,1829 +0,0 @@ -/** - * This file is part of Open Source Software caffe, version 1.0 https://github.com/BVLC/caffe - * - * This file is included by GraphEngine so as to support model format conversion from caffe model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto2"; - -package domi.caffe; - -// Specifies the shape (dimensions) of a Blob. -message BlobShape { - repeated int64 dim = 1 [packed = true]; -} - -message BlobProto { - optional BlobShape shape = 7; - repeated float data = 5 [packed = true]; - repeated float diff = 6 [packed = true]; - repeated double double_data = 8 [packed = true]; - repeated double double_diff = 9 [packed = true]; - optional bytes int8_data = 10; - repeated int32 int32_data = 11 [packed = true]; - repeated uint64 uint64_data = 12 [packed = true]; - // 4D dimensions -- deprecated. Use "shape" instead. - optional int32 num = 1 [default = 0]; - optional int32 channels = 2 [default = 0]; - optional int32 height = 3 [default = 0]; - optional int32 width = 4 [default = 0]; -} - -// The BlobProtoVector is simply a way to pass multiple blobproto instances -// around. -message BlobProtoVector { - repeated BlobProto blobs = 1; -} - -message Datum { - optional int32 channels = 1; - optional int32 height = 2; - optional int32 width = 3; - // the actual image data, in bytes - optional bytes data = 4; - optional int32 label = 5; - // Optionally, the datum could also hold float data. - repeated float float_data = 6; - // If true data contains an encoded image that need to be decoded - optional bool encoded = 7 [default = false]; -} - -message FillerParameter { - // The filler type. - optional string type = 1 [default = 'constant']; - optional float value = 2 [default = 0]; // the value in constant filler - optional float min = 3 [default = 0]; // the min value in uniform filler - optional float max = 4 [default = 1]; // the max value in uniform filler - optional float mean = 5 [default = 0]; // the mean value in Gaussian filler - optional float std = 6 [default = 1]; // the std value in Gaussian filler - // The expected number of non-zero output weights for a given input in - // Gaussian filler -- the default -1 means don't perform sparsification. - optional int32 sparse = 7 [default = -1]; - // Normalize the filler variance by fan_in, fan_out, or their average. - // Applies to 'xavier' and 'msra' fillers. - enum VarianceNorm { - FAN_IN = 0; - FAN_OUT = 1; - AVERAGE = 2; - } - optional VarianceNorm variance_norm = 8 [default = FAN_IN]; -} - -message NetParameter { - optional string name = 1; // consider giving the network a name - // DEPRECATED. See InputParameter. The input blobs to the network. - repeated string input = 3; - // DEPRECATED. See InputParameter. The shape of the input blobs. - repeated BlobShape input_shape = 8; - - // 4D input dimensions -- deprecated. Use "input_shape" instead. - // If specified, for each input blob there should be four - // values specifying the num, channels, height and width of the input blob. - // Thus, there should be a total of (4 * #input) numbers. - repeated int32 input_dim = 4; - - // Whether the network will force every layer to carry out backward operation. - // If set False, then whether to carry out backward is determined - // automatically according to the net structure and learning rates. - optional bool force_backward = 5 [default = false]; - // The current "state" of the network, including the phase, level, and stage. - // Some layers may be included/excluded depending on this state and the states - // specified in the layers' include and exclude fields. - optional NetState state = 6; - - // Print debugging information about results while running Net::Forward, - // Net::Backward, and Net::Update. - optional bool debug_info = 7 [default = false]; - - // The layers that make up the net. Each of their configurations, including - // connectivity and behavior, is specified as a LayerParameter. - repeated LayerParameter layer = 100; // ID 100 so layers are printed last. - - // DEPRECATED: use 'layer' instead. - repeated V1LayerParameter layers = 2; -} - -// NOTE -// Update the next available ID when you add a new SolverParameter field. -// -// SolverParameter next available ID: 42 (last added: layer_wise_reduce) -message SolverParameter { - ////////////////////////////////////////////////////////////////////////////// - // Specifying the train and test networks - // - // Exactly one train net must be specified using one of the following fields: - // train_net_param, train_net, net_param, net - // One or more test nets may be specified using any of the following fields: - // test_net_param, test_net, net_param, net - // If more than one test net field is specified (e.g., both net and - // test_net are specified), they will be evaluated in the field order given - // above: (1) test_net_param, (2) test_net, (3) net_param/net. - // A test_iter must be specified for each test_net. - // A test_level and/or a test_stage may also be specified for each test_net. - ////////////////////////////////////////////////////////////////////////////// - - // Proto filename for the train net, possibly combined with one or more - // test nets. - optional string net = 24; - // Inline train net param, possibly combined with one or more test nets. - optional NetParameter net_param = 25; - - optional string train_net = 1; // Proto filename for the train net. - repeated string test_net = 2; // Proto filenames for the test nets. - optional NetParameter train_net_param = 21; // Inline train net params. - repeated NetParameter test_net_param = 22; // Inline test net params. - - // The states for the train/test nets. Must be unspecified or - // specified once per net. - // - // By default, all states will have solver = true; - // train_state will have phase = TRAIN, - // and all test_state's will have phase = TEST. - // Other defaults are set according to the NetState defaults. - optional NetState train_state = 26; - repeated NetState test_state = 27; - - // The number of iterations for each test net. - repeated int32 test_iter = 3; - - // The number of iterations between two testing phases. - optional int32 test_interval = 4 [default = 0]; - optional bool test_compute_loss = 19 [default = false]; - // If true, run an initial test pass before the first iteration, - // ensuring memory availability and printing the starting value of the loss. - optional bool test_initialization = 32 [default = true]; - optional float base_lr = 5; // The base learning rate - // the number of iterations between displaying info. If display = 0, no info - // will be displayed. - optional int32 display = 6; - // Display the loss averaged over the last average_loss iterations - optional int32 average_loss = 33 [default = 1]; - optional int32 max_iter = 7; // the maximum number of iterations - // accumulate gradients over `iter_size` x `batch_size` instances - optional int32 iter_size = 36 [default = 1]; - - // The learning rate decay policy. The currently implemented learning rate - // policies are as follows: - // - fixed: always return base_lr. - // - step: return base_lr * gamma ^ (floor(iter / step)) - // - exp: return base_lr * gamma ^ iter - // - inv: return base_lr * (1 + gamma * iter) ^ (- power) - // - multistep: similar to step but it allows non uniform steps defined by - // stepvalue - // - poly: the effective learning rate follows a polynomial decay, to be - // zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power) - // - sigmoid: the effective learning rate follows a sigmod decay - // return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize)))) - // - // where base_lr, max_iter, gamma, step, stepvalue and power are defined - // in the solver parameter protocol buffer, and iter is the current iteration. - optional string lr_policy = 8; - optional float gamma = 9; // The parameter to compute the learning rate. - optional float power = 10; // The parameter to compute the learning rate. - optional float momentum = 11; // The momentum value. - optional float weight_decay = 12; // The weight decay. - // regularization types supported: L1 and L2 - // controlled by weight_decay - optional string regularization_type = 29 [default = "L2"]; - // the stepsize for learning rate policy "step" - optional int32 stepsize = 13; - // the stepsize for learning rate policy "multistep" - repeated int32 stepvalue = 34; - - // Set clip_gradients to >= 0 to clip parameter gradients to that L2 norm, - // whenever their actual L2 norm is larger. - optional float clip_gradients = 35 [default = -1]; - - optional int32 snapshot = 14 [default = 0]; // The snapshot interval - optional string snapshot_prefix = 15; // The prefix for the snapshot. - // whether to snapshot diff in the results or not. Snapshotting diff will help - // debugging but the final protocol buffer size will be much larger. - optional bool snapshot_diff = 16 [default = false]; - enum SnapshotFormat { - HDF5 = 0; - BINARYPROTO = 1; - } - optional SnapshotFormat snapshot_format = 37 [default = BINARYPROTO]; - // the mode solver will use: 0 for CPU and 1 for GPU. Use GPU in default. - enum SolverMode { - CPU = 0; - GPU = 1; - } - optional SolverMode solver_mode = 17 [default = GPU]; - // the device_id will that be used in GPU mode. Use device_id = 0 in default. - optional int32 device_id = 18 [default = 0]; - // If non-negative, the seed with which the Solver will initialize the Caffe - // random number generator -- useful for reproducible results. Otherwise, - // (and by default) initialize using a seed derived from the system clock. - optional int64 random_seed = 20 [default = -1]; - - // type of the solver - optional string type = 40 [default = "SGD"]; - - // numerical stability for RMSProp, AdaGrad and AdaDelta and Adam - optional float delta = 31 [default = 1e-8]; - // parameters for the Adam solver - optional float momentum2 = 39 [default = 0.999]; - - // RMSProp decay value - // MeanSquare(t) = rms_decay*MeanSquare(t-1) + (1-rms_decay)*SquareGradient(t) - optional float rms_decay = 38 [default = 0.99]; - - // If true, print information about the state of the net that may help with - // debugging learning problems. - optional bool debug_info = 23 [default = false]; - - // If false, don't save a snapshot after training finishes. - optional bool snapshot_after_train = 28 [default = true]; - - // DEPRECATED: old solver enum types, use string instead - enum SolverType { - SGD = 0; - NESTEROV = 1; - ADAGRAD = 2; - RMSPROP = 3; - ADADELTA = 4; - ADAM = 5; - } - // DEPRECATED: use type instead of solver_type - optional SolverType solver_type = 30 [default = SGD]; - - // Overlap compute and communication for data parallel training - optional bool layer_wise_reduce = 41 [default = true]; -} - -// A message that stores the solver snapshots -message SolverState { - optional int32 iter = 1; // The current iteration - optional string learned_net = 2; // The file that stores the learned net. - repeated BlobProto history = 3; // The history for sgd solvers - optional int32 current_step = 4 [default = 0]; // The current step for learning rate -} - -enum Phase { - TRAIN = 0; - TEST = 1; -} - -message NetState { - optional Phase phase = 1 [default = TEST]; - optional int32 level = 2 [default = 0]; - repeated string stage = 3; -} - -message NetStateRule { - // Set phase to require the NetState have a particular phase (TRAIN or TEST) - // to meet this rule. - optional Phase phase = 1; - - // Set the minimum and/or maximum levels in which the layer should be used. - // Leave undefined to meet the rule regardless of level. - optional int32 min_level = 2; - optional int32 max_level = 3; - - // Customizable sets of stages to include or exclude. - // The net must have ALL of the specified stages and NONE of the specified - // "not_stage"s to meet the rule. - // (Use multiple NetStateRules to specify conjunctions of stages.) - repeated string stage = 4; - repeated string not_stage = 5; -} - -// Specifies training parameters (multipliers on global learning constants, -// and the name and other settings used for weight sharing). -message ParamSpec { - // The names of the parameter blobs -- useful for sharing parameters among - // layers, but never required otherwise. To share a parameter between two - // layers, give it a (non-empty) name. - optional string name = 1; - - // Whether to require shared weights to have the same shape, or just the same - // count -- defaults to STRICT if unspecified. - optional DimCheckMode share_mode = 2; - enum DimCheckMode { - // STRICT (default) requires that num, channels, height, width each match. - STRICT = 0; - // PERMISSIVE requires only the count (num*channels*height*width) to match. - PERMISSIVE = 1; - } - - // The multiplier on the global learning rate for this parameter. - optional float lr_mult = 3 [default = 1.0]; - - // The multiplier on the global weight decay for this parameter. - optional float decay_mult = 4 [default = 1.0]; -} - -// NOTE -// Update the next available ID when you add a new LayerParameter field. -// -// LayerParameter next available layer-specific ID: 151 (last added: smooth_l1_loss_param) -message LayerParameter { - optional string name = 1; // the layer name - optional string type = 2; // the layer type - repeated string bottom = 3; // the name of each bottom blob - repeated string top = 4; // the name of each top blob - - // The train / test phase for computation. - optional Phase phase = 10; - - // The amount of weight to assign each top blob in the objective. - // Each layer assigns a default value, usually of either 0 or 1, - // to each top blob. - repeated float loss_weight = 5; - - // Specifies training parameters (multipliers on global learning constants, - // and the name and other settings used for weight sharing). - repeated ParamSpec param = 6; - - // The blobs containing the numeric parameters of the layer. - repeated BlobProto blobs = 7; - - // Specifies whether to backpropagate to each bottom. If unspecified, - // Caffe will automatically infer whether each input needs backpropagation - // to compute parameter gradients. If set to true for some inputs, - // backpropagation to those inputs is forced; if set false for some inputs, - // backpropagation to those inputs is skipped. - // - // The size must be either 0 or equal to the number of bottoms. - repeated bool propagate_down = 11; - - // Rules controlling whether and when a layer is included in the network, - // based on the current NetState. You may specify a non-zero number of rules - // to include OR exclude, but not both. If no include or exclude rules are - // specified, the layer is always included. If the current NetState meets - // ANY (i.e., one or more) of the specified rules, the layer is - // included/excluded. - repeated NetStateRule include = 8; - repeated NetStateRule exclude = 9; - - // Parameters for data pre-processing. - optional TransformationParameter transform_param = 100; - - // Parameters shared by loss layers. - optional LossParameter loss_param = 101; - - // Layer type-specific parameters. - // - // Note: certain layers may have more than one computational engine - // for their implementation. These layers include an Engine type and - // engine parameter for selecting the implementation. - // The default for the engine is set by the ENGINE switch at compile-time. - optional AccuracyParameter accuracy_param = 102; - optional ArgMaxParameter argmax_param = 103; - optional BatchNormParameter batch_norm_param = 139; - optional BiasParameter bias_param = 141; - optional ConcatParameter concat_param = 104; - optional ContrastiveLossParameter contrastive_loss_param = 105; - optional ConvolutionParameter convolution_param = 106; - optional CropParameter crop_param = 144; - optional DataParameter data_param = 107; - optional DetectionOutputParameter detection_output_param = 150; - optional DropoutParameter dropout_param = 108; - optional DummyDataParameter dummy_data_param = 109; - optional EltwiseParameter eltwise_param = 110; - optional ELUParameter elu_param = 140; - optional EmbedParameter embed_param = 137; - optional ExpParameter exp_param = 111; - optional FlattenParameter flatten_param = 135; - optional HDF5DataParameter hdf5_data_param = 112; - optional HDF5OutputParameter hdf5_output_param = 113; - optional HingeLossParameter hinge_loss_param = 114; - optional ImageDataParameter image_data_param = 115; - optional InfogainLossParameter infogain_loss_param = 116; - optional InnerProductParameter inner_product_param = 117; - optional InputParameter input_param = 143; - optional LogParameter log_param = 134; - optional LRNParameter lrn_param = 118; - optional MemoryDataParameter memory_data_param = 119; - optional MVNParameter mvn_param = 120; - optional ParameterParameter parameter_param = 145; - optional PoolingParameter pooling_param = 121; - optional PowerParameter power_param = 122; - optional PReLUParameter prelu_param = 131; - optional PythonParameter python_param = 130; - optional RecurrentParameter recurrent_param = 146; - optional ReductionParameter reduction_param = 136; - optional ReLUParameter relu_param = 123; - optional ReshapeParameter reshape_param = 133; - optional ScaleParameter scale_param = 142; - optional SigmoidParameter sigmoid_param = 124; - optional SmoothL1LossParameter smooth_l1_loss_param = 148; - optional SoftmaxParameter softmax_param = 125; - optional SPPParameter spp_param = 132; - optional SliceParameter slice_param = 126; - optional TanHParameter tanh_param = 127; - optional ThresholdParameter threshold_param = 128; - optional TileParameter tile_param = 138; - optional WindowDataParameter window_data_param = 129; - optional PermuteParameter permute_param = 202; - optional PriorBoxParameter prior_box_param = 203; - optional NormalizeParameter norm_param = 206; - optional PSROIPoolingParameter psroi_pooling_param = 207; - optional FreespaceExtractParameter freespace_extract_param = 151; - optional PostprocessParameter postprocess_param = 152; - optional SpatialTransformParameter spatial_transform_param = 153; - optional ROIAlignParameter roi_align_param = 154; - optional ReorgParameter reorg_param = 155; - optional RegionParameter region_param = 156; - optional ReverseParameter reverse_param = 157; - optional InterpParameter interp_param = 158; - optional ShuffleChannelParameter shuffle_channel_param = 159; - optional UpsampleParameter upsample_param = 160; - optional ROIPoolingParameter roi_pooling_param = 161; - optional YoloParameter yolo_param = 199; - optional YoloV3DetectionOutputParameter yolov3_detection_output_param = 200; - optional ProposalParameter proposal_param = 201; - optional FSRDetectionOutputParameter fsrdetectionoutput_param = 222; - optional SSDDetectionOutputParameter ssddetectionoutput_param = 232; - optional YoloV2DetectionOutputParameter yolov2_detection_output_param = 204; - optional QuantParameter quant_param = 208; - optional CondTakeParameter condtake_param = 233; - optional MatrixInverseParameter matrix_inverse_param = 210; - optional WarpPerspectiveParameter warp_perspective_param = 234; - optional BatchMatMulParameter batch_matmul_param = 235; - optional SpatialTransformerParameter st_param = 5000; - optional YoloV3DetectionOutputV2Parameter yolov3_detection_output_v2_param = 5001; -} - -// Message that stores parameters used to apply transformation -// to the data layer's data -message TransformationParameter { - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 1 [default = 1]; - // Specify if we want to randomly mirror data. - optional bool mirror = 2 [default = false]; - // Specify if we would like to randomly crop an image. - optional uint32 crop_size = 3 [default = 0]; - // mean_file and mean_value cannot be specified at the same time - optional string mean_file = 4; - // if specified can be repeated once (would substract it from all the channels) - // or can be repeated the same number of times as channels - // (would subtract them from the corresponding channel) - repeated float mean_value = 5; - // Force the decoded image to have 3 color channels. - optional bool force_color = 6 [default = false]; - // Force the decoded image to have 1 color channels. - optional bool force_gray = 7 [default = false]; -} - -// Message that stores parameters shared by loss layers -message LossParameter { - // If specified, ignore instances with the given label. - optional int32 ignore_label = 1; - // How to normalize the loss for loss layers that aggregate across batches, - // spatial dimensions, or other dimensions. Currently only implemented in - // SoftmaxWithLoss and SigmoidCrossEntropyLoss layers. - enum NormalizationMode { - // Divide by the number of examples in the batch times spatial dimensions. - // Outputs that receive the ignore label will NOT be ignored in computing - // the normalization factor. - FULL = 0; - // Divide by the total number of output locations that do not take the - // ignore_label. If ignore_label is not set, this behaves like FULL. - VALID = 1; - // Divide by the batch size. - BATCH_SIZE = 2; - // Do not normalize the loss. - NONE = 3; - } - // For historical reasons, the default normalization for - // SigmoidCrossEntropyLoss is BATCH_SIZE and *not* VALID. - optional NormalizationMode normalization = 3 [default = VALID]; - // Deprecated. Ignored if normalization is specified. If normalization - // is not specified, then setting this to false will be equivalent to - // normalization = BATCH_SIZE to be consistent with previous behavior. - optional bool normalize = 2; -} - -// Messages that store parameters used by individual layer types follow, in -// alphabetical order. - -message AccuracyParameter { - // When computing accuracy, count as correct by comparing the true label to - // the top k scoring classes. By default, only compare to the top scoring - // class (i.e. argmax). - optional uint32 top_k = 1 [default = 1]; - - // The "label" axis of the prediction blob, whose argmax corresponds to the - // predicted label -- may be negative to index from the end (e.g., -1 for the - // last axis). For example, if axis == 1 and the predictions are - // (N x C x H x W), the label blob is expected to contain N*H*W ground truth - // labels with integer values in {0, 1, ..., C-1}. - optional int32 axis = 2 [default = 1]; - - // If specified, ignore instances with the given label. - optional int32 ignore_label = 3; -} - -message ArgMaxParameter { - // If true produce pairs (argmax, maxval) - optional bool out_max_val = 1 [default = false]; - optional uint32 top_k = 2 [default = 1]; - // The axis along which to maximise -- may be negative to index from the - // end (e.g., -1 for the last axis). - // By default ArgMaxLayer maximizes over the flattened trailing dimensions - // for each index of the first / num dimension. - optional int32 axis = 3; -} - -message ConcatParameter { - // The axis along which to concatenate -- may be negative to index from the - // end (e.g., -1 for the last axis). Other axes must have the - // same dimension for all the bottom blobs. - // By default, ConcatLayer concatenates blobs along the "channels" axis (1). - optional int32 axis = 2 [default = 1]; - - // DEPRECATED: alias for "axis" -- does not support negative indexing. - optional uint32 concat_dim = 1 [default = 1]; -} - -message BatchNormParameter { - // If false, normalization is performed over the current mini-batch - // and global statistics are accumulated (but not yet used) by a moving - // average. - // If true, those accumulated mean and variance values are used for the - // normalization. - // By default, it is set to false when the network is in the training - // phase and true when the network is in the testing phase. - optional bool use_global_stats = 1; - // What fraction of the moving average remains each iteration? - // Smaller values make the moving average decay faster, giving more - // weight to the recent values. - // Each iteration updates the moving average @f$S_{t-1}@f$ with the - // current mean @f$ Y_t @f$ by - // @f$ S_t = (1-\beta)Y_t + \beta \cdot S_{t-1} @f$, where @f$ \beta @f$ - // is the moving_average_fraction parameter. - optional float moving_average_fraction = 2 [default = .999]; - // Small value to add to the variance estimate so that we don't divide by - // zero. - optional float eps = 3 [default = 1e-5]; -} - -message BiasParameter { - // The first axis of bottom[0] (the first input Blob) along which to apply - // bottom[1] (the second input Blob). May be negative to index from the end - // (e.g., -1 for the last axis). - // - // For example, if bottom[0] is 4D with shape 100x3x40x60, the output - // top[0] will have the same shape, and bottom[1] may have any of the - // following shapes (for the given value of axis): - // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60 - // (axis == 1 == -3) 3; 3x40; 3x40x60 - // (axis == 2 == -2) 40; 40x60 - // (axis == 3 == -1) 60 - // Furthermore, bottom[1] may have the empty shape (regardless of the value of - // "axis") -- a scalar bias. - optional int32 axis = 1 [default = 1]; - - // (num_axes is ignored unless just one bottom is given and the bias is - // a learned parameter of the layer. Otherwise, num_axes is determined by the - // number of axes by the second bottom.) - // The number of axes of the input (bottom[0]) covered by the bias - // parameter, or -1 to cover all axes of bottom[0] starting from `axis`. - // Set num_axes := 0, to add a zero-axis Blob: a scalar. - optional int32 num_axes = 2 [default = 1]; - - // (filler is ignored unless just one bottom is given and the bias is - // a learned parameter of the layer.) - // The initialization for the learned bias parameter. - // Default is the zero (0) initialization, resulting in the BiasLayer - // initially performing the identity operation. - optional FillerParameter filler = 3; - optional bool bias_from_blob = 4 [default = true]; -} - -message ContrastiveLossParameter { - // margin for dissimilar pair - optional float margin = 1 [default = 1.0]; - // The first implementation of this cost did not exactly match the cost of - // Hadsell et al 2006 -- using (margin - d^2) instead of (margin - d)^2. - // legacy_version = false (the default) uses (margin - d)^2 as proposed in the - // Hadsell paper. New models should probably use this version. - // legacy_version = true uses (margin - d^2). This is kept to support / - // reproduce existing models and results - optional bool legacy_version = 2 [default = false]; -} - -message ConvolutionParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - optional bool bias_term = 2 [default = true]; // whether to have bias terms - - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in all spatial dimensions, or once per spatial dimension. - repeated uint32 pad = 3; // The padding size; defaults to 0 - repeated uint32 kernel_size = 4; // The kernel size - repeated uint32 stride = 6; // The stride; defaults to 1 - // Factor used to dilate the kernel, (implicitly) zero-filling the resulting - // holes. (Kernel dilation is sometimes referred to by its use in the - // algorithme à trous from Holschneider et al. 1987.) - repeated uint32 dilation = 18; // The dilation; defaults to 1 - - // For 2D convolution only, the *_h and *_w versions may also be used to - // specify both spatial dimensions. - optional uint32 pad_h = 9 [default = 0]; // The padding height (2D only) - optional uint32 pad_w = 10 [default = 0]; // The padding width (2D only) - optional uint32 kernel_h = 11; // The kernel height (2D only) - optional uint32 kernel_w = 12; // The kernel width (2D only) - optional uint32 stride_h = 13; // The stride height (2D only) - optional uint32 stride_w = 14; // The stride width (2D only) - - optional uint32 group = 5 [default = 1]; // The group size for group conv - - optional FillerParameter weight_filler = 7; // The filler for the weight - optional FillerParameter bias_filler = 8; // The filler for the bias - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 15 [default = DEFAULT]; - - // The axis to interpret as "channels" when performing convolution. - // Preceding dimensions are treated as independent inputs; - // succeeding dimensions are treated as "spatial". - // With (N, C, H, W) inputs, and axis == 1 (the default), we perform - // N independent 2D convolutions, sliding C-channel (or (C/g)-channels, for - // groups g>1) filters across the spatial axes (H, W) of the input. - // With (N, C, D, H, W) inputs, and axis == 1, we perform - // N independent 3D convolutions, sliding (C/g)-channels - // filters across the spatial axes (D, H, W) of the input. - optional int32 axis = 16 [default = 1]; - - // Whether to force use of the general ND convolution, even if a specific - // implementation for blobs of the appropriate number of spatial dimensions - // is available. (Currently, there is only a 2D-specific convolution - // implementation; for input blobs with num_axes != 2, this option is - // ignored and the ND implementation will be used.) - optional bool force_nd_im2col = 17 [default = false]; -} - -message CropParameter { - // To crop, elements of the first bottom are selected to fit the dimensions - // of the second, reference bottom. The crop is configured by - // - the crop `axis` to pick the dimensions for cropping - // - the crop `offset` to set the shift for all/each dimension - // to align the cropped bottom with the reference bottom. - // All dimensions up to but excluding `axis` are preserved, while - // the dimensions including and trailing `axis` are cropped. - // If only one `offset` is set, then all dimensions are offset by this amount. - // Otherwise, the number of offsets must equal the number of cropped axes to - // shift the crop in each dimension accordingly. - // Note: standard dimensions are N,C,H,W so the default is a spatial crop, - // and `axis` may be negative to index from the end (e.g., -1 for the last - // axis). - optional int32 axis = 1 [default = 2]; - repeated uint32 offset = 2; -} - -message DataParameter { - enum DB { - LEVELDB = 0; - LMDB = 1; - } - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 4; - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - // DEPRECATED. Each solver accesses a different subset of the database. - optional uint32 rand_skip = 7 [default = 0]; - optional DB backend = 8 [default = LEVELDB]; - // DEPRECATED. See TransformationParameter. For data pre-processing, we can do - // simple scaling and subtracting the data mean, if provided. Note that the - // mean subtraction is always carried out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // DEPRECATED. See TransformationParameter. Specify if we would like to randomly - // crop an image. - optional uint32 crop_size = 5 [default = 0]; - // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror - // data. - optional bool mirror = 6 [default = false]; - // Force the encoded image to have 3 color channels - optional bool force_encoded_color = 9 [default = false]; - // Prefetch queue (Increase if data feeding bandwidth varies, within the - // limit of device memory for GPU training) - optional uint32 prefetch = 10 [default = 4]; -} - -message DropoutParameter { - optional float dropout_ratio = 1 [default = 0.5]; // dropout ratio - optional bool scale_train = 2 [default = true]; // scale train or test phase -} - -// DummyDataLayer fills any number of arbitrarily shaped blobs with random -// (or constant) data generated by "Fillers" (see "message FillerParameter"). -message DummyDataParameter { - // This layer produces N >= 1 top blobs. DummyDataParameter must specify 1 or N - // shape fields, and 0, 1 or N data_fillers. - // - // If 0 data_fillers are specified, ConstantFiller with a value of 0 is used. - // If 1 data_filler is specified, it is applied to all top blobs. If N are - // specified, the ith is applied to the ith top blob. - repeated FillerParameter data_filler = 1; - repeated BlobShape shape = 6; - - // 4D dimensions -- deprecated. Use "shape" instead. - repeated uint32 num = 2; - repeated uint32 channels = 3; - repeated uint32 height = 4; - repeated uint32 width = 5; -} - -message EltwiseParameter { - enum EltwiseOp { - PROD = 0; - SUM = 1; - MAX = 2; - } - optional EltwiseOp operation = 1 [default = SUM]; // element-wise operation - repeated float coeff = 2; // blob-wise coefficient for SUM operation - - // Whether to use an asymptotically slower (for >2 inputs) but stabler method - // of computing the gradient for the PROD operation. (No effect for SUM op.) - optional bool stable_prod_grad = 3 [default = true]; -} - -// Message that stores parameters used by ELULayer -message ELUParameter { - // Described in: - // Clevert, D.-A., Unterthiner, T., & Hochreiter, S. (2015). Fast and Accurate - // Deep Network Learning by Exponential Linear Units (ELUs). arXiv - optional float alpha = 1 [default = 1]; -} - -// Message that stores parameters used by EmbedLayer -message EmbedParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - // The input is given as integers to be interpreted as one-hot - // vector indices with dimension num_input. Hence num_input should be - // 1 greater than the maximum possible input value. - optional uint32 input_dim = 2; - - optional bool bias_term = 3 [default = true]; // Whether to use a bias term - optional FillerParameter weight_filler = 4; // The filler for the weight - optional FillerParameter bias_filler = 5; // The filler for the bias - -} - -// Message that stores parameters used by ExpLayer -message ExpParameter { - // ExpLayer computes outputs y = base ^ (shift + scale * x), for base > 0. - // Or if base is set to the default (-1), base is set to e, - // so y = exp(shift + scale * x). - optional float base = 1 [default = -1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -/// Message that stores parameters used by FlattenLayer -message FlattenParameter { - // The first axis to flatten: all preceding axes are retained in the output. - // May be negative to index from the end (e.g., -1 for the last axis). - optional int32 axis = 1 [default = 1]; - - // The last axis to flatten: all following axes are retained in the output. - // May be negative to index from the end (e.g., the default -1 for the last - // axis). - optional int32 end_axis = 2 [default = -1]; -} - -// Message that stores parameters used by HDF5DataLayer -message HDF5DataParameter { - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 2; - - // Specify whether to shuffle the data. - // If shuffle == true, the ordering of the HDF5 files is shuffled, - // and the ordering of data within any given HDF5 file is shuffled, - // but data between different files are not interleaved; all of a file's - // data are output (in a random order) before moving onto another file. - optional bool shuffle = 3 [default = false]; -} - -message HDF5OutputParameter { - optional string file_name = 1; -} - -message HingeLossParameter { - enum Norm { - L1 = 1; - L2 = 2; - } - // Specify the Norm to use L1 or L2 - optional Norm norm = 1 [default = L1]; -} - -message ImageDataParameter { - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 4 [default = 1]; - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - optional uint32 rand_skip = 7 [default = 0]; - // Whether or not ImageLayer should shuffle the list of files at every epoch. - optional bool shuffle = 8 [default = false]; - // It will also resize images if new_height or new_width are not zero. - optional uint32 new_height = 9 [default = 0]; - optional uint32 new_width = 10 [default = 0]; - // Specify if the images are color or gray - optional bool is_color = 11 [default = true]; - // DEPRECATED. See TransformationParameter. For data pre-processing, we can do - // simple scaling and subtracting the data mean, if provided. Note that the - // mean subtraction is always carried out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // DEPRECATED. See TransformationParameter. Specify if we would like to randomly - // crop an image. - optional uint32 crop_size = 5 [default = 0]; - // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror - // data. - optional bool mirror = 6 [default = false]; - optional string root_folder = 12 [default = ""]; -} - -message InfogainLossParameter { - // Specify the infogain matrix source. - optional string source = 1; - optional int32 axis = 2 [default = 1]; // axis of prob -} - -message InnerProductParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - optional bool bias_term = 2 [default = true]; // whether to have bias terms - optional FillerParameter weight_filler = 3; // The filler for the weight - optional FillerParameter bias_filler = 4; // The filler for the bias - - // The first axis to be lumped into a single inner product computation; - // all preceding axes are retained in the output. - // May be negative to index from the end (e.g., -1 for the last axis). - optional int32 axis = 5 [default = 1]; - // Specify whether to transpose the weight matrix or not. - // If transpose == true, any operations will be performed on the transpose - // of the weight matrix. The weight matrix itself is not going to be transposed - // but rather the transfer flag of operations will be toggled accordingly. - optional bool transpose = 6 [default = false]; -} - -message InputParameter { - // This layer produces N >= 1 top blob(s) to be assigned manually. - // Define N shapes to set a shape for each top. - // Define 1 shape to set the same shape for every top. - // Define no shape to defer to reshaping manually. - repeated BlobShape shape = 1; -} - -// Message that stores parameters used by LogLayer -message LogParameter { - // LogLayer computes outputs y = log_base(shift + scale * x), for base > 0. - // Or if base is set to the default (-1), base is set to e, - // so y = ln(shift + scale * x) = log_e(shift + scale * x) - optional float base = 1 [default = -1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -// Message that stores parameters used by LRNLayer -message LRNParameter { - optional uint32 local_size = 1 [default = 5]; - optional float alpha = 2 [default = 1.]; - optional float beta = 3 [default = 0.75]; - enum NormRegion { - ACROSS_CHANNELS = 0; - WITHIN_CHANNEL = 1; - } - optional NormRegion norm_region = 4 [default = ACROSS_CHANNELS]; - optional float k = 5 [default = 1.]; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 6 [default = DEFAULT]; -} - -message MemoryDataParameter { - optional uint32 batch_size = 1; - optional uint32 channels = 2; - optional uint32 height = 3; - optional uint32 width = 4; -} - -message MVNParameter { - // This parameter can be set to false to normalize mean only - optional bool normalize_variance = 1 [default = true]; - - // This parameter can be set to true to perform DNN-like MVN - optional bool across_channels = 2 [default = false]; - - // Epsilon for not dividing by zero while normalizing variance - optional float eps = 3 [default = 1e-9]; -} - -message ParameterParameter { - optional BlobShape shape = 1; -} - -message PoolingParameter { - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional PoolMethod pool = 1 [default = MAX]; // The pooling method - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in height and width or as Y, X pairs. - optional uint32 pad = 4 [default = 0]; // The padding size (equal in Y, X) - optional uint32 pad_h = 9 [default = 0]; // The padding height - optional uint32 pad_w = 10 [default = 0]; // The padding width - optional uint32 kernel_size = 2; // The kernel size (square) - optional uint32 kernel_h = 5; // The kernel height - optional uint32 kernel_w = 6; // The kernel width - optional uint32 stride = 3 [default = 1]; // The stride (equal in Y, X) - optional uint32 stride_h = 7; // The stride height - optional uint32 stride_w = 8; // The stride width - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 11 [default = DEFAULT]; - // If global_pooling then it will pool over the size of the bottom by doing - // kernel_h = bottom->height and kernel_w = bottom->width - optional bool global_pooling = 12 [default = false]; - optional bool ceil_mode = 13 [default = true]; - // How to calculate the output size - using ceil (default) or floor rounding. - enum RoundMode { - CEIL = 0; - FLOOR = 1; - } - optional RoundMode round_mode = 14 [default = CEIL]; -} - -message PowerParameter { - // PowerLayer computes outputs y = (shift + scale * x) ^ power. - optional float power = 1 [default = 1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -message PythonParameter { - optional string module = 1; - optional string layer = 2; - // This value is set to the attribute `param_str` of the `PythonLayer` object - // in Python before calling the `setup()` method. This could be a number, - // string, dictionary in Python dict format, JSON, etc. You may parse this - // string in `setup` method and use it in `forward` and `backward`. - optional string param_str = 3 [default = '']; - // Whether this PythonLayer is shared among worker solvers during data parallelism. - // If true, each worker solver sequentially run forward from this layer. - // This value should be set true if you are using it as a data layer. - optional bool share_in_parallel = 4 [default = false]; -} - -// Message that stores parameters used by RecurrentLayer -message RecurrentParameter { - // The dimension of the output (and usually hidden state) representation -- - // must be explicitly set to non-zero. - optional uint32 num_output = 1 [default = 0]; - - optional FillerParameter weight_filler = 2; // The filler for the weight - optional FillerParameter bias_filler = 3; // The filler for the bias - - // Whether to enable displaying debug_info in the unrolled recurrent net. - optional bool debug_info = 4 [default = false]; - - // Whether to add as additional inputs (bottoms) the initial hidden state - // blobs, and add as additional outputs (tops) the final timestep hidden state - // blobs. The number of additional bottom/top blobs required depends on the - // recurrent architecture -- e.g., 1 for RNNs, 2 for LSTMs. - optional bool expose_hidden = 5 [default = false]; -} - -// Message that stores parameters used by ReductionLayer -message ReductionParameter { - enum ReductionOp { - SUM = 1; - ASUM = 2; - SUMSQ = 3; - MEAN = 4; - } - - optional ReductionOp operation = 1 [default = SUM]; // reduction operation - - // The first axis to reduce to a scalar -- may be negative to index from the - // end (e.g., -1 for the last axis). - // (Currently, only reduction along ALL "tail" axes is supported; reduction - // of axis M through N, where N < num_axes - 1, is unsupported.) - // Suppose we have an n-axis bottom Blob with shape: - // (d0, d1, d2, ..., d(m-1), dm, d(m+1), ..., d(n-1)). - // If axis == m, the output Blob will have shape - // (d0, d1, d2, ..., d(m-1)), - // and the ReductionOp operation is performed (d0 * d1 * d2 * ... * d(m-1)) - // times, each including (dm * d(m+1) * ... * d(n-1)) individual data. - // If axis == 0 (the default), the output Blob always has the empty shape - // (count 1), performing reduction across the entire input -- - // often useful for creating new loss functions. - optional int32 axis = 2 [default = 0]; - - optional float coeff = 3 [default = 1.0]; // coefficient for output -} - -// Message that stores parameters used by ReLULayer -message ReLUParameter { - // Allow non-zero slope for negative inputs to speed up optimization - // Described in: - // Maas, A. L., Hannun, A. Y., & Ng, A. Y. (2013). Rectifier nonlinearities - // improve neural network acoustic models. In ICML Workshop on Deep Learning - // for Audio, Speech, and Language Processing. - optional float negative_slope = 1 [default = 0]; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 2 [default = DEFAULT]; -} - -message ReshapeParameter { - // Specify the output dimensions. If some of the dimensions are set to 0, - // the corresponding dimension from the bottom layer is used (unchanged). - // Exactly one dimension may be set to -1, in which case its value is - // inferred from the count of the bottom blob and the remaining dimensions. - // For example, suppose we want to reshape a 2D blob "input" with shape 2 x 8: - // - // layer { - // type: "Reshape" bottom: "input" top: "output" - // reshape_param { ... } - // } - // - // If "input" is 2D with shape 2 x 8, then the following reshape_param - // specifications are all equivalent, producing a 3D blob "output" with shape - // 2 x 2 x 4: - // - // reshape_param { shape { dim: 2 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 0 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 0 dim: 2 dim: -1 } } - // reshape_param { shape { dim: 0 dim:-1 dim: 4 } } - // - optional BlobShape shape = 1; - - // axis and num_axes control the portion of the bottom blob's shape that are - // replaced by (included in) the reshape. By default (axis == 0 and - // num_axes == -1), the entire bottom blob shape is included in the reshape, - // and hence the shape field must specify the entire output shape. - // - // axis may be non-zero to retain some portion of the beginning of the input - // shape (and may be negative to index from the end; e.g., -1 to begin the - // reshape after the last axis, including nothing in the reshape, - // -2 to include only the last axis, etc.). - // - // For example, suppose "input" is a 2D blob with shape 2 x 8. - // Then the following ReshapeLayer specifications are all equivalent, - // producing a blob "output" with shape 2 x 2 x 4: - // - // reshape_param { shape { dim: 2 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 2 dim: 4 } axis: 1 } - // reshape_param { shape { dim: 2 dim: 4 } axis: -3 } - // - // num_axes specifies the extent of the reshape. - // If num_axes >= 0 (and axis >= 0), the reshape will be performed only on - // input axes in the range [axis, axis+num_axes]. - // num_axes may also be -1, the default, to include all remaining axes - // (starting from axis). - // - // For example, suppose "input" is a 2D blob with shape 2 x 8. - // Then the following ReshapeLayer specifications are equivalent, - // producing a blob "output" with shape 1 x 2 x 8. - // - // reshape_param { shape { dim: 1 dim: 2 dim: 8 } } - // reshape_param { shape { dim: 1 dim: 2 } num_axes: 1 } - // reshape_param { shape { dim: 1 } num_axes: 0 } - // - // On the other hand, these would produce output blob shape 2 x 1 x 8: - // - // reshape_param { shape { dim: 2 dim: 1 dim: 8 } } - // reshape_param { shape { dim: 1 } axis: 1 num_axes: 0 } - // - optional int32 axis = 2 [default = 0]; - optional int32 num_axes = 3 [default = -1]; -} - - -message ScaleParameter { - // The first axis of bottom[0] (the first input Blob) along which to apply - // bottom[1] (the second input Blob). May be negative to index from the end - // (e.g., -1 for the last axis). - // - // For example, if bottom[0] is 4D with shape 100x3x40x60, the output - // top[0] will have the same shape, and bottom[1] may have any of the - // following shapes (for the given value of axis): - // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60 - // (axis == 1 == -3) 3; 3x40; 3x40x60 - // (axis == 2 == -2) 40; 40x60 - // (axis == 3 == -1) 60 - // Furthermore, bottom[1] may have the empty shape (regardless of the value of - // "axis") -- a scalar multiplier. - optional int32 axis = 1 [default = 1]; - - // (num_axes is ignored unless just one bottom is given and the scale is - // a learned parameter of the layer. Otherwise, num_axes is determined by the - // number of axes by the second bottom.) - // The number of axes of the input (bottom[0]) covered by the scale - // parameter, or -1 to cover all axes of bottom[0] starting from `axis`. - // Set num_axes := 0, to multiply with a zero-axis Blob: a scalar. - optional int32 num_axes = 2 [default = 1]; - - // (filler is ignored unless just one bottom is given and the scale is - // a learned parameter of the layer.) - // The initialization for the learned scale parameter. - // Default is the unit (1) initialization, resulting in the ScaleLayer - // initially performing the identity operation. - optional FillerParameter filler = 3; - - // Whether to also learn a bias (equivalent to a ScaleLayer+BiasLayer, but - // may be more efficient). Initialized with bias_filler (defaults to 0). - optional bool bias_term = 4 [default = false]; - optional FillerParameter bias_filler = 5; - optional bool scale_from_blob = 6 [default = true]; -} - -message SigmoidParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; -} - -message SliceParameter { - // The axis along which to slice -- may be negative to index from the end - // (e.g., -1 for the last axis). - // By default, SliceLayer concatenates blobs along the "channels" axis (1). - optional int32 axis = 3 [default = 1]; - repeated uint32 slice_point = 2; - - // DEPRECATED: alias for "axis" -- does not support negative indexing. - optional uint32 slice_dim = 1 [default = 1]; -} - -message SmoothL1LossParameter { - // SmoothL1Loss(x) = - // 0.5 * (sigma * x) ** 2 -- if x < 1.0 / sigma / sigma - // |x| - 0.5 / sigma / sigma -- otherwise - optional float sigma = 1 [default = 1]; -} - -// Message that stores parameters used by SoftmaxLayer, SoftmaxWithLossLayer -message SoftmaxParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; - - // The axis along which to perform the softmax -- may be negative to index - // from the end (e.g., -1 for the last axis). - // Any other axes will be evaluated as independent softmaxes. - optional int32 axis = 2 [default = 1]; -} - -message TanHParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; -} - -// Message that stores parameters used by TileLayer -message TileParameter { - // The index of the axis to tile. - optional int32 axis = 1 [default = 1]; - - // The number of copies (tiles) of the blob to output. - optional int32 tiles = 2; -} - -// Message that stores parameters used by ThresholdLayer -message ThresholdParameter { - optional float threshold = 1 [default = 0]; // Strictly positive values -} - -message WindowDataParameter { - // Specify the data source. - optional string source = 1; - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // Specify the batch size. - optional uint32 batch_size = 4; - // Specify if we would like to randomly crop an image. - optional uint32 crop_size = 5 [default = 0]; - // Specify if we want to randomly mirror data. - optional bool mirror = 6 [default = false]; - // Foreground (object) overlap threshold - optional float fg_threshold = 7 [default = 0.5]; - // Background (non-object) overlap threshold - optional float bg_threshold = 8 [default = 0.5]; - // Fraction of batch that should be foreground objects - optional float fg_fraction = 9 [default = 0.25]; - // Amount of contextual padding to add around a window - // (used only by the window_data_layer) - optional uint32 context_pad = 10 [default = 0]; - // Mode for cropping out a detection window - // warp: cropped window is warped to a fixed size and aspect ratio - // square: the tightest square around the window is cropped - optional string crop_mode = 11 [default = "warp"]; - // cache_images: will load all images in memory for faster access - optional bool cache_images = 12 [default = false]; - // append root_folder to locate images - optional string root_folder = 13 [default = ""]; -} - -message SPPParameter { - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional uint32 pyramid_height = 1; - optional PoolMethod pool = 2 [default = MAX]; // The pooling method - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 6 [default = DEFAULT]; -} - -// DEPRECATED: use LayerParameter. -message V1LayerParameter { - repeated string bottom = 2; - repeated string top = 3; - optional string name = 4; - repeated NetStateRule include = 32; - repeated NetStateRule exclude = 33; - enum LayerType { - NONE = 0; - ABSVAL = 35; - ACCURACY = 1; - ARGMAX = 30; - BNLL = 2; - CONCAT = 3; - CONTRASTIVE_LOSS = 37; - CONVOLUTION = 4; - DATA = 5; - DECONVOLUTION = 39; - DROPOUT = 6; - DUMMY_DATA = 32; - EUCLIDEAN_LOSS = 7; - ELTWISE = 25; - EXP = 38; - FLATTEN = 8; - HDF5_DATA = 9; - HDF5_OUTPUT = 10; - HINGE_LOSS = 28; - IM2COL = 11; - IMAGE_DATA = 12; - INFOGAIN_LOSS = 13; - INNER_PRODUCT = 14; - LRN = 15; - MEMORY_DATA = 29; - MULTINOMIAL_LOGISTIC_LOSS = 16; - MVN = 34; - POOLING = 17; - POWER = 26; - RELU = 18; - SIGMOID = 19; - SIGMOID_CROSS_ENTROPY_LOSS = 27; - SILENCE = 36; - SOFTMAX = 20; - SOFTMAX_LOSS = 21; - SPLIT = 22; - SLICE = 33; - TANH = 23; - WINDOW_DATA = 24; - THRESHOLD = 31; - QUANT = 208; - DEQUANT = 209; - } - optional LayerType type = 5; - repeated BlobProto blobs = 6; - repeated string param = 1001; - repeated DimCheckMode blob_share_mode = 1002; - enum DimCheckMode { - STRICT = 0; - PERMISSIVE = 1; - } - repeated float blobs_lr = 7; - repeated float weight_decay = 8; - repeated float loss_weight = 35; - optional AccuracyParameter accuracy_param = 27; - optional ArgMaxParameter argmax_param = 23; - optional ConcatParameter concat_param = 9; - optional ContrastiveLossParameter contrastive_loss_param = 40; - optional ConvolutionParameter convolution_param = 10; - optional DataParameter data_param = 11; - optional DropoutParameter dropout_param = 12; - optional DummyDataParameter dummy_data_param = 26; - optional EltwiseParameter eltwise_param = 24; - optional ExpParameter exp_param = 41; - optional HDF5DataParameter hdf5_data_param = 13; - optional HDF5OutputParameter hdf5_output_param = 14; - optional HingeLossParameter hinge_loss_param = 29; - optional ImageDataParameter image_data_param = 15; - optional InfogainLossParameter infogain_loss_param = 16; - optional InnerProductParameter inner_product_param = 17; - optional LRNParameter lrn_param = 18; - optional MemoryDataParameter memory_data_param = 22; - optional MVNParameter mvn_param = 34; - optional PoolingParameter pooling_param = 19; - optional PowerParameter power_param = 21; - optional ReLUParameter relu_param = 30; - optional SigmoidParameter sigmoid_param = 38; - optional SoftmaxParameter softmax_param = 39; - optional SliceParameter slice_param = 31; - optional TanHParameter tanh_param = 37; - optional ThresholdParameter threshold_param = 25; - optional WindowDataParameter window_data_param = 20; - optional TransformationParameter transform_param = 36; - optional LossParameter loss_param = 42; - optional V0LayerParameter layer = 1; -} - -// DEPRECATED: V0LayerParameter is the old way of specifying layer parameters -// in Caffe. We keep this message type around for legacy support. -message V0LayerParameter { - optional string name = 1; // the layer name - optional string type = 2; // the string to specify the layer type - - // Parameters to specify layers with inner products. - optional uint32 num_output = 3; // The number of outputs for the layer - optional bool biasterm = 4 [default = true]; // whether to have bias terms - optional FillerParameter weight_filler = 5; // The filler for the weight - optional FillerParameter bias_filler = 6; // The filler for the bias - - optional uint32 pad = 7 [default = 0]; // The padding size - optional uint32 kernelsize = 8; // The kernel size - optional uint32 group = 9 [default = 1]; // The group size for group conv - optional uint32 stride = 10 [default = 1]; // The stride - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional PoolMethod pool = 11 [default = MAX]; // The pooling method - optional float dropout_ratio = 12 [default = 0.5]; // dropout ratio - - optional uint32 local_size = 13 [default = 5]; // for local response norm - optional float alpha = 14 [default = 1.]; // for local response norm - optional float beta = 15 [default = 0.75]; // for local response norm - optional float k = 22 [default = 1.]; - - // For data layers, specify the data source - optional string source = 16; - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 17 [default = 1]; - optional string meanfile = 18; - // For data layers, specify the batch size. - optional uint32 batchsize = 19; - // For data layers, specify if we would like to randomly crop an image. - optional uint32 cropsize = 20 [default = 0]; - // For data layers, specify if we want to randomly mirror data. - optional bool mirror = 21 [default = false]; - - // The blobs containing the numeric parameters of the layer - repeated BlobProto blobs = 50; - // The ratio that is multiplied on the global learning rate. If you want to - // set the learning ratio for one blob, you need to set it for all blobs. - repeated float blobs_lr = 51; - // The weight decay that is multiplied on the global weight decay. - repeated float weight_decay = 52; - - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - optional uint32 rand_skip = 53 [default = 0]; - - // Fields related to detection (det_*) - // foreground (object) overlap threshold - optional float det_fg_threshold = 54 [default = 0.5]; - // background (non-object) overlap threshold - optional float det_bg_threshold = 55 [default = 0.5]; - // Fraction of batch that should be foreground objects - optional float det_fg_fraction = 56 [default = 0.25]; - - // optional bool OBSOLETE_can_clobber = 57 [default = true]; - - // Amount of contextual padding to add around a window - // (used only by the window_data_layer) - optional uint32 det_context_pad = 58 [default = 0]; - - // Mode for cropping out a detection window - // warp: cropped window is warped to a fixed size and aspect ratio - // square: the tightest square around the window is cropped - optional string det_crop_mode = 59 [default = "warp"]; - - // For ReshapeLayer, one needs to specify the new dimensions. - optional int32 new_num = 60 [default = 0]; - optional int32 new_channels = 61 [default = 0]; - optional int32 new_height = 62 [default = 0]; - optional int32 new_width = 63 [default = 0]; - - // Whether or not ImageLayer should shuffle the list of files at every epoch. - // It will also resize images if new_height or new_width are not zero. - optional bool shuffle_images = 64 [default = false]; - - // For ConcatLayer, one needs to specify the dimension for concatenation, and - // the other dimensions must be the same for all the bottom blobs. - // By default it will concatenate blobs along the channels dimension. - optional uint32 concat_dim = 65 [default = 1]; - - optional HDF5OutputParameter hdf5_output_param = 1001; -} - -message PReLUParameter { - // Parametric ReLU described in K. He et al, Delving Deep into Rectifiers: - // Surpassing Human-Level Performance on ImageNet Classification, 2015. - - // Initial value of a_i. Default is a_i=0.25 for all i. - optional FillerParameter filler = 1; - // Whether or not slope parameters are shared across channels. - optional bool channel_shared = 2 [default = false]; -} - -// Message that stores parameters used by DetectionOutputLayer -//message DetectionOutputParameter { -// optional int32 num_classes = 1 [default = 21]; -// optional float nms_threshold = 2 [default = 0.3]; -// optional int32 top_k = 3; -// optional float confidence_threshold = 4 [default = 0.8]; -//} - -// Message that store parameters used by PriorBoxLayer -message PriorBoxParameter { - // Encode/decode type. - enum CodeType { - CORNER = 1; - CENTER_SIZE = 2; - CORNER_SIZE = 3; - } - // Minimum box size (in pixels). Required! - repeated float min_size = 1; - // Maximum box size (in pixels). Required! - repeated float max_size = 2; - // Various of aspect ratios. Duplicate ratios will be ignored. - // If none is provided, we use default ratio 1. - repeated float aspect_ratio = 3; - // If true, will flip each aspect ratio. - // For example, if there is aspect ratio "r", - // we will generate aspect ratio "1.0/r" as well. - optional bool flip = 4 [default = true]; - // If true, will clip the prior so that it is within [0, 1] - optional bool clip = 5 [default = false]; - // Variance for adjusting the prior bboxes. - repeated float variance = 6; - // By default, we calculate img_height, img_width, step_x, step_y based on - // bottom[0] (feat) and bottom[1] (img). Unless these values are explicitely - // provided. - // Explicitly provide the img_size. - optional uint32 img_size = 7; - // Either img_size or img_h/img_w should be specified; not both. - optional uint32 img_h = 8; - optional uint32 img_w = 9; - - // Explicitly provide the step size. - optional float step = 10; - // Either step or step_h/step_w should be specified; not both. - optional float step_h = 11; - optional float step_w = 12; - - // Offset to the top left corner of each cell. - optional float offset = 13 [default = 0.5]; -} - -// Message that stores parameters used by PermutetLayer -message PermuteParameter { - // The new orders of the axes of data. Notice it should be with - // in the same range as the input data, and it starts from 0. - // Do not provide repeated order. - repeated uint32 order = 1; -} - -message NormalizeParameter { - optional bool across_spatial = 1 [default = true]; - // Initial value of scale. Default is 1.0 for all - optional FillerParameter scale_filler = 2; - // Whether or not scale parameters are shared across channels. - optional bool channel_shared = 3 [default = true]; - // Epsilon for not dividing by zero while normalizing variance - optional float eps = 4 [default = 1e-10]; -} - -// needed by ssd -message SaveOutputParameter { - // Output directory. If not empty, we will save the results. - optional string output_directory = 1; - // Output name prefix. - optional string output_name_prefix = 2; - // Output format. - // VOC - PASCAL VOC output format. - // COCO - MS COCO output format. - optional string output_format = 3; - // If you want to output results, must also provide the following two files. - // Otherwise, we will ignore saving results. - // label map file. - optional string label_map_file = 4; - // A file which contains a list of names and sizes with same order - // of the input DB. The file is in the following format: - // name height width - // ... - optional string name_size_file = 5; - // Number of test images. It can be less than the lines specified in - // name_size_file. For example, when we only want to evaluate on part - // of the test images. - optional uint32 num_test_image = 6; - // The resize parameter used in saving the data. - // optional ResizeParameter resize_param = 7; -} - -message NonMaximumSuppressionParameter { - // Threshold to be used in nms. - optional float nms_threshold = 1 [default = 0.3]; - // Maximum number of results to be kept. - optional int32 top_k = 2; - // Parameter for adaptive nms. - optional float eta = 3 [default = 1.0]; -} - -message GeneralNmsParameter { - optional int32 post_top_k = 1 ; - optional float nms_threshold = 2 [default = 0]; - optional float iou_threshold_decay = 3 [default = 1.0]; - optional float coor_scale_factor = 4 [default = 1.0]; -} - -// Message that store parameters used by DetectionOutputLayer, ssd/fasterRcnn -message DetectionOutputParameter { - optional int32 num_classes = 1; - optional bool share_location = 2 [default = true]; - optional int32 background_label_id = 3 [default = 0]; - optional NonMaximumSuppressionParameter nms_param = 4; - optional SaveOutputParameter save_output_param = 5; - optional PriorBoxParameter.CodeType code_type = 6 [default = CENTER_SIZE]; - optional bool variance_encoded_in_target = 8 [default = true]; - optional int32 keep_top_k = 7; - optional float confidence_threshold = 9; - optional float nms_threshold = 13; - optional int32 top_k = 14; - optional int32 boxes = 15 [default = 1]; - optional bool relative = 17 [default = true]; - optional float objectness_threshold = 18 [default = 0.5]; - optional float class_threshold = 19 [default = 0.5]; - repeated float biases = 20; - optional GeneralNmsParameter general_nms_param = 21; - optional float objectness_score = 22; -} -message PSROIPoolingParameter { - required float spatial_scale = 1; - required int32 output_dim = 2; // output channel number - required int32 group_size = 3; // number of groups to encode position-sensitive score maps -} -// Message that stores parameters used by FreespaceExtractLayer -message FreespaceExtractParameter { - optional float org_height = 1; -} - -// Message that stores parameters used by DetectpostprocessLayer -message PostprocessParameter { - optional float nms_thresh = 1 [default = 0.3]; - optional float conf_thresh = 2 [default = 0.5]; - optional uint32 post_nms_topn = 3 [default = 100]; - optional uint32 cls_num = 4 [default = 12]; - repeated float bbox_reg_weights = 5; -} - -// Message that stores parameters used by SpatialTransformLayer -message SpatialTransformParameter { - optional uint32 output_h = 1 [default = 0]; - optional uint32 output_w = 2 [default = 0]; - optional float border_value = 3 [default = 0]; - repeated float affine_transform = 4; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 15 [default = DEFAULT]; -} -message ROIAlignParameter { - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in height and width or as Y, X pairs. - optional uint32 pooled_h = 1 [default = 0]; // The pooled output height - optional uint32 pooled_w = 2 [default = 0]; // The pooled output width - // Multiplicative spatial scale factor to translate ROI coords from their - // input scale to the scale used when pooling - optional float spatial_scale = 3 [default = 1]; - optional int32 sampling_ratio = 4 [default = -1]; - optional int32 roi_end_mode = 5 [default = 0]; -} - -message RegionParameter { - optional uint32 classes = 1 [default = 20]; // Category of classification - optional uint32 coords = 2 [default = 4]; // Coordinates of box - optional uint32 boxes = 3 [default = 1]; // Number of boxes predicted per grid - optional uint32 softmax = 4 [default = 0]; - optional string softmax_tree = 5 [default = ""]; - optional uint32 background = 6 [default = 0]; -} -message ReorgParameter{ - optional uint32 stride = 2 [default = 2]; - optional bool reverse = 1 [default = false]; -} -message ReverseParameter{ - repeated int32 axis = 1; -} -message InterpParameter{ - optional int32 height = 1 [default = 0];//Height of output - optional int32 width = 2 [default = 0];//Width of output - optional int32 zoom_factor = 3 [default = 1];//zoom factor - optional int32 shrink_factor = 4 [default = 1];//shrink factor - optional int32 pad_beg = 5 [default = 0];//padding at begin of input - optional int32 pad_end = 6 [default = 0];//padding at end of input -} -message ShuffleChannelParameter{ - optional uint32 group = 1[default = 1]; // The number of group -} -message UpsampleParameter{ - optional float scale = 1[default = 1]; - optional int32 stride = 2[default = 2]; - optional int32 stride_h = 3[default = 2]; - optional int32 stride_w = 4[default=2]; -} -message ROIPoolingParameter { - required int32 pooled_h = 1; - required int32 pooled_w = 2; - optional float spatial_scale = 3 [default=0.0625]; - optional float spatial_scale_h = 4; - optional float spatial_scale_w = 5; -} - -message YoloParameter { - optional int32 boxes = 1 [default = 3]; - optional int32 coords = 2 [default = 4]; - optional int32 classes = 3 [default = 80]; - optional string yolo_version = 4 [default = "V3"]; - optional bool softmax = 5 [default = false]; - optional bool background = 6 [default = false]; - optional bool softmaxtree = 7 [default = false]; -} - -message YoloV3DetectionOutputParameter { - optional int32 boxes = 1 [default = 3]; - optional int32 classes = 2 [default = 80]; - optional bool relative = 3 [default = true]; - optional float obj_threshold = 4 [default = 0.5]; - optional float score_threshold = 5 [default = 0.5]; - optional float iou_threshold = 6 [default = 0.45]; - optional int32 pre_nms_topn = 7 [default = 512]; - optional int32 post_nms_topn = 8 [default = 1024]; - repeated float biases_high = 9; - repeated float biases_mid = 10; - repeated float biases_low = 11; - optional int32 coords = 12 [default = 4]; - repeated float biases = 13; - optional bool resize_origin_img_to_net = 14 [default = false]; -} - -message YoloV3DetectionOutputV2Parameter { - optional int32 boxes = 1 [default = 3]; - optional int32 classes = 2 [default = 80]; - optional bool relative = 3 [default = true]; - optional float obj_threshold = 4 [default = 0.5]; - optional float score_threshold = 5 [default = 0.5]; - optional float iou_threshold = 6 [default = 0.45]; - optional int32 pre_nms_topn = 7 [default = 512]; - optional int32 post_nms_topn = 8 [default = 1024]; - repeated float biases_high = 9; - repeated float biases_mid = 10; - repeated float biases_low = 11; - optional int32 coords = 12 [default = 4]; - repeated float biases = 13; - optional bool resize_origin_img_to_net = 14 [default = false]; - optional int32 out_box_dim = 15 [default = 3]; -} - -message ProposalParameter { - optional float feat_stride = 1 [default = 16]; - optional float base_size = 2 [default = 16]; - optional float min_size = 3 [default = 16]; - repeated float ratio = 4; - repeated float scale = 5; - optional int32 pre_nms_topn = 6 [default = 3000]; - optional int32 post_nms_topn = 7 [default = 304]; - optional float iou_threshold = 8 [default = 0.7]; - optional bool output_actual_rois_num = 9 [default = false]; -} - -message FSRDetectionOutputParameter { - required int32 num_classes = 1; - required float score_threshold = 2; - required float iou_threshold = 3; - optional int32 batch_rois = 4 [default = 1]; -} - -message SSDDetectionOutputParameter { - required int32 num_classes= 1 [default = 2]; - optional bool share_location = 2 [default = true]; - optional int32 background_label_id = 3 [default = 0]; - optional float iou_threshold = 4 [default = 0.3]; - optional int32 top_k = 5 [default = 200]; - optional float eta = 6 [default = 1.0]; - optional bool variance_encoded_in_target = 7 [default = false]; - optional int32 code_type = 8 [default = 1]; - optional int32 keep_top_k = 9 [default = -1]; - optional float confidence_threshold = 10 [default = 0.0]; -} -message YoloV2DetectionOutputParameter { - optional int32 boxes = 1 [default = 5]; - optional int32 classes = 2 [default = 80]; - optional bool relative = 3 [default = true]; - optional float obj_threshold = 4 [default = 0.5]; - optional float score_threshold = 5 [default = 0.5]; - optional float iou_threshold = 6 [default = 0.45]; - optional int32 pre_nms_topn = 7 [default = 512]; - optional int32 post_nms_topn = 8 [default = 1024]; - repeated float biases = 9; - optional int32 coords = 10 [default = 4]; - optional bool resize_origin_img_to_net = 11 [default = false]; -} - -message QuantParameter { - optional float scale = 2; - optional bytes offset = 3; -} - -message BatchMatMulParameter{ - optional bool adj_x1 = 1 [default = false]; - optional bool adj_x2 = 2 [default = false]; -} - -message CondTakeParameter { - required string mode = 1; - required float val = 2; - optional float eps = 3 [default = 1e-06]; -} - -message MatrixInverseParameter { - optional bool adjoint = 1 [default = false]; -} - -message WarpPerspectiveParameter { - required int32 out_height = 1; - required int32 out_width = 2; - optional float constant = 3; - optional string border_type = 4 [default = 'BORDER_CONSTANT']; -} - -message SpatialTransformerParameter { - // How to use the parameter passed by localisation network - optional string transform_type = 1 [default = "affine"]; - // What is the sampling technique - optional string sampler_type = 2 [default = "bilinear"]; - - // If not set,stay same with the input dimension H and W - optional int32 output_H = 3; - optional int32 output_W = 4; - // If false, only compute dTheta, DO NOT compute dU - optional bool to_compute_dU = 5 [default = true]; - - // The default value for some parameters - optional double theta_1_1 = 6; - optional double theta_1_2 = 7; - optional double theta_1_3 = 8; - optional double theta_2_1 = 9; - optional double theta_2_2 = 10; - optional double theta_2_3 = 11; -} diff --git a/ge/proto/dump_task.proto b/ge/proto/dump_task.proto deleted file mode 100644 index a2411ddb..00000000 --- a/ge/proto/dump_task.proto +++ /dev/null @@ -1,113 +0,0 @@ -syntax = "proto3"; -package toolkit.dump; - -enum OutputDataType { - DT_UNDEFINED = 0; - DT_FLOAT = 1; - DT_FLOAT16 = 2; - DT_INT8 = 3; - DT_UINT8 = 4; - DT_INT16 = 5; - DT_UINT16 = 6; - DT_INT32 = 7; - DT_INT64 = 8; - DT_UINT32 = 9; - DT_UINT64 = 10; - DT_BOOL = 11; - DT_DOUBLE = 12; - DT_STRING = 13; - DT_DUAL_SUB_INT8 = 14; - DT_DUAL_SUB_UINT8 = 15; - DT_COMPLEX64 = 16; - DT_COMPLEX128 = 17; - DT_QINT8 = 18; - DT_QINT16 = 19; - DT_QINT32 = 20; - DT_QUINT8 = 21; - DT_QUINT16 = 22; - DT_RESOURCE = 23; - DT_STRING_REF = 24; - DT_DUAL = 25; - DT_VARIANT = 26; -} - -enum OutputFormat { - FORMAT_NCHW = 0; - FORMAT_NHWC = 1; - FORMAT_ND = 2; - FORMAT_NC1HWC0 = 3; - FORMAT_FRACTAL_Z = 4; - FORMAT_NC1C0HWPAD = 5; - FORMAT_NHWC1C0 = 6; - FORMAT_FSR_NCHW = 7; - FORMAT_FRACTAL_DECONV = 8; - FORMAT_C1HWNC0 = 9; - FORMAT_FRACTAL_DECONV_TRANSPOSE = 10; - FORMAT_FRACTAL_DECONV_SP_STRIDE_TRANS = 11; - FORMAT_NC1HWC0_C04 = 12; - FORMAT_FRACTAL_Z_C04 = 13; - FORMAT_CHWN = 14; - FORMAT_FRACTAL_DECONV_SP_STRIDE8_TRANS = 15; - FORMAT_HWCN = 16; - FORMAT_NC1KHKWHWC0 = 17; - FORMAT_BN_WEIGHT = 18; - FORMAT_FILTER_HWCK = 19; - FORMAT_HASHTABLE_LOOKUP_LOOKUPS=20; - FORMAT_HASHTABLE_LOOKUP_KEYS = 21; - FORMAT_HASHTABLE_LOOKUP_VALUE = 22; - FORMAT_HASHTABLE_LOOKUP_OUTPUT = 23; - FORMAT_HASHTABLE_LOOKUP_HITS=24; - FORMAT_C1HWNCoC0 = 25; - FORMAT_MD = 26; - FORMAT_NDHWC = 27; - FORMAT_FRACTAL_ZZ = 28; - FORMAT_FRACTAL_NZ = 29; - FORMAT_RESERVED = 30; -} - -message OriginalOp { - string name = 1; - uint32 output_index = 2; - OutputDataType data_type = 3; - OutputFormat format = 4; -} - -message Shape { - repeated uint64 dim = 1; -} - -message OpOutput { - OutputDataType data_type = 1; - OutputFormat format = 2; - Shape shape = 3; - OriginalOp original_op = 4; // the original op corresponding to the output - bytes data = 5; - uint64 size = 6; -} - -message OpInput { - OutputDataType data_type = 1; - OutputFormat format = 2; - Shape shape = 3; - bytes data = 4; - uint64 size = 5; -} - -enum BufferType { - L1 = 0; -} - -message OpBuffer { - BufferType buffer_type = 1; - bytes data = 2; - uint64 size = 3; -} - -message DumpData{ - string version = 1; - uint64 dump_time = 2; - repeated OpOutput output = 3; - repeated OpInput input = 4; - repeated OpBuffer buffer = 5; - string op_name = 6; -} diff --git a/ge/proto/fusion_model.proto b/ge/proto/fusion_model.proto deleted file mode 100755 index c92c5581..00000000 --- a/ge/proto/fusion_model.proto +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -import "om.proto"; - -package domi; - -message FusionModelDef { - string version = 1; - repeated OpDef fusion_op = 2; -} \ No newline at end of file diff --git a/ge/proto/fwk_adapter.proto b/ge/proto/fwk_adapter.proto deleted file mode 100644 index 9335c926..00000000 --- a/ge/proto/fwk_adapter.proto +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package aicpu.FWKAdapter; -option cc_enable_arenas = true; - - -// Defines an struct for input and output. -message TensorDataInfo { - - // value DataType - uint32 dtype = 1; - - // shape dim - repeated int64 dim = 2; - - // data point addr - int64 data_addr = 3; -} - -message KernelRunParam { - // input - repeated TensorDataInfo input = 1; - // output - repeated TensorDataInfo output = 2; -} - diff --git a/ge/proto/ge_api.proto b/ge/proto/ge_api.proto deleted file mode 100755 index 331c5aea..00000000 --- a/ge/proto/ge_api.proto +++ /dev/null @@ -1,88 +0,0 @@ -syntax = "proto3"; -package ge.api_pb; - -import "ge_ir.proto"; - -// GE initialize -message GEInitialize { - map options = 1; -}; - -// initialize response -message GEInitializeResponse { - uint32 status = 1; - uint32 clientId = 2; -}; - -// GE finalize -message GEFinalize { - bool final = 1; - uint32 clientId = 2; -}; - -message GEFinalizeResponse { - uint32 status = 1; -}; - -// GE Session -message CreateSession{ - map options = 1; -}; - -message CreateSessionResponse { - uint32 status = 1; - uint64 sessionId = 2; -}; - -//GE AddGraph -//model serialize :: serializegraph -message SessionAddGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - ge.proto.GraphDef graph = 3; -}; - -message SessionAddGraphResponse { - uint32 status = 1; -}; - -//GE SessionRemoveGraph -message SessionRemoveGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; -}; - -message SessionRemoveGraphResponse { - uint32 status = 1; -}; - -message SessionRunGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - repeated ge.proto.TensorDef tensor = 3; -}; - -message SessionBuildGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - repeated ge.proto.TensorDef tensor = 3; - string savePath = 4; -}; - -message SessionRunGraphResponse { - uint32 status = 1; - repeated ge.proto.TensorDef tensor = 2; -}; - -message SessionBuildGraphResponse { - uint32 status = 1; -}; - -message DestroySession{ - bool final = 1; - uint64 sessionId = 2; -}; - -message DestroySessionResponse { - uint32 status = 1; -}; diff --git a/ge/proto/ge_ir.proto b/ge/proto/ge_ir.proto deleted file mode 100644 index c0ef3071..00000000 --- a/ge/proto/ge_ir.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package ge.proto; - -enum DataType -{ - DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. - DT_FLOAT = 1; // float type - DT_FLOAT16 = 2; // fp16 type - DT_INT8 = 3; // int8 type - DT_UINT8 = 4; // uint8 type - DT_INT16 = 5; // int16 type - DT_UINT16 = 6; // uint16 type - DT_INT32 = 7; // - DT_INT64 = 8; // int64 type - DT_UINT32 = 9; // unsigned int32 - DT_UINT64 = 10; // unsigned int64 - DT_BOOL = 11; // bool type - DT_DOUBLE = 12; // double type - DT_STRING = 13; // string type - DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ - DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ - DT_COMPLEX64 = 16; // complex64 type - DT_COMPLEX128 = 17; // complex128 type - DT_QINT8 = 18; // qint8 type - DT_QINT16 = 19; // qint16 type - DT_QINT32 = 20; // qint32 type - DT_QUINT8 = 21; // quint8 type - DT_QUINT16 = 22; // quint16 type - DT_RESOURCE = 23; // resource type - 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 -{ - message ListValue - { - enum ListValueType{ - VT_LIST_NONE = 0; - VT_LIST_STRING = 1; - VT_LIST_INT = 2; - VT_LIST_FLOAT = 3; - VT_LIST_BOOL = 4; - VT_LIST_BYTES = 5; - VT_LIST_TENSOR_DESC = 6; - VT_LIST_TENSOR = 7; - VT_LIST_GRAPH = 8; - VT_LIST_NAMED_ATTRS = 9; - VT_LIST_DATA_TYPE = 10; - } - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3; // "list(int)" - repeated float f = 4; // "list(float)" - repeated bool b = 5; // "list(bool)" - repeated bytes bt = 7; - repeated TensorDescriptor td = 8; - repeated TensorDef t = 9; - repeated GraphDef g = 10; - repeated NamedAttrs na = 11; - repeated int64 dt = 12; // list ge::DataType - - ListValueType val_type = 20; - } - - message ListListInt{ - message ListInt{ - repeated int64 list_i = 1; // list int - } - repeated ListInt list_list_i = 1; // list list int - } - - oneof value - { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; // Used to support attr nesting - TensorDescriptor td = 11; // GeTensorDesc type - TensorDef t = 12; // GeTensor type - GraphDef g = 13; // Graph type - ListListInt list_list_int = 14; // List List Int type - int64 dt = 15; // ge::DataType - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs -{ - string name = 1; - map attr = 2; -} - -// Shape / dimension description, using row-major order -message ShapeDef -{ - repeated int64 dim = 1; // Size of each dimension -} - -// Multidimensional data description -message TensorDescriptor -{ - string name = 1; // Optional parameter, tensor name - - DataType dtype = 2; // tensor datatype - ShapeDef shape = 3; // Shape / dimension - string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" - - bool has_out_attr = 9; - int64 size = 10; - int64 weight_size = 11; - bool reuse_input = 12; - bool output_tensor = 13; - string device_type = 14; - bool input_tensor =15; - int64 real_dim_cnt = 16; - int64 reuse_input_index = 17; - int64 data_offset = 18; - int64 cmps_size = 19; - string cmps_tab = 20; - int64 cmps_tab_offset = 21; - - map attr = 5; // Set of extra parameter fields -} - -// GeTensor definition -message TensorDef -{ - TensorDescriptor desc = 1; // Tensor description - bytes data = 2; // Tensor data -} - - -// Operator description -message OpDef -{ - string name = 1; // name - string type = 2; // type - - repeated string input = 5; // input original op name + outgoing index. op_name:index - - map attr = 10; // Set of operator parameter fields - - bool has_out_attr = 20; - int64 id = 21; - int64 stream_id =22; - repeated string input_name = 23; - repeated string src_name = 24; - repeated int64 src_index = 25; - repeated string dst_name = 26; - repeated int64 dst_index = 27; - repeated int64 input_i = 28; - repeated int64 output_i = 29; - repeated int64 workspace = 30; - repeated int64 workspace_bytes = 31; - repeated bool is_input_const = 32; - repeated TensorDescriptor input_desc = 33; - repeated TensorDescriptor output_desc = 34; - repeated string subgraph_name = 35; -} - -// Graph definition -message GraphDef -{ - string name = 1; // name - - repeated string input = 4; // Graph input - repeated string output = 5; // Graph output - - repeated OpDef op = 6; // List of operators - - map attr = 11; // Extended field -} - -// model definition -message ModelDef -{ - string name = 1; // name - uint32 version = 2; // IR Proto verion - string custom_version = 3; // User model version number, passed in by user - - repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef - - map attr = 11; // Extended field -} - diff --git a/ge/proto/insert_op.proto b/ge/proto/insert_op.proto deleted file mode 100644 index 7d708865..00000000 --- a/ge/proto/insert_op.proto +++ /dev/null @@ -1,140 +0,0 @@ -syntax = "proto3"; - -package domi; - -message InsertNewOps { - repeated AippOpParams aipp_op = 1; - repeated MultiShapeOpParams multi_shape_op = 2; -} - -message AippOpParams { - enum InputFormat { - UNDEFINED = 0; - YUV420SP_U8 = 1; - XRGB8888_U8 = 2; - RGB888_U8 = 3; - YUV400_U8 = 4; - NC1HWC0DI_FP16 = 5; - NC1HWC0DI_S8 = 6; - ARGB8888_U8 = 7; - YUYV_U8 = 8; - YUV422SP_U8 = 9; - AYUV444_U8 = 10; - RAW10 = 11; - RAW12 = 12; - RAW16 = 13; - RAW24 = 14; - RGB16 = 15; - RGB20 = 16; - RGB24 = 17; - RGB8_IR = 18; - RGB16_IR = 19; - RGB24_IR = 20; - } - - enum AippMode { - undefined = 0; - static = 1; - dynamic = 2; - } - - // AIPPģʽ־̬AIPPͶ̬AIPP - AippMode aipp_mode = 1; - - // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 - // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 - uint32 related_input_rank = 2; - - // related_input_name is optional and the top name of data node which inserts aipp - string related_input_name = 6; - - // input_edge_idxΪѡΪͣ÷ΧΪ>=0 - // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP - // ֵ <= Dataߵĸ - repeated uint32 input_edge_idx = 3; - - // [Begin] ̬AIPPþ̬AIPPʱЧ - uint32 max_src_image_size = 4; - - // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ - bool support_rotation = 5; - - // [End] ̬AIPP - - - // [Begin] ̬AIPPö̬AIPPʱЧ - InputFormat input_format = 51; - bool csc_switch = 52; - float cpadding_value = 53; - bool rbuv_swap_switch = 54; - bool ax_swap_switch = 55; - bool single_line_mode = 56; - - int32 src_image_size_w = 57; - int32 src_image_size_h = 58; - - bool crop = 59; - int32 load_start_pos_w = 60; - int32 load_start_pos_h = 61; - int32 crop_size_w = 62; - int32 crop_size_h = 63; - - bool resize = 64; - int32 resize_output_w = 65; - int32 resize_output_h = 66; - - bool padding = 67; - int32 left_padding_size = 68; - int32 right_padding_size = 69; - int32 top_padding_size = 70; - int32 bottom_padding_size = 71; - float padding_value = 72; - - int32 mean_chn_0 = 10; - int32 mean_chn_1 = 11; - int32 mean_chn_2 = 12; - int32 mean_chn_3 = 19; - float min_chn_0 = 13; - float min_chn_1 = 14; - float min_chn_2 = 15; - float min_chn_3 = 20; - repeated float var_reci_chn_0 = 16; - repeated float var_reci_chn_1 = 17; - repeated float var_reci_chn_2 = 18; - repeated float var_reci_chn_3 = 21; - - repeated int32 matrix_r0c0 = 30; - repeated int32 matrix_r0c1 = 31; - repeated int32 matrix_r0c2 = 32; - repeated int32 matrix_r1c0 = 33; - repeated int32 matrix_r1c1 = 34; - repeated int32 matrix_r1c2 = 35; - repeated int32 matrix_r2c0 = 36; - repeated int32 matrix_r2c1 = 37; - repeated int32 matrix_r2c2 = 38; - repeated int32 output_bias_0 = 39; - repeated int32 output_bias_1 = 40; - repeated int32 output_bias_2 = 41; - repeated int32 input_bias_0 = 42; - repeated int32 input_bias_1 = 43; - repeated int32 input_bias_2 = 44; - - // [End] ̬AIPP - - // The n number that is used for raw/rgbir data into f16 transformation. - // The transformation equation is x/(2^n). If set to 0, no transform is performed. - uint32 raw_rgbir_to_f16_n = 45; -} - -message MultiShapeOpParams { - enum MultiShapeMode { - batch = 0; //̬batch - resolution = 1; //ֱ̬ʣչ - } - - MultiShapeMode mode = 1; //ģʽ - uint32 related_input_rank = 2; //Ӳ뵽ĸ - - - repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ -} diff --git a/ge/proto/om.proto b/ge/proto/om.proto deleted file mode 100644 index e15e5f80..00000000 --- a/ge/proto/om.proto +++ /dev/null @@ -1,396 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -enum TargetType -{ - MINI = 0; - TINY = 1; - LITE = 2; -} - -// offline model -message ModelDef { - string name = 1; - uint32 version = 2; - - uint64 memory_size = 10; - uint32 stream_num = 11; - uint32 event_num = 12; - uint64 weight_size = 13; - uint32 label_num = 15; - repeated OpDef op = 20; - TargetType target_type = 23; - - map attr = 30; -}; - -// operator define -message OpDef { - string name = 1; - string type = 2; - - uint32 id = 3; - uint32 stream_id = 4; - - repeated string input_name = 5; - - repeated string src_name = 8; - repeated int32 src_index = 9; - repeated int64 input = 10; - repeated int64 output = 11; - repeated TensorDescriptor input_desc = 12; - repeated TensorDescriptor output_desc = 13; - repeated WeightDef weights = 14; - repeated string dst_name = 15; - repeated int32 dst_index = 16; - - repeated int64 workspace = 20; - repeated uint32 workspace_bytes = 21; - - repeated string weight_name = 22; - repeated bool is_input_const = 23; - - map attr = 30; - - QuantizeFactorParams quantize_factor = 31; - - oneof op_params { - // start at 100 here - SendOpParams sender_param = 100; - RecvOpParams receiver_param = 200; - ConvolutionOpParams convolution_param = 300; - PoolingOpParams pooling_param = 400; - EltwiseOpParams eltwise_param = 500; - BatchNormOpParams batchnorm_param = 600; - ScaleOpParams scale_param = 700; - FullConnectionOpParams full_connection_param = 800; - SoftmaxOpParams softmax_param = 900; - ActivationOpParams activation_param = 1000; - ReshapeOpParams reshape_param = 1100; - } -}; - -message SendOpParams { - uint32 event_id = 1; -}; - -message RecvOpParams { - uint32 event_id = 1; -}; - -enum QuantizeScaleType -{ - VECTOR_SCALE = 0; - SCALAR_SCALE = 1; -} - -enum QuantizeScaleMode -{ - NORMAL_MODE = 0; - SQRT_MODE = 1; -} - -enum QuantizeAlgorithm -{ - NON_OFFSET_ALGO = 0; - HALF_OFFSET_ALGO = 1; - ALL_OFFSET_ALGO = 2; -} -message QuantizeFactor -{ - QuantizeScaleMode scale_mode = 1; - bytes scale_value = 2; - int64 scale_offset = 3; - bytes offset_data_value = 4; - int64 offset_data_offset = 5; - bytes offset_weight_value = 6; - int64 offset_weight_offset = 7; - bytes offset_pad_value = 8; - int64 offset_pad_offset = 9; -}; - -message QuantizeCalcFactor -{ - bytes offsetw = 1; - int64 offsetw_offset = 2; - bytes offsetd = 3; - int64 offsetd_offset = 4; - bytes scalereq = 5; - int64 scaledreq_offset = 6; - bytes offsetdnext = 7; - int64 offsetdnext_offset = 8; -} - -message QuantizeFactorParams -{ - QuantizeAlgorithm quantize_algo = 1; - QuantizeScaleType scale_type = 2; - QuantizeFactor quantize_param = 3; - QuantizeFactor dequantize_param = 4; - QuantizeFactor requantize_param = 5; - QuantizeCalcFactor quantizecalc_param = 6; -}; - -message ConvolutionOpParams { - int32 mode = 1; - int32 algo = 2; - int32 pad_mode = 3; - uint32 group = 4; - uint32 num_output = 5; - - repeated uint32 pad = 10; - repeated uint32 stride = 11; - repeated uint32 dilation = 12; - repeated uint32 kernel = 13; - - float alpha = 20; - float beta = 21; - - WeightDef filter = 40; - WeightDef bias = 41; - - bool relu_flag = 62; - repeated uint32 adj = 70; - repeated uint32 target_shape = 71; - repeated uint32 before_pad = 72; -}; - -message PoolingOpParams { - int32 mode = 1; - int32 nan_opt = 2; - int32 pad_mode = 3; - bool global_pooling = 4; - - repeated uint32 window = 10; - repeated uint32 pad = 11; - repeated uint32 stride = 12; - bool ceil_mode = 13; - int32 data_mode = 14; - - float alpha = 20; - float beta = 21; - repeated uint32 before_pad = 22; -}; - -message EltwiseOpParams { - int32 mode = 1; - repeated float coeff = 2; - float alpha = 3; - float beta = 4; - repeated WeightDef weight = 5; - bool relu_flag = 6; -}; - -message ActivationOpParams { - int32 mode = 1; - float coef = 2; - float alpha = 3; - float beta = 4; -}; - -message BatchNormOpParams { - int32 mode = 1; - - float alpha = 2; - float beta = 3; - double epsilon = 4;//optinal,[default = 1e-5] - bool use_global_stats = 5; //optinal,by default true,testing mode - float moving_average_fraction = 6; //optinal,[default = .999]; - - WeightDef estimated_mean = 7; - WeightDef estimated_variance = 8; - - WeightDef scale = 9; - WeightDef bias = 10; -}; - -message ScaleOpParams { - WeightDef scale = 1; - WeightDef bias = 2; -}; - -message ReshapeOpParams { - float alpha = 1; - float beta = 2; - ShapeDef shape = 3; - int32 axis = 4; - int32 num_axes = 5; - int32 format = 6; -}; - -message SoftmaxOpParams { - int32 algo = 1; - int32 mode = 2; - float alpha = 3; - float beta = 4; -}; - -message FullConnectionOpParams { - WeightDef filter = 1; - WeightDef bias = 2; - uint32 num_output = 3; - bool relu_flag = 12; -}; - -message FlattenOpParams { - float alpha = 1; - float beta = 2; - int32 start_axis = 3; - int32 end_axis = 4; -} - -message AddLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message MulLimitedOpParams { - float alpha = 1; - float beta = 2; - int32 axis = 3; - bool broadcast = 4; - - repeated WeightDef weight = 10; -}; - -message AddOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message MulOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message SubOpParams { - float alpha = 1; - float beta = 2; - - repeated WeightDef weight = 10; -}; - -message BiasAddOpParams { - float alpha = 1; - float beta = 2; - - WeightDef bias = 10; -}; - -message MatMulOpParams { - float alpha = 1; - float beta = 2; - bool transposeX = 3; - bool transposeW = 4; - - WeightDef filter = 10; - WeightDef bias = 12; -}; - -message RsqrtOpParams { - float alpha = 1; - float beta = 2; -}; - - -message WeightDef { - int32 format = 1; - int32 data_type = 2; - ShapeDef shape = 3; - bytes data = 4; - int64 data_offset = 5; - uint32 cmps_size = 6; - bytes cmps_tab = 7; - int64 cmps_tab_offset = 10; - CompressInfo cmps_info = 8; - AllOffsetQuantizeInfo alloffset_quantize_info = 11; -} - -message ShapeDef { - repeated int64 dim = 1; -} - -enum DeviceType { - NPU = 0; // In default, we will use NPU. - CPU = 1; // CPU -} - -message AllOffsetQuantizeInfo { - float scale = 1; - int32 offset = 2; -} - -message TensorDescriptor { - int32 format = 1; - int32 data_type = 2; - repeated int64 dim = 3; - uint32 size = 4; - bool reuse_input = 5; - bool output_tensor = 7; - DeviceType device_type = 8; - bool input_tensor = 9; - uint32 real_dim_cnt = 10; - uint32 reuse_input_index = 11; - AllOffsetQuantizeInfo alloffset_quantize_info = 12; -} - -message CompressInfo { - int32 blockRow = 1; // block row - int32 blockCol = 2; // block col - int32 fractalK = 3; // fractal K - int32 fractalN = 4; // fractal N - int32 lastFractalK = 5; // K of last fractal - int32 lastFractalN = 6; // N of last fractal - int32 cubeSize = 7; // cube's length - int32 loadDir = 8; // data load directtiono 0:col load 1:row load -} - -message AttrDef { - message ListValue { - repeated string s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated uint32 u = 6 [packed = true]; // "list(uint)" - repeated bytes bt = 7; - } - - oneof value { - string s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - uint32 u = 6; // "uint32" - bytes bt = 7; - ListValue list = 1; // any "list(...)" - NamedAttrs func = 10; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NamedAttrs { - string name = 1; - map attr = 2; -} - diff --git a/ge/proto/op_mapping.proto b/ge/proto/op_mapping.proto deleted file mode 100644 index d626eb49..00000000 --- a/ge/proto/op_mapping.proto +++ /dev/null @@ -1,75 +0,0 @@ -syntax = "proto3"; -package toolkit.aicpu.dump; - -message Shape { - repeated uint64 dim = 1; -} - -message Output { - int32 data_type = 1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - string original_name = 5; - int32 original_output_index = 6; - int32 original_output_data_type = 7; - int32 original_output_format = 8; - uint64 size = 9; - Shape origin_shape = 10; -} - -message Input { - int32 data_type =1; - int32 format = 2; - Shape shape = 3; - uint64 address = 4; - uint64 size = 5; - Shape origin_shape = 6; -} - -enum BufferType { - L1 = 0; -} - -message OpBuffer { - BufferType buffer_type = 1; - uint64 address = 2; - uint64 size = 3; -} - -message Op { - string op_name = 1; - string op_type = 2; -} - -message Task { - uint32 task_id = 1; - uint32 stream_id = 2; - Op op = 3; - repeated Output output = 4; - bool end_graph = 5; - repeated Input input = 6; - repeated OpBuffer buffer = 7; -} - -message OpMappingInfo { - string dump_path = 1; - oneof model_name_param { - string model_name = 2; - } - oneof model_id_param { - uint32 model_id = 3; - } - oneof step_id { - uint64 step_id_addr = 4; - } - oneof iterations_per_loop { - uint64 iterations_per_loop_addr = 5; - } - oneof loop_cond { - uint64 loop_cond_addr = 6; - } - uint32 flag = 7; // 0x01 load, 0x00 unload - repeated Task task = 8; - string dump_step = 9; -} \ No newline at end of file diff --git a/ge/proto/optimizer_priority.proto b/ge/proto/optimizer_priority.proto deleted file mode 100644 index 769619cf..00000000 --- a/ge/proto/optimizer_priority.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package ge.optimizers; - -// Default: GE>FE>AICPU -message Priority{ - repeated string optimizer = 1; -} \ No newline at end of file diff --git a/ge/proto/task.proto b/ge/proto/task.proto deleted file mode 100644 index 0da5631e..00000000 --- a/ge/proto/task.proto +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details at - * http://www.apache.org/licenses/LICENSE-2.0 - */ -syntax = "proto3"; - -package domi; - -message ModelTaskDef { - string version = 1; - - map attr = 9; // Extended field - repeated TaskDef task = 10; - - uint64 memory_size = 11; - uint32 stream_num = 12; - uint32 event_num = 13; - uint64 weight_size = 14; - - repeated bytes op = 15; // input/output opdef in bytes - - uint64 base_addr = 16; // base addr - uint64 weight_addr = 17; // weight addr - uint32 batch_num = 18; -} - - -message TaskDef { - uint32 id = 1; - uint32 type = 2; - - uint32 stream_id = 10; - uint32 event_id = 11; - - KernelDef kernel = 20; - KernelExDef kernel_ex = 21; - KernelHcclDef kernel_hccl = 25; - EventExDef event_ex = 26; - LogTimeStampDef log_timestamp = 28; - - uint32 label_id = 30; - - MemcpyAsyncDef memcpy_async = 31; - StreamSwitchDef stream_switch = 32; - StreamActiveDef stream_active = 33; - bytes private_def = 34; - uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future - StreamSwitchNDef stream_switch_n = 36; - - LabelSetDef label_set = 37; - LabelGotoExDef label_goto_ex = 38; - LabelSwitchByIndexDef label_switch_by_index = 39; - KernelDefWithHandle kernel_with_handle = 40; -} - -message KernelDef { - KernelContext context = 1; - - string stub_func = 10; - uint32 block_dim = 11; - uint32 args_size = 12; - bytes args = 13; - bytes sm_desc = 14; - bytes flowtable = 15; - string so_name = 16; - string kernel_name = 17; - bytes kernel_ext_info = 18; - uint32 kernel_ext_info_size = 19; -} - -message KernelDefWithHandle { - KernelContext context = 1; - - uint64 handle = 10; - string dev_func = 11; - uint32 block_dim = 12; - uint32 args_size = 13; - bytes args = 14; - bytes sm_desc = 15; - string original_kernel_key = 16; - string node_info = 17; -} - -message KernelContext { - uint32 kernel_type = 1; - uint32 op_id = 2; // OP type in CCE - uint32 kernel_func_id = 3; - uint32 op_index = 4; // TE/Custom operator - bool is_flowtable = 5; // Identify whether args is a flowtable structure - bytes args_offset = 6; // args offset information - uint32 args_count = 7; // args count - repeated uint32 origin_op_index = 8; -} - - -message KernelExDef { - uint32 flags = 1; - - uint32 op_index = 4; - uint32 args_size = 12; - bytes args = 13; - bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput - uint32 task_info_size = 15; - bytes kernel_ext_info = 16; - uint32 kernel_ext_info_size = 17; -} - - -message KernelHcclDef { - uint32 op_index = 8; - string hccl_type = 9; -} - - -message EventExDef { - uint32 op_index = 1; - uint32 event_type = 2; -} - -message LogTimeStampDef { - uint64 logid = 1; - bool notify = 2; - uint32 flat = 3; -} - -message MemcpyAsyncDef { - uint64 dst = 1; - uint64 dst_max = 2; - uint64 src = 3; - uint64 count = 4; - uint32 kind = 5; - uint32 op_index = 6; -} - -message StreamSwitchDef { - uint32 op_index = 1; - uint32 true_stream_id = 2; - int64 value = 3; - uint64 value_ptr = 4; - uint32 data_type = 5; -} - -message StreamActiveDef { - uint32 op_index = 1; - uint32 active_stream_id = 2; -} - -message StreamSwitchNDef { - uint32 op_index = 1; - uint32 size = 2; - repeated int64 target_value = 3; - repeated uint32 true_stream_id = 4; - uint32 element_size = 5; - uint32 data_type = 6; -} - -message LabelSetDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelGotoExDef { - uint32 op_index = 1; - uint32 label_id = 2; - uint32 model_id = 3; -} - -message LabelSwitchByIndexDef { - uint32 op_index = 1; - uint32 label_max = 2; -} diff --git a/ge/proto/tensorflow/attr_value.proto b/ge/proto/tensorflow/attr_value.proto deleted file mode 100644 index 438d7163..00000000 --- a/ge/proto/tensorflow/attr_value.proto +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "AttrValueProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "tensor.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing the value for an attr used to configure an Op. -// Comment indicates the corresponding attr type. Only the field matching the -// attr type may be filled. -message AttrValue { - // LINT.IfChange - message ListValue { - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated DataType type = 6 [packed = true]; // "list(type)" - repeated TensorShapeProto shape = 7; // "list(shape)" - repeated TensorProto tensor = 8; // "list(tensor)" - repeated NameAttrList func = 9; // "list(attr)" - } - // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) - - oneof value { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - DataType type = 6; // "type" - TensorShapeProto shape = 7; // "shape" - TensorProto tensor = 8; // "tensor" - ListValue list = 1; // any "list(...)" - - // "func" represents a function. func.name is a function's name or - // a primitive op's name. func.attr.first is the name of an attr - // defined for that function. func.attr.second is the value for - // that attr in the instantiation. - NameAttrList func = 10; - - // This is a placeholder only used in nodes defined inside a - // function. It indicates the attr value will be supplied when - // the function is instantiated. For example, let us suppose a - // node "N" in function "FN". "N" has an attr "A" with value - // placeholder = "foo". When FN is instantiated with attr "foo" - // set to "bar", the instantiated node N's attr A will have been - // given the value "bar". - string placeholder = 9; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NameAttrList { - string name = 1; - map attr = 2; -} diff --git a/ge/proto/tensorflow/function.proto b/ge/proto/tensorflow/function.proto deleted file mode 100644 index 44681e32..00000000 --- a/ge/proto/tensorflow/function.proto +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "FunctionProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "node_def.proto"; -import "op_def.proto"; - -// A library is a set of named functions. -message FunctionDefLibrary { - repeated FunctionDef function = 1; - repeated GradientDef gradient = 2; -} - -// A function can be instantiated when the runtime can bind every attr -// with a value. When a GraphDef has a call to a function, it must -// have binding for every attr defined in the signature. -// * device spec, etc. -message FunctionDef { - // The definition of the function's name, arguments, return values, - // attrs etc. - OpDef signature = 1; - - // Attributes specific to this function definition. - map attr = 5; - - // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. - reserved 2; - - // In both of the following fields, there is the need to specify an - // output that is used as either the input to another node (in - // `node_def`) or as a return value of the function (in `ret`). - // Unlike the NodeDefs in GraphDef, we need to be able to specify a - // list in some cases (instead of just single outputs). Also, we - // need to be able to deal with lists of unknown length (so the - // output index may not be known at function definition time). So - // we use the following format instead: - // * "fun_in" where "fun_in" is the name of a function input arg in - // the `signature` field above. This represents that input, whether - // it is a single tensor or a list. - // * "fun_in:0" gives the first element of a function input arg (a - // non-list input is considered a list of length 1 for these - // purposes). - // * "node:out" where "node" is the name of a node in `node_def` and - // "out" is the name one of its op's output arguments (the name - // comes from the OpDef of the node's op). This represents that - // node's output, whether it is a single tensor or a list. - // Note: We enforce that an op's output arguments are never - // renamed in the backwards-compatibility test. - // * "node:out:0" gives the first element of a node output arg (a - // non-list output is considered a list of length 1 for these - // purposes). - // - // NOT CURRENTLY SUPPORTED (but may be in the future): - // * "node:out:-1" gives last element in a node output list - // * "node:out:1:" gives a list with all but the first element in a - // node output list - // * "node:out::-1" gives a list with all but the last element in a - // node output list - - // The body of the function. Unlike the NodeDefs in a GraphDef, attrs - // may have values of type `placeholder` and the `input` field uses - // the "output" format above. - - // By convention, "op" in node_def is resolved by consulting with a - // user-defined library first. If not resolved, "func" is assumed to - // be a builtin op. - repeated NodeDef node_def = 3; - - // A mapping from the output arg names from `signature` to the - // outputs from `node_def` that should be returned by the function. - map ret = 4; -} - -// GradientDef defines the gradient function of a function defined in -// a function library. -// -// A gradient function g (specified by gradient_func) for a function f -// (specified by function_name) must follow the following: -// -// The function 'f' must be a numerical function which takes N inputs -// and produces M outputs. Its gradient function 'g', which is a -// function taking N + M inputs and produces N outputs. -// -// I.e. if we have -// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), -// then, g is -// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, -// dL/dy1, dL/dy2, ..., dL/dy_M), -// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the -// loss function). dL/dx_i is the partial derivative of L with respect -// to x_i. -message GradientDef { - string function_name = 1; // The function name. - string gradient_func = 2; // The gradient function's name. -} diff --git a/ge/proto/tensorflow/graph.proto b/ge/proto/tensorflow/graph.proto deleted file mode 100644 index 73bfc6ee..00000000 --- a/ge/proto/tensorflow/graph.proto +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "GraphProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "node_def.proto"; -import "function.proto"; -import "versions.proto"; - -// Represents the graph of operations -message GraphDef { - repeated NodeDef node = 1; - - // Compatibility versions of the graph. See core/public/version.h for version - // history. The GraphDef version is distinct from the TensorFlow version, and - // each release of TensorFlow will support a range of GraphDef versions. - VersionDef versions = 4; - - // Deprecated single version field; use versions above instead. Since all - // GraphDef changes before "versions" was introduced were forward - // compatible, this field is entirely ignored. - int32 version = 3 [deprecated = true]; - - // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. - // - // "library" provides user-defined functions. - // - // Naming: - // * library.function.name are in a flat namespace. - // NOTE: We may need to change it to be hierarchical to support - // different orgs. E.g., - // { "/google/nn", { ... }}, - // { "/google/vision", { ... }} - // { "/org_foo/module_bar", { ... }} - // map named_lib; - // * If node[i].op is the name of one function in "library", - // node[i] is deemed as a function call. Otherwise, node[i].op - // must be a primitive operation supported by the runtime. - // - // - // Function call semantics: - // - // * The callee may start execution as soon as some of its inputs - // are ready. The caller may want to use Tuple() mechanism to - // ensure all inputs are ready in the same time. - // - // * The consumer of return values may start executing as soon as - // the return values the consumer depends on are ready. The - // consumer may want to use Tuple() mechanism to ensure the - // consumer does not start until all return values of the callee - // function are ready. - FunctionDefLibrary library = 2; -}; diff --git a/ge/proto/tensorflow/graph_library.proto b/ge/proto/tensorflow/graph_library.proto deleted file mode 100644 index 7bca0838..00000000 --- a/ge/proto/tensorflow/graph_library.proto +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; - -import "graph.proto"; - -message GeGraphDef { - string name = 1; - GraphDef graph = 2; -} - -message GraphDefLibrary { - repeated GeGraphDef graph_def = 1; -}; \ No newline at end of file diff --git a/ge/proto/tensorflow/node_def.proto b/ge/proto/tensorflow/node_def.proto deleted file mode 100644 index 50cf5cac..00000000 --- a/ge/proto/tensorflow/node_def.proto +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "NodeProto"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; - -message NodeDef { - // The name given to this operator. Used for naming inputs, - // logging, visualization, etc. Unique within a single GraphDef. - // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". - string name = 1; - - // The operation name. There may be custom parameters in attrs. - // Op names starting with an underscore are reserved for internal use. - string op = 2; - - // Each input is "node:src_output" with "node" being a string name and - // "src_output" indicating which output tensor to use from "node". If - // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs - // may optionally be followed by control inputs that have the format - // "^node". - repeated string input = 3; - - // A (possibly partial) specification for the device on which this - // node should be placed. - // The expected syntax for this string is as follows: - // - // DEVICE_SPEC ::= PARTIAL_SPEC - // - // PARTIAL_SPEC ::= ("/" CONSTRAINT) * - // CONSTRAINT ::= ("job:" JOB_NAME) - // | ("replica:" [1-9][0-9]*) - // | ("task:" [1-9][0-9]*) - // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) - // - // Valid values for this string include: - // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) - // * "/job:worker/device:GPU:3" (partial specification) - // * "" (no specification) - // - // If the constraints do not resolve to a single device (or if this - // field is empty or not present), the runtime will attempt to - // choose a device automatically. - string device = 4; - - // Operation-specific graph-construction-time configuration. - // Note that this should include all attrs defined in the - // corresponding OpDef, including those with a value matching - // the default -- this allows the default to change and makes - // NodeDefs easier to interpret on their own. However, if - // an attr with a default is not specified in this list, the - // default will be used. - // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and - // one of the names from the corresponding OpDef's attr field). - // The values must have a type matching the corresponding OpDef - // attr's type field. - // Add some examples here showing best practices. - map attr = 5; -}; diff --git a/ge/proto/tensorflow/op_def.proto b/ge/proto/tensorflow/op_def.proto deleted file mode 100644 index 7f0e8ce2..00000000 --- a/ge/proto/tensorflow/op_def.proto +++ /dev/null @@ -1,172 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "OpDefProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "types.proto"; - -// Defines an operation. A NodeDef in a GraphDef specifies an Op by -// using the "op" field which should match the name of a OpDef. -// LINT.IfChange -message OpDef { - // Op names starting with an underscore are reserved for internal use. - // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". - string name = 1; - - // For describing inputs and outputs. - message ArgDef { - // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". - string name = 1; - - // Human readable description. - string description = 2; - - // Describes the type of one or more tensors that are accepted/produced - // by this input/output arg. The only legal combinations are: - // * For a single tensor: either the "type" field is set or the - // "type_attr" field is set to the name of an attr with type "type". - // * For a sequence of tensors with the same type: the "number_attr" - // field will be set to the name of an attr with type "int", and - // either the "type" or "type_attr" field will be set as for - // single tensors. - // * For a sequence of tensors, the "type_list_attr" field will be set - // to the name of an attr with type "list(type)". - DataType type = 3; - string type_attr = 4; // if specified, attr must have type "type" - string number_attr = 5; // if specified, attr must have type "int" - // If specified, attr must have type "list(type)", and none of - // type, type_attr, and number_attr may be specified. - string type_list_attr = 6; - - // For inputs: if true, the inputs are required to be refs. - // By default, inputs can be either refs or non-refs. - // For outputs: if true, outputs are refs, otherwise they are not. - bool is_ref = 16; - }; - - // Description of the input(s). - repeated ArgDef input_arg = 2; - - // Description of the output(s). - repeated ArgDef output_arg = 3; - - // Description of the graph-construction-time configuration of this - // Op. That is to say, this describes the attr fields that will - // be specified in the NodeDef. - message AttrDef { - // A descriptive name for the argument. May be used, e.g. by the - // Python client, as a keyword argument name, and so should match - // the regexp "[a-z][a-z0-9_]+". - string name = 1; - - // One of the type names from attr_value.proto ("string", "list(string)", - // "int", etc.). - string type = 2; - - // A reasonable default for this attribute if the user does not supply - // a value. If not specified, the user must supply a value. - AttrValue default_value = 3; - - // Human-readable description. - string description = 4; - - - // --- Constraints --- - // These constraints are only in effect if specified. Default is no - // constraints. - - // For type == "int", this is a minimum value. For "list(___)" - // types, this is the minimum length. - bool has_minimum = 5; - int64 minimum = 6; - - // The set of allowed values. Has type that is the "list" version - // of the "type" field above (uses the "list" field of AttrValue). - // If type == "type" or "list(type)" above, then the "type" field - // of "allowed_values.list" has the set of allowed DataTypes. - // If type == "string" or "list(string)", then the "s" field of - // "allowed_values.list" has the set of allowed strings. - AttrValue allowed_values = 7; - } - repeated AttrDef attr = 4; - - // Optional deprecation based on GraphDef versions. - OpDeprecation deprecation = 8; - - // One-line human-readable description of what the Op does. - string summary = 5; - - // Additional, longer human-readable description of what the Op does. - string description = 6; - - // ------------------------------------------------------------------------- - // Which optimizations this operation can participate in. - - // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) - bool is_commutative = 18; - - // If is_aggregate is true, then this operation accepts N >= 2 - // inputs and produces 1 output all of the same type. Should be - // associative and commutative, and produce output with the same - // shape as the input. The optimizer may replace an aggregate op - // taking input from multiple devices with a tree of aggregate ops - // that aggregate locally within each device (and possibly within - // groups of nearby devices) before communicating. - bool is_aggregate = 16; // for things like add - - // Other optimizations go here, like - // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. - - // ------------------------------------------------------------------------- - // Optimization constraints. - - // Ops are marked as stateful if their behavior depends on some state beyond - // their input tensors (e.g. variable reading op) or if they have - // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops - // must always produce the same output for the same input and have - // no side-effects. - // - // By default Ops may be moved between devices. Stateful ops should - // either not be moved, or should only be moved if that state can also - // be moved (e.g. via some sort of save / restore). - // Stateful ops are guaranteed to never be optimized away by Common - // Subexpression Elimination (CSE). - bool is_stateful = 17; // for things like variables, queue - - // ------------------------------------------------------------------------- - // Non-standard options. - - // By default, all inputs to an Op must be initialized Tensors. Ops - // that may initialize tensors for the first time should set this - // field to true, to allow the Op to take an uninitialized Tensor as - // input. - bool allows_uninitialized_input = 19; // for Assign, etc. -}; -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) - -// Information about version-dependent deprecation of an op -message OpDeprecation { - // First GraphDef version at which the op is disallowed. - int32 version = 1; - - // Explanation of why it was deprecated and what to use instead. - string explanation = 2; -}; - -// A collection of OpDefs -message OpList { - repeated OpDef op = 1; -}; diff --git a/ge/proto/tensorflow/resource_handle.proto b/ge/proto/tensorflow/resource_handle.proto deleted file mode 100644 index 91c46c9a..00000000 --- a/ge/proto/tensorflow/resource_handle.proto +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "ResourceHandle"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Protocol buffer representing a handle to a tensorflow resource. Handles are -// not valid across executions, but can be serialized back and forth from within -// a single run. -message ResourceHandleProto { - // Unique name for the device containing the resource. - string device = 1; - - // Container in which this resource is placed. - string container = 2; - - // Unique name of this resource. - string name = 3; - - // Hash code for the type of the resource. Is only valid in the same device - // and in the same execution. - uint64 hash_code = 4; - - // For debug-only, the name of the type pointed to by this handle, if - // available. - string maybe_type_name = 5; -}; diff --git a/ge/proto/tensorflow/tensor.proto b/ge/proto/tensorflow/tensor.proto deleted file mode 100644 index 48eeb6c4..00000000 --- a/ge/proto/tensorflow/tensor.proto +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TensorProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "resource_handle.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing a tensor. -message TensorProto { - DataType dtype = 1; - - // Shape of the tensor. - TensorShapeProto tensor_shape = 2; - - // Only one of the representations below is set, one of "tensor_contents" and - // the "xxx_val" attributes. We are not using oneof because as oneofs cannot - // contain repeated fields it would require another extra set of messages. - - // Version number. - // - // In version 0, if the "repeated xxx" representations contain only one - // element, that element is repeated to fill the shape. This makes it easy - // to represent a constant Tensor with a single value. - int32 version_number = 3; - - // Serialized raw tensor content from either Tensor::AsProtoTensorContent or - // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation - // can be used for all tensor types. The purpose of this representation is to - // reduce serialization overhead during RPC call by avoiding serialization of - // many repeated small items. - bytes tensor_content = 4; - - // Type specific representations that make it easy to create tensor protos in - // all languages. Only the representation corresponding to "dtype" can - // be set. The values hold the flattened representation of the tensor in - // row major order. - - // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll - // have some pointless zero padding for each value here. - repeated int32 half_val = 13 [packed = true]; - - // DT_FLOAT. - repeated float float_val = 5 [packed = true]; - - // DT_DOUBLE. - repeated double double_val = 6 [packed = true]; - - // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. - repeated int32 int_val = 7 [packed = true]; - - // DT_STRING - repeated bytes string_val = 8; - - // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real - // and imaginary parts of i-th single precision complex. - repeated float scomplex_val = 9 [packed = true]; - - // DT_INT64 - repeated int64 int64_val = 10 [packed = true]; - - // DT_BOOL - repeated bool bool_val = 11 [packed = true]; - - // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real - // and imaginary parts of i-th double precision complex. - repeated double dcomplex_val = 12 [packed = true]; - - // DT_RESOURCE - repeated ResourceHandleProto resource_handle_val = 14; - - // DT_VARIANT - repeated VariantTensorDataProto variant_val = 15; - - // DT_UINT32 - repeated uint32 uint32_val = 16 [packed = true]; - - // DT_UINT64 - repeated uint64 uint64_val = 17 [packed = true]; -}; - -// Protocol buffer representing the serialization format of DT_VARIANT tensors. -message VariantTensorDataProto { - // Name of the type of objects being serialized. - string type_name = 1; - // Portions of the object that are not Tensors. - bytes metadata = 2; - // Tensors contained within objects being serialized. - repeated TensorProto tensors = 3; -} diff --git a/ge/proto/tensorflow/tensor_shape.proto b/ge/proto/tensorflow/tensor_shape.proto deleted file mode 100644 index 3a6d8c5a..00000000 --- a/ge/proto/tensorflow/tensor_shape.proto +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -// Protocol buffer representing the shape of tensors. - -syntax = "proto3"; -option cc_enable_arenas = true; -option java_outer_classname = "TensorShapeProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -package domi.tensorflow; - -// Dimensions of a tensor. -message TensorShapeProto { - // One dimension of the tensor. - message Dim { - // Size of the tensor in that dimension. - // This value must be >= -1, but values of -1 are reserved for "unknown" - // shapes (values of -1 mean "unknown" dimension). Certain wrappers - // that work with TensorShapeProto may fail at runtime when deserializing - // a TensorShapeProto containing a dim value of -1. - int64 size = 1; - - // Optional name of the tensor dimension. - string name = 2; - }; - - // Dimensions of the tensor, such as {"input", 30}, {"output", 40} - // for a 30 x 40 2D tensor. If an entry has size -1, this - // corresponds to a dimension of unknown size. The names are - // optional. - // - // The order of entries in "dim" matters: It indicates the layout of the - // values in the tensor in-memory representation. - // - // The first entry in "dim" is the outermost dimension used to layout the - // values, the last entry is the innermost dimension. This matches the - // in-memory layout of RowMajor Eigen tensors. - // - // If "dim.size()" > 0, "unknown_rank" must be false. - repeated Dim dim = 2; - - // If true, the number of dimensions in the shape is unknown. - // - // If true, "dim.size()" must be 0. - bool unknown_rank = 3; -}; diff --git a/ge/proto/tensorflow/types.proto b/ge/proto/tensorflow/types.proto deleted file mode 100644 index f40e49cb..00000000 --- a/ge/proto/tensorflow/types.proto +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TypesProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// LINT.IfChange -enum DataType { - // Not a legal value for DataType. Used to indicate a DataType field - // has not been set. - DT_INVALID = 0; - - // Data types that all computation devices are expected to be - // capable to support. - DT_FLOAT = 1; - DT_DOUBLE = 2; - DT_INT32 = 3; - DT_UINT8 = 4; - DT_INT16 = 5; - DT_INT8 = 6; - DT_STRING = 7; - DT_COMPLEX64 = 8; // Single-precision complex - DT_INT64 = 9; - DT_BOOL = 10; - DT_QINT8 = 11; // Quantized int8 - DT_QUINT8 = 12; // Quantized uint8 - DT_QINT32 = 13; // Quantized int32 - DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. - DT_QINT16 = 15; // Quantized int16 - DT_QUINT16 = 16; // Quantized uint16 - DT_UINT16 = 17; - DT_COMPLEX128 = 18; // Double-precision complex - DT_HALF = 19; - DT_RESOURCE = 20; - DT_VARIANT = 21; // Arbitrary C++ data types - DT_UINT32 = 22; - DT_UINT64 = 23; - - // Do not use! These are only for parameters. Every enum above - // should have a corresponding value below (verified by types_test). - DT_FLOAT_REF = 101; - DT_DOUBLE_REF = 102; - DT_INT32_REF = 103; - DT_UINT8_REF = 104; - DT_INT16_REF = 105; - DT_INT8_REF = 106; - DT_STRING_REF = 107; - DT_COMPLEX64_REF = 108; - DT_INT64_REF = 109; - DT_BOOL_REF = 110; - DT_QINT8_REF = 111; - DT_QUINT8_REF = 112; - DT_QINT32_REF = 113; - DT_BFLOAT16_REF = 114; - DT_QINT16_REF = 115; - DT_QUINT16_REF = 116; - DT_UINT16_REF = 117; - DT_COMPLEX128_REF = 118; - DT_HALF_REF = 119; - DT_RESOURCE_REF = 120; - DT_VARIANT_REF = 121; - DT_UINT32_REF = 122; - DT_UINT64_REF = 123; -} -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/c/c_api.h, -// https://www.tensorflow.org/code/tensorflow/go/tensor.go, -// https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.h, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, -// https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, -// https://www.tensorflow.org/code/tensorflow/python/framework/function.py) diff --git a/ge/proto/tensorflow/versions.proto b/ge/proto/tensorflow/versions.proto deleted file mode 100644 index 4e81548f..00000000 --- a/ge/proto/tensorflow/versions.proto +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow - * - * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model. - * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications"). - * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd. - */ - -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "VersionsProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Version information for a piece of serialized data -// -// There are different types of versions for each type of data -// (GraphDef, etc.), but they all have the same common shape -// described here. -// -// Each consumer has "consumer" and "min_producer" versions (specified -// elsewhere). A consumer is allowed to consume this data if -// -// producer >= min_producer -// consumer >= min_consumer -// consumer not in bad_consumers -// -message VersionDef { - // The version of the code that produced this data. - int32 producer = 1; - - // Any consumer below this version is not allowed to consume this data. - int32 min_consumer = 2; - - // Specific consumer versions which are disallowed (e.g. due to bugs). - repeated int32 bad_consumers = 3; -}; From 18496bce86f7f55519b8c6bf5efd6b00ecb9a665 Mon Sep 17 00:00:00 2001 From: yskhhh Date: Thu, 17 Jun 2021 14:49:57 +0800 Subject: [PATCH 044/226] add debug task info --- .../node_executor/aicore/aicore_node_executor.cc | 6 +++ ge/hybrid/node_executor/aicore/aicore_op_task.h | 2 + ge/single_op/single_op.cc | 5 ++ ge/single_op/task/build_task_utils.cc | 54 ++++++++++++++++++++-- ge/single_op/task/build_task_utils.h | 8 ++++ ge/single_op/task/op_task.cc | 1 + ge/single_op/task/op_task.h | 2 + tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 31 +++++++++++++ tests/ut/ge/single_op/single_op_unittest.cc | 13 +++++- 9 files changed, 118 insertions(+), 4 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc index 7ebb9e39..efa864ed 100755 --- a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc +++ b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc @@ -18,6 +18,7 @@ #include "framework/common/taskdown_common.h" #include "hybrid/executor/hybrid_execution_context.h" #include "external/runtime/rt_error_codes.h" +#include "single_op/task/build_task_utils.h" namespace ge { namespace hybrid { @@ -196,6 +197,11 @@ Status AiCoreNodeTask::ExecuteAsync(TaskContext &context, std::function RECORD_EXECUTION_EVENT(context.GetExecutionContext(), context.GetNodeName(), "[AiCoreNodeLaunchKernel] Start"); GE_CHK_STATUS_RET_NOLOG((*it)->LaunchKernel(context.GetStream())); GE_CHK_STATUS_RET_NOLOG(CheckOverflow(context)); + GE_CHECK_NOTNULL(context.GetExecutionContext()->model); + GELOGD("[DEBUG_TASK_INFO : Executor Task] %s/%s %s", + context.GetExecutionContext()->model->GetModelName().c_str(), + (*it)->GetName().empty() ? (*it)->GetLogName().c_str() : (*it)->GetName().c_str(), + BuildTaskUtils::GetTaskInfo(context).c_str()); // save profiling data uint32_t task_id = 0; uint32_t stream_id = 0; diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index 8d7b7f1e..9db958d2 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -72,6 +72,8 @@ class AiCoreOpTask { const std::string& GetName() const; + const std::string& GetLogName() const {return log_name_;} + bool GetClearAtomic() const {return clear_atomic_;} uint32_t GetBlockDim() const {return block_dim_;} diff --git a/ge/single_op/single_op.cc b/ge/single_op/single_op.cc index d09e8398..fc34e513 100755 --- a/ge/single_op/single_op.cc +++ b/ge/single_op/single_op.cc @@ -297,6 +297,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status SingleOp::ExecuteAsync(c for (auto &task : tasks_) { ret = task->LaunchKernel(stream_); + GELOGD("[DEBUG_TASK_INFO : Static Task] %s %s", + task->GetTaskName().c_str(), + BuildTaskUtils::GetTaskInfo(task->GetOpdesc(), inputs, outputs).c_str()); if (ret != SUCCESS) { return ret; } @@ -447,6 +450,8 @@ Status DynamicSingleOp::ExecuteAsync(const vector &input_desc, } else { GE_CHK_STATUS_RET_NOLOG(op_task_->LaunchKernel(input_desc, input_buffers, output_desc, output_buffers, stream_)); } + GELOGD("[DEBUG_TASK_INFO : Dynamic Task] %s", + BuildTaskUtils::GetTaskInfo(op_task_->GetOpdesc(), input_buffers, output_buffers).c_str()); GE_CHK_STATUS_RET_NOLOG(op_task_->OpenDump(stream_)); GE_CHK_STATUS_RET_NOLOG(ProfilingTaskInfo(op_task_.get(), kShapeTypeDynamic)); return SUCCESS; diff --git a/ge/single_op/task/build_task_utils.cc b/ge/single_op/task/build_task_utils.cc index 9e4d55e1..b3a7ae09 100644 --- a/ge/single_op/task/build_task_utils.cc +++ b/ge/single_op/task/build_task_utils.cc @@ -70,7 +70,9 @@ std::vector BuildTaskUtils::GetKernelArgs(const OpDescPtr &op_desc, return JoinAddresses(addresses); } -std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc) { +std::string BuildTaskUtils::InnerGetTaskInfo(const OpDescPtr &op_desc, + const std::vector &input_addrs, + const std::vector &output_addrs) { std::stringstream ss; if (op_desc != nullptr) { auto op_type = op_desc->GetType(); @@ -87,7 +89,10 @@ std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc) { } ss << TypeUtils::DataTypeToSerialString(input->GetDataType()) << " "; ss << TypeUtils::FormatToSerialString(input->GetFormat()); - ss << VectorToString(input->GetShape().GetDims()); + ss << VectorToString(input->GetShape().GetDims()) << " "; + if (idx < input_addrs.size()) { + ss << input_addrs[idx]; + } if (idx < op_desc->GetInputsSize() - 1) { ss << ","; } @@ -101,7 +106,10 @@ std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc) { const GeShape &out_shape = output->GetShape(); const auto &dims = out_shape.GetDims(); ss << TypeUtils::FormatToSerialString(out_format); - ss << VectorToString(dims); + ss << VectorToString(dims) << " "; + if (idx < output_addrs.size()) { + ss << output_addrs[idx]; + } if (idx < op_desc->GetOutputsSize() - 1) { ss << ","; } @@ -110,4 +118,44 @@ std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc) { } return ss.str(); } + +std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc) { + vector input_addrs; + vector output_addrs; + return InnerGetTaskInfo(op_desc, input_addrs, output_addrs); +} + +std::string BuildTaskUtils::GetTaskInfo(const OpDescPtr &op_desc, + const std::vector &inputs, + const std::vector &outputs) { + vector input_addrs; + vector output_addrs; + GE_CHECK_NOTNULL_EXEC(op_desc, return ""); + if (op_desc->GetAllInputsSize() == inputs.size()) { + std::for_each(inputs.begin(), inputs.end(), [&](const DataBuffer &db) { input_addrs.push_back(db.data); }); + } + if (op_desc->GetOutputsSize() == outputs.size()) { + std::for_each(outputs.begin(), outputs.end(), [&](const DataBuffer &db) { output_addrs.push_back(db.data); }); + } + return InnerGetTaskInfo(op_desc, input_addrs, output_addrs); +} + +std::string BuildTaskUtils::GetTaskInfo(const hybrid::TaskContext &task_context) { + auto &node_item = task_context.GetNodeItem(); + auto op_desc = node_item.GetOpDesc(); + GE_CHECK_NOTNULL_EXEC(op_desc, return ""); + vector input_addrs; + vector output_addrs; + if (op_desc->GetAllInputsSize() == static_cast(task_context.NumInputs())) { + for (size_t i = 0; i < op_desc->GetAllInputsSize(); ++i) { + input_addrs.push_back(task_context.GetInput(i)->GetData()); + } + } + if (op_desc->GetOutputsSize() == static_cast(task_context.NumOutputs())) { + for (size_t i = 0; i < op_desc->GetOutputsSize(); ++i) { + output_addrs.push_back(task_context.GetOutput(i)->GetData()); + } + } + return InnerGetTaskInfo(op_desc, input_addrs, output_addrs); +} } // namespace ge diff --git a/ge/single_op/task/build_task_utils.h b/ge/single_op/task/build_task_utils.h index 7a2369e4..68894f5b 100644 --- a/ge/single_op/task/build_task_utils.h +++ b/ge/single_op/task/build_task_utils.h @@ -23,6 +23,7 @@ #include "graph/op_desc.h" #include "single_op/single_op.h" #include "single_op/single_op_model.h" +#include "hybrid/node_executor/task_context.h" namespace ge { class BuildTaskUtils { @@ -35,7 +36,14 @@ class BuildTaskUtils { bool keep_workspace = true); static std::vector JoinAddresses(const std::vector> &addresses); static std::vector GetKernelArgs(const OpDescPtr &op_desc, const SingleOpModelParam ¶m); + static std::string InnerGetTaskInfo(const OpDescPtr &op_desc, + const std::vector &input_addrs, + const std::vector &output_addrs); static std::string GetTaskInfo(const OpDescPtr &op_desc); + static std::string GetTaskInfo(const OpDescPtr &op_desc, + const std::vector &inputs, + const std::vector &outputs); + static std::string GetTaskInfo(const hybrid::TaskContext& task_context); template static std::string VectorToString(const std::vector &values) { std::stringstream ss; diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index e48677f8..02fc96f3 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -89,6 +89,7 @@ Status OpTask::OpenDump(rtStream_t stream) { void TbeOpTask::SetStubFunc(const std::string &name, const void *stub_func) { this->stub_name_ = name; this->stub_func_ = stub_func; + this->task_name_ = name; } void TbeOpTask::SetKernelArgs(std::unique_ptr &&args, size_t arg_size, uint32_t block_dim, diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index ed6cf40f..5efb4472 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -44,6 +44,7 @@ class OpTask { virtual Status UpdateArgTable(const SingleOpModelParam ¶m); void SetModelArgs(std::string model_name, uint32_t model_id); Status GetProfilingArgs(TaskDescInfo &task_desc_info, uint32_t &model_id); + const std::string &GetTaskName() const {return task_name_;} void SetOpDesc(const OpDescPtr &op_desc) { op_desc_ = op_desc; } @@ -66,6 +67,7 @@ class OpTask { std::string model_name_; uint32_t model_id_ = 0; uint32_t block_dim_ = 1; + std::string task_name_; }; class TbeOpTask : public OpTask { diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 228af832..24a60413 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -34,12 +34,14 @@ #include "hybrid/executor/hybrid_execution_context.h" #include "hybrid/executor/hybrid_model_executor.h" #include "hybrid/node_executor/aicore/aicore_task_builder.h" +#include "hybrid/node_executor/aicore/aicore_node_executor.h" #include "graph/load/model_manager/tbe_handle_store.h" #include "graph/manager/graph_mem_allocator.h" #include "hybrid/common/npu_memory_allocator.h" #include "graph/types.h" #include "graph/utils/tensor_utils.h" #include "graph/testcase/ge_graph/graph_builder_utils.h" +#include "single_op/task/build_task_utils.h" #include "graph/op_desc_impl.h" #undef private #undef protected @@ -746,4 +748,33 @@ TEST_F(UtestGeHybrid, TestParseDependencies) { AttrUtils::SetTensor(tensor_desc, "_value", tensor); std::set dependent_for_shape_inference; ASSERT_EQ(builder.ParseDependencies(*node_item, deps, dependent_for_shape_inference), SUCCESS); +} + +TEST_F(UtestGeHybrid, TestTaskExecuteAsync) { + 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->AddInputDesc(tensor_desc); + op_desc->AddOutputDesc(tensor_desc); + auto node = graph->AddNode(op_desc); + std::unique_ptr node_item; + NodeItem::Create(node, node_item); + node_item->input_start = 0; + node_item->output_start = 0; + + GraphExecutionContext execution_context; + GraphItem graph_item; + SubgraphContext subgraph_context(&graph_item, &execution_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); + subgraph_context.all_inputs_.resize(2); + subgraph_context.all_outputs_.resize(1); + auto node_state = subgraph_context.GetOrCreateNodeState(node_item.get()); + auto task_context = *node_state->GetTaskContext(); + ASSERT_NE(BuildTaskUtils::GetTaskInfo(task_context), ""); + std::unique_ptr task1(new AiCoreOpTask()); + std::vector> tasks; + AiCoreNodeTask node_task(std::move(tasks)); + ASSERT_EQ(node_task.ExecuteAsync(task_context, nullptr), SUCCESS); } \ No newline at end of file diff --git a/tests/ut/ge/single_op/single_op_unittest.cc b/tests/ut/ge/single_op/single_op_unittest.cc index db3de7ec..831f3f16 100644 --- a/tests/ut/ge/single_op/single_op_unittest.cc +++ b/tests/ut/ge/single_op/single_op_unittest.cc @@ -23,6 +23,7 @@ #define private public #include "single_op/single_op.h" #include "single_op/single_op_manager.h" +#include "single_op/task/build_task_utils.h" #undef private #undef protected @@ -126,9 +127,19 @@ TEST_F(UtestSingleOp, test_singleop_execute_async1) { SingleOpModelParam model_params; single_op.running_param_.reset(new (std::nothrow)SingleOpModelParam(model_params)); single_op.args_.resize(1); + + auto *tbe_task = new (std::nothrow) TbeOpTask(); + ge::OpDescPtr op_desc = std::make_shared("Mul", MATMUL); + EXPECT_EQ(op_desc->AddInputDesc("x", GeTensorDesc(GeShape({2}), FORMAT_NCHW)), GRAPH_SUCCESS); + EXPECT_EQ(op_desc->AddOutputDesc("x", GeTensorDesc(GeShape({2}), FORMAT_NCHW)), GRAPH_SUCCESS); + EXPECT_NE(BuildTaskUtils::GetTaskInfo(op_desc), ""); + ge::ComputeGraphPtr graph = std::make_shared("default"); + ge::NodePtr node = graph->AddNode(op_desc); + tbe_task->node_ = node; + tbe_task->op_desc_ = op_desc; + single_op.tasks_.push_back(tbe_task); EXPECT_EQ(single_op.hybrid_model_executor_, nullptr); EXPECT_EQ(single_op.running_param_->mem_base, nullptr); - EXPECT_EQ(single_op.tasks_.size(), 0); EXPECT_EQ(single_op.ExecuteAsync(input_buffers, output_buffers), SUCCESS); } From 9476853d22cfe73ed8270b9aa0890e96c9ebb70c Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 17 Jun 2021 14:51:39 +0800 Subject: [PATCH 045/226] Adaptation rectification of op_tiling. --- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 24 ++++++++++++------------ ge/hybrid/node_executor/aicore/aicore_op_task.h | 4 ++-- ge/single_op/task/op_task.cc | 13 ++++++------- metadef | 2 +- parser | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index 8cd24bd1..76082cb3 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -25,7 +25,7 @@ #include "single_op/task/build_task_utils.h" #include "single_op/task/tbe_task_builder.h" -using optiling::OpRunInfo; +using optiling::utils::OpRunInfo; namespace ge { namespace hybrid { @@ -359,9 +359,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { GE_CHECK_NOTNULL(op_desc); GELOGD("[%s] Start to update tiling info for task: [%s]", node->GetName().c_str(), stub_name_.c_str()); - OpRunInfo tiling_info; - tiling_info.block_dim = -1; // codex: Using uninitialized value - tiling_info.clear_atomic = true; + OpRunInfo tiling_info(-1, true, 0); auto execution_context = context.GetExecutionContext(); @@ -370,12 +368,14 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { RECORD_EXECUTION_EVENT(execution_context, context.GetNodeName(), "[CalcTilingInfo] End"); // update op args by tiling info - block_dim_ = static_cast(tiling_info.block_dim); - op_desc->SetWorkspaceBytes(tiling_info.workspaces); - clear_atomic_ = tiling_info.clear_atomic; - - tiling_data_ = tiling_info.tiling_data.str(); - tiling_key_ = tiling_info.tiling_key; + block_dim_ = tiling_info.GetBlockDim(); + clear_atomic_ = tiling_info.GetClearAtomic(); + std::vector workspaces; + tiling_info.GetAllWorkspaces(workspaces); + op_desc->SetWorkspaceBytes(workspaces); + + tiling_data_ = tiling_info.GetAllTilingData().str(); + tiling_key_ = tiling_info.GetTilingKey(); GELOGD("Successfully getting [tiling_key] : %u", tiling_key_); if (tiling_data_.empty()) { GELOGD("[%s] Tiling data is empty.", op_desc->GetName().c_str()); @@ -412,7 +412,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { Status AiCoreOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpParaCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(OpParaCalculate(*node, tiling_info), + GE_CHK_STATUS_RET(optiling::OpParaCalculateV2(*node, tiling_info), "[Invoke][OpParaCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpParaCalculate successfully.", node->GetName().c_str()); @@ -633,7 +633,7 @@ std::string AtomicAddrCleanOpTask::GetKeyForKernelName(const OpDesc &op_desc) co Status AtomicAddrCleanOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpAtomicCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(OpAtomicCalculate(*node, tiling_info), + GE_CHK_STATUS_RET(optiling::OpAtomicCalculateV2(*node, tiling_info), "[Invoke][OpAtomicCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpAtomicCalculate successfully.", node->GetName().c_str()); diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index 8d7b7f1e..3c8db8c9 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -85,7 +85,7 @@ class AiCoreOpTask { virtual std::string GetKeyForTvmMagic() const; virtual std::string GetKeyForTvmMetaData() const; virtual std::string GetKeyForKernelName(const OpDesc &op_desc) const; - virtual Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info); + virtual Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info); std::unique_ptr tiling_buffer_ = nullptr; std::string tiling_data_; @@ -130,7 +130,7 @@ class AtomicAddrCleanOpTask : public AiCoreOpTask { std::string GetKeyForTvmMagic() const override; std::string GetKeyForTvmMetaData() const override; std::string GetKeyForKernelName(const OpDesc &op_desc) const override; - Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info) override; + Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info) override; private: Status InitAtomicAddrCleanIndices(const OpDesc &op_desc); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index e48677f8..66d70e7e 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -224,18 +224,17 @@ Status TbeOpTask::LaunchKernel(rtStream_t stream) { Status TbeOpTask::UpdateRunInfo() { // invoke OpParaCalculate GELOGD("Start to invoke OpParaCalculate."); - optiling::OpRunInfo run_info; - run_info.block_dim = 0; - auto ret = optiling::OpParaCalculate(*node_, run_info); + optiling::utils::OpRunInfo run_info(0, true, 0); + auto ret = optiling::OpParaCalculateV2(*node_, run_info); if (ret != GRAPH_SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpParaCalculate] failed, ret = %u.", ret); REPORT_INNER_ERROR("E19999", "invoke OpParaCalculate failed, ret = %u.", ret); return ACL_ERROR_GE_INTERNAL_ERROR; } - block_dim_ = run_info.block_dim; - tiling_data_ = run_info.tiling_data.str(); - tiling_key_ = run_info.tiling_key; - run_info_workspaces_ = run_info.workspaces; + block_dim_ = run_info.GetBlockDim(); + tiling_data_ = run_info.GetAllTilingData().str(); + tiling_key_ = run_info.GetTilingKey(); + run_info.GetAllWorkspaces(run_info_workspaces_); GELOGD("Done invoking OpParaCalculate successfully. block_dim = %u, tiling size = %zu, tiling_key = %u", block_dim_, tiling_data_.size(), tiling_key_); return SUCCESS; diff --git a/metadef b/metadef index 8c5fd448..e189fc7f 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 8c5fd4486f870d8b63213565aa39fdf1ba1e497a +Subproject commit e189fc7f4da9f7714f009d70da4db627de17955d diff --git a/parser b/parser index 3073129b..db5ce472 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 3073129b68c0fae12a8b7531d60782e39128a28c +Subproject commit db5ce472de0086c3e2abdaab3b0685c1d2656c96 From bd1beee90c760f8d6a61b255bfa5c54a7939fd99 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 17 Jun 2021 15:41:02 +0800 Subject: [PATCH 046/226] Fix zip bug. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 96c46e1a..bd471c99 100755 --- a/build.sh +++ b/build.sh @@ -371,6 +371,6 @@ elif [ "X$MINDSPORE_MODE" = "Xon" ] then cd "${OUTPUT_PATH}" find ./ -name graphengine_lib.tar -exec rm {} \; - tar -cf graphengine_lib.tar lib + tar -zcf graphengine_lib.tar lib fi echo "---------------- GraphEngine package archive generated ----------------" From fd51637c46ac0b2518e43b884a426e016ee198a4 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 17 Jun 2021 15:44:03 +0800 Subject: [PATCH 047/226] Fix zip bug. --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index bd471c99..61f86945 100755 --- a/build.sh +++ b/build.sh @@ -355,13 +355,13 @@ generate_package() if [ "x${PLATFORM}" = "xtrain" ] then - tar -cf graphengine_lib.tar fwkacllib + tar -zcf graphengine_lib.tar fwkacllib elif [ "x${PLATFORM}" = "xinference" ] then - tar -cf graphengine_lib.tar acllib atc + tar -zcf graphengine_lib.tar acllib atc elif [ "x${PLATFORM}" = "xall" ] then - tar -cf graphengine_lib.tar fwkacllib acllib atc + tar -zcf graphengine_lib.tar fwkacllib acllib atc fi } From f840399fc3fe240952a00ed567210db7d779135e Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 17 Jun 2021 20:49:25 +0800 Subject: [PATCH 048/226] Aicpu single_op always dynamic execute. --- ge/single_op/task/op_task.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 66d70e7e..1bee6634 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -450,7 +450,6 @@ Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(ULLONG_MAX, kernel_id, false), "[Update][SessionInfo] failed."); - GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateExecuteMode(true), "[Update][ExecuteMode] failed."); GE_CHK_RT_RET(rtMalloc(&ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), RT_MEMORY_HBM)); GE_CHK_RT_RET(rtMemcpy(ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), From 6f130e22904dec2413815135520ce95f44d49f80 Mon Sep 17 00:00:00 2001 From: wangkai Date: Fri, 18 Jun 2021 10:37:55 +0800 Subject: [PATCH 049/226] add link header targets Signed-off-by: wangkai --- ge/common/CMakeLists.txt | 24 ++++++++++++++---------- ge/executor/CMakeLists.txt | 20 +++++++++++++------- 2 files changed, 27 insertions(+), 17 deletions(-) mode change 100644 => 100755 ge/executor/CMakeLists.txt diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 7974a46d..f55ff427 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -84,12 +84,11 @@ target_include_directories(ge_common PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### - ${GE_DEPEND_DIR}/inc - ${GE_DEPEND_DIR}/inc/cce + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### - #${GE_DEPEND_DIR}/include - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> ) target_link_options(ge_common PRIVATE @@ -98,6 +97,9 @@ target_link_options(ge_common PRIVATE target_link_libraries(ge_common PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> static_mmpa -Wl,--no-as-needed graph @@ -151,16 +153,18 @@ target_include_directories(ge_common_static PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### - ${GE_DEPEND_DIR}/inc - ${GE_DEPEND_DIR}/inc/cce + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### - #${GE_DEPEND_DIR}/include - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> ) target_link_libraries(ge_common_static PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> ascend_protobuf_static json c_sec diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt old mode 100644 new mode 100755 index b04216b8..b6342973 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -187,15 +187,18 @@ target_include_directories(ge_executor SYSTEM PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### - ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/cce + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> ) target_link_libraries(ge_executor PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> json ascend_protobuf_static c_sec @@ -238,10 +241,10 @@ target_include_directories(ge_executor_shared PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### - ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/cce + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### - ${GE_CODE_DIR}/third_party/fwkacllib/inc + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> ) target_link_options(ge_executor_shared PRIVATE @@ -251,6 +254,9 @@ target_link_options(ge_executor_shared PRIVATE target_link_libraries(ge_executor_shared PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> -Wl,--no-as-needed ge_common runtime From 676ce23b556e20d8f49eabccc25e3ab51bf8803a Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Fri, 18 Jun 2021 11:03:51 +0800 Subject: [PATCH 050/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?ls=20:=20Adaptation=20rectification=20of=20op=5Ftiling.'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 24 ++++++++++++------------ ge/hybrid/node_executor/aicore/aicore_op_task.h | 4 ++-- ge/single_op/task/op_task.cc | 13 +++++++------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index 76082cb3..8cd24bd1 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -25,7 +25,7 @@ #include "single_op/task/build_task_utils.h" #include "single_op/task/tbe_task_builder.h" -using optiling::utils::OpRunInfo; +using optiling::OpRunInfo; namespace ge { namespace hybrid { @@ -359,7 +359,9 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { GE_CHECK_NOTNULL(op_desc); GELOGD("[%s] Start to update tiling info for task: [%s]", node->GetName().c_str(), stub_name_.c_str()); - OpRunInfo tiling_info(-1, true, 0); + OpRunInfo tiling_info; + tiling_info.block_dim = -1; // codex: Using uninitialized value + tiling_info.clear_atomic = true; auto execution_context = context.GetExecutionContext(); @@ -368,14 +370,12 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { RECORD_EXECUTION_EVENT(execution_context, context.GetNodeName(), "[CalcTilingInfo] End"); // update op args by tiling info - block_dim_ = tiling_info.GetBlockDim(); - clear_atomic_ = tiling_info.GetClearAtomic(); - std::vector workspaces; - tiling_info.GetAllWorkspaces(workspaces); - op_desc->SetWorkspaceBytes(workspaces); - - tiling_data_ = tiling_info.GetAllTilingData().str(); - tiling_key_ = tiling_info.GetTilingKey(); + block_dim_ = static_cast(tiling_info.block_dim); + op_desc->SetWorkspaceBytes(tiling_info.workspaces); + clear_atomic_ = tiling_info.clear_atomic; + + tiling_data_ = tiling_info.tiling_data.str(); + tiling_key_ = tiling_info.tiling_key; GELOGD("Successfully getting [tiling_key] : %u", tiling_key_); if (tiling_data_.empty()) { GELOGD("[%s] Tiling data is empty.", op_desc->GetName().c_str()); @@ -412,7 +412,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { Status AiCoreOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpParaCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(optiling::OpParaCalculateV2(*node, tiling_info), + GE_CHK_STATUS_RET(OpParaCalculate(*node, tiling_info), "[Invoke][OpParaCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpParaCalculate successfully.", node->GetName().c_str()); @@ -633,7 +633,7 @@ std::string AtomicAddrCleanOpTask::GetKeyForKernelName(const OpDesc &op_desc) co Status AtomicAddrCleanOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpAtomicCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(optiling::OpAtomicCalculateV2(*node, tiling_info), + GE_CHK_STATUS_RET(OpAtomicCalculate(*node, tiling_info), "[Invoke][OpAtomicCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpAtomicCalculate successfully.", node->GetName().c_str()); diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index 3c8db8c9..8d7b7f1e 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -85,7 +85,7 @@ class AiCoreOpTask { virtual std::string GetKeyForTvmMagic() const; virtual std::string GetKeyForTvmMetaData() const; virtual std::string GetKeyForKernelName(const OpDesc &op_desc) const; - virtual Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info); + virtual Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info); std::unique_ptr tiling_buffer_ = nullptr; std::string tiling_data_; @@ -130,7 +130,7 @@ class AtomicAddrCleanOpTask : public AiCoreOpTask { std::string GetKeyForTvmMagic() const override; std::string GetKeyForTvmMetaData() const override; std::string GetKeyForKernelName(const OpDesc &op_desc) const override; - Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info) override; + Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info) override; private: Status InitAtomicAddrCleanIndices(const OpDesc &op_desc); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 66d70e7e..e48677f8 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -224,17 +224,18 @@ Status TbeOpTask::LaunchKernel(rtStream_t stream) { Status TbeOpTask::UpdateRunInfo() { // invoke OpParaCalculate GELOGD("Start to invoke OpParaCalculate."); - optiling::utils::OpRunInfo run_info(0, true, 0); - auto ret = optiling::OpParaCalculateV2(*node_, run_info); + optiling::OpRunInfo run_info; + run_info.block_dim = 0; + auto ret = optiling::OpParaCalculate(*node_, run_info); if (ret != GRAPH_SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpParaCalculate] failed, ret = %u.", ret); REPORT_INNER_ERROR("E19999", "invoke OpParaCalculate failed, ret = %u.", ret); return ACL_ERROR_GE_INTERNAL_ERROR; } - block_dim_ = run_info.GetBlockDim(); - tiling_data_ = run_info.GetAllTilingData().str(); - tiling_key_ = run_info.GetTilingKey(); - run_info.GetAllWorkspaces(run_info_workspaces_); + block_dim_ = run_info.block_dim; + tiling_data_ = run_info.tiling_data.str(); + tiling_key_ = run_info.tiling_key; + run_info_workspaces_ = run_info.workspaces; GELOGD("Done invoking OpParaCalculate successfully. block_dim = %u, tiling size = %zu, tiling_key = %u", block_dim_, tiling_data_.size(), tiling_key_); return SUCCESS; From e2741096ad309785b713f9613a1a2266b4d2faf6 Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Fri, 18 Jun 2021 16:39:55 +0800 Subject: [PATCH 051/226] delete repeat code --- ge/hybrid/executor/hybrid_model_async_executor.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index 930412e3..63e48c92 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -78,8 +78,6 @@ Status HybridModelAsyncExecutor::Start(const std::shared_ptr &lis GetThreadLocalContext() = *executor_->GetContext()->ge_context; GetContext().SetSessionId(executor_->GetContext()->session_id); GetContext().SetContextId(executor_->GetContext()->context_id); - GE_CHECK_NOTNULL(executor_->GetContext()->ge_context); - GetThreadLocalContext() = *executor_->GetContext()->ge_context; return RunInternal(); }); From c2a1076a8734a5dbb80f5336ee9bcd8b21bec817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=A8=E6=98=9F?= Date: Sat, 19 Jun 2021 15:15:51 +0800 Subject: [PATCH 052/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!1784=20:=20Create=20NodeExecute=20on-demand'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/hybrid/node_executor/node_executor.cc | 75 ++++++++------- ge/hybrid/node_executor/node_executor.h | 7 +- tests/ut/ge/CMakeLists.txt | 2 - .../hybrid/node_executor/node_executor_unittest.cc | 103 --------------------- 4 files changed, 44 insertions(+), 143 deletions(-) delete mode 100644 tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index 04225557..5f3d6e45 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -58,8 +58,8 @@ Status NodeExecutor::CompileTask(const HybridModel &model, const NodePtr &node, } Status NodeExecutorManager::EnsureInitialized() { + GE_CHK_STATUS_RET(InitializeExecutors()); std::lock_guard lk(mu_); - ++ref_count_; if (initialized_) { return SUCCESS; } @@ -115,14 +115,17 @@ NodeExecutorManager::ExecutorType NodeExecutorManager::ResolveExecutorType(Node return it->second; } -Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) { +Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) const { auto executor_type = ResolveExecutorType(node); - GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); const auto it = executors_.find(executor_type); if (it == executors_.end()) { - return GetOrCreateExecutor(executor_type, executor); + REPORT_INNER_ERROR("E19999", "Failed to get executor by type: %d.", static_cast(executor_type)); + GELOGE(INTERNAL_ERROR, "[Check][ExecutorType]Failed to get executor by type: %d.", + static_cast(executor_type)); + return INTERNAL_ERROR; } + GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); *executor = it->second.get(); return SUCCESS; } @@ -175,50 +178,51 @@ Status NodeExecutorManager::CalcOpRunningParam(Node &node) const { return OpsKernelBuilderManager::Instance().CalcOpRunningParam(node); } -Status NodeExecutorManager::GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **out_executor) { +Status NodeExecutorManager::InitializeExecutors() { std::lock_guard lk(mu_); - const auto executor_it = executors_.find(executor_type); - if (executor_it != executors_.end()) { - *out_executor = executor_it->second.get(); + if (executor_initialized_) { + ++ref_count_; + GELOGI("Executor is already initialized. add ref count to [%d]", ref_count_); return SUCCESS; } - GELOGI("Start to Initialize NodeExecutor, type = %d", static_cast(executor_type)); - auto it = builders_.find(executor_type); - if (it == builders_.end()) { - REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", - static_cast(executor_type)); - GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for executor type = %d", static_cast(executor_type)); - return INTERNAL_ERROR; - } + GELOGI("Start to Initialize NodeExecutors"); + for (auto &it : builders_) { + auto engine_type = it.first; + auto build_fn = it.second; + GE_CHECK_NOTNULL(build_fn); + auto executor = std::unique_ptr(build_fn()); + if (executor == nullptr) { + REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for engine type = %d", + static_cast(engine_type)); + GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(engine_type)); + return INTERNAL_ERROR; + } - auto build_fn = it->second; - GE_CHECK_NOTNULL(build_fn); - auto executor = std::unique_ptr(build_fn()); - if (executor == nullptr) { - REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", - static_cast(executor_type)); - GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(executor_type)); - return INTERNAL_ERROR; - } + GELOGD("Executor of engine type = %d was created successfully", static_cast(engine_type)); + auto ret = executor->Initialize(); + if (ret != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(engine_type)); + GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(engine_type)); + for (auto &executor_it : executors_) { + executor_it.second->Finalize(); + } + executors_.clear(); + return ret; + } - GELOGD("Executor of engine type = %d was created successfully", static_cast(executor_type)); - auto ret = executor->Initialize(); - if (ret != SUCCESS) { - REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(executor_type)); - GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(executor_type)); - return ret; + executors_.emplace(engine_type, std::move(executor)); } - *out_executor = executor.get(); - executors_.emplace(executor_type, std::move(executor)); - GELOGI("Initializing NodeExecutor successfully, type = %d", static_cast(executor_type)); + ++ref_count_; + executor_initialized_ = true; + GELOGI("Initializing NodeExecutors successfully."); return SUCCESS; } void NodeExecutorManager::FinalizeExecutors() { std::lock_guard lk(mu_); - if (ref_count_ <= 0) { + if (!executor_initialized_) { GELOGD("No need for finalizing for not initialized."); return; } @@ -233,6 +237,7 @@ void NodeExecutorManager::FinalizeExecutors() { it.second->Finalize(); } executors_.clear(); + executor_initialized_ = false; GELOGD("Done invoking Finalize successfully."); } diff --git a/ge/hybrid/node_executor/node_executor.h b/ge/hybrid/node_executor/node_executor.h index 97c9cee9..fffd4e7d 100644 --- a/ge/hybrid/node_executor/node_executor.h +++ b/ge/hybrid/node_executor/node_executor.h @@ -179,6 +179,8 @@ class NodeExecutorManager { */ Status EnsureInitialized(); + Status InitializeExecutors(); + void FinalizeExecutors(); /** @@ -194,7 +196,7 @@ class NodeExecutorManager { * @param executor executor * @return SUCCESS on success, error code otherwise */ - Status GetExecutor(Node &node, const NodeExecutor **executor); + Status GetExecutor(Node &node, const NodeExecutor **executor) const; /** * Resolve executor type by node @@ -204,13 +206,12 @@ class NodeExecutorManager { ExecutorType ResolveExecutorType(Node &node) const; private: - Status GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **executor); - std::map> executors_; std::map> builders_; std::map engine_mapping_; std::mutex mu_; bool initialized_ = false; + bool executor_initialized_ = false; int ref_count_ = 0; }; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 631e18f8..8b024820 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -839,7 +839,6 @@ set(HYBRID_TEST_FILES "hybrid/executor/subgraph_executor_unittest.cc" "hybrid/executor/worker/execution_engine_unittest.cc" "hybrid/model/hybrid_model_builder_unittest.cc" - "hybrid/node_executor/node_executor_unittest.cc" "hybrid/node_executor/rts/rts_node_task_unittest.cc" "hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc" "hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc" @@ -847,7 +846,6 @@ set(HYBRID_TEST_FILES "hybrid/executor/hybrid_model_async_executor_unittest.cc" "hybrid/executor/hybrid_model_pipeline_executor_unittest.cc" "hybrid/node_executor/aicore/aicore_task_compiler_unittest.cc" - ) set(OTHERS_TEST_FILES diff --git a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc deleted file mode 100644 index 8a1240d3..00000000 --- a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc +++ /dev/null @@ -1,103 +0,0 @@ -/** - * 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 - -#define private public -#define protected public -#include "hybrid/node_executor/node_executor.h" -#undef protected -#undef private - -using namespace std; -using namespace testing; - -namespace ge { -using namespace hybrid; - -namespace { - bool finalized = false; -} - -class NodeExecutorTest : public testing::Test { - protected: - void SetUp() {} - void TearDown() { } -}; - -class FailureNodeExecutor : public NodeExecutor { - public: - Status Initialize() override { - return INTERNAL_ERROR; - } -}; - -class SuccessNodeExecutor : public NodeExecutor { - public: - Status Initialize() override { - initialized = true; - finalized = false; - return SUCCESS; - } - - Status Finalize() override { - finalized = true; - } - - bool initialized = false; -}; - -REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICORE, FailureNodeExecutor); -REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICPU_TF, SuccessNodeExecutor); - -TEST_F(NodeExecutorTest, TestGetOrCreateExecutor) { - auto &manager = NodeExecutorManager::GetInstance(); - const NodeExecutor *executor = nullptr; - Status ret = SUCCESS; - // no builder - ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::RESERVED, &executor); - ASSERT_EQ(ret, INTERNAL_ERROR); - // initialize failure - ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICORE, &executor); - ASSERT_EQ(ret, INTERNAL_ERROR); - ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); - ASSERT_EQ(ret, SUCCESS); - ASSERT_TRUE(executor != nullptr); - ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); - ASSERT_EQ(ret, SUCCESS); - ASSERT_TRUE(executor != nullptr); - ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); -} - -TEST_F(NodeExecutorTest, TestInitAndFinalize) { - auto &manager = NodeExecutorManager::GetInstance(); - manager.FinalizeExecutors(); - manager.EnsureInitialized(); - manager.EnsureInitialized(); - const NodeExecutor *executor = nullptr; - auto ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); - ASSERT_EQ(ret, SUCCESS); - ASSERT_TRUE(executor != nullptr); - ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); - manager.FinalizeExecutors(); - ASSERT_FALSE(manager.executors_.empty()); - manager.FinalizeExecutors(); - ASSERT_TRUE(manager.executors_.empty()); - ASSERT_TRUE(finalized); -} -} // namespace ge From 0b04317d23e4405c93a1eb2f5e80925fae758523 Mon Sep 17 00:00:00 2001 From: wangxiaotian22 Date: Tue, 15 Jun 2021 21:08:33 +0800 Subject: [PATCH 053/226] fix cmetric --- ge/common/util.cc | 82 +++++++--------------- ge/graph/load/model_manager/davinci_model.cc | 4 +- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 2 +- ge/hybrid/node_executor/hccl/hccl_node_executor.cc | 3 +- ge/ir_build/option_utils.cc | 2 +- ge/offline/main.cc | 3 +- tests/depends/mmpa/src/mmpa_stub.cc | 7 ++ tests/ut/ge/CMakeLists.txt | 1 + tests/ut/ge/common/util_unittest.cc | 63 +++++++++++++++++ tests/ut/ge/graph/load/davinci_model_unittest.cc | 3 + tests/ut/ge/graph_ir/ge_ir_build_unittest.cc | 9 ++- 11 files changed, 115 insertions(+), 64 deletions(-) create mode 100644 tests/ut/ge/common/util_unittest.cc diff --git a/ge/common/util.cc b/ge/common/util.cc index 448efc0f..dfb5bac4 100644 --- a/ge/common/util.cc +++ b/ge/common/util.cc @@ -340,15 +340,24 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string RealPath(const char return res; } +void PathValidErrReport(const std::string &file_path, const std::string &atc_param, const std::string &reason) { + if (!atc_param.empty()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({atc_param, file_path, reason})); + } else { + REPORT_INNER_ERROR("E19999", "Path[%s] invalid, reason:%s", file_path.c_str(), reason.c_str()); + } +} + FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInputPathValid(const std::string &file_path, const std::string &atc_param) { // The specified path is empty std::map args_map; if (file_path.empty()) { - if (atc_param != "") { - ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {atc_param}); + if (!atc_param.empty()) { + REPORT_INPUT_ERROR("E10004", std::vector({"parameter"}), std::vector({atc_param})); } else { - REPORT_INNER_ERROR("E19999", "Param file_path is empty, check invalid"); + REPORT_INNER_ERROR("E19999", "Param file_path is empty, check invalid."); } GELOGW("Input parameter %s is empty.", file_path.c_str()); return false; @@ -356,13 +365,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInputPathValid(const std::string real_path = RealPath(file_path.c_str()); // Unable to get absolute path (does not exist or does not have permission to access) if (real_path.empty()) { - if (atc_param != "") { - std::string reason = "realpath error, errmsg:" + std::string(strerror(errno)); - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, reason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s]'s realpath is empty, errmsg[%s]", file_path.c_str(), strerror(errno)); - } + std::string reason = "realpath error, errmsg:" + std::string(strerror(errno)); + PathValidErrReport(file_path, atc_param, reason); GELOGW("Path[%s]'s realpath is empty, errmsg[%s]", file_path.c_str(), strerror(errno)); return false; } @@ -378,23 +382,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInputPathValid(const GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( !ValidateStr(real_path, mode), - if (atc_param != "") { - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, real_path, kPathValidReason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] has invalid char, %s", file_path.c_str(), kPathValidReason); - } + PathValidErrReport(file_path, atc_param, kPathValidReason); return false, "Invalid value for %s[%s], %s.", atc_param.c_str(), real_path.c_str(), kPathValidReason); // The absolute path points to a file that is not readable if (mmAccess2(real_path.c_str(), M_R_OK) != EN_OK) { - if (atc_param != "") { - std::string reason = "cat not access, errmsg:" + std::string(strerror(errno)); - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, reason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] can't acccess, errmsg:%s", file_path.c_str(), strerror(errno)); - } + PathValidErrReport(file_path, atc_param, "cat not access, errmsg:" + std::string(strerror(errno))); GELOGW("Read file[%s] failed, errmsg[%s]", file_path.c_str(), strerror(errno)); return false; } @@ -406,10 +399,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const const std::string &atc_param) { // The specified path is empty if (file_path.empty()) { - if (atc_param != "") { - ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {atc_param}); + if (!atc_param.empty()) { + REPORT_INPUT_ERROR("E10004", std::vector({"parameter"}), std::vector({atc_param})); } else { - REPORT_INNER_ERROR("E19999", "Param file_path is empty, check invalid"); + REPORT_INNER_ERROR("E19999", "Param file_path is empty, check invalid."); } ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {atc_param}); GELOGW("Input parameter's value is empty."); @@ -417,17 +410,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const } GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(strlen(file_path.c_str()) >= MMPA_MAX_PATH, - if (atc_param != "") { - std::string reason = "len is too long, it must be less than " + - std::to_string(MMPA_MAX_PATH); - ErrorManager::GetInstance().ATCReportErrMessage( - "E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, reason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] len is too long, it must be less than %d", - file_path.c_str(), MMPA_MAX_PATH); - } - return "", "Path[%s] len is too long, it must be less than %d", file_path.c_str(), + std::string reason = "len is too long, it must be less than " + + std::to_string(MMPA_MAX_PATH); + PathValidErrReport(file_path, atc_param, reason); + return false, "Path[%s] len is too long, it must be less than %d", file_path.c_str(), MMPA_MAX_PATH); // A regular matching expression to verify the validity of the input file path @@ -441,12 +427,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( !ValidateStr(file_path, mode), - if (atc_param != "") { - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, kPathValidReason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] has invalid char, %s", file_path.c_str(), kPathValidReason); - } + PathValidErrReport(file_path, atc_param, kPathValidReason); return false, "Invalid value for %s[%s], %s.", atc_param.c_str(), file_path.c_str(), kPathValidReason); std::string real_path = RealPath(file_path.c_str()); @@ -454,13 +435,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const if (!real_path.empty()) { // File is not readable or writable if (mmAccess2(real_path.c_str(), M_W_OK | M_F_OK) != EN_OK) { - if (atc_param != "") { - std::string reason = "cat not access, errmsg:" + std::string(strerror(errno)); - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, reason}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] can't acccess, errmsg:%s", file_path.c_str(), strerror(errno)); - } + PathValidErrReport(file_path, atc_param, "cat not access, errmsg:" + std::string(strerror(errno))); GELOGW("Write file[%s] failed, errmsg[%s]", real_path.c_str(), strerror(errno)); return false; } @@ -479,12 +454,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const std::string prefix_path = std::string(file_path).substr(0, static_cast(path_split_pos)); // Determine whether the specified path is valid by creating the path if (CreateDirectory(prefix_path) != 0) { - if (atc_param != "") { - ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, - {atc_param, file_path, "Can not create directory"}); - } else { - REPORT_INNER_ERROR("E19999", "Path[%s] Can not create directory", file_path.c_str()); - } + PathValidErrReport(file_path, atc_param, "Can not create directory"); GELOGW("Can not create directory[%s].", file_path.c_str()); return false; } diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 5b67c205..929ae158 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3463,11 +3463,11 @@ bool DavinciModel::CheckUserAndModelSize(const int64_t &size, const int64_t &op_ } // The input and model input size can not be exactly equal because user input is not definite. if ((size + kDataMemAlignSizeCompare) < op_size) { - REPORT_INNER_ERROR("E19999", "%s size:%ld from user add align:%u < input_op_size:%ld in model, model_id:%u, " + REPORT_INNER_ERROR("E19999", "%s size:%ld from user add align:%u < op_size:%ld in model, model_id:%u, " "check invalid", input_or_output.c_str(), size, kDataMemAlignSizeCompare, op_size, model_id_); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "[Check][Param] %s size:%ld from user add align:%u < input_op_size:%ld in model, model_id:%u", + "[Check][Param] %s size:%ld from user add align:%u < op_size:%ld in model, model_id:%u", input_or_output.c_str(), size, kDataMemAlignSizeCompare, op_size, model_id_); return false; } diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 5c191af7..2ea41b01 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -114,7 +114,7 @@ Status GetDataDimN(const ge::NodePtr &data_node, ge::Format format, int64_t &bat std::vector({ data_node->GetName() + " format", TypeUtils::FormatToSerialString(format), - "only format " + TypeUtils::FormatToSerialString(FORMAT_NCHW) + " and "+ + "only format " + TypeUtils::FormatToSerialString(FORMAT_NCHW) + " and " + TypeUtils::FormatToSerialString(FORMAT_NHWC) + " supported which dynamic aipp is linked"})); GELOGE(PARAM_INVALID, "[Check][Param] Not support data format:%s, node:%s", diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc index 72092cd8..d942695e 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc @@ -24,6 +24,7 @@ #include "graph/types.h" #include "hybrid/executor/hybrid_execution_context.h" #include "hccl/hcom.h" +#include "runtime/event.h" namespace ge { namespace { @@ -325,7 +326,7 @@ Status RdmaNodeTask::ExecuteAsync(TaskContext &context, std::function do rtEvent_t evt = nullptr; if (context.GetExecutionContext()->hccl_stream != nullptr) { - GE_CHK_RT_RET(rtEventCreateWithFlag(&evt, 0x01)); + GE_CHK_RT_RET(rtEventCreateWithFlag(&evt, RT_EVENT_WITH_FLAG)); GE_CHK_RT_RET(rtStreamWaitEvent(context.GetExecutionContext()->hccl_stream, evt)); } TaskContext *p_ctx = &context; diff --git a/ge/ir_build/option_utils.cc b/ge/ir_build/option_utils.cc index cecc2588..e2b08495 100755 --- a/ge/ir_build/option_utils.cc +++ b/ge/ir_build/option_utils.cc @@ -204,7 +204,7 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] input_format [%s] invalid, can not support now.", input_format.c_str()); - REPORT_INPUT_ERROR("E10003", std::vector({"parameter","value","reason"}), + REPORT_INPUT_ERROR("E10003", std::vector({"parameter", "value", "reason"}), std::vector({"input_format", input_format, "this format is not support"})); return false; } diff --git a/ge/offline/main.cc b/ge/offline/main.cc index a1ae476b..14db1ded 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -953,8 +953,7 @@ domi::Status GenerateModel(std::map &options, std::string output ge::Model load_model = ge::Model("loadmodel", "version2"); auto ret1 = load_model.LoadFromFile(FLAGS_model); if (ret1 != ge::GRAPH_SUCCESS) { - REPORT_INPUT_ERROR("E10041", std::vector({"file"}), std::vector({FLAGS_model})); - REPORT_CALL_ERROR("E19999", "load from model file:%s failed", FLAGS_model.c_str()); + REPORT_INPUT_ERROR("E10041", std::vector({"parameter"}), std::vector({FLAGS_model})); DOMI_LOGE("Load model from %s failed, please check model file or " "input parameter[--framework] is correct", FLAGS_model.c_str()); (void)ge_generator.Finalize(); diff --git a/tests/depends/mmpa/src/mmpa_stub.cc b/tests/depends/mmpa/src/mmpa_stub.cc index a82621ef..aae8de9f 100644 --- a/tests/depends/mmpa/src/mmpa_stub.cc +++ b/tests/depends/mmpa/src/mmpa_stub.cc @@ -220,6 +220,13 @@ VOID mmScandirFree(mmDirent **entryList, INT32 count) INT32 mmAccess2(const CHAR *pathName, INT32 mode) { + if (pathName == NULL) { + return EN_INVALID_PARAM; + } + INT32 ret = access(pathName, mode); + if (ret != EN_OK) { + return EN_ERROR; + } return 0; } diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 63579109..b820e465 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -761,6 +761,7 @@ set(MULTI_PARTS_TEST_FILES "graph_ir/ge_ir_build_unittest.cc" "graph/transop_util_unittest.cc" "common/datatype_transfer_unittest.cc" + "common/util_unittest.cc" "common/dump_manager_unittest.cc" "common/dump_op_unittest.cc" "common/dump_exception_unittest.cc" diff --git a/tests/ut/ge/common/util_unittest.cc b/tests/ut/ge/common/util_unittest.cc new file mode 100644 index 00000000..6df3db96 --- /dev/null +++ b/tests/ut/ge/common/util_unittest.cc @@ -0,0 +1,63 @@ +/** + * 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 "common/util.h" + +namespace ge { +namespace formats { +class UtestUtilTransfer : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + + +INT32 mmAccess2(const CHAR *pathName, INT32 mode) +{ + return -1; +} + +TEST_F(UtestUtilTransfer, CheckOutputPathValid) { + EXPECT_EQ(CheckOutputPathValid("", ""), false); + EXPECT_EQ(CheckOutputPathValid("", "model"), false); + + char max_file_path[14097] = {0}; + memset(max_file_path, 1, 14097); + EXPECT_EQ(CheckOutputPathValid(max_file_path, "model"), false); + + EXPECT_EQ(CheckOutputPathValid("$#%", ""), false); + + // system("touch test_util"); + // system("chmod 555 test_util"); + // EXPECT_EQ(CheckOutputPathValid("./test_util", ""), false); + // system("rm -r test_util"); +} + +TEST_F(UtestUtilTransfer, CheckInputPathValid) { + EXPECT_EQ(CheckInputPathValid("", ""), false); + EXPECT_EQ(CheckInputPathValid("", "model"), false); + + EXPECT_EQ(CheckInputPathValid("$#%", ""), false); + + EXPECT_EQ(CheckInputPathValid("./test_util", ""), false); + +} + +} +} + diff --git a/tests/ut/ge/graph/load/davinci_model_unittest.cc b/tests/ut/ge/graph/load/davinci_model_unittest.cc index 3f9cc850..378f2f07 100644 --- a/tests/ut/ge/graph/load/davinci_model_unittest.cc +++ b/tests/ut/ge/graph/load/davinci_model_unittest.cc @@ -1035,6 +1035,9 @@ TEST_F(UtestDavinciModel, NnExecute) { ProfilingManager::Instance().device_id_.emplace_back(0); model.task_list_.resize(1); EXPECT_EQ(model.NnExecute(stream, false, input_data, output_data), SUCCESS); + + input_data.blobs[0].length = 128; + EXPECT_NE(model.NnExecute(stream, false, input_data, output_data), SUCCESS); } TEST_F(UtestDavinciModel, update_io_addr_success) { DavinciModel model(0, nullptr); 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 e14178d8..047c9e1d 100644 --- a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc +++ b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc @@ -368,7 +368,14 @@ TEST(UtestIrBuild, check_modify_mixlist_param) { {"ge.exec.modify_mixlist", "/modify.json"} }; ModelBufferData model; - + auto ret = aclgrphBuildModel(graph, build_options, model); EXPECT_EQ(ret, GRAPH_PARAM_INVALID); +} + +TEST(UtestIrCommon, check_dynamic_imagesize_input_shape_valid_format_empty) { + std::map> shape_map; + std::string dynamic_image_size = ""; + bool ret = CheckDynamicImagesizeInputShapeValid(shape_map, "123", dynamic_image_size); + EXPECT_EQ(ret, false); } \ No newline at end of file From 1942c5e74e506f6da8e119186cc4ef7921b3761f Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 21 Jun 2021 11:37:17 +0800 Subject: [PATCH 054/226] Fix bug of single_op kernel bin register. --- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index 76082cb3..95877181 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -81,7 +81,7 @@ Status AiCoreOpTask::Init(const OpDesc &op_desc, const domi::TaskDef &task_def) Status AiCoreOpTask::RegisterTbeHandle(const OpDesc &op_desc) { rtError_t rt_ret = rtQueryFunctionRegistered(stub_name_.c_str()); - if (rt_ret != RT_ERROR_NONE || is_single_op_) { + if (rt_ret != RT_ERROR_NONE) { auto op_desc_ptr = MakeShared(op_desc); GE_CHECK_NOTNULL(op_desc_ptr); auto tbe_kernel = op_desc_ptr->TryGetExtAttr(GetKeyForTbeKernel(), TBEKernelPtr()); @@ -194,7 +194,7 @@ Status AiCoreOpTask::RegisterKernelHandle(const OpDesc &op_desc) { Status AiCoreOpTask::InitWithKernelDef(const OpDesc &op_desc, const domi::TaskDef &task_def) { const domi::KernelDef &kernel_def = task_def.kernel(); const domi::KernelContext &context = kernel_def.context(); - stub_name_ = kernel_def.stub_func(); + stub_name_ = is_single_op_ ? to_string(log_id_) + kernel_def.stub_func() : kernel_def.stub_func(); GE_CHK_STATUS_RET(RegisterTbeHandle(op_desc)); GE_CHK_RT_RET(rtGetFunctionByName(stub_name_.c_str(), &stub_func_)); args_size_ = kernel_def.args_size(); From 7337be63533554bb571a2d56a73b5b6d37c78eba Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 21 Jun 2021 14:56:16 +0800 Subject: [PATCH 055/226] Refersh arg addr in aicpu node executor. --- ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc index c2ebf654..c83a76d1 100755 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc @@ -64,10 +64,6 @@ Status AicpuNodeTaskBase::InitExtInfo(const std::string &kernel_ext_info, int64_ GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateSessionInfoSessionId(session_id), "[Update][SessionInfoSessionId] failed, session_id:%ld.", session_id); - bool execute_mode = !aicpu_ext_handle_.IsNeedRefreshIOAddr() && !node_item_->is_dynamic; - GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateExecuteMode(execute_mode), - "[Update][ExecuteMode] failed, node:%s.", node_name_.c_str()); - // copy task args buf GE_CHK_STATUS_RET(AllocTensorBuffer(aicpu_ext_handle_.GetExtInfoLen(), ext_info_addr_dev_), "[Invoke][AllocTensorBuffer]Node[%s] alloc kernel_ext_info buf failed, size=%zu", From b01ce212e745795f6b8ba52df549bc905c5c6376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Sat, 19 Jun 2021 11:08:02 +0800 Subject: [PATCH 056/226] opt info --- CMakeLists.txt | 1 + ge/common/CMakeLists.txt | 8 ++ ge/common/ge_opt_info.cc | 58 ++++++++++++ ge/common/ge_opt_info.h | 31 +++++++ ge/graph/manager/graph_manager.cc | 9 +- tests/CMakeLists.txt | 1 + tests/depends/opt_info/CMakeLists.txt | 37 ++++++++ tests/depends/opt_info/src/opt_info_stub.cc | 46 ++++++++++ tests/framework/cmake/graphengine.cmake | 2 + tests/st/testcase/test_ge_opt_info.cc | 123 ++++++++++++++++++++++++++ tests/ut/ge/CMakeLists.txt | 4 + tests/ut/ge/common/ge_opt_info_unittest.cc | 82 +++++++++++++++++ third_party/fwkacllib/inc/opt_info/opt_info.h | 34 +++++++ 13 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 ge/common/ge_opt_info.cc create mode 100644 ge/common/ge_opt_info.h create mode 100644 tests/depends/opt_info/CMakeLists.txt create mode 100644 tests/depends/opt_info/src/opt_info_stub.cc create mode 100644 tests/st/testcase/test_ge_opt_info.cc create mode 100644 tests/ut/ge/common/ge_opt_info_unittest.cc create mode 100644 third_party/fwkacllib/inc/opt_info/opt_info.h diff --git a/CMakeLists.txt b/CMakeLists.txt index bed5b995..77a759ba 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) + find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index f55ff427..91f3b27d 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -43,6 +43,7 @@ set(SRC_LIST "op/ge_op_utils.cc" "thread_pool.cc" "ge/tbe_plugin_manager.cc" + "ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL) @@ -86,9 +87,11 @@ target_include_directories(ge_common PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> + $<$>:${GE_DEPEND_DIR}../abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_options(ge_common PRIVATE @@ -108,6 +111,7 @@ target_link_libraries(ge_common PRIVATE c_sec error_manager slog + opt_feature -Wl,--as-needed json $<$>:-lrt> @@ -155,9 +159,11 @@ target_include_directories(ge_common_static PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> + $<$>:${GE_DEPEND_DIR}/../abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_libraries(ge_common_static PRIVATE @@ -213,6 +219,7 @@ target_include_directories(ge_common PRIVATE ${CMAKE_BINARY_DIR}/proto/graphengine_protos ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_common PRIVATE @@ -228,6 +235,7 @@ target_link_libraries(ge_common PRIVATE c_sec error_manager slog + opt_feature static_mmpa -Wl,--as-needed json diff --git a/ge/common/ge_opt_info.cc b/ge/common/ge_opt_info.cc new file mode 100644 index 00000000..c6bac480 --- /dev/null +++ b/ge/common/ge_opt_info.cc @@ -0,0 +1,58 @@ +/** + * 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 "common/ge_opt_info.h" + +#include +#include +#include "graph/ge_local_context.h" +#include "ge/ge_api_types.h" +#include "common/debug/ge_log.h" +#include "opt_info.h" + +namespace ge { +Status GeOptInfo::SetOptInfo() { + std::string soc_ver; + graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get soc version failed."); + GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); + return FAILED; + } + GELOGD("Soc version:%s.", soc_ver.c_str()); + std::map opt_info; + // the first arg does not work at present. + if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + return FAILED; + } + // do nothing if get empty information + if (opt_info.empty()) { + GELOGI("Optional information is empty."); + return SUCCESS; + } + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + for (const auto &itr : opt_info) { + graph_options.emplace(itr.first, itr.second); + GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); + } + GetThreadLocalContext().SetGraphOption(graph_options); + return SUCCESS; +} +} // namespace ge diff --git a/ge/common/ge_opt_info.h b/ge/common/ge_opt_info.h new file mode 100644 index 00000000..4ec9a59f --- /dev/null +++ b/ge/common/ge_opt_info.h @@ -0,0 +1,31 @@ +/** + * 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. + */ + +#ifndef GE_COMMON_GE_OPT_INFO_H_ +#define GE_COMMON_GE_OPT_INFO_H_ + +#include "ge/ge_api_error_codes.h" +#include "register/register_types.h" + +namespace ge { +class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { + public: + GeOptInfo() = default; + static Status SetOptInfo(); +}; +} // namespace ge + +#endif // GE_COMMON_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index bf04ed58..3861e6ac 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,6 +27,7 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" +#include "common/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -949,7 +950,7 @@ Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint rtError_t rt_ret = rtCtxCreate(&rt_context, mode, ge::GetContext().DeviceId()); if (rt_ret != RT_ERROR_NONE) { - REPORT_CALL_ERROR("E19999", "Call rtCtxCreate faileded, session_id:%lu, graph_id:%u, mode:%d", + REPORT_CALL_ERROR("E19999", "Call rtCtxCreate failed, session_id:%lu, graph_id:%u, mode:%d", session_id, graph_id, mode); GELOGE(FAILED, "[Call][RtCtxCreate] faileded, session_id:%lu, graph_id:%u, mode:%d", session_id, graph_id, mode); return FAILED; @@ -1001,6 +1002,12 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector + c_sec +) + +target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc new file mode 100644 index 00000000..df518c4b --- /dev/null +++ b/tests/depends/opt_info/src/opt_info_stub.cc @@ -0,0 +1,46 @@ +/** + * 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 "opt_info.h" +#include +#include +#include +#include + +namespace gelc { +namespace { +const std::vector kSocVersions = {"Ascend910"}; +} + +void SetAllOptInfo(std::map &opt_infos) { + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + opt_infos.emplace("opt_module.rl_tune", "all"); + opt_infos.emplace("opt_module.aoe", "all"); +} + +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_infos) { + if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { + SetAllOptInfo(opt_infos); + return SUCCESS; + } + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + return SUCCESS; +} +} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index 81aa00cc..c4380016 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,6 +103,7 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" + "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -117,6 +118,7 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub + opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc new file mode 100644 index 00000000..8fc47a9b --- /dev/null +++ b/tests/st/testcase/test_ge_opt_info.cc @@ -0,0 +1,123 @@ +/** + * 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 "easy_graph/graph/box.h" +#include "easy_graph/graph/node.h" +#include "easy_graph/builder/graph_dsl.h" +#include "easy_graph/builder/box_builder.h" +#include "easy_graph/layout/graph_layout.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" +#include "graph/graph.h" +#include "graph/compute_graph.h" +#include "framework/common/types.h" +#include "graph/debug/ge_attr_define.h" +#include "ge_graph_dsl/graph_dsl.h" +#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" +#define protected public +#define private public +#include "common/ge_opt_info.h" +#undef private +#undef protected + +namespace ge { +class STEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(STEST_opt_info, get_opt_info_all) { + std::map options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(STEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} +} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 631e18f8..ea9e2360 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,6 +62,7 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) +include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -172,6 +173,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/dump/exception_dumper.cc" "${GE_CODE_DIR}/ge/common/dump/opdebug_register.cc" "${GE_CODE_DIR}/ge/common/dump/dump_op.cc" + "${GE_CODE_DIR}/ge/common/ge_opt_info.cc" "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" "${GE_CODE_DIR}/ge/model/ge_root_model.cc" "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" @@ -768,6 +770,7 @@ set(MULTI_PARTS_TEST_FILES "common/dump_op_unittest.cc" "common/dump_exception_unittest.cc" "common/opdebug_register_unittest.cc" + "common/ge_opt_info_unittest.cc" "common/format_transfer_unittest.cc" "common/format_transfer_transpose_unittest.cc" "common/format_transfer_nchw_5d_unittest.cc" @@ -863,6 +866,7 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub + opt_feature_stub ascend_protobuf json ) diff --git a/tests/ut/ge/common/ge_opt_info_unittest.cc b/tests/ut/ge/common/ge_opt_info_unittest.cc new file mode 100644 index 00000000..3ac51615 --- /dev/null +++ b/tests/ut/ge/common/ge_opt_info_unittest.cc @@ -0,0 +1,82 @@ +/** + * 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 + +#define protected public +#define private public +#include "common/ge_opt_info.h" +#include "graph/ge_local_context.h" +#include "external/ge/ge_api_types.h" +#undef private +#undef protected + +namespace ge { +class UTEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UTEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_all) { + std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(global_options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_failed) { + std::map options; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::FAILED); +} + +} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h new file mode 100644 index 00000000..ea9bb529 --- /dev/null +++ b/third_party/fwkacllib/inc/opt_info/opt_info.h @@ -0,0 +1,34 @@ +/** + * 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 + +namespace gelc { +using Status = uint32_t; +using WorkMode = uint32_t; +const Status SUCCESS = 0x0; +const Status FAILED = 0xFFFFFFFF; +const WorkMode kOffline = 0x0; +const WorkMode kInline = 0x01; + +extern "C" { +__attribute__((visibility ("default"))) +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_info_map); +} +} // namespace gelc + From e0939a797a9c413ce37a17131ed7132f1664fb4c Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 21 Jun 2021 15:36:19 +0800 Subject: [PATCH 057/226] Adaptation rectification of op_tiling. --- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 24 ++++++++++++------------ ge/hybrid/node_executor/aicore/aicore_op_task.h | 4 ++-- ge/single_op/task/op_task.cc | 13 ++++++------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index 8cd24bd1..76082cb3 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -25,7 +25,7 @@ #include "single_op/task/build_task_utils.h" #include "single_op/task/tbe_task_builder.h" -using optiling::OpRunInfo; +using optiling::utils::OpRunInfo; namespace ge { namespace hybrid { @@ -359,9 +359,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { GE_CHECK_NOTNULL(op_desc); GELOGD("[%s] Start to update tiling info for task: [%s]", node->GetName().c_str(), stub_name_.c_str()); - OpRunInfo tiling_info; - tiling_info.block_dim = -1; // codex: Using uninitialized value - tiling_info.clear_atomic = true; + OpRunInfo tiling_info(-1, true, 0); auto execution_context = context.GetExecutionContext(); @@ -370,12 +368,14 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { RECORD_EXECUTION_EVENT(execution_context, context.GetNodeName(), "[CalcTilingInfo] End"); // update op args by tiling info - block_dim_ = static_cast(tiling_info.block_dim); - op_desc->SetWorkspaceBytes(tiling_info.workspaces); - clear_atomic_ = tiling_info.clear_atomic; - - tiling_data_ = tiling_info.tiling_data.str(); - tiling_key_ = tiling_info.tiling_key; + block_dim_ = tiling_info.GetBlockDim(); + clear_atomic_ = tiling_info.GetClearAtomic(); + std::vector workspaces; + tiling_info.GetAllWorkspaces(workspaces); + op_desc->SetWorkspaceBytes(workspaces); + + tiling_data_ = tiling_info.GetAllTilingData().str(); + tiling_key_ = tiling_info.GetTilingKey(); GELOGD("Successfully getting [tiling_key] : %u", tiling_key_); if (tiling_data_.empty()) { GELOGD("[%s] Tiling data is empty.", op_desc->GetName().c_str()); @@ -412,7 +412,7 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { Status AiCoreOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpParaCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(OpParaCalculate(*node, tiling_info), + GE_CHK_STATUS_RET(optiling::OpParaCalculateV2(*node, tiling_info), "[Invoke][OpParaCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpParaCalculate successfully.", node->GetName().c_str()); @@ -633,7 +633,7 @@ std::string AtomicAddrCleanOpTask::GetKeyForKernelName(const OpDesc &op_desc) co Status AtomicAddrCleanOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpAtomicCalculate.", node->GetName().c_str()); - GE_CHK_STATUS_RET(OpAtomicCalculate(*node, tiling_info), + GE_CHK_STATUS_RET(optiling::OpAtomicCalculateV2(*node, tiling_info), "[Invoke][OpAtomicCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); GELOGD("[%s] Done invoking OpAtomicCalculate successfully.", node->GetName().c_str()); diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index 8d7b7f1e..3c8db8c9 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -85,7 +85,7 @@ class AiCoreOpTask { virtual std::string GetKeyForTvmMagic() const; virtual std::string GetKeyForTvmMetaData() const; virtual std::string GetKeyForKernelName(const OpDesc &op_desc) const; - virtual Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info); + virtual Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info); std::unique_ptr tiling_buffer_ = nullptr; std::string tiling_data_; @@ -130,7 +130,7 @@ class AtomicAddrCleanOpTask : public AiCoreOpTask { std::string GetKeyForTvmMagic() const override; std::string GetKeyForTvmMetaData() const override; std::string GetKeyForKernelName(const OpDesc &op_desc) const override; - Status CalcTilingInfo(const NodePtr &node, optiling::OpRunInfo &tiling_info) override; + Status CalcTilingInfo(const NodePtr &node, optiling::utils::OpRunInfo &tiling_info) override; private: Status InitAtomicAddrCleanIndices(const OpDesc &op_desc); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index e48677f8..66d70e7e 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -224,18 +224,17 @@ Status TbeOpTask::LaunchKernel(rtStream_t stream) { Status TbeOpTask::UpdateRunInfo() { // invoke OpParaCalculate GELOGD("Start to invoke OpParaCalculate."); - optiling::OpRunInfo run_info; - run_info.block_dim = 0; - auto ret = optiling::OpParaCalculate(*node_, run_info); + optiling::utils::OpRunInfo run_info(0, true, 0); + auto ret = optiling::OpParaCalculateV2(*node_, run_info); if (ret != GRAPH_SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpParaCalculate] failed, ret = %u.", ret); REPORT_INNER_ERROR("E19999", "invoke OpParaCalculate failed, ret = %u.", ret); return ACL_ERROR_GE_INTERNAL_ERROR; } - block_dim_ = run_info.block_dim; - tiling_data_ = run_info.tiling_data.str(); - tiling_key_ = run_info.tiling_key; - run_info_workspaces_ = run_info.workspaces; + block_dim_ = run_info.GetBlockDim(); + tiling_data_ = run_info.GetAllTilingData().str(); + tiling_key_ = run_info.GetTilingKey(); + run_info.GetAllWorkspaces(run_info_workspaces_); GELOGD("Done invoking OpParaCalculate successfully. block_dim = %u, tiling size = %zu, tiling_key = %u", block_dim_, tiling_data_.size(), tiling_key_); return SUCCESS; From df52801ea551999be69e9d42285aa9b06008ff92 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Thu, 13 May 2021 16:14:41 +0800 Subject: [PATCH 058/226] remove updation of session_id --- ge/graph/manager/graph_manager.cc | 2 +- ge/hybrid/model/hybrid_model_builder.cc | 46 +++++++++++++++++----- ge/hybrid/model/hybrid_model_builder.h | 1 + ge/model/ge_root_model.h | 5 +++ .../hybrid/executor/subgraph_executor_unittest.cc | 3 ++ .../hybrid/model/hybrid_model_builder_unittest.cc | 26 +++++++++--- 6 files changed, 67 insertions(+), 16 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index bf04ed58..329db797 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -3132,10 +3132,10 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { } // Avoid repeatively prerun for graphs owns same graph_id in online inference concurrency if (count > 1 && graph_node->GetBuildFlag()) { - graph_node->Lock(); GELOGD("Avoid repeatively prerun, graph_id:%u.", args.graph_id); // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); + graph_node->Lock(); graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 5337a0cf..01e189d3 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -147,6 +147,7 @@ Status HybridModelBuilder::Build() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); hybrid_model_.model_name_ = ge_root_model_->GetModelName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); + GE_CHK_STATUS_RET(CopyGraph(), "[Invoke][CopyGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitRuntimeParams(), "[Invoke][InitRuntimeParams] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(RecoverGraphUnknownFlag(), "[Invoke][RecoverGraphUnknownFlag] failed, model_name_:[%s]", GetGraphName()); @@ -174,8 +175,8 @@ Status HybridModelBuilder::BuildForSingleOp() { hybrid_model_.model_name_ = ge_root_model_->GetRootGraph()->GetName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); auto ret = ge_root_model_->GetSubgraphInstanceNameToModel(); - const GeModelPtr ge_model = ret[ge_root_model_->GetRootGraph()->GetName()]; - GE_CHK_STATUS_RET(IndexTaskDefs(ge_root_model_->GetRootGraph(), ge_model), + const GeModelPtr ge_model = ret[hybrid_model_.root_graph_->GetName()]; + GE_CHK_STATUS_RET(IndexTaskDefs(hybrid_model_.root_graph_, ge_model), "[Invoke][IndexTaskDefs] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(LoadGraph(), "[Invoke][LoadGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitWeights(), "[Invoke][InitWeights] failed, model_name_:[%s]", GetGraphName()); @@ -190,6 +191,29 @@ Status HybridModelBuilder::ValidateParams() { return SUCCESS; } +Status HybridModelBuilder::CopyGraph() { + GELOGD("Copy compute graph begin."); + auto root_graph = ge_root_model_->GetRootGraph(); + + ge_root_model_->IncreaseBuildTimes(); + std::string new_graph_name = ge_root_model_->GetRootGraph()->GetName() + "_" + + std::to_string(ge_root_model_->GetBuildTimes()); + ComputeGraphPtr new_root_graph = MakeShared(new_graph_name); + GE_CHECK_NOTNULL(new_root_graph); + int32_t depth = 0; + std::map node_old_2_new; + std::map op_desc_old_2_new; + graphStatus ret = GraphUtils::CopyComputeGraph(root_graph, new_root_graph, node_old_2_new, op_desc_old_2_new, depth); + if (ret != GRAPH_SUCCESS) { + GELOGE(GRAPH_FAILED, "Copy compute graph failed."); + return GRAPH_FAILED; + } + hybrid_model_.root_graph_ = new_root_graph; + + GELOGD("Copy compute graph[%s] success.", new_graph_name.c_str()); + return SUCCESS; +} + Status HybridModelBuilder::BuildNodeItem(const NodePtr &node, NodeItem &node_item) { auto op_desc = node->GetOpDesc(); GE_CHK_STATUS_RET(ParseForceInfershapeNodes(node, node_item), @@ -814,7 +838,7 @@ Status HybridModelBuilder::BuildOutputMapping(GraphItem &graph_item, } Status HybridModelBuilder::LoadGraph() { - auto root_graph = ge_root_model_->GetRootGraph(); + auto root_graph = hybrid_model_.root_graph_; if (!GetContext().GetHostExecFlag()) { std::shared_ptr merged_graph; GELOGI("Before merging subgraphs DirectNodesSize = %zu, GetAllNodesSize = %zu", @@ -828,7 +852,6 @@ Status HybridModelBuilder::LoadGraph() { root_graph->GetAllNodesSize()); } - hybrid_model_.root_graph_ = root_graph; GE_CHK_STATUS_RET(RelinkNextIteration(), "[%s] Relink NextIteration failed", GetGraphName()); // Reset node id by topological order across all subgraphs int64_t index = 0; @@ -877,6 +900,7 @@ Status HybridModelBuilder::LoadGraph() { } for (auto &it : hybrid_model_.known_shape_sub_models_) { auto node_item = MutableNodeItem(it.first); + GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); @@ -1125,7 +1149,9 @@ Status HybridModelBuilder::InitWeights() { sub_weight_buffer->GetSize()); auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); if (subgraph != ge_root_model_->GetRootGraph()) { - subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); + subgraph = hybrid_model_.root_graph_->GetSubgraph(subgraph_model.first); + } else { + subgraph = hybrid_model_.root_graph_; } GE_CHECK_NOTNULL(subgraph); hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); @@ -1282,7 +1308,7 @@ Status HybridModelBuilder::IndexTaskDefs(const ComputeGraphPtr &sub_graph, const } Status HybridModelBuilder::IndexTaskDefs() { - const auto root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; const auto &root_graph_name = root_graph->GetName(); if (SetOutputNameAttr(*root_graph) != SUCCESS) { GELOGW("Set output name attr failed."); @@ -1316,7 +1342,7 @@ Status HybridModelBuilder::IndexTaskDefs() { Status HybridModelBuilder::IndexSpecialNodes() { GELOGD("Start to index special nodes"); - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); @@ -1471,7 +1497,7 @@ Status HybridModelBuilder::InitRuntimeParams() { runtime_param_.session_id = ret ? static_cast(value) : 0; ret = ge::AttrUtils::GetInt(first_model, ATTR_MODEL_TASK_GEN_VAR_ADDR, value); runtime_param_.logic_var_base = ret ? static_cast(value) : 0; - runtime_param_.graph_id = ge_root_model_->GetRootGraph()->GetGraphID(); + runtime_param_.graph_id = hybrid_model_.root_graph_->GetGraphID(); value = 0; for (auto &it : ge_root_model_->GetSubgraphInstanceNameToModel()) { (void) ge::AttrUtils::GetInt(it.second, ATTR_MODEL_VAR_SIZE, value); @@ -1608,7 +1634,7 @@ Status HybridModelBuilder::TransAllVarData() { } Status HybridModelBuilder::CopyVarData() { - GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(ge_root_model_->GetRootGraph(), + GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(hybrid_model_.root_graph_, runtime_param_.session_id, hybrid_model_.device_id_), "[Invoke][CopyVarData] failed."); @@ -1691,7 +1717,7 @@ Status HybridModelBuilder::LoadKnownShapedSubgraph(ComputeGraph &graph, NodeItem } Status HybridModelBuilder::RecoverGraphUnknownFlag() { - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &sub_graph : root_graph->GetAllSubgraphs()) { GE_CHECK_NOTNULL(sub_graph); for (const auto &node : sub_graph->GetDirectNode()) { diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 92974441..3ab43b7f 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -56,6 +56,7 @@ class HybridModelBuilder { Status BuildOutputMapping(GraphItem &partitioned_call, const NodeItem &node_item, bool is_root_graph); Status ValidateParams(); Status LoadGraph(); + Status CopyGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); Status LoadTasks(); diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index 9e8e116e..b6e3d081 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -60,6 +60,10 @@ class GeRootModel { bool GetTrainFlag() const { return train_flag_; } + int32_t GetBuildTimes() const { return hybrid_build_times_; } + + void IncreaseBuildTimes() { hybrid_build_times_++; } + private: ComputeGraphPtr root_graph_ = nullptr; std::map subgraph_instance_name_to_model_; @@ -69,6 +73,7 @@ class GeRootModel { bool train_flag_ = false; std::string model_name_; bool is_specific_stream_ = false; + int32_t hybrid_build_times_ = 0; }; } // namespace ge using GeRootModelPtr = std::shared_ptr; diff --git a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc index 2dc3b639..827705ae 100644 --- a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc @@ -249,6 +249,9 @@ TEST_F(UtestSubgraphExecutor, cond_graph_schedule_tasks) { graph_context.callback_manager = std::unique_ptr(new CallbackManager()); ASSERT_EQ(graph_context.callback_manager->Init(), SUCCESS); + auto root_graph = hybrid_model.root_graph_; + switch_t = root_graph->FindNode("switch_t"); + switch_f = root_graph->FindNode("switch_f"); const auto node_it_t = hybrid_model.node_items_.find(switch_t); const auto node_it_f = hybrid_model.node_items_.find(switch_f); ASSERT_NE(hybrid_model.node_items_.end(), node_it_t); diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 2ab82350..95669b73 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -214,11 +214,17 @@ TEST_F(UtestHybridModelBuilder, normal_hybrid_model_build) { ASSERT_EQ(it->second->frame_index_, index); ASSERT_EQ(it->second->parent_frame_, -1); }; - TestFrameGroup(enter1, control_group_index); - TestFrameGroup(active1, control_group_index); - TestFrameGroup(active2, control_group_index); - TestFrameGroup(active3, control_group_index); - TestFrameGroup(output1, -1); + auto root_graph = hybrid_model.root_graph_; + auto enter1_node = root_graph->FindNode("enter"); + auto active1_node = root_graph->FindNode("active1"); + auto active2_node = root_graph->FindNode("active2"); + auto active3_node = root_graph->FindNode("active3"); + auto output1_node = root_graph->FindNode("net_output"); + TestFrameGroup(enter1_node, control_group_index); + TestFrameGroup(active1_node, control_group_index); + TestFrameGroup(active2_node, control_group_index); + TestFrameGroup(active3_node, control_group_index); + TestFrameGroup(output1_node, -1); engine_mapping.clear(); task_executor.clear(); @@ -346,4 +352,14 @@ EXPECT_EQ(hybrid_model_builder.InitVariableTensors(), SUCCESS); EXPECT_EQ(hybrid_model_builder.hybrid_model_.variable_tensors_.size(), 1); HostMemManager::Instance().var_memory_base_map_.clear(); } + +TEST_F(UtestHybridModelBuilder, copy_graph_success) { +ComputeGraphPtr graph = std::make_shared("test"); +GeRootModelPtr ge_root_model = make_shared(graph); +HybridModel hybrid_model(ge_root_model); +HybridModelBuilder hybrid_model_builder(hybrid_model); + +Status st = hybrid_model_builder.CopyGraph(); +EXPECT_EQ(st, SUCCESS); +} } // namespace ge From f8154fbef674da3320cdbc325c5957678be3133a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Mon, 21 Jun 2021 17:39:14 +0800 Subject: [PATCH 059/226] opt info --- ge/common/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 91f3b27d..d81bb00a 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -87,7 +87,7 @@ target_include_directories(ge_common PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> - $<$>:${GE_DEPEND_DIR}../abl/licctrl> + $<$>:${GE_DEPEND_DIR}/abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> @@ -159,7 +159,7 @@ target_include_directories(ge_common_static PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> - $<$>:${GE_DEPEND_DIR}/../abl/licctrl> + $<$>:${GE_DEPEND_DIR}/abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> From 096981679abff4bc050f69aa6736ea45ae77db09 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 21 Jun 2021 18:35:43 +0800 Subject: [PATCH 060/226] Update submodule. --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index e189fc7f..f75dbad2 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit e189fc7f4da9f7714f009d70da4db627de17955d +Subproject commit f75dbad2f2249608080e482acc6d723e04fec3da From 64b22f8c98452144804528b69d453fd22ab61474 Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Mon, 21 Jun 2021 19:32:53 +0800 Subject: [PATCH 061/226] skip control flow op when replace node with empty tensor --- ge/graph/passes/replace_with_empty_const_pass.cc | 20 ++++++++++ .../replace_with_empty_const_pass_unittest.cc | 45 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/ge/graph/passes/replace_with_empty_const_pass.cc b/ge/graph/passes/replace_with_empty_const_pass.cc index 9459c852..3176d1ee 100644 --- a/ge/graph/passes/replace_with_empty_const_pass.cc +++ b/ge/graph/passes/replace_with_empty_const_pass.cc @@ -21,7 +21,23 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/utils/graph_utils.h" +#include "graph/utils/node_utils.h" +namespace { +const std::unordered_set kControlFlowOps = { + ge::SWITCH, + ge::REFSWITCH, + ge::MERGE, + ge::REFMERGE, + ge::ENTER, + ge::REFENTER, + ge::NEXTITERATION, + ge::REFNEXTITERATION, + ge::EXIT, + ge::REFEXIT, + ge::LOOPCOND +}; +} namespace ge { Status ReplaceWithEmptyConstPass::Run(NodePtr &node) { GELOGD("ReplaceWithEmptyConstPass in."); @@ -39,6 +55,10 @@ Status ReplaceWithEmptyConstPass::Run(NodePtr &node) { GELOGI("Node %s is const. Ignore current pass.", node->GetName().c_str()); return SUCCESS; } + if (kControlFlowOps.count(NodeUtils::GetNodeType(node)) != 0) { + GELOGI("Node %s is control flow op. Ignore current pass.", node->GetName().c_str()); + return SUCCESS; + } // Node like no op, it has no output if (node->GetOpDesc()->GetAllOutputsDescPtr().empty()) { GELOGI("Node %s has no output desc. Ignore current pass.", node->GetName().c_str()); diff --git a/tests/ut/ge/graph/passes/replace_with_empty_const_pass_unittest.cc b/tests/ut/ge/graph/passes/replace_with_empty_const_pass_unittest.cc index 6711b0d3..d353498c 100644 --- a/tests/ut/ge/graph/passes/replace_with_empty_const_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/replace_with_empty_const_pass_unittest.cc @@ -57,6 +57,36 @@ ut::GraphBuilder Graph1Builder() { builder.AddDataEdge(cast1, 0, conv2d, 0); return builder; } + +/// data1 const1 +/// \ / +/// add1 +/// | +/// data2 -> switch1 (empty) +/// | +/// conv2d +ut::GraphBuilder Graph2Builder() { + ut::GraphBuilder builder = ut::GraphBuilder("graph2"); + auto data1 = builder.AddNode("data1", "Data", 0, 1); + auto data2 = builder.AddNode("data2", "Data", 0, 1); + auto const1 = builder.AddNode("const1", "Const", 0, 1); + auto add1 = builder.AddNode("add1", "Add", 2, 1); + auto switch1 = builder.AddNode("switch1", "Switch", 2, 1); + auto conv2d = builder.AddNode("conv2d", "Conv2D", 1, 0); + + add1->GetOpDesc()->AddInputDesc(GeTensorDesc(GeShape({1, 1, 8, 8}),FORMAT_NCHW)); + add1->GetOpDesc()->AddInputDesc(GeTensorDesc(GeShape({1, 1, 8, 8}),FORMAT_NCHW)); + add1->GetOpDesc()->AddOutputDesc(GeTensorDesc(GeShape({1, 1, 8, 8}),FORMAT_NCHW)); + GeTensorDesc empty_tensor(GeShape({1, 0, 8, 8}),FORMAT_NCHW); + switch1->GetOpDesc()->UpdateOutputDesc(0, empty_tensor); + + builder.AddDataEdge(data1, 0, add1, 0); + builder.AddDataEdge(const1, 0, add1, 1); + builder.AddDataEdge(add1, 0, switch1, 0); + builder.AddDataEdge(data2, 0, switch1, 1); + builder.AddDataEdge(switch1, 0, conv2d, 0); + return builder; +} } // namespace @@ -85,4 +115,19 @@ TEST_F(UtestReplaceWithEmptyConstPass, replace_whith_empty_const_success) { auto conv2d = graph->FindNode("conv2d"); EXPECT_EQ(conv2d->GetInDataNodes().at(0)->GetType(),"Const"); } + +TEST_F(UtestReplaceWithEmptyConstPass, replace_whith_empty_switch_skip) { + auto builder = Graph2Builder(); + auto graph = builder.GetGraph(); + graph->SetSessionID(0); + ReplaceWithEmptyConstPass replace_with_empty_const_pass; + + EXPECT_EQ(graph->GetDirectNodesSize(), 6); + // run pass on switch1, graph still has 6 nodes + auto switch1 = graph->FindNode("switch1"); + EXPECT_NE(switch1, nullptr); + Status ret = replace_with_empty_const_pass.Run(switch1); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(graph->GetDirectNodesSize(), 6); +} } // namespace ge From 0b31eb4bda4f73b54d6f23ce064a240a4cbf5fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Tue, 22 Jun 2021 09:33:39 +0800 Subject: [PATCH 062/226] =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 +- ge/common/CMakeLists.txt | 8 -- ge/common/ge_opt_info.cc | 58 ------------ ge/common/ge_opt_info.h | 31 ------- ge/graph/manager/graph_manager.cc | 7 -- tests/CMakeLists.txt | 1 - tests/depends/opt_info/CMakeLists.txt | 37 -------- tests/depends/opt_info/src/opt_info_stub.cc | 46 ---------- tests/framework/cmake/graphengine.cmake | 2 - tests/st/testcase/test_ge_opt_info.cc | 123 -------------------------- tests/ut/ge/CMakeLists.txt | 4 - tests/ut/ge/common/ge_opt_info_unittest.cc | 82 ----------------- third_party/fwkacllib/inc/opt_info/opt_info.h | 34 ------- 13 files changed, 1 insertion(+), 435 deletions(-) delete mode 100644 ge/common/ge_opt_info.cc delete mode 100644 ge/common/ge_opt_info.h delete mode 100644 tests/depends/opt_info/CMakeLists.txt delete mode 100644 tests/depends/opt_info/src/opt_info_stub.cc delete mode 100644 tests/st/testcase/test_ge_opt_info.cc delete mode 100644 tests/ut/ge/common/ge_opt_info_unittest.cc delete mode 100644 third_party/fwkacllib/inc/opt_info/opt_info.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 77a759ba..e3cc1e32 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,6 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) - find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) @@ -180,4 +179,4 @@ else () add_subdirectory(ge) -endif () \ No newline at end of file +endif () diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index d81bb00a..f55ff427 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -43,7 +43,6 @@ set(SRC_LIST "op/ge_op_utils.cc" "thread_pool.cc" "ge/tbe_plugin_manager.cc" - "ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL) @@ -87,11 +86,9 @@ target_include_directories(ge_common PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> - $<$>:${GE_DEPEND_DIR}/abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> - $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_options(ge_common PRIVATE @@ -111,7 +108,6 @@ target_link_libraries(ge_common PRIVATE c_sec error_manager slog - opt_feature -Wl,--as-needed json $<$>:-lrt> @@ -159,11 +155,9 @@ target_include_directories(ge_common_static PRIVATE #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> $<$>:${GE_DEPEND_DIR}/inc/cce> - $<$>:${GE_DEPEND_DIR}/abl/licctrl> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> - $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_libraries(ge_common_static PRIVATE @@ -219,7 +213,6 @@ target_include_directories(ge_common PRIVATE ${CMAKE_BINARY_DIR}/proto/graphengine_protos ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_common PRIVATE @@ -235,7 +228,6 @@ target_link_libraries(ge_common PRIVATE c_sec error_manager slog - opt_feature static_mmpa -Wl,--as-needed json diff --git a/ge/common/ge_opt_info.cc b/ge/common/ge_opt_info.cc deleted file mode 100644 index c6bac480..00000000 --- a/ge/common/ge_opt_info.cc +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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 "common/ge_opt_info.h" - -#include -#include -#include "graph/ge_local_context.h" -#include "ge/ge_api_types.h" -#include "common/debug/ge_log.h" -#include "opt_info.h" - -namespace ge { -Status GeOptInfo::SetOptInfo() { - std::string soc_ver; - graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); - if (ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get soc version failed."); - GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); - return FAILED; - } - GELOGD("Soc version:%s.", soc_ver.c_str()); - std::map opt_info; - // the first arg does not work at present. - if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - return FAILED; - } - // do nothing if get empty information - if (opt_info.empty()) { - GELOGI("Optional information is empty."); - return SUCCESS; - } - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - for (const auto &itr : opt_info) { - graph_options.emplace(itr.first, itr.second); - GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); - } - GetThreadLocalContext().SetGraphOption(graph_options); - return SUCCESS; -} -} // namespace ge diff --git a/ge/common/ge_opt_info.h b/ge/common/ge_opt_info.h deleted file mode 100644 index 4ec9a59f..00000000 --- a/ge/common/ge_opt_info.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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. - */ - -#ifndef GE_COMMON_GE_OPT_INFO_H_ -#define GE_COMMON_GE_OPT_INFO_H_ - -#include "ge/ge_api_error_codes.h" -#include "register/register_types.h" - -namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { - public: - GeOptInfo() = default; - static Status SetOptInfo(); -}; -} // namespace ge - -#endif // GE_COMMON_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 3861e6ac..b862a7d6 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,7 +27,6 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" -#include "common/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -1002,12 +1001,6 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector - c_sec -) - -target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc deleted file mode 100644 index df518c4b..00000000 --- a/tests/depends/opt_info/src/opt_info_stub.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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 "opt_info.h" -#include -#include -#include -#include - -namespace gelc { -namespace { -const std::vector kSocVersions = {"Ascend910"}; -} - -void SetAllOptInfo(std::map &opt_infos) { - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - opt_infos.emplace("opt_module.rl_tune", "all"); - opt_infos.emplace("opt_module.aoe", "all"); -} - -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_infos) { - if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { - SetAllOptInfo(opt_infos); - return SUCCESS; - } - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - return SUCCESS; -} -} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index c4380016..81aa00cc 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,7 +103,6 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -118,7 +117,6 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub - opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc deleted file mode 100644 index 8fc47a9b..00000000 --- a/tests/st/testcase/test_ge_opt_info.cc +++ /dev/null @@ -1,123 +0,0 @@ -/** - * 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 "easy_graph/graph/box.h" -#include "easy_graph/graph/node.h" -#include "easy_graph/builder/graph_dsl.h" -#include "easy_graph/builder/box_builder.h" -#include "easy_graph/layout/graph_layout.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" -#include "graph/graph.h" -#include "graph/compute_graph.h" -#include "framework/common/types.h" -#include "graph/debug/ge_attr_define.h" -#include "ge_graph_dsl/graph_dsl.h" -#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" -#define protected public -#define private public -#include "common/ge_opt_info.h" -#undef private -#undef protected - -namespace ge { -class STEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(STEST_opt_info, get_opt_info_all) { - std::map options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(STEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} -} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 3ea4d1a7..8b024820 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,7 +62,6 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -173,7 +172,6 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/dump/exception_dumper.cc" "${GE_CODE_DIR}/ge/common/dump/opdebug_register.cc" "${GE_CODE_DIR}/ge/common/dump/dump_op.cc" - "${GE_CODE_DIR}/ge/common/ge_opt_info.cc" "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" "${GE_CODE_DIR}/ge/model/ge_root_model.cc" "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" @@ -770,7 +768,6 @@ set(MULTI_PARTS_TEST_FILES "common/dump_op_unittest.cc" "common/dump_exception_unittest.cc" "common/opdebug_register_unittest.cc" - "common/ge_opt_info_unittest.cc" "common/format_transfer_unittest.cc" "common/format_transfer_transpose_unittest.cc" "common/format_transfer_nchw_5d_unittest.cc" @@ -864,7 +861,6 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub - opt_feature_stub ascend_protobuf json ) diff --git a/tests/ut/ge/common/ge_opt_info_unittest.cc b/tests/ut/ge/common/ge_opt_info_unittest.cc deleted file mode 100644 index 3ac51615..00000000 --- a/tests/ut/ge/common/ge_opt_info_unittest.cc +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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 - -#define protected public -#define private public -#include "common/ge_opt_info.h" -#include "graph/ge_local_context.h" -#include "external/ge/ge_api_types.h" -#undef private -#undef protected - -namespace ge { -class UTEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(UTEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_all) { - std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(global_options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_failed) { - std::map options; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::FAILED); -} - -} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h deleted file mode 100644 index ea9bb529..00000000 --- a/third_party/fwkacllib/inc/opt_info/opt_info.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 - -namespace gelc { -using Status = uint32_t; -using WorkMode = uint32_t; -const Status SUCCESS = 0x0; -const Status FAILED = 0xFFFFFFFF; -const WorkMode kOffline = 0x0; -const WorkMode kInline = 0x01; - -extern "C" { -__attribute__((visibility ("default"))) -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_info_map); -} -} // namespace gelc - From e6e71fe317d331002491b27b3b26c6009c2a1ecf Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 19 Jun 2021 17:18:30 +0800 Subject: [PATCH 063/226] Normalize include files... --- ge/CMakeLists.txt | 30 ++---------- ge/analyzer/analyzer.cc | 2 +- ge/client/ge_api.cc | 4 +- ge/common/CMakeLists.txt | 14 ------ ge/common/base64.h | 4 +- ge/common/dump/dump_manager.h | 2 +- ge/common/dump/dump_op.h | 2 +- ge/common/dump/dump_properties.cc | 2 +- ge/common/dump/opdebug_register.cc | 2 +- ge/common/dump/opdebug_register.h | 4 +- .../format_transfers/format_transfer_fractal_z.cc | 2 +- .../format_transfer_nchw_fz_c04.cc | 2 +- ge/common/ge/datatype_util.h | 2 +- ge/common/ge/plugin_manager.h | 4 +- ge/common/ge_format_util.cc | 2 +- ge/common/helper/model_cache_helper.h | 2 +- ge/common/math/fp16_math.cc | 2 +- ge/common/model_parser/model_parser.cc | 2 +- ge/common/op/attr_value_util.cc | 2 +- ge/common/profiling/ge_profiling.cc | 2 +- ge/common/profiling/ge_runner_profiling.cc | 2 +- ge/common/profiling/profiling_manager.cc | 2 +- ge/common/properties_manager.cc | 2 +- ge/common/properties_manager.h | 2 +- ge/common/thread_pool.cc | 2 +- ge/common/thread_pool.h | 2 +- ge/common/types.cc | 2 +- ge/engine_manager/dnnengine_manager.cc | 2 +- ge/engine_manager/dnnengine_manager.h | 4 +- ge/executor/CMakeLists.txt | 6 --- ge/executor/ge_executor.cc | 6 +-- ge/ge_local_engine/CMakeLists.txt | 10 ---- ge/ge_local_engine/engine/ge_local_engine.cc | 6 +-- ge/ge_local_engine/engine/host_cpu_engine.cc | 2 +- ge/ge_local_engine/engine/host_cpu_engine.h | 2 +- .../ge_local_ops_kernel_builder.cc | 4 +- .../ops_kernel_store/ge_local_ops_kernel_info.cc | 6 +-- .../ops_kernel_store/op/ge_deleted_op.cc | 2 +- ge/ge_local_engine/ops_kernel_store/op/no_op.cc | 2 +- ge/ge_local_engine/ops_kernel_store/op/op.cc | 2 +- ge/ge_local_engine/ops_kernel_store/op/op.h | 2 +- .../ops_kernel_store/op/op_factory.cc | 2 +- ge/ge_runtime/CMakeLists.txt | 8 ---- ge/ge_runtime/model_runner.cc | 8 ++-- ge/ge_runtime/output.cc | 4 +- ge/ge_runtime/output.h | 4 +- ge/ge_runtime/runtime_model.cc | 14 +++--- ge/ge_runtime/runtime_model.h | 4 +- ge/ge_runtime/task/task.h | 2 +- ge/ge_runtime/task/task_factory.h | 4 +- ge/generator/ge_generator.cc | 10 ++-- ge/generator/generator_api.cc | 6 +-- ge/graph/build/graph_builder.cc | 2 +- ge/graph/build/graph_builder.h | 10 ++-- ge/graph/build/label_allocator.cc | 6 +-- ge/graph/build/memory/block_mem_assigner.cc | 4 +- ge/graph/build/memory/block_mem_assigner.h | 6 +-- ge/graph/build/memory/hybrid_mem_assigner.h | 4 +- ge/graph/build/memory/mem_assigner.h | 4 +- ge/graph/build/memory/memory_assigner.cc | 2 +- ge/graph/build/memory/var_mem_assign_util.cc | 6 +-- ge/graph/build/memory/var_mem_assign_util.h | 4 +- ge/graph/build/model_builder.cc | 10 ++-- ge/graph/build/model_builder.h | 8 ++-- ge/graph/build/run_context.cc | 2 +- ge/graph/build/run_context.h | 2 +- ge/graph/build/stream_allocator.cc | 2 +- ge/graph/build/stream_graph_optimizer.cc | 4 +- ge/graph/build/stream_graph_optimizer.h | 2 +- ge/graph/build/task_generator.cc | 6 +-- ge/graph/build/task_generator.h | 2 +- ge/graph/common/bcast.cc | 2 +- ge/graph/common/bcast.h | 6 +-- ge/graph/common/local_context.cc | 6 +-- ge/graph/common/local_context.h | 2 +- ge/graph/common/omg_util.h | 4 +- ge/graph/common/transop_util.cc | 2 +- ge/graph/execute/graph_execute.h | 12 ++--- ge/graph/label/case_label_maker.cc | 6 +-- ge/graph/label/if_label_maker.cc | 6 +-- ge/graph/label/label_maker.cc | 4 +- ge/graph/label/partitioned_call_label_maker.cc | 6 +-- ge/graph/label/while_label_maker.cc | 6 +-- ge/graph/load/graph_loader.cc | 2 +- ge/graph/load/graph_loader.h | 6 +-- ge/graph/load/model_manager/aipp_utils.cc | 4 +- ge/graph/load/model_manager/aipp_utils.h | 4 +- ge/graph/load/model_manager/cpu_queue_schedule.cc | 4 +- ge/graph/load/model_manager/cpu_queue_schedule.h | 2 +- ge/graph/load/model_manager/data_dumper.cc | 2 +- ge/graph/load/model_manager/data_dumper.h | 2 +- ge/graph/load/model_manager/data_inputer.cc | 6 +-- ge/graph/load/model_manager/data_inputer.h | 4 +- ge/graph/load/model_manager/davinci_model.cc | 8 ++-- ge/graph/load/model_manager/davinci_model.h | 12 ++--- ge/graph/load/model_manager/model_manager.cc | 2 +- ge/graph/load/model_manager/model_manager.h | 12 ++--- ge/graph/load/model_manager/model_utils.cc | 6 +-- ge/graph/load/model_manager/model_utils.h | 4 +- .../model_manager/task_info/kernel_ex_task_info.cc | 2 +- .../model_manager/task_info/kernel_task_info.cc | 4 +- .../task_info/super_kernel/super_kernel.cc | 2 +- .../task_info/super_kernel/super_kernel_factory.cc | 2 +- .../task_info/super_kernel/super_kernel_factory.h | 2 +- ge/graph/load/model_manager/tbe_handle_store.cc | 4 +- ge/graph/load/model_manager/tbe_handle_store.h | 2 +- ge/graph/load/model_manager/zero_copy_offset.h | 2 +- ge/graph/load/model_manager/zero_copy_task.cc | 2 +- ge/graph/manager/graph_manager.h | 4 +- ge/graph/manager/graph_manager_utils.cc | 4 +- ge/graph/manager/graph_manager_utils.h | 10 ++-- ge/graph/manager/graph_var_manager.h | 2 +- ge/graph/manager/host_mem_manager.h | 2 +- ge/graph/manager/model_manager/event_manager.h | 6 +-- ge/graph/manager/trans_var_data_utils.cc | 6 +-- ge/graph/manager/trans_var_data_utils.h | 2 +- ge/graph/manager/util/debug.h | 6 +-- ge/graph/manager/util/hcom_util.cc | 6 +-- ge/graph/manager/util/hcom_util.h | 8 ++-- ge/graph/optimize/common/params.h | 2 +- ge/graph/optimize/graph_optimize.h | 6 +-- ge/graph/optimize/summary_optimize.cc | 2 +- ge/graph/partition/dynamic_shape_partition.h | 2 +- ge/graph/partition/engine_place.cc | 2 +- ge/graph/partition/engine_place.h | 2 +- ge/graph/partition/graph_partition.cc | 2 +- ge/graph/partition/graph_partition.h | 2 +- ge/graph/partition/stage_partition.cc | 4 +- ge/graph/partition/stage_partition.h | 2 +- ge/graph/passes/addn_pass.h | 4 +- ge/graph/passes/aicpu_constant_folding_pass.cc | 4 +- ge/graph/passes/atomic_addr_clean_pass.cc | 2 +- ge/graph/passes/atomic_addr_clean_pass.h | 2 +- ge/graph/passes/attach_stream_label_pass.cc | 2 +- ge/graph/passes/base_pass.cc | 2 +- ge/graph/passes/bitcast_pass.h | 4 +- ge/graph/passes/buffer_pool_memory_pass.h | 2 +- .../common_subexpression_elimination_pass.cc | 2 +- .../passes/common_subexpression_elimination_pass.h | 2 +- ge/graph/passes/compile_nodes_pass.cc | 2 +- ge/graph/passes/cond_pass.cc | 2 +- ge/graph/passes/cond_remove_pass.cc | 2 +- ge/graph/passes/constant_folding_pass.cc | 2 +- ge/graph/passes/constant_fuse_same_pass.h | 2 +- ge/graph/passes/data_pass.h | 2 +- ge/graph/passes/dimension_adjust_pass.h | 6 +-- ge/graph/passes/dimension_compute_pass.cc | 2 +- ge/graph/passes/end_of_sequence_add_control_pass.h | 2 +- ge/graph/passes/flow_ctrl_pass.h | 2 +- ge/graph/passes/for_pass.cc | 2 +- .../fuse_data_nodes_with_common_input_pass.cc | 2 +- .../fuse_data_nodes_with_common_input_pass.h | 2 +- ge/graph/passes/get_original_format_pass.cc | 6 +-- ge/graph/passes/global_step_insert_pass.h | 2 +- ge/graph/passes/guarantee_const_pass.cc | 4 +- ge/graph/passes/hccl_continuous_memcpy_pass.cc | 4 +- ge/graph/passes/hccl_continuous_memcpy_pass.h | 2 +- ge/graph/passes/hccl_group_pass.cc | 2 +- ge/graph/passes/hccl_memcpy_pass.cc | 4 +- ge/graph/passes/hccl_memcpy_pass.h | 2 +- ge/graph/passes/hccl_tailing_optimization_pass.cc | 2 +- ge/graph/passes/infershape_pass.cc | 4 +- .../input_output_connection_identify_pass.cc | 2 +- .../passes/input_output_connection_identify_pass.h | 2 +- ge/graph/passes/iterator_op_pass.cc | 4 +- ge/graph/passes/iterator_op_pass.h | 2 +- ge/graph/passes/link_gen_mask_nodes_pass.cc | 2 +- ge/graph/passes/link_gen_mask_nodes_pass.h | 2 +- .../passes/mark_force_unknown_for_cond_pass.cc | 2 +- ge/graph/passes/mark_graph_unknown_status_pass.h | 2 +- ge/graph/passes/mark_node_unknown_shape_pass.h | 2 +- ge/graph/passes/mark_same_addr_pass.h | 2 +- ge/graph/passes/merge_input_memcpy_pass.cc | 2 +- ge/graph/passes/merge_to_stream_merge_pass.cc | 2 +- ge/graph/passes/net_output_pass.h | 2 +- ge/graph/passes/no_use_reshape_remove_pass.cc | 2 +- ge/graph/passes/parallel_group_pass.h | 2 +- ge/graph/passes/pass_manager.cc | 8 ++-- ge/graph/passes/pass_utils.cc | 8 ++-- ge/graph/passes/pass_utils.h | 2 +- ge/graph/passes/permute_pass.cc | 4 +- ge/graph/passes/print_op_pass.h | 2 +- ge/graph/passes/prune_pass.cc | 4 +- ge/graph/passes/ref_identity_delete_op_pass.cc | 2 +- ge/graph/passes/remove_same_const_pass.cc | 2 +- ge/graph/passes/remove_same_const_pass.h | 2 +- ge/graph/passes/replace_transshape_pass.cc | 2 +- ge/graph/passes/resource_pair_add_control_pass.cc | 6 +-- .../passes/resource_pair_remove_control_pass.cc | 6 +-- .../passes/same_transdata_breadth_fusion_pass.cc | 4 +- ge/graph/passes/save_pass.cc | 2 +- ge/graph/passes/save_pass.h | 2 +- ge/graph/passes/shape_operate_op_remove_pass.cc | 6 +-- ge/graph/passes/stop_gradient_pass.h | 2 +- ge/graph/passes/subexpression_migration_pass.cc | 2 +- ge/graph/passes/subexpression_migration_pass.h | 2 +- ge/graph/passes/subgraph_const_migration_pass.cc | 2 +- ge/graph/passes/subgraph_const_migration_pass.h | 2 +- ge/graph/passes/switch_data_edges_bypass.cc | 8 ++-- ge/graph/passes/switch_logic_remove_pass.cc | 2 +- ge/graph/passes/switch_to_stream_switch_pass.cc | 2 +- ge/graph/passes/transop_breadth_fusion_pass.cc | 2 +- ge/graph/passes/transop_depth_fusion_pass.cc | 4 +- .../passes/transop_nearby_allreduce_fusion_pass.cc | 4 +- .../passes/transop_symmetry_elimination_pass.cc | 4 +- .../passes/transop_without_reshape_fusion_pass.cc | 4 +- ge/graph/passes/unused_args_clean_pass.cc | 2 +- ge/graph/passes/unused_args_clean_pass.h | 2 +- ge/graph/passes/variable_op_pass.cc | 2 +- ge/graph/passes/variable_op_pass.h | 2 +- ...variable_ref_useless_control_out_delete_pass.cc | 2 +- ge/graph/preprocess/graph_preprocess.cc | 8 ++-- ge/graph/preprocess/graph_preprocess.h | 10 ++-- ge/graph/preprocess/insert_op/base_insert_op.h | 4 +- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 4 +- ge/graph/preprocess/insert_op/ge_aipp_op.h | 2 +- .../preprocess/insert_op/util_insert_aipp_op.cc | 4 +- ge/graph/preprocess/multi_batch_options.cc | 2 +- ge/host_kernels/broadcast_args_kernel.cc | 6 +-- ge/host_kernels/broadcast_gradient_args_kernel.cc | 6 +-- ge/host_kernels/cast_kernel.cc | 8 ++-- ge/host_kernels/concat_offset_kernel.cc | 6 +-- ge/host_kernels/concat_v2_kernel.cc | 4 +- ge/host_kernels/dynamic_stitch_kernel.cc | 6 +-- ge/host_kernels/empty_kernel.cc | 4 +- ge/host_kernels/expanddims_kernel.cc | 6 +-- ge/host_kernels/fill_kernel.cc | 4 +- ge/host_kernels/floordiv_kernel.cc | 4 +- ge/host_kernels/floormod_kernel.cc | 4 +- ge/host_kernels/gather_v2_kernel.cc | 8 ++-- ge/host_kernels/greater_kernel.cc | 6 +-- ge/host_kernels/identity_kernel.cc | 2 +- ge/host_kernels/kernel_utils.cc | 4 +- ge/host_kernels/kernel_utils.h | 4 +- ge/host_kernels/maximum_kernel.cc | 6 +-- ge/host_kernels/mul_kernel.cc | 6 +-- ge/host_kernels/pack_kernel.cc | 6 +-- ge/host_kernels/permute_kernel.cc | 8 ++-- ge/host_kernels/range_kernel.cc | 6 +-- ge/host_kernels/rank_kernel.cc | 8 ++-- ge/host_kernels/reduce_prod_kernel.cc | 4 +- ge/host_kernels/reformat_kernel.cc | 8 ++-- ge/host_kernels/reshape_kernel.cc | 6 +-- ge/host_kernels/rsqrt_kernel.cc | 8 ++-- ge/host_kernels/size_kernel.cc | 6 +-- ge/host_kernels/slice_d_kernel.cc | 4 +- ge/host_kernels/slice_kernel.cc | 8 ++-- ge/host_kernels/squeeze_kernel.cc | 6 +-- ge/host_kernels/ssd_prior_box_kernel.cc | 2 +- ge/host_kernels/sub_kernel.cc | 4 +- ge/host_kernels/transdata_kernel.cc | 8 ++-- ge/host_kernels/transpose_kernel.cc | 8 ++-- ge/host_kernels/unpack_kernel.cc | 8 ++-- ge/host_kernels/unsqueeze_kernel.cc | 6 +-- ge/hybrid/common/npu_memory_allocator.cc | 2 +- ge/hybrid/common/npu_memory_allocator.h | 2 +- ge/hybrid/common/tensor_value.h | 2 +- ge/hybrid/executor/hybrid_execution_context.cc | 2 +- ge/hybrid/executor/hybrid_model_async_executor.cc | 2 +- ge/hybrid/executor/hybrid_model_executor.cc | 2 +- .../executor/hybrid_model_pipeline_executor.cc | 18 ++++++- .../executor/hybrid_model_pipeline_executor.h | 18 ++++++- ge/hybrid/executor/hybrid_profiler.cc | 2 +- ge/hybrid/executor/node_state.h | 2 +- ge/hybrid/executor/rt_callback_manager.h | 2 +- ge/hybrid/executor/subgraph_context.cc | 2 +- ge/hybrid/hybrid_davinci_model.cc | 2 +- ge/hybrid/hybrid_davinci_model_stub.cc | 2 +- ge/hybrid/model/graph_item.cc | 2 +- ge/hybrid/model/hybrid_model.cc | 4 +- ge/hybrid/model/hybrid_model_builder.cc | 2 +- ge/hybrid/model/node_item.cc | 4 +- .../node_executor/aicore/aicore_node_executor.cc | 2 +- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 2 +- ge/hybrid/node_executor/aicore/aicore_op_task.h | 2 +- .../node_executor/aicore/aicore_task_builder.cc | 6 +-- .../node_executor/aicore/aicore_task_builder.h | 2 +- .../node_executor/aicore/aicore_task_compiler.cc | 2 +- .../node_executor/aicore/aicore_task_compiler.h | 2 +- .../node_executor/aicpu/aicpu_node_executor.h | 2 +- .../compiledsubgraph/known_node_executor.cc | 2 +- .../node_executor/controlop/control_op_executor.cc | 2 +- ge/hybrid/node_executor/hccl/hccl_node_executor.cc | 4 +- ge/hybrid/node_executor/node_executor.h | 2 +- .../partitioned_call_node_executor.cc | 2 +- ge/hybrid/node_executor/rts/rts_node_executor.cc | 4 +- ge/hybrid/node_executor/rts/rts_node_task.cc | 2 +- ge/hybrid/node_executor/task_context.cc | 4 +- ge/inc/graph_pass.h | 6 +-- ge/inc/kernel.h | 4 +- ge/inc/kernel_factory.h | 2 +- ge/inc/pass.h | 2 +- ge/init/gelib.cc | 2 +- ge/init/gelib.h | 4 +- ge/ir_build/attr_options/attr_options.h | 56 +++++++++++----------- ge/ir_build/attr_options/keep_dtype_option.cc | 2 +- ge/ir_build/attr_options/utils.cc | 2 +- ge/ir_build/attr_options/weight_compress_option.cc | 2 +- ge/ir_build/ge_ir_build.cc | 4 +- ge/ir_build/option_utils.cc | 2 +- ge/model/ge_model.cc | 2 +- ge/model/ge_model.h | 2 +- ge/model/ge_root_model.cc | 2 +- ge/offline/CMakeLists.txt | 16 ------- ge/offline/main.cc | 18 +++---- ge/offline/single_op_parser.cc | 4 +- ge/offline/single_op_parser.h | 4 +- ge/opskernel_manager/ops_kernel_builder_manager.cc | 2 +- ge/opskernel_manager/ops_kernel_manager.cc | 4 +- ge/opskernel_manager/ops_kernel_manager.h | 6 +-- ge/plugin/engine/CMakeLists.txt | 3 +- ge/plugin/engine/dnnengines.h | 2 +- ge/plugin/engine/engine_manage.h | 2 +- ge/session/inner_session.cc | 2 +- ge/session/inner_session.h | 2 +- ge/session/omg.cc | 20 ++++---- ge/session/session_manager.h | 4 +- ge/single_op/single_op.cc | 4 +- ge/single_op/single_op.h | 4 +- ge/single_op/single_op_model.cc | 8 ++-- ge/single_op/single_op_model.h | 2 +- ge/single_op/stream_resource.h | 2 +- ge/single_op/task/aicpu_kernel_task_builder.cc | 2 +- ge/single_op/task/op_task.cc | 2 +- ge/single_op/task/op_task.h | 2 +- ge/single_op/task/rts_kernel_task_builder.cc | 2 +- .../common/profiling/ge_runner_profiling.h | 2 +- 327 files changed, 656 insertions(+), 701 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 81e2d539..2b9122da 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -754,22 +754,15 @@ target_compile_options(ge_runner PRIVATE target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common - ${METADEF_DIR} ${METADEF_DIR}/inc - ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/external - ${GE_CODE_DIR}/../inc/cce ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external #### blue zone @@ -835,22 +828,15 @@ target_compile_options(ge_compiler PRIVATE target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common - ${METADEF_DIR} ${METADEF_DIR}/inc - ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/external - ${GE_CODE_DIR}/../inc/cce ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external #### blue zone #### @@ -1000,18 +986,14 @@ set_target_properties(atc_stub_ge_compiler PROPERTIES ) target_include_directories(atc_stub_ge_compiler PRIVATE - ${GE_CODE_DIR} ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common ${GE_CODE_DIR}/inc/external ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph + ${METADEF_DIR}/inc #### yellow zone #### - ${GE_CODE_DIR}/../inc/cce + ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external #### blue zone #### @@ -1041,18 +1023,14 @@ set_target_properties(fwk_stub_ge_runner PROPERTIES ) target_include_directories(fwk_stub_ge_runner PRIVATE - ${GE_CODE_DIR} ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph + ${METADEF_DIR}/inc #### yellow zone #### - ${GE_CODE_DIR}/../inc/cce + ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external #### blue zone #### diff --git a/ge/analyzer/analyzer.cc b/ge/analyzer/analyzer.cc index 95036267..97b59411 100755 --- a/ge/analyzer/analyzer.cc +++ b/ge/analyzer/analyzer.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "analyzer.h" +#include "analyzer/analyzer.h" #include #include diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 1aa4c41d..aa88cfb4 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "ge/ge_api.h" +#include "external/ge/ge_api.h" #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" #include "common/ge/datatype_util.h" #include "proto/ge_api.pb.h" diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index f55ff427..313f1ff3 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -72,20 +72,15 @@ target_compile_options(ge_common PRIVATE target_include_directories(ge_common PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/common - ${GE_CODE_DIR}/ge/common/op ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> - $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> @@ -141,20 +136,15 @@ target_compile_options(ge_common_static PRIVATE target_include_directories(ge_common_static PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/common - ${GE_CODE_DIR}/ge/common/op ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> - $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> @@ -200,15 +190,11 @@ target_compile_options(ge_common PRIVATE target_include_directories(ge_common PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/ge/common - ${GE_CODE_DIR}/ge/common/op ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos ${GE_CODE_DIR}/third_party/fwkacllib/inc diff --git a/ge/common/base64.h b/ge/common/base64.h index a537e585..22a78b46 100644 --- a/ge/common/base64.h +++ b/ge/common/base64.h @@ -20,8 +20,8 @@ #include #include -#include "debug/ge_log.h" -#include "ge_error_codes.h" +#include "framework/common/debug/ge_log.h" +#include "external/ge/ge_error_codes.h" namespace ge { namespace { diff --git a/ge/common/dump/dump_manager.h b/ge/common/dump/dump_manager.h index fa96de93..69152bcf 100644 --- a/ge/common/dump/dump_manager.h +++ b/ge/common/dump/dump_manager.h @@ -20,7 +20,7 @@ #include #include "common/dump/dump_properties.h" -#include "common/ge_types.h" +#include "framework/common/ge_types.h" namespace ge { class DumpManager { diff --git a/ge/common/dump/dump_op.h b/ge/common/dump/dump_op.h index b664495a..73922cb3 100755 --- a/ge/common/dump/dump_op.h +++ b/ge/common/dump/dump_op.h @@ -19,7 +19,7 @@ #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/properties_manager.h" #include "proto/op_mapping.pb.h" #include "runtime/stream.h" diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 08bddf43..ef755540 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -20,7 +20,7 @@ #include #include "common/ge/ge_util.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" #include "framework/common/ge_types.h" diff --git a/ge/common/dump/opdebug_register.cc b/ge/common/dump/opdebug_register.cc index 816455a0..41c85ff6 100644 --- a/ge/common/dump/opdebug_register.cc +++ b/ge/common/dump/opdebug_register.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "opdebug_register.h" +#include "common/dump/opdebug_register.h" namespace { const size_t kOpDebugMemorySize = 2048UL; diff --git a/ge/common/dump/opdebug_register.h b/ge/common/dump/opdebug_register.h index 1826287d..5b927b67 100644 --- a/ge/common/dump/opdebug_register.h +++ b/ge/common/dump/opdebug_register.h @@ -18,8 +18,8 @@ #define GE_COMMON_DUMP_OPDEBUG_REGISTER_H_ #include -#include "common/debug/ge_log.h" -#include "common/debug/log.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/debug/log.h" #include "graph/load/model_manager/data_dumper.h" namespace ge { diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc index ddce348b..38125979 100644 --- a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc @@ -19,7 +19,7 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/utils/formats_definitions.h" #include "common/formats/utils/formats_trans_utils.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc b/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc index 5efe486c..88de4d14 100644 --- a/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc +++ b/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc @@ -23,7 +23,7 @@ #include "common/formats/utils/formats_definitions.h" #include "common/formats/utils/formats_trans_utils.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/type_utils.h" diff --git a/ge/common/ge/datatype_util.h b/ge/common/ge/datatype_util.h index e42b25a7..c3b41b81 100644 --- a/ge/common/ge/datatype_util.h +++ b/ge/common/ge/datatype_util.h @@ -20,7 +20,7 @@ #include #include -#include "graph/types.h" +#include "external/graph/types.h" namespace ge { static const int32_t kGeSizeFloat = sizeof(float); diff --git a/ge/common/ge/plugin_manager.h b/ge/common/ge/plugin_manager.h index 8c351e62..0869704f 100755 --- a/ge/common/ge/plugin_manager.h +++ b/ge/common/ge/plugin_manager.h @@ -26,8 +26,8 @@ #include #include -#include "common/ge_inner_error_codes.h" -#include "engine/dnnengine.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/engine/dnnengine.h" #include "framework/common/debug/ge_log.h" #include "mmpa/mmpa_api.h" diff --git a/ge/common/ge_format_util.cc b/ge/common/ge_format_util.cc index d0240224..f3dee571 100755 --- a/ge/common/ge_format_util.cc +++ b/ge/common/ge_format_util.cc @@ -15,7 +15,7 @@ */ #include "framework/common/ge_format_util.h" -#include "formats/formats.h" +#include "common/formats/formats.h" namespace ge { GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status GeFormatUtil::TransShape(const TensorDesc &src_desc, diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h index 398d6c03..13253cbe 100755 --- a/ge/common/helper/model_cache_helper.h +++ b/ge/common/helper/model_cache_helper.h @@ -21,7 +21,7 @@ #include #include -#include "ge/ge_api_error_codes.h" +#include "external/ge/ge_api_error_codes.h" #include "graph/compute_graph.h" #include "graph/manager/graph_var_manager.h" #include "model/ge_model.h" diff --git a/ge/common/math/fp16_math.cc b/ge/common/math/fp16_math.cc index e465c953..6a9c2fb3 100755 --- a/ge/common/math/fp16_math.cc +++ b/ge/common/math/fp16_math.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "fp16_math.h" +#include "common/math/fp16_math.h" #include "external/register/register_types.h" namespace ge { diff --git a/ge/common/model_parser/model_parser.cc b/ge/common/model_parser/model_parser.cc index ef9ab9e6..7447cdf8 100644 --- a/ge/common/model_parser/model_parser.cc +++ b/ge/common/model_parser/model_parser.cc @@ -20,7 +20,7 @@ #include #include "securec.h" -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" namespace ge { FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelParserBase::ModelParserBase() {} diff --git a/ge/common/op/attr_value_util.cc b/ge/common/op/attr_value_util.cc index 4315a25d..8be0ecd1 100644 --- a/ge/common/op/attr_value_util.cc +++ b/ge/common/op/attr_value_util.cc @@ -17,7 +17,7 @@ #include "framework/common/op/attr_value_util.h" #include "framework/common/debug/log.h" #include "framework/common/util.h" -#include "register/register_types.h" +#include "external/register/register_types.h" namespace ge { #define DEFINE_SET_ATTR_VALUE_ONE(ARG_TYPE, FIELD) \ diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index d0343326..6ec1143c 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "common/profiling/ge_profiling.h" +#include "framework/common/profiling/ge_profiling.h" #include "runtime/base.h" #include "common/profiling/profiling_manager.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/common/profiling/ge_runner_profiling.cc b/ge/common/profiling/ge_runner_profiling.cc index 067aafe3..f74ce384 100644 --- a/ge/common/profiling/ge_runner_profiling.cc +++ b/ge/common/profiling/ge_runner_profiling.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "common/profiling/ge_runner_profiling.h" +#include "framework/common/profiling/ge_runner_profiling.h" #include "init/gelib.h" bool IsInitialize() { diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 61210de6..6707d78e 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -21,7 +21,7 @@ #include "framework/common/string_util.h" #include "graph/ge_context.h" #include "graph/utils/type_utils.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "runtime/base.h" #include "graph/load/model_manager/davinci_model.h" #include "mmpa/mmpa_api.h" diff --git a/ge/common/properties_manager.cc b/ge/common/properties_manager.cc index e1f4c66e..0c5ef1fe 100644 --- a/ge/common/properties_manager.cc +++ b/ge/common/properties_manager.cc @@ -21,7 +21,7 @@ #include #include "common/ge/ge_util.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" #include "framework/common/ge_types.h" diff --git a/ge/common/properties_manager.h b/ge/common/properties_manager.h index 7079eecb..f3f9d7c9 100644 --- a/ge/common/properties_manager.h +++ b/ge/common/properties_manager.h @@ -25,7 +25,7 @@ #include "common/dump/dump_properties.h" #include "graph/op_desc.h" -#include "common/ge_compiler_options.h" +#include "framework/common/ge_compiler_options.h" namespace ge { // Configuration property management diff --git a/ge/common/thread_pool.cc b/ge/common/thread_pool.cc index dead0127..f9b7bb99 100644 --- a/ge/common/thread_pool.cc +++ b/ge/common/thread_pool.cc @@ -23,7 +23,7 @@ #include #include -#include "register/register_types.h" +#include "external/register/register_types.h" namespace ge { FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ThreadPool::ThreadPool(uint32_t size) : is_stoped_(false) { diff --git a/ge/common/thread_pool.h b/ge/common/thread_pool.h index e173618f..7e52edcc 100755 --- a/ge/common/thread_pool.h +++ b/ge/common/thread_pool.h @@ -31,7 +31,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "external/ge/ge_api_error_codes.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "common/ge/ge_util.h" namespace ge { diff --git a/ge/common/types.cc b/ge/common/types.cc index 98ae7737..b1127483 100644 --- a/ge/common/types.cc +++ b/ge/common/types.cc @@ -15,7 +15,7 @@ */ #include "framework/common/types.h" -#include "graph/types.h" +#include "external/graph/types.h" namespace ge { // dump diff --git a/ge/engine_manager/dnnengine_manager.cc b/ge/engine_manager/dnnengine_manager.cc index e89fc847..9e338295 100644 --- a/ge/engine_manager/dnnengine_manager.cc +++ b/ge/engine_manager/dnnengine_manager.cc @@ -22,7 +22,7 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" #include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/engine_manager/dnnengine_manager.h b/ge/engine_manager/dnnengine_manager.h index c3ae5b95..42da3596 100755 --- a/ge/engine_manager/dnnengine_manager.h +++ b/ge/engine_manager/dnnengine_manager.h @@ -26,9 +26,9 @@ #include "nlohmann/json.hpp" #include "common/ge/plugin_manager.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/opskernel/ops_kernel_info_types.h" -#include "engine/dnnengine.h" +#include "framework/engine/dnnengine.h" #include "graph/op_desc.h" #include "graph/node.h" diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index b6342973..f258dffe 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -182,13 +182,10 @@ target_include_directories(ge_executor SYSTEM PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> - $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> @@ -236,13 +233,10 @@ target_include_directories(ge_executor_shared PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> - $<$>:${GE_DEPEND_DIR}/inc/cce> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> ) diff --git a/ge/executor/ge_executor.cc b/ge/executor/ge_executor.cc index 049d012f..486764bd 100755 --- a/ge/executor/ge_executor.cc +++ b/ge/executor/ge_executor.cc @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "executor/ge_executor.h" +#include "framework/executor/ge_executor.h" #include #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "common/profiling/profiling_manager.h" #include "common/dump/dump_manager.h" #include "graph/execute/graph_execute.h" diff --git a/ge/ge_local_engine/CMakeLists.txt b/ge/ge_local_engine/CMakeLists.txt index 3675d333..01a10eaa 100755 --- a/ge/ge_local_engine/CMakeLists.txt +++ b/ge/ge_local_engine/CMakeLists.txt @@ -41,8 +41,6 @@ target_include_directories(ge_local_engine PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### @@ -91,8 +89,6 @@ target_include_directories(atc_ge_local_engine PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### @@ -146,8 +142,6 @@ target_include_directories(ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### @@ -197,8 +191,6 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### @@ -254,8 +246,6 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### diff --git a/ge/ge_local_engine/engine/ge_local_engine.cc b/ge/ge_local_engine/engine/ge_local_engine.cc index ac3e5473..910bb924 100755 --- a/ge/ge_local_engine/engine/ge_local_engine.cc +++ b/ge/ge_local_engine/engine/ge_local_engine.cc @@ -19,10 +19,10 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "common/constant/constant.h" +#include "framework/common/ge_inner_error_codes.h" +#include "ge_local_engine/common/constant/constant.h" #include "common/ge/ge_util.h" -#include "ops_kernel_store/ge_local_ops_kernel_info.h" +#include "ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h" namespace ge { namespace ge_local { diff --git a/ge/ge_local_engine/engine/host_cpu_engine.cc b/ge/ge_local_engine/engine/host_cpu_engine.cc index cd68ae15..488a5ee8 100755 --- a/ge/ge_local_engine/engine/host_cpu_engine.cc +++ b/ge/ge_local_engine/engine/host_cpu_engine.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "host_cpu_engine.h" +#include "ge_local_engine/engine/host_cpu_engine.h" #include "graph/common/omg_util.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/ge_local_engine/engine/host_cpu_engine.h b/ge/ge_local_engine/engine/host_cpu_engine.h index d13fcae1..5d6fa664 100644 --- a/ge/ge_local_engine/engine/host_cpu_engine.h +++ b/ge/ge_local_engine/engine/host_cpu_engine.h @@ -33,7 +33,7 @@ #include #include "framework/common/ge_inner_error_codes.h" #include "graph/node.h" -#include "graph/operator.h" +#include "external/graph/operator.h" #include "external/../register/register.h" namespace ge { diff --git a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.cc b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.cc index 5842fe29..33aa407d 100644 --- a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.cc +++ b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "ge_local_ops_kernel_builder.h" +#include "ge_local_engine/ops_kernel_store/ge_local_ops_kernel_builder.h" #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/node_utils.h" diff --git a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.cc b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.cc index 504c3f2f..d775309d 100755 --- a/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.cc +++ b/ge/ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.cc @@ -16,14 +16,14 @@ #include "ge_local_engine/ops_kernel_store/ge_local_ops_kernel_info.h" #include -#include "common/constant/constant.h" +#include "ge_local_engine/common/constant/constant.h" #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/node_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" -#include "op/op_factory.h" +#include "ge_local_engine/ops_kernel_store/op/op_factory.h" #include "proto/task.pb.h" namespace ge { diff --git a/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.cc b/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.cc index ee601a99..dc4abfb8 100755 --- a/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.cc +++ b/ge/ge_local_engine/ops_kernel_store/op/ge_deleted_op.cc @@ -16,7 +16,7 @@ #include "ge_local_engine/ops_kernel_store/op/ge_deleted_op.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "ge_local_engine/ops_kernel_store/op/op_factory.h" namespace ge { diff --git a/ge/ge_local_engine/ops_kernel_store/op/no_op.cc b/ge/ge_local_engine/ops_kernel_store/op/no_op.cc index c2104693..45d9da47 100755 --- a/ge/ge_local_engine/ops_kernel_store/op/no_op.cc +++ b/ge/ge_local_engine/ops_kernel_store/op/no_op.cc @@ -16,7 +16,7 @@ #include "ge_local_engine/ops_kernel_store/op/no_op.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "ge_local_engine/ops_kernel_store/op/op_factory.h" namespace ge { diff --git a/ge/ge_local_engine/ops_kernel_store/op/op.cc b/ge/ge_local_engine/ops_kernel_store/op/op.cc index 11229b2c..c2ef0091 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/op.cc +++ b/ge/ge_local_engine/ops_kernel_store/op/op.cc @@ -16,7 +16,7 @@ #include "ge_local_engine/ops_kernel_store/op/op.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/op_desc.h" #include "graph/utils/anchor_utils.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/ge_local_engine/ops_kernel_store/op/op.h b/ge/ge_local_engine/ops_kernel_store/op/op.h index b75a8bed..004723e1 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/op.h +++ b/ge/ge_local_engine/ops_kernel_store/op/op.h @@ -20,7 +20,7 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/node.h" namespace ge { diff --git a/ge/ge_local_engine/ops_kernel_store/op/op_factory.cc b/ge/ge_local_engine/ops_kernel_store/op/op_factory.cc index 2e56b7bb..18f3b7b9 100644 --- a/ge/ge_local_engine/ops_kernel_store/op/op_factory.cc +++ b/ge/ge_local_engine/ops_kernel_store/op/op_factory.cc @@ -16,7 +16,7 @@ #include "ge_local_engine/ops_kernel_store/op/op_factory.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/op_desc.h" namespace ge { diff --git a/ge/ge_runtime/CMakeLists.txt b/ge/ge_runtime/CMakeLists.txt index b00dd5b3..3243766f 100644 --- a/ge/ge_runtime/CMakeLists.txt +++ b/ge/ge_runtime/CMakeLists.txt @@ -34,21 +34,13 @@ target_compile_definitions(ge_runtime PRIVATE target_include_directories(ge_runtime PRIVATE ${CMAKE_CURRENT_LIST_DIR} - ${GE_CODE_DIR} ${GE_CODE_DIR}/ge ${GE_CODE_DIR}/inc - ${GE_CODE_DIR}/inc/graph ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common - ${GE_CODE_DIR}/inc/framework/ge_runtime - ${GE_CODE_DIR}/inc/cce ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${METADEF_DIR} ${METADEF_DIR}/inc - ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/ge ) diff --git a/ge/ge_runtime/model_runner.cc b/ge/ge_runtime/model_runner.cc index 9961ab4e..9338aae2 100644 --- a/ge/ge_runtime/model_runner.cc +++ b/ge/ge_runtime/model_runner.cc @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "ge_runtime/model_runner.h" -#include "./runtime_model.h" +#include "framework/ge_runtime/model_runner.h" +#include "ge_runtime/runtime_model.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" -#include "ge_runtime/davinci_model.h" +#include "framework/ge_runtime/davinci_model.h" #include "graph/op_desc.h" namespace ge { diff --git a/ge/ge_runtime/output.cc b/ge/ge_runtime/output.cc index 90c33bb4..0be053d5 100644 --- a/ge/ge_runtime/output.cc +++ b/ge/ge_runtime/output.cc @@ -15,8 +15,8 @@ */ #include "ge_runtime/output.h" -#include "common/ge_inner_error_codes.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" namespace ge { diff --git a/ge/ge_runtime/output.h b/ge/ge_runtime/output.h index 1f7f91ee..61fcf94e 100644 --- a/ge/ge_runtime/output.h +++ b/ge/ge_runtime/output.h @@ -19,8 +19,8 @@ #include #include -#include "ge_runtime/davinci_model.h" -#include "common/ge_types.h" +#include "framework/ge_runtime/davinci_model.h" +#include "framework/common/ge_types.h" namespace ge { namespace model_runner { diff --git a/ge/ge_runtime/runtime_model.cc b/ge/ge_runtime/runtime_model.cc index efaad251..490ac25b 100644 --- a/ge/ge_runtime/runtime_model.cc +++ b/ge/ge_runtime/runtime_model.cc @@ -16,15 +16,15 @@ #include "ge_runtime/runtime_model.h" #include -#include "./model_context.h" -#include "./task/task.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" -#include "common/util.h" +#include "ge_runtime/model_context.h" +#include "ge_runtime/task/task.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/op/op_parser_util.h" -#include "graph/types.h" -#include "task/task_factory.h" +#include "external/graph/types.h" +#include "ge_runtime/task/task_factory.h" #include "ge/common/math/math_util.h" namespace ge { diff --git a/ge/ge_runtime/runtime_model.h b/ge/ge_runtime/runtime_model.h index d0c466d4..429a143f 100644 --- a/ge/ge_runtime/runtime_model.h +++ b/ge/ge_runtime/runtime_model.h @@ -20,8 +20,8 @@ #include #include #include -#include "ge_runtime/davinci_model.h" -#include "common/ge_types.h" +#include "framework/ge_runtime/davinci_model.h" +#include "framework/common/ge_types.h" #include "runtime/base.h" #include "runtime/rt_model.h" diff --git a/ge/ge_runtime/task/task.h b/ge/ge_runtime/task/task.h index c255fd22..8170f3ca 100644 --- a/ge/ge_runtime/task/task.h +++ b/ge/ge_runtime/task/task.h @@ -23,7 +23,7 @@ #include #include "runtime/rt_model.h" #include "ge_runtime/model_context.h" -#include "ge_runtime/task_info.h" +#include "framework/ge_runtime/task_info.h" #include "external/runtime/rt_error_codes.h" namespace ge { diff --git a/ge/ge_runtime/task/task_factory.h b/ge/ge_runtime/task/task_factory.h index 670d1fef..f19b7419 100644 --- a/ge/ge_runtime/task/task_factory.h +++ b/ge/ge_runtime/task/task_factory.h @@ -21,9 +21,9 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" -#include "ge_runtime/task_info.h" +#include "framework/ge_runtime/task_info.h" namespace ge { namespace model_runner { diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 58047c89..24b35bca 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "generator/ge_generator.h" +#include "framework/generator/ge_generator.h" #include #include "common/ge/ge_util.h" #include "common/ge/plugin_manager.h" -#include "common/helper/model_helper.h" -#include "common/helper/om_file_helper.h" -#include "common/util.h" +#include "framework/common/helper/model_helper.h" +#include "framework/common/helper/om_file_helper.h" +#include "framework/common/util.h" #include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" -#include "ge/ge_api.h" +#include "external/ge/ge_api.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_context.h" #include "graph/manager/graph_manager.h" diff --git a/ge/generator/generator_api.cc b/ge/generator/generator_api.cc index b64a9eb3..56a35130 100644 --- a/ge/generator/generator_api.cc +++ b/ge/generator/generator_api.cc @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "generator/generator_api.h" +#include "framework/generator/generator_api.h" #include "common/ge/ge_util.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" -#include "generator/ge_generator.h" +#include "framework/generator/ge_generator.h" #include "graph/ge_attr_value.h" #include "graph/ge_tensor.h" #include "graph/op_desc.h" diff --git a/ge/graph/build/graph_builder.cc b/ge/graph/build/graph_builder.cc index 8b172e63..96dea02e 100644 --- a/ge/graph/build/graph_builder.cc +++ b/ge/graph/build/graph_builder.cc @@ -17,7 +17,7 @@ #include "graph/build/graph_builder.h" #include "graph/build/memory/graph_mem_assigner.h" #include "common/ge/ge_util.h" -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "graph/build/logical_stream_allocator.h" #include "graph/build/run_context.h" #include "graph/build/stream_graph_optimizer.h" diff --git a/ge/graph/build/graph_builder.h b/ge/graph/build/graph_builder.h index fb9ab6bd..c4b16814 100644 --- a/ge/graph/build/graph_builder.h +++ b/ge/graph/build/graph_builder.h @@ -22,16 +22,16 @@ #include #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" #include "common/properties_manager.h" -#include "common/string_util.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/string_util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/build/model_builder.h" #include "graph/build/task_generator.h" #include "graph/compute_graph.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/manager/graph_manager_utils.h" #include "graph/model.h" #include "graph/node.h" diff --git a/ge/graph/build/label_allocator.cc b/ge/graph/build/label_allocator.cc index dd7ee828..6d81c17d 100644 --- a/ge/graph/build/label_allocator.cc +++ b/ge/graph/build/label_allocator.cc @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "label_allocator.h" +#include "graph/build/label_allocator.h" #include "framework/common/types.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/label/label_maker.h" diff --git a/ge/graph/build/memory/block_mem_assigner.cc b/ge/graph/build/memory/block_mem_assigner.cc index 9b81eae3..159e68a7 100755 --- a/ge/graph/build/memory/block_mem_assigner.cc +++ b/ge/graph/build/memory/block_mem_assigner.cc @@ -24,7 +24,7 @@ #include "graph/buffer.h" #include "graph/ge_attr_value.h" #include "graph/ge_context.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/node.h" #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" @@ -36,7 +36,7 @@ #include "graph/common/local_context.h" #include "graph/optimize/common/params.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" #include "runtime/mem.h" using std::map; diff --git a/ge/graph/build/memory/block_mem_assigner.h b/ge/graph/build/memory/block_mem_assigner.h index 231cce09..651daed5 100755 --- a/ge/graph/build/memory/block_mem_assigner.h +++ b/ge/graph/build/memory/block_mem_assigner.h @@ -24,9 +24,9 @@ #include #include #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/build/memory/mem_assigner.h" #include "graph/compute_graph.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/build/memory/hybrid_mem_assigner.h b/ge/graph/build/memory/hybrid_mem_assigner.h index 2bdfd5c5..33bb152b 100755 --- a/ge/graph/build/memory/hybrid_mem_assigner.h +++ b/ge/graph/build/memory/hybrid_mem_assigner.h @@ -22,8 +22,8 @@ #include "graph/build/memory/block_mem_assigner.h" #include "graph/compute_graph.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" namespace ge { using BlockMemAssignerPtr = std::shared_ptr; diff --git a/ge/graph/build/memory/mem_assigner.h b/ge/graph/build/memory/mem_assigner.h index 7d0252d9..d607b989 100755 --- a/ge/graph/build/memory/mem_assigner.h +++ b/ge/graph/build/memory/mem_assigner.h @@ -17,8 +17,8 @@ #ifndef GE_GRAPH_BUILD_MEMORY_MEM_ASSIGNER_H_ #define GE_GRAPH_BUILD_MEMORY_MEM_ASSIGNER_H_ -#include "common/ge_inner_error_codes.h" -#include "memory/memory_assigner.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/memory/memory_assigner.h" namespace ge { static const int64_t kInvalidOffset = -1; diff --git a/ge/graph/build/memory/memory_assigner.cc b/ge/graph/build/memory/memory_assigner.cc index 570aae07..6e49827f 100755 --- a/ge/graph/build/memory/memory_assigner.cc +++ b/ge/graph/build/memory/memory_assigner.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "memory/memory_assigner.h" +#include "framework/memory/memory_assigner.h" #include #include "framework/common/debug/ge_log.h" #include "graph/build/memory/graph_mem_assigner.h" diff --git a/ge/graph/build/memory/var_mem_assign_util.cc b/ge/graph/build/memory/var_mem_assign_util.cc index b8138a30..adddf6bd 100755 --- a/ge/graph/build/memory/var_mem_assign_util.cc +++ b/ge/graph/build/memory/var_mem_assign_util.cc @@ -16,14 +16,14 @@ #include "graph/build/memory/var_mem_assign_util.h" #include -#include "common/types.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/common/transop_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/graph_mem_allocator.h" #include "graph/manager/graph_var_manager.h" -#include "graph/tensor.h" -#include "graph/types.h" +#include "external/graph/tensor.h" +#include "external/graph/types.h" #include "graph/utils/attr_utils.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/graph/build/memory/var_mem_assign_util.h b/ge/graph/build/memory/var_mem_assign_util.h index 9528dbdb..26da9111 100644 --- a/ge/graph/build/memory/var_mem_assign_util.h +++ b/ge/graph/build/memory/var_mem_assign_util.h @@ -17,8 +17,8 @@ #ifndef GE_GRAPH_BUILD_MEMORY_VAR_MEM_ASSIGN_UTIL_H_ #define GE_GRAPH_BUILD_MEMORY_VAR_MEM_ASSIGN_UTIL_H_ #include -#include "common/debug/log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/debug/log.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/utils/node_utils.h" namespace ge { diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index 431e4882..d38e89fe 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -22,7 +22,7 @@ #include "common/dump/dump_manager.h" #include "framework/common/debug/ge_log.h" #include "graph/anchor.h" -#include "graph/attr_value.h" +#include "external/graph/attr_value.h" #include "graph/buffer.h" #include "graph/build/stream_allocator.h" #include "graph/common/omg_util.h" @@ -31,11 +31,11 @@ #include "graph/debug/ge_attr_define.h" #include "graph/ge_attr_value.h" #include "graph/ge_context.h" -#include "graph/ge_error_codes.h" +#include "external/graph/ge_error_codes.h" #include "graph/manager/graph_mem_allocator.h" #include "graph/manager/graph_var_manager.h" #include "graph/optimize/common/params.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/utils/attr_utils.h" #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" @@ -43,8 +43,8 @@ #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" -#include "memory/memory_assigner.h" -#include "omg/version.h" +#include "framework/memory/memory_assigner.h" +#include "framework/omg/version.h" #include "register/op_registry.h" #include "graph/passes/set_input_output_offset_pass.h" #include "graph/build/memory/block_mem_assigner.h" diff --git a/ge/graph/build/model_builder.h b/ge/graph/build/model_builder.h index 6f097329..151e6006 100644 --- a/ge/graph/build/model_builder.h +++ b/ge/graph/build/model_builder.h @@ -23,17 +23,17 @@ #include #include #include -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "common/tbe_kernel_store.h" #include "common/cust_aicpu_kernel_store.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/compute_graph.h" #include "graph/manager/graph_manager_utils.h" #include "graph/model.h" #include "graph/node.h" #include "model/ge_model.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace ge { class ModelBuilder { diff --git a/ge/graph/build/run_context.cc b/ge/graph/build/run_context.cc index 05e40b63..e7f07c0a 100644 --- a/ge/graph/build/run_context.cc +++ b/ge/graph/build/run_context.cc @@ -15,7 +15,7 @@ */ #include "graph/build/run_context.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" #include "graph/common/omg_util.h" diff --git a/ge/graph/build/run_context.h b/ge/graph/build/run_context.h index 82f799aa..20ba76d4 100755 --- a/ge/graph/build/run_context.h +++ b/ge/graph/build/run_context.h @@ -18,7 +18,7 @@ #define GE_GRAPH_BUILD_RUN_CONTEXT_H_ #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/opskernel/ops_kernel_info_types.h" #include "framework/common/types.h" #include "graph/compute_graph.h" diff --git a/ge/graph/build/stream_allocator.cc b/ge/graph/build/stream_allocator.cc index d896925c..bc34a228 100644 --- a/ge/graph/build/stream_allocator.cc +++ b/ge/graph/build/stream_allocator.cc @@ -27,7 +27,7 @@ #include "graph/ge_context.h" #include "graph/utils/graph_utils.h" #include "init/gelib.h" -#include "common/string_util.h" +#include "framework/common/string_util.h" #include "common/util/error_manager/error_manager.h" using std::map; diff --git a/ge/graph/build/stream_graph_optimizer.cc b/ge/graph/build/stream_graph_optimizer.cc index 30142c2b..acf91ad5 100644 --- a/ge/graph/build/stream_graph_optimizer.cc +++ b/ge/graph/build/stream_graph_optimizer.cc @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "stream_graph_optimizer.h" +#include "graph/build/stream_graph_optimizer.h" #include -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/node_utils.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/graph/build/stream_graph_optimizer.h b/ge/graph/build/stream_graph_optimizer.h index d69fa7ba..ec32f7fb 100644 --- a/ge/graph/build/stream_graph_optimizer.h +++ b/ge/graph/build/stream_graph_optimizer.h @@ -18,7 +18,7 @@ #define GE_GRAPH_BUILD_OPTIMIZE_STREAM_GRAPH_H_ #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/opskernel/ops_kernel_info_types.h" #include "framework/common/types.h" #include "graph/compute_graph.h" diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index f9456aab..5dee37d6 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -18,8 +18,8 @@ #include #include #include "common/profiling/profiling_manager.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" @@ -32,7 +32,7 @@ #include "graph/common/ge_call_wrapper.h" #include "init/gelib.h" #include "graph/ge_local_context.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "opskernel_manager/ops_kernel_builder_manager.h" using domi::LogTimeStampDef; diff --git a/ge/graph/build/task_generator.h b/ge/graph/build/task_generator.h index 40cef3ba..6f460906 100755 --- a/ge/graph/build/task_generator.h +++ b/ge/graph/build/task_generator.h @@ -21,7 +21,7 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/opskernel/ops_kernel_info_types.h" #include "framework/common/types.h" #include "graph/compute_graph.h" diff --git a/ge/graph/common/bcast.cc b/ge/graph/common/bcast.cc index b36b50b2..fcc8f9a1 100644 --- a/ge/graph/common/bcast.cc +++ b/ge/graph/common/bcast.cc @@ -19,7 +19,7 @@ #include #include "common/math_util.h" -#include "common/util.h" +#include "framework/common/util.h" using domi::Status; diff --git a/ge/graph/common/bcast.h b/ge/graph/common/bcast.h index a8399896..184751fe 100644 --- a/ge/graph/common/bcast.h +++ b/ge/graph/common/bcast.h @@ -21,11 +21,11 @@ #include #include -#include "common/debug/log.h" -#include "common/types.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/attr_value.h" +#include "external/graph/attr_value.h" #include "graph/ge_tensor.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/graph/common/local_context.cc b/ge/graph/common/local_context.cc index d3e66861..fa2f78e0 100644 --- a/ge/graph/common/local_context.cc +++ b/ge/graph/common/local_context.cc @@ -16,9 +16,9 @@ #include "graph/common/local_context.h" -#include "common/ge_inner_error_codes.h" -#include "common/debug/ge_log.h" -#include "omg/omg_inner_types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/debug/ge_log.h" +#include "framework/omg/omg_inner_types.h" namespace ge { namespace { diff --git a/ge/graph/common/local_context.h b/ge/graph/common/local_context.h index 83367766..4aa95855 100644 --- a/ge/graph/common/local_context.h +++ b/ge/graph/common/local_context.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_COMMON_LOCAL_CONTEXT_H_ #define GE_GRAPH_COMMON_LOCAL_CONTEXT_H_ -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace ge { void SetLocalOmgContext(OmgContext &context); diff --git a/ge/graph/common/omg_util.h b/ge/graph/common/omg_util.h index edaafa45..d55cc7c8 100644 --- a/ge/graph/common/omg_util.h +++ b/ge/graph/common/omg_util.h @@ -22,8 +22,8 @@ #include #include -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/node.h" namespace ge { diff --git a/ge/graph/common/transop_util.cc b/ge/graph/common/transop_util.cc index 62b4c4e4..871ecdb1 100755 --- a/ge/graph/common/transop_util.cc +++ b/ge/graph/common/transop_util.cc @@ -16,7 +16,7 @@ #include "graph/common/transop_util.h" -#include "common/types.h" +#include "framework/common/types.h" #include "graph/utils/type_utils.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/graph/execute/graph_execute.h b/ge/graph/execute/graph_execute.h index aa791c9b..879a124c 100755 --- a/ge/graph/execute/graph_execute.h +++ b/ge/graph/execute/graph_execute.h @@ -24,14 +24,14 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" -#include "common/ge_types.h" +#include "framework/common/ge_types.h" #include "common/properties_manager.h" -#include "common/string_util.h" -#include "common/types.h" -#include "common/util.h" -#include "ge/ge_api_types.h" +#include "framework/common/string_util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" +#include "external/ge/ge_api_types.h" #include "graph/compute_graph.h" #include "graph/manager/graph_context.h" #include "graph/manager/graph_manager_utils.h" diff --git a/ge/graph/label/case_label_maker.cc b/ge/graph/label/case_label_maker.cc index 3fdb1783..88d698d1 100644 --- a/ge/graph/label/case_label_maker.cc +++ b/ge/graph/label/case_label_maker.cc @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "case_label_maker.h" +#include "graph/label/case_label_maker.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "framework/common/op/ge_op_utils.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/label/if_label_maker.cc b/ge/graph/label/if_label_maker.cc index 72b33015..df911e70 100644 --- a/ge/graph/label/if_label_maker.cc +++ b/ge/graph/label/if_label_maker.cc @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "if_label_maker.h" +#include "graph/label/if_label_maker.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "framework/common/op/ge_op_utils.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/label/label_maker.cc b/ge/graph/label/label_maker.cc index 638cbbae..47eeda86 100644 --- a/ge/graph/label/label_maker.cc +++ b/ge/graph/label/label_maker.cc @@ -16,8 +16,8 @@ #include "graph/label/label_maker.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "framework/common/op/ge_op_utils.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/label/partitioned_call_label_maker.cc b/ge/graph/label/partitioned_call_label_maker.cc index 7b4bcbd8..ec8b8c89 100644 --- a/ge/graph/label/partitioned_call_label_maker.cc +++ b/ge/graph/label/partitioned_call_label_maker.cc @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "partitioned_call_label_maker.h" +#include "graph/label/partitioned_call_label_maker.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/label/while_label_maker.cc b/ge/graph/label/while_label_maker.cc index cd6b3743..7e6b8a98 100644 --- a/ge/graph/label/while_label_maker.cc +++ b/ge/graph/label/while_label_maker.cc @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "while_label_maker.h" +#include "graph/label/while_label_maker.h" -#include "common/util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/util.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "framework/common/op/ge_op_utils.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/load/graph_loader.cc b/ge/graph/load/graph_loader.cc index 94b90d69..b2a61106 100755 --- a/ge/graph/load/graph_loader.cc +++ b/ge/graph/load/graph_loader.cc @@ -19,7 +19,7 @@ #include #include -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "common/model_parser/model_parser.h" #include "graph/ge_context.h" #include "graph/load/model_manager/model_manager.h" diff --git a/ge/graph/load/graph_loader.h b/ge/graph/load/graph_loader.h index e11af749..f6324c98 100755 --- a/ge/graph/load/graph_loader.h +++ b/ge/graph/load/graph_loader.h @@ -21,9 +21,9 @@ #include #include -#include "common/debug/log.h" -#include "common/fmk_types.h" -#include "common/ge_types.h" +#include "framework/common/debug/log.h" +#include "framework/common/fmk_types.h" +#include "framework/common/ge_types.h" #include "graph/compute_graph.h" #include "graph/manager/graph_manager_utils.h" #include "graph/model.h" diff --git a/ge/graph/load/model_manager/aipp_utils.cc b/ge/graph/load/model_manager/aipp_utils.cc index 8a18c421..a9f885f8 100755 --- a/ge/graph/load/model_manager/aipp_utils.cc +++ b/ge/graph/load/model_manager/aipp_utils.cc @@ -18,8 +18,8 @@ #include -#include "common/debug/log.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/debug/log.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/attr_utils.h" diff --git a/ge/graph/load/model_manager/aipp_utils.h b/ge/graph/load/model_manager/aipp_utils.h index 78107f3e..237eeced 100755 --- a/ge/graph/load/model_manager/aipp_utils.h +++ b/ge/graph/load/model_manager/aipp_utils.h @@ -19,8 +19,8 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/ge_types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/ge_types.h" #include "graph/op_desc.h" #include "proto/insert_op.pb.h" diff --git a/ge/graph/load/model_manager/cpu_queue_schedule.cc b/ge/graph/load/model_manager/cpu_queue_schedule.cc index 9821aa73..0ec80b34 100644 --- a/ge/graph/load/model_manager/cpu_queue_schedule.cc +++ b/ge/graph/load/model_manager/cpu_queue_schedule.cc @@ -15,8 +15,8 @@ */ #include "graph/load/model_manager/cpu_queue_schedule.h" -#include "common/debug/ge_log.h" -#include "common/debug/log.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/debug/log.h" namespace { const uint32_t kCoreDim = 1; // for rtCpuKernelLaunch diff --git a/ge/graph/load/model_manager/cpu_queue_schedule.h b/ge/graph/load/model_manager/cpu_queue_schedule.h index 8dc44538..d3c8915e 100644 --- a/ge/graph/load/model_manager/cpu_queue_schedule.h +++ b/ge/graph/load/model_manager/cpu_queue_schedule.h @@ -19,7 +19,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/load/model_manager/task_info/task_info.h" #include "graph/load/model_manager/zero_copy_offset.h" #include "runtime/kernel.h" diff --git a/ge/graph/load/model_manager/data_dumper.cc b/ge/graph/load/model_manager/data_dumper.cc index c96b3885..7b5d9df9 100644 --- a/ge/graph/load/model_manager/data_dumper.cc +++ b/ge/graph/load/model_manager/data_dumper.cc @@ -24,7 +24,7 @@ #include "common/debug/memory_dumper.h" #include "common/properties_manager.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" #include "graph/anchor.h" diff --git a/ge/graph/load/model_manager/data_dumper.h b/ge/graph/load/model_manager/data_dumper.h index d1714950..2851e63a 100755 --- a/ge/graph/load/model_manager/data_dumper.h +++ b/ge/graph/load/model_manager/data_dumper.h @@ -29,7 +29,7 @@ #include "proto/ge_ir.pb.h" #include "proto/op_mapping.pb.h" #include "runtime/mem.h" -#include "task_info/task_info.h" +#include "graph/load/model_manager/task_info/task_info.h" #include "framework/common/ge_types.h" #include "runtime/base.h" diff --git a/ge/graph/load/model_manager/data_inputer.cc b/ge/graph/load/model_manager/data_inputer.cc index d286b9b4..d68e95aa 100755 --- a/ge/graph/load/model_manager/data_inputer.cc +++ b/ge/graph/load/model_manager/data_inputer.cc @@ -18,9 +18,9 @@ #include -#include "common/debug/log.h" -#include "common/scope_guard.h" -#include "common/types.h" +#include "framework/common/debug/log.h" +#include "framework/common/scope_guard.h" +#include "framework/common/types.h" namespace ge { domi::Status InputDataWrapper::Init(const InputData &input, const OutputData &output) { diff --git a/ge/graph/load/model_manager/data_inputer.h b/ge/graph/load/model_manager/data_inputer.h index b8d145d4..28b6fb26 100755 --- a/ge/graph/load/model_manager/data_inputer.h +++ b/ge/graph/load/model_manager/data_inputer.h @@ -22,8 +22,8 @@ #include #include "common/blocking_queue.h" -#include "common/ge_types.h" -#include "common/types.h" +#include "framework/common/ge_types.h" +#include "framework/common/types.h" namespace ge { /// diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 97238a4a..b6c4c7b0 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -21,14 +21,14 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "common/profiling/profiling_manager.h" #include "common/properties_manager.h" -#include "common/scope_guard.h" +#include "framework/common/scope_guard.h" #include "common/thread_pool.h" #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" @@ -36,7 +36,7 @@ #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_context.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/load/model_manager/cpu_queue_schedule.h" #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/tbe_handle_store.h" diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index 4c06ad98..1e964855 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -24,14 +24,14 @@ #include #include -#include "common/ge_types.h" -#include "common/helper/model_helper.h" -#include "common/helper/om_file_helper.h" +#include "framework/common/ge_types.h" +#include "framework/common/helper/model_helper.h" +#include "framework/common/helper/om_file_helper.h" #include "common/opskernel/ge_task_info.h" #include "common/properties_manager.h" #include "common/dump/exception_dumper.h" #include "common/dump/opdebug_register.h" -#include "common/types.h" +#include "framework/common/types.h" #include "framework/common/util.h" #include "graph/debug/ge_attr_define.h" #include "graph/load/model_manager/aipp_utils.h" @@ -43,12 +43,12 @@ #include "graph/model.h" #include "graph/node.h" #include "graph/op_desc.h" -#include "graph/operator.h" +#include "external/graph/operator.h" #include "graph/utils/attr_utils.h" #include "graph/utils/tensor_utils.h" #include "mmpa/mmpa_api.h" #include "proto/task.pb.h" -#include "task_info/task_info.h" +#include "graph/load/model_manager/task_info/task_info.h" #include "graph/common/local_context.h" using std::mutex; diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 6a563d2f..2cb31074 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -21,7 +21,7 @@ #include "aicpu/aicpu_schedule/aicpu_op_type_list.h" #include "common/model_parser/model_parser.h" #include "common/dump/dump_manager.h" -#include "common/l2_cache_optimize.h" +#include "framework/common/l2_cache_optimize.h" #include "common/profiling/profiling_manager.h" #include "graph/common/ge_call_wrapper.h" #include "graph/load/model_manager/davinci_model.h" diff --git a/ge/graph/load/model_manager/model_manager.h b/ge/graph/load/model_manager/model_manager.h index e35bb7aa..63a03dd7 100755 --- a/ge/graph/load/model_manager/model_manager.h +++ b/ge/graph/load/model_manager/model_manager.h @@ -26,13 +26,13 @@ #include #include #include "cce/aicpu_engine_struct.h" -#include "common/ge_inner_error_codes.h" -#include "common/ge_types.h" -#include "common/helper/model_helper.h" -#include "common/helper/om_file_helper.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/ge_types.h" +#include "framework/common/helper/model_helper.h" +#include "framework/common/helper/om_file_helper.h" #include "common/properties_manager.h" -#include "common/types.h" -#include "ge/ge_api_types.h" +#include "framework/common/types.h" +#include "external/ge/ge_api_types.h" #include "graph/ge_context.h" #include "graph/model.h" #include "hybrid/hybrid_davinci_model.h" diff --git a/ge/graph/load/model_manager/model_utils.cc b/ge/graph/load/model_manager/model_utils.cc index 224a3331..a31837ca 100755 --- a/ge/graph/load/model_manager/model_utils.cc +++ b/ge/graph/load/model_manager/model_utils.cc @@ -16,11 +16,11 @@ #include "graph/load/model_manager/model_utils.h" #include -#include "common/debug/log.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/debug/log.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/manager/graph_var_manager.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/build/memory/block_mem_assigner.h" #include "common/math/math_util.h" diff --git a/ge/graph/load/model_manager/model_utils.h b/ge/graph/load/model_manager/model_utils.h index 8ce1b060..0eadc7a8 100755 --- a/ge/graph/load/model_manager/model_utils.h +++ b/ge/graph/load/model_manager/model_utils.h @@ -19,8 +19,8 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/load/model_manager/task_info/task_info.h" #include "graph/op_desc.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc index 356919f6..a4b3de75 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc @@ -23,7 +23,7 @@ #include "common/properties_manager.h" #include "framework/common/debug/ge_log.h" #include "framework/common/fmk_error_codes.h" -#include "graph/attr_value.h" +#include "external/graph/attr_value.h" #include "graph/load/model_manager/davinci_model.h" #include "graph/load/model_manager/model_manager.h" #include "hybrid/node_executor/aicpu/aicpu_ext_info.h" diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_task_info.cc index 919a56cd..bfb6e24b 100755 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.cc @@ -29,8 +29,8 @@ #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/model_utils.h" #include "runtime/kernel.h" -#include "super_kernel/super_kernel.h" -#include "super_kernel/super_kernel_factory.h" +#include "graph/load/model_manager/task_info/super_kernel/super_kernel.h" +#include "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h" #include "cce/aicpu_engine_struct.h" #include "hybrid/node_executor/aicpu/aicpu_ext_info.h" #include "framework/common/debug/log.h" diff --git a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc index 44aac465..b5db845d 100644 --- a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc +++ b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "super_kernel.h" +#include "graph/load/model_manager/task_info/super_kernel/super_kernel.h" #include "framework/common/debug/ge_log.h" namespace ge { 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 07dc5d19..d1f53cc4 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 @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "super_kernel_factory.h" +#include "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h" #include "framework/common/debug/ge_log.h" namespace ge { diff --git a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h index c5058b6a..741d1c13 100644 --- a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h +++ b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h @@ -18,7 +18,7 @@ #define SUPER_KERNEL_FACTORY_H #include -#include "super_kernel.h" +#include "graph/load/model_manager/task_info/super_kernel/super_kernel.h" #include "framework/common/debug/log.h" namespace ge { diff --git a/ge/graph/load/model_manager/tbe_handle_store.cc b/ge/graph/load/model_manager/tbe_handle_store.cc index 36207aa2..d20b1bbf 100755 --- a/ge/graph/load/model_manager/tbe_handle_store.cc +++ b/ge/graph/load/model_manager/tbe_handle_store.cc @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "tbe_handle_store.h" +#include "graph/load/model_manager/tbe_handle_store.h" #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "runtime/kernel.h" diff --git a/ge/graph/load/model_manager/tbe_handle_store.h b/ge/graph/load/model_manager/tbe_handle_store.h index 6c3ad750..ba934fc3 100644 --- a/ge/graph/load/model_manager/tbe_handle_store.h +++ b/ge/graph/load/model_manager/tbe_handle_store.h @@ -25,7 +25,7 @@ #include #include -#include "common/fmk_types.h" +#include "framework/common/fmk_types.h" #include "graph/op_kernel_bin.h" namespace ge { diff --git a/ge/graph/load/model_manager/zero_copy_offset.h b/ge/graph/load/model_manager/zero_copy_offset.h index 2dea5666..f3dd07a8 100644 --- a/ge/graph/load/model_manager/zero_copy_offset.h +++ b/ge/graph/load/model_manager/zero_copy_offset.h @@ -29,7 +29,7 @@ #include "graph/utils/attr_utils.h" #include "graph/utils/tensor_utils.h" #include "runtime/mem.h" -#include "task_info/task_info.h" +#include "graph/load/model_manager/task_info/task_info.h" using std::map; using std::set; diff --git a/ge/graph/load/model_manager/zero_copy_task.cc b/ge/graph/load/model_manager/zero_copy_task.cc index 4957f8ea..85be6d7b 100755 --- a/ge/graph/load/model_manager/zero_copy_task.cc +++ b/ge/graph/load/model_manager/zero_copy_task.cc @@ -19,7 +19,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" #include "graph/load/model_manager/model_utils.h" -#include "common/ge_compiler_options.h" +#include "framework/common/ge_compiler_options.h" namespace ge { ZeroCopyTask::ZeroCopyTask(const string &name, uint8_t *args, size_t size) diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 945a5e5d..93ce354a 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -26,10 +26,10 @@ #include #include "common/blocking_queue.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/helper/model_cache_helper.h" #include "external/graph/types.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/build/graph_builder.h" #include "graph/execute/graph_execute.h" #include "graph/ge_local_context.h" diff --git a/ge/graph/manager/graph_manager_utils.cc b/ge/graph/manager/graph_manager_utils.cc index a70b15a6..42251b10 100644 --- a/ge/graph/manager/graph_manager_utils.cc +++ b/ge/graph/manager/graph_manager_utils.cc @@ -21,12 +21,12 @@ #include "framework/common/debug/ge_log.h" #include "common/ge/ge_util.h" -#include "common/string_util.h" +#include "framework/common/string_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/compute_graph.h" #include "graph/op_desc.h" #include "graph/optimize/common/params.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" #include "runtime/mem.h" namespace ge { diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index d38b4321..6ed76e57 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -27,17 +27,17 @@ #include #include "common/blocking_queue.h" -#include "common/ge_types.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_types.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/model.h" #include "model/ge_model.h" #include "model/ge_root_model.h" -#include "register/register_fmk_types.h" +#include "external/register/register_fmk_types.h" #include "external/ge/ge_api_types.h" namespace ge { diff --git a/ge/graph/manager/graph_var_manager.h b/ge/graph/manager/graph_var_manager.h index 0da12f9c..736466c4 100755 --- a/ge/graph/manager/graph_var_manager.h +++ b/ge/graph/manager/graph_var_manager.h @@ -30,7 +30,7 @@ #include "framework/common/l2_cache_optimize.h" #include "graph/ge_tensor.h" #include "graph/op_desc.h" -#include "graph/tensor.h" +#include "external/graph/tensor.h" #include "runtime/mem.h" namespace ge { diff --git a/ge/graph/manager/host_mem_manager.h b/ge/graph/manager/host_mem_manager.h index 84d5aebe..6ff19edb 100644 --- a/ge/graph/manager/host_mem_manager.h +++ b/ge/graph/manager/host_mem_manager.h @@ -32,7 +32,7 @@ #include "framework/common/l2_cache_optimize.h" #include "graph/ge_tensor.h" #include "graph/op_desc.h" -#include "graph/tensor.h" +#include "external/graph/tensor.h" #include "runtime/mem.h" namespace ge { diff --git a/ge/graph/manager/model_manager/event_manager.h b/ge/graph/manager/model_manager/event_manager.h index a7464e0c..2cb1c3f6 100644 --- a/ge/graph/manager/model_manager/event_manager.h +++ b/ge/graph/manager/model_manager/event_manager.h @@ -20,9 +20,9 @@ #include -#include "common/fmk_error_codes.h" -#include "common/fmk_types.h" -#include "common/util.h" +#include "framework/common/fmk_error_codes.h" +#include "framework/common/fmk_types.h" +#include "framework/common/util.h" #include "runtime/event.h" namespace ge { diff --git a/ge/graph/manager/trans_var_data_utils.cc b/ge/graph/manager/trans_var_data_utils.cc index 621eba79..4c25dff1 100644 --- a/ge/graph/manager/trans_var_data_utils.cc +++ b/ge/graph/manager/trans_var_data_utils.cc @@ -16,14 +16,14 @@ #include "graph/manager/trans_var_data_utils.h" -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "graph/manager/graph_var_manager.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/utils/type_utils.h" #include "common/thread_pool.h" #include diff --git a/ge/graph/manager/trans_var_data_utils.h b/ge/graph/manager/trans_var_data_utils.h index 95ebd09a..d5096ef2 100755 --- a/ge/graph/manager/trans_var_data_utils.h +++ b/ge/graph/manager/trans_var_data_utils.h @@ -24,7 +24,7 @@ #include "graph/utils/tensor_utils.h" #include "graph/node.h" #include "runtime/context.h" -#include "graph_var_manager.h" +#include "graph/manager/graph_var_manager.h" namespace ge { class TransVarDataUtils { diff --git a/ge/graph/manager/util/debug.h b/ge/graph/manager/util/debug.h index e1b13caf..02cacb72 100755 --- a/ge/graph/manager/util/debug.h +++ b/ge/graph/manager/util/debug.h @@ -33,10 +33,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "mmpa/mmpa_api.h" #include "proto/om.pb.h" #include "runtime/kernel.h" diff --git a/ge/graph/manager/util/hcom_util.cc b/ge/graph/manager/util/hcom_util.cc index 2da19cc9..8e12ff27 100644 --- a/ge/graph/manager/util/hcom_util.cc +++ b/ge/graph/manager/util/hcom_util.cc @@ -16,10 +16,10 @@ #include "graph/manager/util/hcom_util.h" -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/math/math_util.h" -#include "common/op/attr_value_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/attr_value_util.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/manager/util/hcom_util.h b/ge/graph/manager/util/hcom_util.h index f80ced35..96ef92bf 100644 --- a/ge/graph/manager/util/hcom_util.h +++ b/ge/graph/manager/util/hcom_util.h @@ -21,11 +21,11 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/opskernel/ge_task_info.h" -#include "common/string_util.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/string_util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/op_desc.h" #include "hccl/hcom.h" #include "proto/task.pb.h" diff --git a/ge/graph/optimize/common/params.h b/ge/graph/optimize/common/params.h index d5b66b8f..fbe58c6b 100644 --- a/ge/graph/optimize/common/params.h +++ b/ge/graph/optimize/common/params.h @@ -20,7 +20,7 @@ #include #include "common/singleton.h" -#include "common/types.h" +#include "framework/common/types.h" namespace ge { class Params : public Singleton { diff --git a/ge/graph/optimize/graph_optimize.h b/ge/graph/optimize/graph_optimize.h index 702b7e33..a3d359b6 100755 --- a/ge/graph/optimize/graph_optimize.h +++ b/ge/graph/optimize/graph_optimize.h @@ -25,13 +25,13 @@ #include #include -#include "common/ge_inner_error_codes.h" -#include "common/ge_types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/ge_types.h" #include "common/optimizer/graph_optimizer.h" #include "graph/compute_graph.h" #include "graph/manager/graph_context.h" #include "graph/manager/graph_manager_utils.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace ge { using ComputeGraphPtr = std::shared_ptr; diff --git a/ge/graph/optimize/summary_optimize.cc b/ge/graph/optimize/summary_optimize.cc index d3c02d3e..08a27c4e 100644 --- a/ge/graph/optimize/summary_optimize.cc +++ b/ge/graph/optimize/summary_optimize.cc @@ -21,7 +21,7 @@ #include "graph/optimize/graph_optimize.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace { const char *const kSummary = "Summary"; diff --git a/ge/graph/partition/dynamic_shape_partition.h b/ge/graph/partition/dynamic_shape_partition.h index bd3b128f..31146570 100644 --- a/ge/graph/partition/dynamic_shape_partition.h +++ b/ge/graph/partition/dynamic_shape_partition.h @@ -21,7 +21,7 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" namespace ge { diff --git a/ge/graph/partition/engine_place.cc b/ge/graph/partition/engine_place.cc index 93cc3e61..8639f015 100755 --- a/ge/graph/partition/engine_place.cc +++ b/ge/graph/partition/engine_place.cc @@ -22,7 +22,7 @@ #include #include -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "common/util/error_manager/error_manager.h" #include "graph/utils/graph_utils.h" #include "graph/utils/op_desc_utils.h" diff --git a/ge/graph/partition/engine_place.h b/ge/graph/partition/engine_place.h index 5dc3e6a0..125babb6 100755 --- a/ge/graph/partition/engine_place.h +++ b/ge/graph/partition/engine_place.h @@ -20,7 +20,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" namespace ge { diff --git a/ge/graph/partition/graph_partition.cc b/ge/graph/partition/graph_partition.cc index a810aab0..6f221d97 100755 --- a/ge/graph/partition/graph_partition.cc +++ b/ge/graph/partition/graph_partition.cc @@ -24,7 +24,7 @@ #include "analyzer/analyzer.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/graph_manager_utils.h" diff --git a/ge/graph/partition/graph_partition.h b/ge/graph/partition/graph_partition.h index f34c67e6..560aa9e7 100644 --- a/ge/graph/partition/graph_partition.h +++ b/ge/graph/partition/graph_partition.h @@ -28,7 +28,7 @@ #include #include "graph/compute_graph.h" #include "graph/manager/graph_manager_utils.h" -#include "graph/operator_reg.h" +#include "external/graph/operator_reg.h" #include "graph/partition/engine_place.h" namespace ge { diff --git a/ge/graph/partition/stage_partition.cc b/ge/graph/partition/stage_partition.cc index 309e24c4..68b4209f 100644 --- a/ge/graph/partition/stage_partition.cc +++ b/ge/graph/partition/stage_partition.cc @@ -21,8 +21,8 @@ #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/utils/op_desc_utils.h" -#include "common/util.h" -#include "common/types.h" +#include "framework/common/util.h" +#include "framework/common/types.h" namespace ge { namespace { diff --git a/ge/graph/partition/stage_partition.h b/ge/graph/partition/stage_partition.h index bac00e6b..99aac2b9 100644 --- a/ge/graph/partition/stage_partition.h +++ b/ge/graph/partition/stage_partition.h @@ -21,7 +21,7 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" namespace ge { diff --git a/ge/graph/passes/addn_pass.h b/ge/graph/passes/addn_pass.h index 373d1842..075ff9fc 100644 --- a/ge/graph/passes/addn_pass.h +++ b/ge/graph/passes/addn_pass.h @@ -17,10 +17,10 @@ #ifndef GE_GRAPH_PASSES_ADDN_PASS_H_ #define GE_GRAPH_PASSES_ADDN_PASS_H_ -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "framework/common/types.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/passes/base_pass.h" #include "graph/passes/pass_utils.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/aicpu_constant_folding_pass.cc b/ge/graph/passes/aicpu_constant_folding_pass.cc index 8fdb51a1..d33d4db2 100644 --- a/ge/graph/passes/aicpu_constant_folding_pass.cc +++ b/ge/graph/passes/aicpu_constant_folding_pass.cc @@ -19,9 +19,9 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" -#include "common/types.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/attr_utils.h" diff --git a/ge/graph/passes/atomic_addr_clean_pass.cc b/ge/graph/passes/atomic_addr_clean_pass.cc index 9f202c77..cc22d126 100755 --- a/ge/graph/passes/atomic_addr_clean_pass.cc +++ b/ge/graph/passes/atomic_addr_clean_pass.cc @@ -22,7 +22,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" #include "graph/common/ge_call_wrapper.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/passes/atomic_addr_clean_pass.h b/ge/graph/passes/atomic_addr_clean_pass.h index 0d0b8fff..30162359 100755 --- a/ge/graph/passes/atomic_addr_clean_pass.h +++ b/ge/graph/passes/atomic_addr_clean_pass.h @@ -19,7 +19,7 @@ #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/attach_stream_label_pass.cc b/ge/graph/passes/attach_stream_label_pass.cc index d5b28ec7..bcf86bc2 100644 --- a/ge/graph/passes/attach_stream_label_pass.cc +++ b/ge/graph/passes/attach_stream_label_pass.cc @@ -15,7 +15,7 @@ */ #include "graph/passes/attach_stream_label_pass.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/common/omg_util.h" using std::string; diff --git a/ge/graph/passes/base_pass.cc b/ge/graph/passes/base_pass.cc index 165e7e81..a1551eb2 100755 --- a/ge/graph/passes/base_pass.cc +++ b/ge/graph/passes/base_pass.cc @@ -19,7 +19,7 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" #include "graph/compute_graph.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/bitcast_pass.h b/ge/graph/passes/bitcast_pass.h index 34acaf57..60990dea 100644 --- a/ge/graph/passes/bitcast_pass.h +++ b/ge/graph/passes/bitcast_pass.h @@ -17,10 +17,10 @@ #ifndef GE_GRAPH_PASSES_BITCAST_PASS_H_ #define GE_GRAPH_PASSES_BITCAST_PASS_H_ -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "framework/common/types.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/op_desc.h" #include "graph/passes/base_pass.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/passes/buffer_pool_memory_pass.h b/ge/graph/passes/buffer_pool_memory_pass.h index e3d1c159..89fc5363 100644 --- a/ge/graph/passes/buffer_pool_memory_pass.h +++ b/ge/graph/passes/buffer_pool_memory_pass.h @@ -18,7 +18,7 @@ #define GE_GRAPH_PASSES_BUFFER_POOL_MEMORY_PASS_H_ #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/common_subexpression_elimination_pass.cc b/ge/graph/passes/common_subexpression_elimination_pass.cc index 852ed98a..c41a5cf5 100644 --- a/ge/graph/passes/common_subexpression_elimination_pass.cc +++ b/ge/graph/passes/common_subexpression_elimination_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "common_subexpression_elimination_pass.h" +#include "graph/passes/common_subexpression_elimination_pass.h" #include #include diff --git a/ge/graph/passes/common_subexpression_elimination_pass.h b/ge/graph/passes/common_subexpression_elimination_pass.h index 83bfbace..b182f8b9 100644 --- a/ge/graph/passes/common_subexpression_elimination_pass.h +++ b/ge/graph/passes/common_subexpression_elimination_pass.h @@ -16,7 +16,7 @@ #ifndef GE_COMMON_SUBEXPRESSION_ELIMINATION_H_ #define GE_COMMON_SUBEXPRESSION_ELIMINATION_H_ -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/compile_nodes_pass.cc b/ge/graph/passes/compile_nodes_pass.cc index d0dcec16..1e734178 100755 --- a/ge/graph/passes/compile_nodes_pass.cc +++ b/ge/graph/passes/compile_nodes_pass.cc @@ -19,7 +19,7 @@ #include #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" #include "graph/common/ge_call_wrapper.h" diff --git a/ge/graph/passes/cond_pass.cc b/ge/graph/passes/cond_pass.cc index 116e4f89..47a75cd8 100644 --- a/ge/graph/passes/cond_pass.cc +++ b/ge/graph/passes/cond_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "graph/passes/cond_pass.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/utils/graph_utils.h" #include "graph/utils/type_utils.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/cond_remove_pass.cc b/ge/graph/passes/cond_remove_pass.cc index 478858a9..91e44458 100644 --- a/ge/graph/passes/cond_remove_pass.cc +++ b/ge/graph/passes/cond_remove_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "graph/passes/cond_remove_pass.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/constant_folding_pass.cc b/ge/graph/passes/constant_folding_pass.cc index 25fe26da..6607388f 100644 --- a/ge/graph/passes/constant_folding_pass.cc +++ b/ge/graph/passes/constant_folding_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/constant_folding_pass.h" #include -#include "graph/operator_factory.h" +#include "external/graph/operator_factory.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" diff --git a/ge/graph/passes/constant_fuse_same_pass.h b/ge/graph/passes/constant_fuse_same_pass.h index 3ff2d6b7..a7326c32 100755 --- a/ge/graph/passes/constant_fuse_same_pass.h +++ b/ge/graph/passes/constant_fuse_same_pass.h @@ -22,7 +22,7 @@ #include #include #include "graph/aligned_ptr.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/data_pass.h b/ge/graph/passes/data_pass.h index 519ae046..6f841139 100644 --- a/ge/graph/passes/data_pass.h +++ b/ge/graph/passes/data_pass.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_PASSES_DATA_PASS_H_ #define GE_GRAPH_PASSES_DATA_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/dimension_adjust_pass.h b/ge/graph/passes/dimension_adjust_pass.h index 7766f140..a84f0d8d 100755 --- a/ge/graph/passes/dimension_adjust_pass.h +++ b/ge/graph/passes/dimension_adjust_pass.h @@ -17,10 +17,10 @@ #ifndef GE_GRAPH_PASSES_DIMENSION_ADJUST_PASS_H_ #define GE_GRAPH_PASSES_DIMENSION_ADJUST_PASS_H_ -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/common/omg_util.h" #include "graph/passes/base_pass.h" #include "graph/utils/attr_utils.h" diff --git a/ge/graph/passes/dimension_compute_pass.cc b/ge/graph/passes/dimension_compute_pass.cc index 350faf71..a24a6bd4 100755 --- a/ge/graph/passes/dimension_compute_pass.cc +++ b/ge/graph/passes/dimension_compute_pass.cc @@ -20,7 +20,7 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/utils/attr_utils.h" diff --git a/ge/graph/passes/end_of_sequence_add_control_pass.h b/ge/graph/passes/end_of_sequence_add_control_pass.h index dcc65848..32ee0b25 100644 --- a/ge/graph/passes/end_of_sequence_add_control_pass.h +++ b/ge/graph/passes/end_of_sequence_add_control_pass.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_PASSES_END_OF_SEQUENCE_ADD_CONTROL_EDGE_PASS_H_ #define GE_GRAPH_PASSES_END_OF_SEQUENCE_ADD_CONTROL_EDGE_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/flow_ctrl_pass.h b/ge/graph/passes/flow_ctrl_pass.h index 74f3cce0..cf1af97a 100755 --- a/ge/graph/passes/flow_ctrl_pass.h +++ b/ge/graph/passes/flow_ctrl_pass.h @@ -20,7 +20,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/for_pass.cc b/ge/graph/passes/for_pass.cc index 7d09f370..260e6ea0 100644 --- a/ge/graph/passes/for_pass.cc +++ b/ge/graph/passes/for_pass.cc @@ -16,7 +16,7 @@ #include "graph/passes/for_pass.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" #include "framework/common/ge_inner_error_codes.h" diff --git a/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc b/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc index ec7b2388..280afb6f 100644 --- a/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc +++ b/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc @@ -21,7 +21,7 @@ #include #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/type_utils.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/fuse_data_nodes_with_common_input_pass.h b/ge/graph/passes/fuse_data_nodes_with_common_input_pass.h index 9ff6ab89..33543ded 100755 --- a/ge/graph/passes/fuse_data_nodes_with_common_input_pass.h +++ b/ge/graph/passes/fuse_data_nodes_with_common_input_pass.h @@ -20,7 +20,7 @@ #include #include #include -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/get_original_format_pass.cc b/ge/graph/passes/get_original_format_pass.cc index 670cd50c..4b27dd0e 100644 --- a/ge/graph/passes/get_original_format_pass.cc +++ b/ge/graph/passes/get_original_format_pass.cc @@ -18,9 +18,9 @@ #include -#include "common/debug/log.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/omg/omg_inner_types.h" #include "graph/utils/attr_utils.h" diff --git a/ge/graph/passes/global_step_insert_pass.h b/ge/graph/passes/global_step_insert_pass.h index da83e93a..16be3d4a 100755 --- a/ge/graph/passes/global_step_insert_pass.h +++ b/ge/graph/passes/global_step_insert_pass.h @@ -20,7 +20,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/guarantee_const_pass.cc b/ge/graph/passes/guarantee_const_pass.cc index 1d369f38..b1df73a9 100644 --- a/ge/graph/passes/guarantee_const_pass.cc +++ b/ge/graph/passes/guarantee_const_pass.cc @@ -19,8 +19,8 @@ #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/common/omg_util.h" #include "graph/utils/attr_utils.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/hccl_continuous_memcpy_pass.cc b/ge/graph/passes/hccl_continuous_memcpy_pass.cc index 56cbb005..7f4597b3 100644 --- a/ge/graph/passes/hccl_continuous_memcpy_pass.cc +++ b/ge/graph/passes/hccl_continuous_memcpy_pass.cc @@ -18,9 +18,9 @@ #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" #include "framework/common/types.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/hccl_continuous_memcpy_pass.h b/ge/graph/passes/hccl_continuous_memcpy_pass.h index 5fbb6fd0..d710531d 100644 --- a/ge/graph/passes/hccl_continuous_memcpy_pass.h +++ b/ge/graph/passes/hccl_continuous_memcpy_pass.h @@ -20,7 +20,7 @@ #include #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/hccl_group_pass.cc b/ge/graph/passes/hccl_group_pass.cc index bbfd9b56..35baade6 100644 --- a/ge/graph/passes/hccl_group_pass.cc +++ b/ge/graph/passes/hccl_group_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hccl_group_pass.h" +#include "graph/passes/hccl_group_pass.h" #include #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/passes/hccl_memcpy_pass.cc b/ge/graph/passes/hccl_memcpy_pass.cc index d56ee342..2d83bf51 100755 --- a/ge/graph/passes/hccl_memcpy_pass.cc +++ b/ge/graph/passes/hccl_memcpy_pass.cc @@ -18,9 +18,9 @@ #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" #include "framework/common/types.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/hccl_memcpy_pass.h b/ge/graph/passes/hccl_memcpy_pass.h index b75b27d1..e6ee519b 100755 --- a/ge/graph/passes/hccl_memcpy_pass.h +++ b/ge/graph/passes/hccl_memcpy_pass.h @@ -20,7 +20,7 @@ #include #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/hccl_tailing_optimization_pass.cc b/ge/graph/passes/hccl_tailing_optimization_pass.cc index e1e2f276..d952885d 100644 --- a/ge/graph/passes/hccl_tailing_optimization_pass.cc +++ b/ge/graph/passes/hccl_tailing_optimization_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "hccl_tailing_optimization_pass.h" +#include "graph/passes/hccl_tailing_optimization_pass.h" #include "graph/common/transop_util.h" namespace ge { diff --git a/ge/graph/passes/infershape_pass.cc b/ge/graph/passes/infershape_pass.cc index b74d1c97..60a2f09a 100755 --- a/ge/graph/passes/infershape_pass.cc +++ b/ge/graph/passes/infershape_pass.cc @@ -24,8 +24,8 @@ #include "graph/utils/node_utils.h" #include "graph/common/omg_util.h" #include "graph/debug/ge_attr_define.h" -#include "utils/tensor_utils.h" -#include "utils/type_utils.h" +#include "graph/utils/tensor_utils.h" +#include "graph/utils/type_utils.h" namespace ge { diff --git a/ge/graph/passes/input_output_connection_identify_pass.cc b/ge/graph/passes/input_output_connection_identify_pass.cc index 5779fb41..d5551bdc 100644 --- a/ge/graph/passes/input_output_connection_identify_pass.cc +++ b/ge/graph/passes/input_output_connection_identify_pass.cc @@ -23,7 +23,7 @@ #include #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/input_output_connection_identify_pass.h b/ge/graph/passes/input_output_connection_identify_pass.h index 97ed315d..c4a4653e 100755 --- a/ge/graph/passes/input_output_connection_identify_pass.h +++ b/ge/graph/passes/input_output_connection_identify_pass.h @@ -19,7 +19,7 @@ #include #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/iterator_op_pass.cc b/ge/graph/passes/iterator_op_pass.cc index 3e85887b..d1de809d 100644 --- a/ge/graph/passes/iterator_op_pass.cc +++ b/ge/graph/passes/iterator_op_pass.cc @@ -21,13 +21,13 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" #include "common/ge/ge_util.h" #include "framework/common/debug/ge_log.h" #include "graph/anchor.h" #include "graph/common/omg_util.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/node.h" #include "graph/passes/pass_utils.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/iterator_op_pass.h b/ge/graph/passes/iterator_op_pass.h index d9303358..611109dc 100644 --- a/ge/graph/passes/iterator_op_pass.h +++ b/ge/graph/passes/iterator_op_pass.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_PASSES_ITERATOR_OP_PASS_H_ #define GE_GRAPH_PASSES_ITERATOR_OP_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 522c20ad..9ff3bfd7 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -18,7 +18,7 @@ #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "framework/common/types.h" #include "init/gelib.h" diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.h b/ge/graph/passes/link_gen_mask_nodes_pass.h index 12d68f1b..c6c1e703 100644 --- a/ge/graph/passes/link_gen_mask_nodes_pass.h +++ b/ge/graph/passes/link_gen_mask_nodes_pass.h @@ -21,7 +21,7 @@ #include #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index 74babadc..fbf69c04 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mark_force_unknown_for_cond_pass.h" +#include "graph/passes/mark_force_unknown_for_cond_pass.h" #include diff --git a/ge/graph/passes/mark_graph_unknown_status_pass.h b/ge/graph/passes/mark_graph_unknown_status_pass.h index a1148c6e..2cc86dbd 100644 --- a/ge/graph/passes/mark_graph_unknown_status_pass.h +++ b/ge/graph/passes/mark_graph_unknown_status_pass.h @@ -16,7 +16,7 @@ #ifndef GE_GRAPH_PASSES_MARK_GRAPH_UNKNOWN_STATUS_PASS_H_ #define GE_GRAPH_PASSES_MARK_GRAPH_UNKNOWN_STATUS_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/mark_node_unknown_shape_pass.h b/ge/graph/passes/mark_node_unknown_shape_pass.h index b78b7826..acd12582 100644 --- a/ge/graph/passes/mark_node_unknown_shape_pass.h +++ b/ge/graph/passes/mark_node_unknown_shape_pass.h @@ -16,7 +16,7 @@ #ifndef GE_GRAPH_PASSES_MARK_NODE_UNKNOWN_SHAPE_PASS_H_ #define GE_GRAPH_PASSES_MARK_NODE_UNKNOWN_SHAPE_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/mark_same_addr_pass.h b/ge/graph/passes/mark_same_addr_pass.h index 518fe418..adf971a2 100644 --- a/ge/graph/passes/mark_same_addr_pass.h +++ b/ge/graph/passes/mark_same_addr_pass.h @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" #ifndef GE_GRAPH_PASSES_MARK_SAME_ADDR_PASS_H_ diff --git a/ge/graph/passes/merge_input_memcpy_pass.cc b/ge/graph/passes/merge_input_memcpy_pass.cc index 00c04131..044d4ad9 100644 --- a/ge/graph/passes/merge_input_memcpy_pass.cc +++ b/ge/graph/passes/merge_input_memcpy_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/merge_input_memcpy_pass.h" #include "common/ge/ge_util.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/common/omg_util.h" namespace ge { diff --git a/ge/graph/passes/merge_to_stream_merge_pass.cc b/ge/graph/passes/merge_to_stream_merge_pass.cc index dbcff620..c58def59 100644 --- a/ge/graph/passes/merge_to_stream_merge_pass.cc +++ b/ge/graph/passes/merge_to_stream_merge_pass.cc @@ -16,7 +16,7 @@ #include "graph/passes/merge_to_stream_merge_pass.h" #include "common/ge/ge_util.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/common/omg_util.h" namespace ge { diff --git a/ge/graph/passes/net_output_pass.h b/ge/graph/passes/net_output_pass.h index ab190169..fecccc35 100644 --- a/ge/graph/passes/net_output_pass.h +++ b/ge/graph/passes/net_output_pass.h @@ -22,7 +22,7 @@ #include #include -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/no_use_reshape_remove_pass.cc b/ge/graph/passes/no_use_reshape_remove_pass.cc index b3074565..e0a0ceb8 100644 --- a/ge/graph/passes/no_use_reshape_remove_pass.cc +++ b/ge/graph/passes/no_use_reshape_remove_pass.cc @@ -19,7 +19,7 @@ #include #include -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "external/graph/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" diff --git a/ge/graph/passes/parallel_group_pass.h b/ge/graph/passes/parallel_group_pass.h index 9b895598..cdcdabab 100644 --- a/ge/graph/passes/parallel_group_pass.h +++ b/ge/graph/passes/parallel_group_pass.h @@ -19,7 +19,7 @@ #include #include -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/pass_manager.cc b/ge/graph/passes/pass_manager.cc index fa2f1e17..7c9aa414 100644 --- a/ge/graph/passes/pass_manager.cc +++ b/ge/graph/passes/pass_manager.cc @@ -15,12 +15,12 @@ */ #include "inc/pass_manager.h" -#include "common/debug/log.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/utils/node_utils.h" #include "graph/common/ge_call_wrapper.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace ge { const vector>& PassManager::GraphPasses() const { return names_to_graph_passes_; } diff --git a/ge/graph/passes/pass_utils.cc b/ge/graph/passes/pass_utils.cc index c0ef7685..d5306f5f 100644 --- a/ge/graph/passes/pass_utils.cc +++ b/ge/graph/passes/pass_utils.cc @@ -23,10 +23,10 @@ #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "graph/common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_tensor.h" @@ -35,7 +35,7 @@ #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" -#include "utils/node_utils.h" +#include "graph/utils/node_utils.h" #include "common/formats/utils/formats_trans_utils.h" namespace ge { diff --git a/ge/graph/passes/pass_utils.h b/ge/graph/passes/pass_utils.h index bd506d09..475c4e77 100755 --- a/ge/graph/passes/pass_utils.h +++ b/ge/graph/passes/pass_utils.h @@ -19,7 +19,7 @@ #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" namespace ge { diff --git a/ge/graph/passes/permute_pass.cc b/ge/graph/passes/permute_pass.cc index 8254db72..21222b2c 100644 --- a/ge/graph/passes/permute_pass.cc +++ b/ge/graph/passes/permute_pass.cc @@ -17,8 +17,8 @@ #include "graph/passes/permute_pass.h" #include #include -#include "common/debug/log.h" -#include "common/types.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" #include "graph/utils/attr_utils.h" #include "graph/utils/op_desc_utils.h" #include "inc/kernel.h" diff --git a/ge/graph/passes/print_op_pass.h b/ge/graph/passes/print_op_pass.h index deaf559b..7ee19d5d 100755 --- a/ge/graph/passes/print_op_pass.h +++ b/ge/graph/passes/print_op_pass.h @@ -21,7 +21,7 @@ #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/common/omg_util.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/passes/base_pass.h" #include "graph/utils/graph_utils.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/passes/prune_pass.cc b/ge/graph/passes/prune_pass.cc index 1e2ec4ab..cc6c7618 100644 --- a/ge/graph/passes/prune_pass.cc +++ b/ge/graph/passes/prune_pass.cc @@ -19,8 +19,8 @@ #include #include #include -#include "common/debug/log.h" -#include "common/types.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/ref_identity_delete_op_pass.cc b/ge/graph/passes/ref_identity_delete_op_pass.cc index 39794cff..7bc5804b 100644 --- a/ge/graph/passes/ref_identity_delete_op_pass.cc +++ b/ge/graph/passes/ref_identity_delete_op_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "ref_identity_delete_op_pass.h" +#include "graph/passes/ref_identity_delete_op_pass.h" #include #include #include "graph/common/transop_util.h" diff --git a/ge/graph/passes/remove_same_const_pass.cc b/ge/graph/passes/remove_same_const_pass.cc index a06eea43..947ff3f3 100644 --- a/ge/graph/passes/remove_same_const_pass.cc +++ b/ge/graph/passes/remove_same_const_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "remove_same_const_pass.h" +#include "graph/passes/remove_same_const_pass.h" #include #include diff --git a/ge/graph/passes/remove_same_const_pass.h b/ge/graph/passes/remove_same_const_pass.h index 08905bd2..6934a472 100644 --- a/ge/graph/passes/remove_same_const_pass.h +++ b/ge/graph/passes/remove_same_const_pass.h @@ -16,7 +16,7 @@ #ifndef GE_GRAPH_PASSES_REMOVE_SAME_CONST_PASS_H_ #define GE_GRAPH_PASSES_REMOVE_SAME_CONST_PASS_H_ -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/replace_transshape_pass.cc b/ge/graph/passes/replace_transshape_pass.cc index 28957a61..c7844619 100644 --- a/ge/graph/passes/replace_transshape_pass.cc +++ b/ge/graph/passes/replace_transshape_pass.cc @@ -19,7 +19,7 @@ #include #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "graph/common/omg_util.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/resource_pair_add_control_pass.cc b/ge/graph/passes/resource_pair_add_control_pass.cc index a104a95e..14f04fe0 100755 --- a/ge/graph/passes/resource_pair_add_control_pass.cc +++ b/ge/graph/passes/resource_pair_add_control_pass.cc @@ -21,9 +21,9 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/utils/attr_utils.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/graph/passes/resource_pair_remove_control_pass.cc b/ge/graph/passes/resource_pair_remove_control_pass.cc index 73b96008..138efb43 100755 --- a/ge/graph/passes/resource_pair_remove_control_pass.cc +++ b/ge/graph/passes/resource_pair_remove_control_pass.cc @@ -21,9 +21,9 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/utils/attr_utils.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/graph/passes/same_transdata_breadth_fusion_pass.cc b/ge/graph/passes/same_transdata_breadth_fusion_pass.cc index 60f5c7c9..afd78a4d 100644 --- a/ge/graph/passes/same_transdata_breadth_fusion_pass.cc +++ b/ge/graph/passes/same_transdata_breadth_fusion_pass.cc @@ -20,8 +20,8 @@ #include #include #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/utils/op_desc_utils.h" diff --git a/ge/graph/passes/save_pass.cc b/ge/graph/passes/save_pass.cc index 1181461b..6fec3a3b 100755 --- a/ge/graph/passes/save_pass.cc +++ b/ge/graph/passes/save_pass.cc @@ -20,7 +20,7 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/utils/graph_utils.h" namespace ge { diff --git a/ge/graph/passes/save_pass.h b/ge/graph/passes/save_pass.h index 512dfa62..8efcc46e 100755 --- a/ge/graph/passes/save_pass.h +++ b/ge/graph/passes/save_pass.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_PASSES_SAVE_PASS_H_ #define GE_GRAPH_PASSES_SAVE_PASS_H_ -#include "graph/graph.h" +#include "external/graph/graph.h" #include "inc/graph_pass.h" namespace ge { diff --git a/ge/graph/passes/shape_operate_op_remove_pass.cc b/ge/graph/passes/shape_operate_op_remove_pass.cc index a703f1c9..f6ce0ec1 100755 --- a/ge/graph/passes/shape_operate_op_remove_pass.cc +++ b/ge/graph/passes/shape_operate_op_remove_pass.cc @@ -15,9 +15,9 @@ */ #include "graph/passes/shape_operate_op_remove_pass.h" -#include "common/debug/log.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/utils/attr_utils.h" using domi::SUCCESS; diff --git a/ge/graph/passes/stop_gradient_pass.h b/ge/graph/passes/stop_gradient_pass.h index 808174bc..5132b889 100755 --- a/ge/graph/passes/stop_gradient_pass.h +++ b/ge/graph/passes/stop_gradient_pass.h @@ -18,7 +18,7 @@ #define GE_GRAPH_PASSES_STOP_GRADIENT_PASS_H_ #include "framework/common/debug/ge_log.h" -#include "common/types.h" +#include "framework/common/types.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/omg_util.h" #include "graph/passes/base_pass.h" diff --git a/ge/graph/passes/subexpression_migration_pass.cc b/ge/graph/passes/subexpression_migration_pass.cc index 6265851a..f39e02e5 100755 --- a/ge/graph/passes/subexpression_migration_pass.cc +++ b/ge/graph/passes/subexpression_migration_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "subexpression_migration_pass.h" +#include "graph/passes/subexpression_migration_pass.h" #include "graph/utils/node_utils.h" #include "ge_local_engine/engine/host_cpu_engine.h" diff --git a/ge/graph/passes/subexpression_migration_pass.h b/ge/graph/passes/subexpression_migration_pass.h index d2733fcf..52326798 100755 --- a/ge/graph/passes/subexpression_migration_pass.h +++ b/ge/graph/passes/subexpression_migration_pass.h @@ -17,7 +17,7 @@ #ifndef GE_COMMON_SUBEXPRESSION_MIGRATION_H_ #define GE_COMMON_SUBEXPRESSION_MIGRATION_H_ -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" #include diff --git a/ge/graph/passes/subgraph_const_migration_pass.cc b/ge/graph/passes/subgraph_const_migration_pass.cc index d15e60cf..eac0c84b 100644 --- a/ge/graph/passes/subgraph_const_migration_pass.cc +++ b/ge/graph/passes/subgraph_const_migration_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "subgraph_const_migration_pass.h" +#include "graph/passes/subgraph_const_migration_pass.h" #include "graph/utils/node_utils.h" #include "ge_local_engine/engine/host_cpu_engine.h" diff --git a/ge/graph/passes/subgraph_const_migration_pass.h b/ge/graph/passes/subgraph_const_migration_pass.h index 2834fd66..e43a3049 100755 --- a/ge/graph/passes/subgraph_const_migration_pass.h +++ b/ge/graph/passes/subgraph_const_migration_pass.h @@ -17,7 +17,7 @@ #ifndef GE_COMMON_SUBGRAPH_CONST_MIGRATION_H_ #define GE_COMMON_SUBGRAPH_CONST_MIGRATION_H_ -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" #include diff --git a/ge/graph/passes/switch_data_edges_bypass.cc b/ge/graph/passes/switch_data_edges_bypass.cc index 5f66a0ca..c7b46b7c 100644 --- a/ge/graph/passes/switch_data_edges_bypass.cc +++ b/ge/graph/passes/switch_data_edges_bypass.cc @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "switch_data_edges_bypass.h" +#include "graph/passes/switch_data_edges_bypass.h" #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/util.h" #include "graph/utils/node_utils.h" namespace ge { diff --git a/ge/graph/passes/switch_logic_remove_pass.cc b/ge/graph/passes/switch_logic_remove_pass.cc index 13b409c5..0d6bc2ce 100644 --- a/ge/graph/passes/switch_logic_remove_pass.cc +++ b/ge/graph/passes/switch_logic_remove_pass.cc @@ -21,7 +21,7 @@ #include "framework/common/debug/ge_log.h" #include "graph/utils/graph_utils.h" #include "graph/passes/pass_utils.h" -#include "common/util.h" +#include "framework/common/util.h" namespace ge { namespace { diff --git a/ge/graph/passes/switch_to_stream_switch_pass.cc b/ge/graph/passes/switch_to_stream_switch_pass.cc index e4ab0111..77a7c9db 100644 --- a/ge/graph/passes/switch_to_stream_switch_pass.cc +++ b/ge/graph/passes/switch_to_stream_switch_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/switch_to_stream_switch_pass.h" #include #include "common/ge/ge_util.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/common/omg_util.h" #include "graph/ge_context.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/transop_breadth_fusion_pass.cc b/ge/graph/passes/transop_breadth_fusion_pass.cc index 58b40a5f..5b8e1940 100644 --- a/ge/graph/passes/transop_breadth_fusion_pass.cc +++ b/ge/graph/passes/transop_breadth_fusion_pass.cc @@ -19,7 +19,7 @@ #include #include -#include "common/types.h" +#include "framework/common/types.h" #include "graph/common/transop_util.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/transop_depth_fusion_pass.cc b/ge/graph/passes/transop_depth_fusion_pass.cc index ea4add35..66ce346a 100755 --- a/ge/graph/passes/transop_depth_fusion_pass.cc +++ b/ge/graph/passes/transop_depth_fusion_pass.cc @@ -17,8 +17,8 @@ #include "graph/passes/transop_depth_fusion_pass.h" #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/compute_graph.h" #include "graph/ge_tensor.h" #include "graph/op_desc.h" diff --git a/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc b/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc index 76233f53..483575a4 100644 --- a/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc +++ b/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc @@ -16,8 +16,8 @@ #include "graph/passes/transop_nearby_allreduce_fusion_pass.h" #include "framework/common/debug/ge_log.h" -#include "common/debug/log.h" -#include "common/types.h" +#include "framework/common/debug/log.h" +#include "framework/common/types.h" #include "graph/utils/graph_utils.h" #include "graph/common/transop_util.h" diff --git a/ge/graph/passes/transop_symmetry_elimination_pass.cc b/ge/graph/passes/transop_symmetry_elimination_pass.cc index 665f4bd8..fe0e48f9 100644 --- a/ge/graph/passes/transop_symmetry_elimination_pass.cc +++ b/ge/graph/passes/transop_symmetry_elimination_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "transop_symmetry_elimination_pass.h" +#include "graph/passes/transop_symmetry_elimination_pass.h" #include "common/formats/utils/formats_trans_utils.h" #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" @@ -23,7 +23,7 @@ #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" -#include "types.h" +#include "framework/common/types.h" namespace { const std::set white_list_op{ge::TRANSPOSED, ge::RESHAPE, ge::REFORMAT, ge::CAST, ge::TRANSDATA}; diff --git a/ge/graph/passes/transop_without_reshape_fusion_pass.cc b/ge/graph/passes/transop_without_reshape_fusion_pass.cc index 7e80299b..10e619b9 100644 --- a/ge/graph/passes/transop_without_reshape_fusion_pass.cc +++ b/ge/graph/passes/transop_without_reshape_fusion_pass.cc @@ -20,8 +20,8 @@ #include #include #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "graph/common/transop_util.h" #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/passes/unused_args_clean_pass.cc b/ge/graph/passes/unused_args_clean_pass.cc index 33250311..bc338b86 100755 --- a/ge/graph/passes/unused_args_clean_pass.cc +++ b/ge/graph/passes/unused_args_clean_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "unused_args_clean_pass.h" +#include "graph/passes/unused_args_clean_pass.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/unused_args_clean_pass.h b/ge/graph/passes/unused_args_clean_pass.h index 90a146b2..400cc802 100644 --- a/ge/graph/passes/unused_args_clean_pass.h +++ b/ge/graph/passes/unused_args_clean_pass.h @@ -16,7 +16,7 @@ #ifndef GE_COMMON_CASE_ARGS_CLEAN_H_ #define GE_COMMON_CASE_ARGS_CLEAN_H_ -#include "graph/types.h" +#include "external/graph/types.h" #include "inc/graph_pass.h" #include diff --git a/ge/graph/passes/variable_op_pass.cc b/ge/graph/passes/variable_op_pass.cc index 862b7016..e803949e 100644 --- a/ge/graph/passes/variable_op_pass.cc +++ b/ge/graph/passes/variable_op_pass.cc @@ -21,7 +21,7 @@ #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" #include "graph/ge_context.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/manager/graph_var_manager.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/graph/passes/variable_op_pass.h b/ge/graph/passes/variable_op_pass.h index 3b18882c..d442fdf4 100755 --- a/ge/graph/passes/variable_op_pass.h +++ b/ge/graph/passes/variable_op_pass.h @@ -19,7 +19,7 @@ #include #include #include "graph/common/transop_util.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/manager/graph_var_manager.h" #include "graph/manager/util/variable_accelerate_ctrl.h" #include "inc/graph_pass.h" diff --git a/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc b/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc index 1c8eb0ec..cac6bf75 100644 --- a/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc +++ b/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "variable_ref_useless_control_out_delete_pass.h" +#include "graph/passes/variable_ref_useless_control_out_delete_pass.h" namespace ge { Status VariableRefUselessControlOutDeletePass::Run(ge::ComputeGraphPtr graph) { diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index a73c6a96..6fd83623 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -24,9 +24,9 @@ #include "common/formats/format_transfers/format_transfer_transpose.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/util/error_manager/error_manager.h" -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/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" @@ -39,7 +39,7 @@ #include "graph/passes/addn_pass.h" #include "graph/passes/aicpu_constant_folding_pass.h" #include "graph/passes/assert_pass.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/passes/common_subexpression_elimination_pass.h" #include "graph/passes/cond_pass.h" #include "graph/passes/cond_remove_pass.h" @@ -79,7 +79,7 @@ #include "graph/utils/type_utils.h" #include "inc/pass_manager.h" #include "init/gelib.h" -#include "multi_batch_copy_graph.h" +#include "graph/preprocess/multi_batch_copy_graph.h" #include "graph/passes/data_pass.h" #include "graph/passes/mark_agnostic_pass.h" diff --git a/ge/graph/preprocess/graph_preprocess.h b/ge/graph/preprocess/graph_preprocess.h index 22bc566c..3dfe1797 100755 --- a/ge/graph/preprocess/graph_preprocess.h +++ b/ge/graph/preprocess/graph_preprocess.h @@ -21,13 +21,13 @@ #include #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" #include "common/model_parser/model_parser.h" #include "common/properties_manager.h" -#include "common/string_util.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/string_util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/compute_graph.h" #include "graph/manager/graph_manager_utils.h" #include "graph/manager/util/variable_accelerate_ctrl.h" @@ -35,7 +35,7 @@ #include "graph/node.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" #include "runtime/context.h" namespace ge { diff --git a/ge/graph/preprocess/insert_op/base_insert_op.h b/ge/graph/preprocess/insert_op/base_insert_op.h index b0d7a7a6..6b1eb177 100644 --- a/ge/graph/preprocess/insert_op/base_insert_op.h +++ b/ge/graph/preprocess/insert_op/base_insert_op.h @@ -21,8 +21,8 @@ #include #include #include -#include "common/fmk_error_codes.h" -#include "common/types.h" +#include "framework/common/fmk_error_codes.h" +#include "framework/common/types.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" #include "proto/insert_op.pb.h" diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 5c191af7..5d3a2a85 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -20,10 +20,10 @@ #include #include #include -#include "base_insert_op.h" +#include "graph/preprocess/insert_op/base_insert_op.h" #include "common/dynamic_aipp.h" #include "common/ge/ge_util.h" -#include "common/util.h" +#include "framework/common/util.h" #include "common/util/error_manager/error_manager.h" #include "external/graph/operator_factory.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.h b/ge/graph/preprocess/insert_op/ge_aipp_op.h index 5e509dda..87f80291 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.h +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.h @@ -19,7 +19,7 @@ #include #include -#include "common/op/attr_value_util.h" +#include "framework/common/op/attr_value_util.h" #include "graph/preprocess/insert_op/base_insert_op.h" #include "proto/insert_op.pb.h" diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index d76b79b9..3cd26139 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -20,8 +20,8 @@ #include "common/dynamic_aipp.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/util.h" #include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" diff --git a/ge/graph/preprocess/multi_batch_options.cc b/ge/graph/preprocess/multi_batch_options.cc index b3e5b616..21cbc0c2 100644 --- a/ge/graph/preprocess/multi_batch_options.cc +++ b/ge/graph/preprocess/multi_batch_options.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "multi_batch_options.h" +#include "graph/preprocess/multi_batch_options.h" #include "framework/common/debug/ge_log.h" #include "framework/omg/omg_inner_types.h" diff --git a/ge/host_kernels/broadcast_args_kernel.cc b/ge/host_kernels/broadcast_args_kernel.cc index d8880db9..796142f4 100644 --- a/ge/host_kernels/broadcast_args_kernel.cc +++ b/ge/host_kernels/broadcast_args_kernel.cc @@ -18,9 +18,9 @@ #include -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" #include "graph/passes/pass_utils.h" diff --git a/ge/host_kernels/broadcast_gradient_args_kernel.cc b/ge/host_kernels/broadcast_gradient_args_kernel.cc index 51ff4a4c..59993171 100644 --- a/ge/host_kernels/broadcast_gradient_args_kernel.cc +++ b/ge/host_kernels/broadcast_gradient_args_kernel.cc @@ -17,9 +17,9 @@ #include -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/cast_kernel.cc b/ge/host_kernels/cast_kernel.cc index 056081a1..3f09974f 100644 --- a/ge/host_kernels/cast_kernel.cc +++ b/ge/host_kernels/cast_kernel.cc @@ -19,13 +19,13 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/fp16_t.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/concat_offset_kernel.cc b/ge/host_kernels/concat_offset_kernel.cc index b6940eb4..79552183 100644 --- a/ge/host_kernels/concat_offset_kernel.cc +++ b/ge/host_kernels/concat_offset_kernel.cc @@ -18,9 +18,9 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/concat_v2_kernel.cc b/ge/host_kernels/concat_v2_kernel.cc index 234d8c8a..c5a7d889 100644 --- a/ge/host_kernels/concat_v2_kernel.cc +++ b/ge/host_kernels/concat_v2_kernel.cc @@ -19,9 +19,9 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/fp16_t.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/dynamic_stitch_kernel.cc b/ge/host_kernels/dynamic_stitch_kernel.cc index 52f6cdcf..0313c856 100644 --- a/ge/host_kernels/dynamic_stitch_kernel.cc +++ b/ge/host_kernels/dynamic_stitch_kernel.cc @@ -20,10 +20,10 @@ #include #include "common/fp16_t.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/empty_kernel.cc b/ge/host_kernels/empty_kernel.cc index 61310abc..68ba7f9f 100644 --- a/ge/host_kernels/empty_kernel.cc +++ b/ge/host_kernels/empty_kernel.cc @@ -19,8 +19,8 @@ #include #include "common/fp16_t.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "host_kernels/kernel_utils.h" diff --git a/ge/host_kernels/expanddims_kernel.cc b/ge/host_kernels/expanddims_kernel.cc index f304fbdb..d6ea0287 100644 --- a/ge/host_kernels/expanddims_kernel.cc +++ b/ge/host_kernels/expanddims_kernel.cc @@ -18,9 +18,9 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/fill_kernel.cc b/ge/host_kernels/fill_kernel.cc index 0022791c..e41c5bf3 100644 --- a/ge/host_kernels/fill_kernel.cc +++ b/ge/host_kernels/fill_kernel.cc @@ -20,8 +20,8 @@ #include #include "common/fp16_t.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/floordiv_kernel.cc b/ge/host_kernels/floordiv_kernel.cc index df381212..566a45a3 100644 --- a/ge/host_kernels/floordiv_kernel.cc +++ b/ge/host_kernels/floordiv_kernel.cc @@ -21,8 +21,8 @@ #include #include -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/floormod_kernel.cc b/ge/host_kernels/floormod_kernel.cc index 31e4e19b..bef6d014 100644 --- a/ge/host_kernels/floormod_kernel.cc +++ b/ge/host_kernels/floormod_kernel.cc @@ -19,8 +19,8 @@ #include #include -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/gather_v2_kernel.cc b/ge/host_kernels/gather_v2_kernel.cc index 5702954c..45445143 100644 --- a/ge/host_kernels/gather_v2_kernel.cc +++ b/ge/host_kernels/gather_v2_kernel.cc @@ -20,10 +20,10 @@ #include #include "common/fp16_t.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/greater_kernel.cc b/ge/host_kernels/greater_kernel.cc index a245ec8d..3e62db04 100644 --- a/ge/host_kernels/greater_kernel.cc +++ b/ge/host_kernels/greater_kernel.cc @@ -19,10 +19,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/fp16_t.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/identity_kernel.cc b/ge/host_kernels/identity_kernel.cc index ef1446a8..30f55027 100644 --- a/ge/host_kernels/identity_kernel.cc +++ b/ge/host_kernels/identity_kernel.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "identity_kernel.h" +#include "host_kernels/identity_kernel.h" #include "inc/kernel_factory.h" #include "framework/common/types.h" diff --git a/ge/host_kernels/kernel_utils.cc b/ge/host_kernels/kernel_utils.cc index 595f9517..6447fa43 100755 --- a/ge/host_kernels/kernel_utils.cc +++ b/ge/host_kernels/kernel_utils.cc @@ -18,8 +18,8 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/host_kernels/kernel_utils.h b/ge/host_kernels/kernel_utils.h index c9c90634..7a7545ea 100755 --- a/ge/host_kernels/kernel_utils.h +++ b/ge/host_kernels/kernel_utils.h @@ -20,8 +20,8 @@ #include #include -#include "common/ge_inner_error_codes.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/compute_graph.h" diff --git a/ge/host_kernels/maximum_kernel.cc b/ge/host_kernels/maximum_kernel.cc index 2ced113f..314bc7be 100644 --- a/ge/host_kernels/maximum_kernel.cc +++ b/ge/host_kernels/maximum_kernel.cc @@ -19,10 +19,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/fp16_t.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/mul_kernel.cc b/ge/host_kernels/mul_kernel.cc index b01a5c79..e3657197 100644 --- a/ge/host_kernels/mul_kernel.cc +++ b/ge/host_kernels/mul_kernel.cc @@ -19,10 +19,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/math/math_util.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/pack_kernel.cc b/ge/host_kernels/pack_kernel.cc index bf7a2a1f..103f4029 100644 --- a/ge/host_kernels/pack_kernel.cc +++ b/ge/host_kernels/pack_kernel.cc @@ -18,10 +18,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/utils/formats_trans_utils.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" #include "host_kernels/kernel_utils.h" diff --git a/ge/host_kernels/permute_kernel.cc b/ge/host_kernels/permute_kernel.cc index 327c94f8..93d56415 100755 --- a/ge/host_kernels/permute_kernel.cc +++ b/ge/host_kernels/permute_kernel.cc @@ -19,11 +19,11 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "framework/common/debug/ge_log.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "graph/common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/range_kernel.cc b/ge/host_kernels/range_kernel.cc index 97254fff..d8f8200a 100644 --- a/ge/host_kernels/range_kernel.cc +++ b/ge/host_kernels/range_kernel.cc @@ -19,10 +19,10 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/fp16_t.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/rank_kernel.cc b/ge/host_kernels/rank_kernel.cc index b246b976..9bc404f3 100755 --- a/ge/host_kernels/rank_kernel.cc +++ b/ge/host_kernels/rank_kernel.cc @@ -19,12 +19,12 @@ #include #include -#include "graph/types.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" +#include "external/graph/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "inc/kernel_factory.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" #include "framework/common/types.h" namespace { diff --git a/ge/host_kernels/reduce_prod_kernel.cc b/ge/host_kernels/reduce_prod_kernel.cc index 4837a921..efe48997 100644 --- a/ge/host_kernels/reduce_prod_kernel.cc +++ b/ge/host_kernels/reduce_prod_kernel.cc @@ -20,8 +20,8 @@ #include #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "host_kernels/kernel_utils.h" diff --git a/ge/host_kernels/reformat_kernel.cc b/ge/host_kernels/reformat_kernel.cc index c1942983..b841ed39 100644 --- a/ge/host_kernels/reformat_kernel.cc +++ b/ge/host_kernels/reformat_kernel.cc @@ -17,10 +17,10 @@ #include "host_kernels/reformat_kernel.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/ge/ge_util.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/reshape_kernel.cc b/ge/host_kernels/reshape_kernel.cc index 7c4f58f6..bead8468 100644 --- a/ge/host_kernels/reshape_kernel.cc +++ b/ge/host_kernels/reshape_kernel.cc @@ -16,9 +16,9 @@ #include "host_kernels/reshape_kernel.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/rsqrt_kernel.cc b/ge/host_kernels/rsqrt_kernel.cc index 74c78787..f1f74a99 100755 --- a/ge/host_kernels/rsqrt_kernel.cc +++ b/ge/host_kernels/rsqrt_kernel.cc @@ -19,10 +19,10 @@ #include -#include "common/debug/ge_log.h" -#include "common/debug/log.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/debug/log.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/size_kernel.cc b/ge/host_kernels/size_kernel.cc index caa5febc..9f7bc0ff 100644 --- a/ge/host_kernels/size_kernel.cc +++ b/ge/host_kernels/size_kernel.cc @@ -19,8 +19,8 @@ #include #include -#include "common/debug/log.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/debug/log.h" +#include "framework/common/op/ge_op_utils.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" @@ -28,7 +28,7 @@ #include "host_kernels/kernel_utils.h" #include "graph/passes/pass_utils.h" #include "inc/kernel_factory.h" -#include "omg/omg_inner_types.h" +#include "framework/omg/omg_inner_types.h" namespace ge { namespace { diff --git a/ge/host_kernels/slice_d_kernel.cc b/ge/host_kernels/slice_d_kernel.cc index b8572290..60caac38 100644 --- a/ge/host_kernels/slice_d_kernel.cc +++ b/ge/host_kernels/slice_d_kernel.cc @@ -19,8 +19,8 @@ #include #include "common/fp16_t.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/host_kernels/slice_kernel.cc b/ge/host_kernels/slice_kernel.cc index 6e398e96..0b1e7325 100644 --- a/ge/host_kernels/slice_kernel.cc +++ b/ge/host_kernels/slice_kernel.cc @@ -18,10 +18,10 @@ #include -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/type_utils.h" #include "host_kernels/kernel_utils.h" diff --git a/ge/host_kernels/squeeze_kernel.cc b/ge/host_kernels/squeeze_kernel.cc index 4a2c6725..852a46a1 100644 --- a/ge/host_kernels/squeeze_kernel.cc +++ b/ge/host_kernels/squeeze_kernel.cc @@ -16,9 +16,9 @@ #include "host_kernels/squeeze_kernel.h" -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/ssd_prior_box_kernel.cc b/ge/host_kernels/ssd_prior_box_kernel.cc index 3661fa9d..496cc185 100644 --- a/ge/host_kernels/ssd_prior_box_kernel.cc +++ b/ge/host_kernels/ssd_prior_box_kernel.cc @@ -23,7 +23,7 @@ #include "common/math/math_util.h" #include "common/math_util.h" -#include "common/types.h" +#include "framework/common/types.h" #include "framework/common/util.h" #include "graph/debug/ge_attr_define.h" #include "graph/passes/pass_utils.h" diff --git a/ge/host_kernels/sub_kernel.cc b/ge/host_kernels/sub_kernel.cc index deb36cb3..84c334b0 100644 --- a/ge/host_kernels/sub_kernel.cc +++ b/ge/host_kernels/sub_kernel.cc @@ -20,9 +20,9 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/transdata_kernel.cc b/ge/host_kernels/transdata_kernel.cc index 2b16b075..a06db78b 100644 --- a/ge/host_kernels/transdata_kernel.cc +++ b/ge/host_kernels/transdata_kernel.cc @@ -19,13 +19,13 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" #include "common/fp16_t.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/common/bcast.h" diff --git a/ge/host_kernels/transpose_kernel.cc b/ge/host_kernels/transpose_kernel.cc index 03d112aa..9291ecf5 100755 --- a/ge/host_kernels/transpose_kernel.cc +++ b/ge/host_kernels/transpose_kernel.cc @@ -17,13 +17,13 @@ #include "host_kernels/transpose_kernel.h" #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/formats/format_transfers/format_transfer_transpose.h" #include "common/formats/formats.h" #include "common/formats/utils/formats_trans_utils.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "host_kernels/kernel_utils.h" diff --git a/ge/host_kernels/unpack_kernel.cc b/ge/host_kernels/unpack_kernel.cc index 1c28151f..a90e3616 100755 --- a/ge/host_kernels/unpack_kernel.cc +++ b/ge/host_kernels/unpack_kernel.cc @@ -15,10 +15,10 @@ */ #include "host_kernels/unpack_kernel.h" -#include "common/debug/ge_log.h" -#include "common/op/ge_op_utils.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/unsqueeze_kernel.cc b/ge/host_kernels/unsqueeze_kernel.cc index 4ceaba3f..d2b0d05f 100644 --- a/ge/host_kernels/unsqueeze_kernel.cc +++ b/ge/host_kernels/unsqueeze_kernel.cc @@ -16,9 +16,9 @@ #include "host_kernels/unsqueeze_kernel.h" #include -#include "common/ge_inner_error_codes.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "host_kernels/kernel_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/hybrid/common/npu_memory_allocator.cc b/ge/hybrid/common/npu_memory_allocator.cc index b66038d9..8a9aa0cc 100644 --- a/ge/hybrid/common/npu_memory_allocator.cc +++ b/ge/hybrid/common/npu_memory_allocator.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "npu_memory_allocator.h" +#include "hybrid/common/npu_memory_allocator.h" #include #include "framework/common/debug/log.h" #include "graph/manager/graph_mem_manager.h" diff --git a/ge/hybrid/common/npu_memory_allocator.h b/ge/hybrid/common/npu_memory_allocator.h index 55cb13ad..8df89108 100644 --- a/ge/hybrid/common/npu_memory_allocator.h +++ b/ge/hybrid/common/npu_memory_allocator.h @@ -23,7 +23,7 @@ #include #include #include "external/ge/ge_api_error_codes.h" -#include "memory/memory_api.h" +#include "framework/memory/memory_api.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/common/tensor_value.h b/ge/hybrid/common/tensor_value.h index 348e4e6d..c20074fd 100644 --- a/ge/hybrid/common/tensor_value.h +++ b/ge/hybrid/common/tensor_value.h @@ -20,7 +20,7 @@ #include #include #include -#include "memory/memory_api.h" +#include "framework/memory/memory_api.h" #include "framework/common/util.h" namespace ge { diff --git a/ge/hybrid/executor/hybrid_execution_context.cc b/ge/hybrid/executor/hybrid_execution_context.cc index 0f978bf8..2de9b1ce 100644 --- a/ge/hybrid/executor/hybrid_execution_context.cc +++ b/ge/hybrid/executor/hybrid_execution_context.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hybrid_execution_context.h" +#include "hybrid/executor/hybrid_execution_context.h" #include namespace ge { diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index 930412e3..1519a880 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -19,7 +19,7 @@ #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "graph/ge_context.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/graph_caching_allocator.h" #include "graph/manager/graph_mem_allocator.h" diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 9bf70d26..58da451c 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hybrid_model_executor.h" +#include "hybrid/executor/hybrid_model_executor.h" #include "graph/ge_context.h" #include "graph/runtime_inference_context.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc index c0bd5c7d..45e61138 100644 --- a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc +++ b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc @@ -1,4 +1,20 @@ -#include "hybrid_model_pipeline_executor.h" +/** + * 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 "hybrid/executor/hybrid_model_pipeline_executor.h" #include "common/math/math_util.h" #include "common/dump/dump_manager.h" diff --git a/ge/hybrid/executor/hybrid_model_pipeline_executor.h b/ge/hybrid/executor/hybrid_model_pipeline_executor.h index c59e1462..f694c4e4 100644 --- a/ge/hybrid/executor/hybrid_model_pipeline_executor.h +++ b/ge/hybrid/executor/hybrid_model_pipeline_executor.h @@ -1,3 +1,19 @@ +/** + * 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. + */ + #ifndef GE_HYBRID_EXECUTOR_HYBRID_MODEL_PIPELINE_EXECUTOR_H_ #define GE_HYBRID_EXECUTOR_HYBRID_MODEL_PIPELINE_EXECUTOR_H_ @@ -6,7 +22,7 @@ #include "hybrid/executor/hybrid_execution_context.h" #include "hybrid/executor/rt_callback_manager.h" #include "hybrid/executor/subgraph_executor.h" -#include "hybrid_model_executor.h" +#include "hybrid/executor/hybrid_model_executor.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/executor/hybrid_profiler.cc b/ge/hybrid/executor/hybrid_profiler.cc index 384dc770..f9231a39 100644 --- a/ge/hybrid/executor/hybrid_profiler.cc +++ b/ge/hybrid/executor/hybrid_profiler.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hybrid_profiler.h" +#include "hybrid/executor/hybrid_profiler.h" #include #include #include diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index b80b60b0..727402f1 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -24,7 +24,7 @@ #include "common/blocking_queue.h" #include "external/ge/ge_api_error_codes.h" #include "hybrid/model/node_item.h" -#include "node_done_manager.h" +#include "hybrid/executor/node_done_manager.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/executor/rt_callback_manager.h b/ge/hybrid/executor/rt_callback_manager.h index 9c062134..15b0dede 100644 --- a/ge/hybrid/executor/rt_callback_manager.h +++ b/ge/hybrid/executor/rt_callback_manager.h @@ -23,7 +23,7 @@ #include #include "common/blocking_queue.h" -#include "ge/ge_api_error_codes.h" +#include "external/ge/ge_api_error_codes.h" #include "runtime/rt.h" namespace ge { diff --git a/ge/hybrid/executor/subgraph_context.cc b/ge/hybrid/executor/subgraph_context.cc index 5e97a9a2..4b748e3f 100644 --- a/ge/hybrid/executor/subgraph_context.cc +++ b/ge/hybrid/executor/subgraph_context.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "subgraph_context.h" +#include "hybrid/executor/subgraph_context.h" #include "hybrid/executor/hybrid_model_executor.h" namespace ge { diff --git a/ge/hybrid/hybrid_davinci_model.cc b/ge/hybrid/hybrid_davinci_model.cc index 7368784c..c4500b6d 100755 --- a/ge/hybrid/hybrid_davinci_model.cc +++ b/ge/hybrid/hybrid_davinci_model.cc @@ -15,7 +15,7 @@ */ #include -#include "hybrid_davinci_model.h" +#include "hybrid/hybrid_davinci_model.h" #include "hybrid/model/hybrid_model.h" #include "hybrid/executor/hybrid_model_async_executor.h" #include "hybrid/node_executor/node_executor.h" diff --git a/ge/hybrid/hybrid_davinci_model_stub.cc b/ge/hybrid/hybrid_davinci_model_stub.cc index 67cd29b8..b8a2f242 100644 --- a/ge/hybrid/hybrid_davinci_model_stub.cc +++ b/ge/hybrid/hybrid_davinci_model_stub.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hybrid_davinci_model.h" +#include "hybrid/hybrid_davinci_model.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/model/graph_item.cc b/ge/hybrid/model/graph_item.cc index c38e0a0d..ca23108d 100644 --- a/ge/hybrid/model/graph_item.cc +++ b/ge/hybrid/model/graph_item.cc @@ -15,7 +15,7 @@ */ #include "framework/common/util.h" -#include "graph_item.h" +#include "hybrid/model/graph_item.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/model/hybrid_model.cc b/ge/hybrid/model/hybrid_model.cc index 5e496c3b..e6ddbb8d 100644 --- a/ge/hybrid/model/hybrid_model.cc +++ b/ge/hybrid/model/hybrid_model.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "hybrid_model.h" +#include "hybrid/model/hybrid_model.h" #include #include "graph/debug/ge_attr_define.h" #include "graph/load/model_manager/model_utils.h" @@ -25,7 +25,7 @@ #include "hybrid/common/npu_memory_allocator.h" #include "hybrid/model/hybrid_model_builder.h" #include "hybrid/node_executor/node_executor.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 5337a0cf..d3f00253 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -17,7 +17,7 @@ #include "hybrid/model/hybrid_model_builder.h" #include #include "common/math/math_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/ge_context.h" #include "graph/build/memory/var_mem_assign_util.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index cef06fc6..5c3d7db3 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "node_item.h" +#include "hybrid/model/node_item.h" #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "graph/common/omg_util.h" #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc index 7ebb9e39..c2ce24a4 100755 --- a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc +++ b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "aicore_node_executor.h" +#include "hybrid/node_executor/aicore/aicore_node_executor.h" #include "framework/common/taskdown_common.h" #include "hybrid/executor/hybrid_execution_context.h" #include "external/runtime/rt_error_codes.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index 76082cb3..bca79d7f 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -21,7 +21,7 @@ #include "hybrid/executor/hybrid_execution_context.h" #include "hybrid/node_executor/aicore/aicore_task_builder.h" #include "graph/load/model_manager/tbe_handle_store.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "single_op/task/build_task_utils.h" #include "single_op/task/tbe_task_builder.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index 3c8db8c9..b03bd9e4 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -19,7 +19,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "runtime/stream.h" #include "hybrid/common/tensor_value.h" #include "hybrid/node_executor/task_context.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_task_builder.cc b/ge/hybrid/node_executor/aicore/aicore_task_builder.cc index 114451b3..0ba71fe4 100755 --- a/ge/hybrid/node_executor/aicore/aicore_task_builder.cc +++ b/ge/hybrid/node_executor/aicore/aicore_task_builder.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "aicore_task_builder.h" -#include "common/debug/log.h" -#include "aicore_node_executor.h" +#include "hybrid/node_executor/aicore/aicore_task_builder.h" +#include "framework/common/debug/log.h" +#include "hybrid/node_executor/aicore/aicore_node_executor.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/node_executor/aicore/aicore_task_builder.h b/ge/hybrid/node_executor/aicore/aicore_task_builder.h index 6a472a21..e57538ba 100755 --- a/ge/hybrid/node_executor/aicore/aicore_task_builder.h +++ b/ge/hybrid/node_executor/aicore/aicore_task_builder.h @@ -19,7 +19,7 @@ #include #include -#include "aicore_op_task.h" +#include "hybrid/node_executor/aicore/aicore_op_task.h" #include "framework/common/debug/ge_log.h" #include "graph/utils/attr_utils.h" #include "graph/op_kernel_bin.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_task_compiler.cc b/ge/hybrid/node_executor/aicore/aicore_task_compiler.cc index 0cdea5d5..43563bb6 100755 --- a/ge/hybrid/node_executor/aicore/aicore_task_compiler.cc +++ b/ge/hybrid/node_executor/aicore/aicore_task_compiler.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "aicore_task_compiler.h" +#include "hybrid/node_executor/aicore/aicore_task_compiler.h" #include "framework/common/debug/log.h" #include "graph/debug/ge_attr_define.h" #include "opskernel_manager/ops_kernel_builder_manager.h" diff --git a/ge/hybrid/node_executor/aicore/aicore_task_compiler.h b/ge/hybrid/node_executor/aicore/aicore_task_compiler.h index 4cb4dc58..2778aeb0 100755 --- a/ge/hybrid/node_executor/aicore/aicore_task_compiler.h +++ b/ge/hybrid/node_executor/aicore/aicore_task_compiler.h @@ -19,7 +19,7 @@ #include #include "opskernel_manager/ops_kernel_manager.h" -#include "aicore_node_executor.h" +#include "hybrid/node_executor/aicore/aicore_node_executor.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h index 7577d486..14bc8fcc 100644 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h @@ -20,7 +20,7 @@ #include "external/graph/types.h" #include "cce/aicpu_engine_struct.h" #include "hybrid/node_executor/node_executor.h" -#include "aicpu_ext_info.h" +#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 8b839849..4db223e0 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -20,7 +20,7 @@ #include "framework/common/fmk_error_codes.h" #include "common/dump/dump_manager.h" #include "common/ge/ge_util.h" -#include "graph/attr_value.h" +#include "external/graph/attr_value.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/load/model_manager/model_utils.h" diff --git a/ge/hybrid/node_executor/controlop/control_op_executor.cc b/ge/hybrid/node_executor/controlop/control_op_executor.cc index d55607ff..fa44d761 100644 --- a/ge/hybrid/node_executor/controlop/control_op_executor.cc +++ b/ge/hybrid/node_executor/controlop/control_op_executor.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "control_op_executor.h" +#include "hybrid/node_executor/controlop/control_op_executor.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" #include "hybrid/executor/hybrid_execution_context.h" diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc index 72092cd8..522d0649 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc @@ -17,11 +17,11 @@ #include "hybrid/node_executor/hccl/hccl_node_executor.h" #include "common/ge/plugin_manager.h" #include "common/math/math_util.h" -#include "graph/attr_value.h" +#include "external/graph/attr_value.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/util/hcom_util.h" #include "graph/utils/type_utils.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "hybrid/executor/hybrid_execution_context.h" #include "hccl/hcom.h" diff --git a/ge/hybrid/node_executor/node_executor.h b/ge/hybrid/node_executor/node_executor.h index fffd4e7d..ad4a9296 100644 --- a/ge/hybrid/node_executor/node_executor.h +++ b/ge/hybrid/node_executor/node_executor.h @@ -20,7 +20,7 @@ #include "external/ge/ge_api_error_codes.h" #include "common/opskernel/ops_kernel_builder.h" #include "graph/node.h" -#include "task_context.h" +#include "hybrid/node_executor/task_context.h" namespace ge { const uint32_t MEMORY_ALIGN_RATIO = 2; diff --git a/ge/hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc b/ge/hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc index 28a5dea1..ad1f7e61 100755 --- a/ge/hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc +++ b/ge/hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "partitioned_call_node_executor.h" +#include "hybrid/node_executor/partitioned_call/partitioned_call_node_executor.h" #include "graph/utils/node_utils.h" namespace ge { diff --git a/ge/hybrid/node_executor/rts/rts_node_executor.cc b/ge/hybrid/node_executor/rts/rts_node_executor.cc index 3ad791b6..5cd971df 100644 --- a/ge/hybrid/node_executor/rts/rts_node_executor.cc +++ b/ge/hybrid/node_executor/rts/rts_node_executor.cc @@ -17,9 +17,9 @@ #include "hybrid/node_executor/rts/rts_node_executor.h" #include "hybrid/node_executor/rts/rts_task_factory.h" -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" -#include "common/types.h" +#include "framework/common/types.h" #include "graph/common/omg_util.h" #include "graph/utils/tensor_utils.h" #include "hybrid/model/hybrid_model.h" diff --git a/ge/hybrid/node_executor/rts/rts_node_task.cc b/ge/hybrid/node_executor/rts/rts_node_task.cc index 104196ee..9af54815 100644 --- a/ge/hybrid/node_executor/rts/rts_node_task.cc +++ b/ge/hybrid/node_executor/rts/rts_node_task.cc @@ -22,7 +22,7 @@ #include "graph/utils/type_utils.h" #include "graph/utils/node_utils.h" #include "common/ge/ge_util.h" -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" namespace { constexpr uint8_t kSwitchPredIndex = 0; diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index fe580c1e..78ccb54a 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "task_context.h" +#include "hybrid/node_executor/task_context.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/log.h" #include "graph/utils/tensor_utils.h" -#include "graph/types.h" +#include "external/graph/types.h" #include "graph/debug/ge_attr_define.h" #include "hybrid/executor/hybrid_execution_context.h" #include "hybrid/executor/subgraph_executor.h" diff --git a/ge/inc/graph_pass.h b/ge/inc/graph_pass.h index 642b94ea..a9cc7a32 100644 --- a/ge/inc/graph_pass.h +++ b/ge/inc/graph_pass.h @@ -20,9 +20,9 @@ #include #include -#include "common/op/attr_value_util.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" +#include "framework/common/op/attr_value_util.h" +#include "framework/common/op/ge_op_utils.h" +#include "framework/common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/compute_graph.h" #include "graph/utils/attr_utils.h" diff --git a/ge/inc/kernel.h b/ge/inc/kernel.h index 84af5234..a83776a9 100644 --- a/ge/inc/kernel.h +++ b/ge/inc/kernel.h @@ -19,9 +19,9 @@ #include -#include "common/op/ge_op_utils.h" +#include "framework/common/op/ge_op_utils.h" #include "graph/compute_graph.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/op_desc.h" using std::vector; diff --git a/ge/inc/kernel_factory.h b/ge/inc/kernel_factory.h index 61455836..e532b894 100644 --- a/ge/inc/kernel_factory.h +++ b/ge/inc/kernel_factory.h @@ -24,7 +24,7 @@ #include "common/ge/ge_util.h" #include "framework/common/debug/ge_log.h" -#include "graph/graph.h" +#include "external/graph/graph.h" using std::string; diff --git a/ge/inc/pass.h b/ge/inc/pass.h index 9f8519e1..56f77fef 100644 --- a/ge/inc/pass.h +++ b/ge/inc/pass.h @@ -19,7 +19,7 @@ #include -#include "common/fmk_error_codes.h" +#include "framework/common/fmk_error_codes.h" namespace ge { /// diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 2374e75f..b34871a9 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -33,7 +33,7 @@ #include "framework/common/util.h" #include "framework/omg/ge_init.h" #include "analyzer/analyzer.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "ge_local_engine/engine/host_cpu_engine.h" #include "graph/common/ge_call_wrapper.h" #include "graph/ge_context.h" diff --git a/ge/init/gelib.h b/ge/init/gelib.h index ed6fe5d4..eb367578 100644 --- a/ge/init/gelib.h +++ b/ge/init/gelib.h @@ -23,8 +23,8 @@ #include "engine_manager/dnnengine_manager.h" #include "opskernel_manager/ops_kernel_manager.h" #include "session/session_manager.h" -#include "common/ge_inner_error_codes.h" -#include "common/ge_types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "framework/common/ge_types.h" using std::string; using std::map; diff --git a/ge/ir_build/attr_options/attr_options.h b/ge/ir_build/attr_options/attr_options.h index 7c0f4f4f..b1b794c0 100644 --- a/ge/ir_build/attr_options/attr_options.h +++ b/ge/ir_build/attr_options/attr_options.h @@ -1,29 +1,29 @@ -/** - * Copyright 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 ATTR_OPTIONS_H_ -#define ATTR_OPTIONS_H_ - -#include -#include "graph/compute_graph.h" -#include "graph/ge_error_codes.h" - -namespace ge { -bool IsOriginalOpFind(OpDescPtr &op_desc, const std::string &op_name); - -graphStatus KeepDtypeFunc(ComputeGraphPtr &graph, const std::string &cfg_path); -graphStatus WeightCompressFunc(ComputeGraphPtr &graph, const std::string &cfg_path); -} // namespace +/** + * Copyright 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 ATTR_OPTIONS_H_ +#define ATTR_OPTIONS_H_ + +#include +#include "graph/compute_graph.h" +#include "external/graph/ge_error_codes.h" + +namespace ge { +bool IsOriginalOpFind(OpDescPtr &op_desc, const std::string &op_name); + +graphStatus KeepDtypeFunc(ComputeGraphPtr &graph, const std::string &cfg_path); +graphStatus WeightCompressFunc(ComputeGraphPtr &graph, const std::string &cfg_path); +} // namespace #endif // ATTR_OPTIONS_H_ \ No newline at end of file diff --git a/ge/ir_build/attr_options/keep_dtype_option.cc b/ge/ir_build/attr_options/keep_dtype_option.cc index dfdd0df3..9da08cc0 100644 --- a/ge/ir_build/attr_options/keep_dtype_option.cc +++ b/ge/ir_build/attr_options/keep_dtype_option.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "attr_options.h" +#include "ir_build/attr_options/attr_options.h" #include #include #include diff --git a/ge/ir_build/attr_options/utils.cc b/ge/ir_build/attr_options/utils.cc index f0b559ec..ed63ffe3 100644 --- a/ge/ir_build/attr_options/utils.cc +++ b/ge/ir_build/attr_options/utils.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "attr_options.h" +#include "ir_build/attr_options/attr_options.h" #include #include "graph/debug/ge_attr_define.h" #include "common/util/error_manager/error_manager.h" diff --git a/ge/ir_build/attr_options/weight_compress_option.cc b/ge/ir_build/attr_options/weight_compress_option.cc index 3c057d04..b59c6adc 100644 --- a/ge/ir_build/attr_options/weight_compress_option.cc +++ b/ge/ir_build/attr_options/weight_compress_option.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "attr_options.h" +#include "ir_build/attr_options/attr_options.h" #include #include #include diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index befffa93..ea521f5b 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -25,8 +25,8 @@ #include "framework/common/util.h" #include "framework/omg/omg_inner_types.h" #include "framework/omg/omg_inner_types.h" -#include "ge/ge_api_types.h" -#include "generator/ge_generator.h" +#include "external/ge/ge_api_types.h" +#include "framework/generator/ge_generator.h" #include "graph/compute_graph.h" #include "graph/ge_tensor.h" #include "graph/utils/type_utils.h" diff --git a/ge/ir_build/option_utils.cc b/ge/ir_build/option_utils.cc index cecc2588..e2665eac 100755 --- a/ge/ir_build/option_utils.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 "option_utils.h" +#include "ir_build/option_utils.h" #include "common/util/error_manager/error_manager.h" #include "external/ge/ge_api_types.h" #include "framework/common/string_util.h" diff --git a/ge/model/ge_model.cc b/ge/model/ge_model.cc index bcccc6f8..1bf35afc 100755 --- a/ge/model/ge_model.cc +++ b/ge/model/ge_model.cc @@ -16,7 +16,7 @@ #include "model/ge_model.h" #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/attr_utils.h" diff --git a/ge/model/ge_model.h b/ge/model/ge_model.h index 08db8cc3..6356c621 100755 --- a/ge/model/ge_model.h +++ b/ge/model/ge_model.h @@ -26,7 +26,7 @@ #include "framework/common/debug/log.h" #include "framework/common/fmk_error_codes.h" #include "graph/buffer.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "proto/task.pb.h" namespace ge { diff --git a/ge/model/ge_root_model.cc b/ge/model/ge_root_model.cc index 68f868dd..b6a1e175 100644 --- a/ge/model/ge_root_model.cc +++ b/ge/model/ge_root_model.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "ge_root_model.h" +#include "model/ge_root_model.h" #include "graph/debug/ge_attr_define.h" namespace ge { void GeRootModel::SetSubgraphInstanceNameToModel(string instance_name, GeModelPtr ge_model) { diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index a520652f..3a320226 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -30,25 +30,17 @@ target_compile_definitions(atc_atc.bin PRIVATE target_include_directories(atc_atc.bin PRIVATE ${CMAKE_CURRENT_LIST_DIR} - ${GE_CODE_DIR} ${GE_CODE_DIR}/ge ${GE_CODE_DIR}/inc/external - ${GE_CODE_DIR}/common/inc/external - ${GE_CODE_DIR}/common/inc/external/graph ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc - ${METADEF_DIR}/inc/graph - ${METADEF_DIR}/inc/register ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/external/register ${PARSER_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/common #### blue zone #### ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain @@ -107,25 +99,17 @@ target_compile_definitions(fwk_atc.bin PRIVATE target_include_directories(fwk_atc.bin PRIVATE ${CMAKE_CURRENT_LIST_DIR} - ${GE_CODE_DIR} ${GE_CODE_DIR}/ge ${GE_CODE_DIR}/inc/external - ${GE_CODE_DIR}/common/inc/external - ${GE_CODE_DIR}/common/inc/external/graph ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework ${METADEF_DIR}/inc - ${METADEF_DIR}/inc/graph - ${METADEF_DIR}/inc/register ${METADEF_DIR}/inc/external - ${METADEF_DIR}/inc/external/graph - ${METADEF_DIR}/inc/external/register ${PARSER_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/common #### blue zone #### ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain diff --git a/ge/offline/main.cc b/ge/offline/main.cc index a1ae476b..80a71b7f 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -23,26 +23,26 @@ #include #include #include -#include "common/gflags_util.h" -#include "common/util.h" +#include "framework/common/gflags_util.h" +#include "framework/common/util.h" #include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.h" -#include "ge/ge_api.h" -#include "generator/ge_generator.h" +#include "external/ge/ge_api.h" +#include "framework/generator/ge_generator.h" #include "graph/anchor.h" #include "graph/debug/ge_attr_define.h" -#include "graph/graph.h" +#include "external/graph/graph.h" #include "graph/op_desc.h" #include "graph/utils/graph_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" #include "ir_build/option_utils.h" -#include "omg/omg.h" -#include "omg/parser/parser_factory.h" -#include "omg/parser/parser_inner_ctx.h" +#include "framework/omg/omg.h" +#include "framework/omg/parser/parser_factory.h" +#include "framework/omg/parser/parser_inner_ctx.h" #include "parser/common/register_tbe.h" #include "register/op_registry.h" -#include "single_op_parser.h" +#include "offline/single_op_parser.h" #include "external/ge/ge_ir_build.h" using domi::BuildMode; diff --git a/ge/offline/single_op_parser.cc b/ge/offline/single_op_parser.cc index dac2e15c..6bc5cb3d 100644 --- a/ge/offline/single_op_parser.cc +++ b/ge/offline/single_op_parser.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "single_op_parser.h" +#include "offline/single_op_parser.h" #include #include @@ -24,7 +24,7 @@ #include "framework/common/debug/ge_log.h" #include "common/util/error_manager/error_manager.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/common/util.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/offline/single_op_parser.h b/ge/offline/single_op_parser.h index 11f5512e..25699552 100644 --- a/ge/offline/single_op_parser.h +++ b/ge/offline/single_op_parser.h @@ -21,8 +21,8 @@ #include -#include "ge/ge_api_error_codes.h" -#include "graph/types.h" +#include "external/ge/ge_api_error_codes.h" +#include "external/graph/types.h" #include "graph/ge_attr_value.h" #include "graph/op_desc.h" diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index 04262e1b..33ffddf5 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -15,7 +15,7 @@ */ #include "init/gelib.h" -#include "ops_kernel_builder_manager.h" +#include "opskernel_manager/ops_kernel_builder_manager.h" #include "register/ops_kernel_builder_registry.h" namespace ge { diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index ac5e9153..fc7bbdc2 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -24,9 +24,9 @@ #include #include #include -#include "../init/gelib.h" +#include "init/gelib.h" #include "framework/common/debug/ge_log.h" -#include "ge/ge_api.h" +#include "external/ge/ge_api.h" #include "proto/optimizer_priority.pb.h" namespace { diff --git a/ge/opskernel_manager/ops_kernel_manager.h b/ge/opskernel_manager/ops_kernel_manager.h index 19d703e3..5a72dc50 100644 --- a/ge/opskernel_manager/ops_kernel_manager.h +++ b/ge/opskernel_manager/ops_kernel_manager.h @@ -23,15 +23,15 @@ #include #include -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/ge/plugin_manager.h" #include "common/ge/op_tiling_manager.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "common/opskernel/ops_kernel_info_store.h" #include "common/optimizer/graph_optimizer.h" #include "graph/optimize/graph_optimize.h" #include "framework/common/ge_inner_error_codes.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "runtime/base.h" using std::string; diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index b4ea9c52..b8628ad1 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -24,9 +24,8 @@ target_compile_definitions(engine PRIVATE target_include_directories(engine PRIVATE ${GE_CODE_DIR}/ge - ${GE_CODE_DIR}/inc/ + ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/inc/framework/common ${GE_CODE_DIR}/inc/external ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external diff --git a/ge/plugin/engine/dnnengines.h b/ge/plugin/engine/dnnengines.h index 0633c104..829c83f1 100644 --- a/ge/plugin/engine/dnnengines.h +++ b/ge/plugin/engine/dnnengines.h @@ -21,7 +21,7 @@ #include #include -#include "engine/dnnengine.h" +#include "framework/engine/dnnengine.h" #include "plugin/engine/engine_manage.h" namespace ge { diff --git a/ge/plugin/engine/engine_manage.h b/ge/plugin/engine/engine_manage.h index 7eb88805..a047e5de 100644 --- a/ge/plugin/engine/engine_manage.h +++ b/ge/plugin/engine/engine_manage.h @@ -36,7 +36,7 @@ #include #include -#include "engine/dnnengine.h" +#include "framework/engine/dnnengine.h" namespace ge { using DNNEnginePtr = std::shared_ptr; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index 8248eecf..aabbe19c 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -24,7 +24,7 @@ #include "adx_datadump_server.h" #include "common/dump/dump_properties.h" #include "common/dump/dump_manager.h" -#include "common/util.h" +#include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" diff --git a/ge/session/inner_session.h b/ge/session/inner_session.h index a2ec35df..35fe4692 100644 --- a/ge/session/inner_session.h +++ b/ge/session/inner_session.h @@ -21,7 +21,7 @@ #include #include #include "framework/common/ge_types.h" -#include "ge/ge_api_types.h" +#include "external/ge/ge_api_types.h" #include "graph/manager/graph_manager.h" namespace ge { diff --git a/ge/session/omg.cc b/ge/session/omg.cc index 878b0b39..f7f3def7 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -14,21 +14,21 @@ * limitations under the License. */ -#include "omg/omg.h" +#include "framework/omg/omg.h" #include #include #include #include "common/auth/file_saver.h" -#include "common/debug/log.h" +#include "framework/common/debug/log.h" #include "common/debug/memory_dumper.h" #include "common/ge/ge_util.h" -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "common/model_parser/model_parser.h" #include "common/model_saver.h" #include "common/properties_manager.h" -#include "common/string_util.h" -#include "common/types.h" -#include "common/util.h" +#include "framework/common/string_util.h" +#include "framework/common/types.h" +#include "framework/common/util.h" #include "common/util/error_manager/error_manager.h" #include "framework/common/debug/ge_log.h" #include "framework/omg/parser/parser_inner_ctx.h" @@ -39,10 +39,10 @@ #include "graph/optimize/common/params.h" #include "graph/utils/type_utils.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" -#include "omg/parser/weights_parser.h" +#include "framework/omg/omg_inner_types.h" +#include "framework/omg/parser/model_parser.h" +#include "framework/omg/parser/parser_factory.h" +#include "framework/omg/parser/weights_parser.h" #include "parser/common/pre_checker.h" #include "parser/common/convert/pb2json.h" #include "proto/ge_ir.pb.h" diff --git a/ge/session/session_manager.h b/ge/session/session_manager.h index 17152b0a..4c3429c2 100644 --- a/ge/session/session_manager.h +++ b/ge/session/session_manager.h @@ -22,8 +22,8 @@ #include #include #include -#include "common/ge_inner_error_codes.h" -#include "ge/ge_api_types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "external/ge/ge_api_types.h" #include "session/inner_session.h" #include "runtime/base.h" diff --git a/ge/single_op/single_op.cc b/ge/single_op/single_op.cc index d09e8398..9df6d5dd 100755 --- a/ge/single_op/single_op.cc +++ b/ge/single_op/single_op.cc @@ -16,8 +16,8 @@ #include "single_op/single_op.h" -#include "common/fmk_types.h" -#include "common/ge_types.h" +#include "framework/common/fmk_types.h" +#include "framework/common/ge_types.h" #include "common/math/math_util.h" #include "common/profiling/profiling_manager.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/single_op/single_op.h b/ge/single_op/single_op.h index deb4532e..7e05dd5f 100755 --- a/ge/single_op/single_op.h +++ b/ge/single_op/single_op.h @@ -23,10 +23,10 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "framework/executor/ge_executor.h" #include "runtime/stream.h" -#include "task/op_task.h" +#include "single_op/task/op_task.h" #include "cce/aicpu_engine_struct.h" #include "hybrid/executor/hybrid_model_executor.h" diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 90a6362c..eefa5165 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -28,10 +28,10 @@ #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" #include "runtime/rt.h" -#include "task/aicpu_task_builder.h" -#include "task/aicpu_kernel_task_builder.h" -#include "task/rts_kernel_task_builder.h" -#include "task/tbe_task_builder.h" +#include "single_op/task/aicpu_task_builder.h" +#include "single_op/task/aicpu_kernel_task_builder.h" +#include "single_op/task/rts_kernel_task_builder.h" +#include "single_op/task/tbe_task_builder.h" #include "hybrid/executor/hybrid_model_executor.h" #include "hybrid/node_executor/node_executor.h" diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index 529a442d..bf3ad050 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -23,7 +23,7 @@ #include #include -#include "common/helper/model_helper.h" +#include "framework/common/helper/model_helper.h" #include "single_op/single_op.h" #include "single_op/stream_resource.h" #include "single_op/task/op_task.h" diff --git a/ge/single_op/stream_resource.h b/ge/single_op/stream_resource.h index aecb38c8..8986634b 100755 --- a/ge/single_op/stream_resource.h +++ b/ge/single_op/stream_resource.h @@ -23,7 +23,7 @@ #include #include -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "runtime/stream.h" #include "single_op/single_op.h" diff --git a/ge/single_op/task/aicpu_kernel_task_builder.cc b/ge/single_op/task/aicpu_kernel_task_builder.cc index 18f13691..2f0856bf 100755 --- a/ge/single_op/task/aicpu_kernel_task_builder.cc +++ b/ge/single_op/task/aicpu_kernel_task_builder.cc @@ -17,7 +17,7 @@ #include "single_op/task/aicpu_kernel_task_builder.h" #include "framework/common/taskdown_common.h" #include "graph/load/model_manager/model_manager.h" -#include "build_task_utils.h" +#include "single_op/task/build_task_utils.h" namespace ge { AiCpuCCTaskBuilder::AiCpuCCTaskBuilder(const OpDescPtr &op_desc, const domi::KernelDef &kernel_def) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 66d70e7e..b189ab00 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -29,7 +29,7 @@ #include "framework/common/debug/log.h" #include "register/op_tiling.h" #include "runtime/rt.h" -#include "build_task_utils.h" +#include "single_op/task/build_task_utils.h" namespace ge { namespace { diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index ed6cf40f..2fbb4dc7 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -23,7 +23,7 @@ #include "common/dump/dump_op.h" #include "common/dump/dump_properties.h" -#include "common/ge_inner_error_codes.h" +#include "framework/common/ge_inner_error_codes.h" #include "graph/op_kernel_bin.h" #include "runtime/stream.h" #include "graph/node.h" diff --git a/ge/single_op/task/rts_kernel_task_builder.cc b/ge/single_op/task/rts_kernel_task_builder.cc index aad78fd9..07bcbd19 100644 --- a/ge/single_op/task/rts_kernel_task_builder.cc +++ b/ge/single_op/task/rts_kernel_task_builder.cc @@ -15,7 +15,7 @@ */ #include "single_op/task/rts_kernel_task_builder.h" -#include "build_task_utils.h" +#include "single_op/task/build_task_utils.h" namespace ge { namespace { diff --git a/inc/framework/common/profiling/ge_runner_profiling.h b/inc/framework/common/profiling/ge_runner_profiling.h index 011797a3..27e19bce 100644 --- a/inc/framework/common/profiling/ge_runner_profiling.h +++ b/inc/framework/common/profiling/ge_runner_profiling.h @@ -17,7 +17,7 @@ #ifndef INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ #define INC_FRAMEWORK_COMMON_GE_RUNNER_PROFILING_H_ -#include "profiling/ge_profiling.h" +#include "framework/common/profiling/ge_profiling.h" GE_FUNC_VISIBILITY bool IsInitialize(); From 109973df92d23d8bbbf88d29d5d0bd34a9bc6617 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 22 Jun 2021 11:21:13 +0800 Subject: [PATCH 064/226] Update submodule for proto --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index f75dbad2..310610e5 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit f75dbad2f2249608080e482acc6d723e04fec3da +Subproject commit 310610e5392e01659d214ad380e9ed2c39f9f5a3 From af91789d4559ee3913dd07470bd918c84282e326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=A3=8A?= Date: Mon, 21 Jun 2021 21:10:25 +0800 Subject: [PATCH 065/226] update protobuf to 3.13.0 --- cmake/external_libs/protobuf_static.cmake | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/external_libs/protobuf_static.cmake b/cmake/external_libs/protobuf_static.cmake index b8ff90bb..51f6ffbc 100755 --- a/cmake/external_libs/protobuf_static.cmake +++ b/cmake/external_libs/protobuf_static.cmake @@ -13,7 +13,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR endif() if(GE_PB_PKG) - set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.8.0.tar.gz") + set(REQ_URL "${GE_PB_PKG}/libs/protobuf/v3.13.0.tar.gz") else() if (ENABLE_GITEE) set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz") diff --git a/parser b/parser index db5ce472..79536a19 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit db5ce472de0086c3e2abdaab3b0685c1d2656c96 +Subproject commit 79536a196f89cf7a1f5852ff7304b9a7d7b12eff From beea153eb9be9a76e86233b192a2b25b65c5d8d3 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Tue, 22 Jun 2021 12:53:55 +0800 Subject: [PATCH 066/226] atc test keepdtype --- ge/ir_build/attr_options/attr_options.h | 5 ++-- ge/ir_build/attr_options/keep_dtype_option.cc | 35 ++++++++++++++++------- ge/ir_build/attr_options/utils.cc | 39 +++++++++++++++++++++++-- tests/ut/ge/graph_ir/ge_ir_build_unittest.cc | 41 +++++++++++++++++++++------ 4 files changed, 97 insertions(+), 23 deletions(-) diff --git a/ge/ir_build/attr_options/attr_options.h b/ge/ir_build/attr_options/attr_options.h index b1b794c0..9ea2b9a1 100644 --- a/ge/ir_build/attr_options/attr_options.h +++ b/ge/ir_build/attr_options/attr_options.h @@ -18,11 +18,12 @@ #include #include "graph/compute_graph.h" -#include "external/graph/ge_error_codes.h" +#include "graph/ge_error_codes.h" namespace ge { bool IsOriginalOpFind(OpDescPtr &op_desc, const std::string &op_name); - +bool IsOpTypeEqual(const ge::NodePtr &node, const std::string &op_type); +bool IsContainOpType(const std::string &cfg_line, std::string &op_type); graphStatus KeepDtypeFunc(ComputeGraphPtr &graph, const std::string &cfg_path); graphStatus WeightCompressFunc(ComputeGraphPtr &graph, const std::string &cfg_path); } // namespace diff --git a/ge/ir_build/attr_options/keep_dtype_option.cc b/ge/ir_build/attr_options/keep_dtype_option.cc index 9da08cc0..88f238c0 100644 --- a/ge/ir_build/attr_options/keep_dtype_option.cc +++ b/ge/ir_build/attr_options/keep_dtype_option.cc @@ -32,18 +32,24 @@ void KeepDtypeReportError(const std::vector &invalid_list, const st size_t list_size = invalid_list.size(); err_msg << "config file contains " << list_size; if (list_size == 1) { - err_msg << " operator not in the graph, op name:"; + err_msg << " operator not in the graph, "; } else { - err_msg << " operators not in the graph, op names:"; + err_msg << " operators not in the graph, "; } - + std::string cft_type; for (size_t i = 0; i < list_size; i++) { if (i == kMaxOpsNum) { err_msg << ".."; break; } - err_msg << invalid_list[i]; - if (i != list_size - 1) { + bool istype = IsContainOpType(invalid_list[i], cft_type); + if (!istype) { + err_msg << "op name:"; + } else { + err_msg << "op type:"; + } + err_msg << cft_type; + if (i != (list_size - 1)) { err_msg << " "; } } @@ -72,7 +78,7 @@ graphStatus KeepDtypeFunc(ComputeGraphPtr &graph, const std::string &cfg_path) { return GRAPH_FAILED; } - std::string op_name; + std::string op_name, op_type; std::vector invalid_list; while (std::getline(ifs, op_name)) { if (op_name.empty()) { @@ -80,13 +86,20 @@ graphStatus KeepDtypeFunc(ComputeGraphPtr &graph, const std::string &cfg_path) { } op_name = StringUtils::Trim(op_name); bool is_find = false; - for (auto &node_ptr : graph->GetDirectNode()) { + bool is_type = IsContainOpType(op_name, op_type); + for (auto &node_ptr : graph->GetAllNodes()) { auto op_desc = node_ptr->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); - - if ((op_desc->GetName() == op_name) || IsOriginalOpFind(op_desc, op_name)) { - is_find = true; - (void)AttrUtils::SetInt(op_desc, ATTR_NAME_KEEP_DTYPE, 1); + if (is_type) { + if (IsOpTypeEqual(node_ptr, op_type)) { + is_find = true; + (void)AttrUtils::SetInt(op_desc, ATTR_NAME_KEEP_DTYPE, 1); + } + } else { + if (op_desc->GetName() == op_name || IsOriginalOpFind(op_desc, op_name)) { + is_find = true; + (void)AttrUtils::SetInt(op_desc, ATTR_NAME_KEEP_DTYPE, 1); + } } } if (!is_find) { diff --git a/ge/ir_build/attr_options/utils.cc b/ge/ir_build/attr_options/utils.cc index ed63ffe3..5398c220 100644 --- a/ge/ir_build/attr_options/utils.cc +++ b/ge/ir_build/attr_options/utils.cc @@ -16,9 +16,12 @@ #include "ir_build/attr_options/attr_options.h" #include #include "graph/debug/ge_attr_define.h" -#include "common/util/error_manager/error_manager.h" - +#include "framework/common/debug/ge_log.h" +#include "graph/common/omg_util.h" namespace ge { + namespace { + const std::string CFG_PRE_OPTYPE = "OpType::"; +} bool IsOriginalOpFind(OpDescPtr &op_desc, const std::string &op_name) { std::vector original_op_names; if (!AttrUtils::GetListStr(op_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, original_op_names)) { @@ -33,4 +36,36 @@ bool IsOriginalOpFind(OpDescPtr &op_desc, const std::string &op_name) { return false; } + +bool IsOpTypeEqual(const ge::NodePtr &node, const std::string &op_type) { + if (op_type != node->GetOpDesc()->GetType()) { + return false; + } + std::string origin_type; + auto ret = GetOriginalType(node, origin_type); + if (ret != SUCCESS) { + GELOGW("[Get][OriginalType] from op:%s failed.", node->GetName().c_str()); + return false; + } + if (op_type != origin_type) { + return false; + } + return true; +} + +bool IsContainOpType(const std::string &cfg_line, std::string &op_type) { + op_type = cfg_line; + size_t pos = op_type.find(CFG_PRE_OPTYPE); + if (pos != std::string::npos) { + if (pos == 0) { + op_type = cfg_line.substr(CFG_PRE_OPTYPE.length()); + return true; + } else { + GELOGW("[Check][Param] %s must be at zero pos of %s", CFG_PRE_OPTYPE.c_str(), cfg_line.c_str()); + } + return false; + } + GELOGW("[Check][Param] %s not contain optype", cfg_line.c_str()); + return false; +} } // namespace ge \ No newline at end of file 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 047c9e1d..197c9300 100644 --- a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc +++ b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include #include #include "ir_build/option_utils.h" #include "graph/testcase/ge_graph/graph_builder_utils.h" @@ -21,7 +21,7 @@ #include "graph/utils/graph_utils.h" #include "ge/ge_ir_build.h" #include "graph/ops_stub.h" - +#include "ge/ir_build/attr_options/attr_options.h" #define protected public #define private public @@ -70,6 +70,22 @@ static ComputeGraphPtr BuildComputeGraph() { return builder.GetGraph(); } +static ComputeGraphPtr BuildComputeGraph1() { + auto builder = ut::GraphBuilder("test"); + auto data1 = builder.AddNode("input1", DATA, 1, 1, FORMAT_NCHW, DT_FLOAT, {1, 2, 3}); + auto data2 = builder.AddNode("input2", DATA, 1, 1, FORMAT_NCHW, DT_FLOAT, {4, 10}); + auto addn1 = builder.AddNode("addn1", AddNYes, 2, 1); + auto node1 = builder.AddNode("addd", "Mul", 2, 1); + auto node2 = builder.AddNode("ffm", "FrameworkOp", 2, 1); + auto netoutput = builder.AddNode("netoutput", NETOUTPUT, 1, 0); + + builder.AddDataEdge(data1, 0, addn1, 0); + builder.AddDataEdge(data2, 0, addn1, 1); + builder.AddDataEdge(addn1, 0,netoutput, 0); + + return builder.GetGraph(); +} + // data not set attr index; // but becasue of op proto, register attr index. so all data index is zero; static Graph BuildIrGraph() { @@ -89,10 +105,12 @@ static Graph BuildIrGraph1() { auto data1 = op::Data("data1").set_attr_index(0); auto data2 = op::Data("data2").set_attr_index(1); auto data3 = op::Data("data3"); - std::vector inputs {data1, data2, data3}; + auto data4 = op::Data("Test"); + std::vector inputs {data1, data2, data3, data4}; std::vector outputs; Graph graph("test_graph"); + graph.AddNodeByOp(Operator("gg", "Mul")); graph.SetInputs(inputs).SetOutputs(outputs); return graph; } @@ -373,9 +391,16 @@ TEST(UtestIrBuild, check_modify_mixlist_param) { EXPECT_EQ(ret, GRAPH_PARAM_INVALID); } -TEST(UtestIrCommon, check_dynamic_imagesize_input_shape_valid_format_empty) { - std::map> shape_map; - std::string dynamic_image_size = ""; - bool ret = CheckDynamicImagesizeInputShapeValid(shape_map, "123", dynamic_image_size); - EXPECT_EQ(ret, false); +TEST(UtestIrBuild, atc_cfg_optype_param) { + ComputeGraphPtr graph = BuildComputeGraph1(); + FILE *fp = fopen("./keep.txt", "w+"); + if (fp) { + fprintf(fp, "Test\n"); + fprintf(fp, "OpType::Mul\n"); + fprintf(fp, "Optype::Sub\n"); + fclose(fp); + } + auto ret = KeepDtypeFunc(graph, "./keep.txt"); + (void)remove("./keep.txt"); + EXPECT_EQ(ret, GRAPH_PARAM_INVALID); } \ No newline at end of file From fe77ec974ade91b5a41d713bf7ed0639ac92f176 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 22 Jun 2021 16:20:29 +0800 Subject: [PATCH 067/226] Fix BuildPartitionFrame failed --- ge/graph/partition/dynamic_shape_partition.cc | 25 +++++++++++++------------ ge/graph/partition/dynamic_shape_partition.h | 4 +++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ge/graph/partition/dynamic_shape_partition.cc b/ge/graph/partition/dynamic_shape_partition.cc index 1db47498..8fc19ff2 100755 --- a/ge/graph/partition/dynamic_shape_partition.cc +++ b/ge/graph/partition/dynamic_shape_partition.cc @@ -284,9 +284,6 @@ Status DynamicShapePartitioner::InitClusters() { auto cluster = MakeShared(rank++, type, node, this); REQUIRE_NOT_NULL(cluster, "[New][Memory] for cluster failed."); node_2_cluster_[node] = cluster; - if (cluster->IsUnknownShape()) { - ordered_cluster_.push_back(cluster); - } int64_t group_index = -1; if (AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index)) { @@ -306,7 +303,7 @@ Status DynamicShapePartitioner::InitClusters() { return SUCCESS; } -Status DynamicShapePartitioner::TopologicalSortClusters() { +Status DynamicShapePartitioner::TopologicalSortClusters(const OrderedFilter &ordered_filter) { ordered_cluster_.clear(); // BFS topological sort clusters for known shape cluster std::queue ready_clusters; @@ -331,7 +328,7 @@ Status DynamicShapePartitioner::TopologicalSortClusters() { auto cluster = ready_clusters.front(); ready_clusters.pop(); cluster->UpdateRank(rank++); - if (cluster->IsKnownShape() || cluster->IsInputNode()) { + if (ordered_filter == nullptr || ordered_filter(cluster)) { ordered_cluster_.push_back(cluster); } for (const auto &out_cluster : cluster->Outputs()) { @@ -378,7 +375,6 @@ void DynamicShapePartitioner::MergeClustersControlFlow() { continue; } - bool is_unknown_cluster = cluster->IsUnknownShape(); for (++rit; rit != control_cluster.rend(); ++rit) { const auto &cluster_from = *rit; if (all_merged_clusters.count(cluster_from) > 0) { @@ -395,11 +391,6 @@ void DynamicShapePartitioner::MergeClustersControlFlow() { } } } - - if (!is_unknown_cluster && cluster->IsUnknownShape()) { - GELOGD("Add to ordered cluster: %s", cluster->DebugString().c_str()); - ordered_cluster_.push_back(cluster); - } } } @@ -475,9 +466,19 @@ void DynamicShapePartitioner::MergeClustersInputData() { } Status DynamicShapePartitioner::MergeClusters() { + const auto filter_known = [](const ClusterPtr &cluster) { + return cluster->IsKnownShape() || cluster->IsInputNode(); + }; + const auto filter_unknown = [](const ClusterPtr &cluster) { + return cluster->IsUnknownShape(); + }; + MergeClustersControlFlow(); + REQUIRE_SUCCESS(TopologicalSortClusters(filter_unknown), + "[TopologicalSort][Clusters] after merge control flow clusters failed."); MergeClustersUnknownShape(); - REQUIRE_SUCCESS(TopologicalSortClusters(), "[TopologicalSort][Clusters] after merge unknown shape clusters failed."); + REQUIRE_SUCCESS(TopologicalSortClusters(filter_known), + "[TopologicalSort][Clusters] after merge unknown shape clusters failed."); MergeClustersKnownShape(); MergeClustersInputData(); return SUCCESS; diff --git a/ge/graph/partition/dynamic_shape_partition.h b/ge/graph/partition/dynamic_shape_partition.h index 31146570..0eb282a2 100644 --- a/ge/graph/partition/dynamic_shape_partition.h +++ b/ge/graph/partition/dynamic_shape_partition.h @@ -111,6 +111,8 @@ class DynamicShapePartitioner { Status Partition(); + using OrderedFilter = std::function &cluster)>; + private: Status PartitionImpl(); // Collect nodes that satisfy the unknowshape rules: @@ -138,7 +140,7 @@ class DynamicShapePartitioner { // Merge clusters step3 void MergeClustersInputData(); // Topological sort clusters after merge unknown shape clusters. - Status TopologicalSortClusters(); + Status TopologicalSortClusters(const OrderedFilter &ordered_filter); // Deduplicate merged clusters void PruneUniqueClusters(); // Establish the input-output anchors for each partition of the cluster and record links to other clusters From 3df837167ca0a7fa738b10815e5e8180ac1b59e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Tue, 22 Jun 2021 15:03:25 +0800 Subject: [PATCH 068/226] opt_info --- CMakeLists.txt | 1 + ge/CMakeLists.txt | 8 ++ ge/ge_opt_info/ge_opt_info.cc | 58 +++++++++++ ge/ge_opt_info/ge_opt_info.h | 31 ++++++ ge/graph/manager/graph_manager.cc | 7 ++ tests/CMakeLists.txt | 1 + tests/depends/opt_info/CMakeLists.txt | 37 +++++++ tests/depends/opt_info/src/opt_info_stub.cc | 46 +++++++++ tests/framework/cmake/graphengine.cmake | 2 + tests/st/testcase/test_ge_opt_info.cc | 123 ++++++++++++++++++++++++ tests/ut/ge/CMakeLists.txt | 14 +++ tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc | 82 ++++++++++++++++ third_party/fwkacllib/inc/opt_info/opt_info.h | 34 +++++++ 13 files changed, 444 insertions(+) create mode 100644 ge/ge_opt_info/ge_opt_info.cc create mode 100644 ge/ge_opt_info/ge_opt_info.h create mode 100644 tests/depends/opt_info/CMakeLists.txt create mode 100644 tests/depends/opt_info/src/opt_info_stub.cc create mode 100644 tests/st/testcase/test_ge_opt_info.cc create mode 100644 tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc create mode 100644 third_party/fwkacllib/inc/opt_info/opt_info.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e3cc1e32..41520b14 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) + find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 2b9122da..5db2e7a9 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -434,6 +434,7 @@ set(TRAIN_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" + "ge_opt_info/ge_opt_info.cc" ) set(INFER_SRC_LIST @@ -711,6 +712,7 @@ set(INFER_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" + "ge_opt_info/ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) @@ -765,11 +767,13 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external + ${GE_CODE_DIR}/../abl/licctrl #### blue zone ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_runner PRIVATE @@ -792,6 +796,7 @@ target_link_libraries(ge_runner PRIVATE runtime error_manager ascend_hal_stub + opt_feature -Wl,--as-needed json -lrt @@ -839,11 +844,13 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external + ${GE_CODE_DIR}/../abl/licctrl #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_compiler PRIVATE @@ -863,6 +870,7 @@ target_link_libraries(ge_compiler PRIVATE error_manager slog runtime_compile + opt_feature -Wl,--as-needed json -lrt diff --git a/ge/ge_opt_info/ge_opt_info.cc b/ge/ge_opt_info/ge_opt_info.cc new file mode 100644 index 00000000..8c1b84ab --- /dev/null +++ b/ge/ge_opt_info/ge_opt_info.cc @@ -0,0 +1,58 @@ +/** + * 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 "ge_opt_info/ge_opt_info.h" + +#include +#include +#include "graph/ge_local_context.h" +#include "ge/ge_api_types.h" +#include "common/debug/ge_log.h" +#include "opt_info.h" + +namespace ge { +Status GeOptInfo::SetOptInfo() { + std::string soc_ver; + graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get soc version failed."); + GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); + return FAILED; + } + GELOGD("Soc version:%s.", soc_ver.c_str()); + std::map opt_info; + // the first arg does not work at present. + if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + return FAILED; + } + // do nothing if get empty information + if (opt_info.empty()) { + GELOGI("Optional information is empty."); + return SUCCESS; + } + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + for (const auto &itr : opt_info) { + graph_options.emplace(itr.first, itr.second); + GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); + } + GetThreadLocalContext().SetGraphOption(graph_options); + return SUCCESS; +} +} // namespace ge diff --git a/ge/ge_opt_info/ge_opt_info.h b/ge/ge_opt_info/ge_opt_info.h new file mode 100644 index 00000000..935dff25 --- /dev/null +++ b/ge/ge_opt_info/ge_opt_info.h @@ -0,0 +1,31 @@ +/** + * 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. + */ + +#ifndef GE_OPT_INFO_GE_OPT_INFO_H_ +#define GE_OPT_INFO_GE_OPT_INFO_H_ + +#include "ge/ge_api_error_codes.h" +#include "register/register_types.h" + +namespace ge { +class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { + public: + GeOptInfo() = default; + static Status SetOptInfo(); +}; +} // namespace ge + +#endif // GE_OPT_INFO_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index f36c1c0d..0b27fdf3 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,6 +27,7 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" +#include "ge_opt_info/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -1001,6 +1002,12 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector + c_sec +) + +target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc new file mode 100644 index 00000000..df518c4b --- /dev/null +++ b/tests/depends/opt_info/src/opt_info_stub.cc @@ -0,0 +1,46 @@ +/** + * 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 "opt_info.h" +#include +#include +#include +#include + +namespace gelc { +namespace { +const std::vector kSocVersions = {"Ascend910"}; +} + +void SetAllOptInfo(std::map &opt_infos) { + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + opt_infos.emplace("opt_module.rl_tune", "all"); + opt_infos.emplace("opt_module.aoe", "all"); +} + +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_infos) { + if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { + SetAllOptInfo(opt_infos); + return SUCCESS; + } + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + return SUCCESS; +} +} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index 81aa00cc..c4380016 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,6 +103,7 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" + "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -117,6 +118,7 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub + opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc new file mode 100644 index 00000000..457473b1 --- /dev/null +++ b/tests/st/testcase/test_ge_opt_info.cc @@ -0,0 +1,123 @@ +/** + * 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 "easy_graph/graph/box.h" +#include "easy_graph/graph/node.h" +#include "easy_graph/builder/graph_dsl.h" +#include "easy_graph/builder/box_builder.h" +#include "easy_graph/layout/graph_layout.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" +#include "graph/graph.h" +#include "graph/compute_graph.h" +#include "framework/common/types.h" +#include "graph/debug/ge_attr_define.h" +#include "ge_graph_dsl/graph_dsl.h" +#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" +#define protected public +#define private public +#include "ge_opt_info/ge_opt_info.h" +#undef private +#undef protected + +namespace ge { +class STEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(STEST_opt_info, get_opt_info_all) { + std::map options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(STEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} +} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index f1ede616..37906457 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,6 +62,7 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) +include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -346,6 +347,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/session/omg.cc" + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" ) set(COMMON_FORMAT_SRC_FILES @@ -453,6 +455,7 @@ set(GRAPH_EXECUTE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.h" ) @@ -628,6 +631,10 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model.cc" ) +set(GE_OPT_INFO_SRC_FILES + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" +) + # test files set(COMMON_TEST_FILES "graph/passes/graph_builder_utils.cc" @@ -813,6 +820,10 @@ set(MULTI_PARTS_TEST_FILES "common/host_cpu_engine_unittest.cc" ) +set(GE_OPT_INFO_TEST_FILES + "ge_opt_info/ge_opt_info_unittest.cc" +) + set(GENERATOR_TEST_FILES "generator/ge_generator_unittest.cc" ) @@ -862,6 +873,7 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub + opt_feature_stub ascend_protobuf json ) @@ -1107,10 +1119,12 @@ target_link_libraries(ut_libge_multiparts_utest # libge_others_utest add_executable(ut_libge_others_utest + ${GE_OPT_INFO_SRC_FILES} ${COMMON_TEST_FILES} ${PASS_TEST_FILES} ${EXECUTE_TEST_FILES} ${OTHERS_TEST_FILES} + ${GE_OPT_INFO_TEST_FILES} ) target_compile_options(ut_libge_others_utest PRIVATE diff --git a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc new file mode 100644 index 00000000..20c123e9 --- /dev/null +++ b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc @@ -0,0 +1,82 @@ +/** + * 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 + +#define protected public +#define private public +#include "ge_opt_info/ge_opt_info.h" +#include "graph/ge_local_context.h" +#include "external/ge/ge_api_types.h" +#undef private +#undef protected + +namespace ge { +class UTEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UTEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_all) { + std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(global_options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_failed) { + std::map options; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::FAILED); +} + +} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h new file mode 100644 index 00000000..ea9bb529 --- /dev/null +++ b/third_party/fwkacllib/inc/opt_info/opt_info.h @@ -0,0 +1,34 @@ +/** + * 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 + +namespace gelc { +using Status = uint32_t; +using WorkMode = uint32_t; +const Status SUCCESS = 0x0; +const Status FAILED = 0xFFFFFFFF; +const WorkMode kOffline = 0x0; +const WorkMode kInline = 0x01; + +extern "C" { +__attribute__((visibility ("default"))) +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_info_map); +} +} // namespace gelc + From 69a27208a039ef30f389a0d3ea8f7247a214c4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Tue, 22 Jun 2021 19:17:03 +0800 Subject: [PATCH 069/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!1704=20:=20remove=20updation=20of=20session=5Fid'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/graph/manager/graph_manager.cc | 2 +- ge/hybrid/model/hybrid_model_builder.cc | 46 +++++----------------- ge/hybrid/model/hybrid_model_builder.h | 1 - ge/model/ge_root_model.h | 5 --- .../hybrid/executor/subgraph_executor_unittest.cc | 3 -- .../hybrid/model/hybrid_model_builder_unittest.cc | 26 +++--------- 6 files changed, 16 insertions(+), 67 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index f36c1c0d..b862a7d6 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -3132,10 +3132,10 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { } // Avoid repeatively prerun for graphs owns same graph_id in online inference concurrency if (count > 1 && graph_node->GetBuildFlag()) { + graph_node->Lock(); GELOGD("Avoid repeatively prerun, graph_id:%u.", args.graph_id); // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); - graph_node->Lock(); graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index c050875e..d3f00253 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -147,7 +147,6 @@ Status HybridModelBuilder::Build() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); hybrid_model_.model_name_ = ge_root_model_->GetModelName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); - GE_CHK_STATUS_RET(CopyGraph(), "[Invoke][CopyGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitRuntimeParams(), "[Invoke][InitRuntimeParams] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(RecoverGraphUnknownFlag(), "[Invoke][RecoverGraphUnknownFlag] failed, model_name_:[%s]", GetGraphName()); @@ -175,8 +174,8 @@ Status HybridModelBuilder::BuildForSingleOp() { hybrid_model_.model_name_ = ge_root_model_->GetRootGraph()->GetName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); auto ret = ge_root_model_->GetSubgraphInstanceNameToModel(); - const GeModelPtr ge_model = ret[hybrid_model_.root_graph_->GetName()]; - GE_CHK_STATUS_RET(IndexTaskDefs(hybrid_model_.root_graph_, ge_model), + const GeModelPtr ge_model = ret[ge_root_model_->GetRootGraph()->GetName()]; + GE_CHK_STATUS_RET(IndexTaskDefs(ge_root_model_->GetRootGraph(), ge_model), "[Invoke][IndexTaskDefs] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(LoadGraph(), "[Invoke][LoadGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitWeights(), "[Invoke][InitWeights] failed, model_name_:[%s]", GetGraphName()); @@ -191,29 +190,6 @@ Status HybridModelBuilder::ValidateParams() { return SUCCESS; } -Status HybridModelBuilder::CopyGraph() { - GELOGD("Copy compute graph begin."); - auto root_graph = ge_root_model_->GetRootGraph(); - - ge_root_model_->IncreaseBuildTimes(); - std::string new_graph_name = ge_root_model_->GetRootGraph()->GetName() + "_" + - std::to_string(ge_root_model_->GetBuildTimes()); - ComputeGraphPtr new_root_graph = MakeShared(new_graph_name); - GE_CHECK_NOTNULL(new_root_graph); - int32_t depth = 0; - std::map node_old_2_new; - std::map op_desc_old_2_new; - graphStatus ret = GraphUtils::CopyComputeGraph(root_graph, new_root_graph, node_old_2_new, op_desc_old_2_new, depth); - if (ret != GRAPH_SUCCESS) { - GELOGE(GRAPH_FAILED, "Copy compute graph failed."); - return GRAPH_FAILED; - } - hybrid_model_.root_graph_ = new_root_graph; - - GELOGD("Copy compute graph[%s] success.", new_graph_name.c_str()); - return SUCCESS; -} - Status HybridModelBuilder::BuildNodeItem(const NodePtr &node, NodeItem &node_item) { auto op_desc = node->GetOpDesc(); GE_CHK_STATUS_RET(ParseForceInfershapeNodes(node, node_item), @@ -838,7 +814,7 @@ Status HybridModelBuilder::BuildOutputMapping(GraphItem &graph_item, } Status HybridModelBuilder::LoadGraph() { - auto root_graph = hybrid_model_.root_graph_; + auto root_graph = ge_root_model_->GetRootGraph(); if (!GetContext().GetHostExecFlag()) { std::shared_ptr merged_graph; GELOGI("Before merging subgraphs DirectNodesSize = %zu, GetAllNodesSize = %zu", @@ -852,6 +828,7 @@ Status HybridModelBuilder::LoadGraph() { root_graph->GetAllNodesSize()); } + hybrid_model_.root_graph_ = root_graph; GE_CHK_STATUS_RET(RelinkNextIteration(), "[%s] Relink NextIteration failed", GetGraphName()); // Reset node id by topological order across all subgraphs int64_t index = 0; @@ -900,7 +877,6 @@ Status HybridModelBuilder::LoadGraph() { } for (auto &it : hybrid_model_.known_shape_sub_models_) { auto node_item = MutableNodeItem(it.first); - GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); @@ -1149,9 +1125,7 @@ Status HybridModelBuilder::InitWeights() { sub_weight_buffer->GetSize()); auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); if (subgraph != ge_root_model_->GetRootGraph()) { - subgraph = hybrid_model_.root_graph_->GetSubgraph(subgraph_model.first); - } else { - subgraph = hybrid_model_.root_graph_; + subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); } GE_CHECK_NOTNULL(subgraph); hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); @@ -1308,7 +1282,7 @@ Status HybridModelBuilder::IndexTaskDefs(const ComputeGraphPtr &sub_graph, const } Status HybridModelBuilder::IndexTaskDefs() { - const auto &root_graph = hybrid_model_.root_graph_; + const auto root_graph = ge_root_model_->GetRootGraph(); const auto &root_graph_name = root_graph->GetName(); if (SetOutputNameAttr(*root_graph) != SUCCESS) { GELOGW("Set output name attr failed."); @@ -1342,7 +1316,7 @@ Status HybridModelBuilder::IndexTaskDefs() { Status HybridModelBuilder::IndexSpecialNodes() { GELOGD("Start to index special nodes"); - const auto &root_graph = hybrid_model_.root_graph_; + const auto &root_graph = ge_root_model_->GetRootGraph(); for (auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); @@ -1497,7 +1471,7 @@ Status HybridModelBuilder::InitRuntimeParams() { runtime_param_.session_id = ret ? static_cast(value) : 0; ret = ge::AttrUtils::GetInt(first_model, ATTR_MODEL_TASK_GEN_VAR_ADDR, value); runtime_param_.logic_var_base = ret ? static_cast(value) : 0; - runtime_param_.graph_id = hybrid_model_.root_graph_->GetGraphID(); + runtime_param_.graph_id = ge_root_model_->GetRootGraph()->GetGraphID(); value = 0; for (auto &it : ge_root_model_->GetSubgraphInstanceNameToModel()) { (void) ge::AttrUtils::GetInt(it.second, ATTR_MODEL_VAR_SIZE, value); @@ -1634,7 +1608,7 @@ Status HybridModelBuilder::TransAllVarData() { } Status HybridModelBuilder::CopyVarData() { - GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(hybrid_model_.root_graph_, + GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(ge_root_model_->GetRootGraph(), runtime_param_.session_id, hybrid_model_.device_id_), "[Invoke][CopyVarData] failed."); @@ -1717,7 +1691,7 @@ Status HybridModelBuilder::LoadKnownShapedSubgraph(ComputeGraph &graph, NodeItem } Status HybridModelBuilder::RecoverGraphUnknownFlag() { - const auto &root_graph = hybrid_model_.root_graph_; + const auto &root_graph = ge_root_model_->GetRootGraph(); for (auto &sub_graph : root_graph->GetAllSubgraphs()) { GE_CHECK_NOTNULL(sub_graph); for (const auto &node : sub_graph->GetDirectNode()) { diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 3ab43b7f..92974441 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -56,7 +56,6 @@ class HybridModelBuilder { Status BuildOutputMapping(GraphItem &partitioned_call, const NodeItem &node_item, bool is_root_graph); Status ValidateParams(); Status LoadGraph(); - Status CopyGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); Status LoadTasks(); diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index b6e3d081..9e8e116e 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -60,10 +60,6 @@ class GeRootModel { bool GetTrainFlag() const { return train_flag_; } - int32_t GetBuildTimes() const { return hybrid_build_times_; } - - void IncreaseBuildTimes() { hybrid_build_times_++; } - private: ComputeGraphPtr root_graph_ = nullptr; std::map subgraph_instance_name_to_model_; @@ -73,7 +69,6 @@ class GeRootModel { bool train_flag_ = false; std::string model_name_; bool is_specific_stream_ = false; - int32_t hybrid_build_times_ = 0; }; } // namespace ge using GeRootModelPtr = std::shared_ptr; diff --git a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc index 827705ae..2dc3b639 100644 --- a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc @@ -249,9 +249,6 @@ TEST_F(UtestSubgraphExecutor, cond_graph_schedule_tasks) { graph_context.callback_manager = std::unique_ptr(new CallbackManager()); ASSERT_EQ(graph_context.callback_manager->Init(), SUCCESS); - auto root_graph = hybrid_model.root_graph_; - switch_t = root_graph->FindNode("switch_t"); - switch_f = root_graph->FindNode("switch_f"); const auto node_it_t = hybrid_model.node_items_.find(switch_t); const auto node_it_f = hybrid_model.node_items_.find(switch_f); ASSERT_NE(hybrid_model.node_items_.end(), node_it_t); diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 95669b73..2ab82350 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -214,17 +214,11 @@ TEST_F(UtestHybridModelBuilder, normal_hybrid_model_build) { ASSERT_EQ(it->second->frame_index_, index); ASSERT_EQ(it->second->parent_frame_, -1); }; - auto root_graph = hybrid_model.root_graph_; - auto enter1_node = root_graph->FindNode("enter"); - auto active1_node = root_graph->FindNode("active1"); - auto active2_node = root_graph->FindNode("active2"); - auto active3_node = root_graph->FindNode("active3"); - auto output1_node = root_graph->FindNode("net_output"); - TestFrameGroup(enter1_node, control_group_index); - TestFrameGroup(active1_node, control_group_index); - TestFrameGroup(active2_node, control_group_index); - TestFrameGroup(active3_node, control_group_index); - TestFrameGroup(output1_node, -1); + TestFrameGroup(enter1, control_group_index); + TestFrameGroup(active1, control_group_index); + TestFrameGroup(active2, control_group_index); + TestFrameGroup(active3, control_group_index); + TestFrameGroup(output1, -1); engine_mapping.clear(); task_executor.clear(); @@ -352,14 +346,4 @@ EXPECT_EQ(hybrid_model_builder.InitVariableTensors(), SUCCESS); EXPECT_EQ(hybrid_model_builder.hybrid_model_.variable_tensors_.size(), 1); HostMemManager::Instance().var_memory_base_map_.clear(); } - -TEST_F(UtestHybridModelBuilder, copy_graph_success) { -ComputeGraphPtr graph = std::make_shared("test"); -GeRootModelPtr ge_root_model = make_shared(graph); -HybridModel hybrid_model(ge_root_model); -HybridModelBuilder hybrid_model_builder(hybrid_model); - -Status st = hybrid_model_builder.CopyGraph(); -EXPECT_EQ(st, SUCCESS); -} } // namespace ge From ad3e70748e8cfebdc8fa141af8d8cfd6a8cbd1aa Mon Sep 17 00:00:00 2001 From: chuxing Date: Sat, 19 Jun 2021 16:41:25 +0800 Subject: [PATCH 070/226] Init hccl node executor on-demand --- ge/hybrid/model/hybrid_model_builder.cc | 22 +++++ ge/hybrid/model/hybrid_model_builder.h | 1 + ge/hybrid/node_executor/node_executor.cc | 80 ++++++++-------- ge/hybrid/node_executor/node_executor.h | 9 +- tests/ut/ge/CMakeLists.txt | 2 + .../hybrid/model/hybrid_model_builder_unittest.cc | 27 ++++++ .../hybrid/node_executor/node_executor_unittest.cc | 103 +++++++++++++++++++++ 7 files changed, 200 insertions(+), 44 deletions(-) create mode 100644 tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index d3f00253..bb405605 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -1227,6 +1227,28 @@ Status HybridModelBuilder::LoadGeModel(ComputeGraph &sub_graph, const GeModelPtr hybrid_model_.known_shape_sub_models_.emplace(parent_node, ge_model); } + GE_CHK_STATUS_RET_NOLOG(InitHcclExecutorOnDemand(ge_model)); + return SUCCESS; +} + +Status HybridModelBuilder::InitHcclExecutorOnDemand(const GeModelPtr &ge_model) { + if (NodeExecutorManager::GetInstance().IsExecutorInitialized(NodeExecutorManager::ExecutorType::HCCL)) { + return SUCCESS; + } + + // HCCL tasks in known-shaped subgraph which resides in a dynamic root graph + // still depends on the initialization of the HcclExecutor + auto tasks = ge_model->GetModelTaskDefPtr()->task(); + for (int i = 0; i < tasks.size(); ++i) { + const domi::TaskDef &task_def = tasks[i]; + auto task_type = static_cast(task_def.type()); + if (task_type == RT_MODEL_TASK_HCCL) { + const NodeExecutor *unused = nullptr; + GE_CHK_STATUS_RET_NOLOG(NodeExecutorManager::GetInstance() + .GetOrCreateExecutor(NodeExecutorManager::ExecutorType::HCCL, &unused)); + return SUCCESS; + } + } return SUCCESS; } diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 92974441..9c1eb187 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -57,6 +57,7 @@ class HybridModelBuilder { Status ValidateParams(); Status LoadGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); + static Status InitHcclExecutorOnDemand(const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); Status LoadTasks(); Status IdentifyVariableOutputs(NodeItem &node_item, const ComputeGraphPtr &subgraph); diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index 5f3d6e45..9e9354d9 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -58,8 +58,8 @@ Status NodeExecutor::CompileTask(const HybridModel &model, const NodePtr &node, } Status NodeExecutorManager::EnsureInitialized() { - GE_CHK_STATUS_RET(InitializeExecutors()); std::lock_guard lk(mu_); + ++ref_count_; if (initialized_) { return SUCCESS; } @@ -115,17 +115,14 @@ NodeExecutorManager::ExecutorType NodeExecutorManager::ResolveExecutorType(Node return it->second; } -Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) const { +Status NodeExecutorManager::GetExecutor(Node &node, const NodeExecutor **executor) { auto executor_type = ResolveExecutorType(node); + GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); const auto it = executors_.find(executor_type); if (it == executors_.end()) { - REPORT_INNER_ERROR("E19999", "Failed to get executor by type: %d.", static_cast(executor_type)); - GELOGE(INTERNAL_ERROR, "[Check][ExecutorType]Failed to get executor by type: %d.", - static_cast(executor_type)); - return INTERNAL_ERROR; + return GetOrCreateExecutor(executor_type, executor); } - GELOGD("[%s] Set node executor by type: %d.", node.GetName().c_str(), static_cast(executor_type)); *executor = it->second.get(); return SUCCESS; } @@ -178,51 +175,55 @@ Status NodeExecutorManager::CalcOpRunningParam(Node &node) const { return OpsKernelBuilderManager::Instance().CalcOpRunningParam(node); } -Status NodeExecutorManager::InitializeExecutors() { +bool NodeExecutorManager::IsExecutorInitialized(NodeExecutorManager::ExecutorType executor_type) { + std::lock_guard lk(mu_); + return executors_.find(executor_type) != executors_.end(); +} + +Status NodeExecutorManager::GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **out_executor) { std::lock_guard lk(mu_); - if (executor_initialized_) { - ++ref_count_; - GELOGI("Executor is already initialized. add ref count to [%d]", ref_count_); + const auto executor_it = executors_.find(executor_type); + if (executor_it != executors_.end()) { + *out_executor = executor_it->second.get(); return SUCCESS; } - GELOGI("Start to Initialize NodeExecutors"); - for (auto &it : builders_) { - auto engine_type = it.first; - auto build_fn = it.second; - GE_CHECK_NOTNULL(build_fn); - auto executor = std::unique_ptr(build_fn()); - if (executor == nullptr) { - REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for engine type = %d", - static_cast(engine_type)); - GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(engine_type)); - return INTERNAL_ERROR; - } + GELOGI("Start to Initialize NodeExecutor, type = %d", static_cast(executor_type)); + auto it = builders_.find(executor_type); + if (it == builders_.end()) { + REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", + static_cast(executor_type)); + GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for executor type = %d", static_cast(executor_type)); + return INTERNAL_ERROR; + } - GELOGD("Executor of engine type = %d was created successfully", static_cast(engine_type)); - auto ret = executor->Initialize(); - if (ret != SUCCESS) { - REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(engine_type)); - GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(engine_type)); - for (auto &executor_it : executors_) { - executor_it.second->Finalize(); - } - executors_.clear(); - return ret; - } + auto build_fn = it->second; + GE_CHECK_NOTNULL(build_fn); + auto executor = std::unique_ptr(build_fn()); + if (executor == nullptr) { + REPORT_CALL_ERROR("E19999", "Create NodeExecutor failed for executor type = %d", + static_cast(executor_type)); + GELOGE(INTERNAL_ERROR, "[Create][NodeExecutor] failed for engine type = %d", static_cast(executor_type)); + return INTERNAL_ERROR; + } - executors_.emplace(engine_type, std::move(executor)); + GELOGD("Executor of engine type = %d was created successfully", static_cast(executor_type)); + auto ret = executor->Initialize(); + if (ret != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Initialize NodeExecutor failed for type = %d", static_cast(executor_type)); + GELOGE(ret, "[Initialize][NodeExecutor] failed for type = %d", static_cast(executor_type)); + return ret; } - ++ref_count_; - executor_initialized_ = true; - GELOGI("Initializing NodeExecutors successfully."); + *out_executor = executor.get(); + executors_.emplace(executor_type, std::move(executor)); + GELOGI("Initializing NodeExecutor successfully, type = %d", static_cast(executor_type)); return SUCCESS; } void NodeExecutorManager::FinalizeExecutors() { std::lock_guard lk(mu_); - if (!executor_initialized_) { + if (ref_count_ <= 0) { GELOGD("No need for finalizing for not initialized."); return; } @@ -237,7 +238,6 @@ void NodeExecutorManager::FinalizeExecutors() { it.second->Finalize(); } executors_.clear(); - executor_initialized_ = false; GELOGD("Done invoking Finalize successfully."); } diff --git a/ge/hybrid/node_executor/node_executor.h b/ge/hybrid/node_executor/node_executor.h index ad4a9296..0e4a8464 100644 --- a/ge/hybrid/node_executor/node_executor.h +++ b/ge/hybrid/node_executor/node_executor.h @@ -179,8 +179,6 @@ class NodeExecutorManager { */ Status EnsureInitialized(); - Status InitializeExecutors(); - void FinalizeExecutors(); /** @@ -196,7 +194,7 @@ class NodeExecutorManager { * @param executor executor * @return SUCCESS on success, error code otherwise */ - Status GetExecutor(Node &node, const NodeExecutor **executor) const; + Status GetExecutor(Node &node, const NodeExecutor **executor); /** * Resolve executor type by node @@ -205,13 +203,16 @@ class NodeExecutorManager { */ ExecutorType ResolveExecutorType(Node &node) const; + Status GetOrCreateExecutor(ExecutorType executor_type, const NodeExecutor **executor); + + bool IsExecutorInitialized(ExecutorType executor_type); + private: std::map> executors_; std::map> builders_; std::map engine_mapping_; std::mutex mu_; bool initialized_ = false; - bool executor_initialized_ = false; int ref_count_ = 0; }; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index f1ede616..06b3e0f2 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -840,6 +840,7 @@ set(HYBRID_TEST_FILES "hybrid/executor/subgraph_executor_unittest.cc" "hybrid/executor/worker/execution_engine_unittest.cc" "hybrid/model/hybrid_model_builder_unittest.cc" + "hybrid/node_executor/node_executor_unittest.cc" "hybrid/node_executor/rts/rts_node_task_unittest.cc" "hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc" "hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc" @@ -847,6 +848,7 @@ set(HYBRID_TEST_FILES "hybrid/executor/hybrid_model_async_executor_unittest.cc" "hybrid/executor/hybrid_model_pipeline_executor_unittest.cc" "hybrid/node_executor/aicore/aicore_task_compiler_unittest.cc" + ) set(OTHERS_TEST_FILES diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 2ab82350..5567aca2 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -346,4 +346,31 @@ EXPECT_EQ(hybrid_model_builder.InitVariableTensors(), SUCCESS); EXPECT_EQ(hybrid_model_builder.hybrid_model_.variable_tensors_.size(), 1); HostMemManager::Instance().var_memory_base_map_.clear(); } + +TEST_F(UtestHybridModelBuilder, TestInitHcclExecutorOnDemand) { + NodeExecutorManager::GetInstance().builders_.erase(NodeExecutorManager::ExecutorType::HCCL); + // build aicore task + domi::ModelTaskDef model_task_def; + std::shared_ptr model_task_def_ptr = make_shared(model_task_def); + GeModelPtr ge_model = make_shared(); + ge_model->SetModelTaskDef(model_task_def_ptr); + + // No hccl task + domi::TaskDef *task_def = model_task_def_ptr->add_task(); + task_def->set_type(RT_MODEL_TASK_MEMCPY_ASYNC); + ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); + + // get executor failed due to no builder + task_def = model_task_def_ptr->add_task(); + task_def->set_type(RT_MODEL_TASK_HCCL); + ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), INTERNAL_ERROR); + + // get executor success + REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::HCCL, NodeExecutor); + ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); + + // repeat get, do not access builder + NodeExecutorManager::GetInstance().builders_.erase(NodeExecutorManager::ExecutorType::HCCL); + ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); +} } // namespace ge diff --git a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc new file mode 100644 index 00000000..8a1240d3 --- /dev/null +++ b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc @@ -0,0 +1,103 @@ +/** + * 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 + +#define private public +#define protected public +#include "hybrid/node_executor/node_executor.h" +#undef protected +#undef private + +using namespace std; +using namespace testing; + +namespace ge { +using namespace hybrid; + +namespace { + bool finalized = false; +} + +class NodeExecutorTest : public testing::Test { + protected: + void SetUp() {} + void TearDown() { } +}; + +class FailureNodeExecutor : public NodeExecutor { + public: + Status Initialize() override { + return INTERNAL_ERROR; + } +}; + +class SuccessNodeExecutor : public NodeExecutor { + public: + Status Initialize() override { + initialized = true; + finalized = false; + return SUCCESS; + } + + Status Finalize() override { + finalized = true; + } + + bool initialized = false; +}; + +REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICORE, FailureNodeExecutor); +REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICPU_TF, SuccessNodeExecutor); + +TEST_F(NodeExecutorTest, TestGetOrCreateExecutor) { + auto &manager = NodeExecutorManager::GetInstance(); + const NodeExecutor *executor = nullptr; + Status ret = SUCCESS; + // no builder + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::RESERVED, &executor); + ASSERT_EQ(ret, INTERNAL_ERROR); + // initialize failure + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICORE, &executor); + ASSERT_EQ(ret, INTERNAL_ERROR); + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); +} + +TEST_F(NodeExecutorTest, TestInitAndFinalize) { + auto &manager = NodeExecutorManager::GetInstance(); + manager.FinalizeExecutors(); + manager.EnsureInitialized(); + manager.EnsureInitialized(); + const NodeExecutor *executor = nullptr; + auto ret = manager.GetOrCreateExecutor(NodeExecutorManager::ExecutorType::AICPU_TF, &executor); + ASSERT_EQ(ret, SUCCESS); + ASSERT_TRUE(executor != nullptr); + ASSERT_TRUE(((SuccessNodeExecutor*)executor)->initialized); + manager.FinalizeExecutors(); + ASSERT_FALSE(manager.executors_.empty()); + manager.FinalizeExecutors(); + ASSERT_TRUE(manager.executors_.empty()); + ASSERT_TRUE(finalized); +} +} // namespace ge From f0942201572d6430d1d6ca4b808fe72f65577210 Mon Sep 17 00:00:00 2001 From: lianghao Date: Mon, 21 Jun 2021 21:51:33 +0800 Subject: [PATCH 071/226] train_graph_flag --- ge/graph/manager/graph_manager.cc | 23 +++++++++++----------- ge/graph/manager/graph_manager.h | 2 +- ge/graph/passes/global_step_insert_pass.cc | 11 ----------- ge/ir_build/ge_ir_build.cc | 1 + .../build/buffer_pool_mem_assigner_unittest.cc | 5 +++++ .../passes/global_step_insert_pass_unittest.cc | 7 +------ 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index f36c1c0d..01a2e502 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -122,6 +122,7 @@ const char *const kVectorEngine = "VectorEngine"; const char *const kAIcoreEngine = "AIcoreEngine"; const int32_t kDynamicDimsTypeIsGetNext = 0; const int32_t kDynamicDimsTypeIsData = 1; +const int32_t kBase = 10; const char *const kGetNextName = "IteratorV2"; const uint32_t kInitGraphCount = 1; const uint32_t kNotAdded = 0; @@ -1788,7 +1789,7 @@ Status GraphManager::ParseOptions(const std::map &opti return GE_GRAPH_OPTIONS_INVALID); // ge.graphType - ret = ParseTrainGraphFlag(options_.run_graph_flag, options_.train_graph_flag); + ret = ParseTrainGraphFlag(options_.train_graph_flag); GE_IF_BOOL_EXEC(ret != SUCCESS, GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Parse][TrainGraphFlag] Key:ge.runFlag value is invalid"); return GE_GRAPH_OPTIONS_INVALID); @@ -1833,19 +1834,17 @@ Status GraphManager::ParseOptions(const std::map &opti return SUCCESS; } -Status GraphManager::ParseTrainGraphFlag(const bool &run_flag, bool &train_flag) { - std::shared_ptr ge_instance_ptr = ge::GELib::GetInstance(); - if (ge_instance_ptr == nullptr) { - GELOGW("[Initialize] set train_graph_flag to 0 when GE is not initialized or finalized"); - train_flag = false; - } else if (!ge_instance_ptr->isTrainMode()) { - train_flag = false; - } else { // ge_instance_ptr->isTrainMode() is true - train_flag = true; - if (!run_flag) { - GELOGW("Key:ge.runFlag, its value %d is invalid, it must be 1 when GElib::is_train_mode_ flag is 1", run_flag); +// OPTION_GRAPH_RUN_MODE is supposed to be a session-level option, but it used to be set to global-level in the past. +// If can not parse from session, it can parse from global by GetContext(). +Status GraphManager::ParseTrainGraphFlag(bool &train_flag) { + train_flag = false; + string run_mode; + if (GetContext().GetOption(ge::OPTION_GRAPH_RUN_MODE, run_mode) == SUCCESS && !run_mode.empty()) { + if (GraphRunMode(std::strtol(run_mode.c_str(), nullptr, kBase)) >= TRAIN) { + train_flag = true; } } + GELOGI("Is train flag: %d.", train_flag); return SUCCESS; } diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 93ce354a..3475da6d 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -292,7 +292,7 @@ class GraphManager { static Status ParseParallelNum(const std::string ¶llel_num, const std::string &key, int &num); - static Status ParseTrainGraphFlag(const bool &run_flag, bool &train_flag); + static Status ParseTrainGraphFlag(bool &train_flag); static bool IsPerfLevelInvalid(int32_t perf_level); diff --git a/ge/graph/passes/global_step_insert_pass.cc b/ge/graph/passes/global_step_insert_pass.cc index f27641fc..297e4ee2 100755 --- a/ge/graph/passes/global_step_insert_pass.cc +++ b/ge/graph/passes/global_step_insert_pass.cc @@ -28,10 +28,6 @@ #include "graph/passes/pass_utils.h" #include "graph/ge_context.h" -namespace { -const char *const kFlagOff = "0"; -} // namespace - namespace ge { NodePtr GlobalStepInsertPass::InsertOp(ComputeGraphPtr &compute_graph, const string &node_type, @@ -80,13 +76,6 @@ NodePtr GlobalStepInsertPass::InsertOp(ComputeGraphPtr &compute_graph, } Status GlobalStepInsertPass::Run(ComputeGraphPtr compute_graph) { - // run_flag off means offline, no need insert global step node which type is variable - std::string run_flag; - if (ge::GetContext().GetOption(ge::RUN_FLAG, run_flag) == GRAPH_SUCCESS && run_flag == kFlagOff) { - GELOGI("compute_graph [%u] [%s] skip insert global step", compute_graph->GetGraphID(), - compute_graph->GetName().c_str()); - return SUCCESS; - } NodePtr output_node = compute_graph->FindFirstNodeMatchType(NETOUTPUT); if (output_node == nullptr) { GELOGD("Node type %s can't be found in graph %u", NETOUTPUT, compute_graph->GetGraphID()); diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index ea521f5b..a7671a74 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -574,6 +574,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map(string(ge::RUN_FLAG), to_string(0))); options_.insert(std::pair(string(ge::TRAIN_FLAG), to_string(0))); options_.insert(std::pair(string(ge::SAVE_ORIGINAL_MODEL), to_string(0))); + options_.insert(std::pair(string(ge::OPTION_GRAPH_RUN_MODE), to_string(0))); // print ge option map ge::PrintOptionMap(options_, "ge option"); diff --git a/tests/ut/ge/graph/build/buffer_pool_mem_assigner_unittest.cc b/tests/ut/ge/graph/build/buffer_pool_mem_assigner_unittest.cc index 96283250..05141785 100644 --- a/tests/ut/ge/graph/build/buffer_pool_mem_assigner_unittest.cc +++ b/tests/ut/ge/graph/build/buffer_pool_mem_assigner_unittest.cc @@ -29,6 +29,7 @@ #include "graph/build/memory/buffer_pool_mem_assigner.h" #include "graph/build/memory/graph_mem_assigner.h" #include "graph/build/stream_allocator.h" +#include "graph/ge_local_context.h" #undef protected #undef private @@ -260,6 +261,10 @@ TEST_F(UtestBufferPoolMemAssignerTest, buffer_pool_serial_graph_assign_success) } TEST_F(UtestBufferPoolMemAssignerTest, buffer_pool_subgraph_with_inner_dependency_assign_success) { + std::string build_mode; + std::map options_map; + options_map.insert({ge::OPTION_GRAPH_RUN_MODE, "1"}); + ge::GetThreadLocalContext().SetGraphOption(options_map); ut::BufferPoolGraphBuilder builder("SubgraphWithInnerDependency"); ge::ComputeGraphPtr graph = builder.BuildSubgraphWithInnerDependency(); BufferPoolMemoryPass buffer_pool_mem_pass; diff --git a/tests/ut/ge/graph/passes/global_step_insert_pass_unittest.cc b/tests/ut/ge/graph/passes/global_step_insert_pass_unittest.cc index 9da2565d..cc9a4077 100644 --- a/tests/ut/ge/graph/passes/global_step_insert_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/global_step_insert_pass_unittest.cc @@ -34,7 +34,6 @@ #include "graph/tuning_utils.h" #include "graph_builder_utils.h" #include "graph/ge_context.h" -#include "graph/ge_local_context.h" #include "inc/pass_manager.h" #undef protected #undef private @@ -62,13 +61,9 @@ static ComputeGraphPtr BuildGraph1() { TEST_F(UtestGlobalStepInsertPass, skip_insert) { auto graph = BuildGraph1(); - std::string build_mode; - std::map options_map; - options_map.insert({ge::RUN_FLAG, "0"}); - ge::GetThreadLocalContext().SetGraphOption(options_map); GlobalStepInsertPass pass; Status status = pass.Run(graph); EXPECT_EQ(status, SUCCESS); NodePtr found_node = graph->FindNode(NODE_NAME_GLOBAL_STEP); - EXPECT_EQ(found_node, nullptr); + EXPECT_NE(found_node, nullptr); } From 17a37ca7507a9b6923e99771735069cd264aa7cf Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 23 Jun 2021 14:28:45 +0800 Subject: [PATCH 072/226] add atc_params: check_report for ConvertModelToJson --- ge/offline/main.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/ge/offline/main.cc b/ge/offline/main.cc index a78ff392..6caed1b7 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -847,6 +847,7 @@ domi::Status GenerateInfershapeJson() { ge::Graph graph; std::map atc_params; atc_params.insert(std::pair("input_format", FLAGS_input_format)); + atc_params.insert(std::pair("check_report", FLAGS_check_report)); ret = ParseGraph(graph, atc_params, FLAGS_om.c_str(), FLAGS_weight.c_str(), (domi::FrameworkType) FLAGS_framework, "", FLAGS_target.c_str(), (ge::RunMode) FLAGS_mode, false); if (ret != ge::SUCCESS) { From f595a577dd4f4e69e1d0a6d305bff17c4374bba5 Mon Sep 17 00:00:00 2001 From: lianghuikang <505519763@qq.com> Date: Wed, 23 Jun 2021 09:31:54 +0800 Subject: [PATCH 073/226] add op_precision_mode option and support op_debug_level = 4 --- ge/ir_build/ge_ir_build.cc | 69 +++++++++++++++++++-------- ge/offline/main.cc | 36 ++++++++++++-- ge/session/inner_session.cc | 12 +++++ inc/external/ge/ge_api_types.h | 5 ++ tests/ut/ge/graph_ir/ge_ir_build_unittest.cc | 37 ++++++++++++++ tests/ut/ge/session/ge_api_unittest.cc | 2 +- tests/ut/ge/session/inner_session_unittest.cc | 10 ++++ 7 files changed, 144 insertions(+), 27 deletions(-) diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index ea521f5b..052af2f6 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -263,6 +263,7 @@ class Impl { omg_context_.user_attr_index_valid = false; }; ~Impl() { (void)generator_.Finalize(); }; + graphStatus CheckBuildModeAndBuildStep(); graphStatus GetSupportedOptions(const std::map &in, std::map &out); graphStatus CheckOptions(const std::map &options); @@ -451,6 +452,37 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { return GRAPH_SUCCESS; } +graphStatus Impl::CheckBuildModeAndBuildStep() { + std::string build_mode; + auto it = options_.find(BUILD_MODE); + if (it != options_.end() && !(it->second.empty())) { + if (build_mode_options.find(it->second) == build_mode_options.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({BUILD_MODE, it->second, "value is unsupported. Please check!"})); + GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildMode]:%s is unsupported. Please check!", it->second.c_str()); + return GRAPH_PARAM_INVALID; + } + build_mode = it->second; + } + it = options_.find(BUILD_STEP); + if (it != options_.end() && !(it->second.empty())) { + if (build_step_options.find(it->second) == build_step_options.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({BUILD_STEP, it->second, "value is unsupported. Please check!"})); + GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildStep]:%s is unsupported. Please check!", it->second.c_str()); + return GRAPH_PARAM_INVALID; + } + } else { + if (build_mode == BUILD_MODE_TUNING) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({BUILD_MODE, it->second, "tuning must specify build step. Please check!"})); + GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildMode] tuning must specify build step. Please check!"); + return GRAPH_PARAM_INVALID; + } + } + return GRAPH_SUCCESS; +} + graphStatus Impl::GetSupportedOptions(const std::map &in, std::map &out) { for (auto &ele : in) { @@ -475,29 +507,12 @@ graphStatus Impl::CheckOptions(const std::map &options } // Check options build_mode and build_step. - std::string build_mode; - auto it = options_.find(BUILD_MODE); - if (it != options_.end() && !(it->second.empty())) { - if (build_mode_options.find(it->second) == build_mode_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildMode]:%s is unsupported. Please check!", it->second.c_str()); - return GRAPH_PARAM_INVALID; - } - build_mode = it->second; - } - it = options_.find(BUILD_STEP); - if (it != options_.end() && !(it->second.empty())) { - if (build_step_options.find(it->second) == build_step_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildStep]:%s is unsupported. Please check!", it->second.c_str()); - return GRAPH_PARAM_INVALID; - } - } else { - if (build_mode == BUILD_MODE_TUNING) { - GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildMode] tuning must specify build step. Please check!"); - return GRAPH_PARAM_INVALID; - } + ret = CheckBuildModeAndBuildStep(); + if (ret != GRAPH_SUCCESS) { + return ret; } // Check option EXEC_DISABLE_REUSED_MEMORY - it = options_.find(ge::ir_option::EXEC_DISABLE_REUSED_MEMORY); + auto it = options_.find(ge::ir_option::EXEC_DISABLE_REUSED_MEMORY); if (it != options_.end() && (CheckDisableReuseMemoryParamValid(it->second) != GRAPH_SUCCESS)) { return GRAPH_PARAM_INVALID; } @@ -505,6 +520,18 @@ graphStatus Impl::CheckOptions(const std::map &options if (ge::CheckModifyMixlistParamValid(options_) != GRAPH_SUCCESS) { return GRAPH_PARAM_INVALID; } + // Check option OP_PRECISION_MODE + it = options_.find(ge::ir_option::OP_PRECISION_MODE); + if (it != options_.end() && !it->second.empty() && !ge::CheckInputPathValid(it->second)) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ge::ir_option::OP_PRECISION_MODE, it->second, "path is not found"})); + GELOGE(GRAPH_PARAM_INVALID, "[Check][OP_PRECISION_MODE] %s not found", it->second.c_str()); + return GRAPH_PARAM_INVALID; + } + if (it != options_.end()) { + GELOGI("Option set successfully, option_key=%s, option_value=%s", + ge::ir_option::OP_PRECISION_MODE, it->second.c_str()); + } // Check Input Format if (options_.find(kInputFormat) != options_.end()) { return CheckInputFormat(options_[kInputFormat]); diff --git a/ge/offline/main.cc b/ge/offline/main.cc index a78ff392..54bded4b 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -106,10 +106,14 @@ DEFINE_string(out_nodes, "", "Optional; output nodes designated by users." "Format: \"node_name1:0;node_name1:1;node_name2:0\""); +DEFINE_string(op_precision_mode, "", "Optional; operator precision mode configuration file path"); + DEFINE_string(precision_mode, "force_fp16", "Optional; precision mode." "Support force_fp16, force_fp32, allow_mix_precision, allow_fp32_to_fp16, must_keep_origin_dtype."); +DEFINE_string(modify_mixlist, "", "Optional; operator mixed precision configuration file path"); + DEFINE_string(keep_dtype, "", "Optional; config file to specify the precision used by the operator during compilation."); @@ -192,8 +196,11 @@ DEFINE_string(log, "null", "Optional; generate atc log. Support debug, info, war DEFINE_string(dump_mode, "0", "Optional; generate infershape json,only support 1 , 0."); -DEFINE_int32(op_debug_level, 0, "Optional; configure debug level of compiler. 0(default): close debug;" - "1: open TBE compiler, export ccec file and TBE instruction mapping file; 2: open ccec compiler"); +DEFINE_int32(op_debug_level, 0, "Optional; configure debug level of compiler. 0(default): close debug; " + "1: open TBE compiler, export ccec file and TBE instruction mapping file; 2: open ccec compiler; " + "3: disable debug, and keep generating kernel file (.o and .json); 4: disable debug, " + "keep generation kernel file (.o and .json) and generate the operator CCE file (.cce) " + "and the UB fusion computing description file (.json)"); DEFINE_string(enable_scope_fusion_passes, "", "Optional; validate the non-general scope fusion pass," "multiple names can be set and separated by ','."); DEFINE_string(debug_dir, "", "Optional; the path to save the intermediate files of operator compilation"); @@ -210,8 +217,6 @@ DEFINE_string(display_model_info, "0", "Optional; display model info"); DEFINE_string(device_id, "0", "Optional; user device id"); -DEFINE_string(modify_mixlist, "", "Optional; operator mixed precision configuration file path"); - class GFlagUtils { public: /** @@ -298,8 +303,10 @@ class GFlagUtils { "\"l1_optimize\", \"off_optimize\"\n" " --mdl_bank_path Set the path of the custom repository generated after model tuning.\n" "\n[Operator Tuning]\n" + " --op_precision_mode Set the path of operator precision mode configuration file (.ini)\n" " --precision_mode precision mode, support force_fp16(default), force_fp32, allow_mix_precision, " "allow_fp32_to_fp16, must_keep_origin_dtype.\n" + " --modify_mixlist Set the path of operator mixed precision configuration file.\n" " --keep_dtype Retains the precision of certain operators in inference " "scenarios by using a configuration file.\n" " --auto_tune_mode Set tune mode. E.g.: \"GA,RL\", support configure multiple, spit by ,\n" @@ -315,7 +322,8 @@ class GFlagUtils { " 2: Enable TBE pipe_all, generate the operator CCE file and Python-CCE mapping file " "(.json), and enable the CCE compiler -O0-g.\n" " 3: Disable debug, and keep generating kernel file (.o and .json)\n" - " --modify_mixlist Set the path of operator mixed precision configuration file.\n" + " 4: Disable debug, keep generation kernel file (.o and .json) and generate the " + "operator CCE file (.cce) and the UB fusion computing description file (.json)" "\n[Debug]\n" " --save_original_model Control whether to output original model. E.g.: true: output original model\n" " --log Generate log with level. Support debug, info, warning, error, null\n" @@ -365,6 +373,14 @@ class GFlagUtils { FLAGS_op_select_implmode) != ge::SUCCESS, ret = ge::FAILED, "[Check][ImplMode]check optypelist_for_implmode and op_select_implmode failed!"); + if (!FLAGS_op_precision_mode.empty() && !ge::CheckInputPathValid(FLAGS_op_precision_mode, "--op_precision_mode")) { + ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, + {"op_precision_mode", FLAGS_op_precision_mode.c_str(), + "path is not found"}); + GELOGE(ge::FAILED, "[Check][op_precision_mode] %s not found", FLAGS_op_precision_mode.c_str()); + ret = ge::FAILED; + } + if (ge::CheckModifyMixlistParamValid(FLAGS_precision_mode, FLAGS_modify_mixlist) != ge::SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"modify_mixlist", FLAGS_modify_mixlist.c_str(), @@ -1049,6 +1065,7 @@ static void SetEnvForSingleOp(std::map &options) { options.emplace(ge::RUN_FLAG, flag_off); options.emplace(ge::OPTION_GRAPH_RUN_MODE, flag_off); options.emplace(ge::SINGLE_OP_FLAG, flag_on); + options.emplace(ge::OP_PRECISION_MODE, FLAGS_op_precision_mode); options.emplace(ge::PRECISION_MODE, FLAGS_precision_mode); options.emplace(ge::SOC_VERSION, FLAGS_soc_version); options.emplace(ge::CORE_TYPE, FLAGS_core_type); @@ -1076,6 +1093,14 @@ domi::Status GenerateSingleOp(const std::string& json_file_path) { ge::CheckImplmodeParamValid(FLAGS_optypelist_for_implmode, FLAGS_op_select_implmode) != ge::SUCCESS, return ge::FAILED, "[Check][ImplmodeParam] fail for input optypelist_for_implmode and op_select_implmode."); + if (!FLAGS_op_precision_mode.empty() && !ge::CheckInputPathValid(FLAGS_op_precision_mode, "--op_precision_mode")) { + ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, + {"op_precision_mode", FLAGS_op_precision_mode.c_str(), + "path is not found"}); + GELOGE(ge::FAILED, "[Check][op_precision_mode] %s not found", FLAGS_op_precision_mode.c_str()); + return ge::FAILED; + } + if (ge::CheckModifyMixlistParamValid(FLAGS_precision_mode, FLAGS_modify_mixlist) != ge::SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"modify_mixlist", FLAGS_modify_mixlist.c_str(), @@ -1159,6 +1184,7 @@ domi::Status GenerateOmModel() { options.insert(std::pair(string(ge::CALIBRATION_CONF_FILE), FLAGS_cal_conf)); 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::OP_PRECISION_MODE), FLAGS_op_precision_mode)); options.insert(std::pair(string(ge::PRECISION_MODE), FLAGS_precision_mode)); options.insert(std::pair(string(ge::TUNE_DEVICE_IDS), FLAGS_device_id)); diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index aabbe19c..54e62d32 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -82,6 +82,18 @@ Status InnerSession::Initialize() { return ret; } + //Check option OP_PRECISION_MODE + auto iter = all_options.find(ge::OP_PRECISION_MODE); + if (iter != all_options.end() && !iter->second.empty() && !ge::CheckInputPathValid(iter->second)) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ge::OP_PRECISION_MODE, iter->second, "path is not found"})); + GELOGE(PARAM_INVALID, "[Check][OP_PRECISION_MODE] %s not found", iter->second.c_str()); + return FAILED; + } + if (iter != all_options.end()) { + GELOGI("Option set successfully, option_key=%s, option_value=%s", + ge::OP_PRECISION_MODE.c_str(), iter->second.c_str()); + } // Check option modify_mixlist if (ge::CheckModifyMixlistParamValid(all_options) != ge::SUCCESS) { return FAILED; diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index fbd6c020..6f5bbfbf 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -113,6 +113,7 @@ const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; const char *const PERFORMANCE_MODE = "ge.performance_mode"; const char *const MODIFY_MIXLIST = "ge.exec.modify_mixlist"; +const char *const OP_PRECISION_MODE = "ge.exec.op_precision_mode"; } // namespace configure_option // Configure stream num by Session constructor options param, // its value should be int32_t type, default value is "1" @@ -326,6 +327,8 @@ const std::string PERFORMANCE_MODE = "ge.performance_mode"; const std::string MODIFY_MIXLIST = "ge.exec.modify_mixlist"; +const std::string OP_PRECISION_MODE = "ge.exec.op_precision_mode"; + // Graph run mode enum GraphRunMode { PREDICTION = 0, TRAIN }; @@ -405,6 +408,7 @@ static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); static const char *const PERFORMANCE_MODE = ge::PERFORMANCE_MODE.c_str(); static const char *const MODIFY_MIXLIST = ge::MODIFY_MIXLIST.c_str(); +static const char *const OP_PRECISION_MODE = ge::OP_PRECISION_MODE.c_str(); // for interface: aclgrphBuildModel #ifdef __GNUC__ @@ -416,6 +420,7 @@ const std::set ir_builder_suppported_options = {INPUT_FORMAT, DYNAMIC_IMAGE_SIZE, DYNAMIC_DIMS, INSERT_OP_FILE, + OP_PRECISION_MODE, PRECISION_MODE, TUNE_DEVICE_IDS, EXEC_DISABLE_REUSED_MEMORY, 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 197c9300..60f33ed3 100644 --- a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc +++ b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc @@ -391,6 +391,43 @@ TEST(UtestIrBuild, check_modify_mixlist_param) { EXPECT_EQ(ret, GRAPH_PARAM_INVALID); } +TEST(UtestIrBuild, check_op_precision_mode_param) { + Graph graph = BuildIrGraph1(); + const std::map build_options = { + {"ge.exec.op_precision_mode", "./op_precision_mode.ini"} + }; + ModelBufferData model; + + auto ret = aclgrphBuildModel(graph, build_options, model); + EXPECT_EQ(ret, GRAPH_PARAM_INVALID); +} + +TEST(UtestIrBuild, check_build_model_and_build_step) { + Graph graph_1 = BuildIrGraph1(); + const std::map build_options_1 = { + {"ge.buildMode", "xxx"} + }; + ModelBufferData model_1; + auto ret_1 = aclgrphBuildModel(graph_1, build_options_1, model_1); + EXPECT_NE(ret_1, GRAPH_SUCCESS); + + Graph graph_2 = BuildIrGraph1(); + const std::map build_options_2 = { + {"ge.buildStep", "xxx"} + }; + ModelBufferData model_2; + auto ret_2 = aclgrphBuildModel(graph_2, build_options_2, model_2); + EXPECT_NE(ret_2, GRAPH_SUCCESS); + + Graph graph_3 = BuildIrGraph1(); + const std::map build_options_3 = { + {"ge.buildMode", "tuning"} + }; + ModelBufferData model_3; + auto ret_3 = aclgrphBuildModel(graph_3, build_options_3, model_3); + EXPECT_NE(ret_3, GRAPH_SUCCESS); +} + TEST(UtestIrBuild, atc_cfg_optype_param) { ComputeGraphPtr graph = BuildComputeGraph1(); FILE *fp = fopen("./keep.txt", "w+"); diff --git a/tests/ut/ge/session/ge_api_unittest.cc b/tests/ut/ge/session/ge_api_unittest.cc index 2cabc4a3..9a7058f3 100644 --- a/tests/ut/ge/session/ge_api_unittest.cc +++ b/tests/ut/ge/session/ge_api_unittest.cc @@ -64,7 +64,7 @@ TEST_F(UtestGeApi, build_graph_success) { ASSERT_NE(ret, SUCCESS); } -TEST_F(UtestGeApi, ge_initialize) { +TEST_F(UtestGeApi, ge_initialize_modify_mixlist) { std::map options = { {ge::MODIFY_MIXLIST, "/mixlist.json"} }; diff --git a/tests/ut/ge/session/inner_session_unittest.cc b/tests/ut/ge/session/inner_session_unittest.cc index ecad56d6..0d20f06a 100644 --- a/tests/ut/ge/session/inner_session_unittest.cc +++ b/tests/ut/ge/session/inner_session_unittest.cc @@ -53,4 +53,14 @@ TEST_F(Utest_Inner_session, initialize) { auto ret = inner_session.Initialize(); EXPECT_NE(ret, ge::SUCCESS); } + +TEST_F(Utest_Inner_session, check_op_precision_mode) { + std::map options = { + {ge::OP_PRECISION_MODE, "./op_precision_mode.ini"} + }; + uint64_t session_id = 1; + InnerSession inner_session(session_id, options); + auto ret = inner_session.Initialize(); + EXPECT_NE(ret, ge::SUCCESS); +} } // namespace ge From 48be801e80aaac9e2b06d1c209fb92adb07064b4 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 23 Jun 2021 16:49:10 +0800 Subject: [PATCH 074/226] Fix mem leak and recursive depth protection --- ge/common/ge/tbe_plugin_manager.cc | 14 ++++++++ ge/session/omg.cc | 13 ++++++++ ge/single_op/single_op_model.cc | 8 ++--- ge/single_op/single_op_model.h | 2 +- ge/single_op/task/aicpu_task_builder.cc | 8 ++--- ge/single_op/task/aicpu_task_builder.h | 4 +-- ge/single_op/task/op_task.cc | 4 +-- ge/single_op/task/op_task.h | 1 - tests/ut/ge/CMakeLists.txt | 1 + tests/ut/ge/common/tbe_plugin_manager_unittest.cc | 40 +++++++++++++++++++++++ tests/ut/ge/session/omg_omg_unittest.cc | 9 +++++ tests/ut/ge/single_op/single_op_model_unittest.cc | 24 ++++++++++++++ 12 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 tests/ut/ge/common/tbe_plugin_manager_unittest.cc diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index 94ba8a9a..c876e300 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -105,17 +105,29 @@ void TBEPluginManager::ProcessSoFullName(vector &file_list, string &caff } void TBEPluginManager::FindParserSo(const string &path, vector &file_list, string &caffe_parser_path) { + static uint32_t temp_depth = 0; + static const uint32_t max_recursive_depth = 20; // For recursive depth protection + + temp_depth++; + if (temp_depth >= max_recursive_depth) { + GELOGW("Recursive depth is become %u, Please check input!", temp_depth); + temp_depth--; + return; + } + // Path, change to absolute path string real_path = RealPath(path.c_str()); // Plugin path does not exist if (real_path.empty()) { GELOGW("RealPath is empty."); + temp_depth--; return; } INT32 is_dir = mmIsDir(real_path.c_str()); // Lib plugin path not exist if (is_dir != EN_OK) { GELOGW("%s is not a dir. errmsg:%s", real_path.c_str(), strerror(errno)); + temp_depth--; return; } @@ -123,6 +135,7 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis auto ret = mmScandir(real_path.c_str(), &entries, nullptr, nullptr); if (ret < EN_OK) { GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", real_path.c_str(), ret, strerror(errno)); + temp_depth--; return; } for (int i = 0; i < ret; ++i) { @@ -142,6 +155,7 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis } } mmScandirFree(entries, ret); + temp_depth--; } void TBEPluginManager::GetPluginSoFileList(const string &path, vector &file_list, string &caffe_parser_path) { diff --git a/ge/session/omg.cc b/ge/session/omg.cc index f7f3def7..8d826043 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -221,14 +221,25 @@ static Status ParseOutputFp16NodesFormat(const string &is_output_fp16) { } void FindParserSo(const string &path, vector &file_list, string &caffe_parser_path) { + static uint32_t temp_depth = 0; + static const uint32_t max_recursive_depth = 20; // For recursive depth protection + + temp_depth++; + if (temp_depth >= max_recursive_depth) { + GELOGW("Recursive depth is become %u, Please check input!", temp_depth); + temp_depth--; + return; + } // path, Change to absolute path string real_path = RealPath(path.c_str()); if (real_path.empty()) { // plugin path does not exist + temp_depth--; return; } struct stat stat_buf; if ((stat(real_path.c_str(), &stat_buf) != 0) || (!S_ISDIR(stat_buf.st_mode))) { GELOGI("The path %s is not a directory.", real_path.c_str()); + temp_depth--; return; } @@ -237,6 +248,7 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p if (nullptr == dir) { // plugin path does not exist GELOGW("Open directory %s failed.", path.c_str()); + temp_depth--; return; } @@ -260,6 +272,7 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p FindParserSo(full_name, file_list, caffe_parser_path); } closedir(dir); + temp_depth--; return; } diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index eefa5165..1d00127a 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -380,7 +380,7 @@ Status SingleOpModel::BuildTaskList(StreamResource *stream_resource, SingleOp &s uint64_t singleop_kernel_id = aicpu_kernel_id++; GELOGI("Build singleOp TfTask, kernel_id = %lu", singleop_kernel_id); GE_CHK_STATUS_RET_NOLOG( - BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, false, depend_compute_flag, singleop_kernel_id)); + BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, depend_compute_flag, singleop_kernel_id)); aicpu_task->SetModelArgs(model_name_, model_id_); ParseArgTable(aicpu_task, single_op); single_op.tasks_.emplace_back(aicpu_task); @@ -458,7 +458,7 @@ Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask * } Status SingleOpModel::BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, - bool dynamic_flag, bool& depend_compute_flag, uint64_t kernel_id) { + bool& depend_compute_flag, uint64_t kernel_id) { auto iter = op_list_.find(kernel_def.op_index()); if (iter == op_list_.end()) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, @@ -476,7 +476,7 @@ Status SingleOpModel::BuildKernelExTask(const domi::KernelExDef &kernel_def, AiC return ACL_ERROR_GE_MEMORY_ALLOCATION; } auto builder = AiCpuTaskBuilder(iter->second->GetOpDesc(), kernel_def); - auto ret = builder.BuildTask(*aicpu_task, model_params_, dynamic_flag, kernel_id); + auto ret = builder.BuildTask(*aicpu_task, model_params_, kernel_id); if (ret != SUCCESS) { GELOGE(ret, "[Build][Task] failed, kernel_id:%lu.", kernel_id); return ret; @@ -631,7 +631,7 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, bool depend_compute_flag = false; uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); - GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, true, + GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, depend_compute_flag, dynamic_singleop_kernel_id)); if (depend_compute_flag) { if (i >= tasks.size() - 1) { diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index bf3ad050..747d99e9 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -70,7 +70,7 @@ class SingleOpModel { Status BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &dynamic_single_op); Status BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task); Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, - bool dynamic_flag, bool& depend_compute_flag, uint64_t kernel_id); + bool& depend_compute_flag, uint64_t kernel_id); Status BuildCpuKernelTask(const domi::KernelDef &kernel_def, OpTask **task, uint64_t kernel_id); Status BuildModelTaskKernel(StreamResource *stream_resource, const domi::TaskDef &task_def, DynamicSingleOp &single_op); diff --git a/ge/single_op/task/aicpu_task_builder.cc b/ge/single_op/task/aicpu_task_builder.cc index 805b1306..1b945280 100755 --- a/ge/single_op/task/aicpu_task_builder.cc +++ b/ge/single_op/task/aicpu_task_builder.cc @@ -63,7 +63,7 @@ namespace ge { return SUCCESS; } - Status AiCpuTaskBuilder::InitWorkspaceAndIO(AiCpuTask &task, const SingleOpModelParam ¶m, bool dynamic_flag) { + Status AiCpuTaskBuilder::InitWorkspaceAndIO(AiCpuTask &task, const SingleOpModelParam ¶m) { if (kernel_def_.args_size() > sizeof(STR_FWK_OP_KERNEL)) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size]sizeof STR_FWK_OP_KERNEL is: %lu, but args_size is: %d", sizeof(STR_FWK_OP_KERNEL), kernel_def_.args_size()); @@ -83,9 +83,8 @@ namespace ge { return SUCCESS; } - Status AiCpuTaskBuilder::BuildTask(ge::AiCpuTask &task, const SingleOpModelParam ¶m, - bool dynamic_flag, uint64_t kernel_id) { - GE_CHK_STATUS_RET_NOLOG(InitWorkspaceAndIO(task, param, dynamic_flag)); + Status AiCpuTaskBuilder::BuildTask(ge::AiCpuTask &task, const SingleOpModelParam ¶m, uint64_t kernel_id) { + GE_CHK_STATUS_RET_NOLOG(InitWorkspaceAndIO(task, param)); STR_FWK_OP_KERNEL fwk_op_kernel = {0}; auto ret = SetFmkOpKernel(task.io_addr_, task.workspace_addr_, fwk_op_kernel); @@ -124,7 +123,6 @@ namespace ge { task.arg_size_ = sizeof(STR_FWK_OP_KERNEL); task.op_type_ = op_desc_->GetName(); task.task_info_ = kernel_def_.task_info(); - task.dynamic_flag_ = dynamic_flag; task.kernel_id_ = kernel_id; auto debug_info = BuildTaskUtils::GetTaskInfo(op_desc_); diff --git a/ge/single_op/task/aicpu_task_builder.h b/ge/single_op/task/aicpu_task_builder.h index fe9c9bc2..eca91254 100755 --- a/ge/single_op/task/aicpu_task_builder.h +++ b/ge/single_op/task/aicpu_task_builder.h @@ -29,12 +29,12 @@ namespace ge { AiCpuTaskBuilder(const OpDescPtr &op_desc, const domi::KernelExDef &kernel_def); ~AiCpuTaskBuilder() = default; - Status BuildTask(AiCpuTask &task, const SingleOpModelParam ¶m, bool dynamic_flag, uint64_t kernel_id); + Status BuildTask(AiCpuTask &task, const SingleOpModelParam ¶m, uint64_t kernel_id); private: static Status SetKernelArgs(void **args, STR_FWK_OP_KERNEL &kernel); Status SetFmkOpKernel(void *io_addr, void *ws_addr, STR_FWK_OP_KERNEL &kernel); - Status InitWorkspaceAndIO(AiCpuTask &task, const SingleOpModelParam ¶m, bool dynamic_flag); + Status InitWorkspaceAndIO(AiCpuTask &task, const SingleOpModelParam ¶m); const OpDescPtr op_desc_; const domi::KernelExDef &kernel_def_; diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index db2fdfeb..b6a78f9e 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -621,9 +621,7 @@ Status AiCpuBaseTask::UpdateIoAddr(const vector &inputs, const vecto AiCpuTask::~AiCpuTask() { FreeHbm(args_); FreeHbm(io_addr_); - if (dynamic_flag_) { - FreeHbm(workspace_addr_); - } + FreeHbm(workspace_addr_); FreeHbm(copy_workspace_buf_); FreeHbm(copy_ioaddr_dev_); FreeHbm(copy_input_release_flag_dev_); diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 2fbb4dc7..19320bc0 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -192,7 +192,6 @@ class AiCpuTask : public AiCpuBaseTask { // host addr std::vector io_addr_host_; - bool dynamic_flag_ = false; // for copy task void *copy_task_args_buf_ = nullptr; void *copy_workspace_buf_ = nullptr; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf573343..e3aecf80 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -818,6 +818,7 @@ set(MULTI_PARTS_TEST_FILES "session/inner_session_unittest.cc" "session/session_manager_unittest.cc" "common/host_cpu_engine_unittest.cc" + "common/tbe_plugin_manager_unittest.cc" ) set(GE_OPT_INFO_TEST_FILES diff --git a/tests/ut/ge/common/tbe_plugin_manager_unittest.cc b/tests/ut/ge/common/tbe_plugin_manager_unittest.cc new file mode 100644 index 00000000..16c1650b --- /dev/null +++ b/tests/ut/ge/common/tbe_plugin_manager_unittest.cc @@ -0,0 +1,40 @@ +/** + * 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 + +#define protected public +#define private public +#include "common/ge/tbe_plugin_manager.h" +#undef private +#undef protected + +namespace ge { +class UtestTBEPluginManager: public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UtestTBEPluginManager, CheckFindParserSo) { + string path = ""; + vector file_list = {}; + string caffe_parser_path = ""; + TBEPluginManager::Instance().FindParserSo(path, file_list, caffe_parser_path); + path = "/lib64"; + TBEPluginManager::Instance().FindParserSo(path, file_list, caffe_parser_path); +} +} // namespace ge diff --git a/tests/ut/ge/session/omg_omg_unittest.cc b/tests/ut/ge/session/omg_omg_unittest.cc index 334df319..6176b7c0 100644 --- a/tests/ut/ge/session/omg_omg_unittest.cc +++ b/tests/ut/ge/session/omg_omg_unittest.cc @@ -48,4 +48,13 @@ TEST_F(UtestOmg, display_model_info_success) { attr_def->mutable_list()->add_i(4); PrintModelInfo(&model_def, 1); } + +TEST_F(UtestOmg, find_parser_so) { + string path = ""; + vector file_list = {}; + string caffe_parser_path = ""; + FindParserSo(path, file_list, caffe_parser_path); + path = "/lib64"; + FindParserSo(path, file_list, caffe_parser_path); +} } // namespace ge diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index 1975f9f4..e4a53340 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -310,3 +310,27 @@ TEST_F(UtestSingleOpModel, BuildTaskList) { MemcpyAsyncTask mem_task; ASSERT_EQ(mem_task.LaunchKernel(0), SUCCESS); } + +TEST_F(UtestSingleOpModel, build_aicpu_task) { + ComputeGraphPtr graph = make_shared("single_op"); + GeModelPtr ge_model = make_shared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph)); + shared_ptr model_task_def = make_shared(); + ge_model->SetModelTaskDef(model_task_def); + + domi::TaskDef *task_def = model_task_def->add_task(); + task_def->set_type(RT_MODEL_TASK_KERNEL_EX); + + string model_data_str = "123456789"; + SingleOpModel model("model", model_data_str.c_str(), model_data_str.size()); + std::mutex stream_mu; + rtStream_t stream = nullptr; + rtStreamCreate(&stream, 0); + DynamicSingleOp single_op(0, &stream_mu, stream); + model.model_helper_.model_ = ge_model; + auto op_desc = std::make_shared("add", "Add"); + NodePtr node = graph->AddNode(op_desc); + model.op_list_[0] = node; + StreamResource *res = new (std::nothrow) StreamResource(1); + ASSERT_EQ(model.BuildTaskListForDynamicOp(res, single_op), SUCCESS); +} From 0ed42e96f711bbe5287f77e1f04bbed02266d7f2 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 23 Jun 2021 17:29:54 +0800 Subject: [PATCH 075/226] Fix mem leak and recursive depth protection --- ge/common/ge/tbe_plugin_manager.cc | 1 + ge/hybrid/node_executor/task_context.cc | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index c876e300..6a461a6d 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -156,6 +156,7 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis } mmScandirFree(entries, ret); temp_depth--; + return; } void TBEPluginManager::GetPluginSoFileList(const string &path, vector &file_list, string &caffe_parser_path) { diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index 78ccb54a..c0464c87 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -43,6 +43,7 @@ TaskContext::~TaskContext() { output_tensor->Destroy(); } } + ReleaseWorkspace(); } void TaskContext::ReleaseWorkspace() { @@ -50,6 +51,7 @@ void TaskContext::ReleaseWorkspace() { for (auto ws_addr : workspaces_) { execution_context_->allocator->Deallocate(ws_addr); } + workspaces_.clear(); } std::unique_ptr TaskContext::Create(NodeState *node_state, SubgraphContext *subgraph_context) { From 350855d3dca3921f48d42553a5e1db923bd400a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Wed, 23 Jun 2021 09:51:02 +0000 Subject: [PATCH 076/226] update third_party/fwkacllib/inc/runtime/rt_model.h. --- third_party/fwkacllib/inc/runtime/rt_model.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 74539222..30b8f053 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -50,8 +50,9 @@ typedef enum tagModelTaskType { RT_MODEL_TASK_STREAM_LABEL_SWITCH_BY_INDEX, RT_MODEL_TASK_STREAM_LABEL_GOTO, RT_MODEL_TASK_MODEL_EXIT, - RT_MODEL_TASK_FFTS_TASK, RT_MODEL_TASK_ALL_KERNEL, + RT_MODEL_TASK_PROFILER_TRACE_EX, + RT_MODEL_TASK_FFTS_TASK, } rtModelTaskType_t; typedef enum tagModelStreamType { From d30366d2c96061538a7f6fed2830b94f0a7e3403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Wed, 23 Jun 2021 17:53:02 +0800 Subject: [PATCH 077/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!1840=20:=20opt=20info'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 - ge/CMakeLists.txt | 8 -- ge/ge_opt_info/ge_opt_info.cc | 58 ----------- ge/ge_opt_info/ge_opt_info.h | 31 ------ ge/graph/manager/graph_manager.cc | 7 -- tests/CMakeLists.txt | 1 - tests/depends/opt_info/CMakeLists.txt | 37 ------- tests/depends/opt_info/src/opt_info_stub.cc | 46 --------- tests/framework/cmake/graphengine.cmake | 2 - tests/st/testcase/test_ge_opt_info.cc | 123 ------------------------ tests/ut/ge/CMakeLists.txt | 14 --- tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc | 82 ---------------- third_party/fwkacllib/inc/opt_info/opt_info.h | 34 ------- 13 files changed, 444 deletions(-) delete mode 100644 ge/ge_opt_info/ge_opt_info.cc delete mode 100644 ge/ge_opt_info/ge_opt_info.h delete mode 100644 tests/depends/opt_info/CMakeLists.txt delete mode 100644 tests/depends/opt_info/src/opt_info_stub.cc delete mode 100644 tests/st/testcase/test_ge_opt_info.cc delete mode 100644 tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc delete mode 100644 third_party/fwkacllib/inc/opt_info/opt_info.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 41520b14..e3cc1e32 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,6 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) - find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 5db2e7a9..2b9122da 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -434,7 +434,6 @@ set(TRAIN_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" ) set(INFER_SRC_LIST @@ -712,7 +711,6 @@ set(INFER_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) @@ -767,13 +765,11 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external - ${GE_CODE_DIR}/../abl/licctrl #### blue zone ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_runner PRIVATE @@ -796,7 +792,6 @@ target_link_libraries(ge_runner PRIVATE runtime error_manager ascend_hal_stub - opt_feature -Wl,--as-needed json -lrt @@ -844,13 +839,11 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external - ${GE_CODE_DIR}/../abl/licctrl #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_compiler PRIVATE @@ -870,7 +863,6 @@ target_link_libraries(ge_compiler PRIVATE error_manager slog runtime_compile - opt_feature -Wl,--as-needed json -lrt diff --git a/ge/ge_opt_info/ge_opt_info.cc b/ge/ge_opt_info/ge_opt_info.cc deleted file mode 100644 index 8c1b84ab..00000000 --- a/ge/ge_opt_info/ge_opt_info.cc +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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 "ge_opt_info/ge_opt_info.h" - -#include -#include -#include "graph/ge_local_context.h" -#include "ge/ge_api_types.h" -#include "common/debug/ge_log.h" -#include "opt_info.h" - -namespace ge { -Status GeOptInfo::SetOptInfo() { - std::string soc_ver; - graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); - if (ret != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get soc version failed."); - GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); - return FAILED; - } - GELOGD("Soc version:%s.", soc_ver.c_str()); - std::map opt_info; - // the first arg does not work at present. - if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", - gelc::kOffline, soc_ver.c_str()); - return FAILED; - } - // do nothing if get empty information - if (opt_info.empty()) { - GELOGI("Optional information is empty."); - return SUCCESS; - } - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - for (const auto &itr : opt_info) { - graph_options.emplace(itr.first, itr.second); - GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); - } - GetThreadLocalContext().SetGraphOption(graph_options); - return SUCCESS; -} -} // namespace ge diff --git a/ge/ge_opt_info/ge_opt_info.h b/ge/ge_opt_info/ge_opt_info.h deleted file mode 100644 index 935dff25..00000000 --- a/ge/ge_opt_info/ge_opt_info.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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. - */ - -#ifndef GE_OPT_INFO_GE_OPT_INFO_H_ -#define GE_OPT_INFO_GE_OPT_INFO_H_ - -#include "ge/ge_api_error_codes.h" -#include "register/register_types.h" - -namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { - public: - GeOptInfo() = default; - static Status SetOptInfo(); -}; -} // namespace ge - -#endif // GE_OPT_INFO_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 0a4633ad..b862a7d6 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,7 +27,6 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" -#include "ge_opt_info/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -1002,12 +1001,6 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector - c_sec -) - -target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc deleted file mode 100644 index df518c4b..00000000 --- a/tests/depends/opt_info/src/opt_info_stub.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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 "opt_info.h" -#include -#include -#include -#include - -namespace gelc { -namespace { -const std::vector kSocVersions = {"Ascend910"}; -} - -void SetAllOptInfo(std::map &opt_infos) { - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - opt_infos.emplace("opt_module.rl_tune", "all"); - opt_infos.emplace("opt_module.aoe", "all"); -} - -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_infos) { - if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { - SetAllOptInfo(opt_infos); - return SUCCESS; - } - opt_infos.emplace("opt_module.fe", "all"); - opt_infos.emplace("opt_module.pass", "all"); - opt_infos.emplace("opt_module.op_tune", "all"); - return SUCCESS; -} -} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index c4380016..81aa00cc 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,7 +103,6 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -118,7 +117,6 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub - opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc deleted file mode 100644 index 457473b1..00000000 --- a/tests/st/testcase/test_ge_opt_info.cc +++ /dev/null @@ -1,123 +0,0 @@ -/** - * 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 "easy_graph/graph/box.h" -#include "easy_graph/graph/node.h" -#include "easy_graph/builder/graph_dsl.h" -#include "easy_graph/builder/box_builder.h" -#include "easy_graph/layout/graph_layout.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" -#include "graph/graph.h" -#include "graph/compute_graph.h" -#include "framework/common/types.h" -#include "graph/debug/ge_attr_define.h" -#include "ge_graph_dsl/graph_dsl.h" -#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" -#define protected public -#define private public -#include "ge_opt_info/ge_opt_info.h" -#undef private -#undef protected - -namespace ge { -class STEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(STEST_opt_info, get_opt_info_all) { - std::map options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(STEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - - /// data1 data2 - /// \ / - /// add - // build graph - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - CHAIN(NODE("data2", DATA)->NODE("add")); - }); - - auto graph = ToGeGraph(g1); - - // new session & add graph - Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor - std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); - EXPECT_EQ(ret, SUCCESS); - - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} -} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf573343..06b3e0f2 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,7 +62,6 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -347,7 +346,6 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/session/omg.cc" - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" ) set(COMMON_FORMAT_SRC_FILES @@ -455,7 +453,6 @@ set(GRAPH_EXECUTE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.h" ) @@ -631,10 +628,6 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model.cc" ) -set(GE_OPT_INFO_SRC_FILES - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" -) - # test files set(COMMON_TEST_FILES "graph/passes/graph_builder_utils.cc" @@ -820,10 +813,6 @@ set(MULTI_PARTS_TEST_FILES "common/host_cpu_engine_unittest.cc" ) -set(GE_OPT_INFO_TEST_FILES - "ge_opt_info/ge_opt_info_unittest.cc" -) - set(GENERATOR_TEST_FILES "generator/ge_generator_unittest.cc" ) @@ -875,7 +864,6 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub - opt_feature_stub ascend_protobuf json ) @@ -1121,12 +1109,10 @@ target_link_libraries(ut_libge_multiparts_utest # libge_others_utest add_executable(ut_libge_others_utest - ${GE_OPT_INFO_SRC_FILES} ${COMMON_TEST_FILES} ${PASS_TEST_FILES} ${EXECUTE_TEST_FILES} ${OTHERS_TEST_FILES} - ${GE_OPT_INFO_TEST_FILES} ) target_compile_options(ut_libge_others_utest PRIVATE diff --git a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc deleted file mode 100644 index 20c123e9..00000000 --- a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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 - -#define protected public -#define private public -#include "ge_opt_info/ge_opt_info.h" -#include "graph/ge_local_context.h" -#include "external/ge/ge_api_types.h" -#undef private -#undef protected - -namespace ge { -class UTEST_opt_info : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(UTEST_opt_info, get_opt_info_success) { - std::map options = {{ge::SOC_VERSION, "Ascend910"}}; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_all) { - std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; - GetThreadLocalContext().SetGlobalOption(global_options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::SUCCESS); - std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); - auto itr = graph_options.find("opt_module.fe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.pass"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.op_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.rl_tune"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); - itr = graph_options.find("opt_module.aoe"); - EXPECT_NE(itr, graph_options.end()); - EXPECT_EQ(itr->second, "all"); -} - -TEST_F(UTEST_opt_info, get_opt_info_failed) { - std::map options; - GetThreadLocalContext().SetGlobalOption(options); - auto ret = GeOptInfo::SetOptInfo(); - EXPECT_EQ(ret, ge::FAILED); -} - -} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h deleted file mode 100644 index ea9bb529..00000000 --- a/third_party/fwkacllib/inc/opt_info/opt_info.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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 - -namespace gelc { -using Status = uint32_t; -using WorkMode = uint32_t; -const Status SUCCESS = 0x0; -const Status FAILED = 0xFFFFFFFF; -const WorkMode kOffline = 0x0; -const WorkMode kInline = 0x01; - -extern "C" { -__attribute__((visibility ("default"))) -Status GetOptInfo(WorkMode mode, const std::string &soc_ver, - std::map &opt_info_map); -} -} // namespace gelc - From e7279c1a6c9a5df56da7af51de325bcd4e70c204 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 23 Jun 2021 18:00:27 +0800 Subject: [PATCH 078/226] Fix ut. --- ge/common/ge/tbe_plugin_manager.cc | 1 - ge/single_op/single_op_model.cc | 13 ++++--------- ge/single_op/single_op_model.h | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index 6a461a6d..c876e300 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -156,7 +156,6 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis } mmScandirFree(entries, ret); temp_depth--; - return; } void TBEPluginManager::GetPluginSoFileList(const string &path, vector &file_list, string &caffe_parser_path) { diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 1d00127a..08a0fcbc 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -376,11 +376,10 @@ Status SingleOpModel::BuildTaskList(StreamResource *stream_resource, SingleOp &s } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { GELOGD("Building AICPU_TF task"); AiCpuTask *aicpu_task = nullptr; - bool depend_compute_flag = false; uint64_t singleop_kernel_id = aicpu_kernel_id++; GELOGI("Build singleOp TfTask, kernel_id = %lu", singleop_kernel_id); GE_CHK_STATUS_RET_NOLOG( - BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, depend_compute_flag, singleop_kernel_id)); + BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, singleop_kernel_id)); aicpu_task->SetModelArgs(model_name_, model_id_); ParseArgTable(aicpu_task, single_op); single_op.tasks_.emplace_back(aicpu_task); @@ -457,8 +456,7 @@ Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask * return SUCCESS; } -Status SingleOpModel::BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, - bool& depend_compute_flag, uint64_t kernel_id) { +Status SingleOpModel::BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, uint64_t kernel_id) { auto iter = op_list_.find(kernel_def.op_index()); if (iter == op_list_.end()) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, @@ -481,7 +479,6 @@ Status SingleOpModel::BuildKernelExTask(const domi::KernelExDef &kernel_def, AiC GELOGE(ret, "[Build][Task] failed, kernel_id:%lu.", kernel_id); return ret; } - depend_compute_flag = (aicpu_task->GetUnknownType() == DEPEND_COMPUTE); *task = aicpu_task.release(); return SUCCESS; @@ -628,12 +625,10 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, } GELOGD("Building AICPU_TF task"); AiCpuTask *aicpu_task = nullptr; - bool depend_compute_flag = false; uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); - GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, - depend_compute_flag, dynamic_singleop_kernel_id)); - if (depend_compute_flag) { + GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, dynamic_singleop_kernel_id)); + if (aicpu_task->GetUnknownType() == DEPEND_COMPUTE) { if (i >= tasks.size() - 1) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Task]The copy task of the fourth operator was not found."); REPORT_INNER_ERROR("E19999", "The copy task of the fourth operator was not found."); diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index 747d99e9..b7f6b42a 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -69,8 +69,7 @@ class SingleOpModel { Status BuildTaskList(StreamResource *stream_resource, SingleOp &single_op); Status BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &dynamic_single_op); Status BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task); - Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, - bool& depend_compute_flag, uint64_t kernel_id); + Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, uint64_t kernel_id); Status BuildCpuKernelTask(const domi::KernelDef &kernel_def, OpTask **task, uint64_t kernel_id); Status BuildModelTaskKernel(StreamResource *stream_resource, const domi::TaskDef &task_def, DynamicSingleOp &single_op); From 3996f5df109662f59e7eca969ff9ce9392a8badf Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 23 Jun 2021 19:32:49 +0800 Subject: [PATCH 079/226] Fix bug of recursive depth protection. --- ge/common/ge/tbe_plugin_manager.cc | 16 +++++----------- ge/common/ge/tbe_plugin_manager.h | 3 ++- ge/session/omg.cc | 16 +++++----------- inc/framework/omg/omg.h | 3 ++- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index c876e300..70c1ab94 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -104,14 +104,12 @@ void TBEPluginManager::ProcessSoFullName(vector &file_list, string &caff } } -void TBEPluginManager::FindParserSo(const string &path, vector &file_list, string &caffe_parser_path) { - static uint32_t temp_depth = 0; +void TBEPluginManager::FindParserSo(const string &path, vector &file_list, + string &caffe_parser_path, uint32_t recursive_depth) { static const uint32_t max_recursive_depth = 20; // For recursive depth protection - temp_depth++; - if (temp_depth >= max_recursive_depth) { - GELOGW("Recursive depth is become %u, Please check input!", temp_depth); - temp_depth--; + if (recursive_depth >= max_recursive_depth) { + GELOGW("Recursive depth is become %u, Please check input!", recursive_depth); return; } @@ -120,14 +118,12 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis // Plugin path does not exist if (real_path.empty()) { GELOGW("RealPath is empty."); - temp_depth--; return; } INT32 is_dir = mmIsDir(real_path.c_str()); // Lib plugin path not exist if (is_dir != EN_OK) { GELOGW("%s is not a dir. errmsg:%s", real_path.c_str(), strerror(errno)); - temp_depth--; return; } @@ -135,7 +131,6 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis auto ret = mmScandir(real_path.c_str(), &entries, nullptr, nullptr); if (ret < EN_OK) { GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", real_path.c_str(), ret, strerror(errno)); - temp_depth--; return; } for (int i = 0; i < ret; ++i) { @@ -151,11 +146,10 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis ProcessSoFullName(file_list, caffe_parser_path, full_name, caffe_parser_so_suff, aicpu_so_suff, aicpu_host_so_suff); } else { - FindParserSo(full_name, file_list, caffe_parser_path); + FindParserSo(full_name, file_list, caffe_parser_path, recursive_depth + 1); } } mmScandirFree(entries, ret); - temp_depth--; } void TBEPluginManager::GetPluginSoFileList(const string &path, vector &file_list, string &caffe_parser_path) { diff --git a/ge/common/ge/tbe_plugin_manager.h b/ge/common/ge/tbe_plugin_manager.h index 4bd8c6e3..eada3e64 100755 --- a/ge/common/ge/tbe_plugin_manager.h +++ b/ge/common/ge/tbe_plugin_manager.h @@ -57,7 +57,8 @@ class TBEPluginManager { static void ProcessSoFullName(vector &file_list, string &caffe_parser_path, string &full_name, const string &caffe_parser_so_suff, const string &aicpu_so_suff, const string &aicpu_host_so_suff); - static void FindParserSo(const string &path, vector &file_list, string &caffe_parser_path); + static void FindParserSo(const string &path, vector &file_list, string &caffe_parser_path, + uint32_t recursive_depth = 0); static void GetPluginSoFileList(const string &path, vector &file_list, string &caffe_parser_path); static void GetCustomOpPath(std::string &customop_path); void LoadCustomOpLib(); diff --git a/ge/session/omg.cc b/ge/session/omg.cc index 8d826043..a2ee176f 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -220,26 +220,22 @@ static Status ParseOutputFp16NodesFormat(const string &is_output_fp16) { return SUCCESS; } -void FindParserSo(const string &path, vector &file_list, string &caffe_parser_path) { - static uint32_t temp_depth = 0; +void FindParserSo(const string &path, vector &file_list, + string &caffe_parser_path, uint32_t recursive_depth) { static const uint32_t max_recursive_depth = 20; // For recursive depth protection - temp_depth++; - if (temp_depth >= max_recursive_depth) { - GELOGW("Recursive depth is become %u, Please check input!", temp_depth); - temp_depth--; + if (recursive_depth >= max_recursive_depth) { + GELOGW("Recursive depth is become %u, Please check input!", recursive_depth); return; } // path, Change to absolute path string real_path = RealPath(path.c_str()); if (real_path.empty()) { // plugin path does not exist - temp_depth--; return; } struct stat stat_buf; if ((stat(real_path.c_str(), &stat_buf) != 0) || (!S_ISDIR(stat_buf.st_mode))) { GELOGI("The path %s is not a directory.", real_path.c_str()); - temp_depth--; return; } @@ -248,7 +244,6 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p if (nullptr == dir) { // plugin path does not exist GELOGW("Open directory %s failed.", path.c_str()); - temp_depth--; return; } @@ -269,10 +264,9 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p continue; } - FindParserSo(full_name, file_list, caffe_parser_path); + FindParserSo(full_name, file_list, caffe_parser_path, recursive_depth + 1); } closedir(dir); - temp_depth--; return; } diff --git a/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index a0cdb449..1c39d203 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.h @@ -91,7 +91,8 @@ GE_FUNC_VISIBILITY Status ConvertFwkModelToJson(domi::FrameworkType framework, c GE_FUNC_VISIBILITY void GetGroupName(ge::proto::ModelDef &model); -GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); +GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path, + uint32_t recursive_depth = 0); GE_FUNC_VISIBILITY Status DumpInfershapeJson(const ge::Graph &graph, const char *json_file); From 3440d44062a01b1fd871e5ce069047b279c5afaf Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 23 Jun 2021 20:31:18 +0800 Subject: [PATCH 080/226] Fix multi control from one node --- ge/ge_local_engine/engine/host_cpu_engine.cc | 9 +++------ ge/hybrid/model/hybrid_model_builder.cc | 4 ---- ge/hybrid/model/node_item.cc | 15 ++++++--------- ge/hybrid/model/node_item.h | 2 +- ge/hybrid/node_executor/hccl/hccl_node_executor.cc | 1 + ge/hybrid/node_executor/rts/rts_node_executor.cc | 7 +------ 6 files changed, 12 insertions(+), 26 deletions(-) diff --git a/ge/ge_local_engine/engine/host_cpu_engine.cc b/ge/ge_local_engine/engine/host_cpu_engine.cc index 488a5ee8..d9b67736 100755 --- a/ge/ge_local_engine/engine/host_cpu_engine.cc +++ b/ge/ge_local_engine/engine/host_cpu_engine.cc @@ -14,14 +14,14 @@ * limitations under the License. */ #include "ge_local_engine/engine/host_cpu_engine.h" -#include "graph/common/omg_util.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_adapter.h" +#include "graph/utils/node_utils.h" +#include "graph/utils/type_utils.h" #include "register/op_kernel_registry.h" #include "register/host_cpu_context.h" #include "common/ge/ge_util.h" #include "common/ge/plugin_manager.h" -#include "graph/utils/type_utils.h" #include "common/fp16_t.h" #include "common/math/math_util.h" @@ -123,10 +123,7 @@ bool HostCpuEngine::CheckSupported(const string &op_type) { } Status HostCpuEngine::FindOpKernel(const ge::NodePtr &node, std::unique_ptr &op_kernel) { - std::string op_type; - auto status = GetOriginalType(node, op_type); - GE_CHK_BOOL_EXEC_NOLOG(status == SUCCESS, return status); - + const std::string op_type = NodeUtils::GetNodeType(node); auto kernel = OpKernelRegistry::GetInstance().CreateHostCpuOp(op_type); if (kernel == nullptr) { GELOGD("Op of type %s is not supported by host cpu engine", op_type.c_str()); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index c050875e..f6de6ef0 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -289,10 +289,6 @@ Status HybridModelBuilder::GetOrCreateNodeItem(const NodePtr &node, NodeItem **n return SUCCESS; } - if (node->GetType() == MEMCPYASYNC) { // Convert MemcpyAsync to Identity. - node->GetOpDesc()->SetType(IDENTITY); - } - std::unique_ptr new_node; GE_CHK_STATUS_RET(NodeItem::Create(node, new_node), "[Invoke][Create] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET_NOLOG(NodeExecutorManager::GetInstance().GetExecutor(*node, &new_node->node_executor)); diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index 5c3d7db3..250562ce 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -15,9 +15,7 @@ */ #include "hybrid/model/node_item.h" -#include -#include "framework/common/debug/log.h" -#include "graph/common/omg_util.h" + #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" #include "hybrid/executor/worker/shape_inference_engine.h" @@ -98,8 +96,7 @@ Status ParseFusedSubgraph(NodeItem &node_item) { GE_CHECK_NOTNULL(node); auto op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(node, node_type)); + const std::string node_type = NodeUtils::GetNodeType(node); if (node_type == DATA) { GE_CHK_GRAPH_STATUS_RET(ParseInputMapping(*node, *op_desc, *fused_subgraph)); } else if (node_type == kNodeTypeRetVal) { @@ -409,8 +406,8 @@ void NodeItem::SetDataSend(NodeItem *node_item, int anchor_index) { void NodeItem::SetCtrlSend(NodeItem *node_item, uint32_t switch_index) { if (switch_index < switch_groups_.size()) { - std::vector &switch_group = switch_groups_[switch_index]; - switch_group.emplace_back(node_item); + auto &switch_group = switch_groups_[switch_index]; + switch_group.emplace(node_item); } else { ctrl_send_.insert(node_item); } @@ -433,8 +430,8 @@ void NodeItem::SetMergeCtrl(NodeItem *node_item, uint32_t merge_index) { } // this is StreamMerge node, node_item is StreamActive node. - std::vector &switch_group = switch_groups_[merge_index]; - switch_group.emplace_back(node_item); + auto &switch_group = switch_groups_[merge_index]; + switch_group.emplace(node_item); node_item->ctrl_send_.emplace(this); GELOGI("Node[%s] will control node[%s]", node_item->NodeName().c_str(), NodeName().c_str()); diff --git a/ge/hybrid/model/node_item.h b/ge/hybrid/model/node_item.h index ec66f094..12775b00 100644 --- a/ge/hybrid/model/node_item.h +++ b/ge/hybrid/model/node_item.h @@ -155,7 +155,7 @@ struct NodeItem { std::map data_recv_; // Recv data notify from std::set ctrl_send_; // Send ctrl notify to std::set ctrl_recv_; // Recv ctrl notify from - std::vector> switch_groups_; // Send ctrl notify to + std::vector> switch_groups_; // Send ctrl notify to std::shared_ptr kernel_task; std::unique_ptr fused_subgraph; diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc index b8819a42..3f887819 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc @@ -342,6 +342,7 @@ Status RdmaNodeTask::ExecuteAsync(TaskContext &context, std::function do GE_CHK_RT_RET(rtEventDestroy(evt)); } GELOGI("rdma callback success."); + return SUCCESS; }; HcclResult hccl_ret = HcomExecEnqueueRemoteAccess(context.GetNodeItem().NodeType(), addr_infos, callback); diff --git a/ge/hybrid/node_executor/rts/rts_node_executor.cc b/ge/hybrid/node_executor/rts/rts_node_executor.cc index 5cd971df..d52f56b9 100644 --- a/ge/hybrid/node_executor/rts/rts_node_executor.cc +++ b/ge/hybrid/node_executor/rts/rts_node_executor.cc @@ -17,13 +17,9 @@ #include "hybrid/node_executor/rts/rts_node_executor.h" #include "hybrid/node_executor/rts/rts_task_factory.h" -#include "framework/common/debug/log.h" #include "common/ge/ge_util.h" -#include "framework/common/types.h" -#include "graph/common/omg_util.h" #include "graph/utils/tensor_utils.h" #include "hybrid/model/hybrid_model.h" -#include "runtime/rt.h" namespace ge { namespace hybrid { @@ -133,8 +129,7 @@ Status ProfilingTraceNodeTask::ExecuteAsync(TaskContext &context, std::function< Status RtsNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node, shared_ptr &task) const { GE_CHECK_NOTNULL(node); GELOGD("[%s] Load for local task.", node->GetName().c_str()); - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(node, node_type), "Get original type failed."); + const std::string node_type = NodeUtils::GetNodeType(node); RtsNodeTaskPtr rts_task = RtsTaskFactory::GetInstance().Create(node_type); if (rts_task == nullptr) { GELOGE(UNSUPPORTED, "[%s] Unsupported RTS op type: %s", node->GetName().c_str(), node_type.c_str()); From 538394ffc5a60fe2b4c6f71de3033190e617173c Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 23 Jun 2021 20:53:47 +0800 Subject: [PATCH 081/226] Fix Guard for variable release --- ge/graph/load/model_manager/model_manager.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 2cb31074..8bcaa23f 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -1394,9 +1394,19 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) { return SUCCESS; } + rtStream_t stream = nullptr; vector allocated_mem; + std::function callback = [&]() { + for (auto mem : allocated_mem) { + GE_CHK_RT(rtFree(mem)); + } + if (stream != nullptr) { + GE_CHK_RT(rtStreamDestroy(stream)); + } + }; + GE_MAKE_GUARD(release, callback); + rtError_t status; - rtStream_t stream = nullptr; vector v_cust_so; void *args = nullptr; @@ -1471,13 +1481,6 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) { GELOGE(RT_FAILED, "[Call][RtStreamSynchronize] fail, ret = 0x%X", status); return RT_ERROR_TO_GE_STATUS(status); } - std::function callback = [&]() { - for (auto mem : allocated_mem) { - GE_CHK_RT(rtFree(mem)); - } - GE_CHK_RT(rtStreamDestroy(stream)); - }; - GE_MAKE_GUARD(release, callback); GELOGI("Cpu kernel launch task success."); return SUCCESS; } From 8a1ec9739945e9292a6af47980370147d3931014 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 23 Jun 2021 21:03:49 +0800 Subject: [PATCH 082/226] Fix st. --- ge/session/omg.cc | 11 ++--------- inc/framework/omg/omg.h | 3 +-- tests/ut/ge/session/omg_omg_unittest.cc | 9 --------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/ge/session/omg.cc b/ge/session/omg.cc index a2ee176f..f7f3def7 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -220,14 +220,7 @@ static Status ParseOutputFp16NodesFormat(const string &is_output_fp16) { return SUCCESS; } -void FindParserSo(const string &path, vector &file_list, - string &caffe_parser_path, uint32_t recursive_depth) { - static const uint32_t max_recursive_depth = 20; // For recursive depth protection - - if (recursive_depth >= max_recursive_depth) { - GELOGW("Recursive depth is become %u, Please check input!", recursive_depth); - return; - } +void FindParserSo(const string &path, vector &file_list, string &caffe_parser_path) { // path, Change to absolute path string real_path = RealPath(path.c_str()); if (real_path.empty()) { // plugin path does not exist @@ -264,7 +257,7 @@ void FindParserSo(const string &path, vector &file_list, continue; } - FindParserSo(full_name, file_list, caffe_parser_path, recursive_depth + 1); + FindParserSo(full_name, file_list, caffe_parser_path); } closedir(dir); return; diff --git a/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index 1c39d203..a0cdb449 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.h @@ -91,8 +91,7 @@ GE_FUNC_VISIBILITY Status ConvertFwkModelToJson(domi::FrameworkType framework, c GE_FUNC_VISIBILITY void GetGroupName(ge::proto::ModelDef &model); -GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path, - uint32_t recursive_depth = 0); +GE_FUNC_VISIBILITY void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); GE_FUNC_VISIBILITY Status DumpInfershapeJson(const ge::Graph &graph, const char *json_file); diff --git a/tests/ut/ge/session/omg_omg_unittest.cc b/tests/ut/ge/session/omg_omg_unittest.cc index 6176b7c0..334df319 100644 --- a/tests/ut/ge/session/omg_omg_unittest.cc +++ b/tests/ut/ge/session/omg_omg_unittest.cc @@ -48,13 +48,4 @@ TEST_F(UtestOmg, display_model_info_success) { attr_def->mutable_list()->add_i(4); PrintModelInfo(&model_def, 1); } - -TEST_F(UtestOmg, find_parser_so) { - string path = ""; - vector file_list = {}; - string caffe_parser_path = ""; - FindParserSo(path, file_list, caffe_parser_path); - path = "/lib64"; - FindParserSo(path, file_list, caffe_parser_path); -} } // namespace ge From 55a5e8019df6c0e53c474c27e91a045d5492002c Mon Sep 17 00:00:00 2001 From: lianghao Date: Tue, 22 Jun 2021 21:49:01 +0800 Subject: [PATCH 083/226] FillKernel --- ge/host_kernels/fill_kernel.cc | 8 +++++ .../passes/folding_kernel/fill_kernel_unittest.cc | 36 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/ge/host_kernels/fill_kernel.cc b/ge/host_kernels/fill_kernel.cc index e41c5bf3..ac46101b 100644 --- a/ge/host_kernels/fill_kernel.cc +++ b/ge/host_kernels/fill_kernel.cc @@ -45,6 +45,7 @@ Status FillKernel::Compute(const ge::OpDescPtr op_desc_ptr, const std::vectorGetName().c_str()); GE_CHECK_NOTNULL(input.at(kFillDimsInputIndex)); GE_CHECK_NOTNULL(input.at(kFillDataInputIndex)); @@ -57,6 +58,13 @@ Status FillKernel::Compute(const ge::OpDescPtr op_desc_ptr, const std::vectorGetOutputDescPtr(0); + GE_CHECK_NOTNULL(output_desc); + if (output_desc->GetShape().IsUnknownShape()) { + GELOGD("Output is unknown shape, [%s] skip FillKernel.", op_desc_ptr->GetName().c_str()); + return NOT_CHANGED; + } + GeTensorPtr output_ptr; output_ptr = MakeShared(op_desc_ptr->GetOutputDesc(0)); if (output_ptr == nullptr) { diff --git a/tests/ut/ge/graph/passes/folding_kernel/fill_kernel_unittest.cc b/tests/ut/ge/graph/passes/folding_kernel/fill_kernel_unittest.cc index f58d6d9b..c0cce260 100644 --- a/tests/ut/ge/graph/passes/folding_kernel/fill_kernel_unittest.cc +++ b/tests/ut/ge/graph/passes/folding_kernel/fill_kernel_unittest.cc @@ -64,6 +64,7 @@ class UtestGraphPassesFoldingKernelFillKernel : public testing::Test { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -124,6 +125,7 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillBoolShape2And3) { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -230,6 +232,7 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillDimsHaveNegativeNumber) { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -284,6 +287,7 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillDimsTypeNotSupport) { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -310,6 +314,7 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillDimsOverflow) { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -336,6 +341,7 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillDimsMulDataTypeOverflow) { op_desc_ptr->AddInputDesc(dims_tensor_desc); op_desc_ptr->AddInputDesc(value_tensor_desc); + op_desc_ptr->AddOutputDesc(dims_tensor_desc); std::vector input = {dim_tensor, value_tensor}; std::vector outputs; @@ -343,3 +349,33 @@ TEST_F(UtestGraphPassesFoldingKernelFillKernel, FillDimsMulDataTypeOverflow) { EXPECT_EQ(PARAM_INVALID, status); } + +TEST_F(UtestGraphPassesFoldingKernelFillKernel, OutputdescUnknown) { + ge::OpDescPtr op_dims = std::make_shared(); + vector dims_vec = {2}; + vector dims_value_vec = {2, 3}; + GeTensorDesc dims_tensor_desc(GeShape(dims_vec), FORMAT_NCHW, DT_INT32); + GeTensorPtr dim_tensor = std::make_shared(dims_tensor_desc, (uint8_t *) dims_value_vec.data(), + dims_value_vec.size() * sizeof(int32_t)); + OpDescUtils::SetWeights(op_dims, dim_tensor); + + ge::OpDescPtr op_value = std::make_shared(); + vector data_vec = {1}; + GeTensorDesc value_tensor_desc(GeShape(), FORMAT_NCHW, DT_BOOL); + GeTensorPtr value_tensor = + std::make_shared(value_tensor_desc, (uint8_t *) data_vec.data(), data_vec.size() * sizeof(bool)); + OpDescUtils::SetWeights(op_value, value_tensor); + + op_desc_ptr->AddInputDesc(dims_tensor_desc); + op_desc_ptr->AddInputDesc(value_tensor_desc); + + vector out_vec = {-1, -1}; + GeTensorDesc out_tensor_desc(GeShape(out_vec), FORMAT_NCHW, DT_INT32); + op_desc_ptr->AddOutputDesc(out_tensor_desc); + + std::vector input = {dim_tensor, value_tensor}; + std::vector outputs; + Status status = kernel->Compute(op_desc_ptr, input, outputs); + + EXPECT_EQ(NOT_CHANGED, status); +} \ No newline at end of file From a55b872fc5de15af2c50e082a2f11b2d2d9fc38d Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 24 Jun 2021 09:32:14 +0800 Subject: [PATCH 084/226] UT for LaunchKernelCustAicpuSo --- ge/graph/load/model_manager/model_manager.cc | 4 +++- tests/ut/ge/graph/load/model_manager_unittest.cc | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 8bcaa23f..3c31014d 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -1378,7 +1378,9 @@ Status ModelManager::LoadCustAicpuSo(const OpDescPtr &op_desc, const string &so_ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) { GELOGD("Aicpu kernel launch task in, kernel name %s.", kernel_name.c_str()); std::lock_guard lock(cust_aicpu_mutex_); - if (cust_aicpu_so_.size() == 0) return SUCCESS; + if (cust_aicpu_so_.empty()) { + return SUCCESS; + } // get current context rtContext_t rt_cur_ctx = nullptr; auto rt_error = rtCtxGetCurrent(&rt_cur_ctx); diff --git a/tests/ut/ge/graph/load/model_manager_unittest.cc b/tests/ut/ge/graph/load/model_manager_unittest.cc index a3545b33..d9e4eabd 100644 --- a/tests/ut/ge/graph/load/model_manager_unittest.cc +++ b/tests/ut/ge/graph/load/model_manager_unittest.cc @@ -438,4 +438,22 @@ TEST_F(UtestModelManagerModelManager, test_data_input_tensor) { auto ret = mm.DataInputTensor(model_id,inputs); EXPECT_EQ(PARAM_INVALID, ret); // HybridDavinciModel::impl_ is null. } + +TEST_F(UtestModelManagerModelManager, test_launch_kernel_cust_aicpu) { + ModelManager mm; + + // cust_aicpu_so_ is empty. + EXPECT_EQ(mm.LaunchKernelCustAicpuSo("empty_cust_aicpu"), SUCCESS); + + // deleteCustOp after Launch will deleted. + uintptr_t resource_id = 1; // for rtCtxGetCurrent stub + std::vector kernel_bin(256); + auto &cust_resource_001 = mm.cust_aicpu_so_[resource_id]; + auto tbe_kernel = std::shared_ptr(new OpKernelBin("deleteCustOp", std::move(kernel_bin))); + auto &cust_opkernel_001 = cust_resource_001["deleteCustOp"] = tbe_kernel; + + EXPECT_FALSE(mm.cust_aicpu_so_.empty()); + EXPECT_EQ(mm.LaunchKernelCustAicpuSo("deleteCustOp"), SUCCESS); + EXPECT_TRUE(mm.cust_aicpu_so_.empty()); +} } // namespace ge From 4fd937eb056b6a82094428d0b31a4feb3cb1f19d Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 24 Jun 2021 15:49:11 +0800 Subject: [PATCH 085/226] Replace MemcpyAsyncNodeTask --- ge/hybrid/node_executor/rts/rts_node_executor.cc | 1 + ge/hybrid/node_executor/rts/rts_node_task.cc | 29 ------------------------ ge/hybrid/node_executor/rts/rts_node_task.h | 5 ---- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/ge/hybrid/node_executor/rts/rts_node_executor.cc b/ge/hybrid/node_executor/rts/rts_node_executor.cc index d52f56b9..e3058ee3 100644 --- a/ge/hybrid/node_executor/rts/rts_node_executor.cc +++ b/ge/hybrid/node_executor/rts/rts_node_executor.cc @@ -29,6 +29,7 @@ REGISTER_RTS_TASK_CREATOR(IDENTITY, IdentityNodeTask); REGISTER_RTS_TASK_CREATOR(IDENTITYN, IdentityNNodeTask); REGISTER_RTS_TASK_CREATOR(READVARIABLEOP, ReadVariableOpNodeTask); REGISTER_RTS_TASK_CREATOR(PROFILINGTRAININGTRACE, ProfilingTraceNodeTask); +REGISTER_RTS_TASK_CREATOR(MEMCPYASYNC, IdentityNodeTask); Status IdentityNodeTask::DoCopyTensor(TaskContext &context, int index) { auto input_desc = context.MutableInputDesc(index); diff --git a/ge/hybrid/node_executor/rts/rts_node_task.cc b/ge/hybrid/node_executor/rts/rts_node_task.cc index 9af54815..7b95f98a 100644 --- a/ge/hybrid/node_executor/rts/rts_node_task.cc +++ b/ge/hybrid/node_executor/rts/rts_node_task.cc @@ -43,7 +43,6 @@ namespace hybrid { REGISTER_RTS_TASK_CREATOR(STREAMACTIVE, StreamActiveNodeTask); REGISTER_RTS_TASK_CREATOR(STREAMSWITCH, StreamSwitchNodeTask); REGISTER_RTS_TASK_CREATOR(STREAMMERGE, StreamMergeNodeTask); -REGISTER_RTS_TASK_CREATOR(MEMCPYASYNC, MemcpyAsyncNodeTask); REGISTER_RTS_TASK_CREATOR(ENTER, PassThroughNodeTask); REGISTER_RTS_TASK_CREATOR(REFENTER, PassThroughNodeTask); @@ -168,34 +167,6 @@ Status StreamMergeNodeTask::ExecuteAsync(TaskContext &task_context, std::functio return SUCCESS; } -Status MemcpyAsyncNodeTask::ExecuteAsync(TaskContext &task_context, std::function done_callback) { - GELOGD("[%s] Start to execute.", task_context.GetNodeName()); - auto input_desc = task_context.MutableInputDesc(0); - GE_CHECK_NOTNULL(input_desc); - int64_t copy_size = 0; - GE_CHK_GRAPH_STATUS_RET(TensorUtils::GetTensorSizeInBytes(*input_desc, copy_size)); - // copy_size would not be negative since GetTensorSizeInBytes returned successfully. - if (copy_size > 0) { - const auto in_v = task_context.MutableInput(0); - const auto out_v = task_context.MutableOutput(0); - GE_CHECK_NOTNULL(in_v); - GE_CHECK_NOTNULL(out_v); - GELOGD("[%s] input size: %zu, output size: %zu, copy size: %ld", task_context.GetNodeName(), - in_v->GetSize(), out_v->GetSize(), copy_size); - GE_CHK_RT_RET(rtMemcpyAsync(out_v->MutableData(), out_v->GetSize(), in_v->GetData(), copy_size, - RT_MEMCPY_DEVICE_TO_DEVICE, task_context.GetStream())); - } else { - GELOGW("[%s] invalid copy size: %ld", task_context.GetNodeName(), copy_size); - } - - if (done_callback) { - GE_CHK_STATUS_RET(task_context.RegisterCallback(done_callback)); - } - - GELOGD("[%s] Done executing successfully.", task_context.GetNodeName()); - return SUCCESS; -} - Status PassThroughNodeTask::ExecuteAsync(TaskContext &task_context, std::function done_callback) { GELOGD("[%s] Start to execute.", task_context.GetNodeName()); const auto in_x = task_context.GetInput(0); // x diff --git a/ge/hybrid/node_executor/rts/rts_node_task.h b/ge/hybrid/node_executor/rts/rts_node_task.h index d7d63eb5..e18f9a8f 100644 --- a/ge/hybrid/node_executor/rts/rts_node_task.h +++ b/ge/hybrid/node_executor/rts/rts_node_task.h @@ -60,11 +60,6 @@ class StreamMergeNodeTask : public RtsNodeTask { Status ExecuteAsync(TaskContext &task_context, std::function done_callback) override; }; -class MemcpyAsyncNodeTask : public RtsNodeTask { - public: - Status ExecuteAsync(TaskContext &task_context, std::function done_callback) override; -}; - class PassThroughNodeTask : public RtsNodeTask { public: Status ExecuteAsync(TaskContext &task_context, std::function done_callback) override; From 27a9d527f9649d4e46c01052ab82b30533dca798 Mon Sep 17 00:00:00 2001 From: zhupuxu Date: Wed, 9 Jun 2021 14:13:41 +0800 Subject: [PATCH 086/226] step info Signed-off-by: zhupuxu --- ge/common/profiling/ge_profiling.cc | 39 ++++++++++++++++++++-- inc/framework/common/profiling/ge_profiling.h | 5 +++ tests/depends/profiler/src/profiler_stub.cc | 8 +++++ tests/ut/ge/CMakeLists.txt | 1 + .../ge/profiling/ge_profiling_manager_unittest.cc | 19 ++++++++++- 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index d0343326..48d12609 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -22,6 +22,7 @@ #include "graph/load/graph_loader.h" #include "init/gelib.h" #include "framework/common/ge_inner_error_codes.h" +#include "model/ge_model.h" namespace { const uint32_t kDeviceListIndex = 3; @@ -42,6 +43,10 @@ const std::map kProfCommandTypeMap = { {kProfCommandhandleFinalize, kProfilingFinalize}, {kProfCommandhandleModelSubscribe, kProfModelSubscribe}, {kProfCommandhandleModelUnsubscribe, kProfModelUnsubscribe}}; + +const uint64_t kModelId = ge::INVALID_MODEL_ID; +const uint16_t kStepStart = 0; +const uint16_t kStepEnd = 1; } // namespace bool TransProfConfigToParam(const ProfCommandHandleData &profCommand, vector &prof_config_params) { @@ -216,6 +221,36 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le return ge::SUCCESS; } -GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream) { - return ge::SUCCESS; +ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream) { + static bool is_first_run = true; + int32_t device_id = 0; + rtError_t rt_ret = rtGetDevice(&device_id); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(rt_ret, "[Get][LogicDeviceId]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Get logic device id failed, ret 0x%X", rt_ret); + return ge::FAILED; + } + if (is_first_run && tag_id == kStepStart) { + GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, + kModelId, + tag_id, + stream, + device_id)); + is_first_run = false; + return ge::SUCCESS; + } + if (!is_first_run && tag_id == kStepEnd) { + GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, + kModelId, + tag_id, + stream, + device_id)); + is_first_run = true; + return ge::SUCCESS; + } + GELOGE(ge::FAILED, "Param tag_id:%u invalid when is_first_run is %d", tag_id, is_first_run); + REPORT_INPUT_ERROR("E10001", std::vector({"value", "parameter", "reason"}), + std::vector({std::to_string(tag_id), "tag_id", + "tag id must be 0 when first run, must be 1 when second run"})); + return ge::FAILED; } diff --git a/inc/framework/common/profiling/ge_profiling.h b/inc/framework/common/profiling/ge_profiling.h index a8de56a8..7a238b2f 100644 --- a/inc/framework/common/profiling/ge_profiling.h +++ b/inc/framework/common/profiling/ge_profiling.h @@ -43,6 +43,11 @@ GE_FUNC_VISIBILITY ge::Status RegProfCtrlCallback(MsprofCtrlCallback func); GE_FUNC_VISIBILITY ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func); GE_FUNC_VISIBILITY ge::Status RegProfReporterCallback(MsprofReporterCallback func); GE_FUNC_VISIBILITY ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t len); + +/// +/// @brief Output the profiling data of single operator in Pytorch, and does not support multithreading +/// @return Status result +/// GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream); #endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ diff --git a/tests/depends/profiler/src/profiler_stub.cc b/tests/depends/profiler/src/profiler_stub.cc index 1ed49fd8..0b8eaa88 100644 --- a/tests/depends/profiler/src/profiler_stub.cc +++ b/tests/depends/profiler/src/profiler_stub.cc @@ -16,6 +16,7 @@ #include "toolchain/prof_engine.h" #include "toolchain/prof_mgr_core.h" +#include "runtime/base.h" void * ProfMgrStartUp(const ProfMgrCfg *cfg) { @@ -32,3 +33,10 @@ int Msprof::Engine::RegisterEngine(const std::string& module, const Msprof::Engi return 0; } +rtError_t rtSetMsprofReporterCallback(MsprofReporterCallback callback) { + return 0; +} + +rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCallback callback) { + return 0; +} diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 3ea4d1a7..25fe4947 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -158,6 +158,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_builder_manager.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/model_manager.cc" "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" + "${GE_CODE_DIR}/ge/common/profiling/ge_profiling.cc" "${GE_CODE_DIR}/ge/graph/manager/host_mem_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/memory_api.cc" "${GE_CODE_DIR}/ge/session/inner_session.cc" diff --git a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc index 9c615317..aae3f535 100644 --- a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc +++ b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc @@ -25,6 +25,7 @@ #define private public #include "common/profiling/profiling_manager.h" #include "graph/ge_local_context.h" +#include "inc/framework/common/profiling/ge_profiling.h" #undef protected #undef private @@ -115,4 +116,20 @@ TEST_F(UtestGeProfilinganager, get_fp_bp_point_empty) { ProfilingManager::Instance().GetFpBpPoint(fp_point, bp_point); EXPECT_EQ(fp_point, ""); EXPECT_EQ(bp_point, ""); -} \ No newline at end of file +} + +TEST_F(UtestGeProfilinganager, set_step_info_success) { + uint64_t index_id = 0; + auto stream = (rtStream_t)0x1; + Status ret = ProfSetStepInfo(index_id, 0, stream); + EXPECT_EQ(ret, ge::SUCCESS); + ret = ProfSetStepInfo(index_id, 1, stream); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST_F(UtestGeProfilinganager, set_step_info_failed) { + uint64_t index_id = 0; + auto stream = (rtStream_t)0x1; + Status ret = ProfSetStepInfo(index_id, 1, stream); + EXPECT_EQ(ret, ge::FAILED); +} From 75429f81a033a9de1b975936948aa6310b68523c Mon Sep 17 00:00:00 2001 From: wqtshg Date: Fri, 25 Jun 2021 10:22:30 +0800 Subject: [PATCH 087/226] update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 9e4a51a9..f3f137de 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 9e4a51a9602195b82e326b853f5adbfefc3972b6 +Subproject commit f3f137de034885f0c7394d7f04b41b08d450d2d2 diff --git a/parser b/parser index 79536a19..15a27afe 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 79536a196f89cf7a1f5852ff7304b9a7d7b12eff +Subproject commit 15a27afefe45f2abdb78787d629163aab9437599 From 6ab6ee4c72aae0b3cc3752a9edb9c62ce8a5bb2f Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Fri, 25 Jun 2021 11:15:15 +0800 Subject: [PATCH 088/226] add ptr checker --- ge/hybrid/common/tensor_value.h | 3 ++- ge/hybrid/executor/hybrid_model_async_executor.cc | 12 ++++++++---- ge/hybrid/executor/hybrid_model_async_executor.h | 4 ++-- .../hybrid/executor/hybrid_model_async_executor_unittest.cc | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ge/hybrid/common/tensor_value.h b/ge/hybrid/common/tensor_value.h index c20074fd..c041263b 100644 --- a/ge/hybrid/common/tensor_value.h +++ b/ge/hybrid/common/tensor_value.h @@ -95,7 +95,8 @@ class TensorValue { name_ = name; } - MemStorageType GetMemType() const { + Status GetMemType(MemStorageType &mem_type) const { + GE_CHECK_NOTNULL(buffer_); return buffer_->GetMemType(); } diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index a6f31522..e0dd768d 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -458,7 +458,8 @@ Status HybridModelAsyncExecutor::CopyOutputs(HybridModelExecutor::ExecuteArgs &a auto tensor = TensorAdapter::AsTensor(ge_tensor); outputs.emplace_back(std::move(tensor)); } else { - BuildDeviceTensor(output_tensor, ge_tensor_desc, output_size, outputs); + GE_CHK_STATUS_RET(BuildDeviceTensor(output_tensor, ge_tensor_desc, output_size, outputs), + "Build device tensor failed"); output_data->blobs.emplace_back(output_tensor.Release(), static_cast(output_size), false, static_cast(kPlacementDevice)); } @@ -478,13 +479,15 @@ Status HybridModelAsyncExecutor::CopyOutputs(HybridModelExecutor::ExecuteArgs &a return SUCCESS; } -void HybridModelAsyncExecutor::BuildDeviceTensor(TensorValue &output_tensor, GeTensorDesc &ge_tensor_desc, - int64_t output_size, std::vector &outputs) { +Status HybridModelAsyncExecutor::BuildDeviceTensor(TensorValue &output_tensor, GeTensorDesc &ge_tensor_desc, + int64_t output_size, std::vector &outputs) { GELOGD("Start to build device tensor"); - auto mem_type = output_tensor.GetMemType(); + MemStorageType mem_type = HBM; + GE_CHK_STATUS_RET(output_tensor.GetMemType(mem_type), "[Build][DeviceTensor] Get mem type failed"); GELOGD("Mem type is %d", static_cast(mem_type)); auto deleter = [=](uint8_t *device_data) { if (device_data != nullptr) { + GELOGD("Free device addr is %p", device_data); if (mem_type == RDMA_HBM) { MemManager::Instance().RdmaPoolInstance(RT_MEMORY_HBM).Free(device_data, device_id_); } else if (mem_type == HOST_DDR) { @@ -499,6 +502,7 @@ void HybridModelAsyncExecutor::BuildDeviceTensor(TensorValue &output_tensor, GeT auto tensor = TensorAdapter::AsTensor(ge_tensor); tensor.SetData(reinterpret_cast(output_tensor.Release()), static_cast(output_size), deleter); outputs.emplace_back(std::move(tensor)); + return SUCCESS; } Status HybridModelAsyncExecutor::Execute(const std::vector &inputs, diff --git a/ge/hybrid/executor/hybrid_model_async_executor.h b/ge/hybrid/executor/hybrid_model_async_executor.h index 5ae1a222..f94f6aa5 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.h +++ b/ge/hybrid/executor/hybrid_model_async_executor.h @@ -76,8 +76,8 @@ class HybridModelAsyncExecutor { OutputData *output_data); Status CopyOutputs(HybridModelExecutor::ExecuteArgs &args, OutputData *output_data, std::vector &outputs); - void BuildDeviceTensor(TensorValue &output_tensor, GeTensorDesc &ge_tensor_desc, int64_t output_size, - std::vector &outputs); + Status BuildDeviceTensor(TensorValue &output_tensor, GeTensorDesc &ge_tensor_desc, int64_t output_size, + std::vector &outputs); Status OnComputeDone(uint32_t data_index, uint32_t result_code, std::vector &outputs); diff --git a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc index 98bb78f2..f772af23 100644 --- a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc @@ -82,7 +82,7 @@ TEST_F(UtestHybridModelAsyncExecutor, BuildDeviceTensor) { GeTensorDesc ge_tensor_desc; int64_t output_size = 100; std::vector outputs; - executor.BuildDeviceTensor(tensor, ge_tensor_desc, output_size, outputs); + auto ret = executor.BuildDeviceTensor(tensor, ge_tensor_desc, output_size, outputs); auto size = tensor.GetSize(); ASSERT_EQ(size, 100); } From 01e49940a6393583c274271fdba7119f689a9d6c Mon Sep 17 00:00:00 2001 From: wuweikang Date: Thu, 13 May 2021 16:14:41 +0800 Subject: [PATCH 089/226] add copy graph --- ge/graph/manager/graph_manager.cc | 2 +- ge/hybrid/model/hybrid_model.h | 1 + ge/hybrid/model/hybrid_model_builder.cc | 47 +++++++++++++++++----- ge/hybrid/model/hybrid_model_builder.h | 1 + ge/model/ge_root_model.h | 5 +++ .../hybrid/executor/subgraph_executor_unittest.cc | 3 ++ .../hybrid/model/hybrid_model_builder_unittest.cc | 26 +++++++++--- 7 files changed, 70 insertions(+), 15 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 0a4633ad..0b27fdf3 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -3139,10 +3139,10 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { } // Avoid repeatively prerun for graphs owns same graph_id in online inference concurrency if (count > 1 && graph_node->GetBuildFlag()) { - graph_node->Lock(); GELOGD("Avoid repeatively prerun, graph_id:%u.", args.graph_id); // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); + graph_node->Lock(); graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); diff --git a/ge/hybrid/model/hybrid_model.h b/ge/hybrid/model/hybrid_model.h index 9821242a..77246e20 100644 --- a/ge/hybrid/model/hybrid_model.h +++ b/ge/hybrid/model/hybrid_model.h @@ -147,6 +147,7 @@ class HybridModel { GeRootModelPtr ge_root_model_; std::map input_nodes_; ComputeGraphPtr root_graph_; + ComputeGraphPtr orig_root_graph_; std::map device_variable_nodes_; //lint !e148 std::map host_variable_nodes_; //lint !e148 std::map> variable_tensors_; diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index bb405605..351f8a02 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -147,6 +147,7 @@ Status HybridModelBuilder::Build() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); hybrid_model_.model_name_ = ge_root_model_->GetModelName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); + GE_CHK_STATUS_RET(CopyGraph(), "[Invoke][CopyGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitRuntimeParams(), "[Invoke][InitRuntimeParams] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(RecoverGraphUnknownFlag(), "[Invoke][RecoverGraphUnknownFlag] failed, model_name_:[%s]", GetGraphName()); @@ -171,11 +172,12 @@ Status HybridModelBuilder::Build() { Status HybridModelBuilder::BuildForSingleOp() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); + hybrid_model_.root_graph_ = ge_root_model_->GetRootGraph(); hybrid_model_.model_name_ = ge_root_model_->GetRootGraph()->GetName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); auto ret = ge_root_model_->GetSubgraphInstanceNameToModel(); - const GeModelPtr ge_model = ret[ge_root_model_->GetRootGraph()->GetName()]; - GE_CHK_STATUS_RET(IndexTaskDefs(ge_root_model_->GetRootGraph(), ge_model), + const GeModelPtr ge_model = ret[hybrid_model_.root_graph_->GetName()]; + GE_CHK_STATUS_RET(IndexTaskDefs(hybrid_model_.root_graph_, ge_model), "[Invoke][IndexTaskDefs] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(LoadGraph(), "[Invoke][LoadGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitWeights(), "[Invoke][InitWeights] failed, model_name_:[%s]", GetGraphName()); @@ -190,6 +192,29 @@ Status HybridModelBuilder::ValidateParams() { return SUCCESS; } +Status HybridModelBuilder::CopyGraph() { + GELOGD("Copy compute graph begin."); + auto root_graph = ge_root_model_->GetRootGraph(); + + ge_root_model_->IncreaseBuildTimes(); + std::string new_graph_name = ge_root_model_->GetRootGraph()->GetName() + "_" + + std::to_string(ge_root_model_->GetBuildTimes()); + ComputeGraphPtr new_root_graph = MakeShared(new_graph_name); + GE_CHECK_NOTNULL(new_root_graph); + int32_t depth = 0; + std::map node_old_2_new; + std::map op_desc_old_2_new; + graphStatus ret = GraphUtils::CopyComputeGraph(root_graph, new_root_graph, node_old_2_new, op_desc_old_2_new, depth); + if (ret != GRAPH_SUCCESS) { + GELOGE(GRAPH_FAILED, "Copy compute graph failed."); + return GRAPH_FAILED; + } + hybrid_model_.root_graph_ = new_root_graph; + + GELOGD("Copy compute graph[%s] success.", new_graph_name.c_str()); + return SUCCESS; +} + Status HybridModelBuilder::BuildNodeItem(const NodePtr &node, NodeItem &node_item) { auto op_desc = node->GetOpDesc(); GE_CHK_STATUS_RET(ParseForceInfershapeNodes(node, node_item), @@ -814,12 +839,13 @@ Status HybridModelBuilder::BuildOutputMapping(GraphItem &graph_item, } Status HybridModelBuilder::LoadGraph() { - auto root_graph = ge_root_model_->GetRootGraph(); + auto root_graph = hybrid_model_.root_graph_; if (!GetContext().GetHostExecFlag()) { std::shared_ptr merged_graph; GELOGI("Before merging subgraphs DirectNodesSize = %zu, GetAllNodesSize = %zu", root_graph->GetDirectNodesSize(), root_graph->GetAllNodesSize()); + hybrid_model_.orig_root_graph_ = root_graph; GE_CHK_GRAPH_STATUS_RET(UnfoldSubgraphs(root_graph, merged_graph), "[Invoke][UnfoldSubgraphs]Failed to unfold subgraphs, model_name_:%s.", GetGraphName()); root_graph = std::move(merged_graph); @@ -877,6 +903,7 @@ Status HybridModelBuilder::LoadGraph() { } for (auto &it : hybrid_model_.known_shape_sub_models_) { auto node_item = MutableNodeItem(it.first); + GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); @@ -1125,7 +1152,9 @@ Status HybridModelBuilder::InitWeights() { sub_weight_buffer->GetSize()); auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); if (subgraph != ge_root_model_->GetRootGraph()) { - subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); + subgraph = hybrid_model_.root_graph_->GetSubgraph(subgraph_model.first); + } else { + subgraph = hybrid_model_.root_graph_; } GE_CHECK_NOTNULL(subgraph); hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); @@ -1304,7 +1333,7 @@ Status HybridModelBuilder::IndexTaskDefs(const ComputeGraphPtr &sub_graph, const } Status HybridModelBuilder::IndexTaskDefs() { - const auto root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; const auto &root_graph_name = root_graph->GetName(); if (SetOutputNameAttr(*root_graph) != SUCCESS) { GELOGW("Set output name attr failed."); @@ -1338,7 +1367,7 @@ Status HybridModelBuilder::IndexTaskDefs() { Status HybridModelBuilder::IndexSpecialNodes() { GELOGD("Start to index special nodes"); - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); @@ -1493,7 +1522,7 @@ Status HybridModelBuilder::InitRuntimeParams() { runtime_param_.session_id = ret ? static_cast(value) : 0; ret = ge::AttrUtils::GetInt(first_model, ATTR_MODEL_TASK_GEN_VAR_ADDR, value); runtime_param_.logic_var_base = ret ? static_cast(value) : 0; - runtime_param_.graph_id = ge_root_model_->GetRootGraph()->GetGraphID(); + runtime_param_.graph_id = hybrid_model_.root_graph_->GetGraphID(); value = 0; for (auto &it : ge_root_model_->GetSubgraphInstanceNameToModel()) { (void) ge::AttrUtils::GetInt(it.second, ATTR_MODEL_VAR_SIZE, value); @@ -1630,7 +1659,7 @@ Status HybridModelBuilder::TransAllVarData() { } Status HybridModelBuilder::CopyVarData() { - GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(ge_root_model_->GetRootGraph(), + GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(hybrid_model_.root_graph_, runtime_param_.session_id, hybrid_model_.device_id_), "[Invoke][CopyVarData] failed."); @@ -1713,7 +1742,7 @@ Status HybridModelBuilder::LoadKnownShapedSubgraph(ComputeGraph &graph, NodeItem } Status HybridModelBuilder::RecoverGraphUnknownFlag() { - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &sub_graph : root_graph->GetAllSubgraphs()) { GE_CHECK_NOTNULL(sub_graph); for (const auto &node : sub_graph->GetDirectNode()) { diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 9c1eb187..05830e82 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -56,6 +56,7 @@ class HybridModelBuilder { Status BuildOutputMapping(GraphItem &partitioned_call, const NodeItem &node_item, bool is_root_graph); Status ValidateParams(); Status LoadGraph(); + Status CopyGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); static Status InitHcclExecutorOnDemand(const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index 9e8e116e..b6e3d081 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -60,6 +60,10 @@ class GeRootModel { bool GetTrainFlag() const { return train_flag_; } + int32_t GetBuildTimes() const { return hybrid_build_times_; } + + void IncreaseBuildTimes() { hybrid_build_times_++; } + private: ComputeGraphPtr root_graph_ = nullptr; std::map subgraph_instance_name_to_model_; @@ -69,6 +73,7 @@ class GeRootModel { bool train_flag_ = false; std::string model_name_; bool is_specific_stream_ = false; + int32_t hybrid_build_times_ = 0; }; } // namespace ge using GeRootModelPtr = std::shared_ptr; diff --git a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc index 2dc3b639..827705ae 100644 --- a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc @@ -249,6 +249,9 @@ TEST_F(UtestSubgraphExecutor, cond_graph_schedule_tasks) { graph_context.callback_manager = std::unique_ptr(new CallbackManager()); ASSERT_EQ(graph_context.callback_manager->Init(), SUCCESS); + auto root_graph = hybrid_model.root_graph_; + switch_t = root_graph->FindNode("switch_t"); + switch_f = root_graph->FindNode("switch_f"); const auto node_it_t = hybrid_model.node_items_.find(switch_t); const auto node_it_f = hybrid_model.node_items_.find(switch_f); ASSERT_NE(hybrid_model.node_items_.end(), node_it_t); diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 5567aca2..10f7c0fe 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -214,11 +214,17 @@ TEST_F(UtestHybridModelBuilder, normal_hybrid_model_build) { ASSERT_EQ(it->second->frame_index_, index); ASSERT_EQ(it->second->parent_frame_, -1); }; - TestFrameGroup(enter1, control_group_index); - TestFrameGroup(active1, control_group_index); - TestFrameGroup(active2, control_group_index); - TestFrameGroup(active3, control_group_index); - TestFrameGroup(output1, -1); + auto root_graph = hybrid_model.root_graph_; + auto enter1_node = root_graph->FindNode("enter"); + auto active1_node = root_graph->FindNode("active1"); + auto active2_node = root_graph->FindNode("active2"); + auto active3_node = root_graph->FindNode("active3"); + auto output1_node = root_graph->FindNode("net_output"); + TestFrameGroup(enter1_node, control_group_index); + TestFrameGroup(active1_node, control_group_index); + TestFrameGroup(active2_node, control_group_index); + TestFrameGroup(active3_node, control_group_index); + TestFrameGroup(output1_node, -1); engine_mapping.clear(); task_executor.clear(); @@ -373,4 +379,14 @@ TEST_F(UtestHybridModelBuilder, TestInitHcclExecutorOnDemand) { NodeExecutorManager::GetInstance().builders_.erase(NodeExecutorManager::ExecutorType::HCCL); ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); } + +TEST_F(UtestHybridModelBuilder, copy_graph_success) { +ComputeGraphPtr graph = std::make_shared("test"); +GeRootModelPtr ge_root_model = make_shared(graph); +HybridModel hybrid_model(ge_root_model); +HybridModelBuilder hybrid_model_builder(hybrid_model); + +Status st = hybrid_model_builder.CopyGraph(); +EXPECT_EQ(st, SUCCESS); +} } // namespace ge From ae488883304a78b6dc802a0f090a9d22ffa96af7 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Thu, 24 Jun 2021 21:31:30 +0800 Subject: [PATCH 090/226] modify ge_log_error --- ge/executor/ge_executor.cc | 276 ++++++++++++++++++++++++------------ ge/graph/build/label_allocator.cc | 3 +- inc/framework/common/debug/ge_log.h | 7 +- 3 files changed, 194 insertions(+), 92 deletions(-) diff --git a/ge/executor/ge_executor.cc b/ge/executor/ge_executor.cc index 486764bd..73cd7bb5 100755 --- a/ge/executor/ge_executor.cc +++ b/ge/executor/ge_executor.cc @@ -125,34 +125,41 @@ void SetDynamicInputDataFlag(const ge::RunModelData &input_data, const std::vect bool IsDynamicBatchSizeMatchModel(uint64_t batch_size, const vector> &batch_info) { if (batch_info.empty()) { - GELOGE(ge::FAILED, "Dynamic batch info is empty."); + REPORT_INNER_ERROR("E19999", "param Dynamic batch info is empty, check invalid."); + GELOGE(ge::FAILED, "[Check][Param] Dynamic batch info is empty."); return false; } for (auto batch : batch_info) { if (batch.size() != kDynamicBatchSizeVecSize) { - GELOGE(ge::FAILED, "Dynamic batch param num is %zu, current batch size is %zu.", kDynamicBatchSizeVecSize, - batch.size()); + REPORT_INNER_ERROR("E19999", "Dynamic batch param num is %zu, current batch size is %zu.", + kDynamicBatchSizeVecSize, batch.size()); + GELOGE(ge::FAILED, "[Check][Param] Dynamic batch param num is %zu, current batch size is %zu.", + kDynamicBatchSizeVecSize, batch.size()); return false; } if (batch[0] == static_cast(batch_size)) { return true; } } - GELOGE(ge::FAILED, "Dynamic batch %lu can not match the gear of model.", batch_size); + REPORT_INNER_ERROR("E19999", "Dynamic batch %lu can not match the gear of model.", batch_size); + GELOGE(ge::FAILED, "[Check][Param] Dynamic batch %lu can not match the gear of model.", batch_size); return false; } bool IsDynamicImageSizeMatchModel(uint64_t image_height, uint64_t image_width, const vector> &batch_info) { if (batch_info.empty()) { - GELOGE(ge::FAILED, "Dynamic batch info is empty."); + REPORT_INNER_ERROR("E19999", "ParamDynamic batch info is empty. check invalid"); + GELOGE(ge::FAILED, "[Check][Param] Dynamic batch info is empty."); return false; } for (auto resolution : batch_info) { if (resolution.size() != kDynamicImageSizeVecSize) { - GELOGE(ge::FAILED, "Dynamic resolution param num is %zu, current resolution size is %zu.", + REPORT_INNER_ERROR("E19999", "Dynamic resolution param num is %zu, current resolution size is %zu.", + kDynamicImageSizeVecSize, resolution.size()); + GELOGE(ge::FAILED, "[Check][Param] Dynamic resolution param num is %zu, current resolution size is %zu.", kDynamicImageSizeVecSize, resolution.size()); return false; } @@ -160,22 +167,28 @@ bool IsDynamicImageSizeMatchModel(uint64_t image_height, uint64_t image_width, return true; } } - - GELOGE(ge::FAILED, "Dynamic resolution (%lu,%lu) can not match the gear of model.", image_height, image_width); + REPORT_INNER_ERROR("E19999", "Dynamic resolution (%lu,%lu) can not match the gear of model.", + image_height, image_width); + GELOGE(ge::FAILED, "[Check][Param]Dynamic resolution (%lu,%lu) can not match the gear of model.", + image_height, image_width); return false; } bool IsDynmaicDimsSizeMatchModel(const vector cur_dynamic_dims, const vector> &batch_info) { if (batch_info.empty()) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Dynamic batch info is empty."); + REPORT_INNER_ERROR("E19999", "param batch_info is empty, check invalid"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Param] Dynamic batch info is empty."); return false; } bool find_match = false; for (auto resolution : batch_info) { if (cur_dynamic_dims.size() != resolution.size()) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Cur dynamic dims param num is %zu, current resolution size is %zu.", + REPORT_INNER_ERROR("E19999", "Cur dynamic dims param num is %zu, current resolution size is %zu.", + cur_dynamic_dims.size(), resolution.size()); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, + "[Check][Param] Cur dynamic dims param num is %zu, current resolution size is %zu.", cur_dynamic_dims.size(), resolution.size()); return false; } @@ -192,7 +205,7 @@ bool IsDynmaicDimsSizeMatchModel(const vector cur_dynamic_dims, } } if (!find_match) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "choose dynamic dims can not match the gear of model."); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Param] choose dynamic dims can not match the gear of model."); } return find_match; } @@ -241,7 +254,7 @@ Status GeExecutor::Initialize() { Status init_hostcpu_engine_status = HostCpuEngine::GetInstance().Initialize(); if (init_hostcpu_engine_status != SUCCESS) { - GELOGE(init_hostcpu_engine_status, "Failed to initialize HostCpuEngine"); + GELOGE(init_hostcpu_engine_status, "[initialize][HostCpuEngine] failed"); return init_hostcpu_engine_status; } @@ -251,12 +264,12 @@ Status GeExecutor::Initialize() { mem_type.push_back(RT_MEMORY_P2P_DDR); auto ret = MemManager::Instance().Initialize(mem_type); if (ret != SUCCESS) { - GELOGE(ret, "Memory Manager init failed."); + GELOGE(ret, "[Initialize][MemManager] failed."); return ret; } GE_CHK_STATUS_RET(OpsKernelBuilderManager::Instance().Initialize({}, false), - "Failed to initialize OpsKernelBuilders."); + "[Initialize][OpsKernelBuilderManager] failed."); // Start profiling Options profiling_options; @@ -292,13 +305,18 @@ Status GeExecutor::Finalize() { Status GeExecutor::SetDynamicBatchSize(uint32_t model_id, void *dynamic_input_addr, uint64_t length, uint64_t batch_size) { if (dynamic_input_addr == nullptr) { - GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic input addr is nullptr!"); + REPORT_INNER_ERROR("E19999", "param dynamic_input_addr is nullptr, check invalid, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, + "[Check][Param] Dynamic input addr is nullptr, model id:%u", model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID; } uint64_t size = sizeof(uint32_t); if (length < size) { - GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, "Dynamic input size [%lu] is less than [%lu]!", length, size); + REPORT_INNER_ERROR("E19999", "Dynamic input size [%lu] is less than [%lu], check invalid, model id:%u", + length, size, model_id); + GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, + "[Check][Param] Dynamic input size [%lu] is less than [%lu], model id:%u", length, size, model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } if (length >= sizeof(uint64_t)) { @@ -311,24 +329,28 @@ Status GeExecutor::SetDynamicBatchSize(uint32_t model_id, void *dynamic_input_ad int32_t dynamic_type = static_cast(FIXED); Status ret = GraphExecutor::GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Get dynamic input info failed."); + REPORT_CALL_ERROR("E19999", "get dynamic batch info failed, model id:%u", model_id); + GELOGE(ret, "[Get][DynamicBatchInfo] failed, model id:%u.", model_id); return ret; } if (!IsDynamicBatchSizeMatchModel(batch_size, batch_info)) { - GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, "The current dynamic input does not match the gear of the model."); + GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, + "[Check][Param] The current dynamic input does not match the gear of the model(id:%u).", model_id); return ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID; } ret = GraphExecutor::SetDynamicSize(model_id, batch_num, static_cast(DYNAMIC_BATCH)); if (ret != SUCCESS) { - GELOGE(ret, "Set dynamic size failed"); + REPORT_CALL_ERROR("E19999", "set dynamic size failed, model id:%u, dynamic_type:1", model_id); + GELOGE(ret, "[Set][DynamicSize] failed, model id:%u, dynamic_type:1", model_id); return ret; } // memcpy dynamic_batch_size from host to device rtError_t rt_ret = rtMemcpy(dynamic_input_addr, length, &batch_size, size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy dynamic batch input data failed! ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy, size:%lu ret:0x%X", length, rt_ret); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy dynamic batch input data failed! size:%lu ret:0x%X", length, rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } return SUCCESS; @@ -337,14 +359,19 @@ Status GeExecutor::SetDynamicBatchSize(uint32_t model_id, void *dynamic_input_ad Status GeExecutor::SetDynamicImageSize(uint32_t model_id, void *dynamic_input_addr, uint64_t length, uint64_t image_height, uint64_t image_width) { if (dynamic_input_addr == nullptr) { - GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic input addr is nullptr!"); + REPORT_INNER_ERROR("E19999", "param dynamic_input_addr is nullptr, check invalid, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, + "[Check][Param] Dynamic input addr is nullptr, model id:%u", model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID; } uint64_t dynamic_input_size = kDynamicImageSizeInputSize * sizeof(uint32_t); if (length < dynamic_input_size) { + REPORT_INNER_ERROR("E19999", "Dynamic input size [%lu] is less than [%lu], check invalid, model id:%u", + length, dynamic_input_size, model_id); GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, - "Dynamic input size [%lu] is less than [%lu]!", length, dynamic_input_size); + "[Check][Param] Dynamic input size [%lu] is less than [%lu], model id:%u", + length, dynamic_input_size, model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } uint64_t size = sizeof(uint32_t); @@ -357,18 +384,22 @@ Status GeExecutor::SetDynamicImageSize(uint32_t model_id, void *dynamic_input_ad int32_t dynamic_type = static_cast(FIXED); Status ret = GraphExecutor::GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Get dynamic input info failed."); + REPORT_CALL_ERROR("E19999", "Get dynamic input info failed, model id:%u.", model_id); + GELOGE(ret, "[Get][DynamicBatchInfo] failed, model id:%u.", model_id); return ret; } if (!IsDynamicImageSizeMatchModel(image_height, image_width, batch_info)) { - GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, "The current dynamic input does not match the gear of the model."); + GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, + "[Check][Param] The current dynamic input does not match the gear of the model, " + "image_height:%lu, image_width:%lu.", image_height, image_width); return ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID; } ret = GraphExecutor::SetDynamicSize(model_id, batch_num, static_cast(DYNAMIC_IMAGE)); if (ret != SUCCESS) { - GELOGE(ret, "Set dynamic size failed"); + REPORT_CALL_ERROR("E19999", "Set dynamic size failed, model id:%u,", model_id); + GELOGE(ret, "[Set][DynamicSize] failed, model id:%u", model_id); return ret; } @@ -376,7 +407,9 @@ Status GeExecutor::SetDynamicImageSize(uint32_t model_id, void *dynamic_input_ad rtError_t rt_ret = rtMemcpy(dynamic_input_addr, size, &image_height, size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy dynamic resolution input data failed! ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed! size:%lu, ret:0x%X, model id:%u", size, rt_ret, model_id); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy dynamic resolution input data failed! size:%lu, ret:0x%X, model id:%u", + size, rt_ret, model_id); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -385,7 +418,10 @@ Status GeExecutor::SetDynamicImageSize(uint32_t model_id, void *dynamic_input_ad rt_ret = rtMemcpy(reinterpret_cast(reinterpret_cast(dynamic_input_addr) + size), remain_size, &image_width, size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy dynamic resolution input data failed!"); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed! size:%lu, ret:0x%X, model id:%u", + remain_size, rt_ret, model_id); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy dynamic resolution input data failed! size:%lu, ret:0x%X, model id:%u", + remain_size, rt_ret, model_id); return RT_ERROR_TO_GE_STATUS(rt_ret); } return SUCCESS; @@ -394,40 +430,48 @@ Status GeExecutor::SetDynamicImageSize(uint32_t model_id, void *dynamic_input_ad Status GeExecutor::SetDynamicDims(uint32_t model_id, void *dynamic_input_addr, uint64_t length, const vector &dynamic_dims) { if (dynamic_input_addr == nullptr) { - GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic input addr is nullptr!"); + REPORT_INNER_ERROR("E19999", "Param dynamic_input_addr is nullptr, check invalid, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, + "[Check][Param] Dynamic input addr is nullptr, model id:%u", model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID; } vector cur_dynamic_dims; Status ret = GetCurDynamicDims(model_id, dynamic_dims, cur_dynamic_dims); if (ret != SUCCESS) { - GELOGE(ret, "Set cur gear dynamic dims failed"); + GELOGE(ret, "[Get][CurDynamicDims] failed, model id:%u", model_id); return ret; } std::vector> batch_info; int32_t dynamic_type = static_cast(FIXED); ret = GraphExecutor::GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Get dynamic input info failed."); + REPORT_CALL_ERROR("E19999", "Get dynamic input info failed, model id:%u.", model_id); + GELOGE(ret, "[Get][DynamicBatchInfo] failed, model id:%u.", model_id); return ret; } if (!IsDynmaicDimsSizeMatchModel(cur_dynamic_dims, batch_info)) { - GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, "The current dynamic input does not match the gear of the model."); + GELOGE(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, + "[Check][Param] The current dynamic input does not match the gear of the model, id:%u.", model_id); return ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID; } ret = GraphExecutor::SetDynamicSize(model_id, cur_dynamic_dims, static_cast(DYNAMIC_DIMS)); if (ret != SUCCESS) { - GELOGE(ret, "Set dynamic size failed"); + REPORT_CALL_ERROR("E19999", "Set dynamic size failed, model id:%u", model_id); + GELOGE(ret, "[Set][DynamicSize] failed, model id:%u", model_id); return ret; } size_t dynamic_dim_num = cur_dynamic_dims.size(); uint64_t dynamic_input_size = static_cast(dynamic_dim_num * sizeof(uint32_t)); if (length < dynamic_input_size) { + REPORT_INNER_ERROR("E19999", "input dynamic size [%lu] is less than [%lu], model id:%u", + length, dynamic_input_size, model_id); GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, - "Dynamic input size [%lu] is less than [%lu]!", length, dynamic_input_size); + "[Check][Param] Dynamic input size [%lu] is less than [%lu], model id:%u", + length, dynamic_input_size, model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } uint64_t size = sizeof(uint32_t); @@ -440,7 +484,9 @@ Status GeExecutor::SetDynamicDims(uint32_t model_id, void *dynamic_input_addr, u rt_ret = rtMemcpy(reinterpret_cast(reinterpret_cast(dynamic_input_addr) + size * i), length - size * i, &cur_dynamic_dims[i], size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy dynamic resolution input data failed!"); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%lu, ret:0x%X", (length - size * i), rt_ret); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy dynamic resolution input data failed! size:%lu, ret:0x%X", + length - size * i, rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } } @@ -454,14 +500,14 @@ Status GeExecutor::GetCurDynamicDims(uint32_t model_id, const vector & vector output_desc; auto ret = GetModelDescInfo(model_id, input_desc, output_desc); if (ret != ge::SUCCESS) { - GELOGE(ret, "GetModelDescInfo failed."); + GELOGE(ret, "[Get][ModelDescInfo] failed, model id:%u.", model_id); return ret; } vector user_designate_shape_order; vector all_data_dims; ret = GetUserDesignateShapeOrder(model_id, user_designate_shape_order); if (ret != ge::SUCCESS) { - GELOGE(ret, "GetUserDesignateShapeOrder failed."); + GELOGE(ret, "[Call][GetUserDesignateShapeOrder] failed, model id:%u.", model_id); return ret; } for (auto &data_name : user_designate_shape_order) { @@ -475,8 +521,10 @@ Status GeExecutor::GetCurDynamicDims(uint32_t model_id, const vector & } } if (dynamic_dims.size() != all_data_dims.size()){ + REPORT_INNER_ERROR("E19999", "Dynamic input size [%lu] is not equal with all data dims size [%lu]!", + dynamic_dims.size(), all_data_dims.size()); GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, - "Dynamic input size [%lu] is not equal with all data dims size [%lu]!", + "[Check][Param] Dynamic input size [%lu] is not equal with all data dims size [%lu]!", dynamic_dims.size(), all_data_dims.size()); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } @@ -484,8 +532,10 @@ Status GeExecutor::GetCurDynamicDims(uint32_t model_id, const vector & if (all_data_dims[i] < 0) { cur_dynamic_dims.push_back(dynamic_dims[i]); } else if (static_cast(all_data_dims[i]) != dynamic_dims[i]) { + REPORT_INNER_ERROR("E19999", "Static dims should be same, index:%zu value:%lu should be %ld", + i, dynamic_dims[i], all_data_dims[i]); GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, - "Static dims should be same, index: %zu value: %lu should be %ld", + "[Check][Param] Static dims should be same, index:%zu value:%lu should be %ld", i, dynamic_dims[i], all_data_dims[i]); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } @@ -496,12 +546,14 @@ Status GeExecutor::GetCurDynamicDims(uint32_t model_id, const vector & Status GeExecutor::GetCurShape(const uint32_t model_id, std::vector &batch_info, int32_t &dynamic_type) { GELOGI("Begin to get current shape"); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized, model id:%u", model_id); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetCurShape(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Get current shape failed"); + REPORT_CALL_ERROR("E19999", "Get Cur Shape failed, model id:%u", model_id); + GELOGE(ret, "[Get][CurShape] failed, model id:%u", model_id); return ret; } return SUCCESS; @@ -512,11 +564,14 @@ Status GeExecutor::SetDynamicAippData(uint32_t model_id, void *dynamic_input_add const kAippDynamicPara &aippParms) { GELOGI("Enter to SetDynamicAippData."); if (dynamic_input_addr == nullptr) { - GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic aipp input addr is nullptr!"); + REPORT_INNER_ERROR("E19999", "Param dynamic_input_addr is nullptr, check invalid, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, + "[Check][Param] Dynamic aipp input addr is nullptr, model id:%u", model_id); return ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID; } if (aippBatchPara.empty()) { - GELOGE(ACL_ERROR_GE_AIPP_BATCH_EMPTY, "aippBatchPara is empty."); + REPORT_INNER_ERROR("E19999", "Param aippBatchPara is empty, check invalid, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_AIPP_BATCH_EMPTY, "[Check][Param] aippBatchPara is empty, model id:%u", model_id); return ACL_ERROR_GE_AIPP_BATCH_EMPTY; } uint64_t batch_num = aippBatchPara.size(); @@ -527,14 +582,18 @@ Status GeExecutor::SetDynamicAippData(uint32_t model_id, void *dynamic_input_add "batch num is %lu, struct_len is %lu", model_id, length, batch_num, struct_len); if (struct_len > length) { + REPORT_INNER_ERROR("E19999", "input dynamic aipp param len:%lu is larger than aipp_data size:%lu", + struct_len, length); GELOGE(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, - "input dynamic aipp param len [%lu] is larger than aipp_data size [%lu]", struct_len, length); + "[Check][Param] input dynamic aipp param len [%lu] is larger than aipp_data size [%lu]", + struct_len, length); return ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID; } // Memcpy real kAippDynamicBatchPara from host to device rtError_t rt_ret = rtMemcpy(dynamic_input_addr, length, &aippParms, real_aippParms_size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy real_aippParms_size failed! ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%lu, ret:0x%X", length, rt_ret); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy aippParms failed! size:%lu, ret:0x%X", length, rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } uint64_t remain_len = length - real_aippParms_size; @@ -545,7 +604,8 @@ Status GeExecutor::SetDynamicAippData(uint32_t model_id, void *dynamic_input_add (remain_len - i * sizeof(kAippDynamicBatchPara)), &(aippBatchPara[i]), sizeof(kAippDynamicBatchPara), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "memcpy kAippDynamicBatchPara input data failed! ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret:0x%X", rt_ret); + GELOGE(rt_ret, "[Call][RtMemcpy] memcpy kAippDynamicBatchPara input data failed! ret:0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } } @@ -555,12 +615,14 @@ Status GeExecutor::SetDynamicAippData(uint32_t model_id, void *dynamic_input_add Status GeExecutor::UnloadModel(uint32_t model_id) { GELOGD("unload model %u begin.", model_id); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphLoader::DestroyAicpuSessionForInfer(model_id); if (ret != SUCCESS) { - GELOGE(ret, "[GraphLoader] DestroyAicpuSessionForInfer failed. model id: %u", model_id); + REPORT_CALL_ERROR("E19999", "Destroy Aicpu Session For Infer failed, model id:%u", model_id); + GELOGE(ret, "[Destroy][AicpuSession] For Infer failed. model id:%u", model_id); return ret; } @@ -578,7 +640,8 @@ Status GeExecutor::UnloadModel(uint32_t model_id) { } ret = GraphLoader::UnloadModel(model_id); if (ret != SUCCESS) { - GELOGE(ret, "[GraphLoader] DestroyAicpuSessionForInfer failed. model id: %u", model_id); + REPORT_CALL_ERROR("E19999", "unload model failed, model id:%u", model_id); + GELOGE(ret, "[Unload][Model] failed. model id:%u", model_id); return ret; } return SUCCESS; @@ -588,7 +651,8 @@ Status GeExecutor::UnloadModel(uint32_t model_id) { Status GeExecutor::GetModelDescInfo(uint32_t model_id, std::vector &input_desc, std::vector &output_desc, bool new_model_desc) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized, model id:%u", model_id); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized, model id:%u", model_id); return ACL_ERROR_GE_EXEC_NOT_INIT; } @@ -600,20 +664,26 @@ Status GeExecutor::GetModelDescInfo(uint32_t model_id, std::vector> &batch_info, int32_t &dynamic_type) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "GetDynamicBatchInfo failed."); + REPORT_CALL_ERROR("E19999", "Get Dynamic BatchInfo failed, model id:%u.", model_id); + GELOGE(ret, "[Get][DynamicBatchInfo] failed, model id:%u.", model_id); return ret; } return SUCCESS; @@ -657,13 +729,15 @@ Status GeExecutor::GetDynamicBatchInfo(uint32_t model_id, std::vector> &batch_info) { GELOGI("Begin to get combined dynamic dims info."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetCombinedDynamicDims(model_id, batch_info); if (ret != SUCCESS) { - GELOGE(ret, "GetCombinedDynamicDims failed."); + REPORT_CALL_ERROR("E19999", "Get Combined DynamicDims failed, model id:%u.", model_id); + GELOGE(ret, "[Get][CombinedDynamicDims] failed, model id:%u.", model_id); return ret; } @@ -680,13 +754,15 @@ Status GeExecutor::GetCombinedDynamicDims(uint32_t model_id, vector &user_designate_shape_order) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetUserDesignateShapeOrder(model_id, user_designate_shape_order); if (ret != SUCCESS) { - GELOGE(ret, "GetUserDesignateShapeOrder failed."); + REPORT_CALL_ERROR("E19999", "GetUserDesignateShapeOrder failed, model id:%u.", model_id); + GELOGE(ret, "[Call][GetUserDesignateShapeOrder] failed, model id:%u.", model_id); return ret; } @@ -704,7 +780,8 @@ Status GeExecutor::GetUserDesignateShapeOrder(uint32_t model_id, vector Status GeExecutor::GetAIPPInfo(uint32_t model_id, uint32_t index, AippConfigInfo &aipp_info) { GELOGI("Begin to GetAIPPInfo."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor not inited yet!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetAippInfo(model_id, index, aipp_info); @@ -719,7 +796,8 @@ Status GeExecutor::GetAIPPInfo(uint32_t model_id, uint32_t index, AippConfigInfo Status GeExecutor::GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index) { GELOGI("Begin to get aipp type."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not inited yet!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetAippType(model_id, index, type, aipp_index); @@ -741,8 +819,10 @@ Status GeExecutor::GetOpAttr(uint32_t model_id, const std::string &op_name, cons } Status ret = GraphExecutor::GetOpAttr(model_id, op_name, attr_name, attr_value); if (ret != SUCCESS) { - GELOGE(ret, "[Get][OpAttr]Get op:%s attr:%s failed.", op_name.c_str(), attr_name.c_str()); - REPORT_CALL_ERROR("E19999", "Get op:%s attr:%s failed.", op_name.c_str(), attr_name.c_str()); + GELOGE(ret, "[Get][OpAttr]Get op:%s attr:%s failed, model id:%u.", + op_name.c_str(), attr_name.c_str(), model_id); + REPORT_CALL_ERROR("E19999", "Get op:%s attr:%s failed, model id:%u", + op_name.c_str(), attr_name.c_str(), model_id); return ret; } return SUCCESS; @@ -750,12 +830,14 @@ Status GeExecutor::GetOpAttr(uint32_t model_id, const std::string &op_name, cons Status GeExecutor::GetModelAttr(uint32_t model_id, std::vector &dynamic_output_shape_info) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not inited yet!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not inited yet!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetModelAttr(model_id, dynamic_output_shape_info); if (ret != SUCCESS) { - GELOGE(ret, "Get dynamic batch output shape info failed."); + REPORT_CALL_ERROR("E19999", "Get Model Attr failed, model id:%u.", model_id); + GELOGE(ret, "[Get][ModelAttr] failed, model id:%u.", model_id); return ret; } return SUCCESS; @@ -764,7 +846,8 @@ Status GeExecutor::GetModelAttr(uint32_t model_id, std::vector &dyn Status GeExecutor::CommandHandle(const Command &command) { Status ret = GraphLoader::CommandHandle(command); if (ret != SUCCESS) { - GELOGE(ACL_ERROR_GE_COMMAND_HANDLE, "CommandHandle: Command Handle failed."); + REPORT_CALL_ERROR("E19999", "call CommandHandle failed, ret:%u", ret); + GELOGE(ACL_ERROR_GE_COMMAND_HANDLE, "[Call][CommandHandle] failed, ret:%u", ret); return ACL_ERROR_GE_COMMAND_HANDLE; } return SUCCESS; @@ -773,7 +856,8 @@ Status GeExecutor::CommandHandle(const Command &command) { Status GeExecutor::GetMaxUsedMemory(uint32_t model_id, uint32_t &max_size) { GELOGI("Get max used memory begin."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } @@ -793,14 +877,15 @@ Status GeExecutor::GetMaxUsedMemory(uint32_t model_id, uint32_t &max_size) { Status GeExecutor::LoadDataFromFile(const std::string &path, ModelData &model_data) { GELOGI("Load data from file begin."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } string filePath = RealPath(path.c_str()); if (filePath.empty()) { GELOGE(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, - "File path is invalid. please check your text file '%s'.", path.c_str()); + "[Call][RealPath] File path is invalid. please check your text file '%s'.", path.c_str()); return ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID; } GELOGI("load modelData from file: %s.", path.c_str()); @@ -829,7 +914,8 @@ Status GeExecutor::LoadDataFromFile(const std::string &path, ModelData &model_da Status GeExecutor::LoadModelFromData(uint32_t &model_id, const ModelData &model_data, void *dev_ptr, size_t mem_size, void *weight_ptr, size_t weight_size) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not inited yet!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } @@ -850,7 +936,8 @@ Status GeExecutor::LoadModelWithQ(uint32_t &model_id, const ModelData &model_dat const std::vector &output_queue_ids) { GELOGI("Load model with queue begin."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } return GraphLoader::LoadModelWithQ(model_id, model_data, input_queue_ids, output_queue_ids); @@ -889,7 +976,8 @@ Status GeExecutor::ExecModel(uint32_t model_id, void *stream, const ge::RunModel const std::vector &input_desc, ge::RunModelData &run_output_data, std::vector &output_desc, bool async_mode) { if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } @@ -904,7 +992,8 @@ Status GeExecutor::ExecModel(uint32_t model_id, void *stream, const ge::RunModel int32_t dynamic_type = static_cast(FIXED); Status ret = GraphExecutor::GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Get dynamic input info failed."); + REPORT_CALL_ERROR("E19999", "get dynamic batch info failed, model id:%u.", model_id); + GELOGE(ret, "[Get][DynamicBatchInfo] failed, model id:%u.", model_id); return ret; } if (!batch_info.empty()) { @@ -926,14 +1015,16 @@ Status GeExecutor::ExecModel(uint32_t model_id, void *stream, const ge::RunModel Status GeExecutor::GetMemAndWeightSize(const std::string &path, size_t &mem_size, size_t &weight_size) { GELOGI("Get memory and weight size from file begin."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } ModelData model; Status ret = ge::GraphLoader::LoadDataFromFile(path, 0, model); if ((ret != SUCCESS) || (model.model_data == nullptr)) { - GELOGE(ret, "Load data from file failed. ret = %d", ret); + REPORT_CALL_ERROR("E19999", "load data from file failed, ret = %d", ret); + GELOGE(ret, "[Load][Data] from file failed. ret = %d", ret); return ret; } @@ -958,12 +1049,14 @@ Status GeExecutor::GetMemAndWeightSize(const void *model_data, size_t model_size size_t &weight_size) { GELOGI("Get memory and weight size from data begin."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } if (model_data == nullptr) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID, "invalid model data!"); + REPORT_INNER_ERROR("E19999", "param model_data is nullptr, check invalid!"); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID, "[Check][Param] invalid model data!"); return ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID; } @@ -997,7 +1090,8 @@ Status GeExecutor::LoadDynamicSingleOpV2(const std::string &model_name, const ge Status GeExecutor::ExecuteAsync(SingleOp *executor, const std::vector &inputs, std::vector &outputs) { if (executor == nullptr) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "param is NULL"); + REPORT_INNER_ERROR("E19999", "Param executor is nullptr, check invalid"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] param executor is nullptr"); return ACL_ERROR_GE_EXEC_NOT_INIT; } @@ -1021,7 +1115,8 @@ Status GeExecutor::GetDeviceIdByModelId(uint32_t model_id, uint32_t &device_id) GE_CHECK_NOTNULL(model_manager); auto davinci_model = model_manager->GetModel(model_id); if (davinci_model == nullptr) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, "Model id: %d is invaild or model is not loaded.", model_id); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, + "[Get][Model] failed, Model id:%u is invaild or model is not loaded.", model_id); return ACL_ERROR_GE_EXEC_MODEL_ID_INVALID; } @@ -1034,7 +1129,7 @@ Status GeExecutor::GetBatchInfoSize(uint32_t model_id, size_t &shape_count) { int32_t dynamic_type = static_cast(FIXED); Status ret = GetDynamicBatchInfo(model_id, batch_info, dynamic_type); if (ret != SUCCESS) { - GELOGE(ret, "Calc batch info size failed. ret = %d", ret); + GELOGE(ret, "[Get][DynamicBatchInfo] failed. ret = %d, model id:%u", ret, model_id); return ret; } if (batch_info.empty()) { @@ -1048,13 +1143,15 @@ Status GeExecutor::GetBatchInfoSize(uint32_t model_id, size_t &shape_count) { Status GeExecutor::GetOrigInputInfo(uint32_t model_id, uint32_t index, OriginInputInfo &orig_input_info) { GELOGI("Begin to GetOrigInputInfo."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetOrigInputInfo(model_id, index, orig_input_info); if (ret != SUCCESS) { - GELOGE(ret, "GetOrigInputInfo failed."); + REPORT_CALL_ERROR("E19999", "Get Orig Input Info failed, model id:%u.", model_id); + GELOGE(ret, "[Get][OrigInputInfo] failed, model id:%u.", model_id); return ret; } @@ -1067,13 +1164,15 @@ Status GeExecutor::GetAllAippInputOutputDims(uint32_t model_id, uint32_t index, std::vector &output_dims) { GELOGI("Begin to GetAllAippInputOutputDims."); if (!isInit_) { - GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "not inited yet!"); + REPORT_INNER_ERROR("E19999", "GeExecutor has not been initialized!"); + GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "[Check][Param] GeExecutor has not been initialized!"); return ACL_ERROR_GE_EXEC_NOT_INIT; } Status ret = GraphExecutor::GetAllAippInputOutputDims(model_id, index, input_dims, output_dims); if (ret != SUCCESS) { - GELOGE(ret, "GetAllAippInputOutputDims failed."); + REPORT_CALL_ERROR("E19999", "Get All Aipp Input Output Dims failed, model id:%u.", model_id); + GELOGE(ret, "[Get][AllAippInputOutputDims] failed, model id:%u.", model_id); return ret; } @@ -1085,7 +1184,10 @@ Status GeExecutor::GetOpDescInfo(uint32_t device_id, uint32_t stream_id, uint32_ GELOGI("Begin to GetOpDescInfo."); Status ret = GraphExecutor::GetOpDescInfo(device_id, stream_id, task_id, op_desc_info); if (ret != SUCCESS) { - GELOGE(ret, "GetOpDescInfo failed."); + REPORT_CALL_ERROR("E19999", "get opdesc info failed, device_id:%u, stream_id:%u, task_id:%u.", + device_id, stream_id, task_id); + GELOGE(ret, "[Get][OpDescInfo] failed, device_id:%u, stream_id:%u, task_id:%u.", + device_id, stream_id, task_id); return ret; } GELOGI("GetOpDescInfo succ."); @@ -1096,7 +1198,7 @@ Status GeExecutor::SetDump(const DumpConfig &dump_config) { GELOGI("Start to set dump config"); auto ret = DumpManager::GetInstance().SetDumpConf(dump_config); if (ret != SUCCESS) { - GELOGE(ret, "Set dump conf failed"); + GELOGE(ret, "[Set][DumpConf] failed, ret:%d", ret); return ret; } GELOGI("Set dump config successfully"); diff --git a/ge/graph/build/label_allocator.cc b/ge/graph/build/label_allocator.cc index 6d81c17d..f2329769 100644 --- a/ge/graph/build/label_allocator.cc +++ b/ge/graph/build/label_allocator.cc @@ -80,8 +80,7 @@ bool LabelAllocator::CollectFunctionalNode(ComputeGraphPtr &graph, std::setGetParentNode(); if (func_node == nullptr) { - REPORT_INNER_ERROR("E19999", "Parent node not set in node:%s(%s), graph:%s", - func_node->GetName().c_str(), func_node->GetType().c_str(), graph->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "Parent node not set, graph:%s", graph->GetName().c_str()); GELOGE(INTERNAL_ERROR, "[Get][Node] Parent functional node not set: %s.", graph->GetName().c_str()); return false; } diff --git a/inc/framework/common/debug/ge_log.h b/inc/framework/common/debug/ge_log.h index 754712f3..3e646440 100644 --- a/inc/framework/common/debug/ge_log.h +++ b/inc/framework/common/debug/ge_log.h @@ -84,9 +84,10 @@ inline bool IsLogEnable(int module_name, int log_level) { ##__VA_ARGS__); \ } while (0) -#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \ - dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \ - ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__) +#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \ + dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) %s" fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \ + ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ErrorManager::GetInstance().GetLogHeader().c_str(), \ + ##__VA_ARGS__) // print memory when it is greater than 1KB. #define GE_PRINT_DYNAMIC_MEMORY(FUNC, PURPOSE, SIZE) \ From 66b63a27ef778deeb3f7df0681e1e41b8fe9d100 Mon Sep 17 00:00:00 2001 From: y00500818 Date: Fri, 25 Jun 2021 16:52:48 +0800 Subject: [PATCH 091/226] bugfix for InitNetOutput --- ge/graph/load/model_manager/davinci_model.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index a00d2b9d..7d82879f 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -1156,7 +1156,6 @@ Status DavinciModel::InitNetOutput(const ComputeGraphPtr &graph, const NodePtr & } size_t num = output_data_info_.size(); - bool fusion_flag = false; size_t input_count = input_size_list.size(); is_getnext_sink_dynamic_ = false; @@ -1166,6 +1165,7 @@ Status DavinciModel::InitNetOutput(const ComputeGraphPtr &graph, const NodePtr & } for (size_t idx = 0; idx < input_count; ++idx) { ZeroCopyOffset zero_copy_offset; + bool fusion_flag = false; Status ret = zero_copy_offset.InitOutputDataInfo(input_size_list, virtual_addr_list, op_desc, idx, fusion_flag); GE_IF_BOOL_EXEC(ret != SUCCESS, GELOGE(PARAM_INVALID, "[Init][DataInfo] of input_info %s failed.", op_desc->GetName().c_str()); From 3af68a42300f54e50f079ebf8ea41b01a02eeb59 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Fri, 25 Jun 2021 20:53:08 +0800 Subject: [PATCH 092/226] Fix Set Control flow group for -1 --- .../passes/mark_force_unknown_for_cond_pass.cc | 97 ++++++++++++---------- ge/graph/passes/mark_force_unknown_for_cond_pass.h | 11 +++ ge/graph/passes/switch_to_stream_switch_pass.cc | 5 +- ge/hybrid/executor/node_state.cc | 35 +++++--- ge/hybrid/executor/node_state.h | 1 + ge/hybrid/model/node_item.cc | 6 +- ge/hybrid/model/node_item.h | 4 +- ge/hybrid/node_executor/node_executor.cc | 1 + ge/hybrid/node_executor/task_context.cc | 6 ++ ge/hybrid/node_executor/task_context.h | 1 + 10 files changed, 108 insertions(+), 59 deletions(-) diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index fbf69c04..233a1ff0 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -16,8 +16,6 @@ #include "graph/passes/mark_force_unknown_for_cond_pass.h" -#include - #include "graph/utils/node_utils.h" #include "graph/common/omg_util.h" @@ -26,17 +24,7 @@ namespace { inline bool IsMergeInLoop(const NodePtr &node) { const static std::set kLoopMergeInputs{ ENTER, REFENTER, NEXTITERATION, REFNEXTITERATION }; - std::string node_type; - (void)GetOriginalType(node, node_type); - return kLoopMergeInputs.count(node_type) > 0; -} - -inline bool IsSwitchInLoop(const NodePtr &node) { - const static std::set kLoopSwitchInputs{ MERGE, REFMERGE, LOOPCOND }; - - std::string node_type; - (void)GetOriginalType(node, node_type); - return kLoopSwitchInputs.count(node_type) > 0; + return kLoopMergeInputs.count(NodeUtils::GetNodeType(node)) > 0; } } @@ -44,10 +32,7 @@ Status MarkForceUnknownForCondPass::Run(ComputeGraphPtr graph) { GELOGD("MarkForceUnknownForCondPass Enter"); std::map> switch_groups; for (const auto &node : graph->GetDirectNode()) { - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(node, node_type), - "[Get][OriginalType] of node in graph:%s failed.", graph->GetName().c_str()); - if (kMergeOpTypes.count(node_type) == 0) { + if (kMergeOpTypes.count(NodeUtils::GetNodeType(node)) == 0) { continue; } @@ -65,6 +50,51 @@ Status MarkForceUnknownForCondPass::Run(ComputeGraphPtr graph) { } /// +/// @brief Deal with Switch node for LoopCond +/// @param [in] Switch node +/// @param [in] dest span +/// @param [out] Search queue +/// @return true: Switch In while loop / false: Not in while Loop. +/// +bool MarkForceUnknownForCondPass::DealWithLoopSwitch(const NodePtr &node, uint32_t dst_span, + std::queue> search_queue) { + /// LoopCond --->\. + /// \. + /// Enter-----------+ \. + /// +--> Merge --> Switch --> Exit + /// NextIteration---+ + const auto is_loop_op = [](const NodePtr &n) { + return NodeUtils::GetNodeType(n) == LOOPCOND; + }; + const auto is_exit_op = [](const NodePtr &n) { + return kExitOpTypes.count(NodeUtils::GetNodeType(n)) > 0; + }; + + const auto src_nodes = node->GetInAllNodes(); + const auto dst_nodes = node->GetOutAllNodes(); + if (std::none_of(src_nodes.begin(), src_nodes.end(), is_loop_op) && + std::none_of(dst_nodes.begin(), dst_nodes.end(), is_exit_op)) { + return false; + } + + for (const auto &m : src_nodes) { + if (kMergeOpTypes.count(NodeUtils::GetNodeType(m)) > 0) { + for (const auto &n : m->GetInAllNodes()) { + if (kNextIterationOpTypes.count(NodeUtils::GetNodeType(n)) > 0) { + continue; + } + + search_queue.push({n, dst_span}); + GELOGD("Travel in Loop: %s <-- %s <-- %s, span is: %u", node->GetName().c_str(), m->GetName().c_str(), + n->GetName().c_str(), dst_span); + } + } + } + + return true; +} + +/// /// @brief Mark force unknown shape for Switch node /// @param [in] merge node /// @param [out] switch group @@ -72,6 +102,7 @@ Status MarkForceUnknownForCondPass::Run(ComputeGraphPtr graph) { /// void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const NodePtr &node, std::vector &switch_group) { // Switch --> {Switch --> Merge} --> Merge + GELOGD("Search Switch node for Merge: %s", node->GetName().c_str()); std::unordered_set nodes_seen; std::queue> search_queue({{node, 0}}); while (!search_queue.empty()) { @@ -79,43 +110,25 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const NodePtr &node, std: const auto dst_span = search_queue.front().second; search_queue.pop(); - // Switch --> Identity --> Constant - for (const auto &in_node : dst_node->GetInControlNodes()) { - if (nodes_seen.count(in_node) > 0) { - GELOGD("Travel node: %s, Skip already seen node: %s", dst_node->GetName().c_str(), in_node->GetName().c_str()); - continue; - } - nodes_seen.insert(in_node); - - if (in_node->GetType() == IDENTITY) { - GELOGD("Travel node: %s, In control: %s, span is: %u", dst_node->GetName().c_str(), - in_node->GetName().c_str(), dst_span); - search_queue.push({in_node, dst_span}); - } - } - - for (const auto &in_node : dst_node->GetInDataNodes()) { + for (const auto &in_node : dst_node->GetInAllNodes()) { if (nodes_seen.count(in_node) > 0) { GELOGD("Travel node: %s, Skip already seen node: %s", dst_node->GetName().c_str(), in_node->GetName().c_str()); continue; } nodes_seen.insert(in_node); - std::string node_type; - (void)GetOriginalType(in_node, node_type); + const std::string node_type = NodeUtils::GetNodeType(in_node); GELOGD("Travel node: %s, %s node: %s, span is: %u", dst_node->GetName().c_str(), node_type.c_str(), in_node->GetName().c_str(), dst_span); if (kSwitchOpTypes.count(node_type) > 0) { // Switch input node. + if (DealWithLoopSwitch(in_node, dst_span, search_queue)) { + continue; + } + if (dst_span > 0) { search_queue.push({in_node, dst_span - 1}); } else { - const auto &all_in_nodes = in_node->GetInDataNodes(); - if (std::any_of(all_in_nodes.begin(), all_in_nodes.end(), IsSwitchInLoop)) { - GELOGW("Travel node: %s, %s node: %s, Skip LoopCond switch", dst_node->GetName().c_str(), node_type.c_str(), - in_node->GetName().c_str()); - } else { - switch_group.emplace_back(in_node); - } + switch_group.emplace_back(in_node); } } else if (kMergeOpTypes.count(node_type) > 0) { // Merge input node. search_queue.push({in_node, dst_span + 1}); diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.h b/ge/graph/passes/mark_force_unknown_for_cond_pass.h index 528a8fdc..d2be9a9e 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.h +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.h @@ -19,6 +19,8 @@ #include "inc/graph_pass.h" +#include + namespace ge { class MarkForceUnknownForCondPass : public GraphPass { public: @@ -26,6 +28,15 @@ class MarkForceUnknownForCondPass : public GraphPass { private: /// + /// @brief Deal with Switch node for LoopCond + /// @param [in] Switch node + /// @param [in] dest span + /// @param [out] Search queue + /// @return true: Switch In while loop / false: Not in while Loop. + /// + bool DealWithLoopSwitch(const NodePtr &node, uint32_t dst_span, std::queue> search_queue); + + /// /// @brief Mark force unknown shape for Switch node /// @param [in] merge node /// @param [out] switch group diff --git a/ge/graph/passes/switch_to_stream_switch_pass.cc b/ge/graph/passes/switch_to_stream_switch_pass.cc index 77a7c9db..7fecae31 100644 --- a/ge/graph/passes/switch_to_stream_switch_pass.cc +++ b/ge/graph/passes/switch_to_stream_switch_pass.cc @@ -395,8 +395,9 @@ NodePtr SwitchToStreamSwitchPass::CreateStreamSwitchNode(const ComputeGraphPtr & peer_cond_anchor->GetOwnerNode()->GetName().c_str(), stream_switch->GetName().c_str()); int64_t group_index = -1; - (void)AttrUtils::GetInt(switch_node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); - SetControlFlowGroup(stream_switch, group_index); + if (AttrUtils::GetInt(switch_node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index)) { + SetControlFlowGroup(stream_switch, group_index); + } return stream_switch; } diff --git a/ge/hybrid/executor/node_state.cc b/ge/hybrid/executor/node_state.cc index 468c84e6..4b0d0c44 100644 --- a/ge/hybrid/executor/node_state.cc +++ b/ge/hybrid/executor/node_state.cc @@ -326,17 +326,37 @@ std::shared_ptr NodeState::GetTaskContext() { } void NodeState::SavePersistTensor(int input_idx, const TensorValue &tensor) { - if (node_item_->root_data_.count(input_idx) > 0) { + const auto is_persist_tensor = [](const std::map> &items, int idx) { + const auto is_exist = [&idx](const std::pair> &items) { + return items.second.count(idx) > 0; + }; + return std::any_of(items.begin(), items.end(), is_exist); + }; + + if (is_persist_tensor(node_item_->root_data_, input_idx)) { GELOGD("[%s] Save Root input tensor: %d", GetName().c_str(), input_idx); root_tensor_values_[input_idx] = tensor; - } - - if (node_item_->enter_data_.count(input_idx) > 0) { + } else if (is_persist_tensor(node_item_->enter_data_, input_idx)) { GELOGD("[%s] Save Enter input tensor: %d", GetName().c_str(), input_idx); root_tensor_values_[input_idx] = tensor; } } +void NodeState::UpdatePersistTensor() { + const auto update_tensor = [&](const std::map> &items) { + for (const auto &item : items) { + for (const auto idx : item.second) { + UpdatePersistTensor(idx); + } + } + }; + + update_tensor(node_item_->root_data_); + if (iteration_count_ > 0) { + update_tensor(node_item_->enter_data_); + } +} + void NodeState::UpdatePersistTensor(int input_idx) { const auto it = root_tensor_values_.find(input_idx); if (it == root_tensor_values_.end()) { @@ -363,16 +383,9 @@ void NodeState::ResetContext(uint64_t iteration) { data_scheduled_ = static_cast(node_item_->root_data_.size()); ctrl_scheduled_ = static_cast(node_item_->root_ctrl_.size()); - for (auto item : node_item_->root_data_) { - UpdatePersistTensor(item.first); - } - if (iteration > 0) { data_scheduled_ += static_cast(node_item_->enter_data_.size()); ctrl_scheduled_ += static_cast(node_item_->enter_ctrl_.size()); - for (auto item : node_item_->enter_data_) { - UpdatePersistTensor(item.first); - } } iteration_count_ = iteration; diff --git a/ge/hybrid/executor/node_state.h b/ge/hybrid/executor/node_state.h index 727402f1..f1cec215 100644 --- a/ge/hybrid/executor/node_state.h +++ b/ge/hybrid/executor/node_state.h @@ -132,6 +132,7 @@ struct NodeState { void RunNextIteration(); void SavePersistTensor(int input_idx, const TensorValue &tensor); + void UpdatePersistTensor(); Status NodeScheduled(const std::function &ready) const; diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index 250562ce..8e87c6e2 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -395,11 +395,13 @@ void NodeItem::SetDataSend(NodeItem *node_item, int anchor_index) { data_send_.emplace(node_item); node_item->data_recv_[this] = anchor_index; if (is_root_node_) { - node_item->root_data_[anchor_index] = this; + auto &data_anchors = node_item->root_data_[this]; + data_anchors.emplace(anchor_index); } // If Enter feed Not Merge, take as root Node. if (IsEnterOp() && (node_item->node_type != STREAMMERGE)) { - node_item->enter_data_[anchor_index] = this; + auto &data_anchors = node_item->enter_data_[this]; + data_anchors.emplace(anchor_index); } GELOGI("Node[%s] will control node[%s]", NodeName().c_str(), node_item->NodeName().c_str()); } diff --git a/ge/hybrid/model/node_item.h b/ge/hybrid/model/node_item.h index 12775b00..f6dcdcf6 100644 --- a/ge/hybrid/model/node_item.h +++ b/ge/hybrid/model/node_item.h @@ -148,9 +148,9 @@ struct NodeItem { int64_t frame_index_ = -1; int64_t parent_frame_ = -1; std::set root_ctrl_; // Recv ctrl from root node - std::map root_data_; // Recv data from root node + std::map> root_data_; // Recv data from root node std::set enter_ctrl_; // Recv ctrl from Enter node - std::map enter_data_; // Recv data from Enter node + std::map> enter_data_; // Recv data from Enter node std::set data_send_; // Send data notify to std::map data_recv_; // Recv data notify from std::set ctrl_send_; // Send ctrl notify to diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index 9e9354d9..eeb5ba20 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -39,6 +39,7 @@ const char *const kEngineNameHostCpu = "DNN_VM_HOST_CPU_OP_STORE"; Status NodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) const { GE_CHK_STATUS_RET_NOLOG(context.AllocateOutputs()); GE_CHK_STATUS_RET_NOLOG(context.AllocateWorkspaces()); + GE_CHK_STATUS_RET_NOLOG(context.UpdatePersistTensor()); GE_CHK_STATUS_RET_NOLOG(task.UpdateArgs(context)); return SUCCESS; } diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index c0464c87..3c288981 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -470,6 +470,12 @@ Status TaskContext::PropagateOutputs() { return SUCCESS; } +Status TaskContext::UpdatePersistTensor() { + GE_CHECK_NOTNULL(node_state_); + node_state_->UpdatePersistTensor(); + return SUCCESS; +} + const void *TaskContext::GetVarBaseAddr() { return execution_context_->model->GetVarMemBase(); } diff --git a/ge/hybrid/node_executor/task_context.h b/ge/hybrid/node_executor/task_context.h index c96e194e..cff5d680 100644 --- a/ge/hybrid/node_executor/task_context.h +++ b/ge/hybrid/node_executor/task_context.h @@ -78,6 +78,7 @@ class TaskContext { Status AllocateOutputs(AllocationAttr *attr = nullptr); Status AllocateWorkspaces(); Status AllocateWorkspace(size_t size, void **buffer, void *ori_addr = nullptr); + Status UpdatePersistTensor(); bool IsTraceEnabled() const; From d4828ea130d310773161d5f1b8ccc313f283cd1a Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 26 Jun 2021 15:00:53 +0800 Subject: [PATCH 093/226] UpdatePersistTensor from ExecutionEngine --- ge/hybrid/executor/node_state.cc | 4 ++++ ge/hybrid/executor/worker/execution_engine.cc | 1 + ge/hybrid/node_executor/node_executor.cc | 1 - ge/hybrid/node_executor/task_context.cc | 11 +---------- ge/hybrid/node_executor/task_context.h | 1 - 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ge/hybrid/executor/node_state.cc b/ge/hybrid/executor/node_state.cc index 4b0d0c44..7ab7b536 100644 --- a/ge/hybrid/executor/node_state.cc +++ b/ge/hybrid/executor/node_state.cc @@ -333,6 +333,10 @@ void NodeState::SavePersistTensor(int input_idx, const TensorValue &tensor) { return std::any_of(items.begin(), items.end(), is_exist); }; + if (root_tensor_values_.count(input_idx) > 0) { + return; + } + if (is_persist_tensor(node_item_->root_data_, input_idx)) { GELOGD("[%s] Save Root input tensor: %d", GetName().c_str(), input_idx); root_tensor_values_[input_idx] = tensor; diff --git a/ge/hybrid/executor/worker/execution_engine.cc b/ge/hybrid/executor/worker/execution_engine.cc index 8eecbc80..d4c73f58 100755 --- a/ge/hybrid/executor/worker/execution_engine.cc +++ b/ge/hybrid/executor/worker/execution_engine.cc @@ -375,6 +375,7 @@ Status ExecutionEngine::DoExecuteAsync(NodeState &node_state, RECORD_EXECUTION_EVENT(&context, task_context.GetNodeName(), "[PrepareTask] Start"); GE_CHK_STATUS_RET(executor->PrepareTask(*task, task_context), "[Prepare][Task] for [%s] failed.", node_state.GetName().c_str()); + node_state.UpdatePersistTensor(); RECORD_EXECUTION_EVENT(&context, task_context.GetNodeName(), "[PrepareTask] End"); GELOGD("[%s] Done task preparation successfully.", node_state.GetName().c_str()); diff --git a/ge/hybrid/node_executor/node_executor.cc b/ge/hybrid/node_executor/node_executor.cc index eeb5ba20..9e9354d9 100755 --- a/ge/hybrid/node_executor/node_executor.cc +++ b/ge/hybrid/node_executor/node_executor.cc @@ -39,7 +39,6 @@ const char *const kEngineNameHostCpu = "DNN_VM_HOST_CPU_OP_STORE"; Status NodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) const { GE_CHK_STATUS_RET_NOLOG(context.AllocateOutputs()); GE_CHK_STATUS_RET_NOLOG(context.AllocateWorkspaces()); - GE_CHK_STATUS_RET_NOLOG(context.UpdatePersistTensor()); GE_CHK_STATUS_RET_NOLOG(task.UpdateArgs(context)); return SUCCESS; } diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index 3c288981..4ecc1558 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -460,22 +460,12 @@ Status TaskContext::PropagateOutputs() { subgraph_context_->all_inputs_[input_offset].SetName( node_item_->NodeName() + "_in_" + std::to_string(dst_input_idx)); } - - auto dst_node_state = subgraph_context_->GetOrCreateNodeState(dst_node_item); - GE_CHECK_NOTNULL(dst_node_state); - dst_node_state->SavePersistTensor(dst_input_idx, *tensor); } } (void)guard; return SUCCESS; } -Status TaskContext::UpdatePersistTensor() { - GE_CHECK_NOTNULL(node_state_); - node_state_->UpdatePersistTensor(); - return SUCCESS; -} - const void *TaskContext::GetVarBaseAddr() { return execution_context_->model->GetVarMemBase(); } @@ -501,6 +491,7 @@ void TaskContext::ReleaseInputsAndOutputs() { void TaskContext::ReleaseInput(int index) { auto input_tensor = MutableInput(index); if (input_tensor != nullptr) { + node_state_->SavePersistTensor(index, *input_tensor); input_tensor->Destroy(); GELOGD("[%s] Tensor of input[%d] released", GetNodeName(), index); } diff --git a/ge/hybrid/node_executor/task_context.h b/ge/hybrid/node_executor/task_context.h index cff5d680..c96e194e 100644 --- a/ge/hybrid/node_executor/task_context.h +++ b/ge/hybrid/node_executor/task_context.h @@ -78,7 +78,6 @@ class TaskContext { Status AllocateOutputs(AllocationAttr *attr = nullptr); Status AllocateWorkspaces(); Status AllocateWorkspace(size_t size, void **buffer, void *ori_addr = nullptr); - Status UpdatePersistTensor(); bool IsTraceEnabled() const; From e2cb3778f0e4724cec833363a878e6b28093ec04 Mon Sep 17 00:00:00 2001 From: wq160 Date: Thu, 24 Jun 2021 11:42:57 +0800 Subject: [PATCH 094/226] add infer_base and infer value range --- ge/CMakeLists.txt | 4 + ge/common/formats/utils/formats_trans_utils.cc | 19 + ge/common/formats/utils/formats_trans_utils.h | 2 + ge/graph/passes/constant_folding_pass.cc | 26 +- ge/graph/passes/constant_folding_pass.h | 5 + ge/graph/passes/folding_pass.cc | 8 - ge/graph/passes/folding_pass.h | 2 - ge/graph/passes/infer_base_pass.cc | 386 ++++++++++++++ ge/graph/passes/infer_base_pass.h | 65 +++ ge/graph/passes/infer_value_range_pass.cc | 500 ++++++++++++++++++ ge/graph/passes/infer_value_range_pass.h | 49 ++ ge/graph/preprocess/graph_preprocess.cc | 3 + metadef | 2 +- tests/ut/ge/CMakeLists.txt | 7 +- .../ut/ge/graph/passes/infer_base_pass_unittest.cc | 359 +++++++++++++ .../passes/infer_value_range_pass_unittest.cc | 583 +++++++++++++++++++++ 16 files changed, 1997 insertions(+), 23 deletions(-) create mode 100644 ge/graph/passes/infer_base_pass.cc create mode 100644 ge/graph/passes/infer_base_pass.h create mode 100644 ge/graph/passes/infer_value_range_pass.cc create mode 100644 ge/graph/passes/infer_value_range_pass.h create mode 100644 tests/ut/ge/graph/passes/infer_base_pass_unittest.cc create mode 100644 tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 2b9122da..dc80597c 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -298,7 +298,9 @@ set(TRAIN_SRC_LIST "graph/passes/hccl_continuous_memcpy_pass.cc" "graph/passes/identity_pass.cc" "graph/passes/ref_identity_delete_op_pass.cc" + "graph/passes/infer_base_pass.cc" "graph/passes/infershape_pass.cc" + "graph/passes/infer_value_range_pass.cc" "graph/passes/iterator_op_pass.cc" "graph/passes/link_gen_mask_nodes_pass.cc" "graph/passes/merge_pass.cc" @@ -547,7 +549,9 @@ set(INFER_SRC_LIST "graph/passes/shape_operate_op_remove_pass.cc" "graph/passes/assert_pass.cc" "graph/passes/dropout_pass.cc" + "graph/passes/infer_base_pass.cc" "graph/passes/infershape_pass.cc" + "graph/passes/infer_value_range_pass.cc" "graph/passes/unused_const_pass.cc" "graph/passes/permute_pass.cc" "graph/passes/ctrl_edge_transfer_pass.cc" diff --git a/ge/common/formats/utils/formats_trans_utils.cc b/ge/common/formats/utils/formats_trans_utils.cc index 052951ce..db1812d0 100755 --- a/ge/common/formats/utils/formats_trans_utils.cc +++ b/ge/common/formats/utils/formats_trans_utils.cc @@ -49,6 +49,25 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY std::string ShapeToString(const s return JoinToString(shape); } +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY +std::string RangeToString(const std::vector> &ranges) { + bool first = true; + std::stringstream ss; + ss << "["; + for (const auto &range : ranges) { + if (first) { + first = false; + } else { + ss << ","; + } + ss << "{"; + ss << range.first << "," << range.second; + ss << "}"; + } + ss << "]"; + return ss.str(); +} + int64_t GetItemNumByShape(const std::vector &shape) { int64_t num = 1; for (auto dim : shape) { diff --git a/ge/common/formats/utils/formats_trans_utils.h b/ge/common/formats/utils/formats_trans_utils.h index 848e8b3a..64f9f820 100755 --- a/ge/common/formats/utils/formats_trans_utils.h +++ b/ge/common/formats/utils/formats_trans_utils.h @@ -54,6 +54,8 @@ std::string ShapeToString(const GeShape &shape); std::string ShapeToString(const std::vector &shape); +std::string RangeToString(const std::vector> &ranges); + int64_t GetItemNumByShape(const std::vector &shape); bool CheckShapeValid(const std::vector &shape, const int64_t expect_dims); diff --git a/ge/graph/passes/constant_folding_pass.cc b/ge/graph/passes/constant_folding_pass.cc index 6607388f..53b14fd5 100644 --- a/ge/graph/passes/constant_folding_pass.cc +++ b/ge/graph/passes/constant_folding_pass.cc @@ -20,17 +20,23 @@ #include "external/graph/operator_factory.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" +#include "ge_local_engine/engine/host_cpu_engine.h" #include "init/gelib.h" namespace ge { const int64_t kStartCallNum = 1; const std::string kKernelLibName = "aicpu_tf_kernel"; -// tf_kernel.json opsFlag config const std::string kOpsFlagClose = "0"; -Status RunOpKernelWithCheck(NodePtr &node, - const vector &inputs, - std::vector &outputs) { +const map> &ConstantFoldingPass::GetGeConstantFoldingPerfStatistic() const { + return statistic_of_ge_constant_folding_; +} +const map> &ConstantFoldingPass::GetOpConstantFoldingPerfStatistic() const { + return statistic_of_op_constant_folding_; +} + +Status ConstantFoldingPass::RunOpKernelWithCheck(NodePtr &node, const vector &inputs, + std::vector &outputs) { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if ((instance_ptr == nullptr) || (!instance_ptr->InitFlag())) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GE is not initialized or is finalized."); @@ -47,15 +53,13 @@ Status RunOpKernelWithCheck(NodePtr &node, if (ops_flag == kOpsFlagClose) { return UNSUPPORTED; } - return FoldingPass::RunOpKernel(node, inputs, outputs); + return RunOpKernel(node, inputs, outputs); } -const map> &ConstantFoldingPass::GetGeConstantFoldingPerfStatistic() const { - return statistic_of_ge_constant_folding_; -} - -const map> &ConstantFoldingPass::GetOpConstantFoldingPerfStatistic() const { - return statistic_of_op_constant_folding_; +Status ConstantFoldingPass::RunOpKernel(NodePtr &node, + const vector &inputs, + std::vector &outputs) { + return HostCpuEngine::GetInstance().Run(node, inputs, outputs); } Status ConstantFoldingPass::Run(ge::NodePtr &node) { diff --git a/ge/graph/passes/constant_folding_pass.h b/ge/graph/passes/constant_folding_pass.h index 703e6edd..7de48a17 100644 --- a/ge/graph/passes/constant_folding_pass.h +++ b/ge/graph/passes/constant_folding_pass.h @@ -28,6 +28,11 @@ class ConstantFoldingPass : public FoldingPass { Status Run(ge::NodePtr &node) override; const std::map> &GetGeConstantFoldingPerfStatistic() const; const std::map> &GetOpConstantFoldingPerfStatistic() const; + + static Status RunOpKernel(NodePtr &node, const vector &inputs, vector &outputs); + static Status RunOpKernelWithCheck(NodePtr &node, const vector &inputs, + std::vector &outputs); + private: std::map> statistic_of_op_constant_folding_; std::map> statistic_of_ge_constant_folding_; diff --git a/ge/graph/passes/folding_pass.cc b/ge/graph/passes/folding_pass.cc index c0a0f2a2..819c3b40 100755 --- a/ge/graph/passes/folding_pass.cc +++ b/ge/graph/passes/folding_pass.cc @@ -28,8 +28,6 @@ #include "inc/kernel.h" #include "inc/kernel_factory.h" #include "graph/debug/ge_attr_define.h" -#include "ge_local_engine/engine/host_cpu_engine.h" - namespace ge { namespace folding_pass { @@ -123,12 +121,6 @@ NodePtr AddIdentityNodeToGraph(const std::string &name, const GeTensorDesc &tens } } // namespace -Status FoldingPass::RunOpKernel(NodePtr &node, - const vector &inputs, - std::vector &outputs) { - return HostCpuEngine::GetInstance().Run(node, inputs, outputs); -} - Status FoldingPass::Folding(NodePtr &node, vector &outputs) { GE_CHECK_NOTNULL(node); GELOGD("begin folding node:%s", node->GetName().c_str()); diff --git a/ge/graph/passes/folding_pass.h b/ge/graph/passes/folding_pass.h index 745cffd7..c461ff5c 100755 --- a/ge/graph/passes/folding_pass.h +++ b/ge/graph/passes/folding_pass.h @@ -34,8 +34,6 @@ bool IsNoNeedConstantFolding(const NodePtr &node); using IndexsToAnchors = std::map>; class FoldingPass : public BaseNodePass { - public: - static Status RunOpKernel(NodePtr &node, const vector &inputs, vector &outputs); protected: Status Folding(NodePtr &node, vector &outputs); private: diff --git a/ge/graph/passes/infer_base_pass.cc b/ge/graph/passes/infer_base_pass.cc new file mode 100644 index 00000000..27eb0c54 --- /dev/null +++ b/ge/graph/passes/infer_base_pass.cc @@ -0,0 +1,386 @@ +/** + * 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 "infer_base_pass.h" +#include "common/ge/ge_util.h" +#include "common/util/error_manager/error_manager.h" +#include "framework/common/debug/ge_log.h" +#include "framework/common/util.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/graph_utils.h" +#include "graph/utils/node_utils.h" +#include "graph/utils/tensor_utils.h" +#include "graph/utils/type_utils.h" + +namespace ge { +namespace { +graphStatus FindValidSubgraphNetoutput(const ConstNodePtr &node, const ComputeGraphPtr &sub_graph, NodePtr &netoutput) { + auto sub_nodes = sub_graph->GetDirectNode(); + for (size_t i = sub_nodes.size(); i > 0; --i) { + auto sub_node = sub_nodes.at(i - 1); + if (sub_node->GetType() == NETOUTPUT) { + if (sub_node == nullptr) { + REPORT_INNER_ERROR("E19999", "NetOutput node is null in subgraph %s, parent node %s.", + sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Check][Param] NetOutput node is null on sub graph %s, parent node %s", + sub_graph->GetName().c_str(), node->GetName().c_str()); + return GRAPH_FAILED; + } + auto sub_node_opdesc = sub_node->GetOpDesc(); + if (sub_node_opdesc == nullptr) { + REPORT_INNER_ERROR("E19999", "Invalid NetOutput node in subgraph %s, parent node %s, no OpDesc on it", + sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Check][Param] Invalid NetOutput node on sub graph %s, parent node %s, no OpDesc on it", + sub_graph->GetName().c_str(), node->GetName().c_str()); + return GRAPH_FAILED; + } + + netoutput = sub_node; + return GRAPH_SUCCESS; + } + } + + REPORT_INNER_ERROR("E19999", "Can not find the NetOutput node in subgraph %s, parent node %s", + sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Check][Param] Can not find the NetOutput node in subgraph %s, parent node %s", + sub_graph->GetName().c_str(), node->GetName().c_str()); + return GRAPH_FAILED; +} +} // namespace + +Status InferBasePass::Run(NodePtr &node) { + GE_CHECK_NOTNULL(node); + GE_CHECK_NOTNULL(node->GetOpDesc()); + + bool need_infer = NeedInfer(node); + if (!need_infer) { + GELOGD("Node %s does not need to infer.", node->GetName().c_str()); + return SUCCESS; + } + + std::set changed_nodes; + auto ret = InferAndUpdate(node, !OptionExists(kOptimizeAfterSubGraph), changed_nodes); + if (ret != GRAPH_SUCCESS) { + GELOGE(ret, "Infer and update for node %s failed! ret: %u", node->GetName().c_str(), ret); + return GRAPH_FAILED; + } + + AddChangedNodesImmediateRepass(changed_nodes); + return SUCCESS; +} + +bool InferBasePass::NeedInfer(const NodePtr &node) const { return true; } +void InferBasePass::AddChangedNodesImmediateRepass(const std::set &changed_nodes) { + for (const auto &node_ele : changed_nodes) { + AddImmediateRePassNode(node_ele); + } +} + +graphStatus InferBasePass::InferAndUpdate(NodePtr &node, bool before_subgraph, std::set &changed_nodes) { + graphStatus ret; + if (ContainsSubgraph(node)) { + if (before_subgraph) { + ret = UpdateTensorDescToSubgraphData(node); + } else { + ret = UpdateTensorDescToParentNodeOutput(node); + } + if (ret != GRAPH_SUCCESS) { + GELOGE(ret, "Update tensor desc failed between parent node %s and subgraphs. ret: %u", node->GetName().c_str(), + ret); + return ret; + } + } + + PrintInOutTensors(node, "before_infer"); + ret = Infer(node); + PrintInOutTensors(node, "after_infer"); + if (ret == GRAPH_NODE_NEED_REPASS) { + // if a node need re_pass, it is not necessary to update peer node input. + changed_nodes.insert(node); + return GRAPH_SUCCESS; + } else if (ret != GRAPH_SUCCESS && ret != GRAPH_NOT_CHANGED) { + GELOGE(ret, "Infer failed for node %s, ret: %u", node->GetName().c_str(), ret); + return ret; + } + + ret = UpdateTensorDescToPeerInputs(node, changed_nodes); + if (ret != GRAPH_SUCCESS) { + GELOGE(ret, "Node %s updates tensor desc to peer input nodes failed! ret: %u", node->GetName().c_str(), ret); + } + GELOGD("Node %s infer and update succeeded .", node->GetName().c_str()); + return ret; +} + +bool InferBasePass::ContainsSubgraph(const NodePtr &node) { + auto sub_graph_names = node->GetOpDesc()->GetSubgraphInstanceNames(); + return !sub_graph_names.empty(); +} + +graphStatus InferBasePass::UpdateTensorDescToPeerInputs(NodePtr &node, std::set &changed_nodes) { + auto op_desc = node->GetOpDesc(); + for (const auto &out_anchor : node->GetAllOutDataAnchors()) { + auto output_tensor = op_desc->MutableOutputDesc(out_anchor->GetIdx()); + for (const auto &peer_anchor : out_anchor->GetPeerInDataAnchors()) { + auto peer_anchor_opdesc = peer_anchor->GetOwnerNode()->GetOpDesc(); + if (peer_anchor_opdesc == nullptr) { + continue; + } + auto peer_input_desc = peer_anchor_opdesc->MutableInputDesc(peer_anchor->GetIdx()); + if (peer_input_desc == nullptr) { + continue; + } + + bool changed = false; + auto ret = UpdateTensorDesc(output_tensor, peer_input_desc, changed); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update peer input desc failed, node %s.", node->GetName().c_str()); + GELOGE(ret, "Update peer input desc failed, node %s.", node->GetName().c_str()); + return ret; + } + if (changed) { + changed_nodes.insert(peer_anchor->GetOwnerNode()); + GELOGD("Node %s update peer node succeeded, peer node %s is changed.", node->GetName().c_str(), + peer_anchor->GetOwnerNode()->GetName().c_str()); + } + } + } + return GRAPH_SUCCESS; +} + +std::vector InferBasePass::GetCurNodeSubgraphs(const NodePtr &node) { + std::vector cur_node_subgraph; + auto op_desc = node->GetOpDesc(); + auto sub_graph_names = op_desc->GetSubgraphInstanceNames(); + if (sub_graph_names.empty()) { + return cur_node_subgraph; + } + + auto root_graph = GraphUtils::FindRootGraph(node->GetOwnerComputeGraph()); + for (const auto &name : sub_graph_names) { + if (name.empty()) { + GELOGW("The node %s contains empty subgraph instance name", node->GetName().c_str()); + continue; + } + auto sub_graph = root_graph->GetSubgraph(name); + if (sub_graph == nullptr) { + GELOGW("The subgrpah %s for node %s is null.", name.c_str(), node->GetName().c_str()); + continue; + } + cur_node_subgraph.emplace_back(sub_graph); + } + return cur_node_subgraph; +} + +graphStatus InferBasePass::UpdateTensorDescToSubgraphData(NodePtr &node) { + auto op_desc = node->GetOpDesc(); + for (const auto &sub_graph : GetCurNodeSubgraphs(node)) { + for (const auto &node_sub : sub_graph->GetDirectNode()) { + if (node_sub->GetType() != DATA) { + continue; + } + + auto data_opdesc = node_sub->GetOpDesc(); + if (data_opdesc == nullptr) { + REPORT_INNER_ERROR("E19999", "Invalid data node on the sub graph %s parent node %s, no OpDesc", + sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Get][OpDesc] Invalid data node on the sub graph %s parent node %s, no OpDesc", + sub_graph->GetName().c_str(), node->GetName().c_str()); + return GRAPH_FAILED; + } + int ref_i; + if (!AttrUtils::GetInt(data_opdesc, ATTR_NAME_PARENT_NODE_INDEX, ref_i)) { + REPORT_INNER_ERROR("E19999", "Invalid data node on the sub graph %s parent node %s, no ref-index attribute", + sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Get][Int] Invalid data node on the sub graph %s parent node %s, no ref-index attribute", + sub_graph->GetName().c_str(), node->GetName().c_str()); + return GRAPH_FAILED; + } + GELOGD("Subgraph Data node ref_index is %d, parent node is %s.", ref_i, node->GetName().c_str()); + + // In multi-batch, data shape of subgraph is different, no need to refresh. + if (data_opdesc->HasAttr(ATTR_MBATCH_ORIGIN_INPUT_DIMS)) { + GELOGD("While updating subgraph data node, ignore node %s which is created by multi-dims", + data_opdesc->GetName().c_str()); + continue; + } + auto input_desc = op_desc->MutableInputDesc(ref_i); + if (input_desc == nullptr) { + REPORT_INNER_ERROR("E19999", + "The ref index(%d) on the data %s on the sub graph %s " + "parent node %s are incompatible, inputs num %u", + ref_i, node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str(), + node->GetAllInDataAnchorsSize()); + GELOGE(GRAPH_FAILED, + "[Call][MutableInputDesc] The ref index(%d) on the data %s on the sub graph %s " + "parent node %s are incompatible, inputs num %u", + ref_i, node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str(), + node->GetAllInDataAnchorsSize()); + return GRAPH_FAILED; + } + GELOGI("Ref index is %d, input_desc dtype is %d, node name is %s", ref_i, input_desc->GetDataType(), + node->GetName().c_str()); + + bool has_tensor_desc_changed = false; + auto data_input_td = data_opdesc->MutableInputDesc(0); + auto ret = UpdateTensorDesc(input_desc, data_input_td, has_tensor_desc_changed); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Failed to update input desc of data %s on the sub graph %s parent node %s", + node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][InputDesc] of data %s on the sub graph %s parent node %s failed", + node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str()); + return ret; + } + + auto data_output_td = data_opdesc->MutableOutputDesc(0); + ret = UpdateTensorDesc(input_desc, data_output_td, has_tensor_desc_changed); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Failed to update output desc of data %s on the sub graph %s parent node %s", + node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][OutputDesc] of data %s on the sub graph %s parent node %s failed", + node_sub->GetName().c_str(), sub_graph->GetName().c_str(), node->GetName().c_str()); + return ret; + } + GELOGD("Parent node %s update subgraph data %s input and output succeed.", node->GetName().c_str(), + data_opdesc->GetName().c_str()); + } + } + return GRAPH_SUCCESS; +} + +graphStatus InferBasePass::UpdateTensorDescToParentNodeOutput(NodePtr &node) { + std::vector> ref_out_tensors(node->GetAllOutDataAnchorsSize()); + + for (const auto &sub_graph : GetCurNodeSubgraphs(node)) { + NodePtr netoutput; + auto ret = FindValidSubgraphNetoutput(node, sub_graph, netoutput); + if (ret != GRAPH_SUCCESS) { + return ret; + } + + auto netoutput_opdesc = netoutput->GetOpDesc(); + for (auto &netoutput_in_anchor : netoutput->GetAllInDataAnchors()) { + auto netoutput_in_desc = netoutput_opdesc->MutableInputDesc(netoutput_in_anchor->GetIdx()); + if (netoutput_in_desc == nullptr) { + REPORT_INNER_ERROR("E19999", + "Invalid NetOutput node on sub graph %s, parent node %s, can not find input tensor %d", + sub_graph->GetName().c_str(), node->GetName().c_str(), netoutput_in_anchor->GetIdx()); + GELOGE(GRAPH_FAILED, + "[Get][Tensor] Invalid NetOutput node on sub graph %s, parent node %s, can not find input tensor %d", + sub_graph->GetName().c_str(), node->GetName().c_str(), netoutput_in_anchor->GetIdx()); + return GRAPH_FAILED; + } + GELOGI("Netoutput in anchor index is %d, input tensor dim is %zu", netoutput_in_anchor->GetIdx(), + netoutput_in_desc->GetShape().GetDimNum()); + int ref_i; + if (!AttrUtils::GetInt(netoutput_in_desc, ATTR_NAME_PARENT_NODE_INDEX, ref_i)) { + // if there is no ref index on the TensorDesc, it means the output data will be ignored outer. + continue; + } + GELOGI("Parent node index of edge desc is %d", ref_i); + if (ref_i < 0 || static_cast(ref_i) >= node->GetAllOutDataAnchorsSize()) { + REPORT_INNER_ERROR("E19999", + "Invalid ref_index %d of parent node %s, ref_index should less than %u.", ref_i, + node->GetName().c_str(), node->GetAllOutDataAnchorsSize()); + GELOGE(GRAPH_FAILED, + "[Get][Ref_index] Invalid ref_index %d of parent node %s, ref_index should less than %u.", ref_i, + node->GetName().c_str(), node->GetAllOutDataAnchorsSize()); + return GRAPH_FAILED; + } + ref_out_tensors[ref_i].emplace_back(netoutput_in_desc); + } + } + + return UpdateParentNodeContainsSubgraphs(node, ref_out_tensors); +} + +graphStatus InferBasePass::UpdateParentNodeContainsSubgraphs( + NodePtr &node, const std::vector> &ref_out_tensors) { + for (size_t i = 0; i < ref_out_tensors.size(); i++) { + if (ref_out_tensors[i].empty()) { + REPORT_CALL_ERROR("E19999", "Parent node %s ref_index %zu subgraph output tensor list is empty.", + node->GetName().c_str(), i); + GELOGE(GRAPH_FAILED, "[Param][check] Parent node %s ref_index %zu subgraph output tensor list is empty.", + node->GetName().c_str(), i); + return GRAPH_FAILED; + } + auto node_op_desc = node->GetOpDesc(); + auto node_output_td = node_op_desc->MutableOutputDesc(i); + if (node_output_td == nullptr) { + REPORT_CALL_ERROR("E19999", "Node %s output %zu tensor desc is null.", node->GetName().c_str(), i); + GELOGE(GRAPH_FAILED, "[Param][check] Node %s output %zu tensor desc is null.", node->GetName().c_str(), i); + return GRAPH_FAILED; + } + + graphStatus ret; + if (node_op_desc->HasAttr(ATTR_NAME_BATCH_NUM)) { + ret = UpdateOutputFromSubgraphsForMultiDims(ref_out_tensors[i], node_output_td); + } else { + ret = UpdateOutputFromSubgraphs(ref_out_tensors[i], node_output_td); + } + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Node %s update output %zu tensor desc failed. ret: %u", node->GetName().c_str(), i, + ret); + GELOGE(GRAPH_FAILED, "[Param][check] Node %s update output %zu tensor desc failed. ret: %u", + node->GetName().c_str(), i, ret); + return ret; + } + GELOGD("Parent node %s successfully updated the output tensors from subgraphs.", node->GetName().c_str()); + } + return GRAPH_SUCCESS; +} + +void InferBasePass::PrintInOutTensors(const NodePtr &node, const std::string &phase) { + if (!IsLogEnable(GE, DLOG_DEBUG)) { + return; + } + if (node == nullptr) { + REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); + GELOGE(GRAPH_FAILED, "[Check][Param] node is null"); + return; + } + ge::OpDescPtr op_desc = node->GetOpDesc(); + GE_IF_BOOL_EXEC(op_desc == nullptr, REPORT_INNER_ERROR("E19999", "Node has no opdesc, check invalid"); + GELOGE(GRAPH_FAILED, "[Get][OpDesc] op_desc is null."); return ); + std::stringstream ss; + ss << "{"; + int32_t in_idx = 0; + for (const auto &input_desc : op_desc->GetAllInputsDescPtr()) { + if (input_desc == nullptr) { + in_idx++; + continue; + } + if (in_idx > 0) { + ss << " "; + } + ss << "input_" << in_idx << " tensor: "; + ss << SerialTensorInfo(input_desc); + in_idx++; + } + int32_t out_idx = 0; + for (const auto &output_desc : op_desc->GetAllOutputsDescPtr()) { + if (output_desc == nullptr) { + out_idx++; + continue; + } + ss << " "; + ss << "output_" << out_idx << " tensor: "; + ss << SerialTensorInfo(output_desc); + out_idx++; + } + ss << "}"; + GELOGD("Infer tensor dump [%s], Node name: [%s]. %s", phase.c_str(), node->GetName().c_str(), ss.str().c_str()); +} +} // namespace ge diff --git a/ge/graph/passes/infer_base_pass.h b/ge/graph/passes/infer_base_pass.h new file mode 100644 index 00000000..3900b5db --- /dev/null +++ b/ge/graph/passes/infer_base_pass.h @@ -0,0 +1,65 @@ +/** + * 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. + */ +#ifndef GE_GRAPH_PASSES_INFER_BASE_PASS_H_ +#define GE_GRAPH_PASSES_INFER_BASE_PASS_H_ + +#include "graph/passes/base_pass.h" + +namespace ge { +class InferBasePass : public BaseNodePass { + public: + Status Run(NodePtr &node) override; + graphStatus InferAndUpdate(NodePtr &node, bool before_subgraph, std::set &changed_nodes); + void PrintInOutTensors(const NodePtr &node, const std::string &phase); + + protected: + virtual std::string SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const = 0; + virtual bool NeedInfer(const NodePtr &node) const; + virtual graphStatus Infer(NodePtr &node) = 0; + + /** + * Update the output TensorDesc by src TensorDesc. This will be called when updating peer node input desc. + * @param src, input TensorDesc + * @param dst, output TensorDesc to be updated + * @return + */ + virtual graphStatus UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) = 0; + + /** + * Update the output TensorDesc for nodes which contain subgraphs. + * In dynamic multi-dims/batch/images size scene, the update process maybe different, + * in which case, the `InferBasePass` will call method `UpdateOutputFromSubgraphsForMultiDims` instead. + * @param src, input TensorDesc from NetOutput nodes in all subgraphs + * @param dst, output TensorDesc to be updated + * @return + */ + virtual graphStatus UpdateOutputFromSubgraphs(const std::vector &src, + GeTensorDescPtr &dst) = 0; + virtual graphStatus UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) = 0; + + private: + void AddChangedNodesImmediateRepass(const std::set &changed_nodes); + bool ContainsSubgraph(const NodePtr &node); + std::vector GetCurNodeSubgraphs(const NodePtr &node); + graphStatus UpdateTensorDescToSubgraphData(NodePtr &node); + graphStatus UpdateTensorDescToParentNodeOutput(NodePtr &node); + graphStatus UpdateParentNodeContainsSubgraphs(NodePtr &node, + const std::vector> &ref_out_tensors); + graphStatus UpdateTensorDescToPeerInputs(NodePtr &node, std::set &changed_nodes); +}; +} // namespace ge +#endif // GE_GRAPH_PASSES_INFER_BASE_PASS_H_ diff --git a/ge/graph/passes/infer_value_range_pass.cc b/ge/graph/passes/infer_value_range_pass.cc new file mode 100644 index 00000000..b9cb88bc --- /dev/null +++ b/ge/graph/passes/infer_value_range_pass.cc @@ -0,0 +1,500 @@ +/** + * 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 "graph/passes/infer_value_range_pass.h" +#include "common/formats/utils/formats_trans_utils.h" +#include "common/util/error_manager/error_manager.h" +#include "framework/common/debug/ge_log.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/operator_factory_impl.h" +#include "graph/passes/constant_folding_pass.h" +#include "graph/utils/type_utils.h" +#include "common/ge/ge_util.h" + +using std::unique_ptr; +namespace ge { +namespace { +#define GET_DATA_BY_DTYPE(DTYPE, TYPE) \ + case (DTYPE): \ + ConstructValueRange(lower_boundary_tensor, upper_boundary_tensor, output_tensor_value_range); \ + break; + +void SerialShapeRange(const GeTensorDescPtr &desc, std::string &desc_str) { + std::vector> shape_range; + (void)desc->GetShapeRange(shape_range); + desc_str += formats::RangeToString(shape_range); + shape_range.clear(); + (void)desc->GetOriginShapeRange(shape_range); + desc_str += ","; + desc_str += formats::RangeToString(shape_range); + shape_range.clear(); +} + +Status RunCpuKernelForValueRange(NodePtr &node, const vector &inputs, + std::vector &outputs) { + // RunOpKernelWithCheck, RunOpKernel for test + auto ret = ConstantFoldingPass::RunOpKernel(node, inputs, outputs); + if (ret != SUCCESS) { + auto op_kernel = folding_pass::GetKernelByType(node); + if (op_kernel == nullptr) { + GELOGW("Calculate value range failed, no op kernel for node %s type %s", node->GetName().c_str(), + node->GetType().c_str()); + return NOT_CHANGED; + } + + ret = op_kernel->Compute(node->GetOpDesc(), inputs, outputs); + if (ret != SUCCESS) { + GELOGW("Calculate value range failed, node %s run cpu kernel failed.", node->GetName().c_str()); + return NOT_CHANGED; + } + } + GELOGI("Node %s type %s, run cpu kernel success.", node->GetName().c_str(), node->GetType().c_str()); + return SUCCESS; +} +} // namespace + +graphStatus InferValueRangePass::Infer(NodePtr &node) { + auto infer_value_range_param = OperatorFactoryImpl::GetInferValueRangePara(node->GetType()); + + // Use registered func to calculate value range + if (!infer_value_range_param.use_cpu_kernel) { + if (infer_value_range_param.infer_value_func == nullptr) { + GELOGW("The registered func of node %s to infer value range is nullptr.", node->GetName().c_str()); + return GRAPH_NOT_CHANGED; + } + Operator op = OpDescUtils::CreateOperatorFromNode(node); + auto ret = node->GetOpDesc()->CallInferValueRangeFunc(op); + if (ret != GRAPH_SUCCESS) { + GELOGW("Node %s call infer value range func failed, ret: %u.", node->GetName().c_str(), ret); + return GRAPH_NOT_CHANGED; + } + GELOGD("Node %s infer value range func succeed by registered func.", node->GetName().c_str()); + return GRAPH_SUCCESS; + } + + // if input value range has -1, cpu kernel cannot calculate correctly, so set {1:-1} + if (InputHasUnknownValueRange(node)) { + GELOGI("Node %s has unknown value range in input tensors, set value range {1:-1}, and skip cpu kernel.", + node->GetName().c_str()); + return GenerateWorstValueRange(node); + } + + // Use CPU kernel func to calculate value range + auto ret = ConstructInputAndInferValueRange(node); + if (ret != GRAPH_SUCCESS) { + GELOGW("Use CPU kernel to calculate value range failed. node: %s, ret: %u", node->GetName().c_str(), ret); + return GRAPH_NOT_CHANGED; + } + GELOGD("Node %s infer value range func succeed by running cpu kernel.", node->GetName().c_str()); + return GRAPH_SUCCESS; +} + +std::string InferValueRangePass::SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const { + std::stringstream ss; + ss << "["; + ss << "(shape:[" << tensor_desc->MutableShape().ToString() << "]),"; + string range_str; + SerialShapeRange(tensor_desc, range_str); + ss << "(shape_range:" << range_str << "),"; + std::vector> value_range; + (void)tensor_desc->GetValueRange(value_range); + string value_range_str = formats::RangeToString(value_range); + ss << "(value_range:" << value_range_str << ")]"; + return ss.str(); +} + +bool InferValueRangePass::NeedInfer(const NodePtr &node) const { + auto infer_value_range_param = OperatorFactoryImpl::GetInferValueRangePara(node->GetType()); + if (!infer_value_range_param.is_initialized) { + GELOGD("Node %s does not register func to infer value range, skip infer_value_range_pass.", + node->GetName().c_str()); + return false; + } + + if (infer_value_range_param.when_call == INPUT_IS_DYNAMIC) { + // Only do infer for node that all inputs are dynamic, such as shape + if (InputIsDynamic(node)) { + return true; + } + GELOGD("Node %s register func to infer value range and when_call is INPUT_IS_DYNAMIC, but check input failed.", + node->GetName().c_str()); + } else if (infer_value_range_param.when_call == INPUT_HAS_VALUE_RANGE) { + // Only do infer for node that all inputs have value_range or node type of inputs is constant/const + if (InputIsConstOrHasValueRange(node)) { + return true; + } + GELOGD("Node %s register func to infer value range and when_call is INPUT_HAS_VALUE_RANGE, but check input failed.", + node->GetName().c_str()); + } + GELOGD("Node %s does not need to infer value range, skip infer_value_range_pass.", node->GetName().c_str()); + return false; +} + +bool InferValueRangePass::InputIsDynamic(const NodePtr &node) const{ + bool input_is_dynamic = false; + auto cur_op_desc = node->GetOpDesc(); + for (const auto &input_desc : cur_op_desc->GetAllInputsDescPtr()) { + auto dims = input_desc->GetShape().GetDims(); + for (auto dim : dims) { + if (dim == UNKNOWN_DIM || dim == UNKNOWN_DIM_NUM) { + input_is_dynamic = true; + break; + } + } + } + return input_is_dynamic; +} + +bool InferValueRangePass::InputIsConstOrHasValueRange(const NodePtr &node) const { + bool input_is_const_or_has_value_range = true; + auto cur_op_desc = node->GetOpDesc(); + auto in_data_anchors = node->GetAllInDataAnchors(); + for (size_t i = 0; i < in_data_anchors.size(); ++i) { + auto peer_out_anchor = in_data_anchors.at(i)->GetPeerOutAnchor(); + if (peer_out_anchor == nullptr) { + continue; + } + auto peer_node = peer_out_anchor->GetOwnerNode(); + if (peer_node == nullptr || peer_node->GetOpDesc() == nullptr) { + continue; + } + if ((peer_node->GetType() == CONSTANT) || (peer_node->GetType() == CONSTANTOP)) { + continue; + } + + const auto &input_desc = cur_op_desc->GetInputDesc(i); + std::vector> value_range; + (void)input_desc.GetValueRange(value_range); + if (value_range.empty()) { + GELOGD("Node %s input %zu does not have value range, skip infer_value_range_pass for current node.", + node->GetName().c_str(), i); + input_is_const_or_has_value_range = false; + break; + } + } + return input_is_const_or_has_value_range; +} + +bool InferValueRangePass::InputHasUnknownValueRange(const NodePtr &node) const { + bool has_unknown_value_range = false; + auto cur_op_desc = node->GetOpDesc(); + for (const auto &input_desc : cur_op_desc->GetAllInputsDescPtr()) { + std::vector> input_desc_value_range; + input_desc->GetValueRange(input_desc_value_range); + if (!input_desc_value_range.empty()) { + for (const auto &range : input_desc_value_range) { + if (range.first == -1 || range.second == -1) { + GELOGD("Node %s input tensors have unknown value range, value range is %s.", node->GetName().c_str(), + formats::RangeToString(input_desc_value_range).c_str()); + has_unknown_value_range = true; + } + } + } + } + return has_unknown_value_range; +} + +graphStatus InferValueRangePass::UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) { + if (src == nullptr || dst == nullptr) { + REPORT_CALL_ERROR("E19999", "While updating tensor desc, input desc is null."); + GELOGE(GRAPH_FAILED, "[Param][check] While updating tensor desc, input desc is null."); + return GRAPH_FAILED; + } + + changed = false; + std::vector> src_value_range; + std::vector> dst_value_range; + (void)src->GetValueRange(src_value_range); + (void)dst->GetValueRange(dst_value_range); + if (src_value_range != dst_value_range) { + GELOGD("While updating tensor desc, value range has been changed, src value range: %s, dst value range: %s.", + formats::RangeToString(src_value_range).c_str(), formats::RangeToString(dst_value_range).c_str()); + changed = true; + } + + dst->SetValueRange(src_value_range); + return GRAPH_SUCCESS; +} + +graphStatus InferValueRangePass::UpdateOutputFromSubgraphs(const std::vector &src, + GeTensorDescPtr &dst) { + std::vector> ref_out_tensor_value_range; + auto ref_out_tensor = src.at(0); + (void)ref_out_tensor->GetValueRange(ref_out_tensor_value_range); + for (auto &ref_tensor : src) { + std::vector> ref_tensor_value_range; + (void)ref_tensor->GetValueRange(ref_tensor_value_range); + + if (ref_tensor_value_range.size() != ref_out_tensor_value_range.size()) { + GELOGD("Update TensorDesc %s failed, rank of value ranges %s and %s are not the same, skip value range refresh.", + dst->GetName().c_str(), formats::RangeToString(ref_out_tensor_value_range).c_str(), + formats::RangeToString(ref_tensor_value_range).c_str()); + return GRAPH_SUCCESS; + } + + for (size_t j = 0; j < ref_out_tensor_value_range.size(); j++) { + if ((ref_out_tensor_value_range.at(j).first != ref_tensor_value_range.at(j).first) || + (ref_out_tensor_value_range.at(j).second != ref_tensor_value_range.at(j).second)) { + ref_out_tensor_value_range[j] = std::make_pair(1, -1); + } + } + } + GELOGD("While updating output desc from subgraphs, set parent node desc value range %s.", + formats::RangeToString(ref_out_tensor_value_range).c_str()); + dst->SetValueRange(ref_out_tensor_value_range); + return GRAPH_SUCCESS; +} + +graphStatus InferValueRangePass::UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) { + REPORT_INNER_ERROR("E19999", + "Update TensorDesc %s failed. In dynamic multi-dims size scene, there should be no value range.", + dst->GetName().c_str()); + GELOGE(GRAPH_FAILED, + "[Update][TensorDesc] %s failed. In dynamic multi-dims size scene, there should be no value range.", + dst->GetName().c_str()); + return GRAPH_FAILED; +} + +graphStatus InferValueRangePass::GenerateWorstValueRange(NodePtr &node) { + GELOGI("Node %s does not run cpu kernel, because input value range has -1.", node->GetName().c_str()); + OpDescPtr op_desc = node->GetOpDesc(); + for (size_t i = 0; i < op_desc->GetOutputsSize(); ++i) { + auto output_desc = op_desc->MutableOutputDesc(i); + if (output_desc == nullptr) { + continue; + } + auto output_i_shape = output_desc->GetShape(); + auto output_i_shape_size = output_i_shape.GetShapeSize(); + if (output_i_shape_size < 0) { + GELOGD("Node %s output shape is unknown, cannot infer value range, shape is %s.", node->GetName().c_str(), + formats::ShapeToString(output_i_shape).c_str()); + return GRAPH_NOT_CHANGED; + } + + std::vector> output_i_value_range(output_i_shape_size, {1, -1}); + output_desc->SetValueRange(output_i_value_range); + GELOGD("Node %s output %zu shape is %s, the generated worst value range is %s.", node->GetName().c_str(), i, + formats::ShapeToString(output_i_shape).c_str(), formats::RangeToString(output_i_value_range).c_str()); + } + return GRAPH_SUCCESS; +} + +template +graphStatus InferValueRangePass::ConstructData(const GeTensorDesc &tensor_desc, bool use_floor_value, + GeTensorPtr &output_ptr) { + std::vector> value_range; + (void)tensor_desc.GetValueRange(value_range); + if (static_cast(value_range.size()) != tensor_desc.GetShape().GetShapeSize()) { + GELOGW("Value range of input %s is invalid.", tensor_desc.GetName().c_str()); + return GRAPH_PARAM_INVALID; + } + + size_t value_range_data_num = value_range.size(); + unique_ptr buf(new (std::nothrow) T[value_range_data_num]()); + if (buf == nullptr) { + REPORT_INNER_ERROR("E19999", "New buf failed"); + GELOGE(MEMALLOC_FAILED, "New buf failed"); + return GRAPH_FAILED; + } + for (size_t j = 0; j < value_range_data_num; ++j) { + auto value_range_j = use_floor_value ? value_range[j].first : value_range[j].second; + buf[j] = static_cast(value_range_j); + } + + if (output_ptr->SetData(reinterpret_cast(buf.get()), value_range_data_num * sizeof(T)) != GRAPH_SUCCESS) { + GELOGW("Set data failed while constructing value range input tensor."); + return GRAPH_NOT_CHANGED; + } + return GRAPH_SUCCESS; +} + +graphStatus InferValueRangePass::ConstructDataByType(const GeTensorDesc &tensor_desc, bool use_floor_value, + GeTensorPtr &output_ptr) { + graphStatus ret = GRAPH_SUCCESS; + auto data_type = tensor_desc.GetDataType(); + output_ptr->MutableTensorDesc().SetDataType(data_type); + switch (data_type) { + case DT_FLOAT: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_DOUBLE: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_UINT8: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_INT8: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_UINT16: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_INT16: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_INT32: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + case DT_INT64: + ret = ConstructData(tensor_desc, use_floor_value, output_ptr); + break; + default: + GELOGW("Data type:%s is not supported.", TypeUtils::DataTypeToSerialString(data_type).c_str()); + ret = GRAPH_PARAM_INVALID; + } + return ret; +} + +vector InferValueRangePass::ConstructInputTensors(const NodePtr &node, bool use_floor_value) { + vector input_tensors; + auto cur_op_desc = node->GetOpDesc(); + auto in_data_anchors = node->GetAllInDataAnchors(); + for (size_t i = 0; i < in_data_anchors.size(); ++i) { + auto peer_out_anchor = in_data_anchors.at(i)->GetPeerOutAnchor(); + if (peer_out_anchor == nullptr) { + continue; + } + auto peer_node = peer_out_anchor->GetOwnerNode(); + if (peer_node == nullptr) { + continue; + } + + // construct input tensor by constant node + if ((peer_node->GetType() == CONSTANT) || (peer_node->GetType() == CONSTANTOP)) { + vector const_weight = OpDescUtils::MutableWeights(peer_node); + if (const_weight.empty()) { + GELOGW("MutableWeights failed, weight is empty, node: %s(%s)", peer_node->GetName().c_str(), + peer_node->GetType().c_str()); + return vector(); + } + // const/constant op has only one weight + if (const_weight.at(0) == nullptr) { + GELOGW("MutableWeights failed, weight of constant is null, node name: %s(%s)", + peer_node->GetName().c_str(), peer_node->GetType().c_str()); + return vector(); + } + input_tensors.push_back(const_weight.at(0)); + GELOGD("Node %s construct input tensor %zu by constant node.", node->GetName().c_str(), input_tensors.size()); + continue; + } + + // construct input tensor by boundary of value range + const auto &input_tensor_desc = cur_op_desc->GetInputDesc(i); + GeTensorPtr tmp_tensor_ptr = MakeShared(input_tensor_desc); + if (tmp_tensor_ptr == nullptr) { + REPORT_INNER_ERROR("E19999", "Make shared failed"); + GELOGE(MEMALLOC_FAILED, "Make shared failed"); + return vector(); + } + + auto ret = ConstructDataByType(input_tensor_desc, use_floor_value, tmp_tensor_ptr); + if (ret != GRAPH_SUCCESS) { + GELOGW("Construct input tensor by boundary of value range failed for input %s.", + input_tensor_desc.GetName().c_str()); + return vector(); + } + input_tensors.push_back(tmp_tensor_ptr); + GELOGD("Node %s construct input tensor %zu by input desc value range.", node->GetName().c_str(), + input_tensors.size()); + } + + return input_tensors; +} + +graphStatus InferValueRangePass::ConstructInputAndInferValueRange(NodePtr &node) { + auto inputs = ConstructInputTensors(node, true); + if (inputs.empty()) { + return GRAPH_PARAM_INVALID; + } + vector lower_boundary_outputs; + auto ret = RunCpuKernelForValueRange(node, inputs, lower_boundary_outputs); + if (ret != SUCCESS) { + GELOGW("Node %s run cpu kernel failed while calculating value range.", node->GetName().c_str()); + return GRAPH_PARAM_INVALID; + } + + inputs = ConstructInputTensors(node, false); + if (inputs.empty()) { + return GRAPH_PARAM_INVALID; + } + vector upper_boundary_outputs; + ret = RunCpuKernelForValueRange(node, inputs, upper_boundary_outputs); + if (ret != SUCCESS) { + GELOGW("Node %s run cpu kernel failed while calculating value range.", node->GetName().c_str()); + return GRAPH_PARAM_INVALID; + } + + // construct value range from output tensor + OpDescPtr node_desc = node->GetOpDesc(); + std::vector> output_tensor_value_range; + size_t node_output_desc_size = node_desc->GetOutputsSize(); + for (size_t i = 0; i < node_output_desc_size; ++i) { + output_tensor_value_range.clear(); + auto output_tensor_desc = node_desc->MutableOutputDesc(i); + auto output_shape_size = output_tensor_desc->GetShape().GetShapeSize(); + auto lower_boundary_tensor = lower_boundary_outputs[i]; + auto lower_boundary_shape = lower_boundary_tensor->GetTensorDesc().GetShape(); + auto upper_boundary_tensor = upper_boundary_outputs[i]; + auto upper_boundary_shape = upper_boundary_tensor->GetTensorDesc().GetShape(); + if (lower_boundary_shape.GetShapeSize() != output_shape_size || + upper_boundary_shape.GetShapeSize() != output_shape_size) { + GELOGD( + "Cpu kernel result shapes %s, %s and output shape %s do not match, can not infer value range for output %s.", + formats::ShapeToString(lower_boundary_shape).c_str(), formats::ShapeToString(upper_boundary_shape).c_str(), + formats::ShapeToString(output_tensor_desc->GetShape()).c_str(), output_tensor_desc->GetName().c_str()); + return GRAPH_PARAM_INVALID; + } + + auto data_type = output_tensor_desc->GetDataType(); + switch (data_type) { + GET_DATA_BY_DTYPE(DT_INT8, int8_t) + GET_DATA_BY_DTYPE(DT_INT16, int16_t) + GET_DATA_BY_DTYPE(DT_INT32, int32_t) + GET_DATA_BY_DTYPE(DT_INT64, int64_t) + GET_DATA_BY_DTYPE(DT_UINT8, uint8_t) + GET_DATA_BY_DTYPE(DT_UINT16, uint16_t) + GET_DATA_BY_DTYPE(DT_UINT32, uint32_t) + GET_DATA_BY_DTYPE(DT_UINT64, uint64_t) + GET_DATA_BY_DTYPE(DT_FLOAT, float) + GET_DATA_BY_DTYPE(DT_DOUBLE, double) + default: + GELOGW("Data type:%s is not supported.", TypeUtils::DataTypeToSerialString(data_type).c_str()); + return GRAPH_PARAM_INVALID; + } + output_tensor_desc->SetValueRange(output_tensor_value_range); + GELOGD("Node %s calculates output %zu value range %s by running cpu kernel.", node->GetName().c_str(), i, + formats::RangeToString(output_tensor_value_range).c_str()); + } + return GRAPH_SUCCESS; +} + +template +void InferValueRangePass::ConstructValueRange(const GeTensorPtr &left_tensor, const GeTensorPtr &right_tensor, + std::vector> &value_range) { + auto x = reinterpret_cast(left_tensor->GetData().GetData()); + auto y = reinterpret_cast(right_tensor->GetData().GetData()); + if (x == nullptr || y == nullptr) { + GELOGI("Output tensor of cpu kernel does not have data, no way to set value range."); + return; + } + for (auto j = 0; j < left_tensor->GetTensorDesc().GetShape().GetShapeSize(); ++j) { + auto left = static_cast(*(x + j)); + auto right = static_cast(*(y + j)); + value_range.emplace_back(std::make_pair(left, right)); + } +} +} // namespace ge diff --git a/ge/graph/passes/infer_value_range_pass.h b/ge/graph/passes/infer_value_range_pass.h new file mode 100644 index 00000000..eb485c87 --- /dev/null +++ b/ge/graph/passes/infer_value_range_pass.h @@ -0,0 +1,49 @@ +/** + * 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. + */ + +#ifndef GE_GRAPH_PASSES_INFER_VALUE_RANGE_PASS_H_ +#define GE_GRAPH_PASSES_INFER_VALUE_RANGE_PASS_H_ + +#include "graph/passes/infer_base_pass.h" + +namespace ge { +class InferValueRangePass : public InferBasePass { + public: + graphStatus Infer(NodePtr &node) override; + + private: + std::string SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const override; + graphStatus UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) override; + graphStatus UpdateOutputFromSubgraphs(const std::vector &src, GeTensorDescPtr &dst) override; + graphStatus UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) override; + bool NeedInfer(const NodePtr &node) const override; + + bool InputIsDynamic(const NodePtr &node) const; + bool InputIsConstOrHasValueRange(const NodePtr &node) const; + bool InputHasUnknownValueRange(const NodePtr &node) const; + graphStatus GenerateWorstValueRange(NodePtr &node); + template + graphStatus ConstructData(const GeTensorDesc &tensor_desc, bool use_floor_value, GeTensorPtr &output_ptr); + graphStatus ConstructDataByType(const GeTensorDesc &tensor_desc, bool use_floor_value, GeTensorPtr &output_ptr); + vector ConstructInputTensors(const NodePtr &node, bool use_floor_value); + template + void ConstructValueRange(const GeTensorPtr &left_tensor, const GeTensorPtr &right_tensor, + std::vector> &value_range); + graphStatus ConstructInputAndInferValueRange(NodePtr &node); +}; +} // namespace ge +#endif // GE_GRAPH_PASSES_INFER_VALUE_RANGE_PASS_H_ diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 6fd83623..bc8646e7 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -54,6 +54,7 @@ #include "graph/passes/hccl_group_pass.h" #include "graph/passes/identity_pass.h" #include "graph/passes/infershape_pass.h" +#include "graph/passes/infer_value_range_pass.h" #include "graph/passes/merge_pass.h" #include "graph/passes/net_output_pass.h" #include "graph/passes/no_use_reshape_remove_pass.h" @@ -2016,6 +2017,8 @@ Status GraphPrepare::InferShapeForPreprocess() { names_to_passes.emplace_back("DimensionComputePass", &dimension_compute_pass); ConstantFoldingPass constant_folding_pass; names_to_passes.emplace_back("ConstantFoldingPass", &constant_folding_pass); + InferValueRangePass infer_value_pass; + names_to_passes.emplace_back("InferValuePass", &infer_value_pass); int32_t dev_count = 0; AicpuConstantFoldingPass aicpu_constant_folding_pass; diff --git a/metadef b/metadef index 2ad00e17..9e4a51a9 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 2ad00e17886fd06c0d00f8a8cf370783a3d31818 +Subproject commit 9e4a51a9602195b82e326b853f5adbfefc3972b6 diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index b67dc23d..80b12e32 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -220,7 +220,9 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/shape_operate_op_remove_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/assert_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/dropout_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_base_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/infershape_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_value_range_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/unused_const_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/permute_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/ctrl_edge_transfer_pass.cc" @@ -534,7 +536,9 @@ set(GRAPH_PASS_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/transpose_transdata_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/hccl_memcpy_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/no_use_reshape_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_base_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/infershape_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_value_range_pass.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/analyzer/analyzer.cc" "${GE_CODE_DIR}/ge/graph/passes/net_output_pass.cc" @@ -661,6 +665,8 @@ set(DISTINCT_GRAPH_LOAD_TEST_FILES ) set(PASS_TEST_FILES + "graph/passes/infer_value_range_pass_unittest.cc" + "graph/passes/infer_base_pass_unittest.cc" "graph/passes/prune_pass_unittest.cc" "graph/passes/enter_pass_unittest.cc" "graph/passes/switch_op_pass_unittest.cc" @@ -719,7 +725,6 @@ set(PASS_TEST_FILES "graph/passes/memcpy_addr_async_unittest.cc" "graph/passes/hccl_continuous_pass_unittest.cc" "graph/passes/hccl_memcpy_pass_unittest.cc" - ) set(KERNEL_TEST_FILES diff --git a/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc new file mode 100644 index 00000000..e9247f75 --- /dev/null +++ b/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc @@ -0,0 +1,359 @@ +/** + * 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 "graph/passes/infer_base_pass.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/tensor_utils.h" +#include "graph/utils/graph_utils.h" +#include "graph_builder_utils.h" + +using namespace std; +using namespace testing; +namespace ge { +class ChildPassBuilder; +static const char *kInferTimes = "infer_times"; +class InferBasePassStub : public InferBasePass { + public: + friend class ChildPassBuilder; + graphStatus Infer(NodePtr &node) override{ + call_infer_times++; + for (size_t i = 0; i < node->GetOutDataNodesSize(); ++i) { + auto output_td = node->GetOpDesc()->MutableOutputDesc(i); + int times = 0; + AttrUtils::GetInt(output_td, kInferTimes, times); + AttrUtils::SetInt(output_td, kInferTimes, times + 1); + } + return infer_result_; + }; + + int32_t call_infer_times = 0; + int32_t call_update_tensor_desc_times = 0; + int32_t call_update_from_subgraph_times = 0; + int32_t call_update_from_subgraph_multi_dims_times = 0; + std::vector> update_td_pairs; + + private: + bool NeedInfer(const NodePtr &node) const override { + return need_infer_; + }; + std::string SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const override { return "test SerialTensorInfo"; }; + graphStatus UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) override { + call_update_tensor_desc_times++; + changed = td_changed_; + int times = 0; + if (AttrUtils::GetInt(src, kInferTimes, times)) { + AttrUtils::SetInt(dst, kInferTimes, times); + } + update_td_pairs.emplace_back(src, dst); + return GRAPH_SUCCESS; + }; + graphStatus UpdateOutputFromSubgraphs(const std::vector &src, GeTensorDescPtr &dst) override { + call_update_from_subgraph_times++; + return GRAPH_SUCCESS; + }; + graphStatus UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) override { + call_update_from_subgraph_multi_dims_times++; + return GRAPH_SUCCESS; + }; + bool td_changed_; + bool need_infer_; + graphStatus infer_result_; +}; + +class ChildPassBuilder { + public: + ChildPassBuilder &SetNeedInferFlag(bool flag) { + need_infer_ = flag; + return *this; + } + + ChildPassBuilder &SetInferResult(graphStatus ret) { + infer_result_ = ret; + return *this; + } + + ChildPassBuilder &SetTdChangedFlag(bool changed_flag) { + td_changed_ = changed_flag; + return *this; + } + + InferBasePassStub Build() { + InferBasePassStub ib; + ib.td_changed_ = td_changed_; + ib.need_infer_ = need_infer_; + ib.infer_result_ = infer_result_; + return ib; + } + + private: + bool td_changed_ = false; + bool need_infer_ = true; + graphStatus infer_result_ = GRAPH_SUCCESS; +}; + +class UtestGraphInferBasePassStub : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +/* + * data1 data2 + * \ / + * sub1 + * | + * netoutput + */ +ut::GraphBuilder TestSubgraphBuilder() { + ut::GraphBuilder builder = ut::GraphBuilder("branch_graph"); + std::vector shape1 = {1,1}; + auto data1 = builder.AddNode("data1_1", "Data", 1, 1, FORMAT_NCHW, DT_INT32, shape1); + auto data1_desc = data1->GetOpDesc(); + EXPECT_NE(data1_desc, nullptr); + AttrUtils::SetInt(data1_desc, "_parent_node_index", 0); + std::vector shape2 = {2,2}; + auto data2 = builder.AddNode("data2_1", "Data", 1, 1, FORMAT_NCHW, DT_INT32, shape2); + auto data2_desc = data2->GetOpDesc(); + EXPECT_NE(data2_desc, nullptr); + AttrUtils::SetInt(data2_desc, "_parent_node_index", 1); + + auto sub1 = builder.AddNode("Sub", "Sub", 2, 1); + std::vector shape7 = {8,8}; + auto netoutput = builder.AddNode("output", NETOUTPUT, 1, 0, FORMAT_NCHW, DT_INT32, shape7); + auto input0_desc = netoutput->GetOpDesc()->MutableInputDesc(0); + EXPECT_NE(input0_desc, nullptr); + AttrUtils::SetInt(input0_desc, "_parent_node_index", 0); + + builder.AddDataEdge(data1, 0, sub1, 0); + builder.AddDataEdge(data2, 0, sub1, 1); + builder.AddDataEdge(sub1, 0, netoutput, 0); + return builder; +} + +/* + * data1 data2 + * \ / + * case1 + * | + * netoutput + */ +ut::GraphBuilder RootGraphBuilder() { + ut::GraphBuilder builder = ut::GraphBuilder("root_graph"); + auto data1 = builder.AddNode("data1", "Data", 0, 1); + auto data2 = builder.AddNode("data2", "Data", 0, 1); + auto case1 = builder.AddNode("case1", CASE, 2, 1); + auto netoutput = builder.AddNode("netoutput", NETOUTPUT, 1, 0); + builder.AddDataEdge(data1, 0, case1, 0); + builder.AddDataEdge(data2, 0, case1, 1); + builder.AddDataEdge(case1, 0, netoutput, 0); + + auto parent_graph = builder.GetGraph(); + auto subgraph_builder = TestSubgraphBuilder(); + auto subgraph = subgraph_builder.GetGraph(); + case1->GetOpDesc()->AddSubgraphName(subgraph->GetName()); + case1->GetOpDesc()->SetSubgraphInstanceName(0, subgraph->GetName()); + subgraph->SetParentNode(case1); + subgraph->SetParentGraph(parent_graph); + EXPECT_EQ(parent_graph->AddSubgraph(subgraph->GetName(), subgraph), GRAPH_SUCCESS); + return builder; +} + +/* + * data1 data2 + * \ / + * add1 + * | + * netoutput + */ +ut::GraphBuilder NoSubgraphBuilder() { + ut::GraphBuilder builder = ut::GraphBuilder("no_subgraph"); + auto data1 = builder.AddNode("data1", "Data", 0, 1); + auto data2 = builder.AddNode("data2", "Data", 0, 1); + auto add1 = builder.AddNode("add1", ADD, 2, 1); + auto netoutput = builder.AddNode("netoutput", NETOUTPUT, 1, 0); + builder.AddDataEdge(data1, 0, add1, 0); + builder.AddDataEdge(data2, 0, add1, 1); + builder.AddDataEdge(add1, 0, netoutput, 0); + return builder; +} + +TEST_F(UtestGraphInferBasePassStub, CallInfer_WhenNeedInferReturnTrue) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + EXPECT_NE(add_node, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.Build(); + + // NeedInfer return true + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_infer_times, 1); + int times = -1; + EXPECT_TRUE(AttrUtils::GetInt(add_node->GetOpDesc()->GetOutputDescPtr(0), kInferTimes, times)); + EXPECT_EQ(times, 1); +} + +TEST_F(UtestGraphInferBasePassStub, NotCallInfer_WhenNeedInferReturnFalse) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + EXPECT_NE(add_node, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.SetNeedInferFlag(false).Build(); + + // NeedInfer return false + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_infer_times, 0); + int times = -1; + EXPECT_FALSE(AttrUtils::GetInt(add_node->GetOpDesc()->GetOutputDescPtr(0), kInferTimes, times)); +} + +TEST_F(UtestGraphInferBasePassStub, NotAddCurNodeRepass_CallUpdatePeerNode_WhenInferReturnSuccess) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + auto netoutput = test_graph->FindNode("netoutput"); + EXPECT_NE(add_node, nullptr); + EXPECT_NE(netoutput, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.Build(); + + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_infer_times, 1); + EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 1); + std::vector> expected_updated_tensor_desc_pairs = { + {add_node->GetOpDesc()->MutableOutputDesc(0), netoutput->GetOpDesc()->MutableInputDesc(0)}}; + EXPECT_EQ(stub_base_pass.update_td_pairs, expected_updated_tensor_desc_pairs); + EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({})); +} + +TEST_F(UtestGraphInferBasePassStub, AddCurNodeRepass_NotCallUpdatePeerNode_WhenInferReturnNeedRepass) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + EXPECT_NE(add_node, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.SetInferResult(GRAPH_NODE_NEED_REPASS).Build(); + + // do re_pass + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_infer_times, 1); + EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 0); + EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({add_node})); +} + +TEST_F(UtestGraphInferBasePassStub, NotAddPeerNodeRepass_AfterUpdatePeerNode_WhenUnchanged) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + auto netoutput = test_graph->FindNode("netoutput"); + EXPECT_NE(add_node, nullptr); + EXPECT_NE(netoutput, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.Build(); + + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 1); + EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({})); + int times = -1; + EXPECT_TRUE(AttrUtils::GetInt(add_node->GetOpDesc()->GetOutputDescPtr(0), kInferTimes, times)); + EXPECT_EQ(times, 1); + times = -1; + EXPECT_TRUE(AttrUtils::GetInt(netoutput->GetOpDesc()->GetInputDescPtr(0), kInferTimes, times)); + EXPECT_EQ(times, 1); +} + +TEST_F(UtestGraphInferBasePassStub, AddPeerNodeRepass_AfterUpdatePeerNode_WhenChanged) { + auto builder = NoSubgraphBuilder(); + auto test_graph = builder.GetGraph(); + auto add_node = test_graph->FindNode("add1"); + auto netoutput = test_graph->FindNode("netoutput"); + EXPECT_NE(add_node, nullptr); + EXPECT_NE(netoutput, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.SetTdChangedFlag(true).Build(); + + EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 1); + EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({netoutput})); +} + +TEST_F(UtestGraphInferBasePassStub, TestUpdateSubgraphData_WhenBeforeSubgraph) { + auto builder = RootGraphBuilder(); + auto parent_graph = builder.GetGraph(); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 1); + + auto case_node = parent_graph->FindNode("case1"); + auto data1 = subgraphs[0]->FindNode("data1_1"); + auto data2 = subgraphs[0]->FindNode("data2_1"); + EXPECT_NE(case_node, nullptr); + EXPECT_NE(data1, nullptr); + EXPECT_NE(data2, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.SetInferResult(GRAPH_NODE_NEED_REPASS).Build(); + + EXPECT_EQ(stub_base_pass.Run(case_node), SUCCESS); + // when GRAPH_NODE_NEED_REPASS, not update peer node, only update two data, update input and output, 2*2 + EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 4); + std::vector> expected_updated_tensor_desc_pairs = { + {case_node->GetOpDesc()->MutableInputDesc(0), data1->GetOpDesc()->MutableInputDesc(0)}, + {case_node->GetOpDesc()->MutableInputDesc(0), data1->GetOpDesc()->MutableOutputDesc(0)}, + {case_node->GetOpDesc()->MutableInputDesc(1), data2->GetOpDesc()->MutableInputDesc(0)}, + {case_node->GetOpDesc()->MutableInputDesc(1), data2->GetOpDesc()->MutableOutputDesc(0)}, + }; + EXPECT_EQ(stub_base_pass.update_td_pairs, expected_updated_tensor_desc_pairs); +} + +TEST_F(UtestGraphInferBasePassStub, TestUpdateParentNodeOutput_WhenAfterSubgraph) { + auto builder = RootGraphBuilder(); + auto parent_graph = builder.GetGraph(); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 1); + + auto case_node = parent_graph->FindNode("case1"); + EXPECT_NE(case_node, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.Build(); + stub_base_pass.SetOption(kOptimizeAfterSubGraph, ""); + + EXPECT_EQ(stub_base_pass.Run(case_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_update_from_subgraph_times, 1); + EXPECT_EQ(stub_base_pass.call_update_from_subgraph_multi_dims_times, 0); +} + +TEST_F(UtestGraphInferBasePassStub, TestUpdateParentNodeOutputForMultiDims_WhenAfterSubgraph) { + auto builder = RootGraphBuilder(); + auto parent_graph = builder.GetGraph(); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 1); + + auto case_node = parent_graph->FindNode("case1"); + auto set_ret = AttrUtils::SetInt(case_node->GetOpDesc(), ATTR_NAME_BATCH_NUM, 2); + EXPECT_EQ(set_ret, true); + EXPECT_NE(case_node, nullptr); + ChildPassBuilder pass_builder; + auto stub_base_pass = pass_builder.Build(); + stub_base_pass.SetOption(kOptimizeAfterSubGraph, ""); + + EXPECT_EQ(stub_base_pass.Run(case_node), SUCCESS); + EXPECT_EQ(stub_base_pass.call_update_from_subgraph_times, 0); + EXPECT_EQ(stub_base_pass.call_update_from_subgraph_multi_dims_times, 1); +} +} // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc new file mode 100644 index 00000000..fea1b27d --- /dev/null +++ b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc @@ -0,0 +1,583 @@ +/** + * 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 + +#define protected public +#define private public +#include "graph/passes/infer_value_range_pass.h" +#include "graph/utils/tensor_utils.h" +#include "graph/utils/graph_utils.h" +#include "graph_builder_utils.h" + +#include "inc/external/graph/operator_reg.h" +#include "inc/external/graph/operator.h" +#include "inc/external/graph/operator_factory.h" +#include "inc/graph/operator_factory_impl.h" +#include "inc/kernel.h" +#include "inc/kernel_factory.h" + +using namespace std; +using namespace testing; +namespace ge { +class UtestGraphInferValueRangePass : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +/* + * data1 const1 + * \ / + * case1 + * | + * relu10 + * | + * netoutput + */ +ut::GraphBuilder ParentGraphBuilder() { + ut::GraphBuilder builder = ut::GraphBuilder("g1"); + auto data1 = builder.AddNode("data1", "Data", 0, 1); + std::vector const_shape = {1}; + auto const1 = builder.AddNode("const1", "Const", 0, 1, FORMAT_NCHW, DT_INT32, const_shape); + auto case1 = builder.AddNode("case1", CASE, 2, 1); + auto relu1 = builder.AddNode("relu10", "Relu", 1, 1); + auto netoutput = builder.AddNode("netoutput", NETOUTPUT, 1, 0); + + int32_t weight[1] = {1}; + GeTensorDesc weight_desc(GeShape({1}), FORMAT_NHWC, DT_INT32); + GeTensorPtr tensor = std::make_shared(weight_desc, (uint8_t *)weight, sizeof(weight)); + OpDescUtils::SetWeights(const1, {tensor}); + auto case_in0_shape = GeShape({1, 1,-1, 224}); + auto case_in1_shape = GeShape({1,1}); + std::vector> in0_range = {make_pair(1, 1), make_pair(1, 1), + make_pair(1, -1), make_pair(1, 224)}; + std::vector> in1_range = {make_pair(1, 100), make_pair(1, 10)}; + case1->GetOpDesc()->MutableInputDesc(0)->SetShape(case_in0_shape); + case1->GetOpDesc()->MutableInputDesc(0)->SetValueRange(in0_range); + case1->GetOpDesc()->MutableInputDesc(1)->SetShape(case_in1_shape); + case1->GetOpDesc()->MutableInputDesc(1)->SetValueRange(in1_range); + + builder.AddDataEdge(data1, 0, case1, 0); + builder.AddDataEdge(const1, 0, case1, 1); + builder.AddDataEdge(case1, 0, relu1, 0); + builder.AddDataEdge(relu1, 0, netoutput, 0); + return builder; +} + +/* + * data1 data2 + * \ / + * switch + * / \ + * relu1 relu2 + * \ / + * merge + * | + * netoutput + */ +ut::GraphBuilder SwitchSubgraphBuilder(string graph_name, uint32_t num) { + ut::GraphBuilder builder = ut::GraphBuilder(graph_name); + + std::vector shape1 = {2,2}; + string data1_name = "data1_" + std::to_string(num); + auto data1 = builder.AddNode(data1_name, "Data", 1, 1, FORMAT_NCHW, DT_INT32, shape1); + auto data1_desc = data1->GetOpDesc(); + EXPECT_NE(data1_desc, nullptr); + AttrUtils::SetInt(data1_desc, "_parent_node_index", 0); + + std::vector shape2 = {3,3}; + string data2_name = "data2_" + std::to_string(num); + auto data2 = builder.AddNode(data2_name, "Data", 1, 1, FORMAT_NCHW, DT_INT32, shape2); + auto data2_desc = data2->GetOpDesc(); + EXPECT_NE(data2_desc, nullptr); + AttrUtils::SetInt(data2_desc, "_parent_node_index", 1); + + string switch_name = "switch_" + std::to_string(num); + auto switch1 = builder.AddNode(switch_name, "Switch", 2, 2); + + string relu1_name = "relu1_" + std::to_string(num); + auto relu1 = builder.AddNode(relu1_name, "Relu", 1, 1); + + string relu2_name = "relu2_" + std::to_string(num); + auto relu2 = builder.AddNode(relu2_name, "Relu", 1, 1); + + string merge_name = "merge_" + std::to_string(num); + auto merge = builder.AddNode(merge_name, "Merge", 2, 1); + + std::vector shape7 = {8,8}; + string output_name = "output_" + std::to_string(num); + auto netoutput = builder.AddNode(output_name, NETOUTPUT, 1, 0, FORMAT_NCHW, DT_INT32, shape7); + auto input0_desc = netoutput->GetOpDesc()->MutableInputDesc(0); + EXPECT_NE(input0_desc, nullptr); + AttrUtils::SetInt(input0_desc, "_parent_node_index", 0); + std::vector> range = {make_pair(1, -1), make_pair(1, -1)}; + input0_desc->SetValueRange(range); + + builder.AddDataEdge(data1, 0, switch1, 0); + builder.AddDataEdge(data2, 0, switch1, 1); + builder.AddDataEdge(switch1, 0, relu1, 0); + builder.AddDataEdge(switch1, 1, relu2, 0); + builder.AddDataEdge(relu1, 0, merge, 0); + builder.AddDataEdge(relu2, 0, merge, 1); + builder.AddDataEdge(merge, 0, netoutput, 0); + + return builder; +} + +void AddCaseSubgraph(ComputeGraphPtr &parent_graph, uint32_t branch_num) { + auto case_node = parent_graph->FindNode("case1"); + EXPECT_NE(case_node, nullptr); + + for (uint32_t i = 0; i < branch_num; ++i) { + string name = "Branch_Graph_" + std::to_string(i); + + auto builder_subgraph = SwitchSubgraphBuilder(name, i); + auto switch_subgraph = builder_subgraph.GetGraph(); + + case_node->GetOpDesc()->AddSubgraphName(switch_subgraph->GetName()); + case_node->GetOpDesc()->SetSubgraphInstanceName(i, switch_subgraph->GetName()); + + switch_subgraph->SetParentNode(case_node); + switch_subgraph->SetParentGraph(parent_graph); + EXPECT_EQ(parent_graph->AddSubgraph(switch_subgraph->GetName(), switch_subgraph), GRAPH_SUCCESS); + } +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UnregisteredNodeType) { + auto graph = std::make_shared("test_graph"); + GeTensorDesc ge_tensor_desc(GeShape({1, 1, 4, 192}), ge::FORMAT_NCHW, DT_FLOAT16); + auto addn_op_desc = std::make_shared("AddN", "AddN"); + addn_op_desc->AddInputDesc(ge_tensor_desc); + addn_op_desc->AddOutputDesc(ge_tensor_desc); + auto addn_op_node = graph->AddNode(addn_op_desc); + + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(addn_op_node), SUCCESS); +} + +auto ShapeValueInfer = [&](Operator &op) { + auto op_desc = OpDescUtils::GetOpDescFromOperator(op); + auto output_tensor_desc = op_desc->MutableOutputDesc(0); + std::vector> in_shape_range; + op_desc->MutableInputDesc(0)->GetShapeRange(in_shape_range); + if (!in_shape_range.empty()) { + output_tensor_desc->SetValueRange(in_shape_range); + } + return SUCCESS; +}; +REG_OP(Shape) + .OP_END_FACTORY_REG(Shape) +IMPL_INFER_VALUE_RANGE_FUNC(Shape, ShapeValueRangeFunc){ + auto op_desc = OpDescUtils::GetOpDescFromOperator(op); + auto output_tensor_desc = op_desc->MutableOutputDesc(0); + std::vector> in_shape_range; + op_desc->MutableInputDesc(0)->GetShapeRange(in_shape_range); + if (!in_shape_range.empty()) { + output_tensor_desc->SetValueRange(in_shape_range); + } + return GRAPH_SUCCESS; +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseRegistedFunc_NotInfer) { + INFER_VALUE_RANGE_CUSTOM_FUNC_REG(Shape, INPUT_IS_DYNAMIC, ShapeValueRangeFunc); + auto graph = std::make_shared("test_graph"); + GeTensorDesc ge_tensor_desc(GeShape({1, 1, 4, 192}), ge::FORMAT_NCHW, DT_INT32); + std::vector> shape_range = {make_pair(1, 1), make_pair(1, 1), + make_pair(4, 4), make_pair(192, 192)}; + ge_tensor_desc.SetShapeRange(shape_range); + GeTensorDesc output_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, DT_INT32); + auto op_desc = std::make_shared("Shape", "Shape"); + op_desc->AddInputDesc(ge_tensor_desc); + op_desc->AddOutputDesc(output_tensor_desc); + auto op_node = graph->AddNode(op_desc); + + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(op_node), SUCCESS); + + auto output_0_desc = op_node->GetOpDesc()->GetOutputDesc(0); + std::vector> value_range; + output_0_desc.GetValueRange(value_range); + EXPECT_EQ(value_range.empty(), true); +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseRegistedFunc_DoInfer) { + // sqrt -> shape -> Output + INFER_VALUE_RANGE_CUSTOM_FUNC_REG(Shape, INPUT_IS_DYNAMIC, ShapeValueRangeFunc); + auto graph = std::make_shared("test_graph"); + GeTensorDesc sqrt_tensor_desc(GeShape({-1, -1, 4, 192}), ge::FORMAT_NCHW, DT_INT32); + std::vector> shape_range = {make_pair(1, 100), make_pair(1, 240), + make_pair(4, 4), make_pair(192, 192)}; + sqrt_tensor_desc.SetShapeRange(shape_range); + auto sqrt_op_desc = std::make_shared("Sqrt", "Sqrt"); + sqrt_op_desc->AddInputDesc(sqrt_tensor_desc); + sqrt_op_desc->AddOutputDesc(sqrt_tensor_desc); + auto sqrt_node = graph->AddNode(sqrt_op_desc); + + GeTensorDesc shape_output_desc(GeShape({4}), ge::FORMAT_NCHW, DT_INT32); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddInputDesc(sqrt_tensor_desc); + shape_op_desc->AddOutputDesc(shape_output_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc Output_in_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT32); + auto Output_op_desc = std::make_shared("Output", "Output"); + Output_op_desc->AddInputDesc(Output_in_tensor_desc); + auto Output_node = graph->AddNode(Output_op_desc); + + ge::GraphUtils::AddEdge(sqrt_node->GetOutDataAnchor(0), shape_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), Output_node->GetInDataAnchor(0)); + EXPECT_EQ(graph->TopologicalSorting(), GRAPH_SUCCESS); + + + InferValueRangePass infer_pass; + auto ret = infer_pass.Run(shape_node); + EXPECT_EQ(ret, SUCCESS); + + auto output_0_desc = shape_node->GetOpDesc()->GetOutputDesc(0); + std::vector> value_range; + output_0_desc.GetValueRange(value_range); + EXPECT_EQ(value_range.size(), 4); + std::vector target_value_range = {1, 100, 1, 240, 4, 4, 192, 192}; + std::vector output_value_range; + for (auto pair : value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(target_value_range, output_value_range); + + auto in_0_desc = Output_node->GetOpDesc()->GetInputDesc(0); + value_range.clear(); + in_0_desc.GetValueRange(value_range); + EXPECT_EQ(value_range.size(), 4); + output_value_range.clear(); + for (auto pair : value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(target_value_range, output_value_range); + +} + +class AddKernel : public Kernel { + public: + Status Compute(const ge::OpDescPtr op_desc_ptr, const std::vector &input, + std::vector &v_output) override { + if (input[0]->GetTensorDesc().GetDataType() == DT_INT64 || input[0]->GetTensorDesc().GetDataType() == DT_UINT64) { + vector data_vec; + auto data_num = input[0]->GetTensorDesc().GetShape().GetShapeSize(); + auto x1_data = reinterpret_cast(input[0]->GetData().data()); + auto x2_data = reinterpret_cast(input[1]->GetData().data()); + for (size_t i = 0; i < data_num; i++) { + auto x_index = *(x1_data + i); + auto y_index = *(x2_data + i); + data_vec.push_back(x_index + y_index); + } + GeTensorPtr const_tensor = std::make_shared(input[0]->GetTensorDesc(), (uint8_t *)data_vec.data(), + data_num * sizeof(int64_t)); + v_output.emplace_back(const_tensor); + return SUCCESS; + } else if (input[0]->GetTensorDesc().GetDataType() == DT_INT32 || input[0]->GetTensorDesc().GetDataType() == DT_UINT32) { + vector data_vec; + auto data_num = input[0]->GetTensorDesc().GetShape().GetShapeSize(); + auto x1_data = reinterpret_cast(input[0]->GetData().data()); + auto x2_data = reinterpret_cast(input[1]->GetData().data()); + for (size_t i = 0; i < data_num; i++) { + auto x_index = *(x1_data + i); + auto y_index = *(x2_data + i); + data_vec.push_back(x_index + y_index); + } + GeTensorPtr const_tensor = std::make_shared(input[0]->GetTensorDesc(), (uint8_t *)data_vec.data(), + data_num * sizeof(int32_t)); + v_output.emplace_back(const_tensor); + return SUCCESS; + } + } +}; +REGISTER_KERNEL(ADD, AddKernel); +INFER_VALUE_RANGE_DEFAULT_REG(Add); +INFER_VALUE_RANGE_DEFAULT_REG(Sqrt); + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHaveUnKnownValueRange) { + // shape --- add --- sqrt + // constant / + auto graph = std::make_shared("test_graph"); + + vector dims_vec = {4}; + vector data_vec = {1, 1, 1, 1}; + GeTensorDesc const_tensor_desc(ge::GeShape(dims_vec), ge::FORMAT_NCHW, ge::DT_INT64); + GeTensorPtr const_tensor = + std::make_shared(const_tensor_desc, (uint8_t *)data_vec.data(), data_vec.size() * sizeof(int64_t)); + + auto const_op_desc = std::make_shared("Constant", "Constant"); + const_op_desc->AddOutputDesc(const_tensor_desc); + EXPECT_EQ(OpDescUtils::SetWeights(const_op_desc, const_tensor), GRAPH_SUCCESS); + auto const_node = graph->AddNode(const_op_desc); + + GeTensorDesc shape_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT64); + std::vector> unknown_value_range = {make_pair(1, -1), make_pair(1, 240), + make_pair(4, 4), make_pair(192, 192)}; + shape_tensor_desc.SetValueRange(unknown_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_tensor_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT64); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddInputDesc(const_tensor_desc); + add_op_desc->AddOutputDesc(add_tensor_desc); + auto add_node = graph->AddNode(add_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(const_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + + // test unknown value range + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 4); + + std::vector unknown_target_value_range = {1, -1, 1, -1, 1, -1, 1, -1}; + std::vector output_value_range; + for (auto pair : out_value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(unknown_target_value_range, output_value_range); +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsAreKnownValueRange_Int64) { + // shape --- add --- sqrt + // constant / + auto graph = std::make_shared("test_graph"); + + vector dims_vec = {4}; + vector data_vec = {1, 1, 1, 1}; + GeTensorDesc const_tensor_desc(ge::GeShape(dims_vec), ge::FORMAT_NCHW, ge::DT_INT64); + GeTensorPtr const_tensor = + std::make_shared(const_tensor_desc, (uint8_t *)data_vec.data(), data_vec.size() * sizeof(int64_t)); + + auto const_op_desc = std::make_shared("Constant", "Constant"); + const_op_desc->AddOutputDesc(const_tensor_desc); + EXPECT_EQ(OpDescUtils::SetWeights(const_op_desc, const_tensor), GRAPH_SUCCESS); + auto const_node = graph->AddNode(const_op_desc); + + GeTensorDesc shape_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT64); + std::vector> unknown_value_range = {make_pair(1, 100), make_pair(1, 240), + make_pair(4, 4), make_pair(192, 192)}; + shape_tensor_desc.SetValueRange(unknown_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_tensor_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT64); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddInputDesc(const_tensor_desc); + add_op_desc->AddOutputDesc(add_tensor_desc); + auto add_node = graph->AddNode(add_op_desc); + + auto sqrt_op_desc = std::make_shared("Sqrt", "Sqrt"); + sqrt_op_desc->AddInputDesc(GeTensorDesc()); + auto sqrt_node = graph->AddNode(sqrt_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(const_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + ge::GraphUtils::AddEdge(add_node->GetOutDataAnchor(0), sqrt_node->GetInDataAnchor(1)); + + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(sqrt_node), SUCCESS); + + // test known value range + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 4); + + std::vector target_value_range = {2, 101, 2, 241, 5, 5, 193, 193}; + std::vector output_value_range; + for (auto pair : out_value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(target_value_range, output_value_range); +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsAreKnownValueRange_Int32) { + // shape --- add --- sqrt + // constant / + auto graph = std::make_shared("test_graph"); + vector data_vec = {1, 100, 2, 200}; + GeTensorDesc const_tensor_desc(ge::GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT32); + GeTensorPtr const_tensor = + std::make_shared(const_tensor_desc, (uint8_t *)data_vec.data(), data_vec.size() * sizeof(int32_t)); + auto const_op_desc = std::make_shared("Constant", "Constant"); + const_op_desc->AddOutputDesc(const_tensor_desc); + EXPECT_EQ(OpDescUtils::SetWeights(const_op_desc, const_tensor), GRAPH_SUCCESS); + auto const_node = graph->AddNode(const_op_desc); + + GeTensorDesc shape_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT32); + std::vector> known_value_range = {make_pair(1, 100), make_pair(1, 240), + make_pair(4, 4), make_pair(192, 192)}; + shape_tensor_desc.SetValueRange(known_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_tensor_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_tensor_desc(GeShape({4}), ge::FORMAT_NCHW, ge::DT_INT32); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddInputDesc(const_tensor_desc); + add_op_desc->AddOutputDesc(add_tensor_desc); + auto add_node = graph->AddNode(add_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(const_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 4); + + std::vector target_value_range = {2, 101, 101, 340, 6, 6, 392, 392}; + std::vector output_value_range; + for (auto pair : out_value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(target_value_range, output_value_range); +} + +REG_OP(Case) + .OP_END_FACTORY_REG(Case) +IMPL_INFER_VALUE_RANGE_FUNC(Case, ValueRangeFunc){ + auto op_desc = OpDescUtils::GetOpDescFromOperator(op); + auto output_tensor_desc = op_desc->MutableOutputDesc(0); + std::vector> in_value_range; + output_tensor_desc->GetValueRange(in_value_range); + if (in_value_range.empty()) { + std::vector> out_value_range = {make_pair(1, 2), make_pair(1, 3), + make_pair(1, 4), make_pair(1, 5)};; + output_tensor_desc->SetValueRange(out_value_range); + } + return GRAPH_SUCCESS; +} +INFER_VALUE_RANGE_CUSTOM_FUNC_REG(Case, INPUT_HAS_VALUE_RANGE, ValueRangeFunc); + +TEST_F(UtestGraphInferValueRangePass, CallRun_HasCaeSubgraph_WhenBeforeSubgraph) { + auto builder = ParentGraphBuilder(); + auto parent_graph = builder.GetGraph(); + AddCaseSubgraph(parent_graph, 2); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 2); + + // check before subgraph + auto case_node = parent_graph->FindNode("case1"); + EXPECT_NE(case_node, nullptr); + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(case_node), SUCCESS); + + auto case_out_0_desc = case_node->GetOpDesc()->MutableOutputDesc(0); + std::vector> out_value_range; + case_out_0_desc->GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 4); + std::vector target_value_range = {1,2,1,3,1,4,1,5}; + std::vector output_value_range_list; + for (auto pair : out_value_range) { + output_value_range_list.push_back(pair.first); + output_value_range_list.push_back(pair.second); + } + EXPECT_EQ(target_value_range, output_value_range_list); + + auto data_node = subgraphs[0]->FindNode("data1_0"); + auto data_output_0_desc = data_node->GetOpDesc()->GetOutputDesc(0); + std::vector target_value_range_list = {1, 1, 1, 1, 1, -1, 1, 224}; + std::vector> output_value_range; + data_output_0_desc.GetValueRange(output_value_range); + EXPECT_EQ(output_value_range.size(), 4); + std::vector data_value_range_list; + for (auto pair : output_value_range) { + data_value_range_list.push_back(pair.first); + data_value_range_list.push_back(pair.second); + } + EXPECT_EQ(data_value_range_list, target_value_range_list); + + data_node = subgraphs[0]->FindNode("data2_0"); + auto data2_input_0_desc = data_node->GetOpDesc()->GetInputDesc(0); + std::vector target_value_range_list2 = {1, 100, 1, 10}; + out_value_range.clear(); + data2_input_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 2); + data_value_range_list.clear(); + for (auto pair : out_value_range) { + data_value_range_list.push_back(pair.first); + data_value_range_list.push_back(pair.second); + } + EXPECT_EQ(data_value_range_list, target_value_range_list2); +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_HasCaeSubgraph_WhenAfterSubgraph) { + auto builder = ParentGraphBuilder(); + auto parent_graph = builder.GetGraph(); + AddCaseSubgraph(parent_graph, 2); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 2); + + auto case_node = parent_graph->FindNode("case1"); + EXPECT_NE(case_node, nullptr); + InferValueRangePass infer_pass; + // check after subgraph + infer_pass.options_[kOptimizeAfterSubGraph] = "yes"; + EXPECT_EQ(infer_pass.Run(case_node), SUCCESS); + + std::vector out_target_dims = {1, -1, 1, -1}; + auto case_out = case_node->GetOpDesc()->GetOutputDescPtr(0); + std::vector> out_value_range; + case_out->GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 2); + + std::vector output_value_range_list; + for (auto pair : out_value_range) { + output_value_range_list.push_back(pair.first); + output_value_range_list.push_back(pair.second); + } + EXPECT_EQ(out_target_dims, output_value_range_list); +} + +TEST_F(UtestGraphInferValueRangePass, CallRun_HasSubgraph_WhenAfterSubgraph_ForMultiDims) { + auto builder = ParentGraphBuilder(); + auto parent_graph = builder.GetGraph(); + AddCaseSubgraph(parent_graph, 2); + auto subgraphs = parent_graph->GetAllSubgraphs(); + EXPECT_EQ(subgraphs.size(), 2); + + auto case_node = parent_graph->FindNode("case1"); + EXPECT_NE(case_node, nullptr); + InferValueRangePass infer_pass; + infer_pass.options_[kOptimizeAfterSubGraph] = "yes"; + + // check after subgraph for multi-batch + auto set_ret = AttrUtils::SetInt(case_node->GetOpDesc(), ATTR_NAME_BATCH_NUM, 2); + EXPECT_EQ(set_ret, true); + EXPECT_EQ(infer_pass.Run(case_node), GRAPH_FAILED); +} +} // namespace ge From eccff67f421da4ae147c629f61821676acf550d2 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 26 Jun 2021 15:42:55 +0800 Subject: [PATCH 095/226] Clear UpdatePersistTensor Warning for first run --- ge/graph/passes/mark_force_unknown_for_cond_pass.cc | 6 +++--- ge/graph/passes/mark_force_unknown_for_cond_pass.h | 2 +- ge/hybrid/executor/node_state.cc | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index 233a1ff0..aa36a43b 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -56,8 +56,8 @@ Status MarkForceUnknownForCondPass::Run(ComputeGraphPtr graph) { /// @param [out] Search queue /// @return true: Switch In while loop / false: Not in while Loop. /// -bool MarkForceUnknownForCondPass::DealWithLoopSwitch(const NodePtr &node, uint32_t dst_span, - std::queue> search_queue) { +bool MarkForceUnknownForCondPass::DealAsLoopSwitch(const NodePtr &node, uint32_t dst_span, + std::queue> &search_queue) { /// LoopCond --->\. /// \. /// Enter-----------+ \. @@ -121,7 +121,7 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const NodePtr &node, std: GELOGD("Travel node: %s, %s node: %s, span is: %u", dst_node->GetName().c_str(), node_type.c_str(), in_node->GetName().c_str(), dst_span); if (kSwitchOpTypes.count(node_type) > 0) { // Switch input node. - if (DealWithLoopSwitch(in_node, dst_span, search_queue)) { + if (DealAsLoopSwitch(in_node, dst_span, search_queue)) { continue; } diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.h b/ge/graph/passes/mark_force_unknown_for_cond_pass.h index d2be9a9e..030b55ee 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.h +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.h @@ -34,7 +34,7 @@ class MarkForceUnknownForCondPass : public GraphPass { /// @param [out] Search queue /// @return true: Switch In while loop / false: Not in while Loop. /// - bool DealWithLoopSwitch(const NodePtr &node, uint32_t dst_span, std::queue> search_queue); + bool DealAsLoopSwitch(const NodePtr &node, uint32_t dst_span, std::queue> &search_queue); /// /// @brief Mark force unknown shape for Switch node diff --git a/ge/hybrid/executor/node_state.cc b/ge/hybrid/executor/node_state.cc index 7ab7b536..ad38c792 100644 --- a/ge/hybrid/executor/node_state.cc +++ b/ge/hybrid/executor/node_state.cc @@ -355,6 +355,10 @@ void NodeState::UpdatePersistTensor() { } }; + if (root_tensor_values_.empty()) { + return; + } + update_tensor(node_item_->root_data_); if (iteration_count_ > 0) { update_tensor(node_item_->enter_data_); From 01dfd8974956525c7977f926a94aee25335c7b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Sat, 26 Jun 2021 16:16:34 +0800 Subject: [PATCH 096/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!1849=20:=20add=20copy=20graph'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/graph/manager/graph_manager.cc | 2 +- ge/hybrid/model/hybrid_model.h | 1 - ge/hybrid/model/hybrid_model_builder.cc | 47 +++++----------------- ge/hybrid/model/hybrid_model_builder.h | 1 - ge/model/ge_root_model.h | 5 --- .../hybrid/executor/subgraph_executor_unittest.cc | 3 -- .../hybrid/model/hybrid_model_builder_unittest.cc | 26 +++--------- 7 files changed, 15 insertions(+), 70 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 01a2e502..66026f8d 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -3131,10 +3131,10 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { } // Avoid repeatively prerun for graphs owns same graph_id in online inference concurrency if (count > 1 && graph_node->GetBuildFlag()) { + graph_node->Lock(); GELOGD("Avoid repeatively prerun, graph_id:%u.", args.graph_id); // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); - graph_node->Lock(); graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); diff --git a/ge/hybrid/model/hybrid_model.h b/ge/hybrid/model/hybrid_model.h index 77246e20..9821242a 100644 --- a/ge/hybrid/model/hybrid_model.h +++ b/ge/hybrid/model/hybrid_model.h @@ -147,7 +147,6 @@ class HybridModel { GeRootModelPtr ge_root_model_; std::map input_nodes_; ComputeGraphPtr root_graph_; - ComputeGraphPtr orig_root_graph_; std::map device_variable_nodes_; //lint !e148 std::map host_variable_nodes_; //lint !e148 std::map> variable_tensors_; diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 8f96ea9d..1f68f374 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -147,7 +147,6 @@ Status HybridModelBuilder::Build() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); hybrid_model_.model_name_ = ge_root_model_->GetModelName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); - GE_CHK_STATUS_RET(CopyGraph(), "[Invoke][CopyGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitRuntimeParams(), "[Invoke][InitRuntimeParams] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(RecoverGraphUnknownFlag(), "[Invoke][RecoverGraphUnknownFlag] failed, model_name_:[%s]", GetGraphName()); @@ -172,12 +171,11 @@ Status HybridModelBuilder::Build() { Status HybridModelBuilder::BuildForSingleOp() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); - hybrid_model_.root_graph_ = ge_root_model_->GetRootGraph(); hybrid_model_.model_name_ = ge_root_model_->GetRootGraph()->GetName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); auto ret = ge_root_model_->GetSubgraphInstanceNameToModel(); - const GeModelPtr ge_model = ret[hybrid_model_.root_graph_->GetName()]; - GE_CHK_STATUS_RET(IndexTaskDefs(hybrid_model_.root_graph_, ge_model), + const GeModelPtr ge_model = ret[ge_root_model_->GetRootGraph()->GetName()]; + GE_CHK_STATUS_RET(IndexTaskDefs(ge_root_model_->GetRootGraph(), ge_model), "[Invoke][IndexTaskDefs] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(LoadGraph(), "[Invoke][LoadGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitWeights(), "[Invoke][InitWeights] failed, model_name_:[%s]", GetGraphName()); @@ -192,29 +190,6 @@ Status HybridModelBuilder::ValidateParams() { return SUCCESS; } -Status HybridModelBuilder::CopyGraph() { - GELOGD("Copy compute graph begin."); - auto root_graph = ge_root_model_->GetRootGraph(); - - ge_root_model_->IncreaseBuildTimes(); - std::string new_graph_name = ge_root_model_->GetRootGraph()->GetName() + "_" + - std::to_string(ge_root_model_->GetBuildTimes()); - ComputeGraphPtr new_root_graph = MakeShared(new_graph_name); - GE_CHECK_NOTNULL(new_root_graph); - int32_t depth = 0; - std::map node_old_2_new; - std::map op_desc_old_2_new; - graphStatus ret = GraphUtils::CopyComputeGraph(root_graph, new_root_graph, node_old_2_new, op_desc_old_2_new, depth); - if (ret != GRAPH_SUCCESS) { - GELOGE(GRAPH_FAILED, "Copy compute graph failed."); - return GRAPH_FAILED; - } - hybrid_model_.root_graph_ = new_root_graph; - - GELOGD("Copy compute graph[%s] success.", new_graph_name.c_str()); - return SUCCESS; -} - Status HybridModelBuilder::BuildNodeItem(const NodePtr &node, NodeItem &node_item) { auto op_desc = node->GetOpDesc(); GE_CHK_STATUS_RET(ParseForceInfershapeNodes(node, node_item), @@ -835,13 +810,12 @@ Status HybridModelBuilder::BuildOutputMapping(GraphItem &graph_item, } Status HybridModelBuilder::LoadGraph() { - auto root_graph = hybrid_model_.root_graph_; + auto root_graph = ge_root_model_->GetRootGraph(); if (!GetContext().GetHostExecFlag()) { std::shared_ptr merged_graph; GELOGI("Before merging subgraphs DirectNodesSize = %zu, GetAllNodesSize = %zu", root_graph->GetDirectNodesSize(), root_graph->GetAllNodesSize()); - hybrid_model_.orig_root_graph_ = root_graph; GE_CHK_GRAPH_STATUS_RET(UnfoldSubgraphs(root_graph, merged_graph), "[Invoke][UnfoldSubgraphs]Failed to unfold subgraphs, model_name_:%s.", GetGraphName()); root_graph = std::move(merged_graph); @@ -899,7 +873,6 @@ Status HybridModelBuilder::LoadGraph() { } for (auto &it : hybrid_model_.known_shape_sub_models_) { auto node_item = MutableNodeItem(it.first); - GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); @@ -1148,9 +1121,7 @@ Status HybridModelBuilder::InitWeights() { sub_weight_buffer->GetSize()); auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); if (subgraph != ge_root_model_->GetRootGraph()) { - subgraph = hybrid_model_.root_graph_->GetSubgraph(subgraph_model.first); - } else { - subgraph = hybrid_model_.root_graph_; + subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); } GE_CHECK_NOTNULL(subgraph); hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); @@ -1329,7 +1300,7 @@ Status HybridModelBuilder::IndexTaskDefs(const ComputeGraphPtr &sub_graph, const } Status HybridModelBuilder::IndexTaskDefs() { - const auto &root_graph = hybrid_model_.root_graph_; + const auto root_graph = ge_root_model_->GetRootGraph(); const auto &root_graph_name = root_graph->GetName(); if (SetOutputNameAttr(*root_graph) != SUCCESS) { GELOGW("Set output name attr failed."); @@ -1363,7 +1334,7 @@ Status HybridModelBuilder::IndexTaskDefs() { Status HybridModelBuilder::IndexSpecialNodes() { GELOGD("Start to index special nodes"); - const auto &root_graph = hybrid_model_.root_graph_; + const auto &root_graph = ge_root_model_->GetRootGraph(); for (auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); @@ -1518,7 +1489,7 @@ Status HybridModelBuilder::InitRuntimeParams() { runtime_param_.session_id = ret ? static_cast(value) : 0; ret = ge::AttrUtils::GetInt(first_model, ATTR_MODEL_TASK_GEN_VAR_ADDR, value); runtime_param_.logic_var_base = ret ? static_cast(value) : 0; - runtime_param_.graph_id = hybrid_model_.root_graph_->GetGraphID(); + runtime_param_.graph_id = ge_root_model_->GetRootGraph()->GetGraphID(); value = 0; for (auto &it : ge_root_model_->GetSubgraphInstanceNameToModel()) { (void) ge::AttrUtils::GetInt(it.second, ATTR_MODEL_VAR_SIZE, value); @@ -1655,7 +1626,7 @@ Status HybridModelBuilder::TransAllVarData() { } Status HybridModelBuilder::CopyVarData() { - GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(hybrid_model_.root_graph_, + GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(ge_root_model_->GetRootGraph(), runtime_param_.session_id, hybrid_model_.device_id_), "[Invoke][CopyVarData] failed."); @@ -1738,7 +1709,7 @@ Status HybridModelBuilder::LoadKnownShapedSubgraph(ComputeGraph &graph, NodeItem } Status HybridModelBuilder::RecoverGraphUnknownFlag() { - const auto &root_graph = hybrid_model_.root_graph_; + const auto &root_graph = ge_root_model_->GetRootGraph(); for (auto &sub_graph : root_graph->GetAllSubgraphs()) { GE_CHECK_NOTNULL(sub_graph); for (const auto &node : sub_graph->GetDirectNode()) { diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 05830e82..9c1eb187 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -56,7 +56,6 @@ class HybridModelBuilder { Status BuildOutputMapping(GraphItem &partitioned_call, const NodeItem &node_item, bool is_root_graph); Status ValidateParams(); Status LoadGraph(); - Status CopyGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); static Status InitHcclExecutorOnDemand(const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index b6e3d081..9e8e116e 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -60,10 +60,6 @@ class GeRootModel { bool GetTrainFlag() const { return train_flag_; } - int32_t GetBuildTimes() const { return hybrid_build_times_; } - - void IncreaseBuildTimes() { hybrid_build_times_++; } - private: ComputeGraphPtr root_graph_ = nullptr; std::map subgraph_instance_name_to_model_; @@ -73,7 +69,6 @@ class GeRootModel { bool train_flag_ = false; std::string model_name_; bool is_specific_stream_ = false; - int32_t hybrid_build_times_ = 0; }; } // namespace ge using GeRootModelPtr = std::shared_ptr; diff --git a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc index 827705ae..2dc3b639 100644 --- a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc @@ -249,9 +249,6 @@ TEST_F(UtestSubgraphExecutor, cond_graph_schedule_tasks) { graph_context.callback_manager = std::unique_ptr(new CallbackManager()); ASSERT_EQ(graph_context.callback_manager->Init(), SUCCESS); - auto root_graph = hybrid_model.root_graph_; - switch_t = root_graph->FindNode("switch_t"); - switch_f = root_graph->FindNode("switch_f"); const auto node_it_t = hybrid_model.node_items_.find(switch_t); const auto node_it_f = hybrid_model.node_items_.find(switch_f); ASSERT_NE(hybrid_model.node_items_.end(), node_it_t); diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 10f7c0fe..5567aca2 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -214,17 +214,11 @@ TEST_F(UtestHybridModelBuilder, normal_hybrid_model_build) { ASSERT_EQ(it->second->frame_index_, index); ASSERT_EQ(it->second->parent_frame_, -1); }; - auto root_graph = hybrid_model.root_graph_; - auto enter1_node = root_graph->FindNode("enter"); - auto active1_node = root_graph->FindNode("active1"); - auto active2_node = root_graph->FindNode("active2"); - auto active3_node = root_graph->FindNode("active3"); - auto output1_node = root_graph->FindNode("net_output"); - TestFrameGroup(enter1_node, control_group_index); - TestFrameGroup(active1_node, control_group_index); - TestFrameGroup(active2_node, control_group_index); - TestFrameGroup(active3_node, control_group_index); - TestFrameGroup(output1_node, -1); + TestFrameGroup(enter1, control_group_index); + TestFrameGroup(active1, control_group_index); + TestFrameGroup(active2, control_group_index); + TestFrameGroup(active3, control_group_index); + TestFrameGroup(output1, -1); engine_mapping.clear(); task_executor.clear(); @@ -379,14 +373,4 @@ TEST_F(UtestHybridModelBuilder, TestInitHcclExecutorOnDemand) { NodeExecutorManager::GetInstance().builders_.erase(NodeExecutorManager::ExecutorType::HCCL); ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); } - -TEST_F(UtestHybridModelBuilder, copy_graph_success) { -ComputeGraphPtr graph = std::make_shared("test"); -GeRootModelPtr ge_root_model = make_shared(graph); -HybridModel hybrid_model(ge_root_model); -HybridModelBuilder hybrid_model_builder(hybrid_model); - -Status st = hybrid_model_builder.CopyGraph(); -EXPECT_EQ(st, SUCCESS); -} } // namespace ge From 572990a616dc60da23bcb70fbd436e7f2948cc88 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 26 Jun 2021 23:20:31 +0800 Subject: [PATCH 097/226] UT for control flow group --- tests/depends/mmpa/src/mmpa_stub.cc | 4 + tests/ut/ge/CMakeLists.txt | 3 +- .../build/logical_stream_allocator_unittest.cc | 10 +- .../ut/ge/graph/build/stream_allocator_unittest.cc | 2 +- tests/ut/ge/graph/passes/assert_pass_unittest.cc | 6 +- tests/ut/ge/graph/passes/base_pass_unittest.cc | 14 +-- .../ut/ge/graph/passes/cond_branch_v1_unittest.cc | 6 +- .../graph/passes/constant_folding_pass_unittest.cc | 38 +++--- .../passes/dimension_compute_pass_unittest.cc | 8 +- .../ssd_prior_box_kernel_unittest.cc | 2 +- ...e_data_nodes_with_common_input_pass_unittest.cc | 2 +- .../mark_force_unknown_for_cond_pass_unittest.cc | 129 +++++++++++++++------ tests/ut/ge/graph/passes/merge_pass_unittest.cc | 28 ++--- .../graph/passes/parallel_group_pass_unittest.cc | 12 +- .../graph/passes/reshape_recovery_pass_unittest.cc | 6 +- .../graph/passes/reshape_remove_pass_unittest.cc | 16 +-- .../passes/resource_pair_control_pass_unittest.cc | 2 +- .../passes/switch_logic_remove_pass_unittest.cc | 12 +- .../trans_op_breadth_fusion_pass_unittest.cc | 4 +- .../passes/trans_op_depth_fusion_pass_unittest.cc | 14 +-- ...ransop_nearby_allreduce_fusion_pass_unittest.cc | 4 +- .../ge/graph/passes/variable_op_pass_unittest.cc | 2 +- .../ge/graph/variable_accelerate_ctrl_unittest.cc | 10 +- 23 files changed, 195 insertions(+), 139 deletions(-) diff --git a/tests/depends/mmpa/src/mmpa_stub.cc b/tests/depends/mmpa/src/mmpa_stub.cc index aae8de9f..b0f1fb87 100644 --- a/tests/depends/mmpa/src/mmpa_stub.cc +++ b/tests/depends/mmpa/src/mmpa_stub.cc @@ -345,6 +345,10 @@ INT32 mmIsDir(const CHAR *fileName) INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len) { + const char *env = getenv(name); + if (env != nullptr) { + strcpy(value, env); + } return 0; } diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 95b9e388..57677cf0 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -720,7 +720,6 @@ set(PASS_TEST_FILES "graph/passes/memcpy_addr_async_unittest.cc" "graph/passes/hccl_continuous_pass_unittest.cc" "graph/passes/hccl_memcpy_pass_unittest.cc" - ) set(KERNEL_TEST_FILES @@ -850,7 +849,6 @@ set(HYBRID_TEST_FILES "hybrid/executor/hybrid_model_async_executor_unittest.cc" "hybrid/executor/hybrid_model_pipeline_executor_unittest.cc" "hybrid/node_executor/aicore/aicore_task_compiler_unittest.cc" - ) set(OTHERS_TEST_FILES @@ -877,6 +875,7 @@ add_library(ge_ut_graph STATIC target_compile_definitions(ge_ut_graph PRIVATE google=ascend_private + FMK_SUPPORT_DUMP ) target_compile_options(ge_ut_graph PRIVATE diff --git a/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc b/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc index 218bfd0d..352984fa 100644 --- a/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc +++ b/tests/ut/ge/graph/build/logical_stream_allocator_unittest.cc @@ -349,7 +349,7 @@ class UtestLogicalStreamAllocator : public testing::Test { /// B --> C(AllReduce) --- D /// / /// stream id: 0 A - /// \ + /// \. /// E --> F(AllReduce) --- G /// stream id: 2 2 2 /// @@ -599,7 +599,7 @@ TEST_F(UtestLogicalStreamAllocator, test_label_not_reusable2) { /// case of multi-output, then unuse stream /// sub1 -/// / | \ +/// / | \. /// sub2 sub3 sub4 TEST_F(UtestLogicalStreamAllocator, test_multiOut_new_stream) { SubGraphInfoPtr data = CreateDataSubgraph(); @@ -624,7 +624,7 @@ TEST_F(UtestLogicalStreamAllocator, test_multiOut_new_stream) { /// if paralle id 1, then use stream /// sub1 -/// / | | \ +/// / | | \. /// sub2 sub3 sub4 sub5 TEST_F(UtestLogicalStreamAllocator, test_parallel_one) { SubGraphInfoPtr data = CreateDataSubgraph(); @@ -653,7 +653,7 @@ TEST_F(UtestLogicalStreamAllocator, test_parallel_one) { /// if the param of engine independent is true, then set independent stream /// sub1 -/// / | | \ +/// / | | \. /// sub2 sub3 sub4 sub5 TEST_F(UtestLogicalStreamAllocator, test_independent) { SubGraphInfoPtr data = CreateDataSubgraph(); @@ -692,7 +692,7 @@ TEST_F(UtestLogicalStreamAllocator, test_independent) { /// set stream based on stream label, and then based on independent /// sub1 -/// / | | \ +/// / | | \. /// sub2 sub3 sub4 sub5 TEST_F(UtestLogicalStreamAllocator, test_independent_switch_label) { SubGraphInfoPtr data = CreateDataSubgraph(); diff --git a/tests/ut/ge/graph/build/stream_allocator_unittest.cc b/tests/ut/ge/graph/build/stream_allocator_unittest.cc index 019e75d1..4ae871af 100644 --- a/tests/ut/ge/graph/build/stream_allocator_unittest.cc +++ b/tests/ut/ge/graph/build/stream_allocator_unittest.cc @@ -36,7 +36,7 @@ class UtestStreamAllocator : public testing::Test { /// /// A - /// / \ + /// / \. /// B C /// | | /// D 400 diff --git a/tests/ut/ge/graph/passes/assert_pass_unittest.cc b/tests/ut/ge/graph/passes/assert_pass_unittest.cc index 4aa133d3..9247681c 100644 --- a/tests/ut/ge/graph/passes/assert_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/assert_pass_unittest.cc @@ -55,7 +55,7 @@ class UtestGraphPassesAssertPass : public Test { }; /// D E -/// | \ | \ +/// | \ | \. /// F C G /// : | : /// H A I @@ -134,8 +134,8 @@ TEST_F(UtestGraphPassesAssertPass, assert_pass_test2) { EXPECT_EQ(graph->FindNode("D"), nullptr); } -/// E F -/// | \ | \ +/// E F +/// | \ | \. /// H C -> D G /// \ | : /// A I diff --git a/tests/ut/ge/graph/passes/base_pass_unittest.cc b/tests/ut/ge/graph/passes/base_pass_unittest.cc index 9bba5d77..c687e07f 100644 --- a/tests/ut/ge/graph/passes/base_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/base_pass_unittest.cc @@ -130,7 +130,7 @@ class UTESTGraphPassesBasePass : public testing::Test { /// reshape1 /// | /// add1 -/// / \ +/// / \. /// | | /// data1 const1 ComputeGraphPtr BuildGraph1() { @@ -148,9 +148,9 @@ ComputeGraphPtr BuildGraph1() { } /// sum1 -/// / \ -/// / \ -/// / \ +/// / \. +/// / \. +/// / \. /// reshape1 addn1 /// | c | /// add1 <--- shape1 @@ -217,7 +217,7 @@ void CheckIterOrder(UtestTestPass *pass, std::vector &loop, vector &cond) { /******************************************************************************* - * Exit Identify - * \ / \. - * \ / \. - * Switch Add - * / | | - * / | | - * / | | - * LoopCond | | - * \ | | - * \ | | - * \ | | - * Less | | - * \ | NextIteration - * \ | | - * \ | | - * Merge <---------| - * | - * | - * Enter + * | + * +--------------------- Merge ----------------------+ + * / | + * / | + * / | + * / | + * Exit Identify | + * \ / \. | + * \ / \. | + * Switch Add Add + * / | | | + * / | | | + * / | | | + * LoopCond | | | + * \ | | | + * \ | | | + * \ | | | + * Less | | | + * \ | NextIteration | + * \ | | | + * \ | | | + * Merge <---------| | + * | | + * | | + * Enter | + * \ | + * \ | + * Switch Switch + * | | + * +-----------------Equal----------------------+ + * | ******************************************************************************/ - auto data1 = CreateNode(*graph, "data", DATA, 1, 1); + auto data1 = CreateNode(*graph, "data1", DATA, 1, 1); + auto data2 = CreateNode(*graph, "data2", DATA, 1, 1); + + auto equal1 = CreateNode(*graph, "equal1", EQUAL, 2, 1); + auto switch1 = CreateNode(*graph, "switch1", SWITCH, 2, 2); + auto switch2 = CreateNode(*graph, "switch2", SWITCH, 2, 2); + auto enter1 = CreateNode(*graph, "enter", ENTER, 1, 1); - auto merge1 = CreateNode(*graph, "merge", MERGE, 2, 2); - auto less1 = CreateNode(*graph, "less", LESS, 2, 1); + auto merge1 = CreateNode(*graph, "merge1", MERGE, 2, 2); + auto less1 = CreateNode(*graph, "less1", LESS, 2, 1); auto loop1 = CreateNode(*graph, "loopcond", LOOPCOND, 1, 1); - auto switch1 = CreateNode(*graph, "switch", SWITCH, 2, 2); + auto switch3 = CreateNode(*graph, "switch3", SWITCH, 2, 2); auto ident1 = CreateNode(*graph, "identity", IDENTITY, 1, 1); - auto add1 = CreateNode(*graph, "add", ADD, 2, 1); + auto add1 = CreateNode(*graph, "add1", ADD, 2, 1); auto next1 = CreateNode(*graph, "next", NEXTITERATION, 1, 1); auto exit1 = CreateNode(*graph, "exit", EXIT, 1, 1); - auto value0 = CreateNode(*graph, "const", CONSTANT, 0, 1); - auto value1 = CreateNode(*graph, "const", CONSTANT, 0, 1); + auto value1 = CreateNode(*graph, "const1", CONSTANT, 0, 1); + + auto value2 = CreateNode(*graph, "const2", CONSTANT, 0, 1); + auto add2 = CreateNode(*graph, "add2", ADD, 2, 1); + auto merge2 = CreateNode(*graph, "merge2", MERGE, 2, 2); auto output1 = CreateNode(*graph, "net_output", NETOUTPUT, 1, 1); - GraphUtils::AddEdge(data1->GetOutDataAnchor(0), enter1->GetInDataAnchor(0)); + GraphUtils::AddEdge(data1->GetOutDataAnchor(0), equal1->GetInDataAnchor(0)); + GraphUtils::AddEdge(data2->GetOutDataAnchor(0), equal1->GetInDataAnchor(1)); + GraphUtils::AddEdge(data1->GetOutDataAnchor(0), switch1->GetInDataAnchor(0)); + GraphUtils::AddEdge(data2->GetOutDataAnchor(0), switch2->GetInDataAnchor(0)); + GraphUtils::AddEdge(equal1->GetOutDataAnchor(0), switch1->GetInDataAnchor(1)); + GraphUtils::AddEdge(equal1->GetOutDataAnchor(0), switch2->GetInDataAnchor(1)); + cond.emplace_back(switch1); + cond.emplace_back(switch2); + + GraphUtils::AddEdge(switch1->GetOutDataAnchor(0), enter1->GetInDataAnchor(0)); // false GraphUtils::AddEdge(enter1->GetOutDataAnchor(0), merge1->GetInDataAnchor(0)); GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), less1->GetInDataAnchor(0)); GraphUtils::AddEdge(value1->GetOutDataAnchor(0), less1->GetInDataAnchor(1)); GraphUtils::AddEdge(less1->GetOutDataAnchor(0), loop1->GetInDataAnchor(0)); - GraphUtils::AddEdge(loop1->GetOutDataAnchor(0), switch1->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), switch1->GetInDataAnchor(1)); + GraphUtils::AddEdge(loop1->GetOutDataAnchor(0), switch3->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), switch3->GetInDataAnchor(1)); + loop.emplace_back(merge1); - GraphUtils::AddEdge(switch1->GetOutDataAnchor(0), exit1->GetInDataAnchor(0)); - GraphUtils::AddEdge(switch1->GetOutDataAnchor(1), ident1->GetInDataAnchor(0)); + GraphUtils::AddEdge(switch3->GetOutDataAnchor(0), exit1->GetInDataAnchor(0)); // false + GraphUtils::AddEdge(switch3->GetOutDataAnchor(1), ident1->GetInDataAnchor(0)); // true + loop.emplace_back(switch3); GraphUtils::AddEdge(ident1->GetOutDataAnchor(0), add1->GetInDataAnchor(0)); GraphUtils::AddEdge(value1->GetOutDataAnchor(0), add1->GetInDataAnchor(1)); GraphUtils::AddEdge(add1->GetOutDataAnchor(0), next1->GetInDataAnchor(0)); - GraphUtils::AddEdge(next1->GetOutDataAnchor(0), merge1->GetInDataAnchor(1)); - GraphUtils::AddEdge(exit1->GetOutDataAnchor(0), output1->GetInDataAnchor(0)); - merge = merge1; + GraphUtils::AddEdge(switch2->GetOutDataAnchor(1), add2->GetInDataAnchor(1)); // true + GraphUtils::AddEdge(value2->GetOutDataAnchor(0), add2->GetInDataAnchor(0)); + + GraphUtils::AddEdge(exit1->GetOutDataAnchor(0), merge2->GetInDataAnchor(0)); + GraphUtils::AddEdge(add2->GetOutDataAnchor(0), merge2->GetInDataAnchor(1)); + GraphUtils::AddEdge(merge2->GetOutDataAnchor(0), output1->GetInDataAnchor(0)); + + cond.emplace_back(merge2); + merge = merge2; } static void CreateCondGraph(ComputeGraphPtr &graph, NodePtr &merge) { @@ -197,12 +235,27 @@ static void CreateCondGraph(ComputeGraphPtr &graph, NodePtr &merge) { TEST_F(UtestMarkForceUnknownForCondPass, skip_while_loop_merge) { auto graph = std::make_shared("test_graph"); NodePtr merge; - CreateLoopGraph(graph, merge); - - AttrUtils::SetBool(merge->GetOpDesc(), ATTR_NAME_FORCE_UNKNOWN_SHAPE, true); + vector loop; + vector cond; + CreateLoopGraph(graph, merge, loop, cond); MarkForceUnknownForCondPass mark_force_unknown_pass; EXPECT_EQ(mark_force_unknown_pass.Run(graph), SUCCESS); // skip LoopCond + setenv("DUMP_GE_GRAPH", "1", true); + GE_DUMP(graph, "control_group"); + unsetenv("DUMP_GE_GRAPH"); + + EXPECT_EQ(loop.size(), 2); + for (const auto &node : loop) { + EXPECT_FALSE(node->GetOpDesc()->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP)); + } + + EXPECT_EQ(cond.size(), 3); + for (const auto &node : cond) { + int64_t group_index = -1; + EXPECT_TRUE(AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index)); + EXPECT_EQ(group_index, merge->GetOpDesc()->GetId()); + } } TEST_F(UtestMarkForceUnknownForCondPass, skip_known_shape_merge) { diff --git a/tests/ut/ge/graph/passes/merge_pass_unittest.cc b/tests/ut/ge/graph/passes/merge_pass_unittest.cc index 75fdb21b..f8f0afea 100644 --- a/tests/ut/ge/graph/passes/merge_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/merge_pass_unittest.cc @@ -110,8 +110,8 @@ TEST_F(UtestGraphPassesMergePass, multiple_inputs) { } /// Merge -/// | \ -/// | \ +/// | \. +/// | \. /// Op1 Op2 Merge2 /// \ | | /// \ | Op3 @@ -137,10 +137,10 @@ TEST_F(UtestGraphPassesMergePass, empty_input_cut_branch_meet_net_output_with_da } /// Merge -/// | \ -/// | \ +/// | \. +/// | \. /// Op1 Op2 Merge2 -/// \ | | \ +/// \ | | \. /// \ | Op3 /// \ | : /// NetOutput @@ -165,8 +165,8 @@ TEST_F(UtestGraphPassesMergePass, empty_input_cut_branch_meet_net_output_with_co TEST_F(UtestGraphPassesMergePass, empty_input_cut_branch) { /// Merge - /// | \ - /// | \ + /// | \. + /// | \. /// Op1 Op2 Merge2 /// \ | | /// \ | Op3 @@ -210,7 +210,7 @@ TEST_F(UtestGraphPassesMergePass, empty_input_cut_branch) { /// Op1 Op2 Merge2 /// \ | /// \ Op3 - /// \ + /// \. /// Merge3 ret = pass_.Run(merge_node2); @@ -224,7 +224,7 @@ TEST_F(UtestGraphPassesMergePass, single_non_const_input) { /// Op1 /// | /// Merge - /// / \ + /// / \. /// Op2 Op3 auto merge_node = NewNode("Merge", MERGE, 1, 2); auto node1 = NewNode("Op1", RELU, 1, 1); @@ -253,7 +253,7 @@ TEST_F(UtestGraphPassesMergePass, single_const_input) { /// Const /// | /// Merge Pass Const - /// / \ ===> / \ + /// / \ ===> / \. /// Op1 Op2 Op1 Op2 auto merge_node = NewNode("Merge", MERGE, 1, 2); auto const_node = NewNode("Const", CONSTANT, 1, 1); @@ -284,7 +284,7 @@ TEST_F(UtestGraphPassesMergePass, single_const_input_value_index_two_out_nodes) /// / | ===> / \(control anchor) /// Op1 | \ Op1 Constant /// Op2 Op3 | - /// / \ + /// / \. /// Op2 Op3 auto merge_node = NewNode("Merge", MERGE, 1, 2); auto const_node = NewNode("Const", CONSTANT, 1, 1); @@ -329,7 +329,7 @@ TEST_F(UtestGraphPassesMergePass, single_const_input_value_index_two_out_nodes1) /// / | ===> / \(control anchor) /// Op1 | \ Op1 Constant /// Op2 Op3 | - /// / \ + /// / \. /// Op2 Op3 auto merge_node = NewNode("Merge", MERGE, 1, 2); auto const_node = NewNode("Const", CONSTANT, 1, 1); @@ -357,7 +357,7 @@ TEST_F(UtestGraphPassesMergePass, const_with_control_input) { /// C /// | /// Merge - /// / \ + /// / \. /// Op1 Op2 auto switch_node = NewNode("Switch", SWITCH, 1, 2); auto identity_node = NewNode("Identity", SWITCH, 1, 1); @@ -381,7 +381,7 @@ TEST_F(UtestGraphPassesMergePass, const_with_control_input) { /// . /// . /// C - /// / \ + /// / \. /// Op1 Op2 auto ret = pass_.Run(merge_node); EXPECT_EQ(ret, SUCCESS); diff --git a/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc b/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc index d5b1db41..374fe837 100644 --- a/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc @@ -66,11 +66,11 @@ class UtestGraphPassesParallelGgroupPass : public testing::Test { void BuildDefaultGraph() { /// input - /// \ + /// \. /// sqrt pred /// \ / /// cast - /// / \ + /// / \. /// switch_t switch_f /// | | /// F T @@ -118,13 +118,13 @@ class UtestGraphPassesParallelGgroupPass : public testing::Test { void BuildDefaultGraph1() { /// input - /// \ + /// \. /// sqrt pred /// \ / /// Switch /// | | /// ----F T---- - /// \ | / \ + /// \ | / \. /// \ Merge1 Merge2 /// \_________| input_node_ = NewNode("input", RELU, 0, 1); @@ -164,14 +164,14 @@ class UtestGraphPassesParallelGgroupPass : public testing::Test { void BuildDefaultGraph2() { /// input input1 - /// \ \ + /// \ \. /// sqrt pred sqrt1 pred1 /// \ / \ / /// Switch Switch1 /// | | _______| /// | | / /// ____F T____ - /// \ | / \ + /// \ | / \. /// \ Merge1 Merge2 /// \__________| input_node_ = NewNode("input", RELU, 0, 2); diff --git a/tests/ut/ge/graph/passes/reshape_recovery_pass_unittest.cc b/tests/ut/ge/graph/passes/reshape_recovery_pass_unittest.cc index 3be11452..f941645e 100644 --- a/tests/ut/ge/graph/passes/reshape_recovery_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/reshape_recovery_pass_unittest.cc @@ -31,9 +31,9 @@ class UtestReshapeRecoveryPass : public testing::Test { namespace { /// netoutput1 -/// | \ -///transdata1 \ -/// | \ +/// | \. +///transdata1 \. +/// | \. /// | transdata2 /// | / /// var1 const1 diff --git a/tests/ut/ge/graph/passes/reshape_remove_pass_unittest.cc b/tests/ut/ge/graph/passes/reshape_remove_pass_unittest.cc index 351e96d7..ca0cac86 100644 --- a/tests/ut/ge/graph/passes/reshape_remove_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/reshape_remove_pass_unittest.cc @@ -35,7 +35,7 @@ namespace { /// transdata1 /// | /// reshape1 -/// | \ +/// | \. /// var1 const1 ut::GraphBuilder Graph1Builder() { ut::GraphBuilder builder = ut::GraphBuilder("g1"); @@ -55,11 +55,11 @@ ut::GraphBuilder Graph1Builder() { } /// netoutput1 -/// | \ -///transdata1 \ -/// | \ +/// | \. +///transdata1 \. +/// | \. /// reshape1 reshape2 -/// | \ / \ +/// | \ / \. /// var1 const1 var2 ut::GraphBuilder Graph2Builder() { ut::GraphBuilder builder = ut::GraphBuilder("g2"); @@ -83,9 +83,9 @@ ut::GraphBuilder Graph2Builder() { } /// netoutput1 -/// | \ -///transdata1 \ -/// | \ +/// | \. +///transdata1 \. +/// | \. /// reshape1 transdata2 /// | \ / /// var1 const1 diff --git a/tests/ut/ge/graph/passes/resource_pair_control_pass_unittest.cc b/tests/ut/ge/graph/passes/resource_pair_control_pass_unittest.cc index 6d12a49d..8cdfd0c7 100644 --- a/tests/ut/ge/graph/passes/resource_pair_control_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/resource_pair_control_pass_unittest.cc @@ -34,7 +34,7 @@ class UtestResourcePairControlPass : public testing::Test { namespace { /// netoutput1 -/// | \ +/// | \. /// StackPush StackPop /// | | /// var1 const1 diff --git a/tests/ut/ge/graph/passes/switch_logic_remove_pass_unittest.cc b/tests/ut/ge/graph/passes/switch_logic_remove_pass_unittest.cc index dcad318c..22734047 100644 --- a/tests/ut/ge/graph/passes/switch_logic_remove_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/switch_logic_remove_pass_unittest.cc @@ -63,9 +63,9 @@ ComputeGraphPtr BuildGraph1() { /// netoutput1 /// | /// merge1 -/// / \ +/// / \. /// / add1 -/// / F| \ +/// / F| \. /// addn1 swtich2 var3 /// \F T/ | /// switch1 | @@ -101,9 +101,9 @@ ComputeGraphPtr BuildGraph2() { /// add1 /// / \T /// var3 swtich2 -/// T/ \ -/// switch1 \ -/// / \ \ +/// T/ \. +/// switch1 \. +/// / \ \. /// var1 var2 var4 ComputeGraphPtr BuildGraph3() { auto builder = ut::GraphBuilder("g3"); @@ -129,7 +129,7 @@ ComputeGraphPtr BuildGraph3() { /// netoutput1 /// | /// merge1 -/// / \ +/// / \. /// add1 addn1 /// / \T F/ /// var3 swtich2 diff --git a/tests/ut/ge/graph/passes/trans_op_breadth_fusion_pass_unittest.cc b/tests/ut/ge/graph/passes/trans_op_breadth_fusion_pass_unittest.cc index dbb163e1..d05bd695 100644 --- a/tests/ut/ge/graph/passes/trans_op_breadth_fusion_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/trans_op_breadth_fusion_pass_unittest.cc @@ -402,7 +402,7 @@ TEST_F(UtestGraphPassesTransOpBreadthFusionPass, test_multi_anchor_case) { } /// ----> netoutput1 -/// / | \ +/// / | \. /// transdata1 transdata2 transdata3 /// \ / | /// var1-------------- @@ -432,7 +432,7 @@ static ComputeGraphPtr BuildGraph1() { } /// ---------> netoutput1 -/// / | \ +/// / | \. /// transdata1 transdata2(l1) transdata3(l1) /// \ / | /// var1------------------ diff --git a/tests/ut/ge/graph/passes/trans_op_depth_fusion_pass_unittest.cc b/tests/ut/ge/graph/passes/trans_op_depth_fusion_pass_unittest.cc index a9ea41ea..dbac3246 100644 --- a/tests/ut/ge/graph/passes/trans_op_depth_fusion_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/trans_op_depth_fusion_pass_unittest.cc @@ -456,19 +456,19 @@ TEST_F(UtestGraphPassesTransOpDepthFusionPass, test_transop_with_multi_out_edge) /// -->transpose1 -->transpose3-->sinh2 /// | \ / /// | -->transpose2 - /// | \ + /// | \. /// / -->cast3-->cast4-->sinh3 /// / /// / -->transpose4-->transpose5-->sinh4 /// / / /// Node4D-->Cast1-->Cast2-->Cast5 -->reshape2-->sinh5 - /// \ \ + /// \ \. /// \ -->sinh6 - /// \ + /// \. /// \ -->transpose6-->transpose7-->sinh9 /// \ / /// -->reshape-->cast6-->cast7-->sinh8 - /// \ + /// \. /// -->sinh7 /// after optimized graph @@ -479,15 +479,15 @@ TEST_F(UtestGraphPassesTransOpDepthFusionPass, test_transop_with_multi_out_edge) /// / /-->transpose3-->sinh2 /// -->Cast1 /// / \-->sinh7 - /// / \ + /// / \. /// / -->sinh9 /// Node4D /// \ -->sinh4 /// \ / /// -->Cast5-->sinh5 - /// \ \ + /// \ \. /// \ -->sinh6 - /// \ + /// \. /// -->Cast7-->sinh8 ge::ComputeGraphPtr graph = std::make_shared("test"); diff --git a/tests/ut/ge/graph/passes/transop_nearby_allreduce_fusion_pass_unittest.cc b/tests/ut/ge/graph/passes/transop_nearby_allreduce_fusion_pass_unittest.cc index 1220b35e..9c6d8276 100644 --- a/tests/ut/ge/graph/passes/transop_nearby_allreduce_fusion_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/transop_nearby_allreduce_fusion_pass_unittest.cc @@ -180,7 +180,7 @@ ComputeGraphPtr GetGraph7(size_t symmetric_transdata_num, size_t asymmetric_tran /// TransData TransData ... MatMul ... /// \ | / / / /// HcomAllReduce - /// / | \ \ \ + /// / | \ \ \. /// TransData TransData ... RealDiv ... ComputeGraphPtr graph = std::make_shared("test"); NodePtr allreduce = @@ -340,7 +340,7 @@ TEST(UtestTransopNearbyAllreduceFusionPass, test7_all_reduce_with_multiple_trans /// TransData TransData ... MatMul ... /// \ | / / / /// HcomAllReduce - /// / | \ \ \ + /// / | \ \ \. /// TransData TransData ... RealDiv ... size_t symmetric_transdata_num = 20; size_t asymmetric_transdata_num = 20; diff --git a/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc b/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc index f1ea7a27..655867a7 100644 --- a/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/variable_op_pass_unittest.cc @@ -66,7 +66,7 @@ namespace { /// transdata2 /// | /// assign1 -/// / \ +/// / \. /// transdata1 | /// | | /// var1 const1 diff --git a/tests/ut/ge/graph/variable_accelerate_ctrl_unittest.cc b/tests/ut/ge/graph/variable_accelerate_ctrl_unittest.cc index 37b4bda7..bf350b6c 100644 --- a/tests/ut/ge/graph/variable_accelerate_ctrl_unittest.cc +++ b/tests/ut/ge/graph/variable_accelerate_ctrl_unittest.cc @@ -35,8 +35,8 @@ namespace { /// shapeNo1 /// | /// addnYes1 -/// / \ -/// / \ +/// / \. +/// / \. /// const1 const2 ComputeGraphPtr BuildGraph1() { @@ -57,9 +57,9 @@ ComputeGraphPtr BuildGraph1() { /// /// netoutput1 -/// / \ \ -/// add1 assign1 \ -/// / \ / \ \ +/// / \ \. +/// add1 assign1 \. +/// / \ / \ \. /// var1 var2 const1 var3 ComputeGraphPtr BuildGraph2() { From a4aae38d72c9bc0e564ecce4d6da4ad02d46a0fd Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 26 Jun 2021 23:25:58 +0800 Subject: [PATCH 098/226] Remove UT dump env --- tests/ut/ge/graph/passes/mark_force_unknown_for_cond_pass_unittest.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/ut/ge/graph/passes/mark_force_unknown_for_cond_pass_unittest.cc b/tests/ut/ge/graph/passes/mark_force_unknown_for_cond_pass_unittest.cc index 50991822..557359b7 100644 --- a/tests/ut/ge/graph/passes/mark_force_unknown_for_cond_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/mark_force_unknown_for_cond_pass_unittest.cc @@ -241,9 +241,6 @@ TEST_F(UtestMarkForceUnknownForCondPass, skip_while_loop_merge) { MarkForceUnknownForCondPass mark_force_unknown_pass; EXPECT_EQ(mark_force_unknown_pass.Run(graph), SUCCESS); // skip LoopCond - setenv("DUMP_GE_GRAPH", "1", true); - GE_DUMP(graph, "control_group"); - unsetenv("DUMP_GE_GRAPH"); EXPECT_EQ(loop.size(), 2); for (const auto &node : loop) { From 020d7cb8a04780fb7cf99ddd8a578281a26128ce Mon Sep 17 00:00:00 2001 From: lichun Date: Mon, 28 Jun 2021 10:34:54 +0800 Subject: [PATCH 099/226] remove SetDataType --- ge/hybrid/executor/subgraph_executor.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 6979d05f..33a2846c 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -109,7 +109,6 @@ Status SubgraphExecutor::InitInputsForUnknownShape(const std::vectorSetShape(tensor_desc->GetShape()); output_desc->SetOriginShape(tensor_desc->GetOriginShape()); - output_desc->SetDataType(tensor_desc->GetDataType()); node_state->SetSkipInferShape(true); } } From 91fd6e45ddd8ccbc0d1289c59efffac3ebbd2d13 Mon Sep 17 00:00:00 2001 From: WeiGangqiang Date: Tue, 22 Jun 2021 14:53:24 +0800 Subject: [PATCH 100/226] add ge running env config and perfact graph dsl --- .clang-format | 2 +- build.sh | 7 +- ge/ge_runtime/task/hccl_task.cc | 1 + tests/depends/slog/src/slog_stub.cc | 62 ++++++--- tests/framework/CMakeLists.txt | 4 +- tests/framework/cmake/graphengine.cmake | 31 +---- .../include/ge_graph_dsl/op_desc/op_desc_cfg_box.h | 34 +++-- .../framework/ge_graph_dsl/src/op_desc_cfg_box.cc | 29 +++- .../ge_graph_dsl/tests/op_desc_config_test.cc | 75 +++++++++++ .../ge_graph_dsl/tests/stub/optype_stub.cc | 1 + tests/framework/ge_running_env/CMakeLists.txt | 18 +++ .../ge_running_env/include/CMakeLists.txt | 17 +++ .../include/ge_running_env/env_installer.h} | 29 ++-- .../include/ge_running_env/fake_engine.h | 56 ++++++++ .../include/ge_running_env/fake_ns.h | 28 ++++ .../include/ge_running_env/fake_op.h | 49 +++++++ .../ge_running_env/fake_ops_kernel_builder.h} | 39 ++---- .../ge_running_env/fake_ops_kernel_info_store.h | 39 ++++++ .../include/ge_running_env/ge_running_env_faker.h | 45 +++++++ .../include/ge_running_env/info_store_holder.h} | 40 +++--- tests/framework/ge_running_env/src/CMakeLists.txt | 45 +++++++ .../ge_running_env/src/engine/fake_engine.cc | 81 +++++++++++ .../src/engine/fake_ops_kernel_builder.cc} | 43 ++---- .../src/engine/fake_ops_kernel_info_store.cc | 42 ++++++ .../ge_running_env/src/engine/info_store_holder.cc | 49 +++++++ .../src/env/ge_default_running_env.cc | 56 ++++++++ .../src/env/ge_default_running_env.h | 32 +++++ .../ge_running_env/src/env/ge_running_env_faker.cc | 109 +++++++++++++++ tests/framework/ge_running_env/src/op/fake_op.cc | 95 +++++++++++++ .../ge_running_env/src/op/fake_op_repo.cc | 39 ++++++ .../framework/ge_running_env/src/op/fake_op_repo.h | 31 +++++ .../framework/ge_running_env/tests/CMakeLists.txt | 33 +++++ .../tests/test_ge_running_env_faker.cc | 148 +++++++++++++++++++++ tests/framework/ge_running_env/tests/test_main.cc | 34 +++++ tests/framework/stub_engine/CMakeLists.txt | 58 -------- tests/framework/stub_engine/engine/stub_engine.cc | 74 ----------- tests/framework/stub_engine/engine/stub_engine.h | 127 ------------------ tests/framework/stub_engine/inc/st_types.h | 33 ----- .../stub_engine/ops_kernel_store/op/host_op.cc | 41 ------ .../ops_kernel_store/op/stub_op_factory.cc | 51 ------- .../ops_kernel_store/op/stub_op_factory.h | 109 --------------- .../ops_kernel_store/stub_ops_kernel_store.cc | 77 ----------- .../ops_kernel_store/stub_ops_kernel_store.h | 73 ---------- tests/st/testcase/CMakeLists.txt | 2 +- tests/st/testcase/test_framework_dummy.cc | 16 +-- tests/st/testcase/test_main.cc | 37 ++++++ 46 files changed, 1328 insertions(+), 813 deletions(-) create mode 100644 tests/framework/ge_graph_dsl/tests/op_desc_config_test.cc create mode 100644 tests/framework/ge_running_env/CMakeLists.txt create mode 100644 tests/framework/ge_running_env/include/CMakeLists.txt rename tests/framework/{stub_engine/ops_kernel_store/op/host_op.h => ge_running_env/include/ge_running_env/env_installer.h} (52%) create mode 100644 tests/framework/ge_running_env/include/ge_running_env/fake_engine.h create mode 100644 tests/framework/ge_running_env/include/ge_running_env/fake_ns.h create mode 100644 tests/framework/ge_running_env/include/ge_running_env/fake_op.h rename tests/framework/{stub_engine/ops_kernel_store/stub_ops_kernel_builder.h => ge_running_env/include/ge_running_env/fake_ops_kernel_builder.h} (59%) create mode 100644 tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_info_store.h create mode 100644 tests/framework/ge_running_env/include/ge_running_env/ge_running_env_faker.h rename tests/framework/{stub_engine/ops_kernel_store/op/op.h => ge_running_env/include/ge_running_env/info_store_holder.h} (51%) create mode 100644 tests/framework/ge_running_env/src/CMakeLists.txt create mode 100644 tests/framework/ge_running_env/src/engine/fake_engine.cc rename tests/framework/{stub_engine/ops_kernel_store/stub_ops_kernel_builder.cc => ge_running_env/src/engine/fake_ops_kernel_builder.cc} (73%) create mode 100644 tests/framework/ge_running_env/src/engine/fake_ops_kernel_info_store.cc create mode 100644 tests/framework/ge_running_env/src/engine/info_store_holder.cc create mode 100644 tests/framework/ge_running_env/src/env/ge_default_running_env.cc create mode 100644 tests/framework/ge_running_env/src/env/ge_default_running_env.h create mode 100644 tests/framework/ge_running_env/src/env/ge_running_env_faker.cc create mode 100644 tests/framework/ge_running_env/src/op/fake_op.cc create mode 100644 tests/framework/ge_running_env/src/op/fake_op_repo.cc create mode 100644 tests/framework/ge_running_env/src/op/fake_op_repo.h create mode 100644 tests/framework/ge_running_env/tests/CMakeLists.txt create mode 100644 tests/framework/ge_running_env/tests/test_ge_running_env_faker.cc create mode 100644 tests/framework/ge_running_env/tests/test_main.cc delete mode 100644 tests/framework/stub_engine/CMakeLists.txt delete mode 100644 tests/framework/stub_engine/engine/stub_engine.cc delete mode 100644 tests/framework/stub_engine/engine/stub_engine.h delete mode 100644 tests/framework/stub_engine/inc/st_types.h delete mode 100644 tests/framework/stub_engine/ops_kernel_store/op/host_op.cc delete mode 100644 tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.cc delete mode 100644 tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.h delete mode 100644 tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.cc delete mode 100644 tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.h create mode 100644 tests/st/testcase/test_main.cc diff --git a/.clang-format b/.clang-format index c931e8f0..e7f9d935 100644 --- a/.clang-format +++ b/.clang-format @@ -50,7 +50,7 @@ CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 2 +ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: true DisableFormat: false diff --git a/build.sh b/build.sh index 61f86945..dbbf696b 100755 --- a/build.sh +++ b/build.sh @@ -144,7 +144,6 @@ build_graphengine() CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_UT=ON" fi - if [[ "X$ENABLE_GE_ST" = "Xon" ]]; then CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" fi @@ -176,7 +175,7 @@ build_graphengine() TARGET="ge_compiler atc_atc.bin ge_executor_shared ${TARGET}" elif [ "X$ENABLE_GE_ST" = "Xon" ] then - TARGET="ge_graph_dsl_test graph_engine_test" + TARGET="ge_graph_dsl_test ge_running_env_test graph_engine_test" 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" @@ -244,13 +243,13 @@ if [[ "X$ENABLE_GE_ST" = "Xon" ]]; then mkdir -p ${OUTPUT_PATH}/plugin/opskernel cp ${BUILD_PATH}/tests/framework/libnnengine.so ${OUTPUT_PATH}/plugin/nnengine cp ${BUILD_PATH}/engine_conf.json ${OUTPUT_PATH}/plugin/nnengine/ge_config - cp ${BUILD_PATH}/tests/framework/libhost_cpu_engine.so ${OUTPUT_PATH}/plugin/opskernel cp ${BUILD_PATH}/tests/framework/libge_local_engine.so ${OUTPUT_PATH}/plugin/opskernel - cp ${BUILD_PATH}/tests/framework/stub_engine/libfe.so ${OUTPUT_PATH}/plugin/opskernel #prepare st execution bin cp ${BUILD_PATH}/tests/st/testcase/graph_engine_test ${OUTPUT_PATH} + cp ${BUILD_PATH}/tests/framework/ge_running_env/tests/ge_running_env_test ${OUTPUT_PATH} cp ${BUILD_PATH}/tests/framework/ge_graph_dsl/tests/ge_graph_dsl_test ${OUTPUT_PATH} #execute st testcase + RUN_TEST_CASE=${OUTPUT_PATH}/ge_running_env_test && ${RUN_TEST_CASE} RUN_TEST_CASE=${OUTPUT_PATH}/graph_engine_test && ${RUN_TEST_CASE} RUN_TEST_CASE=${OUTPUT_PATH}/ge_graph_dsl_test && ${RUN_TEST_CASE} if [[ "$?" -ne 0 ]]; then diff --git a/ge/ge_runtime/task/hccl_task.cc b/ge/ge_runtime/task/hccl_task.cc index 2ffe5185..b1c7158c 100644 --- a/ge/ge_runtime/task/hccl_task.cc +++ b/ge/ge_runtime/task/hccl_task.cc @@ -16,6 +16,7 @@ #include "ge_runtime/task/hccl_task.h" #include +#include "framework/common/util.h" #include "ge_runtime/task/task_factory.h" #include "common/opskernel/ops_kernel_info_store.h" #include "common/opskernel/ge_task_info.h" diff --git a/tests/depends/slog/src/slog_stub.cc b/tests/depends/slog/src/slog_stub.cc index d0eb49c5..238a6b37 100644 --- a/tests/depends/slog/src/slog_stub.cc +++ b/tests/depends/slog/src/slog_stub.cc @@ -23,13 +23,46 @@ void dav_log(int module_id, const char *fmt, ...) {} -void DlogErrorInner(int module_id, const char *fmt, ...) { dav_log(module_id, fmt); } +static int log_level = DLOG_ERROR; + +#define __DO_PRINT() \ + do { \ + const int FMT_BUFF_SIZE = 1024; \ + char fmt_buff[FMT_BUFF_SIZE] = {0}; \ + va_list valist; \ + va_start(valist, fmt); \ + vsnprintf(fmt_buff, FMT_BUFF_SIZE, fmt, valist); \ + va_end(valist); \ + printf("%s \n", fmt_buff); \ + } while (0) + +void DlogErrorInner(int module_id, const char *fmt, ...) { + if (log_level > DLOG_ERROR) { + return; + } + __DO_PRINT(); +} -void DlogWarnInner(int module_id, const char *fmt, ...) { dav_log(module_id, fmt); } +void DlogWarnInner(int module_id, const char *fmt, ...) { + if (log_level > DLOG_WARN) { + return; + } + __DO_PRINT(); +} -void DlogInfoInner(int module_id, const char *fmt, ...) { dav_log(module_id, fmt); } +void DlogInfoInner(int module_id, const char *fmt, ...) { + if (log_level > DLOG_INFO) { + return; + } + __DO_PRINT(); +} -void DlogDebugInner(int module_id, const char *fmt, ...) { dav_log(module_id, fmt); } +void DlogDebugInner(int module_id, const char *fmt, ...) { + if (log_level > DLOG_DEBUG) { + return; + } + __DO_PRINT(); +} void DlogEventInner(int module_id, const char *fmt, ...) { dav_log(module_id, fmt); } @@ -39,30 +72,25 @@ void DlogWithKVInner(int module_id, int level, KeyValue *pst_kv_array, int kv_nu dav_log(module_id, fmt); } -int dlog_setlevel(int module_id, int level, int enable_event) { return DLOG_DEBUG; } +int dlog_setlevel(int module_id, int level, int enable_event) { + log_level = level; + return log_level; +} -int dlog_getlevel(int module_id, int *enable_event) { return DLOG_DEBUG; } +int dlog_getlevel(int module_id, int *enable_event) { return log_level; } -int CheckLogLevel(int moduleId, int logLevel) -{ - return 1; -} +int CheckLogLevel(int moduleId, int log_level_check) { return log_level >= log_level_check; } /** * @ingroup plog * @brief DlogReportInitialize: init log in service process before all device setting. * @return: 0: SUCCEED, others: FAILED */ -int DlogReportInitialize() { - return 0; -} +int DlogReportInitialize() { return 0; } /** * @ingroup plog * @brief DlogReportFinalize: release log resource in service process after all device reset. * @return: 0: SUCCEED, others: FAILED */ -int DlogReportFinalize() { - return 0; -} - +int DlogReportFinalize() { return 0; } diff --git a/tests/framework/CMakeLists.txt b/tests/framework/CMakeLists.txt index d7c806a6..8a2218b4 100644 --- a/tests/framework/CMakeLists.txt +++ b/tests/framework/CMakeLists.txt @@ -15,8 +15,8 @@ include(cmake/graphengine.cmake) add_subdirectory(easy_graph) -add_subdirectory(stub_engine) add_subdirectory(ge_graph_dsl) +add_subdirectory(ge_running_env) file(GLOB_RECURSE UTILS_SRC CONFIGURE_DEPENDS "utils/*.cc" @@ -29,4 +29,4 @@ target_include_directories(framework ) set_target_properties(framework PROPERTIES CXX_STANDARD 11) -target_link_libraries(framework PUBLIC ge_graph_dsl graphengine fe) +target_link_libraries(framework PUBLIC ge_graph_dsl ge_with_env) diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index 81aa00cc..3c18b560 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -150,7 +150,7 @@ set_target_properties(metadef_graph PROPERTIES CXX_STANDARD 11) # ---- Target : Local engine ---- -add_library(ge_local_engine SHARED ${LOCAL_ENGINE_SRC} ${METADEF_REGISTER_SRCS}) +add_library(ge_local_engine SHARED ${LOCAL_ENGINE_SRC}) target_include_directories(ge_local_engine PUBLIC @@ -169,38 +169,11 @@ target_compile_options(ge_local_engine PRIVATE target_link_libraries(ge_local_engine PUBLIC $ ${STUB_LIBS} - metadef_graph -lrt -ldl -lpthread -lgcov ) set_target_properties(ge_local_engine PROPERTIES CXX_STANDARD 11) -# ---- Target : Host engine ---- - -add_library(host_cpu_engine SHARED ${HOST_ENGINE_SRC}) - -target_include_directories(host_cpu_engine - PUBLIC - "${INCLUDE_DIRECTORIES}" - "${GE_CODE_DIR}/ge/host_cpu_engine" -) - -target_compile_definitions(host_cpu_engine PRIVATE - google=ascend_private - FMK_SUPPORT_DUMP -) - -target_compile_options(host_cpu_engine PRIVATE - -g --coverage -fprofile-arcs -ftest-coverage - -Werror=format -) - -target_link_libraries(host_cpu_engine PUBLIC - $ ${STUB_LIBS} metadef_graph -lrt -ldl -lpthread -lgcov -) - -set_target_properties(host_cpu_engine PROPERTIES CXX_STANDARD 11) - # ---- Target : engine plugin---- # @@ -273,4 +246,4 @@ target_link_libraries(graphengine PUBLIC ) set_target_properties(graphengine PROPERTIES CXX_STANDARD 11) -add_dependencies(graphengine host_cpu_engine ge_local_engine nnengine engine_conf.json optimizer_priority.pbtxt) +add_dependencies(graphengine ge_local_engine nnengine engine_conf.json optimizer_priority.pbtxt) diff --git a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg_box.h b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg_box.h index af3a1971..2be05972 100644 --- a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg_box.h +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg_box.h @@ -21,6 +21,7 @@ #include "ge_graph_dsl/ge.h" #include "ge_graph_dsl/op_desc/op_box.h" #include "ge_graph_dsl/op_desc/op_desc_cfg.h" +#include "graph/ge_attr_value.h" #include "graph/op_desc.h" GE_NS_BEGIN @@ -29,19 +30,32 @@ struct OpDescCfgBox : OpBox, private OpDescCfg { OpDescCfgBox(const OpType &opType); OpDescCfgBox &InCnt(int in_cnt); OpDescCfgBox &OutCnt(int out_cnt); + OpDescCfgBox &ParentNodeIndex(int node_index); OpDescCfgBox &TensorDesc(Format format = FORMAT_NCHW, DataType data_type = DT_FLOAT, - std::vector shape = {1, 1, 224, 224}); - template - OpDescCfgBox& Attr(const std::string &name, Type value) { - auto attrvalue = ge::GeAttrValue::CreateFrom(value); - attrs_.emplace(std::make_pair(name, attrvalue)); - return *this; - } + std::vector shape = {1, 1, 224, 224}); + OpDescCfgBox &Weight(GeTensorPtr &); - private: + template + OpDescCfgBox &Attr(const std::string &name, Type &&value) { + auto attrvalue = ge::GeAttrValue::CreateFrom(std::forward(value)); + attrs_.emplace(std::make_pair(name, attrvalue)); + return *this; + } + + template + OpDescCfgBox &Attr(const std::string &name, Type &value) { + auto attrvalue = ge::GeAttrValue::CreateFrom(value); + attrs_.emplace(std::make_pair(name, attrvalue)); + return *this; + } + + OpDescCfgBox &Attr(const std::string &name, int value); + OpDescCfgBox &Attr(const std::string &name, const char *value); OpDescPtr Build(const ::EG_NS::NodeId &id) const override; - void UpdateAttrs(OpDescPtr&) const; - std::map attrs_; + + private: + void UpdateAttrs(OpDescPtr &) const; + std::map attrs_; }; #define OP_CFG(optype) ::GE_NS::OpDescCfgBox(optype) diff --git a/tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc b/tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc index fc2a6c1c..be7cd831 100644 --- a/tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc +++ b/tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc @@ -17,8 +17,8 @@ #include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" #include "easy_graph/infra/status.h" #include "ge_graph_dsl/op_desc/op_desc_cfg_repo.h" -#include "ge_graph_dsl/op_desc/op_desc_cfg.h" #include "external/graph/gnode.h" +#include "graph/debug/ge_attr_define.h" #include "graph/ge_tensor.h" using ::EG_NS::Status; @@ -44,6 +44,26 @@ OpDescCfgBox &OpDescCfgBox::OutCnt(int out_cnt) { return *this; } +OpDescCfgBox &OpDescCfgBox::ParentNodeIndex(int node_index) { + this->Attr(ATTR_NAME_PARENT_NODE_INDEX, node_index); + return *this; +} + +OpDescCfgBox &OpDescCfgBox::Attr(const std::string &name, int value) { + this->Attr(name, (int64_t)value); + return *this; +} + +OpDescCfgBox &OpDescCfgBox::Attr(const std::string &name, const char *value) { + this->Attr(name, std::string(value)); + return *this; +} + +OpDescCfgBox &OpDescCfgBox::Weight(GeTensorPtr &tensor_ptr) { + this->Attr(ATTR_NAME_WEIGHTS, tensor_ptr); + return *this; +} + OpDescCfgBox &OpDescCfgBox::TensorDesc(Format format, DataType data_type, std::vector shape) { default_tensor_.format_ = format; default_tensor_.data_type_ = data_type; @@ -51,10 +71,9 @@ OpDescCfgBox &OpDescCfgBox::TensorDesc(Format format, DataType data_type, std::v return *this; } -void OpDescCfgBox::UpdateAttrs(OpDescPtr& op_desc) const { - std::for_each(attrs_.begin(), attrs_.end(), [&op_desc](const auto &attr){ - op_desc->SetAttr(attr.first, attr.second); - }); +void OpDescCfgBox::UpdateAttrs(OpDescPtr &op_desc) const { + std::for_each(attrs_.begin(), attrs_.end(), + [&op_desc](const auto &attr) { op_desc->SetAttr(attr.first, attr.second); }); } OpDescPtr OpDescCfgBox::Build(const ::EG_NS::NodeId &id) const { diff --git a/tests/framework/ge_graph_dsl/tests/op_desc_config_test.cc b/tests/framework/ge_graph_dsl/tests/op_desc_config_test.cc new file mode 100644 index 00000000..eee5d7c2 --- /dev/null +++ b/tests/framework/ge_graph_dsl/tests/op_desc_config_test.cc @@ -0,0 +1,75 @@ +/** + * 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 "gtest/gtest.h" +#include "framework/common/types.h" +#include "graph/debug/ge_attr_define.h" +#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" +#include "graph/ge_tensor.h" +#include "graph/utils/attr_utils.h" +GE_NS_BEGIN + +class OpDescCfgTest : public testing::Test {}; + +TEST_F(OpDescCfgTest, test_attr_set_string_success) { + auto op_ptr = OP_CFG(DATA).Attr(ENTER_ATTR_FRAME_NAME, "1").Build("data1"); + + ge::GeAttrValue ret; + op_ptr->GetAttr(ENTER_ATTR_FRAME_NAME, ret); + std::string value; + ret.GetValue(value); + + ASSERT_EQ(value, "1"); +} + +TEST_F(OpDescCfgTest, test_attr_set_int_success) { + auto op_ptr = OP_CFG(DATA).Attr(ENTER_ATTR_FRAME_NAME, 2).Build("data1"); + + ge::GeAttrValue ret; + op_ptr->GetAttr(ENTER_ATTR_FRAME_NAME, ret); + int64_t value; + ret.GetValue(value); + + ASSERT_EQ(value, 2); +} + +TEST_F(OpDescCfgTest, test_attr_set_perent_node_index_success) { + auto op_ptr = OP_CFG(DATA).ParentNodeIndex(2).Build("data1"); + + ge::GeAttrValue ret; + op_ptr->GetAttr(ATTR_NAME_PARENT_NODE_INDEX, ret); + int64_t value; + ret.GetValue(value); + + ASSERT_EQ(value, 2); +} + +TEST_F(OpDescCfgTest, test_attr_set_weight_success) { + int64_t dims_size = 1; + vector data_vec = {5}; + for_each(data_vec.begin(), data_vec.end(), [&](int64_t &data) { dims_size *= data; }); + vector data_value_vec(dims_size, 1); + GeTensorDesc data_tensor_desc(GeShape(data_vec), FORMAT_NCHW, DT_INT32); + GeTensorPtr data_tensor = std::make_shared(data_tensor_desc, (uint8_t *)data_value_vec.data(), + data_value_vec.size() * sizeof(int32_t)); + + auto op_ptr = OP_CFG(CONSTANT).Weight(data_tensor).Build("const1"); + + ConstGeTensorPtr tensor_value; + ASSERT_TRUE(AttrUtils::GetTensor(op_ptr, ge::ATTR_NAME_WEIGHTS, tensor_value)); + ASSERT_EQ(tensor_value->GetTensorDesc().GetDataType(), DT_INT32); +} + +GE_NS_END diff --git a/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc b/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc index b83d68fc..071f8c36 100644 --- a/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc +++ b/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc @@ -23,6 +23,7 @@ GE_NS_BEGIN REGISTER_OPTYPE_DEFINE(DATA, "Data"); REGISTER_OPTYPE_DEFINE(HCOMALLGATHER, "HcomAllGather"); REGISTER_OPTYPE_DEFINE(VARIABLE, "Variable"); +REGISTER_OPTYPE_DEFINE(CONSTANT, "Const"); REGISTER_OPTYPE_DEFINE(CONSTANTOP, "Constant"); REGISTER_OPTYPE_DEFINE(LESS, "Less"); REGISTER_OPTYPE_DEFINE(MUL, "Mul"); diff --git a/tests/framework/ge_running_env/CMakeLists.txt b/tests/framework/ge_running_env/CMakeLists.txt new file mode 100644 index 00000000..deac4e03 --- /dev/null +++ b/tests/framework/ge_running_env/CMakeLists.txt @@ -0,0 +1,18 @@ +# 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. +# ============================================================================ + +add_subdirectory(include) +add_subdirectory(src) +add_subdirectory(tests) \ No newline at end of file diff --git a/tests/framework/ge_running_env/include/CMakeLists.txt b/tests/framework/ge_running_env/include/CMakeLists.txt new file mode 100644 index 00000000..b71b0578 --- /dev/null +++ b/tests/framework/ge_running_env/include/CMakeLists.txt @@ -0,0 +1,17 @@ +# 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. +# ============================================================================ + +add_library(ge_running_env_inc INTERFACE) +target_include_directories(ge_running_env_inc INTERFACE ./) diff --git a/tests/framework/stub_engine/ops_kernel_store/op/host_op.h b/tests/framework/ge_running_env/include/ge_running_env/env_installer.h similarity index 52% rename from tests/framework/stub_engine/ops_kernel_store/op/host_op.h rename to tests/framework/ge_running_env/include/ge_running_env/env_installer.h index 464df47a..79b65137 100644 --- a/tests/framework/stub_engine/ops_kernel_store/op/host_op.h +++ b/tests/framework/ge_running_env/include/ge_running_env/env_installer.h @@ -14,23 +14,22 @@ * limitations under the License. */ -#ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_HOST_OP_H_ -#define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_HOST_OP_H_ +#ifndef H1D9F4FDE_BB21_4DE4_AC7E_751920B45039 +#define H1D9F4FDE_BB21_4DE4_AC7E_751920B45039 -#include "stub_engine/ops_kernel_store/op/op.h" +#include "fake_ns.h" +#include "opskernel_manager/ops_kernel_manager.h" +#include "register/ops_kernel_builder_registry.h" -namespace ge { -namespace st { -class GE_FUNC_VISIBILITY HostOp : public Op { - public: - HostOp(const Node &node, RunContext &run_context) : Op(node, run_context) {} - ~HostOp() override = default; - HostOp &operator=(const HostOp &op) = delete; - HostOp(const HostOp &op) = delete; +FAKE_NS_BEGIN - Status Run() override; +struct EnvInstaller { + virtual void InstallTo(std::map&) const {} + virtual void InstallTo(std::map&) const {} + virtual void InstallTo(std::map&) const {} + virtual void Install() const {} }; -} // namespace st -} // namespace ge -#endif // GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_HOST_OP_H_ +FAKE_NS_END + +#endif diff --git a/tests/framework/ge_running_env/include/ge_running_env/fake_engine.h b/tests/framework/ge_running_env/include/ge_running_env/fake_engine.h new file mode 100644 index 00000000..c4207223 --- /dev/null +++ b/tests/framework/ge_running_env/include/ge_running_env/fake_engine.h @@ -0,0 +1,56 @@ +/** + * 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. + */ +#ifndef HAF5E9BF2_752F_4E03_B0A5_E1B912A5FA24 +#define HAF5E9BF2_752F_4E03_B0A5_E1B912A5FA24 + +#include +#include "fake_ns.h" +#include "ge_running_env/env_installer.h" +#include "common/opskernel/ops_kernel_info_types.h" +#include "opskernel_manager/ops_kernel_manager.h" +#include "register/ops_kernel_builder_registry.h" +#include "fake_ops_kernel_builder.h" +#include "fake_ops_kernel_info_store.h" + +FAKE_NS_BEGIN + +using FakeOpsKernelBuilderPtr = std::shared_ptr; +using FakeOpsKernelInfoStorePtr = std::shared_ptr; + +struct FakeEngine : EnvInstaller { + FakeEngine(const std::string& engine_name); + FakeEngine& KernelBuilder(FakeOpsKernelBuilderPtr); + FakeEngine& KernelInfoStore(FakeOpsKernelInfoStorePtr); + FakeEngine& KernelInfoStore(const std::string&); + + private: + void InstallTo(std::map&) const override; + void InstallTo(std::map&) const override; + + private: + template + void InstallFor(std::map& maps, const std::map>&) const; + + private: + std::string engine_name_; + std::set info_store_names_; + std::map custom_builders_; + std::map custom_info_stores_; +}; + +FAKE_NS_END + +#endif diff --git a/tests/framework/ge_running_env/include/ge_running_env/fake_ns.h b/tests/framework/ge_running_env/include/ge_running_env/fake_ns.h new file mode 100644 index 00000000..c802e109 --- /dev/null +++ b/tests/framework/ge_running_env/include/ge_running_env/fake_ns.h @@ -0,0 +1,28 @@ +/** + * 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. + */ +#ifndef H7AEFF0EA_9FDE_487F_8562_2917A2D48EA2 +#define H7AEFF0EA_9FDE_487F_8562_2917A2D48EA2 + +#define FAKE_NS ge +#define FAKE_NS_BEGIN namespace FAKE_NS { +#define FAKE_NS_END } +#define USING_STUB_NS using namespace FAKE_NS; +#define FWD_DECL_STUB(type) \ + namespace FAKE_NS { \ + struct type; \ + } + +#endif diff --git a/tests/framework/ge_running_env/include/ge_running_env/fake_op.h b/tests/framework/ge_running_env/include/ge_running_env/fake_op.h new file mode 100644 index 00000000..cc442cdb --- /dev/null +++ b/tests/framework/ge_running_env/include/ge_running_env/fake_op.h @@ -0,0 +1,49 @@ +/** + * 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. + */ +#ifndef H737AD661_27C0_400F_8B08_29701308C5D0 +#define H737AD661_27C0_400F_8B08_29701308C5D0 + +#include +#include +#include "fake_ns.h" +#include "ge_running_env/env_installer.h" +#include "graph/operator_factory.h" + +FAKE_NS_BEGIN + +struct FakeOp : EnvInstaller { + FakeOp(const std::string& op_type); + + FakeOp& Inputs(const std::vector&); + FakeOp& Outputs(const std::vector&); + FakeOp& InferShape(InferShapeFunc); + FakeOp& InfoStoreAndBuilder(const std::string&); + + private: + void Install() const override; + void InstallTo(std::map&) const override; + + private: + const std::string op_type_; + std::vector inputs_; + std::vector outputs_; + InferShapeFunc info_fun_; + std::set info_store_names_; +}; + +FAKE_NS_END + +#endif /* H737AD661_27C0_400F_8B08_29701308C5D0 */ diff --git a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.h b/tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_builder.h similarity index 59% rename from tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.h rename to tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_builder.h index 62dab542..acfe5e41 100644 --- a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.h +++ b/tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_builder.h @@ -13,39 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef H39E4E719_91F4_4D0F_BA4F_6BA56CB1E20D +#define H39E4E719_91F4_4D0F_BA4F_6BA56CB1E20D -#ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_BUILDER_H_ -#define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_BUILDER_H_ +#include "fake_ns.h" +#include "common/opskernel/ops_kernel_builder.h" +#include "info_store_holder.h" -#if defined(_MSC_VER) -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY _declspec(dllexport) -#else -#define GE_FUNC_VISIBILITY -#endif -#else -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) -#else -#define GE_FUNC_VISIBILITY -#endif -#endif +FAKE_NS_BEGIN -#include "common/opskernel/ops_kernel_builder.h" +struct FakeOpsKernelBuilder : OpsKernelBuilder, InfoStoreHolder { + FakeOpsKernelBuilder(const std::string &kernel_lib_name); + FakeOpsKernelBuilder(); -namespace ge { -namespace st { -class GE_FUNC_VISIBILITY StubOpsKernelBuilder : public OpsKernelBuilder { - public: + private: Status Initialize(const map &options) override; - Status Finalize() override; - Status CalcOpRunningParam(Node &node) override; - Status GenerateTask(const Node &node, RunContext &context, std::vector &tasks) override; }; -} // namespace st -} // namespace ge -#endif // GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_BUILDER_H_ +FAKE_NS_END + +#endif diff --git a/tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_info_store.h b/tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_info_store.h new file mode 100644 index 00000000..4a8ab9dc --- /dev/null +++ b/tests/framework/ge_running_env/include/ge_running_env/fake_ops_kernel_info_store.h @@ -0,0 +1,39 @@ +/** + * 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. + */ +#ifndef H1EBABA85_7056_48F0_B496_E4DB68E5FED3 +#define H1EBABA85_7056_48F0_B496_E4DB68E5FED3 + +#include "fake_ns.h" +#include "common/opskernel/ops_kernel_info_store.h" +#include "ge/ge_api_types.h" +#include "info_store_holder.h" + +FAKE_NS_BEGIN + +struct FakeOpsKernelInfoStore : OpsKernelInfoStore, InfoStoreHolder { + FakeOpsKernelInfoStore(const std::string &kernel_lib_name); + FakeOpsKernelInfoStore(); + + private: + Status Initialize(const std::map &options) override; + Status Finalize() override; + bool CheckSupported(const OpDescPtr &op_desc, std::string &reason) const override; + void GetAllOpsKernelInfo(std::map &infos) const override; +}; + +FAKE_NS_END + +#endif diff --git a/tests/framework/ge_running_env/include/ge_running_env/ge_running_env_faker.h b/tests/framework/ge_running_env/include/ge_running_env/ge_running_env_faker.h new file mode 100644 index 00000000..6d325c6a --- /dev/null +++ b/tests/framework/ge_running_env/include/ge_running_env/ge_running_env_faker.h @@ -0,0 +1,45 @@ +/** + * 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. + */ +#ifndef H99C11FC4_700E_4D4D_B073_7808FA88BEBC +#define H99C11FC4_700E_4D4D_B073_7808FA88BEBC + +#include "ge_running_env/fake_engine.h" +#include "fake_ns.h" +#include "opskernel_manager/ops_kernel_manager.h" +#include "register/ops_kernel_builder_registry.h" + +FAKE_NS_BEGIN + +struct GeRunningEnvFaker { + GeRunningEnvFaker(); + GeRunningEnvFaker &Reset(); + GeRunningEnvFaker &Install(const EnvInstaller &); + GeRunningEnvFaker &InstallDefault(); + static void BackupEnv(); + + private: + void flush(); + + private: + std::map> &op_kernel_info_; + std::map &ops_kernel_info_stores_; + std::map &ops_kernel_optimizers_; + std::map &ops_kernel_builders_; +}; + +FAKE_NS_END + +#endif /* H99C11FC4_700E_4D4D_B073_7808FA88BEBC */ diff --git a/tests/framework/stub_engine/ops_kernel_store/op/op.h b/tests/framework/ge_running_env/include/ge_running_env/info_store_holder.h similarity index 51% rename from tests/framework/stub_engine/ops_kernel_store/op/op.h rename to tests/framework/ge_running_env/include/ge_running_env/info_store_holder.h index 3741567a..85b6c75f 100644 --- a/tests/framework/stub_engine/ops_kernel_store/op/op.h +++ b/tests/framework/ge_running_env/include/ge_running_env/info_store_holder.h @@ -13,33 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef H7992249B_058D_40A1_94EA_52BBCB76434E +#define H7992249B_058D_40A1_94EA_52BBCB76434E -#ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_H_ -#define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_H_ - -#include -#include -#include -#include "common/ge_inner_error_codes.h" +#include "fake_ns.h" #include "common/opskernel/ops_kernel_info_types.h" -#include "graph/node.h" -namespace ge { -namespace st { -/** - * The base class for all op. - */ -class GE_FUNC_VISIBILITY Op { - public: - Op(const Node &node, RunContext &run_context) : run_context_(run_context), node_(node) {} - virtual ~Op() = default; - virtual Status Run() = 0; +FAKE_NS_BEGIN + +struct InfoStoreHolder { + InfoStoreHolder(); + InfoStoreHolder(const std::string&); + void EngineName(std::string engine_name); + void RegistOp(std::string op_type); + std::string GetLibName(); protected: - const RunContext &run_context_; - const Node &node_; + std::map op_info_map_; + std::string kernel_lib_name_; + std::string engine_name_; }; -} // namespace st -} // namespace ge -#endif // GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_H_ +FAKE_NS_END + +#endif diff --git a/tests/framework/ge_running_env/src/CMakeLists.txt b/tests/framework/ge_running_env/src/CMakeLists.txt new file mode 100644 index 00000000..ae068bd3 --- /dev/null +++ b/tests/framework/ge_running_env/src/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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. +# ============================================================================ + +file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "*.cc" "*.CC" "*.cpp" "*.CPP" "*.c++") + +# ---- Target : stub Host engine ---- +add_library(ge_with_env STATIC ${SOURCES}) + +target_include_directories(ge_with_env + PUBLIC + include + ) + +target_include_directories(ge_with_env + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + +target_compile_definitions(ge_with_env PRIVATE + google=ascend_private + FMK_SUPPORT_DUMP + ) + +target_compile_options(ge_with_env PRIVATE + -g --coverage -fprofile-arcs -ftest-coverage + -Werror=format + ) + +target_link_libraries(ge_with_env PUBLIC + $ ge_running_env_inc graphengine -lrt -ldl -lpthread -lgcov + ) + +set_target_properties(ge_with_env PROPERTIES CXX_STANDARD 17) diff --git a/tests/framework/ge_running_env/src/engine/fake_engine.cc b/tests/framework/ge_running_env/src/engine/fake_engine.cc new file mode 100644 index 00000000..4b8fedbc --- /dev/null +++ b/tests/framework/ge_running_env/src/engine/fake_engine.cc @@ -0,0 +1,81 @@ +/** + * 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 "ge_running_env/fake_engine.h" +#include "ge_running_env/fake_ops_kernel_builder.h" +#include "ge_running_env/fake_ops_kernel_info_store.h" +#include "opskernel_manager/ops_kernel_manager.h" + +FAKE_NS_BEGIN + +FakeEngine::FakeEngine(const std::string &engine_name) : engine_name_(engine_name) {} + +FakeEngine &FakeEngine::KernelInfoStore(const std::string &info_store) { + info_store_names_.insert(info_store); + return *this; +} + +FakeEngine &FakeEngine::KernelInfoStore(FakeOpsKernelInfoStorePtr ptr) { + info_store_names_.insert(ptr->GetLibName()); + custom_info_stores_.insert(std::make_pair(ptr->GetLibName(), ptr)); + return *this; +} + +FakeEngine &FakeEngine::KernelBuilder(FakeOpsKernelBuilderPtr builder) { + info_store_names_.insert(builder->GetLibName()); + custom_builders_.insert(std::make_pair(builder->GetLibName(), builder)); + return *this; +} + +namespace { +template +void InstallDefault(std::map &maps, const std::string &info_store_name, + const std::string &engine_name) { + auto parent_obj = std::make_shared(info_store_name); + if (parent_obj == nullptr) { + return; + } + parent_obj->EngineName(engine_name); + maps.insert(std::make_pair(parent_obj->GetLibName(), parent_obj)); +} +} // namespace + +template +void FakeEngine::InstallFor(std::map &maps, + const std::map> &child_maps) const { + if (info_store_names_.empty()) { + InstallDefault(maps, engine_name_, engine_name_); + } else { + for (auto &info_store_name : info_store_names_) { + auto iter = child_maps.find(info_store_name); + if (iter == child_maps.end()) { + InstallDefault(maps, info_store_name, engine_name_); + } else { + maps.insert(std::make_pair(iter->second->GetLibName(), iter->second)); + } + } + } +} + +void FakeEngine::InstallTo(std::map &ops_kernel_info_stores) const { + InstallFor(ops_kernel_info_stores, custom_info_stores_); +} + +void FakeEngine::InstallTo(std::map &ops_kernel_builders) const { + InstallFor(ops_kernel_builders, custom_builders_); +} + +FAKE_NS_END diff --git a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.cc b/tests/framework/ge_running_env/src/engine/fake_ops_kernel_builder.cc similarity index 73% rename from tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.cc rename to tests/framework/ge_running_env/src/engine/fake_ops_kernel_builder.cc index 2de8691f..77472249 100644 --- a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_builder.cc +++ b/tests/framework/ge_running_env/src/engine/fake_ops_kernel_builder.cc @@ -14,40 +14,25 @@ * limitations under the License. */ -#include "stub_ops_kernel_builder.h" -#include +#include "ge_running_env/fake_ops_kernel_builder.h" +#include "graph/utils/node_utils.h" #include "common/ge_inner_error_codes.h" #include "ge/ge_api_types.h" #include "graph/utils/node_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" -#include #include "framework/common/debug/ge_log.h" -#include "host_cpu_engine/common/constant/constant.h" -#include "register/ops_kernel_builder_registry.h" -#include "inc/st_types.h" +FAKE_NS_BEGIN -namespace ge { -namespace st { -REGISTER_OPS_KERNEL_BUILDER(kAicoreLibName, StubOpsKernelBuilder); -REGISTER_OPS_KERNEL_BUILDER(kVectorLibName, StubOpsKernelBuilder); -REGISTER_OPS_KERNEL_BUILDER(kAicpuLibName, StubOpsKernelBuilder); -REGISTER_OPS_KERNEL_BUILDER(kAicpuAscendLibName, StubOpsKernelBuilder); -REGISTER_OPS_KERNEL_BUILDER(kHcclLibName, StubOpsKernelBuilder); -REGISTER_OPS_KERNEL_BUILDER(kRTSLibName, StubOpsKernelBuilder); +FakeOpsKernelBuilder::FakeOpsKernelBuilder(const std::string &info_store_name) : InfoStoreHolder(info_store_name) {} +FakeOpsKernelBuilder::FakeOpsKernelBuilder() : InfoStoreHolder() {} -Status StubOpsKernelBuilder::Finalize() { - return SUCCESS; -} -Status StubOpsKernelBuilder::Initialize(const map &options) { - return SUCCESS; -} +Status FakeOpsKernelBuilder::Finalize() { return SUCCESS; } +Status FakeOpsKernelBuilder::Initialize(const map &options) { return SUCCESS; } -Status StubOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { +Status FakeOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { OpDescPtr op_desc = ge_node.GetOpDesc(); if (op_desc == nullptr) { - GELOGE(FAILED, "[Get][OpDesc]CalcOpRunningParam failed, as op desc is null"); - REPORT_INNER_ERROR("E19999", "GetOpDesc failed."); return FAILED; } @@ -86,9 +71,9 @@ Status StubOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); REPORT_CALL_ERROR( - "E19999", "CalcTensorMemSize failed for op[%s:%s] out[%zu] mem size, mem_size=%ld, format=%s, data_type=%s.", - name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), - TypeUtils::DataTypeToSerialString(data_type).c_str()); + "E19999", "CalcTensorMemSize failed for op[%s:%s] out[%zu] mem size, mem_size=%ld, format=%s, data_type=%s.", + name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), + TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } GELOGI("Calc op[%s:%s] out[%zu] mem size is %ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, @@ -111,9 +96,9 @@ Status StubOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { return SUCCESS; } -Status StubOpsKernelBuilder::GenerateTask(const Node &node, RunContext &context, vector &tasks) { +Status FakeOpsKernelBuilder::GenerateTask(const Node &node, RunContext &context, vector &tasks) { // no need to generate device task return SUCCESS; } -} // namespace st -} // namespace ge \ No newline at end of file + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/src/engine/fake_ops_kernel_info_store.cc b/tests/framework/ge_running_env/src/engine/fake_ops_kernel_info_store.cc new file mode 100644 index 00000000..348e1334 --- /dev/null +++ b/tests/framework/ge_running_env/src/engine/fake_ops_kernel_info_store.cc @@ -0,0 +1,42 @@ +/** + * 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 "external/ge/ge_api_error_codes.h" +#include "ge_running_env/fake_ops_kernel_info_store.h" + +FAKE_NS_BEGIN + +FakeOpsKernelInfoStore::FakeOpsKernelInfoStore(const std::string &info_store_name) : InfoStoreHolder(info_store_name) {} + +FakeOpsKernelInfoStore::FakeOpsKernelInfoStore() : InfoStoreHolder() {} + +Status FakeOpsKernelInfoStore::Finalize() { + op_info_map_.clear(); + return SUCCESS; +} + +Status FakeOpsKernelInfoStore::Initialize(const std::map &options) { return SUCCESS; } + +void FakeOpsKernelInfoStore::GetAllOpsKernelInfo(map &infos) const { infos = op_info_map_; } + +bool FakeOpsKernelInfoStore::CheckSupported(const OpDescPtr &op_desc, std::string &) const { + if (op_desc == nullptr) { + return false; + } + return op_info_map_.count(op_desc->GetType()) > 0; +} + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/src/engine/info_store_holder.cc b/tests/framework/ge_running_env/src/engine/info_store_holder.cc new file mode 100644 index 00000000..231af93a --- /dev/null +++ b/tests/framework/ge_running_env/src/engine/info_store_holder.cc @@ -0,0 +1,49 @@ +/** + * 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 "ge_running_env/info_store_holder.h" +FAKE_NS_BEGIN + +namespace { +std::string GenStoreName() { + static int store_id = 0; + return "store_" + std::to_string(store_id++); +} +} // namespace + +InfoStoreHolder::InfoStoreHolder(const std::string& kernel_lib_name) : kernel_lib_name_(kernel_lib_name) {} + +InfoStoreHolder::InfoStoreHolder() : kernel_lib_name_(GenStoreName()) {} + +void InfoStoreHolder::RegistOp(std::string op_type) { + OpInfo default_op_info = {.engine = engine_name_, + .opKernelLib = kernel_lib_name_, + .computeCost = 0, + .flagPartial = false, + .flagAsync = false, + .isAtomic = false}; + + auto iter = op_info_map_.find(op_type); + if (iter == op_info_map_.end()) { + op_info_map_.emplace(op_type, default_op_info); + } +} + +void InfoStoreHolder::EngineName(std::string engine_name) { engine_name_ = engine_name; } + +std::string InfoStoreHolder::GetLibName() { return kernel_lib_name_; } + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/src/env/ge_default_running_env.cc b/tests/framework/ge_running_env/src/env/ge_default_running_env.cc new file mode 100644 index 00000000..ab705f55 --- /dev/null +++ b/tests/framework/ge_running_env/src/env/ge_default_running_env.cc @@ -0,0 +1,56 @@ +/** + * 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 "ge_default_running_env.h" +#include "ge_running_env/ge_running_env_faker.h" +#include "ge_running_env/fake_op.h" + +FAKE_NS_BEGIN +namespace { +std::vector default_engines = {FakeEngine("AIcoreEngine").KernelInfoStore("AiCoreLib"), + FakeEngine("VectorEngine").KernelInfoStore("VectorLib"), + FakeEngine("DNN_VM_AICPU").KernelInfoStore("AicpuLib"), + FakeEngine("DNN_VM_AICPU_ASCEND").KernelInfoStore("AicpuAscendLib"), + FakeEngine("DNN_HCCL").KernelInfoStore("HcclLib"), + FakeEngine("DNN_VM_RTS").KernelInfoStore("RTSLib")}; + +std::vector fake_ops = { + FakeOp(ENTER).InfoStoreAndBuilder("RTSLib"), FakeOp(MERGE).InfoStoreAndBuilder("RTSLib"), + FakeOp(SWITCH).InfoStoreAndBuilder("RTSLib"), FakeOp(LOOPCOND).InfoStoreAndBuilder("RTSLib"), + FakeOp(STREAMMERGE).InfoStoreAndBuilder("RTSLib"), FakeOp(STREAMSWITCH).InfoStoreAndBuilder("RTSLib"), + FakeOp(STREAMACTIVE).InfoStoreAndBuilder("RTSLib"), FakeOp(EXIT).InfoStoreAndBuilder("RTSLib"), + + FakeOp(LESS).InfoStoreAndBuilder("AiCoreLib"), FakeOp(NEXTITERATION).InfoStoreAndBuilder("AiCoreLib"), + FakeOp(CAST).InfoStoreAndBuilder("AiCoreLib"), FakeOp(TRANSDATA).InfoStoreAndBuilder("AiCoreLib"), + FakeOp(NOOP).InfoStoreAndBuilder("AiCoreLib"), FakeOp(VARIABLE).InfoStoreAndBuilder("AiCoreLib"), + FakeOp(CONSTANT).InfoStoreAndBuilder("AiCoreLib"), FakeOp(ASSIGN).InfoStoreAndBuilder("AiCoreLib"), + FakeOp(ADD).InfoStoreAndBuilder("AiCoreLib"), FakeOp(MUL).InfoStoreAndBuilder("AiCoreLib"), + FakeOp(DATA).InfoStoreAndBuilder("AiCoreLib"), FakeOp(NETOUTPUT).InfoStoreAndBuilder("AiCoreLib"), + +}; +} // namespace + +void GeDefaultRunningEnv::InstallTo(GeRunningEnvFaker& ge_env) { + for (auto& fake_engine : default_engines) { + ge_env.Install(fake_engine); + } + + for (auto& fake_op : fake_ops) { + ge_env.Install(fake_op); + } +} + +FAKE_NS_END \ No newline at end of file diff --git a/tests/framework/ge_running_env/src/env/ge_default_running_env.h b/tests/framework/ge_running_env/src/env/ge_default_running_env.h new file mode 100644 index 00000000..b93c528a --- /dev/null +++ b/tests/framework/ge_running_env/src/env/ge_default_running_env.h @@ -0,0 +1,32 @@ +/** + * 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. + */ + +#ifndef INC_5D044B8760CB41ABA108AE2E37E8EBDE +#define INC_5D044B8760CB41ABA108AE2E37E8EBDE + +#include "ge_running_env/fake_ns.h" + +FAKE_NS_BEGIN + +struct GeRunningEnvFaker; + +struct GeDefaultRunningEnv { + static void InstallTo(GeRunningEnvFaker&); +}; + +FAKE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_running_env/src/env/ge_running_env_faker.cc b/tests/framework/ge_running_env/src/env/ge_running_env_faker.cc new file mode 100644 index 00000000..2977f6b2 --- /dev/null +++ b/tests/framework/ge_running_env/src/env/ge_running_env_faker.cc @@ -0,0 +1,109 @@ +/** + * 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 "external/ge/ge_api.h" +#include "opskernel_manager/ops_kernel_builder_manager.h" +#include "init/gelib.h" +#include "utility" +#include "ge_running_env/ge_running_env_faker.h" +#include "ge_default_running_env.h" +#include "ge_running_env/env_installer.h" +#include "op/fake_op_repo.h" + +FAKE_NS_BEGIN + +namespace { +OpsKernelManager& getKernelManger() { + std::shared_ptr instancePtr = ge::GELib::GetInstance(); + return instancePtr->OpsKernelManagerObj(); +} + +struct InitEnv { + static InitEnv& GetInstance() { + static InitEnv instance; + return instance; + } + + void reset(std::map& ops_kernel_info_stores, + std::map& builders) { + std::set remove_info_names; + for (auto iter : ops_kernel_info_stores) { + if (kernel_info_names.find(iter.first) == kernel_info_names.end()) { + remove_info_names.insert(iter.first); + } + } + for (auto info_name : remove_info_names) { + ops_kernel_info_stores.erase(info_name); + builders.erase(info_name); + } + } + + private: + InitEnv() { + for (auto iter : getKernelManger().GetAllOpsKernelInfoStores()) { + kernel_info_names.insert(iter.first); + } + } + + private: + std::set kernel_info_names; +}; +} // namespace + +GeRunningEnvFaker::GeRunningEnvFaker() + : op_kernel_info_(const_cast>&>(getKernelManger().GetAllOpsKernelInfo())), + ops_kernel_info_stores_( + const_cast&>(getKernelManger().GetAllOpsKernelInfoStores())), + ops_kernel_optimizers_( + const_cast&>(getKernelManger().GetAllGraphOptimizerObjs())), + ops_kernel_builders_(const_cast&>( + OpsKernelBuilderManager::Instance().GetAllOpsKernelBuilders())) { + Reset(); +} + +GeRunningEnvFaker& GeRunningEnvFaker::Reset() { + InitEnv& init_env = InitEnv::GetInstance(); + FakeOpRepo::Reset(); + init_env.reset(ops_kernel_info_stores_, ops_kernel_builders_); + flush(); + return *this; +} + +void GeRunningEnvFaker::BackupEnv() { InitEnv::GetInstance(); } + +GeRunningEnvFaker& GeRunningEnvFaker::Install(const EnvInstaller& installer) { + installer.Install(); + installer.InstallTo(ops_kernel_info_stores_); + installer.InstallTo(ops_kernel_optimizers_); + installer.InstallTo(ops_kernel_builders_); + flush(); + return *this; +} + +void GeRunningEnvFaker::flush() { + op_kernel_info_.clear(); + getKernelManger().GetOpsKernelInfo(""); +} + +GeRunningEnvFaker& GeRunningEnvFaker::InstallDefault() { + Reset(); + GeDefaultRunningEnv::InstallTo(*this); + return *this; +} + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/src/op/fake_op.cc b/tests/framework/ge_running_env/src/op/fake_op.cc new file mode 100644 index 00000000..52bbee8d --- /dev/null +++ b/tests/framework/ge_running_env/src/op/fake_op.cc @@ -0,0 +1,95 @@ +/** + * 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 "ge_running_env/fake_op.h" +#include "fake_op_repo.h" +#include "ge_running_env/info_store_holder.h" +#include "graph/operator_factory.h" + +FAKE_NS_BEGIN + +FakeOp::FakeOp(const std::string& op_type) : op_type_(op_type) {} + +FakeOp& FakeOp::Inputs(const std::vector& inputs) { + inputs_ = inputs; + return *this; +} + +FakeOp& FakeOp::Outputs(const std::vector& outputs) { + outputs_ = outputs; + return *this; +} + +FakeOp& FakeOp::InferShape(InferShapeFunc infer_fun) { + info_fun_ = infer_fun; + return *this; +} + +FakeOp& FakeOp::InfoStoreAndBuilder(const std::string& name) { + info_store_names_.insert(name); + return *this; +} + +namespace { + +void RegistOpToInfoStore(OpsKernelInfoStorePtr& info_store, const std::string& op_type) { + if (info_store == nullptr) { + return; + } + auto holder = dynamic_cast(info_store.get()); + holder->RegistOp(op_type); +} + +struct FakeOperator : Operator { + FakeOperator(const std::string& op_type) : Operator(op_type) {} + + FakeOperator& RegistInputs(const std::vector& inputs) { + for (auto& input : inputs) { + Operator::InputRegister(input); + } + return *this; + } + + FakeOperator& RegistOutputs(const std::vector& outputs) { + for (auto& output : outputs) { + Operator::OutputRegister(output); + } + return *this; + } +}; +} // namespace + +void FakeOp::InstallTo(std::map& info_stores) const { + std::for_each(info_store_names_.begin(), info_store_names_.end(), [=, &info_stores](auto& info_store_name) { + auto iter = info_stores.find(info_store_name); + if (iter != info_stores.end()) { + RegistOpToInfoStore(iter->second, op_type_); + } + }); +} + +void FakeOp::Install() const { + FakeOpRepo::Regist( + op_type_, + [op_type = this->op_type_, inputs = this->inputs_, outputs = this->outputs_](const std::string&) -> Operator { + return FakeOperator(op_type).RegistInputs(inputs).RegistOutputs(outputs); + }); + if (info_fun_) { + FakeOpRepo::Regist(op_type_, info_fun_); + } +} + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/src/op/fake_op_repo.cc b/tests/framework/ge_running_env/src/op/fake_op_repo.cc new file mode 100644 index 00000000..7d571b8b --- /dev/null +++ b/tests/framework/ge_running_env/src/op/fake_op_repo.cc @@ -0,0 +1,39 @@ +/** + * 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 "graph/operator_factory_impl.h" +#include "ge_running_env/fake_op.h" +#include "fake_op_repo.h" + +FAKE_NS_BEGIN + +void FakeOpRepo::Reset() { + if (OperatorFactoryImpl::operator_creators_) { + OperatorFactoryImpl::operator_creators_->clear(); + } + if (OperatorFactoryImpl::operator_infershape_funcs_) { + OperatorFactoryImpl::operator_infershape_funcs_->clear(); + } +} + +void FakeOpRepo::Regist(const std::string &operator_type, const OpCreator creator) { + OperatorFactoryImpl::RegisterOperatorCreator(operator_type, creator); +} +void FakeOpRepo::Regist(const std::string &operator_type, const InferShapeFunc infer_fun) { + OperatorFactoryImpl::RegisterInferShapeFunc(operator_type, infer_fun); +} + +FAKE_NS_END \ No newline at end of file diff --git a/tests/framework/ge_running_env/src/op/fake_op_repo.h b/tests/framework/ge_running_env/src/op/fake_op_repo.h new file mode 100644 index 00000000..345515e4 --- /dev/null +++ b/tests/framework/ge_running_env/src/op/fake_op_repo.h @@ -0,0 +1,31 @@ +/** + * 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. + */ +#ifndef DBF6CE7CD4AC4A83BA4ED4B372FC66E4 +#define DBF6CE7CD4AC4A83BA4ED4B372FC66E4 + +#include "ge_running_env/fake_ns.h" +#include "graph/operator_factory.h" + +FAKE_NS_BEGIN + +struct FakeOpRepo { + static void Reset(); + static void Regist(const std::string &operator_type, const OpCreator); + static void Regist(const std::string &operator_type, const InferShapeFunc); +}; + +FAKE_NS_END +#endif \ No newline at end of file diff --git a/tests/framework/ge_running_env/tests/CMakeLists.txt b/tests/framework/ge_running_env/tests/CMakeLists.txt new file mode 100644 index 00000000..67a9bd70 --- /dev/null +++ b/tests/framework/ge_running_env/tests/CMakeLists.txt @@ -0,0 +1,33 @@ +# 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. +# ============================================================================ + +file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "*.cc" "*.CC" "*.cpp" "*.CPP") + +add_executable(ge_running_env_test ${SOURCES}) + +target_include_directories(ge_running_env_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_compile_options(ge_running_env_test PRIVATE + -g +) +set_target_properties(ge_running_env_test PROPERTIES CXX_STANDARD 17) + +target_link_libraries(ge_running_env_test PUBLIC gtest ge_with_env) + +include(CTest) +enable_testing() +add_test(NAME test COMMAND ge_running_env_test) \ No newline at end of file diff --git a/tests/framework/ge_running_env/tests/test_ge_running_env_faker.cc b/tests/framework/ge_running_env/tests/test_ge_running_env_faker.cc new file mode 100644 index 00000000..4429f4a7 --- /dev/null +++ b/tests/framework/ge_running_env/tests/test_ge_running_env_faker.cc @@ -0,0 +1,148 @@ +/** + * 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 "graph/operator_factory_impl.h" +#include "init/gelib.h" +#include "external/ge/ge_api.h" +#include "opskernel_manager/ops_kernel_builder_manager.h" +#include "ge_running_env/fake_ops_kernel_builder.h" +#include "ge_running_env/fake_ns.h" +#include "ge_running_env/ge_running_env_faker.h" +#include "ge_running_env/fake_op.h" +FAKE_NS_BEGIN + +#define ASSERT_OPS_LIST_SIZE(list_size) \ + std::vector ops_list; \ + OperatorFactory::GetOpsTypeList(ops_list);\ + ASSERT_EQ(ops_list.size(), list_size); + +class GeRunningEvnFakerTest : public testing::Test { + protected: + void SetUp() {} + OpsKernelManager &kernel_manager = ge::GELib::GetInstance()->OpsKernelManagerObj(); + OpsKernelBuilderManager &builder_manager = OpsKernelBuilderManager::Instance(); +}; + +TEST_F(GeRunningEvnFakerTest, test_reset_running_env_is_success) { + GeRunningEnvFaker ge_env; + ge_env.Reset(); + ASSERT_OPS_LIST_SIZE(0); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 1); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 1); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); + ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 1); +} + +TEST_F(GeRunningEvnFakerTest, test_install_fake_op_success) { + GeRunningEnvFaker ge_env; + ge_env.Install(FakeOp(DATA)).Install(FakeOp(SWITCH)); + ASSERT_OPS_LIST_SIZE(2); + ASSERT_TRUE(OperatorFactory::IsExistOp(DATA)); + ASSERT_TRUE(OperatorFactory::IsExistOp(SWITCH)); +} + +TEST_F(GeRunningEvnFakerTest, test_install_fake_op_with_inputs_and_outputs_success) { + GeRunningEnvFaker ge_env; + ge_env.Install(FakeOp(ADD).Inputs({"x1", "x2"}).Outputs({"y"})); + + auto add1 = OperatorFactory::CreateOperator("add1", ADD); + + ASSERT_EQ(add1.GetInputsSize(), 2); + ASSERT_EQ(add1.GetOutputsSize(), 1); + ASSERT_OPS_LIST_SIZE(1); +} + +TEST_F(GeRunningEvnFakerTest, test_install_fake_op_with_infer_shape_success) { + GeRunningEnvFaker ge_env; + auto infer_fun = [](Operator &op) -> graphStatus { + TensorDesc input_desc = op.GetInputDescByName("data"); + return GRAPH_SUCCESS; + }; + ASSERT_TRUE(OperatorFactoryImpl::GetInferShapeFunc(DATA) == nullptr); + + ge_env.Install(FakeOp(DATA).Inputs({"data"}).InferShape(infer_fun)); + + ASSERT_TRUE(OperatorFactoryImpl::GetInferShapeFunc(DATA) != nullptr); +} + +TEST_F(GeRunningEvnFakerTest, test_install_engine_with_default_info_store) { + GeRunningEnvFaker ge_env; + ge_env.Install(FakeEngine("DNN_HCCL")); + + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); + ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 1); +} + +TEST_F(GeRunningEvnFakerTest, test_install_engine_with_info_store_name) { + GeRunningEnvFaker ge_env; + ge_env.Install(FakeEngine("DNN_HCCL").KernelInfoStore("AiCoreLib2")) + .Install(FakeOp(SWITCH).InfoStoreAndBuilder("AiCoreLib2")); + + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); + ASSERT_EQ(kernel_manager.GetOpsKernelInfo(SWITCH).size(), 2); +} + +TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_builder_success) { + struct FakeKernelBuilder : FakeOpsKernelBuilder { + Status CalcOpRunningParam(Node &node) override { + OpDescPtr op_desc = node.GetOpDesc(); + if (op_desc == nullptr) { + return FAILED; + } + return SUCCESS; + } + }; + + GeRunningEnvFaker ge_env; + auto ai_core_kernel = FakeEngine("DNN_HCCL").KernelBuilder(std::make_shared()); + ge_env.Reset().Install(ai_core_kernel); + + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); +} + +TEST_F(GeRunningEvnFakerTest, test_install_custom_kernel_info_store_success) { + struct FakeKernelBuilder : FakeOpsKernelInfoStore { + FakeKernelBuilder(const std::string &kernel_lib_name) : FakeOpsKernelInfoStore(kernel_lib_name) {} + + bool CheckSupported(const OpDescPtr &op_desc, std::string &reason) const override { return FAILED; } + }; + + GeRunningEnvFaker ge_env; + auto ai_core_kernel = FakeEngine("DNN_HCCL").KernelInfoStore(std::make_shared("AiCoreLib2")); + ge_env.Reset().Install(ai_core_kernel); + + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 2); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 2); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 52); +} + +TEST_F(GeRunningEvnFakerTest, test_install_default_fake_engine_success) { + GeRunningEnvFaker ge_env; + ge_env.InstallDefault(); + + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfoStores().size(), 7); + ASSERT_EQ(builder_manager.GetAllOpsKernelBuilders().size(), 7); + ASSERT_EQ(kernel_manager.GetAllOpsKernelInfo().size(), 66); +} + +FAKE_NS_END diff --git a/tests/framework/ge_running_env/tests/test_main.cc b/tests/framework/ge_running_env/tests/test_main.cc new file mode 100644 index 00000000..ede79c75 --- /dev/null +++ b/tests/framework/ge_running_env/tests/test_main.cc @@ -0,0 +1,34 @@ +/** + * 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 "common/debug/log.h" +#include "external/ge/ge_api.h" +#include "ge_running_env/ge_running_env_faker.h" + +using namespace std; +using namespace ge; + +int main(int argc, char **argv) { + map options; + ge::GEInitialize(options); + GeRunningEnvFaker::BackupEnv(); + testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + + return ret; +} diff --git a/tests/framework/stub_engine/CMakeLists.txt b/tests/framework/stub_engine/CMakeLists.txt deleted file mode 100644 index c86313c7..00000000 --- a/tests/framework/stub_engine/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -list(APPEND INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_SOURCE_DIR}" - "${GE_CODE_DIR}" - "${GE_CODE_DIR}/inc" - "${GE_CODE_DIR}/metadef/inc" - "${GE_CODE_DIR}/ge" - "${GE_CODE_DIR}/ge/inc" - "${GE_CODE_DIR}/ge/ir_build" - "${GE_CODE_DIR}/metadef" - "${GE_CODE_DIR}/metadef/graph" - "${GE_CODE_DIR}/inc/external" - "${GE_CODE_DIR}/inc/framework/common" - "${GE_CODE_DIR}/metadef/inc/external" - "${GE_CODE_DIR}/metadef/inc/external/graph" - "${GE_CODE_DIR}/metadef/inc/graph" - "${GE_CODE_DIR}/inc/framework" - "${GE_CODE_DIR}/metadef/inc/common" - "${GE_CODE_DIR}/metadef/third_party" - "${GE_CODE_DIR}/metadef/third_party/transformer/inc" - "${GE_CODE_DIR}/parser" - "${GE_CODE_DIR}/parser/parser" - "${GE_CODE_DIR}/third_party/fwkacllib/inc" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" - "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" - "${GE_CODE_DIR}/tests/ut/ge" - "${GE_CODE_DIR}/tests/ut/common" - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/proto/ge" - "${CMAKE_BINARY_DIR}/proto/ge/proto" - ) - -file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "*.cc" "*.CC" "*.cpp" "*.CPP" "*.c++") - -# ---- Target : stub Host engine ---- -add_library(fe SHARED ${SOURCES}) - -target_include_directories(fe - PUBLIC - ${INCLUDE_DIRECTORIES} - ${CMAKE_CURRENT_SOURCE_DIR} - ) - -target_compile_definitions(fe PRIVATE - google=ascend_private - FMK_SUPPORT_DUMP - ) - -target_compile_options(fe PRIVATE - -g --coverage -fprofile-arcs -ftest-coverage - -Werror=format - ) - -target_link_libraries(fe PUBLIC - $ ${STUB_LIBS} metadef_graph -lmmpa -L${GE_CODE_DIR}/third_party/prebuild/x86_64 -lrt -ldl -lpthread -lgcov - ) - -set_target_properties(fe PROPERTIES CXX_STANDARD 11) diff --git a/tests/framework/stub_engine/engine/stub_engine.cc b/tests/framework/stub_engine/engine/stub_engine.cc deleted file mode 100644 index 622e8c4e..00000000 --- a/tests/framework/stub_engine/engine/stub_engine.cc +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 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 "stub_engine.h" -#include -#include -#include -#include -#include "framework/common/debug/ge_log.h" -#include "common/ge/ge_util.h" -#include "inc/st_types.h" - -namespace ge { -namespace st { -StubEngine &StubEngine::Instance() { - static StubEngine instance; - return instance; -} - -Status StubEngine::Initialize(const std::map &options) { - for (const auto engine_2_lib : kStubEngine2KernelLib) { - auto ops_kernel_store = MakeShared(engine_2_lib.second); - if (ops_kernel_store == nullptr) { - return FAILED; - } - ops_kernel_store_map_.insert(make_pair(engine_2_lib.second, ops_kernel_store)); - } - return SUCCESS; -} - -void StubEngine::GetOpsKernelInfoStores(std::map &ops_kernel_map) { - for (const auto name_2_ops_kernel_store : ops_kernel_store_map_) { - ops_kernel_map[name_2_ops_kernel_store.first] = name_2_ops_kernel_store.second; - } -} - -void StubEngine::GetGraphOptimizerObjs(std::map &) { - // no optimizer for host cpu engine -} - -Status StubEngine::Finalize() { - return SUCCESS; -} -} // namespace st -} // namespace ge - -ge::Status Initialize(const std::map &options) { - return ge::st::StubEngine::Instance().Initialize(options); -} - -void GetOpsKernelInfoStores(std::map &ops_kernel_map) { - ge::st::StubEngine::Instance().GetOpsKernelInfoStores(ops_kernel_map); -} - -void GetGraphOptimizerObjs(std::map &graph_optimizers) { - ge::st::StubEngine::Instance().GetGraphOptimizerObjs(graph_optimizers); -} - -ge::Status Finalize() { - return ge::st::StubEngine::Instance().Finalize(); -} diff --git a/tests/framework/stub_engine/engine/stub_engine.h b/tests/framework/stub_engine/engine/stub_engine.h deleted file mode 100644 index d3909115..00000000 --- a/tests/framework/stub_engine/engine/stub_engine.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright 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 GRAPH_ENGINE_LLT_STUB_ENGINE_H_ -#define GRAPH_ENGINE_LLT_STUB_ENGINE_H_ - -#if defined(_MSC_VER) -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY _declspec(dllexport) -#else -#define GE_FUNC_VISIBILITY -#endif -#else -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) -#else -#define GE_FUNC_VISIBILITY -#endif -#endif - -#include -#include -#include -#include "inc/st_types.h" -#include "common/opskernel/ops_kernel_info_store.h" -#include "common/optimizer/graph_optimizer.h" -#include "stub_engine/ops_kernel_store/stub_ops_kernel_store.h" - -using OpsKernelInfoStorePtr = std::shared_ptr; -using StubOpsKernelInfoStorePtr = std::shared_ptr; -using GraphOptimizerPtr = std::shared_ptr; - -namespace ge { -namespace st { -/** - * host cpu engine. - * Used for the ops which executes on host. - */ -class GE_FUNC_VISIBILITY StubEngine { - public: - /** - * get StubEngine instance. - * @return StubEngine instance. - */ - static StubEngine &Instance(); - - virtual ~StubEngine() = default; - - /** - * When Ge start, GE will invoke this interface - * @return The status whether initialize successfully - */ - Status Initialize(const std::map &options); - - /** - * After the initialize, GE will invoke this interface - * to get the Ops kernel Store. - * @param ops_kernel_map The host cpu's ops kernel info - */ - void GetOpsKernelInfoStores(std::map &ops_kernel_map); - - /** - * After the initialize, GE will invoke this interface - * to get the Graph Optimizer. - * @param graph_optimizers The host cpu's Graph Optimizer objs - */ - void GetGraphOptimizerObjs(std::map &graph_optimizers); - - /** - * When the graph finished, GE will invoke this interface - * @return The status whether initialize successfully - */ - Status Finalize(); - - StubEngine(const StubEngine &StubEngine) = delete; - StubEngine(const StubEngine &&StubEngine) = delete; - StubEngine &operator=(const StubEngine &StubEngine) = delete; - StubEngine &operator=(StubEngine &&StubEngine) = delete; - - private: - StubEngine() = default; - map ops_kernel_store_map_; -}; -} // namespace st -} // namespace ge - -extern "C" { - -/** - * When Ge start, GE will invoke this interface - * @return The status whether initialize successfully - */ -GE_FUNC_VISIBILITY ge::Status Initialize(const map &options); - -/** - * After the initialize, GE will invoke this interface to get the Ops kernel Store - * @param ops_kernel_map The host cpu's ops kernel info - */ -GE_FUNC_VISIBILITY void GetOpsKernelInfoStores(std::map &ops_kernel_map); - -/** - * After the initialize, GE will invoke this interface to get the Graph Optimizer - * @param graph_optimizers The host cpu's Graph Optimizer objs - */ -GE_FUNC_VISIBILITY void GetGraphOptimizerObjs(std::map &graph_optimizers); - -/** - * When the graph finished, GE will invoke this interface - * @return The status whether initialize successfully - */ -GE_FUNC_VISIBILITY ge::Status Finalize(); -} - -#endif // GRAPH_ENGINE_LLT_STUB_ENGINE_H_ diff --git a/tests/framework/stub_engine/inc/st_types.h b/tests/framework/stub_engine/inc/st_types.h deleted file mode 100644 index 92aa00d9..00000000 --- a/tests/framework/stub_engine/inc/st_types.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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. - */ -#ifndef GRAPHENGINE_ST_TYPES_H -#define GRAPHENGINE_ST_TYPES_H -#include -namespace ge { -namespace st { -const std::string kAicoreLibName = "AiCoreLib"; -const std::string kVectorLibName = "VectorLib"; -const std::string kAicpuLibName = "AicpuLib"; -const std::string kAicpuAscendLibName = "AicpuAscendLib"; -const std::string kHcclLibName = "HcclLib"; -const std::string kRTSLibName = "RTSLib"; -const std::map kStubEngine2KernelLib = { - {"AIcoreEngine", "AiCoreLib"}, {"VectorEngine", "VectorLib"}, - {"DNN_VM_AICPU", "AicpuLib"}, {"DNN_VM_AICPU_ASCEND", "AicpuAscendLib"}, - {"DNN_HCCL", "HcclLib"}, {"DNN_VM_RTS", "RTSLib"}}; -} // namespace st -} // namespace ge -#endif // GRAPHENGINE_ST_TYPES_H diff --git a/tests/framework/stub_engine/ops_kernel_store/op/host_op.cc b/tests/framework/stub_engine/ops_kernel_store/op/host_op.cc deleted file mode 100644 index 42678148..00000000 --- a/tests/framework/stub_engine/ops_kernel_store/op/host_op.cc +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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 "inc/st_types.h" -#include "stub_engine/ops_kernel_store/op/host_op.h" -#include "framework/common/util.h" -#include "stub_engine/ops_kernel_store/op/stub_op_factory.h" - -namespace ge { -namespace st { -Status HostOp::Run() { - // no need to generate device task - return SUCCESS; -} -REGISTER_OP_CREATOR(Enter, RTSLib, HostOp); -REGISTER_OP_CREATOR(Merge, RTSLib, HostOp); -REGISTER_OP_CREATOR(Switch, RTSLib, HostOp); -REGISTER_OP_CREATOR(Less, AiCoreLib, HostOp); -REGISTER_OP_CREATOR(NextIteration, AiCoreLib, HostOp); -REGISTER_OP_CREATOR(LoopCond, RTSLib, HostOp); -REGISTER_OP_CREATOR(Exit, RTSLib, HostOp); -REGISTER_OP_CREATOR(StreamMerge, RTSLib, HostOp); -REGISTER_OP_CREATOR(StreamSwitch, RTSLib, HostOp); -REGISTER_OP_CREATOR(StreamActive, RTSLib, HostOp); -REGISTER_OP_CREATOR(Cast, AiCoreLib, HostOp); -REGISTER_OP_CREATOR(Transdata, AiCoreLib, HostOp); -} // namespace st -} // namespace ge diff --git a/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.cc b/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.cc deleted file mode 100644 index 601bca4d..00000000 --- a/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.cc +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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 "stub_op_factory.h" -#include "framework/common/debug/ge_log.h" -#include "common/ge_inner_error_codes.h" -#include "graph/op_desc.h" - -namespace ge { -namespace st { -OpFactory &OpFactory::Instance() { - static OpFactory instance; - return instance; -} - -std::shared_ptr OpFactory::CreateOp(const Node &node, RunContext &run_context) { - auto iter = op_creator_map_.find(node.GetType()); - if (iter != op_creator_map_.end()) { - return iter->second(node, run_context); - } - GELOGE(FAILED, "Not supported OP, type = %s, name = %s", node.GetType().c_str(), node.GetName().c_str()); - return nullptr; -} - -void OpFactory::RegisterCreator(const std::string &type, const std::string &kernel_lib, const OP_CREATOR_FUNC &func) { - if (func == nullptr) { - GELOGW("Func is NULL."); - return; - } - - if (all_store_ops_.find(kernel_lib) != all_store_ops_.end()) { - all_store_ops_[kernel_lib].emplace_back(type); - } else { - all_store_ops_[kernel_lib] = {type}; - } -} -} // namespace st -} // namespace ge diff --git a/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.h b/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.h deleted file mode 100644 index f41fd07e..00000000 --- a/tests/framework/stub_engine/ops_kernel_store/op/stub_op_factory.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - * 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. - */ - -#ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_FACTORY_H_ -#define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_FACTORY_H_ - -#include -#include -#include -#include -#include -#include "common/ge/ge_util.h" -#include "stub_engine/ops_kernel_store/op/op.h" -#include "inc/st_types.h" - -namespace ge { -namespace st { -using OP_CREATOR_FUNC = std::function(const Node &, RunContext &)>; - -/** - * manage all the op, support create op. - */ -class GE_FUNC_VISIBILITY OpFactory { - public: - static OpFactory &Instance(); - - /** - * @brief create Op. - * @param [in] node share ptr of node - * @param [in] run_context run context - * @return not nullptr success - * @return nullptr fail - */ - std::shared_ptr CreateOp(const Node &node, RunContext &run_context); - - /** - * @brief Register Op create function. - * @param [in] type Op type - * @param [in] func Op create func - */ - void RegisterCreator(const std::string &type, const std::string &lib_name, const OP_CREATOR_FUNC &func); - - const std::vector &GetAllOps() const { - return all_ops_; - } - - const std::vector &GetAllOps(std::string lib_name) const { - auto iter = all_store_ops_.find(lib_name); - if (iter == all_store_ops_.end()) { - return all_ops_; - } - return iter->second; - } - - bool CheckSupported(const std::string &type) { - return op_creator_map_.find(type) != op_creator_map_.end(); - } - - OpFactory(const OpFactory &) = delete; - OpFactory &operator=(const OpFactory &) = delete; - OpFactory(OpFactory &&) = delete; - OpFactory &operator=(OpFactory &&) = delete; - - private: - OpFactory() = default; - ~OpFactory() = default; - - // the op creator function map - std::map op_creator_map_; - std::map> lib_op_creator_map_; - std::vector all_ops_; - std::map> all_store_ops_; -}; - -class GE_FUNC_VISIBILITY OpRegistrar { - public: - OpRegistrar(const std::string &type, const std::string &kernel_lib, const OP_CREATOR_FUNC &func) { - OpFactory::Instance().RegisterCreator(type, kernel_lib, func); - } - ~OpRegistrar() = default; - - OpRegistrar(const OpRegistrar &) = delete; - OpRegistrar &operator=(const OpRegistrar &) = delete; - OpRegistrar(OpRegistrar &&) = delete; - OpRegistrar &operator=(OpRegistrar &&) = delete; -}; - -#define REGISTER_OP_CREATOR(type, lib_name, clazz) \ - std::shared_ptr Creator_##type##Op(const Node &node, RunContext &run_context) { \ - return MakeShared(node, run_context); \ - } \ - OpRegistrar g_##type##Op_creator(#type, #lib_name, Creator_##type##Op) -} // namespace st -} // namespace ge - -#endif // GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_OP_OP_FACTORY_H_ diff --git a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.cc b/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.cc deleted file mode 100644 index d43fee88..00000000 --- a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.cc +++ /dev/null @@ -1,77 +0,0 @@ -/** - * 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 "stub_ops_kernel_store.h" -#include -#include "ge/ge_api_types.h" -#include "framework/common/debug/ge_log.h" -#include "graph/utils/node_utils.h" -#include "graph/utils/tensor_utils.h" -#include "graph/utils/type_utils.h" -#include "op/stub_op_factory.h" - -namespace ge { -namespace st { -using domi::TaskDef; -using std::map; -using std::string; -using std::vector; - -Status StubOpsKernelInfoStore::Initialize(const map &options) { - GELOGI("StubOpsKernelInfoStore init start."); - string engine_name; - for (const auto &engine_2_lib : kStubEngine2KernelLib) { - if (engine_2_lib.second == store_name_) { - engine_name = engine_2_lib.first; - } - } - if (engine_name.empty()) { - return FAILED; - } - - OpInfo default_op_info = {.engine = engine_name, - .opKernelLib = store_name_, - .computeCost = 0, - .flagPartial = false, - .flagAsync = false, - .isAtomic = false}; - // Init op_info_map_ - auto all_ops_in_store = OpFactory::Instance().GetAllOps(store_name_); - for (auto &op : all_ops_in_store) { - op_info_map_[op] = default_op_info; - } - - GELOGI("StubOpsKernelInfoStore inited success. op num=%zu", op_info_map_.size()); - return SUCCESS; -} - -Status StubOpsKernelInfoStore::Finalize() { - op_info_map_.clear(); - return SUCCESS; -} - -void StubOpsKernelInfoStore::GetAllOpsKernelInfo(map &infos) const { - infos = op_info_map_; -} - -bool StubOpsKernelInfoStore::CheckSupported(const OpDescPtr &op_desc, std::string &) const { - if (op_desc == nullptr) { - return false; - } - return op_info_map_.count(op_desc->GetType()) > 0; -} -} // namespace st -} // namespace ge diff --git a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.h b/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.h deleted file mode 100644 index ea7f712b..00000000 --- a/tests/framework/stub_engine/ops_kernel_store/stub_ops_kernel_store.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - */ - -#ifndef GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_INFO_H_ -#define GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_INFO_H_ - -#if defined(_MSC_VER) -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY _declspec(dllexport) -#else -#define GE_FUNC_VISIBILITY -#endif -#else -#ifdef FUNC_VISIBILITY -#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) -#else -#define GE_FUNC_VISIBILITY -#endif -#endif - -#include -#include -#include - -#include "common/opskernel/ops_kernel_info_store.h" - -namespace ge { -namespace st { -/*const vector kStubOpKernelLibNameVec = { - "AiCoreLib", - "AicpuLib", - "HcclLib", - "RTSLib" -};*/ -class GE_FUNC_VISIBILITY StubOpsKernelInfoStore : public OpsKernelInfoStore { - public: - StubOpsKernelInfoStore(std::string store_name) : store_name_(store_name) {} - ~StubOpsKernelInfoStore() override = default; - Status Initialize(const std::map &options) override; - Status Finalize() override; - bool CheckSupported(const OpDescPtr &op_desc, std::string &reason) const override; - void GetAllOpsKernelInfo(std::map &infos) const override; - std::string GetOpsKernelStoreName() const { - return store_name_; - } - - StubOpsKernelInfoStore(const StubOpsKernelInfoStore &ops_kernel_store) = delete; - StubOpsKernelInfoStore(const StubOpsKernelInfoStore &&ops_kernel_store) = delete; - StubOpsKernelInfoStore &operator=(const StubOpsKernelInfoStore &ops_kernel_store) = delete; - StubOpsKernelInfoStore &operator=(StubOpsKernelInfoStore &&ops_kernel_store) = delete; - - private: - // store op name and OpInfo key-value pair - std::map op_info_map_; - std::string store_name_; -}; -} // namespace st -} // namespace ge - -#endif // GE_HOST_CPU_ENGINE_OPS_KERNEL_STORE_HOST_CPU_OPS_KERNEL_INFO_H_ diff --git a/tests/st/testcase/CMakeLists.txt b/tests/st/testcase/CMakeLists.txt index 9d1d5a0e..b3663708 100644 --- a/tests/st/testcase/CMakeLists.txt +++ b/tests/st/testcase/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories(graph_engine_test set_target_properties(graph_engine_test PROPERTIES CXX_STANDARD 17) -target_link_libraries(graph_engine_test PRIVATE gtest gtest_main framework) +target_link_libraries(graph_engine_test PRIVATE gtest framework) include(CTest) enable_testing() diff --git a/tests/st/testcase/test_framework_dummy.cc b/tests/st/testcase/test_framework_dummy.cc index 951e6b2b..0abdd18b 100644 --- a/tests/st/testcase/test_framework_dummy.cc +++ b/tests/st/testcase/test_framework_dummy.cc @@ -17,9 +17,13 @@ #include #include #include "external/ge/ge_api.h" +#include "ge_running_env/fake_engine.h" #include "graph/debug/ge_attr_define.h" #include "framework/common/types.h" + #include "builder/graph_builder_utils.h" +#include "ge_running_env/ge_running_env_faker.h" + #include "graph/operator_reg.h" #include "graph/operator.h" #define protected public @@ -109,8 +113,8 @@ Graph BuildV1ControlFlowGraph() { for_each(data_vec.begin(), data_vec.end(), [&](int64_t &data) { dims_size *= data; }); vector data_value_vec(dims_size, 1); GeTensorDesc data_tensor_desc(GeShape(data_vec), FORMAT_NCHW, DT_INT32); - GeTensorPtr data_tensor = make_shared(data_tensor_desc, (uint8_t *) data_value_vec.data(), - data_value_vec.size() * sizeof(int32_t)); + GeTensorPtr data_tensor = + make_shared(data_tensor_desc, (uint8_t *)data_value_vec.data(), data_value_vec.size() * sizeof(int32_t)); OpDescUtils::SetWeights(const_5->GetOpDesc(), data_tensor); OpDescUtils::SetWeights(const_2->GetOpDesc(), data_tensor); OpDescUtils::SetWeights(const_1->GetOpDesc(), data_tensor); @@ -120,13 +124,9 @@ Graph BuildV1ControlFlowGraph() { } // namespace class FrameworkTest : public testing::Test { protected: - void SetUp() { - // ge initialize - map options; - auto ret = ge::GEInitialize(options); - EXPECT_EQ(ret, SUCCESS); - } + void SetUp() { ge_env.InstallDefault(); } void TearDown() {} + GeRunningEnvFaker ge_env; }; /// data data diff --git a/tests/st/testcase/test_main.cc b/tests/st/testcase/test_main.cc new file mode 100644 index 00000000..a39c68aa --- /dev/null +++ b/tests/st/testcase/test_main.cc @@ -0,0 +1,37 @@ +/** + * 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 "common/debug/log.h" +#include "external/ge/ge_api.h" +#include "ge_running_env/include/ge_running_env/ge_running_env_faker.h" + +using namespace std; +using namespace ge; + +int main(int argc, char **argv) { + // init the logging + map options; + auto init_status = ge::GEInitialize(options); + if (init_status != SUCCESS) { + std::cout << "ge init failed , ret code:" << init_status << endl; + } + GeRunningEnvFaker::BackupEnv(); + testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + return ret; +} From 07a5635e8b5e08879c2013cffec6164e5697006d Mon Sep 17 00:00:00 2001 From: TangQunzhang Date: Mon, 28 Jun 2021 13:48:18 +0800 Subject: [PATCH 101/226] Print statics when malloc memory fail --- ge/graph/manager/graph_caching_allocator.cc | 18 ++++++++++++------ ge/graph/manager/graph_caching_allocator.h | 10 +++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ge/graph/manager/graph_caching_allocator.cc b/ge/graph/manager/graph_caching_allocator.cc index 82bfbda9..7b316fc3 100644 --- a/ge/graph/manager/graph_caching_allocator.cc +++ b/ge/graph/manager/graph_caching_allocator.cc @@ -20,7 +20,6 @@ #include #include -#include "framework/common/debug/ge_log.h" #include "graph/manager/graph_mem_manager.h" namespace ge { @@ -94,7 +93,8 @@ void IncreaseCount(std::map &count, size_t size) { } } -CachingAllocator::CachingAllocator(rtMemType_t memory_type) : memory_type_(memory_type), memory_allocator_(nullptr) { +CachingAllocator::CachingAllocator(rtMemType_t memory_type) + : memory_type_(memory_type), memory_allocator_(nullptr), called_malloc_counts_(0), called_free_counts_(0) { for (uint32_t i = 0; i < kNumBins; i++) { free_block_bins_[i] = nullptr; } @@ -121,6 +121,8 @@ Status CachingAllocator::Initialize(uint32_t device_id) { if (memory_allocator_ == nullptr) { return ACL_ERROR_GE_INTERNAL_ERROR; } + called_malloc_counts_ = 0; + called_free_counts_ = 0; return ge::SUCCESS; } @@ -133,6 +135,7 @@ void CachingAllocator::Finalize(uint32_t device_id) { uint8_t *CachingAllocator::Malloc(size_t size, uint8_t *org_ptr, uint32_t device_id) { GELOGI("Start malloc pool memory, size = %zu, device id = %u", size, device_id); + called_malloc_counts_++; size = GetBlockSize(size); uint8_t *ptr = nullptr; Block *block = FindFreeBlock(size, org_ptr, device_id); @@ -156,6 +159,7 @@ uint8_t *CachingAllocator::Malloc(size_t size, uint8_t *org_ptr, uint32_t device Status CachingAllocator::Free(uint8_t *ptr, uint32_t device_id) { GELOGI("Free device id = %u", device_id); + called_free_counts_++; if (ptr == nullptr) { REPORT_INNER_ERROR("E19999", "Param ptr is nullptr, device_id:%u, check invalid", device_id); GELOGE(PARAM_INVALID, "[Check][Param] Invalid memory pointer, device_id:%u", device_id); @@ -283,6 +287,7 @@ Status CachingAllocator::TryExtendCache(size_t size, uint32_t device_id) { if (memory_addr == nullptr) { GELOGE(ge::FAILED, "[Malloc][Memory] failed, no enough memory for size = %zu, device_id = %u", memory_size, device_id); + PrintStatics(DLOG_ERROR); return ge::FAILED; } GELOGT(TRACE_RUNNING, "Try to free cached memory size:%zu and malloc memory size:%zu success.", @@ -385,14 +390,14 @@ void CachingAllocator::FreeBlockBins() { } void PrintCount(std::map &count, const std::string &name, size_t total_size, size_t total_count) { - GELOGI("%6s total[size:%10zu count:%10zu].", name.c_str(), total_size, total_count); + GEEVENT("%6s total[size:%11zu count:%11zu].", name.c_str(), total_size, total_count); for (auto &it : count) { - GELOGI(" |- block[size:%10zu count:%10zu].", it.first, it.second); + GEEVENT(" |- block[size:%11zu count:%11zu].", it.first, it.second); } } -void CachingAllocator::PrintStatics() { - if (!IsLogEnable(GE_MODULE_NAME, DLOG_INFO)) { +void CachingAllocator::PrintStatics(int32_t level) { + if (!IsLogEnable(GE_MODULE_NAME, level)) { return; } size_t total_using_size = 0; @@ -435,6 +440,7 @@ void CachingAllocator::PrintStatics() { } } while (0); + GEEVENT("Called counts[malloc:%11zu free:%11zu].", called_malloc_counts_.load(), called_free_counts_.load()); PrintCount(malloc_block_stat, "Malloc", total_malloc_size, total_malloc_count); PrintCount(using_block_stat, "Using", total_using_size, total_using_count); PrintCount(free_block_stat, "Free", total_free_size, total_free_count); diff --git a/ge/graph/manager/graph_caching_allocator.h b/ge/graph/manager/graph_caching_allocator.h index 2db00ff2..d00858f3 100644 --- a/ge/graph/manager/graph_caching_allocator.h +++ b/ge/graph/manager/graph_caching_allocator.h @@ -27,6 +27,7 @@ #include #include +#include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/node.h" #include "graph/manager/block_memory.h" @@ -192,9 +193,10 @@ class CachingAllocator { /// /// @ingroup ge_graph /// @brief print the memory info in pool + /// @param [in] log level /// @return void /// - void PrintStatics(); + void PrintStatics(int32_t level = DLOG_INFO); private: rtMemType_t memory_type_; @@ -213,6 +215,12 @@ class CachingAllocator { // malloced memorys from device std::map malloced_memory_; + + //user call Malloc total counts + std::atomic called_malloc_counts_; + + //user call Free total counts + std::atomic called_free_counts_; }; } // namespace ge #endif // GE_GRAPH_MANAGER_GRAPH_CACHING_ALLOCATOR_H_ From a6b6229967c1241494d86eb39200db8783e55a52 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Thu, 13 May 2021 16:14:41 +0800 Subject: [PATCH 102/226] add copy graph --- ge/graph/manager/graph_manager.cc | 2 +- ge/hybrid/model/hybrid_model.h | 1 + ge/hybrid/model/hybrid_model_builder.cc | 45 +++++++++++++++++----- ge/hybrid/model/hybrid_model_builder.h | 1 + .../hybrid/executor/subgraph_executor_unittest.cc | 3 ++ .../hybrid/model/hybrid_model_builder_unittest.cc | 26 ++++++++++--- 6 files changed, 63 insertions(+), 15 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 66026f8d..01a2e502 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -3131,10 +3131,10 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { } // Avoid repeatively prerun for graphs owns same graph_id in online inference concurrency if (count > 1 && graph_node->GetBuildFlag()) { - graph_node->Lock(); GELOGD("Avoid repeatively prerun, graph_id:%u.", args.graph_id); // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); + graph_node->Lock(); graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); diff --git a/ge/hybrid/model/hybrid_model.h b/ge/hybrid/model/hybrid_model.h index 9821242a..77246e20 100644 --- a/ge/hybrid/model/hybrid_model.h +++ b/ge/hybrid/model/hybrid_model.h @@ -147,6 +147,7 @@ class HybridModel { GeRootModelPtr ge_root_model_; std::map input_nodes_; ComputeGraphPtr root_graph_; + ComputeGraphPtr orig_root_graph_; std::map device_variable_nodes_; //lint !e148 std::map host_variable_nodes_; //lint !e148 std::map> variable_tensors_; diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 1f68f374..e80d9b90 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -147,6 +147,7 @@ Status HybridModelBuilder::Build() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); hybrid_model_.model_name_ = ge_root_model_->GetModelName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); + GE_CHK_STATUS_RET(CopyGraph(), "[Invoke][CopyGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitRuntimeParams(), "[Invoke][InitRuntimeParams] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(RecoverGraphUnknownFlag(), "[Invoke][RecoverGraphUnknownFlag] failed, model_name_:[%s]", GetGraphName()); @@ -171,11 +172,12 @@ Status HybridModelBuilder::Build() { Status HybridModelBuilder::BuildForSingleOp() { GE_CHK_STATUS_RET(ValidateParams(), "[Invoke][ValidateParams] failed, model_name_:[%s]", GetGraphName()); + hybrid_model_.root_graph_ = ge_root_model_->GetRootGraph(); hybrid_model_.model_name_ = ge_root_model_->GetRootGraph()->GetName(); GELOGI("[%s] Start to build hybrid model.", GetGraphName()); auto ret = ge_root_model_->GetSubgraphInstanceNameToModel(); - const GeModelPtr ge_model = ret[ge_root_model_->GetRootGraph()->GetName()]; - GE_CHK_STATUS_RET(IndexTaskDefs(ge_root_model_->GetRootGraph(), ge_model), + const GeModelPtr ge_model = ret[hybrid_model_.root_graph_->GetName()]; + GE_CHK_STATUS_RET(IndexTaskDefs(hybrid_model_.root_graph_, ge_model), "[Invoke][IndexTaskDefs] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(LoadGraph(), "[Invoke][LoadGraph] failed, model_name_:[%s]", GetGraphName()); GE_CHK_STATUS_RET(InitWeights(), "[Invoke][InitWeights] failed, model_name_:[%s]", GetGraphName()); @@ -190,6 +192,27 @@ Status HybridModelBuilder::ValidateParams() { return SUCCESS; } +Status HybridModelBuilder::CopyGraph() { + GELOGD("Copy compute graph begin."); + auto root_graph = ge_root_model_->GetRootGraph(); + + std::string new_graph_name = ge_root_model_->GetRootGraph()->GetName(); + ComputeGraphPtr new_root_graph = MakeShared(new_graph_name); + GE_CHECK_NOTNULL(new_root_graph); + int32_t depth = 0; + std::map node_old_2_new; + std::map op_desc_old_2_new; + graphStatus ret = GraphUtils::CopyComputeGraph(root_graph, new_root_graph, node_old_2_new, op_desc_old_2_new, depth); + if (ret != GRAPH_SUCCESS) { + GELOGE(GRAPH_FAILED, "Copy compute graph failed."); + return GRAPH_FAILED; + } + hybrid_model_.root_graph_ = new_root_graph; + + GELOGD("Copy compute graph[%s] success.", new_graph_name.c_str()); + return SUCCESS; +} + Status HybridModelBuilder::BuildNodeItem(const NodePtr &node, NodeItem &node_item) { auto op_desc = node->GetOpDesc(); GE_CHK_STATUS_RET(ParseForceInfershapeNodes(node, node_item), @@ -810,12 +833,13 @@ Status HybridModelBuilder::BuildOutputMapping(GraphItem &graph_item, } Status HybridModelBuilder::LoadGraph() { - auto root_graph = ge_root_model_->GetRootGraph(); + auto root_graph = hybrid_model_.root_graph_; if (!GetContext().GetHostExecFlag()) { std::shared_ptr merged_graph; GELOGI("Before merging subgraphs DirectNodesSize = %zu, GetAllNodesSize = %zu", root_graph->GetDirectNodesSize(), root_graph->GetAllNodesSize()); + hybrid_model_.orig_root_graph_ = root_graph; GE_CHK_GRAPH_STATUS_RET(UnfoldSubgraphs(root_graph, merged_graph), "[Invoke][UnfoldSubgraphs]Failed to unfold subgraphs, model_name_:%s.", GetGraphName()); root_graph = std::move(merged_graph); @@ -873,6 +897,7 @@ Status HybridModelBuilder::LoadGraph() { } for (auto &it : hybrid_model_.known_shape_sub_models_) { auto node_item = MutableNodeItem(it.first); + GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); @@ -1121,7 +1146,9 @@ Status HybridModelBuilder::InitWeights() { sub_weight_buffer->GetSize()); auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); if (subgraph != ge_root_model_->GetRootGraph()) { - subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); + subgraph = hybrid_model_.root_graph_->GetSubgraph(subgraph_model.first); + } else { + subgraph = hybrid_model_.root_graph_; } GE_CHECK_NOTNULL(subgraph); hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); @@ -1300,7 +1327,7 @@ Status HybridModelBuilder::IndexTaskDefs(const ComputeGraphPtr &sub_graph, const } Status HybridModelBuilder::IndexTaskDefs() { - const auto root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; const auto &root_graph_name = root_graph->GetName(); if (SetOutputNameAttr(*root_graph) != SUCCESS) { GELOGW("Set output name attr failed."); @@ -1334,7 +1361,7 @@ Status HybridModelBuilder::IndexTaskDefs() { Status HybridModelBuilder::IndexSpecialNodes() { GELOGD("Start to index special nodes"); - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &node : root_graph->GetAllNodes()) { GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); @@ -1489,7 +1516,7 @@ Status HybridModelBuilder::InitRuntimeParams() { runtime_param_.session_id = ret ? static_cast(value) : 0; ret = ge::AttrUtils::GetInt(first_model, ATTR_MODEL_TASK_GEN_VAR_ADDR, value); runtime_param_.logic_var_base = ret ? static_cast(value) : 0; - runtime_param_.graph_id = ge_root_model_->GetRootGraph()->GetGraphID(); + runtime_param_.graph_id = hybrid_model_.root_graph_->GetGraphID(); value = 0; for (auto &it : ge_root_model_->GetSubgraphInstanceNameToModel()) { (void) ge::AttrUtils::GetInt(it.second, ATTR_MODEL_VAR_SIZE, value); @@ -1626,7 +1653,7 @@ Status HybridModelBuilder::TransAllVarData() { } Status HybridModelBuilder::CopyVarData() { - GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(ge_root_model_->GetRootGraph(), + GE_CHK_STATUS_RET(TransVarDataUtils::CopyVarData(hybrid_model_.root_graph_, runtime_param_.session_id, hybrid_model_.device_id_), "[Invoke][CopyVarData] failed."); @@ -1709,7 +1736,7 @@ Status HybridModelBuilder::LoadKnownShapedSubgraph(ComputeGraph &graph, NodeItem } Status HybridModelBuilder::RecoverGraphUnknownFlag() { - const auto &root_graph = ge_root_model_->GetRootGraph(); + const auto &root_graph = hybrid_model_.root_graph_; for (auto &sub_graph : root_graph->GetAllSubgraphs()) { GE_CHECK_NOTNULL(sub_graph); for (const auto &node : sub_graph->GetDirectNode()) { diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 9c1eb187..05830e82 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -56,6 +56,7 @@ class HybridModelBuilder { Status BuildOutputMapping(GraphItem &partitioned_call, const NodeItem &node_item, bool is_root_graph); Status ValidateParams(); Status LoadGraph(); + Status CopyGraph(); Status LoadGeModel(ComputeGraph &graph, const GeModelPtr &ge_model); static Status InitHcclExecutorOnDemand(const GeModelPtr &ge_model); Status LoadTask(NodeItem &node_item); diff --git a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc index 2dc3b639..827705ae 100644 --- a/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/subgraph_executor_unittest.cc @@ -249,6 +249,9 @@ TEST_F(UtestSubgraphExecutor, cond_graph_schedule_tasks) { graph_context.callback_manager = std::unique_ptr(new CallbackManager()); ASSERT_EQ(graph_context.callback_manager->Init(), SUCCESS); + auto root_graph = hybrid_model.root_graph_; + switch_t = root_graph->FindNode("switch_t"); + switch_f = root_graph->FindNode("switch_f"); const auto node_it_t = hybrid_model.node_items_.find(switch_t); const auto node_it_f = hybrid_model.node_items_.find(switch_f); ASSERT_NE(hybrid_model.node_items_.end(), node_it_t); diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 5567aca2..10f7c0fe 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -214,11 +214,17 @@ TEST_F(UtestHybridModelBuilder, normal_hybrid_model_build) { ASSERT_EQ(it->second->frame_index_, index); ASSERT_EQ(it->second->parent_frame_, -1); }; - TestFrameGroup(enter1, control_group_index); - TestFrameGroup(active1, control_group_index); - TestFrameGroup(active2, control_group_index); - TestFrameGroup(active3, control_group_index); - TestFrameGroup(output1, -1); + auto root_graph = hybrid_model.root_graph_; + auto enter1_node = root_graph->FindNode("enter"); + auto active1_node = root_graph->FindNode("active1"); + auto active2_node = root_graph->FindNode("active2"); + auto active3_node = root_graph->FindNode("active3"); + auto output1_node = root_graph->FindNode("net_output"); + TestFrameGroup(enter1_node, control_group_index); + TestFrameGroup(active1_node, control_group_index); + TestFrameGroup(active2_node, control_group_index); + TestFrameGroup(active3_node, control_group_index); + TestFrameGroup(output1_node, -1); engine_mapping.clear(); task_executor.clear(); @@ -373,4 +379,14 @@ TEST_F(UtestHybridModelBuilder, TestInitHcclExecutorOnDemand) { NodeExecutorManager::GetInstance().builders_.erase(NodeExecutorManager::ExecutorType::HCCL); ASSERT_EQ(HybridModelBuilder::InitHcclExecutorOnDemand(ge_model), SUCCESS); } + +TEST_F(UtestHybridModelBuilder, copy_graph_success) { +ComputeGraphPtr graph = std::make_shared("test"); +GeRootModelPtr ge_root_model = make_shared(graph); +HybridModel hybrid_model(ge_root_model); +HybridModelBuilder hybrid_model_builder(hybrid_model); + +Status st = hybrid_model_builder.CopyGraph(); +EXPECT_EQ(st, SUCCESS); +} } // namespace ge From deecaf160a6a18ca9fa075606163fa16e53dba23 Mon Sep 17 00:00:00 2001 From: wq160 Date: Mon, 28 Jun 2021 10:37:15 +0800 Subject: [PATCH 103/226] Temporarily disable ImmediateRePass --- ge/graph/passes/infer_base_pass.cc | 5 ++--- tests/ut/ge/graph/passes/infer_base_pass_unittest.cc | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ge/graph/passes/infer_base_pass.cc b/ge/graph/passes/infer_base_pass.cc index 27eb0c54..25c45677 100644 --- a/ge/graph/passes/infer_base_pass.cc +++ b/ge/graph/passes/infer_base_pass.cc @@ -84,9 +84,8 @@ Status InferBasePass::Run(NodePtr &node) { bool InferBasePass::NeedInfer(const NodePtr &node) const { return true; } void InferBasePass::AddChangedNodesImmediateRepass(const std::set &changed_nodes) { - for (const auto &node_ele : changed_nodes) { - AddImmediateRePassNode(node_ele); - } +// need passed_nodes set to solve the problem that multi-input operators do repass in advance. +// when there is passed_nodes set, wo should call AddImmediateRePassNode for all nodes in changed_nodes. } graphStatus InferBasePass::InferAndUpdate(NodePtr &node, bool before_subgraph, std::set &changed_nodes) { diff --git a/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc index e9247f75..24cc5c1b 100644 --- a/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/infer_base_pass_unittest.cc @@ -255,7 +255,7 @@ TEST_F(UtestGraphInferBasePassStub, AddCurNodeRepass_NotCallUpdatePeerNode_WhenI EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); EXPECT_EQ(stub_base_pass.call_infer_times, 1); EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 0); - EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({add_node})); +// EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({add_node})); } TEST_F(UtestGraphInferBasePassStub, NotAddPeerNodeRepass_AfterUpdatePeerNode_WhenUnchanged) { @@ -291,7 +291,7 @@ TEST_F(UtestGraphInferBasePassStub, AddPeerNodeRepass_AfterUpdatePeerNode_WhenCh EXPECT_EQ(stub_base_pass.Run(add_node), SUCCESS); EXPECT_EQ(stub_base_pass.call_update_tensor_desc_times, 1); - EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({netoutput})); +// EXPECT_EQ(stub_base_pass.GetNodesNeedRePassImmediately(), std::unordered_set({netoutput})); } TEST_F(UtestGraphInferBasePassStub, TestUpdateSubgraphData_WhenBeforeSubgraph) { From e9bab262b736d4d56e3d78c8ed921fa811b752bd Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 28 Jun 2021 16:43:47 +0800 Subject: [PATCH 104/226] Fix bug of aicore input const. --- ge/single_op/task/op_task.cc | 54 +++++++++++++++++++++--- ge/single_op/task/op_task.h | 2 + tests/ut/ge/single_op/single_op_task_unittest.cc | 37 ++++++++++++++-- 3 files changed, 83 insertions(+), 10 deletions(-) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index b6a78f9e..92d1e325 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -345,6 +345,53 @@ Status TbeOpTask::AllocateWorkspaces(const vector &workspace_sizes) { return SUCCESS; } +Status TbeOpTask::UpdateIoAddr(std::vector &args, const std::vector &inputs, + const std::vector &outputs) { + uintptr_t *arg_base = nullptr; + size_t arg_num = 0; + GetIoAddr(arg_base, arg_num); + + const vector v_is_input_const = op_desc_->GetIsInputConst(); + size_t non_const_index = 0; + for (size_t i = 0; i < op_desc_->GetAllInputsSize(); ++i) { + const GeTensorDescPtr tensor_desc = op_desc_->MutableInputDesc(static_cast(i)); + if (tensor_desc == nullptr) { + GELOGD("SingleOp: %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]) { + if (i >= arg_num) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Args size is %zu, but get index is %zu.", arg_num, i); + REPORT_INNER_ERROR("E19999", "[Check][Size] Args size is %zu, but get index is %zu.", arg_num, i); + return ACL_ERROR_GE_PARAM_INVALID; + } + auto addr = reinterpret_cast(arg_base[i]); + GELOGD("SingleOp: %s, Index: %zu, input is const, addr = %p", op_desc_->GetName().c_str(), i, addr); + args.emplace_back(addr); + continue; + } + if (non_const_index >= inputs.size()) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Input size is %zu, but get non_const_index is %zu", + inputs.size(), non_const_index); + REPORT_INNER_ERROR("E19999", "[Check][Size] Input size is %zu, but get non_const_index is %zu", + inputs.size(), non_const_index); + return ACL_ERROR_GE_PARAM_INVALID; + } + auto addr = inputs[non_const_index].data; + GELOGD("SingleOp: %s, input[%zu], addr = %p", op_desc_->GetName().c_str(), i, addr); + args.emplace_back(addr); + non_const_index++; + } + + for (size_t i = 0; i < outputs.size(); ++i) { + auto addr = outputs[i].data; + GELOGD("SingleOp: %s, output[%zu] addr = %p", op_desc_->GetName().c_str(), i, addr); + args.emplace_back(addr); + } + + return SUCCESS; +} + Status TbeOpTask::LaunchKernel(const vector &input_desc, const vector &input_buffers, vector &output_desc, @@ -355,12 +402,7 @@ Status TbeOpTask::LaunchKernel(const vector &input_desc, GE_CHK_STATUS_RET_NOLOG(UpdateRunInfo()); GE_CHK_STATUS_RET(AllocateWorkspaces(run_info_workspaces_), "[Allocate][Workspaces] failed."); std::vector args; - for (auto &buffer : input_buffers) { - args.emplace_back(buffer.data); - } - for (auto &buffer : output_buffers) { - args.emplace_back(buffer.data); - } + GE_CHK_STATUS_RET(UpdateIoAddr(args, input_buffers, output_buffers), "[Update][IoAddr] failed."); for (auto &buffer : workspaces_) { args.emplace_back(buffer); } diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 19320bc0..0cbc1a29 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -101,6 +101,8 @@ class TbeOpTask : public OpTask { const vector &output_desc); Status AllocateWorkspaces(const std::vector &workspace_sizes); Status DoLaunchKernel(rtStream_t stream); + Status UpdateIoAddr(std::vector &args, const std::vector &inputs, + const std::vector &outputs); const void *stub_func_ = nullptr; std::unique_ptr args_; diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index a17c9012..472a88c3 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -91,8 +91,9 @@ TEST_F(UtestSingleOpTask, test_build_kernel_task) { TbeOpTask task_tmp; TbeOpTask *task = &task_tmp; ASSERT_EQ(model.BuildKernelTask(task_def, &task), SUCCESS); + ge::DataBuffer data_buffer; vector input_desc; - vector input_buffers; + vector input_buffers = { data_buffer }; vector output_desc; vector output_buffers; task->node_ = node; @@ -110,8 +111,36 @@ TEST_F(UtestSingleOpTask, test_build_kernel_task) { task->args_.reset(&task_args); ASSERT_EQ(task->LaunchKernel(input_desc, input_buffers, output_desc, output_buffers, stream_), SUCCESS); - char handle_tmp = '0'; - char *handle = &handle_tmp; + char *handle = "00"; task->SetHandle(handle); ASSERT_EQ(task->LaunchKernel(input_desc, input_buffers, output_desc, output_buffers, stream_), SUCCESS); -} \ No newline at end of file +} + +TEST_F(UtestSingleOpTask, test_update_ioaddr) { + auto graph = make_shared("graph"); + auto op_desc = make_shared("Add", "Add"); + + GeTensorDesc desc; + op_desc->AddInputDesc(desc); + op_desc->AddInputDesc(desc); + op_desc->AddOutputDesc(desc); + vector is_input_const = { true, false }; + op_desc->SetIsInputConst(is_input_const); + auto node = graph->AddNode(op_desc); + + TbeOpTask task; + task.op_desc_ = op_desc; + task.args_.reset(new (std::nothrow) uint8_t[sizeof(void *) * 3]); + + vector args; + vector inputs; + vector outputs; + ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); + task.arg_size_ = sizeof(void *) * 3; + ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); + + ge::DataBuffer data_buffer; + inputs = { data_buffer }; + ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), SUCCESS); +} + From b9715a14584132d72ca9dd49811a943852730eca Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 28 Jun 2021 19:23:31 +0800 Subject: [PATCH 105/226] DSP: Switch -> TransData -> Cast -> Exit --- ge/graph/passes/next_iteration_pass.cc | 33 +++++++++++++++++---------- ge/hybrid/executor/worker/execution_engine.cc | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ge/graph/passes/next_iteration_pass.cc b/ge/graph/passes/next_iteration_pass.cc index fb8f8627..1c2d7218 100644 --- a/ge/graph/passes/next_iteration_pass.cc +++ b/ge/graph/passes/next_iteration_pass.cc @@ -24,7 +24,9 @@ using std::string; namespace ge { namespace { -const int64_t kLoopType = 1; +constexpr int64_t kLoopType = 1; +constexpr uint8_t kMaxTransOp = 3; +constexpr uint8_t kTransOpIoSize = 1; } Status NextIterationPass::Run(ComputeGraphPtr graph) { @@ -287,18 +289,25 @@ void NextIterationPass::HandleSwitchExitNodes(const LoopCondGroup &loop_group, i std::string node_type; for (const auto &switch_node : loop_group.switch_nodes) { SetControlFlowGroup(switch_node, group_index); - for (const auto &node : switch_node->GetOutDataNodes()) { - (void)GetOriginalType(node, node_type); - if (kExitOpTypes.count(node_type) > 0) { - SetControlFlowGroup(node, group_index); - } else { - // For: Switch -> Cast -> Exit - for (const auto &n : node->GetOutDataNodes()) { - (void)GetOriginalType(n, node_type); - if (kExitOpTypes.count(node_type) > 0) { - SetControlFlowGroup(n, group_index); - } + for (auto node : switch_node->GetOutDataNodes()) { + // Switch --> Exit + // Switch --> Cast --> Exit + // Switch --> TransData --> Cast --> Exit + for (uint8_t i = 0; i < kMaxTransOp; ++i) { + if (node->GetInDataNodes().size() != kTransOpIoSize || node->GetAllOutDataAnchorsSize() != kTransOpIoSize) { + break; } + + if (kExitOpTypes.count(NodeUtils::GetNodeType(node)) > 0) { + SetControlFlowGroup(node, group_index); + break; + } + + const auto &all_nodes = node->GetOutAllNodes(); + if (all_nodes.size() != kTransOpIoSize) { + break; + } + node = all_nodes.at(0); } } } diff --git a/ge/hybrid/executor/worker/execution_engine.cc b/ge/hybrid/executor/worker/execution_engine.cc index d4c73f58..ca864244 100755 --- a/ge/hybrid/executor/worker/execution_engine.cc +++ b/ge/hybrid/executor/worker/execution_engine.cc @@ -373,9 +373,9 @@ Status ExecutionEngine::DoExecuteAsync(NodeState &node_state, auto executor = node_item.node_executor; GE_CHECK_NOTNULL(executor); RECORD_EXECUTION_EVENT(&context, task_context.GetNodeName(), "[PrepareTask] Start"); + node_state.UpdatePersistTensor(); GE_CHK_STATUS_RET(executor->PrepareTask(*task, task_context), "[Prepare][Task] for [%s] failed.", node_state.GetName().c_str()); - node_state.UpdatePersistTensor(); RECORD_EXECUTION_EVENT(&context, task_context.GetNodeName(), "[PrepareTask] End"); GELOGD("[%s] Done task preparation successfully.", node_state.GetName().c_str()); From c7e8fc988d24c951dc1942847878e2b339e0e961 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 28 Jun 2021 19:26:20 +0800 Subject: [PATCH 106/226] Fix bug of multi_task. --- ge/single_op/single_op_model.cc | 128 ++++++++++++++++++++++------------------ ge/single_op/single_op_model.h | 6 ++ 2 files changed, 77 insertions(+), 57 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 08a0fcbc..e5d15beb 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -95,35 +95,6 @@ Status CheckInferDepend(GeModelPtr &ge_model, bool &is_infer_depend, bool &is_ho } return SUCCESS; } - -Status NeedHybridModel(GeModelPtr &ge_model, bool &flag) { - bool is_infer_depend = false; - bool is_host_mem = false; - GE_CHK_STATUS_RET(CheckInferDepend(ge_model, is_infer_depend, is_host_mem), "[Check][InferDepend] failed."); - bool need_d2h_cpy = is_infer_depend && !is_host_mem; - auto tasks = ge_model->GetModelTaskDefPtr()->task(); - int32_t kernel_task_num = 0; - for (int i = 0; i < tasks.size(); ++i) { - auto task_type = static_cast(tasks[i].type()); - if (task_type == RT_MODEL_TASK_KERNEL || task_type == RT_MODEL_TASK_ALL_KERNEL) { - const auto &context = task_type == RT_MODEL_TASK_KERNEL ? tasks[i].kernel().context() : - tasks[i].kernel_with_handle().context(); - auto kernel_type = static_cast(context.kernel_type()); - if (kernel_type == ccKernelType::TE) { - if (need_d2h_cpy) { - flag = true; - return SUCCESS; - } - kernel_task_num++; - if (kernel_task_num > 1) { - flag = true; - return SUCCESS; - } - } - } - } - return SUCCESS; -} } // namespace SingleOpModel::SingleOpModel(const std::string &model_name, const void *model_data, uint32_t model_size) @@ -596,50 +567,92 @@ Status SingleOpModel::BuildModelTaskKernel(StreamResource *stream_resource, cons } Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &single_op) { - auto ge_model = model_helper_.GetGeModel(); - GE_CHECK_NOTNULL(ge_model); - - auto compute_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); - GE_CHECK_NOTNULL(compute_graph); - single_op.compute_graph_ = compute_graph; - auto tasks = ge_model->GetModelTaskDefPtr()->task(); - for (int i = 0; i < tasks.size(); ++i) { - const TaskDef &task_def = tasks[i]; - GELOGI("[%s] Task[%d], type = [%u], DebugString = [%s]", model_name_.c_str(), i, task_def.type(), - task_def.DebugString().c_str()); + if (tbe_tasks_.size() > 0) { + const auto &task_def = tbe_tasks_[0]; + GELOGD("Building TBE task."); + TbeOpTask *tbe_task = nullptr; + GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def, &tbe_task)); + tbe_task->SetModelArgs(model_name_, model_id_); + if (tbe_task->tiling_buffer_ != nullptr) { + GELOGD("tiling buffer is not nullptr."); + tbe_task->stream_resource_ = stream_resource; + } + single_op.op_task_.reset(tbe_task); + } else if (aicpu_tasks_.size() > 0) { + const auto &task_def = aicpu_tasks_[0]; auto task_type = static_cast(task_def.type()); - if (task_type == RT_MODEL_TASK_KERNEL || task_type == RT_MODEL_TASK_ALL_KERNEL) { - if (single_op.op_task_ != nullptr) { - GELOGE(ACL_ERROR_GE_OP_TASK_TYPE_INVALID, "[Check][TaskType]Do not support dynamic op with multiple tasks."); - REPORT_INNER_ERROR("E19999", - "BuildTaskListForDynamicOp fail for Do not support dynamic op with multiple tasks."); - return ACL_ERROR_GE_OP_TASK_TYPE_INVALID; - } - GE_CHK_STATUS_RET_NOLOG(BuildModelTaskKernel(stream_resource, task_def, single_op)); + if (task_type == RT_MODEL_TASK_KERNEL) { + GELOGD("Building AICPU_CC task"); + OpTask *task = nullptr; + uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; + GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); + GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); + task->SetModelArgs(model_name_, model_id_); + single_op.op_task_.reset(task); } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { - if (single_op.op_task_ != nullptr) { - GELOGE(ACL_ERROR_GE_OP_TASK_TYPE_INVALID, "[Check][TaskType]Do not support dynamic op with multiple tasks."); - REPORT_INNER_ERROR("E19999", - "BuildTaskListForDynamicOp fail for Do not support dynamic op with multiple tasks."); - return ACL_ERROR_GE_OP_TASK_TYPE_INVALID; - } GELOGD("Building AICPU_TF task"); AiCpuTask *aicpu_task = nullptr; uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, dynamic_singleop_kernel_id)); if (aicpu_task->GetUnknownType() == DEPEND_COMPUTE) { - if (i >= tasks.size() - 1) { + if (aicpu_tasks_.size() < 2) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Task]The copy task of the fourth operator was not found."); REPORT_INNER_ERROR("E19999", "The copy task of the fourth operator was not found."); return ACL_ERROR_GE_PARAM_INVALID; } - ++i; - const TaskDef ©_task_def = tasks[i]; + const TaskDef ©_task_def = aicpu_tasks_[1]; GE_CHK_STATUS_RET_NOLOG(aicpu_task->SetMemCopyTask(copy_task_def.kernel_ex())); } aicpu_task->SetModelArgs(model_name_, model_id_); single_op.op_task_.reset(aicpu_task); + } + } + return SUCCESS; +} + +Status SingleOpModel::NeedHybridModel(GeModelPtr &ge_model, bool &need_hybrid_model) { + bool is_infer_depend = false; + bool is_host_mem = false; + GE_CHK_STATUS_RET(CheckInferDepend(ge_model, is_infer_depend, is_host_mem), "[Check][InferDepend] failed."); + bool need_d2h_cpy = is_infer_depend && !is_host_mem; + bool aicpu_multi_task = tbe_tasks_.size() >= 1 && aicpu_tasks_.size() >= 1; + bool aicore_multi_task = tbe_tasks_.size() > 1; + need_hybrid_model = need_d2h_cpy || aicore_multi_task || aicpu_multi_task; + return SUCCESS; +} + +Status SingleOpModel::ParseTasks() { + auto ge_model = model_helper_.GetGeModel(); + GE_CHECK_NOTNULL(ge_model); + + auto tasks = ge_model->GetModelTaskDefPtr()->task(); + for (int i = 0; i < tasks.size(); ++i) { + TaskDef &task_def = tasks[i]; + GELOGI("[%s] Task[%d], type = [%u], DebugString = [%s]", model_name_.c_str(), i, task_def.type(), + task_def.DebugString().c_str()); + auto task_type = static_cast(task_def.type()); + if (task_type == RT_MODEL_TASK_KERNEL) { + const auto &kernel_def = task_def.kernel(); + const auto &context = kernel_def.context(); + auto kernel_type = static_cast(context.kernel_type()); + if (kernel_type == ccKernelType::TE) { + tbe_tasks_.emplace_back(task_def); + } else if (kernel_type == ccKernelType::AI_CPU || kernel_type == ccKernelType::CUST_AI_CPU) { + aicpu_tasks_.emplace_back(task_def); + } else { + GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, + "[Check][Param:TaskDef]Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", + context.kernel_type()); + REPORT_INNER_ERROR("E19999", + "BuildModelTaskKernel fail for got:%u not supported, Only TBE, AI_CPU, CUST_AI_CPU kernel are supported.", + context.kernel_type()); + return ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID; + } + } else if (task_type == RT_MODEL_TASK_ALL_KERNEL) { + tbe_tasks_.emplace_back(task_def); + } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { + aicpu_tasks_.emplace_back(task_def); } else { // skip GELOGD("Skip task type: %d", static_cast(task_type)); @@ -654,6 +667,7 @@ Status SingleOpModel::BuildDynamicOp(StreamResource &resource, DynamicSingleOp & GE_CHK_STATUS_RET_NOLOG(InitModelMem(resource)); model_params_.memory_size = UINT64_MAX; model_params_.graph_is_dynamic = true; + GE_CHK_STATUS_RET(ParseTasks(), "[Parse][Tasks] failed."); auto ge_model = model_helper_.GetGeModel(); GE_CHECK_NOTNULL(ge_model); diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index b7f6b42a..98aed0f0 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -78,6 +78,12 @@ class SingleOpModel { void ParseArgTable(OpTask *task, SingleOp &op); Status InitHybridModelExecutor(const StreamResource &resource, const GeModelPtr &ge_model, SingleOp &single_op); Status SetHostMemTensor(DynamicSingleOp &single_op); + Status NeedHybridModel(GeModelPtr &ge_model, bool &flag); + Status ParseTasks(); + + std::vector tbe_tasks_; + std::vector atomic_tasks_; + std::vector aicpu_tasks_; std::string model_name_; uint32_t model_id_ = 0; From 98f34a58bbf8cad99b7e127942c83389a6305574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Wed, 23 Jun 2021 19:36:26 +0800 Subject: [PATCH 107/226] opt info --- CMakeLists.txt | 1 + ge/CMakeLists.txt | 8 ++ ge/ge_opt_info/ge_opt_info.cc | 58 +++++++++++ ge/ge_opt_info/ge_opt_info.h | 31 ++++++ ge/graph/manager/graph_manager.cc | 7 ++ tests/CMakeLists.txt | 1 + tests/depends/opt_info/CMakeLists.txt | 37 +++++++ tests/depends/opt_info/src/opt_info_stub.cc | 46 +++++++++ tests/framework/cmake/graphengine.cmake | 2 + tests/st/testcase/test_ge_opt_info.cc | 123 ++++++++++++++++++++++++ tests/ut/ge/CMakeLists.txt | 14 +++ tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc | 82 ++++++++++++++++ third_party/fwkacllib/inc/opt_info/opt_info.h | 32 ++++++ 13 files changed, 442 insertions(+) create mode 100644 ge/ge_opt_info/ge_opt_info.cc create mode 100644 ge/ge_opt_info/ge_opt_info.h create mode 100644 tests/depends/opt_info/CMakeLists.txt create mode 100644 tests/depends/opt_info/src/opt_info_stub.cc create mode 100644 tests/st/testcase/test_ge_opt_info.cc create mode 100644 tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc create mode 100644 third_party/fwkacllib/inc/opt_info/opt_info.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e3cc1e32..41520b14 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ else () #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) + find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) find_module(static_mmpa libmmpa.a ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 2b9122da..5db2e7a9 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -434,6 +434,7 @@ set(TRAIN_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" + "ge_opt_info/ge_opt_info.cc" ) set(INFER_SRC_LIST @@ -711,6 +712,7 @@ set(INFER_SRC_LIST "graph/build/memory/max_block_mem_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" "graph/build/memory/buffer_pool_mem_assigner.cc" + "ge_opt_info/ge_opt_info.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) @@ -765,11 +767,13 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external + ${GE_CODE_DIR}/../abl/licctrl #### blue zone ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_runner PRIVATE @@ -792,6 +796,7 @@ target_link_libraries(ge_runner PRIVATE runtime error_manager ascend_hal_stub + opt_feature -Wl,--as-needed json -lrt @@ -839,11 +844,13 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external + ${GE_CODE_DIR}/../abl/licctrl #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain + ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info ) target_link_options(ge_compiler PRIVATE @@ -863,6 +870,7 @@ target_link_libraries(ge_compiler PRIVATE error_manager slog runtime_compile + opt_feature -Wl,--as-needed json -lrt diff --git a/ge/ge_opt_info/ge_opt_info.cc b/ge/ge_opt_info/ge_opt_info.cc new file mode 100644 index 00000000..8c1b84ab --- /dev/null +++ b/ge/ge_opt_info/ge_opt_info.cc @@ -0,0 +1,58 @@ +/** + * 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 "ge_opt_info/ge_opt_info.h" + +#include +#include +#include "graph/ge_local_context.h" +#include "ge/ge_api_types.h" +#include "common/debug/ge_log.h" +#include "opt_info.h" + +namespace ge { +Status GeOptInfo::SetOptInfo() { + std::string soc_ver; + graphStatus ret = GetThreadLocalContext().GetOption(SOC_VERSION, soc_ver); + if (ret != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get soc version failed."); + GELOGE(FAILED, "[Get][SocVersion]Get soc version failed."); + return FAILED; + } + GELOGD("Soc version:%s.", soc_ver.c_str()); + std::map opt_info; + // the first arg does not work at present. + if (gelc::GetOptInfo(gelc::kOffline, soc_ver, opt_info) != gelc::SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + GELOGE(FAILED, "[Get][OptInfo]Get optional information failed, is_offline:%d, soc version:%s", + gelc::kOffline, soc_ver.c_str()); + return FAILED; + } + // do nothing if get empty information + if (opt_info.empty()) { + GELOGI("Optional information is empty."); + return SUCCESS; + } + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + for (const auto &itr : opt_info) { + graph_options.emplace(itr.first, itr.second); + GELOGI("Get optional information success, key:%s, value:%s.", itr.first.c_str(), itr.second.c_str()); + } + GetThreadLocalContext().SetGraphOption(graph_options); + return SUCCESS; +} +} // namespace ge diff --git a/ge/ge_opt_info/ge_opt_info.h b/ge/ge_opt_info/ge_opt_info.h new file mode 100644 index 00000000..935dff25 --- /dev/null +++ b/ge/ge_opt_info/ge_opt_info.h @@ -0,0 +1,31 @@ +/** + * 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. + */ + +#ifndef GE_OPT_INFO_GE_OPT_INFO_H_ +#define GE_OPT_INFO_GE_OPT_INFO_H_ + +#include "ge/ge_api_error_codes.h" +#include "register/register_types.h" + +namespace ge { +class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeOptInfo { + public: + GeOptInfo() = default; + static Status SetOptInfo(); +}; +} // namespace ge + +#endif // GE_OPT_INFO_GE_OPT_INFO_H_ diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index b862a7d6..0a4633ad 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -27,6 +27,7 @@ #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" +#include "ge_opt_info/ge_opt_info.h" #include "analyzer/analyzer.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" @@ -1001,6 +1002,12 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector + c_sec +) + +target_include_directories(opt_feature_stub INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/tests/depends/opt_info/src/opt_info_stub.cc b/tests/depends/opt_info/src/opt_info_stub.cc new file mode 100644 index 00000000..df518c4b --- /dev/null +++ b/tests/depends/opt_info/src/opt_info_stub.cc @@ -0,0 +1,46 @@ +/** + * 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 "opt_info.h" +#include +#include +#include +#include + +namespace gelc { +namespace { +const std::vector kSocVersions = {"Ascend910"}; +} + +void SetAllOptInfo(std::map &opt_infos) { + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + opt_infos.emplace("opt_module.rl_tune", "all"); + opt_infos.emplace("opt_module.aoe", "all"); +} + +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_infos) { + if (std::find(kSocVersions.begin(), kSocVersions.end(), soc_ver)== kSocVersions.end()) { + SetAllOptInfo(opt_infos); + return SUCCESS; + } + opt_infos.emplace("opt_module.fe", "all"); + opt_infos.emplace("opt_module.pass", "all"); + opt_infos.emplace("opt_module.op_tune", "all"); + return SUCCESS; +} +} // namespace gelc diff --git a/tests/framework/cmake/graphengine.cmake b/tests/framework/cmake/graphengine.cmake index 81aa00cc..c4380016 100644 --- a/tests/framework/cmake/graphengine.cmake +++ b/tests/framework/cmake/graphengine.cmake @@ -103,6 +103,7 @@ list(APPEND INCLUDE_DIRECTORIES "${GE_CODE_DIR}/third_party/fwkacllib/inc/cce" "${GE_CODE_DIR}/third_party/fwkacllib/inc/ops" "${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain" + "${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info" "${GE_CODE_DIR}/tests/ut/ge" "${GE_CODE_DIR}/tests/ut/common" "${CMAKE_BINARY_DIR}" @@ -117,6 +118,7 @@ list(APPEND STUB_LIBS runtime_stub profiler_stub hccl_stub + opt_feature_stub error_manager_stub ascend_protobuf json diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc new file mode 100644 index 00000000..457473b1 --- /dev/null +++ b/tests/st/testcase/test_ge_opt_info.cc @@ -0,0 +1,123 @@ +/** + * 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 "easy_graph/graph/box.h" +#include "easy_graph/graph/node.h" +#include "easy_graph/builder/graph_dsl.h" +#include "easy_graph/builder/box_builder.h" +#include "easy_graph/layout/graph_layout.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" +#include "graph/graph.h" +#include "graph/compute_graph.h" +#include "framework/common/types.h" +#include "graph/debug/ge_attr_define.h" +#include "ge_graph_dsl/graph_dsl.h" +#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" +#define protected public +#define private public +#include "ge_opt_info/ge_opt_info.h" +#undef private +#undef protected + +namespace ge { +class STEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(STEST_opt_info, get_opt_info_all) { + std::map options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(STEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + + /// data1 data2 + /// \ / + /// add + // build graph + DEF_GRAPH(g1) { + CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CHAIN(NODE("data2", DATA)->NODE("add")); + }); + + auto graph = ToGeGraph(g1); + + // new session & add graph + Session session(options); + auto ret = session.AddGraph(1, graph, options); + EXPECT_EQ(ret, SUCCESS); + // build input tensor + std::vector inputs; + // build_graph through session + ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} +} // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 06b3e0f2..cf573343 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -62,6 +62,7 @@ include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain) +include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info) include_directories(${GE_CODE_DIR}/tests/ut/ge) include_directories(${GE_CODE_DIR}/tests/ut/common) include_directories(${CMAKE_BINARY_DIR}) @@ -346,6 +347,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/session/omg.cc" + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" ) set(COMMON_FORMAT_SRC_FILES @@ -453,6 +455,7 @@ set(GRAPH_EXECUTE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_context.h" ) @@ -628,6 +631,10 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model.cc" ) +set(GE_OPT_INFO_SRC_FILES + "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" +) + # test files set(COMMON_TEST_FILES "graph/passes/graph_builder_utils.cc" @@ -813,6 +820,10 @@ set(MULTI_PARTS_TEST_FILES "common/host_cpu_engine_unittest.cc" ) +set(GE_OPT_INFO_TEST_FILES + "ge_opt_info/ge_opt_info_unittest.cc" +) + set(GENERATOR_TEST_FILES "generator/ge_generator_unittest.cc" ) @@ -864,6 +875,7 @@ list(APPEND COMMON_SHARED_LIBRARIES mmpa_stub hccl_stub error_manager_stub + opt_feature_stub ascend_protobuf json ) @@ -1109,10 +1121,12 @@ target_link_libraries(ut_libge_multiparts_utest # libge_others_utest add_executable(ut_libge_others_utest + ${GE_OPT_INFO_SRC_FILES} ${COMMON_TEST_FILES} ${PASS_TEST_FILES} ${EXECUTE_TEST_FILES} ${OTHERS_TEST_FILES} + ${GE_OPT_INFO_TEST_FILES} ) target_compile_options(ut_libge_others_utest PRIVATE diff --git a/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc new file mode 100644 index 00000000..20c123e9 --- /dev/null +++ b/tests/ut/ge/ge_opt_info/ge_opt_info_unittest.cc @@ -0,0 +1,82 @@ +/** + * 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 + +#define protected public +#define private public +#include "ge_opt_info/ge_opt_info.h" +#include "graph/ge_local_context.h" +#include "external/ge/ge_api_types.h" +#undef private +#undef protected + +namespace ge { +class UTEST_opt_info : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UTEST_opt_info, get_opt_info_success) { + std::map options = {{ge::SOC_VERSION, "Ascend910"}}; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_all) { + std::map global_options = {{ge::SOC_VERSION, "Ascend310"}}; + GetThreadLocalContext().SetGlobalOption(global_options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::SUCCESS); + std::map graph_options = GetThreadLocalContext().GetAllGraphOptions(); + auto itr = graph_options.find("opt_module.fe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.pass"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.op_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.rl_tune"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); + itr = graph_options.find("opt_module.aoe"); + EXPECT_NE(itr, graph_options.end()); + EXPECT_EQ(itr->second, "all"); +} + +TEST_F(UTEST_opt_info, get_opt_info_failed) { + std::map options; + GetThreadLocalContext().SetGlobalOption(options); + auto ret = GeOptInfo::SetOptInfo(); + EXPECT_EQ(ret, ge::FAILED); +} + +} // namespace ge diff --git a/third_party/fwkacllib/inc/opt_info/opt_info.h b/third_party/fwkacllib/inc/opt_info/opt_info.h new file mode 100644 index 00000000..4dff695b --- /dev/null +++ b/third_party/fwkacllib/inc/opt_info/opt_info.h @@ -0,0 +1,32 @@ +/** + * 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 + +namespace gelc { +using Status = uint32_t; +using WorkMode = uint32_t; +const Status SUCCESS = 0x0; +const Status FAILED = 0xFFFFFFFF; +const WorkMode kOffline = 0x0; +const WorkMode kInline = 0x01; + +__attribute__((visibility ("default"))) +Status GetOptInfo(WorkMode mode, const std::string &soc_ver, + std::map &opt_info_map); +} // namespace gelc + From ae348cf55a6cb7c5729dd6b4b5fb700723e8362b Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 29 Jun 2021 15:42:36 +0800 Subject: [PATCH 108/226] Fix ut. --- ge/single_op/task/op_task.cc | 120 ++++++++++++----------- ge/single_op/task/op_task.h | 6 +- ge/single_op/task/tbe_task_builder.cc | 1 + tests/ut/ge/single_op/single_op_task_unittest.cc | 23 +++-- tests/ut/ge/single_op/single_op_unittest.cc | 2 +- 5 files changed, 84 insertions(+), 68 deletions(-) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 92d1e325..632cd4d8 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -345,14 +345,46 @@ Status TbeOpTask::AllocateWorkspaces(const vector &workspace_sizes) { return SUCCESS; } -Status TbeOpTask::UpdateIoAddr(std::vector &args, const std::vector &inputs, - const std::vector &outputs) { - uintptr_t *arg_base = nullptr; - size_t arg_num = 0; - GetIoAddr(arg_base, arg_num); +Status TbeOpTask::UpdateTilingArgs(rtStream_t stream) { + size_t args_size = op_desc_->GetInputsSize() + op_desc_->GetOutputsSize() + workspaces_.size(); + if (tiling_buffer_ != nullptr) { + args_size++; + } + size_t temp_size = args_size * sizeof(void *); + if (arg_size_ < temp_size) { + GELOGD("Need to reset size of args_ from %zu to %zu.", arg_size_, temp_size); + std::unique_ptr args(new (std::nothrow) uint8_t[temp_size]()); + GE_CHECK_NOTNULL(args); + if (memcpy_s(args.get(), temp_size, args_.get(), arg_size_) != EOK) { + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Update][KernelArgs] failed for [%s].", node_->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "update kernel args failed for %s.", node_->GetName().c_str()); + return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; + } + args_.reset(args.release()); + arg_size_ = temp_size; + } + + uintptr_t *arg_base = reinterpret_cast(args_.get()); + size_t arg_index = op_desc_->GetInputsSize() + op_desc_->GetOutputsSize(); + for (size_t i = 0; i < workspaces_.size(); ++i) { + arg_base[arg_index++] = reinterpret_cast(workspaces_[i]); + } + + if (tiling_buffer_ != nullptr) { + GELOGD("[%s] Start to copy tiling info. size = %zu", node_->GetName().c_str(), tiling_data_.size()); + GE_CHK_RT_RET(rtMemcpyAsync(tiling_buffer_, max_tiling_size_, tiling_data_.data(), tiling_data_.size(), + RT_MEMCPY_HOST_TO_DEVICE_EX, stream)); + arg_base[arg_index] = reinterpret_cast(tiling_buffer_); + } + + return SUCCESS; +} + +Status TbeOpTask::SetArgIndex() { + arg_index_.clear(); const vector v_is_input_const = op_desc_->GetIsInputConst(); - size_t non_const_index = 0; + size_t input_index = 0; for (size_t i = 0; i < op_desc_->GetAllInputsSize(); ++i) { const GeTensorDescPtr tensor_desc = op_desc_->MutableInputDesc(static_cast(i)); if (tensor_desc == nullptr) { @@ -360,33 +392,33 @@ Status TbeOpTask::UpdateIoAddr(std::vector &args, const std::vector= arg_num) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Args size is %zu, but get index is %zu.", arg_num, i); - REPORT_INNER_ERROR("E19999", "[Check][Size] Args size is %zu, but get index is %zu.", arg_num, i); - return ACL_ERROR_GE_PARAM_INVALID; - } - auto addr = reinterpret_cast(arg_base[i]); - GELOGD("SingleOp: %s, Index: %zu, input is const, addr = %p", op_desc_->GetName().c_str(), i, addr); - args.emplace_back(addr); + GELOGD("SingleOp: %s, Index: %zu, input is const", op_desc_->GetName().c_str(), i); + input_index++; continue; } - if (non_const_index >= inputs.size()) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Input size is %zu, but get non_const_index is %zu", - inputs.size(), non_const_index); - REPORT_INNER_ERROR("E19999", "[Check][Size] Input size is %zu, but get non_const_index is %zu", - inputs.size(), non_const_index); - return ACL_ERROR_GE_PARAM_INVALID; - } - auto addr = inputs[non_const_index].data; - GELOGD("SingleOp: %s, input[%zu], addr = %p", op_desc_->GetName().c_str(), i, addr); - args.emplace_back(addr); - non_const_index++; + arg_index_.emplace_back(input_index); + input_index++; } + return SUCCESS; +} - for (size_t i = 0; i < outputs.size(); ++i) { - auto addr = outputs[i].data; - GELOGD("SingleOp: %s, output[%zu] addr = %p", op_desc_->GetName().c_str(), i, addr); - args.emplace_back(addr); +Status TbeOpTask::UpdateIoAddr(const vector &inputs, const vector &outputs) { + if (arg_index_.size() != inputs.size()) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Args size is %zu, but get input size is %zu.", + arg_index_.size(), inputs.size()); + REPORT_INNER_ERROR("E19999", "[Check][Size] Args size is %zu, but get input size is %zu.", + arg_index_.size(), inputs.size()); + return ACL_ERROR_GE_PARAM_INVALID; + } + + uintptr_t *arg_base = reinterpret_cast(args_.get()); + for (size_t i = 0; i < arg_index_.size(); ++i) { + arg_base[arg_index_[i]] = reinterpret_cast(inputs[i].data); + } + + size_t input_size = op_desc_->GetInputsSize(); + for (size_t i = 0; i < op_desc_->GetOutputsSize(); ++i) { + arg_base[input_size + i] = reinterpret_cast(outputs[i].data); } return SUCCESS; @@ -398,37 +430,11 @@ Status TbeOpTask::LaunchKernel(const vector &input_desc, vector &output_buffers, rtStream_t stream) { GELOGD("[%s] Start to launch kernel", node_->GetName().c_str()); + GE_CHK_STATUS_RET(UpdateIoAddr(input_buffers, output_buffers), "[Update][IoAddr] failed."); GE_CHK_STATUS_RET_NOLOG(UpdateNodeByShape(input_desc, output_desc)); GE_CHK_STATUS_RET_NOLOG(UpdateRunInfo()); GE_CHK_STATUS_RET(AllocateWorkspaces(run_info_workspaces_), "[Allocate][Workspaces] failed."); - std::vector args; - GE_CHK_STATUS_RET(UpdateIoAddr(args, input_buffers, output_buffers), "[Update][IoAddr] failed."); - for (auto &buffer : workspaces_) { - args.emplace_back(buffer); - } - - if (tiling_buffer_ != nullptr) { - GELOGD("[%s] Start to copy tiling info. size = %zu", node_->GetName().c_str(), tiling_data_.size()); - GE_CHK_RT_RET(rtMemcpyAsync(tiling_buffer_, max_tiling_size_, tiling_data_.data(), tiling_data_.size(), - RT_MEMCPY_HOST_TO_DEVICE_EX, stream)); - - args.emplace_back(tiling_buffer_); - } - - GELOGD("Dst size is %zu, src size is %zu.", arg_size_, args.size() * sizeof(void *)); - // node with workspace: build can not get size of workspace, need to update arg_size_ when execute - if (arg_size_ < (args.size() * sizeof(void *))) { - size_t temp_size = args.size() * sizeof(void *); - GELOGD("Need to reset size of args_ from %zu to %zu.", arg_size_, temp_size); - args_.reset(new(std::nothrow) uint8_t[temp_size]()); - GE_CHECK_NOTNULL(args_); - arg_size_ = temp_size; - } - if (memcpy_s(args_.get(), arg_size_, args.data(), args.size() * sizeof(void *)) != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Update][KernelArgs] failed for [%s].", node_->GetName().c_str()); - REPORT_INNER_ERROR("E19999", "update kernel args failed for %s.", node_->GetName().c_str()); - return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; - } + GE_CHK_STATUS_RET(UpdateTilingArgs(stream), "[Update][TilingArgs] failed."); GELOGD("[%s] Start to invoke rtKernelLaunch", node_->GetName().c_str()); GE_CHK_STATUS_RET(DoLaunchKernel(stream), "Failed to do launch kernel."); diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 0cbc1a29..d3e8383d 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -85,6 +85,7 @@ class TbeOpTask : public OpTask { const OpDescPtr &op_desc, const domi::KernelDefWithHandle& kernel_def_with_handle); Status UpdateRunInfo() override; + Status SetArgIndex(); const void *GetArgs() const; size_t GetArgSize() const; @@ -100,9 +101,9 @@ class TbeOpTask : public OpTask { Status UpdateNodeByShape(const vector &input_desc, const vector &output_desc); Status AllocateWorkspaces(const std::vector &workspace_sizes); + Status UpdateTilingArgs(rtStream_t stream); Status DoLaunchKernel(rtStream_t stream); - Status UpdateIoAddr(std::vector &args, const std::vector &inputs, - const std::vector &outputs); + Status UpdateIoAddr(const vector &inputs, const vector &outputs); const void *stub_func_ = nullptr; std::unique_ptr args_; @@ -122,6 +123,7 @@ class TbeOpTask : public OpTask { void* handle_ = nullptr; std::string original_kernel_key_; std::string node_info_; + std::vector arg_index_; }; class AiCpuBaseTask : public OpTask { diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index c7ff13d1..e5206ea6 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -387,6 +387,7 @@ Status TbeTaskBuilder::BuildTask(TbeOpTask &task, const SingleOpModelParam ¶ } task.SetStubFunc(stub_name_, stub_func); } + GE_CHK_STATUS_RET(task.SetArgIndex(), "[Set][ArgTable] failed."); return SUCCESS; } diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 472a88c3..020efc23 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -95,7 +95,7 @@ TEST_F(UtestSingleOpTask, test_build_kernel_task) { vector input_desc; vector input_buffers = { data_buffer }; vector output_desc; - vector output_buffers; + vector output_buffers = { data_buffer }; task->node_ = node; OpTilingFunc op_tiling_func = [](const TeOpParas &, const OpCompileInfo &, OpRunInfo &) -> bool {return true;}; OpTilingRegistryInterf("Add", op_tiling_func); @@ -107,8 +107,7 @@ TEST_F(UtestSingleOpTask, test_build_kernel_task) { task->max_tiling_size_ = 64; task->tiling_data_ = "tiling_data"; task->arg_size_ = 64; - uint8_t task_args{0}; - task->args_.reset(&task_args); + task->args_.reset(new (std::nothrow) uint8_t[sizeof(void *) * 3]); ASSERT_EQ(task->LaunchKernel(input_desc, input_buffers, output_desc, output_buffers, stream_), SUCCESS); char *handle = "00"; @@ -130,17 +129,25 @@ TEST_F(UtestSingleOpTask, test_update_ioaddr) { TbeOpTask task; task.op_desc_ = op_desc; - task.args_.reset(new (std::nothrow) uint8_t[sizeof(void *) * 3]); + task.node_ = node; + ASSERT_EQ(task.SetArgIndex(), SUCCESS); + task.arg_size_ = sizeof(void *) * 4; + task.args_.reset(new (std::nothrow) uint8_t[task.arg_size_]); + task.arg_index_ = {0}; vector args; vector inputs; vector outputs; - ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); - task.arg_size_ = sizeof(void *) * 3; - ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); + ASSERT_EQ(task.UpdateIoAddr(inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); ge::DataBuffer data_buffer; inputs = { data_buffer }; - ASSERT_EQ(task.UpdateIoAddr(args, inputs, outputs), SUCCESS); + outputs = { data_buffer }; + ASSERT_EQ(task.UpdateIoAddr(inputs, outputs), SUCCESS); + + task.tiling_buffer_ = (void *)0x0001; + task.workspaces_ = { (void *)0x0002 }; + ASSERT_EQ(task.UpdateTilingArgs(nullptr), SUCCESS); + task.tiling_buffer_ = nullptr; } diff --git a/tests/ut/ge/single_op/single_op_unittest.cc b/tests/ut/ge/single_op/single_op_unittest.cc index db3de7ec..09aac153 100644 --- a/tests/ut/ge/single_op/single_op_unittest.cc +++ b/tests/ut/ge/single_op/single_op_unittest.cc @@ -103,7 +103,7 @@ TEST_F(UtestSingleOp, test_dynamic_singleop_execute_async1) { EXPECT_EQ(desc_ptr->AddInputDesc("x", GeTensorDesc(GeShape({2}), FORMAT_NCHW)), GRAPH_SUCCESS); dynamic_single_op.op_task_->op_desc_ = desc_ptr; // UpdateRunInfo failed - EXPECT_EQ(dynamic_single_op.ExecuteAsync(input_desc, input_buffers, output_desc, output_buffers), PARAM_INVALID); + EXPECT_EQ(dynamic_single_op.ExecuteAsync(input_desc, input_buffers, output_desc, output_buffers), ACL_ERROR_GE_PARAM_INVALID); } From a781b6c3548ec748d869cbb8d51e11d515c322a1 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 29 Jun 2021 16:56:06 +0800 Subject: [PATCH 109/226] Fix bug of atomic profiling. --- ge/hybrid/node_executor/aicore/aicore_node_executor.cc | 2 +- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 10 ++++++++++ ge/hybrid/node_executor/aicore/aicore_op_task.h | 4 ++++ ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc | 2 +- ge/hybrid/node_executor/task_context.cc | 6 +++--- ge/hybrid/node_executor/task_context.h | 4 ++-- .../ut/ge/hybrid/executor/worker/execution_engine_unittest.cc | 2 +- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 11 ++++++++++- 8 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc index c2ce24a4..7a22a062 100755 --- a/ge/hybrid/node_executor/aicore/aicore_node_executor.cc +++ b/ge/hybrid/node_executor/aicore/aicore_node_executor.cc @@ -208,7 +208,7 @@ Status AiCoreNodeTask::ExecuteAsync(TaskContext &context, std::function context.SetTaskId(task_id); context.SetStreamId(stream_id); GELOGD("Aicore node[%s] task_id: %u, stream_id: %u.", context.GetNodeName(), task_id, stream_id); - (void)context.SaveProfilingTaskDescInfo(task_id, stream_id, kTaskTypeAicore, (*it)->GetBlockDim()); + (void)context.SaveProfilingTaskDescInfo(task_id, stream_id, kTaskTypeAicore, (*it)->GetBlockDim(), (*it)->GetOpType()); RECORD_EXECUTION_EVENT(context.GetExecutionContext(), context.GetNodeName(), "[AiCoreNodeLaunchKernel] End"); RECORD_EXECUTION_EVENT(context.GetExecutionContext(), context.GetNodeName(), "[AiCoreNodeLaunchKernel] End"); } diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index a32f2999..b34cc0c6 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -33,6 +33,7 @@ namespace { constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; constexpr char const *kAttrOpParamSize = "op_para_size"; constexpr char const *kAttrAtomicOpParamSize = "atomic_op_para_size"; +const string kAtomicOpType = "DynamicAtomicAddrClean"; std::atomic log_id(0); } // namespace @@ -51,6 +52,7 @@ bool TbeHandleRegistry::AddHandle(std::unique_ptr &&holder) { } Status AiCoreOpTask::Init(const OpDesc &op_desc, const domi::TaskDef &task_def) { + op_type_ = op_desc.GetType(); log_name_ = op_desc.GetName() + "_tvmbin"; log_id_ = log_id++; auto op_desc_ptr = MakeShared(op_desc); @@ -538,6 +540,10 @@ const std::string &AiCoreOpTask::GetName() const { return stub_name_; } +const std::string &AiCoreOpTask::GetOpType() const { + return op_type_; +} + std::string AiCoreOpTask::GetKeyForOpParamSize() const { return kAttrOpParamSize; } @@ -631,6 +637,10 @@ std::string AtomicAddrCleanOpTask::GetKeyForKernelName(const OpDesc &op_desc) co return op_desc.GetName() + "_atomic_kernelname"; } +const std::string &AtomicAddrCleanOpTask::GetOpType() const { + return kAtomicOpType; +} + Status AtomicAddrCleanOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) { GELOGD("[%s] Start to invoke OpAtomicCalculate.", node->GetName().c_str()); GE_CHK_STATUS_RET(optiling::OpAtomicCalculateV2(*node, tiling_info), diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.h b/ge/hybrid/node_executor/aicore/aicore_op_task.h index b03bd9e4..8d7be0db 100755 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.h +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.h @@ -78,6 +78,8 @@ class AiCoreOpTask { void SetSingleOp(bool is_single_op) {is_single_op_ = is_single_op;}; + virtual const std::string& GetOpType() const; + protected: Status UpdateTilingInfo(TaskContext &context); virtual std::string GetKeyForOpParamSize() const; @@ -117,12 +119,14 @@ class AiCoreOpTask { uint64_t log_id_ = 0; std::string log_name_; uint32_t offset_ = 0; + std::string op_type_; }; class AtomicAddrCleanOpTask : public AiCoreOpTask { public: Status Init(const OpDesc &op_desc, const domi::TaskDef &task_def) override; Status UpdateArgs(TaskContext &task_context) override; + const std::string& GetOpType() const override; protected: std::string GetKeyForOpParamSize() const override; diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc index c83a76d1..820c9b56 100755 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc @@ -207,7 +207,7 @@ Status AicpuNodeTaskBase::ExecuteAsync(TaskContext &context, std::functionSynchronize(GetStream()); } -Status TaskContext::SaveProfilingTaskDescInfo(uint32_t task_id, uint32_t stream_id, - const std::string &task_type, uint32_t block_dim) { +Status TaskContext::SaveProfilingTaskDescInfo(uint32_t task_id, uint32_t stream_id, const std::string &task_type, + uint32_t block_dim, const std::string &op_type) { if (ProfilingManager::Instance().ProfilingModelLoadOn()) { const NodeItem &node_item = GetNodeItem(); auto op_desc = node_item.GetOpDesc(); @@ -589,7 +589,7 @@ Status TaskContext::SaveProfilingTaskDescInfo(uint32_t task_id, uint32_t stream TaskDescInfo tmp_task_desc_info; tmp_task_desc_info.model_name = dynamic_model_name; tmp_task_desc_info.op_name = op_desc->GetName(); - tmp_task_desc_info.op_type = op_desc->GetType(); + tmp_task_desc_info.op_type = op_type; tmp_task_desc_info.block_dim = block_dim; tmp_task_desc_info.task_type = task_type; tmp_task_desc_info.task_id = task_id; diff --git a/ge/hybrid/node_executor/task_context.h b/ge/hybrid/node_executor/task_context.h index c96e194e..5304606b 100644 --- a/ge/hybrid/node_executor/task_context.h +++ b/ge/hybrid/node_executor/task_context.h @@ -118,8 +118,8 @@ class TaskContext { void *handle_ = nullptr; const std::vector& GetProfilingTaskDescInfo() const { return task_desc_info; } - Status SaveProfilingTaskDescInfo(uint32_t task_id, uint32_t stream_id, - const std::string &task_type, uint32_t block_dim); + Status SaveProfilingTaskDescInfo(uint32_t task_id, uint32_t stream_id, const std::string &task_type, + uint32_t block_dim, const std::string &op_type); void ClearProfilingTaskDescInfo() { task_desc_info.clear(); } private: diff --git a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc index cc20d614..07701f4d 100644 --- a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc +++ b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc @@ -119,7 +119,7 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { uint32_t stream_id = 1; std::string task_type = "rts"; uint32_t block_dim = 0; - node_state->GetTaskContext()->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim); + node_state->GetTaskContext()->SaveProfilingTaskDescInfo(task_id, stream_id, task_type, block_dim, op_desc->GetType()); ASSERT_TRUE(node_state->GetTaskContext() != nullptr); diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 4f14f628..688d3a34 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -100,7 +100,7 @@ TEST_F(UtestGeHybrid, aicore_op_task_init_success) { op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); std::string kernel_name("kernel/Add"); AttrUtils::SetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name); - ASSERT_EQ(aicore_task->InitWithTaskDef(*op_desc.get(), task_def), SUCCESS); + ASSERT_EQ(aicore_task->Init(*op_desc.get(), task_def), SUCCESS); rtStream_t stream = nullptr; rtStreamCreate(&stream, 0); ASSERT_EQ(aicore_task->LaunchKernel(stream), SUCCESS); @@ -676,6 +676,15 @@ TEST_F(UtestGeHybrid, test_key_for_kernel_bin) { EXPECT_EQ(atomic_task->GetKeyForKernelName(op_desc), "Sum_atomic_kernelname"); } +TEST_F(UtestGeHybrid, test_op_type) { + auto aicore_task = std::unique_ptr(new(std::nothrow)hybrid::AiCoreOpTask()); + aicore_task->op_type_ = "Add"; + EXPECT_EQ(aicore_task->GetOpType(), "Add"); + + auto atomic_task = std::unique_ptr(new(std::nothrow)hybrid::AtomicAddrCleanOpTask()); + EXPECT_EQ(atomic_task->GetOpType(), "DynamicAtomicAddrClean"); +} + TEST_F(UtestGeHybrid, TestParseDependentInputNodesForHccl) { NodeExecutorManager::GetInstance().engine_mapping_.emplace("ops_kernel_info_hccl", NodeExecutorManager::ExecutorType::HCCL); From 813f2fe4a2eb234153ce0ad5a5801c98bdb9be4f Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 29 Jun 2021 19:11:56 +0800 Subject: [PATCH 110/226] Fix ut. --- ge/single_op/task/op_task.cc | 10 ++++------ ge/single_op/task/op_task.h | 4 +++- ge/single_op/task/tbe_task_builder.cc | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 632cd4d8..28ec7f64 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -346,7 +346,7 @@ Status TbeOpTask::AllocateWorkspaces(const vector &workspace_sizes) { } Status TbeOpTask::UpdateTilingArgs(rtStream_t stream) { - size_t args_size = op_desc_->GetInputsSize() + op_desc_->GetOutputsSize() + workspaces_.size(); + size_t args_size = input_num_ + output_num_ + workspaces_.size(); if (tiling_buffer_ != nullptr) { args_size++; } @@ -361,12 +361,12 @@ Status TbeOpTask::UpdateTilingArgs(rtStream_t stream) { return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } - args_.reset(args.release()); + args_ = std::move(args); arg_size_ = temp_size; } uintptr_t *arg_base = reinterpret_cast(args_.get()); - size_t arg_index = op_desc_->GetInputsSize() + op_desc_->GetOutputsSize(); + size_t arg_index = input_num_ + output_num_; for (size_t i = 0; i < workspaces_.size(); ++i) { arg_base[arg_index++] = reinterpret_cast(workspaces_[i]); } @@ -382,7 +382,6 @@ Status TbeOpTask::UpdateTilingArgs(rtStream_t stream) { } Status TbeOpTask::SetArgIndex() { - arg_index_.clear(); const vector v_is_input_const = op_desc_->GetIsInputConst(); size_t input_index = 0; for (size_t i = 0; i < op_desc_->GetAllInputsSize(); ++i) { @@ -416,9 +415,8 @@ Status TbeOpTask::UpdateIoAddr(const vector &inputs, const vector(inputs[i].data); } - size_t input_size = op_desc_->GetInputsSize(); for (size_t i = 0; i < op_desc_->GetOutputsSize(); ++i) { - arg_base[input_size + i] = reinterpret_cast(outputs[i].data); + arg_base[input_num_ + i] = reinterpret_cast(outputs[i].data); } return SUCCESS; diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index d3e8383d..f93e031a 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -123,7 +123,9 @@ class TbeOpTask : public OpTask { void* handle_ = nullptr; std::string original_kernel_key_; std::string node_info_; - std::vector arg_index_; + std::vector arg_index_; // data index in args + size_t input_num_; // Include const input + size_t output_num_; }; class AiCpuBaseTask : public OpTask { diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index e5206ea6..db8ecfe2 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -388,6 +388,8 @@ Status TbeTaskBuilder::BuildTask(TbeOpTask &task, const SingleOpModelParam ¶ task.SetStubFunc(stub_name_, stub_func); } GE_CHK_STATUS_RET(task.SetArgIndex(), "[Set][ArgTable] failed."); + task.input_num_ = op_desc_->GetInputsSize(); + task.output_num_ = op_desc_->GetOutputsSize(); return SUCCESS; } From 59c97eef3eef0903c54052fe4b6428e5597db58c Mon Sep 17 00:00:00 2001 From: wq160 Date: Tue, 29 Jun 2021 10:58:45 +0800 Subject: [PATCH 111/226] set scalar tensor value range --- ge/graph/passes/infer_value_range_pass.cc | 3 ++ ge/graph/passes/replace_with_empty_const_pass.cc | 14 ++++--- ge/graph/passes/replace_with_empty_const_pass.h | 2 +- .../passes/infer_value_range_pass_unittest.cc | 48 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/ge/graph/passes/infer_value_range_pass.cc b/ge/graph/passes/infer_value_range_pass.cc index b9cb88bc..e714e90a 100644 --- a/ge/graph/passes/infer_value_range_pass.cc +++ b/ge/graph/passes/infer_value_range_pass.cc @@ -286,6 +286,9 @@ graphStatus InferValueRangePass::GenerateWorstValueRange(NodePtr &node) { } std::vector> output_i_value_range(output_i_shape_size, {1, -1}); + if (output_i_shape.IsScalar()) { + output_i_value_range.emplace_back(1, -1); + } output_desc->SetValueRange(output_i_value_range); GELOGD("Node %s output %zu shape is %s, the generated worst value range is %s.", node->GetName().c_str(), i, formats::ShapeToString(output_i_shape).c_str(), formats::RangeToString(output_i_value_range).c_str()); diff --git a/ge/graph/passes/replace_with_empty_const_pass.cc b/ge/graph/passes/replace_with_empty_const_pass.cc index 3176d1ee..6cb31627 100644 --- a/ge/graph/passes/replace_with_empty_const_pass.cc +++ b/ge/graph/passes/replace_with_empty_const_pass.cc @@ -71,7 +71,7 @@ Status ReplaceWithEmptyConstPass::Run(NodePtr &node) { GELOGI("Node %s Got empty output_desc_ptr, ignore current pass.", node->GetName().c_str()); return SUCCESS; } - if (!IsEmptyTenor(output_desc_ptr->GetShape())) { + if (!IsKnownEmptyTenor(output_desc_ptr->GetShape())) { is_all_output_empty = false; break; } @@ -107,12 +107,16 @@ Status ReplaceWithEmptyConstPass::GetOutputsOfCurrNode(const NodePtr &node_to_re return SUCCESS; } -bool ReplaceWithEmptyConstPass::IsEmptyTenor(const GeShape &shape) const { +bool ReplaceWithEmptyConstPass::IsKnownEmptyTenor(const GeShape &shape) const { + bool is_known_empty_tensor = false; for (auto dim : shape.GetDims()) { - if (dim == 0) { - return true; + if (dim < 0) { + // current dim is unknown dim, skip replace + return false; + } else if (dim == 0) { + is_known_empty_tensor = true; } } - return false; + return is_known_empty_tensor; } } // namespace ge diff --git a/ge/graph/passes/replace_with_empty_const_pass.h b/ge/graph/passes/replace_with_empty_const_pass.h index fde75358..90103432 100644 --- a/ge/graph/passes/replace_with_empty_const_pass.h +++ b/ge/graph/passes/replace_with_empty_const_pass.h @@ -26,7 +26,7 @@ class ReplaceWithEmptyConstPass : public FoldingPass { private: Status GetOutputsOfCurrNode(const NodePtr &node_to_replace, vector &outputs); - bool IsEmptyTenor(const GeShape &shape) const; + bool IsKnownEmptyTenor(const GeShape &shape) const; }; } // namespace ge #endif // GE_GRAPH_PASSES_REPLACE_WITH_EMPTY_CONST_PASS_H_ diff --git a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc index fea1b27d..576d679c 100644 --- a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc @@ -362,6 +362,54 @@ TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHave EXPECT_EQ(unknown_target_value_range, output_value_range); } +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHaveUnKnownValueRange_ScalarOutput) { + // shape --- add --- sqrt + // constant / + auto graph = std::make_shared("test_graph"); + vector data_vec = {1}; + GeTensorDesc const_tensor_desc(ge::GeShape(), ge::FORMAT_NCHW, ge::DT_INT64); + GeTensorPtr const_tensor = + std::make_shared(const_tensor_desc, (uint8_t *)data_vec.data(), data_vec.size() * sizeof(int64_t)); + + auto const_op_desc = std::make_shared("Constant", "Constant"); + const_op_desc->AddOutputDesc(const_tensor_desc); + EXPECT_EQ(OpDescUtils::SetWeights(const_op_desc, const_tensor), GRAPH_SUCCESS); + auto const_node = graph->AddNode(const_op_desc); + + GeTensorDesc shape_tensor_desc(GeShape(), ge::FORMAT_NCHW, ge::DT_INT64); + std::vector> unknown_value_range = {make_pair(1, -1)}; + shape_tensor_desc.SetValueRange(unknown_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_tensor_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_tensor_desc(GeShape(), ge::FORMAT_NCHW, ge::DT_INT64); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddInputDesc(const_tensor_desc); + add_op_desc->AddOutputDesc(add_tensor_desc); + auto add_node = graph->AddNode(add_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(const_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + + // test unknown value range + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 1); + + std::vector unknown_target_value_range = {1, -1}; + std::vector output_value_range; + for (auto pair : out_value_range) { + output_value_range.push_back(pair.first); + output_value_range.push_back(pair.second); + } + EXPECT_EQ(unknown_target_value_range, output_value_range); +} + TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsAreKnownValueRange_Int64) { // shape --- add --- sqrt // constant / From 4f3f54d56407d045fa37bf02508cc101a46e1bef Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 29 Jun 2021 19:19:08 +0800 Subject: [PATCH 112/226] Fix ut. --- ge/single_op/task/op_task.h | 2 +- tests/ut/ge/single_op/single_op_task_unittest.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index f93e031a..97d8a342 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -124,7 +124,7 @@ class TbeOpTask : public OpTask { std::string original_kernel_key_; std::string node_info_; std::vector arg_index_; // data index in args - size_t input_num_; // Include const input + size_t input_num_; // include const input size_t output_num_; }; diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 020efc23..b0c98205 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -134,6 +134,8 @@ TEST_F(UtestSingleOpTask, test_update_ioaddr) { task.arg_size_ = sizeof(void *) * 4; task.args_.reset(new (std::nothrow) uint8_t[task.arg_size_]); task.arg_index_ = {0}; + task.input_num_ = 2; + task.output_num_ = 1; vector args; vector inputs; From 9f6aff6759714c0093045b563f9b6f5bba8d46a6 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Fri, 18 Jun 2021 09:32:57 +0800 Subject: [PATCH 113/226] check dump option --- ge/common/dump/dump_properties.cc | 243 ++++++++++++++++++++++--- ge/common/dump/dump_properties.h | 18 +- ge/session/inner_session.cc | 2 +- tests/ut/ge/CMakeLists.txt | 1 + tests/ut/ge/common/dump_properties_unittest.cc | 126 +++++++++++++ 5 files changed, 364 insertions(+), 26 deletions(-) create mode 100644 tests/ut/ge/common/dump_properties_unittest.cc diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index ef755540..010347c0 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -18,6 +18,7 @@ #include #include +#include #include "common/ge/ge_util.h" #include "framework/common/util.h" @@ -37,6 +38,159 @@ const uint32_t kAtomicOverflow = (0x1 << 1); const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); } // namespace namespace ge { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::Split(const std::string &s, + std::vector &result, + const char *delchar) { + if (s.empty()) { + return; + } + result.clear(); + + char *buffer = new (std::nothrow)char[s.size() + 1]; + if (buffer == nullptr) { + GELOGE(FAILED, "[Split][string] failed while malloc memory, string value is:%s", s.c_str()); + REPORT_CALL_ERROR("E19999", "Memory malloc may fail when split string, get fatal exception, " + "string value is:%s", s.c_str()); + return; + } + buffer[s.size()] = '\0'; + errno_t e = strcpy_s(buffer, s.size() + 1, s.c_str()); + if (e != EOK) { + delete[] buffer; + return; + } + char *context = nullptr; + char *p = strtok_s(buffer, delchar, &context); + while (p != nullptr) { + result.emplace_back(p); + p = strtok_s(nullptr, delchar, &context); + } + delete[] buffer; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpStep(const std::string &dump_step) { + std::string modified_dum_step = dump_step + "|"; + std::smatch result; + std::vector match_vecs; + std::regex pattern(R"((\d{1,}-\d{1,}\||\d{1,}\|)+)"); + if (regex_match(modified_dum_step, result, pattern)) { + Split(result.str(), match_vecs, "|"); + if (match_vecs.empty()) { + REPORT_CALL_ERROR("E19999", "Split may get fatal exception, dump_step:%s.", dump_step.c_str()); + GELOGE(FAILED, "[Check][Param] failed. Split may get fatal exception, ge.exec.dumpStep:%s.", dump_step.c_str()); + return FAILED; + } + // 100 is the max sets of dump steps. + if (match_vecs.size() > 100) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported, only support dump <= 100 sets of data"})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "dump_step only support dump <= 100 sets of data.", dump_step.c_str()); + return PARAM_INVALID; + } + for (const auto &match_vec : match_vecs) { + std::vector vec_after_split; + Split(match_vec, vec_after_split, "-"); + if (match_vecs.empty()) { + REPORT_CALL_ERROR("E19999", "Split may get fatal exception."); + GELOGE(FAILED, "[Check][Param] failed, split may get fatal exception."); + return FAILED; + } + if (vec_after_split.size() > 1) { + if (std::atoi(vec_after_split[0].c_str()) >= std::atoi(vec_after_split[1].c_str())) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported." + "in range steps, the first step is >= second step, correct example:'0|5|10-20"})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "in range steps, the first step is >= second step, correct example:'0|5|10-20'", dump_step.c_str()); + return PARAM_INVALID; + } + } + } + } else { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported, correct example:'0|5|10|50-100."})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "dump_step string style is error, correct example:'0|5|10|50-100.'", dump_step.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpMode(const std::string &dump_mode) { + const std::set dump_mode_list = {"input", "output", "all"}; + std::set::iterator iter; + + if ((iter = dump_mode_list.find(dump_mode)) == dump_mode_list.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpMode", + dump_mode.c_str(), + " is not supported, should be one of the following:[input, output, all]"})); + GELOGE(PARAM_INVALID, "[Check][Param] the dump_debug_mode:%s, is is not supported," + "should be one of the following:[input, output, all].", dump_mode.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpPath(const std::string &input) { + if (mmIsDir(input.c_str()) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " is not a directory."})); + GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, is not directory.", input.c_str()); + return PARAM_INVALID; + } + char trusted_path[MMPA_MAX_PATH] = { "\0" }; + if (mmRealPath(input.c_str(), trusted_path, MMPA_MAX_PATH) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " dumpPath invalid."})); + GELOGE(PARAM_INVALID, "[Check][Param] the dumpPath:%s, is invalid.", input.c_str()); + return PARAM_INVALID; + } + if (mmAccess2(trusted_path, R_OK | W_OK) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " does't have read, write permissions."})); + GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, does't have read, write permissions.", input.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckEnableDump(const std::string &input) { + std::set enable_dump_option_list = {"1", "0"}; + auto it = enable_dump_option_list.find(input); + if (it == enable_dump_option_list.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.enableDump", + input.c_str(), + " only support 1 or 0."})); + GELOGE(PARAM_INVALID, "[Check][Param] Not support ge.exec.enableDump or ge.exec.enableDumpDebug format:%s, " + "only support 1 or 0.", input.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties::DumpProperties(const DumpProperties &other) { CopyFrom(other); } @@ -47,7 +201,26 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: return *this; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOptions() { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { + if (enable_dump_ == kEnableFlag) { + std::string dump_step; + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); + GELOGI("Get dump step %s successfully", dump_step.c_str()); + SetDumpStep(dump_step); + } + string dump_mode = "output"; + if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { + GELOGI("Get dump mode %s successfully", dump_mode.c_str()); + GE_CHK_STATUS_RET(CheckDumpMode(dump_mode), "[Check][dump_mode] failed."); + SetDumpMode(dump_mode); + } + AddPropertyValue(DUMP_ALL_MODEL, {}); + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOptions() { enable_dump_.clear(); enable_dump_debug_.clear(); dump_path_.clear(); @@ -57,17 +230,32 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOpti is_infer_op_debug_ = false; op_debug_mode_ = 0; - std::string enable_dump; + std::string enable_dump = std::to_string(false); (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP, enable_dump); enable_dump_ = enable_dump; + if (!enable_dump_.empty()) { + GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_), "[Check][enable_dump] failed."); + } - std::string enable_dump_debug; + std::string enable_dump_debug = std::to_string(false); (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP_DEBUG, enable_dump_debug); enable_dump_debug_ = enable_dump_debug; - + if (!enable_dump_debug_.empty()) { + GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_debug_), "[Check][enable_dump_debug] failed."); + } + if ((enable_dump_ == kEnableFlag) && (enable_dump_debug_ == kEnableFlag)) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.enableDump and ge.exec.enableDumpDebug", + enable_dump_ + ", " + enable_dump_debug, + "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be set to 1 at the same time."})); + GELOGE(FAILED, "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be both set to 1 at the same time."); + return FAILED; + } if ((enable_dump_ == kEnableFlag) || (enable_dump_debug_ == kEnableFlag)) { std::string dump_path; if (GetContext().GetOption(OPTION_EXEC_DUMP_PATH, dump_path) == GRAPH_SUCCESS) { + GE_CHK_STATUS_RET(CheckDumpPath(dump_path), "Check dump path failed."); if (!dump_path.empty() && dump_path[dump_path.size() - 1] != '/') { dump_path = dump_path + "/"; } @@ -75,25 +263,21 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOpti GELOGI("Get dump path %s successfully", dump_path.c_str()); SetDumpPath(dump_path); } else { - GELOGW("Dump path is not set"); + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + dump_path, + "ge.exec.dumpPath is not set."})); + GELOGE(FAILED, "[Check][dump_path] failed. Dump path is not set."); + return FAILED; } } - if (enable_dump_ == kEnableFlag) { - std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { - GELOGI("Get dump step %s successfully", dump_step.c_str()); - SetDumpStep(dump_step); - } - string dump_mode; - if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { - GELOGI("Get dump mode %s successfully", dump_mode.c_str()); - SetDumpMode(dump_mode); - } - AddPropertyValue(DUMP_ALL_MODEL, {}); - } + GE_CHK_STATUS_RET(SetDumpOptions(), "SetDumpOptions failed."); + + GE_CHK_STATUS_RET(SetDumpDebugOptions(), "SetDumpDebugOptions failed."); - SetDumpDebugOptions(); + return SUCCESS; } // The following is the new dump scenario of the fusion operator @@ -253,14 +437,20 @@ void DumpProperties::CopyFrom(const DumpProperties &other) { } } -void DumpProperties::SetDumpDebugOptions() { +Status DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { GELOGD("Get dump debug mode %s successfully", dump_debug_mode.c_str()); } else { - GELOGW("Dump debug mode is not set."); - return; + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpDebugMode", + dump_debug_mode, + "ge.exec.dumpDebugMode is not set."})); + GELOGE(PARAM_INVALID, "[Check][dump_debug_mode] failed. Dump debug mode is not set."); + + return PARAM_INVALID; } if (dump_debug_mode == OP_DEBUG_AICORE) { @@ -276,10 +466,17 @@ void DumpProperties::SetDumpDebugOptions() { is_train_op_debug_ = true; op_debug_mode_ = kAllOverflow; } else { - GELOGW("ge.exec.dumpDebugMode is invalid."); + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpDebugMode", + dump_debug_mode, + "ge.exec.dumpDebugMode is invalid."})); + GELOGE(PARAM_INVALID, "[Set][DumpDebugOptions] failed, ge.exec.dumpDebugMode is invalid."); + return PARAM_INVALID; } } else { GELOGI("ge.exec.enableDumpDebug is false or is not set."); } + return SUCCESS; } } // namespace ge diff --git a/ge/common/dump/dump_properties.h b/ge/common/dump/dump_properties.h index 98487491..cbfc362d 100644 --- a/ge/common/dump/dump_properties.h +++ b/ge/common/dump/dump_properties.h @@ -23,6 +23,7 @@ #include namespace ge { +using Status = uint32_t; class DumpProperties { public: DumpProperties() = default; @@ -33,7 +34,7 @@ class DumpProperties { DumpProperties &operator=(const DumpProperties &dump); - void InitByOptions(); + Status InitByOptions(); void AddPropertyValue(const std::string &model, const std::set &layers); @@ -95,7 +96,20 @@ class DumpProperties { private: void CopyFrom(const DumpProperties &other); - void SetDumpDebugOptions(); + Status SetDumpDebugOptions(); + + Status SetDumpOptions(); + + void Split(const std::string &s, std::vector &result, const char *delchar); + + Status CheckDumpStep(const std::string &dump_step); + + Status CheckDumpMode(const std::string &dump_mode); + + Status CheckDumpPath(const std::string &input); + + Status CheckEnableDump(const std::string &input); + std::string enable_dump_; std::string enable_dump_debug_; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index aabbe19c..b3df08ce 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -109,7 +109,7 @@ Status InnerSession::Initialize() { GE_CHK_RT_RET(rtSetDevice(GetContext().DeviceId())); DumpProperties dump_properties; - dump_properties.InitByOptions(); + GE_CHK_STATUS_RET(dump_properties.InitByOptions(), "Init dump properties failed."); GE_CHK_STATUS_RET(AddDumpProperties(dump_properties), "[Add][DumpProperties] failed."); ret = graph_manager_.Initialize(options_); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf573343..d7568ccc 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -774,6 +774,7 @@ set(MULTI_PARTS_TEST_FILES "common/util_unittest.cc" "common/dump_manager_unittest.cc" "common/dump_op_unittest.cc" + "common/dump_properties_unittest.cc" "common/dump_exception_unittest.cc" "common/opdebug_register_unittest.cc" "common/format_transfer_unittest.cc" diff --git a/tests/ut/ge/common/dump_properties_unittest.cc b/tests/ut/ge/common/dump_properties_unittest.cc new file mode 100644 index 00000000..57809013 --- /dev/null +++ b/tests/ut/ge/common/dump_properties_unittest.cc @@ -0,0 +1,126 @@ +/** + * 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 + +#define protected public +#define private public + +#include "common/dump/dump_properties.h" +#include "ge_local_context.h" +#include "ge/ge_api_types.h" +#include "common/debug/log.h" +#include "common/ge_inner_error_codes.h" + +namespace ge { +class UTEST_dump_properties : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UTEST_dump_properties, check_dump_step) { + DumpProperties dp; + std::string dump_step{"0|3-5|10"}; + std::string unsupport_input1{"0|5-3|10"}; + std::string unsupport_input2{"one"}; + std::string unsupport_input3; + for (int i = 0; i < 200; ++i) { + unsupport_input3 += std::to_string(i) + "|"; + } + unsupport_input3.pop_back(); + Status st = dp.CheckDumpStep(dump_step); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input1); + EXPECT_NE(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input2); + EXPECT_NE(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input3); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_dump_mode) { + DumpProperties dp; + std::string dump_mode_1{"input"}; + std::string dump_mode_2{"output"}; + std::string dump_mode_3{"all"}; + std::string unsupport_input1{"mode1"}; + Status st = dp.CheckDumpMode(dump_mode_1); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(dump_mode_2); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(dump_mode_3); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(unsupport_input1); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_dump_path) { + DumpProperties dp; + std::string dump_path{"/tmp/"}; + std::string unsupport_input1{" \\unsupported"}; + Status st = dp.CheckDumpPath(dump_path); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpPath(unsupport_input1); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_enable_dump) { + DumpProperties dp; + std::string enable_dump_t{"1"}; + std::string enable_dump_f{"0"}; + std::string unsupport_input1{"true"}; + std::string unsupport_input2{"false"}; + Status st = dp.CheckEnableDump(enable_dump_t); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckEnableDump(enable_dump_f); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckEnableDump(unsupport_input1); + EXPECT_NE(st, SUCCESS); + st = dp.CheckEnableDump(unsupport_input2); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_success_1) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}, + {OPTION_EXEC_DUMP_STEP, "0|1-3|10"}, + {OPTION_EXEC_DUMP_MODE, "all"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_EQ(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_success_2) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}, + {OPTION_EXEC_DUMP_DEBUG_MODE, "aicore_overflow"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_EQ(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_failed) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_NE(st, SUCCESS); +} +} // namespace ge \ No newline at end of file From e1c506026cc082fed10f63630bfb3c2275ce245b Mon Sep 17 00:00:00 2001 From: wangxiaotian22 Date: Tue, 29 Jun 2021 21:08:22 +0800 Subject: [PATCH 114/226] fix sc --- ge/graph/preprocess/multi_batch_copy_graph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/preprocess/multi_batch_copy_graph.cc b/ge/graph/preprocess/multi_batch_copy_graph.cc index 1634c8ce..fd3a4e91 100644 --- a/ge/graph/preprocess/multi_batch_copy_graph.cc +++ b/ge/graph/preprocess/multi_batch_copy_graph.cc @@ -1206,7 +1206,7 @@ Status MultiBatchGraphCopyer::CheckCopyResult(const std::vector &start_ auto dims = NodeUtils::GetOutputDesc(*node, kDataOutIndex).GetShape().GetDims(); if (!IsAllDimsPositive(dims)) { REPORT_CALL_ERROR("E19999", "Failed to copy multi batch graph, the node %s still has unknown shape %s", - node->GetName().c_str(), formats::ShapeToString(dims).c_str()); + node->GetName().c_str(), formats::ShapeToString(dims).c_str()); GELOGE(INTERNAL_ERROR, "[Check][Param] Failed to copy multi batch graph, the node %s still has unknown shape %s", node->GetName().c_str(), formats::ShapeToString(dims).c_str()); return INTERNAL_ERROR; From faaef130b4192da826a7965006b8952969bf8218 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 30 Jun 2021 10:20:59 +0800 Subject: [PATCH 115/226] Add ut. --- ge/single_op/single_op.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ge/single_op/single_op.h b/ge/single_op/single_op.h index 7e05dd5f..94d7227b 100755 --- a/ge/single_op/single_op.h +++ b/ge/single_op/single_op.h @@ -92,7 +92,6 @@ class DynamicSingleOp { rtStream_t stream_ = nullptr; size_t num_inputs_ = 0; size_t num_outputs_ = 0; - ComputeGraphPtr compute_graph_; }; } // namespace ge #endif // GE_SINGLE_OP_SINGLE_OP_H_ From e7296ed73c1b133df356245791dc533e2e4b8e6f Mon Sep 17 00:00:00 2001 From: wangxiaotian22 Date: Wed, 30 Jun 2021 15:19:38 +0800 Subject: [PATCH 116/226] fix sc + --- ge/ge_runtime/task/label_goto_task.cc | 2 +- ge/single_op/task/op_task.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ge/ge_runtime/task/label_goto_task.cc b/ge/ge_runtime/task/label_goto_task.cc index 4302bff3..7cb6d556 100644 --- a/ge/ge_runtime/task/label_goto_task.cc +++ b/ge/ge_runtime/task/label_goto_task.cc @@ -72,7 +72,7 @@ bool LabelGotoTask::Distribute() { return false; } - rt_ret = rtLabelListCpy((void**)label_list.data(), label_list.size(), label_info_, label_info_size); + rt_ret = rtLabelListCpy(reinterpret_cast(label_list.data()), label_list.size(), label_info_, label_info_size); if (rt_ret != RT_ERROR_NONE) { GELOGE(RT_FAILED, "Call rt api failed, ret: %#x", rt_ret); return false; diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 19320bc0..75b0707b 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -33,6 +33,10 @@ #include "register/op_tiling.h" namespace ge { +namespace { +const int kAddressNum = 2; +} // namespace + class StreamResource; struct SingleOpModelParam; class OpTask { @@ -256,7 +260,7 @@ class MemcpyAsyncTask : public OpTask { friend class SingleOpModel; friend class RtsKernelTaskBuilder; - uintptr_t addresses_[2]; + uintptr_t addresses_[kAddressNum]; size_t dst_max_; size_t count_; rtMemcpyKind_t kind_; From 2c7342bb3ae956e6f4884cc0e99068d215c178b0 Mon Sep 17 00:00:00 2001 From: wq160 Date: Tue, 29 Jun 2021 21:10:52 +0800 Subject: [PATCH 117/226] add scalar tensor value range process --- ge/graph/passes/infer_value_range_pass.cc | 30 ++++++++++++--- .../passes/infer_value_range_pass_unittest.cc | 45 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/ge/graph/passes/infer_value_range_pass.cc b/ge/graph/passes/infer_value_range_pass.cc index e714e90a..03a18fdb 100644 --- a/ge/graph/passes/infer_value_range_pass.cc +++ b/ge/graph/passes/infer_value_range_pass.cc @@ -301,12 +301,26 @@ graphStatus InferValueRangePass::ConstructData(const GeTensorDesc &tensor_desc, GeTensorPtr &output_ptr) { std::vector> value_range; (void)tensor_desc.GetValueRange(value_range); - if (static_cast(value_range.size()) != tensor_desc.GetShape().GetShapeSize()) { - GELOGW("Value range of input %s is invalid.", tensor_desc.GetName().c_str()); + size_t value_range_data_num = value_range.size(); + auto tensor_shape = tensor_desc.GetShape(); + bool value_range_and_tensor_shape_matched = true; + if (tensor_shape.IsScalar()){ + // scalar tensor has only one value_range pair + if (value_range_data_num != 1) { + value_range_and_tensor_shape_matched = false; + } + } else { + // normal tensor, value_range size is equal to tensor shape size. + if (static_cast(value_range_data_num) != tensor_shape.GetShapeSize()) { + value_range_and_tensor_shape_matched = false; + } + } + if (!value_range_and_tensor_shape_matched) { + GELOGW("Input %s value range and tensor shape do not match. Value range size is %zu, tensor shape is %s.", + tensor_desc.GetName().c_str(), value_range_data_num, formats::ShapeToString(tensor_shape).c_str()); return GRAPH_PARAM_INVALID; } - size_t value_range_data_num = value_range.size(); unique_ptr buf(new (std::nothrow) T[value_range_data_num]()); if (buf == nullptr) { REPORT_INNER_ERROR("E19999", "New buf failed"); @@ -494,10 +508,16 @@ void InferValueRangePass::ConstructValueRange(const GeTensorPtr &left_tensor, co GELOGI("Output tensor of cpu kernel does not have data, no way to set value range."); return; } - for (auto j = 0; j < left_tensor->GetTensorDesc().GetShape().GetShapeSize(); ++j) { + auto left_tensor_shape = left_tensor->GetTensorDesc().GetShape(); + for (auto j = 0; j < left_tensor_shape.GetShapeSize(); ++j) { auto left = static_cast(*(x + j)); auto right = static_cast(*(y + j)); - value_range.emplace_back(std::make_pair(left, right)); + value_range.emplace_back(left, right); + } + + if (left_tensor_shape.IsScalar()) { + GELOGD("When inferring value range, output tensors of cpu kernel are scalar tensors."); + value_range.emplace_back(static_cast(*x), static_cast(*y)); } } } // namespace ge diff --git a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc index 576d679c..c39755b3 100644 --- a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc @@ -293,6 +293,9 @@ class AddKernel : public Kernel { } else if (input[0]->GetTensorDesc().GetDataType() == DT_INT32 || input[0]->GetTensorDesc().GetDataType() == DT_UINT32) { vector data_vec; auto data_num = input[0]->GetTensorDesc().GetShape().GetShapeSize(); + if (input[0]->GetTensorDesc().GetShape().IsScalar()) { + data_num = 1; + } auto x1_data = reinterpret_cast(input[0]->GetData().data()); auto x2_data = reinterpret_cast(input[1]->GetData().data()); for (size_t i = 0; i < data_num; i++) { @@ -410,6 +413,48 @@ TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHave EXPECT_EQ(unknown_target_value_range, output_value_range); } +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsAreKnownValueRange_ScalarOutput) { + // shape --- add --- sqrt + // constant / + auto graph = std::make_shared("test_graph"); + vector data_vec = {2}; + GeTensorDesc const_td(ge::GeShape(), ge::FORMAT_NCHW, ge::DT_INT32); + GeTensorPtr const_tensor = std::make_shared(const_td, (uint8_t *)data_vec.data(), sizeof(int32_t)); + auto const_op_desc = std::make_shared("Constant", "Constant"); + const_op_desc->AddOutputDesc(const_td); + EXPECT_EQ(OpDescUtils::SetWeights(const_op_desc, const_tensor), GRAPH_SUCCESS); + auto const_node = graph->AddNode(const_op_desc); + + GeTensorDesc shape_td(GeShape(), ge::FORMAT_NCHW, ge::DT_INT32); + std::vector> known_value_range = {make_pair(1, 100)}; + shape_td.SetValueRange(known_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_td); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_td(GeShape(), ge::FORMAT_NCHW, ge::DT_INT32); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_td); + add_op_desc->AddInputDesc(const_td); + add_op_desc->AddOutputDesc(add_td); + auto add_node = graph->AddNode(add_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(const_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 1); + + std::vector target_value_range = {3, 102}; + std::vector output_value_range = {out_value_range[0].first, out_value_range[0].second}; + EXPECT_EQ(output_value_range, target_value_range); +} + TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsAreKnownValueRange_Int64) { // shape --- add --- sqrt // constant / From f9e7359ad37746bacdb246e255cc32c7250d767a Mon Sep 17 00:00:00 2001 From: chenyemeng Date: Wed, 30 Jun 2021 16:10:57 +0800 Subject: [PATCH 118/226] header file update --- .../inc/external/runtime/rt_error_codes.h | 7 + third_party/fwkacllib/inc/runtime/base.h | 8 +- third_party/fwkacllib/inc/runtime/config.h | 43 ++++++ third_party/fwkacllib/inc/runtime/dev.h | 5 + third_party/fwkacllib/inc/runtime/event.h | 37 ++++- third_party/fwkacllib/inc/runtime/kernel.h | 83 ++++++++--- third_party/fwkacllib/inc/runtime/mem.h | 11 ++ third_party/fwkacllib/inc/runtime/rt_model.h | 13 +- .../fwkacllib/inc/toolchain/prof_callback.h | 31 +++- third_party/fwkacllib/inc/toolchain/slog.h | 62 ++++---- .../fwkacllib/inc/toolchain/tuning_tool/tune_api.h | 160 +++++++++++---------- 11 files changed, 332 insertions(+), 128 deletions(-) diff --git a/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h b/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h index 67146dbe..9f216a56 100755 --- a/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h +++ b/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h @@ -38,6 +38,7 @@ static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callba 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_WAIT_TIMEOUT = 107019; // wait timeout 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 @@ -50,6 +51,7 @@ static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no eve 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_NO_CDQ_RESOURCE = 207011; // no cdq 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 @@ -85,9 +87,14 @@ static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug 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_VECTOR_CORE_TIMEOUT = 507034; // vector core timeout +static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception +static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception +static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal 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 } diff --git a/third_party/fwkacllib/inc/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index 40bc91f7..7fc1cdea 100644 --- a/third_party/fwkacllib/inc/runtime/base.h +++ b/third_party/fwkacllib/inc/runtime/base.h @@ -156,7 +156,7 @@ RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtSt /** * @ingroup profiling_base - * @brief ts send keypoint for step info. + * @brief ts send keypoint profiler log. */ RTS_API rtError_t rtProfilerTraceEx(uint64_t id, uint64_t modelId, uint16_t tagId, rtStream_t stream); @@ -206,7 +206,7 @@ RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCal /** * @ingroup dvrt_base - * @brief register callback for fail task + * @brief register callback for fail task * @param [in] uniName unique register name, can't be null * @param [in] callback fail task callback function * @param [out] NA @@ -345,11 +345,11 @@ RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream); +RTS_API rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream); /** * @ingroup dvrt_base - * @brief get current thread last stream id and task id + * @brief get current thread last stream id and task id * @param [out] stream id and task id * @param [in] null * @return RT_ERROR_NONE for ok diff --git a/third_party/fwkacllib/inc/runtime/config.h b/third_party/fwkacllib/inc/runtime/config.h index ee104693..c1327c45 100644 --- a/third_party/fwkacllib/inc/runtime/config.h +++ b/third_party/fwkacllib/inc/runtime/config.h @@ -46,6 +46,12 @@ typedef enum tagRtChipType { CHIP_END, } rtChipType_t; +typedef enum tagRtAicpuScheType { + SCHEDULE_SOFTWARE = 0, /* Software Schedule */ + SCHEDULE_SOFTWARE_OPT, + SCHEDULE_HARDWARE, /* HWTS Schedule */ +} rtAicpuScheType; + typedef enum tagRtVersion { VER_BEGIN = 0, VER_NA = VER_BEGIN, @@ -65,6 +71,7 @@ typedef enum tagRtPlatformType { PLATFORM_LHISI_CS, PLATFORM_DC, PLATFORM_CLOUD_V2, + PLATFORM_LHISI_SD3403, PLATFORM_END, } rtPlatformType_t; @@ -126,6 +133,11 @@ typedef struct tagRtPlatformConfig { uint32_t platformConfig; } rtPlatformConfig_t; +typedef enum tagRTTaskTimeoutType { + RT_TIMEOUT_TYPE_OP_WAIT = 0, + RT_TIMEOUT_TYPE_OP_EXECUTE, +} rtTaskTimeoutType_t; + /** * @ingroup * @brief get AI core count @@ -184,6 +196,37 @@ RTS_API rtError_t rtMemGetL2Info(rtStream_t stream, void **ptr, uint32_t *size); */ RTS_API rtError_t rtGetRuntimeVersion(uint32_t *runtimeVersion); + +/** + * @ingroup + * @brief get device feature ability by device id, such as task schedule ability. + * @param [in] deviceId + * @param [in] moduleType + * @param [in] featureType + * @param [out] value + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDeviceCapability(int32_t deviceId, int32_t moduleType, int32_t featureType, int32_t *value); + +/** + * @ingroup + * @brief set event wait task timeout time. + * @param [in] timeout + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetOpWaitTimeOut(uint32_t timeout); + +/** + * @ingroup + * @brief set op execute task timeout time. + * @param [in] timeout + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetOpExecuteTimeOut(uint32_t timeout); + #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif diff --git a/third_party/fwkacllib/inc/runtime/dev.h b/third_party/fwkacllib/inc/runtime/dev.h index e82ec5fa..2cf6712f 100644 --- a/third_party/fwkacllib/inc/runtime/dev.h +++ b/third_party/fwkacllib/inc/runtime/dev.h @@ -63,6 +63,11 @@ typedef enum tagRtFeatureType { FEATURE_TYPE_RSV } rtFeatureType_t; +typedef enum tagRtDeviceFeatureType { + FEATURE_TYPE_SCHE, + FEATURE_TYPE_END, +} rtDeviceFeatureType_t; + typedef enum tagMemcpyInfo { MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, MEMCPY_INFO_RSV diff --git a/third_party/fwkacllib/inc/runtime/event.h b/third_party/fwkacllib/inc/runtime/event.h index 41e611ea..57948c47 100644 --- a/third_party/fwkacllib/inc/runtime/event.h +++ b/third_party/fwkacllib/inc/runtime/event.h @@ -23,12 +23,23 @@ extern "C" { #endif +typedef enum rtEventWaitStatus { + EVENT_STATUS_COMPLETE = 0, + EVENT_STATUS_NOT_READY = 1, + EVENT_STATUS_MAX = 2, +} rtEventWaitStatus_t; + /** * @ingroup event_flags * @brief event op bit flags */ -#define RT_EVENT_DEFAULT (0x00) -#define RT_EVENT_WITH_FLAG (0x01) +#define RT_EVENT_DEFAULT (0x0E) +#define RT_EVENT_WITH_FLAG (0x0B) + +#define RT_EVENT_DDSYNC_NS 0x01U +#define RT_EVENT_STREAM_MARK 0x02U +#define RT_EVENT_DDSYNC 0x04U +#define RT_EVENT_TIME_LINE 0x08U /** * @ingroup dvrt_event @@ -106,6 +117,16 @@ RTS_API rtError_t rtEventQuery(rtEvent_t event); /** * @ingroup dvrt_event + * @brief Queries an event's wait status + * @param [in] event event to query + * @param [in out] EVENT_WAIT_STATUS status + * @return EVENT_STATUS_COMPLETE for complete + * @return EVENT_STATUS_NOT_READY for not complete + */ +RTS_API rtError_t rtEventQueryWaitStatus(rtEvent_t event, rtEventWaitStatus_t *status); + +/** + * @ingroup dvrt_event * @brief computes the elapsed time between events. * @param [in] time time between start and end in ms * @param [in] start starting event @@ -178,6 +199,18 @@ RTS_API rtError_t rtNotifyWait(rtNotify_t notify, rtStream_t stream); /** * @ingroup dvrt_event + * @brief Wait for a notify with time out + * @param [in] notify_ notify to be wait + * @param [in] stream_ input stream + * @param [in] timeOut input timeOut + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_STREAM_CONTEXT for stream is not in current ctx + */ +RTS_API rtError_t rtNotifyWaitWithTimeOut(rtNotify_t notify_, rtStream_t stream_, uint32_t timeOut); + +/** + * @ingroup dvrt_event * @brief Name a notify * @param [in] notify_ notify to be named * @param [in|out] name identification name diff --git a/third_party/fwkacllib/inc/runtime/kernel.h b/third_party/fwkacllib/inc/runtime/kernel.h index 402fadef..9b0221c7 100644 --- a/third_party/fwkacllib/inc/runtime/kernel.h +++ b/third_party/fwkacllib/inc/runtime/kernel.h @@ -112,6 +112,16 @@ typedef struct rtKernelInfo { } *rtKernelInfo_t; /** + * @ingroup rt_kernel + * @brief op name + */ +typedef struct rtKernelLaunchNames { + const char *soName; // defined for so name + const char *kernelName; // defined for kernel type name + const char *opName; // defined for operator name +} rtKernelLaunchNames_t; + +/** * @ingroup rt_KernelConfigDump * @brief device dump type */ @@ -173,13 +183,7 @@ typedef void (*rtCallback_t)(void *fnData); * @ingroup rt_kernel * @brief magic number of elf binary for aicube */ -#define RT_DEV_BINARY_MAGIC_ELF_AICUBE 0x41415247 - -/** - * @ingroup rt_kernel - * @brief magic number of elf binary for aivector - */ -#define RT_DEV_BINARY_MAGIC_ELF_AIVECTOR 0x41415248 +#define RT_DEV_BINARY_MAGIC_ELF_AICUBE 0x41494343 /** * @ingroup rt_kernel_flags @@ -192,14 +196,14 @@ typedef void (*rtCallback_t)(void *fnData); #define RT_KERNEL_CUSTOM_AICPU (0x08) // STARS topic scheduler sqe : topic_type -#define RT_KERNEL_DEVICE_FIRST (0X10) -#define RT_KERNEL_HOST_ONLY (0X20) -#define RT_KERNEL_HOST_FIRST (0X30) +#define RT_KERNEL_DEVICE_FIRST (0x10) +#define RT_KERNEL_HOST_ONLY (0x20) +#define RT_KERNEL_HOST_FIRST (0x40) /** * @ingroup rt_kernel * @brief kernel mode - */ +**/ #define RT_DEFAULT_KERNEL_MODE (0x00) #define RT_NORMAL_KERNEL_MODE (0x01) #define RT_ALL_KERNEL_MODE (0x02) @@ -222,7 +226,7 @@ RTS_API rtError_t rtDevBinaryRegister(const rtDevBinary_t *bin, void **handle); /** * @ingroup rt_kernel - * @brief register device binary + * @brief register device binary with all kernel * @param [in] bin device binary description * @param [out] handle device binary handle * @return RT_ERROR_NONE for ok @@ -341,7 +345,7 @@ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void * * @ingroup rt_kernel * @brief launch kernel with handle to device * @param [in] handle program - * @param [in] devFunc device function description + * @param [in] devFunc device function description. * @param [in] blockDim block dimentions * @param [in] args argments address for kernel function * @param [in] argsSize argements size @@ -352,7 +356,7 @@ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void * * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelLaunchWithHandle(void *handle, const void *devFunc, uint32_t blockDim, void *args, uint32_t argsSize, - rtSmDesc_t *smDesc, rtStream_t stream, const void *kernelInfo); + rtSmDesc_t *smDesc, rtStream_t stream_, const void *kernelInfo); /** * @ingroup rt_kernel @@ -371,7 +375,7 @@ RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags); /** - * @ingroup rt_kernel + * @ingroup rt_kernel(abandoned) * @brief launch kernel to device * @param [in] args argments address for kernel function * @param [in] argsSize argements size @@ -383,7 +387,21 @@ RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim RTS_API rtError_t rtKernelLaunchEx(void *args, uint32_t argsSize, uint32_t flags, rtStream_t stream); /** - * @ingroup rt_kernel + * @ingroup rt_kernel(in use) + * @brief launch kernel to device + * @param [in] opName opkernel name + * @param [in] args argments address for kernel function + * @param [in] argsSize argements size + * @param [in] flags launch flags + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelLaunchFwk(const char *opName, void *args, uint32_t argsSize, uint32_t flags, + rtStream_t rtStream); + +/** + * @ingroup rt_kernel(abandoned) * @brief launch cpu kernel to device * @param [in] soName so name * @param [in] kernelName kernel name @@ -399,7 +417,22 @@ RTS_API rtError_t rtCpuKernelLaunch(const void *soName, const void *kernelName, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream); /** - * @ingroup rt_kernel + * @ingroup rt_kernel(in use) + * @brief launch cpu kernel to device + * @param [in] launchNames names for kernel launch + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argments size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtAicpuKernelLaunch(const rtKernelLaunchNames_t *launchNames, + uint32_t blockDim, const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream); + +/** + * @ingroup rt_kernel(abandoned) * @brief launch cpu kernel to device with dump identifier * @param [in] soName so name * @param [in] kernelName kernel name @@ -417,6 +450,22 @@ RTS_API rtError_t rtCpuKernelLaunchWithFlag(const void *soName, const void *kern uint32_t flags); /** + * @ingroup rt_kernel(in use) + * @brief launch cpu kernel to device with dump identifier + * @param [in] launchNames names for kernel launch + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argments size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @param [in] flag dump flag or others function flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtAicpuKernelLaunchWithFlag(const rtKernelLaunchNames_t *launchNames, uint32_t blockDim, + const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags); + +/** * @ingroup rt_kernel * @brief L1 fusion dump addr transfered to device * @param [in] model handle info diff --git a/third_party/fwkacllib/inc/runtime/mem.h b/third_party/fwkacllib/inc/runtime/mem.h index 30af85d9..bace4bc6 100644 --- a/third_party/fwkacllib/inc/runtime/mem.h +++ b/third_party/fwkacllib/inc/runtime/mem.h @@ -116,6 +116,9 @@ typedef enum tagRtMemInfoType { typedef enum tagRtRecudeKind { RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P + RT_MEMCPY_SDMA_AUTOMATIC_MAX = 11, + RT_MEMCPY_SDMA_AUTOMATIC_MIN = 12, + RT_MEMCPY_SDMA_AUTOMATIC_EQUAL = 13, RT_RECUDE_KIND_END } rtRecudeKind_t; @@ -123,6 +126,14 @@ typedef enum tagRtDataType { RT_DATA_TYPE_FP32 = 0, // fp32 RT_DATA_TYPE_FP16 = 1, // fp16 RT_DATA_TYPE_INT16 = 2, // int16 + RT_DATA_TYPE_INT4 = 3, // int4 + RT_DATA_TYPE_INT8 = 4, // int8 + RT_DATA_TYPE_INT32 = 5, // int32 + RT_DATA_TYPE_BFP16 = 6, // bfp16 + RT_DATA_TYPE_BFP32 = 7, // bfp32 + RT_DATA_TYPE_UINT8 = 8, // uint8 + RT_DATA_TYPE_UINT16= 9, // uint16 + RT_DATA_TYPE_UINT32= 10,// uint32 RT_DATA_TYPE_END } rtDataType_t; diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 30b8f053..a7618b45 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -135,12 +135,13 @@ typedef struct tagAllKernelTaskInfo { uint16_t argsCount; uint16_t argsSize; uint16_t reserved; - const void *dev_func; + void *devfunc; void *handle; uint8_t *smDesc; uint8_t *args; uint16_t *argsOffset; } rtAllKernelTaskInfo_t; + typedef struct tagKernelTaskInfoEx { uint32_t flags; uint32_t argsSize; @@ -198,6 +199,13 @@ typedef struct tagProfilerTraceTaskInfo { uint32_t reserved[6]; } rtProfilerTrace_t; +typedef struct tagProfilerTraceExTaskInfo { + uint64_t profilerTraceId; + uint64_t modelId; + uint16_t tagId; + uint8_t reserved[22]; +} rtProfilerTraceEx_t; + typedef struct tagrtMemcpyAsyncTaskInfo { void *dst; uint64_t destMax; @@ -265,7 +273,7 @@ typedef struct tagTaskInfo { union { rtKernelTaskInfoEx_t kernelTaskEx; rtKernelTaskInfo_t kernelTask; - rtAllKernelTaskInfo_t allkernelTask; + rtAllKernelTaskInfo_t allKernelTask; rtEventTaskInfo_t eventTask; rtStreamSwitchTaskInfo_t streamSwitchTask; rtStreamActiveTaskInfo_t streamActiveTask; @@ -273,6 +281,7 @@ typedef struct tagTaskInfo { rtLabelSwitchTaskInfo_t labelSwitchTask; rtLabelGotoTaskInfo_t labelGotoTask; rtProfilerTrace_t profilertraceTask; + rtProfilerTraceEx_t profilertraceExTask; rtMemcpyAsyncTaskInfo_t memcpyAsyncTask; rtNotifyTaskInfo_t notifyTask; rtReduceAsyncTaskInfo_t reduceAsyncTask; diff --git a/third_party/fwkacllib/inc/toolchain/prof_callback.h b/third_party/fwkacllib/inc/toolchain/prof_callback.h index 18550157..5073cfb1 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_callback.h +++ b/third_party/fwkacllib/inc/toolchain/prof_callback.h @@ -108,7 +108,19 @@ enum MsprofCtrlCallbackType { MSPROF_CTRL_INIT_ACL_ENV = 0, // start profiling with acl env MSPROF_CTRL_INIT_ACL_JSON, // start profiling with acl.json MSPROF_CTRL_INIT_GE_OPTIONS, // start profiling with ge env and options - MSPROF_CTRL_FINALIZE // stop profiling + MSPROF_CTRL_FINALIZE, // stop profiling + MSPROF_CTRL_REPORT_FUN_P, // for report callback + MSPROF_CTRL_PROF_SWITCH_ON, // for prof switch on + MSPROF_CTRL_PROF_SWITCH_OFF // for prof switch off +}; + +#define MSPROF_MAX_DEV_NUM (64) + +struct MsprofCommandHandle { + uint64_t profSwitch; + uint32_t devNums; // length of device id list + uint32_t devIdList[MSPROF_MAX_DEV_NUM]; + uint32_t modelId; }; /** @@ -129,6 +141,23 @@ typedef int32_t (*MsprofCtrlCallback)(uint32_t type, void *data, uint32_t len); */ typedef void (*MsprofSetDeviceCallback)(uint32_t devId, bool isOpenDevice); +/* + * @name MsprofInit + * @brief Profiling module init + * @param [in] dataType: profiling type: ACL Env/ACL Json/GE Option + * @param [in] data: profiling switch data + * @param [in] dataLen: Length of data + * @return 0:SUCCESS, >0:FAILED + */ +int32_t MsprofInit(uint32_t dataType, void *data, uint32_t dataLen); + +/* + * @name AscendCL + * @brief Finishing Profiling + * @param NULL + * @return 0:SUCCESS, >0:FAILED + */ +int32_t MsprofFinalize(); #ifdef __cplusplus } #endif diff --git a/third_party/fwkacllib/inc/toolchain/slog.h b/third_party/fwkacllib/inc/toolchain/slog.h index ba286d02..cc7c83ca 100644 --- a/third_party/fwkacllib/inc/toolchain/slog.h +++ b/third_party/fwkacllib/inc/toolchain/slog.h @@ -17,6 +17,8 @@ #ifndef D_SYSLOG_H_ #define D_SYSLOG_H_ +static const int TMP_LOG = 0; + #ifdef __cplusplus #ifndef LOG_CPP extern "C" { @@ -120,15 +122,15 @@ typedef struct tagKV { } KeyValue; typedef enum { - APPLICATION = 0, - SYSTEM + APPLICATION = 0, + SYSTEM } ProcessType; typedef struct { - ProcessType type; - unsigned int pid; - unsigned int deviceId; - char reserved[RESERVERD_LENGTH]; + ProcessType type; + unsigned int pid; + unsigned int deviceId; + char reserved[RESERVERD_LENGTH]; } LogAttr; /** @@ -141,7 +143,7 @@ enum { IDEDD, /**< IDE daemon device */ IDEDH, /**< IDE daemon host */ HCCL, /**< HCCL */ - FMK, /**< Framework */ + FMK, /**< Adapter */ HIAIENGINE, /**< Matrix */ DVPP, /**< DVPP */ RUNTIME, /**< Runtime */ @@ -162,11 +164,11 @@ enum { MDCDEFAULT, /**< MDC undefine */ MDCSC, /**< MDC spatial cognition */ MDCPNC, - MLL, + MLL, /**< abandon */ DEVMM, /**< Dlog memory managent */ KERNEL, /**< Kernel */ LIBMEDIA, /**< Libmedia */ - CCECPU, /**< ai cpu */ + CCECPU, /**< aicpu shedule */ ASCENDDK, /**< AscendDK */ ROS, /**< ROS */ HCCP, @@ -179,7 +181,7 @@ enum { TSDUMP, /**< TSDUMP module */ AICPU, /**< AICPU module */ LP, /**< LP module */ - TDT, + TDT, /**< tsdaemon or aicpu shedule */ FE, MD, MB, @@ -261,7 +263,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); #define dlog_error(moduleId, fmt, ...) \ do { \ DlogErrorInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -276,7 +278,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, DLOG_WARN) == 1) { \ DlogWarnInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -291,7 +293,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, DLOG_INFO) == 1) { \ DlogInfoInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -306,7 +308,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, DLOG_DEBUG) == 1) { \ DlogDebugInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -318,7 +320,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); #define dlog_event(moduleId, fmt, ...) \ do { \ DlogEventInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -334,7 +336,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, level) == 1) { \ DlogInner(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -351,7 +353,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, level) == 1) { \ DlogInner(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -369,7 +371,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr); if(CheckLogLevel(moduleId, level) == 1) { \ DlogWithKVInner(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -381,13 +383,13 @@ DLL_EXPORT void DlogFlush(void); * @ingroup slog * @brief Internal log interface, other modules are not allowed to call this interface */ -void DlogErrorInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void DlogWarnInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void DlogInfoInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void DlogDebugInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void DlogEventInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void DlogInner(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); -void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6))); +void DlogErrorInner(int moduleId, const char *fmt, ...); +void DlogWarnInner(int moduleId, const char *fmt, ...); +void DlogInfoInner(int moduleId, const char *fmt, ...); +void DlogDebugInner(int moduleId, const char *fmt, ...); +void DlogEventInner(int moduleId, const char *fmt, ...); +void DlogInner(int moduleId, int level, const char *fmt, ...); +void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...); #ifdef __cplusplus #ifndef LOG_CPP @@ -453,7 +455,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogInnerForC(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -470,7 +472,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogInnerForC(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -488,7 +490,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr); if(CheckLogLevelForC(moduleId, level) == 1) { \ DlogWithKVInnerForC(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ } \ - } while (0) + } while (TMP_LOG != 0) /** * @ingroup slog @@ -500,8 +502,8 @@ DLL_EXPORT void DlogFlushForC(void); * @ingroup slog * @brief Internal log interface, other modules are not allowed to call this interface */ -void DlogInnerForC(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4))); -void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6))); +void DlogInnerForC(int moduleId, int level, const char *fmt, ...); +void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...); #ifdef __cplusplus } diff --git a/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h b/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h index 6208f462..2cf6e0c4 100644 --- a/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h +++ b/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h @@ -1,72 +1,88 @@ -/** - * @file tune_api.h - * - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.\n - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n - * 描述:mstune调优接口头文件 - */ -/** @defgroup mstune mstune调优接口 */ -#ifndef TUNE_API_H -#define TUNE_API_H -#include -#include -#include -#include "graph/graph.h" -#include "ge/ge_api.h" - -/** - * @ingroup mstune - * - * mstune status - */ -enum MsTuneStatus { - MSTUNE_SUCCESS, /** tune success */ - MSTUNE_FAILED, /** tune failed */ -}; - -// Option key: for train options sets -const std::string MSTUNE_SELF_KEY = "mstune"; -const std::string MSTUNE_GEINIT_KEY = "initialize"; -const std::string MSTUNE_GESESS_KEY = "session"; - -/** - * @ingroup mstune - * @par 描述: 命令行调优 - * - * @attention 无 - * @param option [IN] 调优参数 - * @param msg [OUT] 调优异常下返回信息 - * @retval #MSTUNE_SUCCESS 执行成功 - * @retval #MSTUNE_FAILED 执行失败 - * @par 依赖: - * @li tune_api.cpp:该接口所属的开发包。 - * @li tune_api.h:该接口声明所在的头文件。 - * @see 无 - * @since - */ -MsTuneStatus MsTuning(const std::map &option, std::string &msg); - -/** - * @ingroup mstune - * @par 描述: 梯度调优 - * - * @attention 无 - * @param tuningGraph [IN] 调优图 - * @param dependGraph [IN] 调优依赖图 - * @param session [IN] ge连接会话 - * @param option [IN] 参数集. 包含调优参数及ge参数 - * @retval #MSTUNE_SUCCESS 执行成功 - * @retval #MSTUNE_FAILED 执行失败 - * @par 依赖: - * @li tune_api.cpp:该接口所属的开发包。 - * @li tune_api.h:该接口声明所在的头文件。 - * @see 无 - * @since - */ -extern "C" MsTuneStatus MsTrainTuning(ge::Graph &tuningGraph, std::vector &dependGraph, - ge::Session *session, const std::map> &option); - -#endif +/** + * @file tune_api.h + * + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.\n + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n + * 描述:aoe调优接口头文件 + */ +/** @defgroup aoe aoe调优接口 */ +#ifndef TUNE_API_H +#define TUNE_API_H +#include +#include +#include "ge/ge_api.h" +#include "aoe_types.h" + +/** + * @ingroup aoe + * @par 描述: 命令行调优 + * + * @attention 无 + * @param option [IN] 调优参数 + * @param msg [OUT] 调优异常下返回信息 + * @retval #AOE_SUCCESS 执行成功 + * @retval #AOE_FAILURE 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +AoeStatus AoeOfflineTuning(const std::map &option, std::string &msg); + +/** + * @ingroup aoe + * @par 描述: 调优初始化 + * + * @attention 无 + * @param session [IN] ge连接会话 + * @param option [IN] 参数集. 包含调优参数及ge参数 + * @retval #AOE_SUCCESS 执行成功 + * @retval #AOE_FAILURE 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +extern "C" AoeStatus AoeOnlineInitialize(ge::Session *session, const std::map &option); + +/** + * @ingroup aoe + * @par 描述: 调优去初始化 + * + * @attention 无 + * @param 无 + * @retval #AOE_SUCCESS 执行成功 + * @retval #AOE_FAILURE 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +extern "C" AoeStatus AoeOnlineFinalize(); + +/** + * @ingroup aoe + * @par 描述: 调优处理 + * + * @attention 无 + * @param tuningGraph [IN] 调优图 + * @param dependGraph [IN] 调优依赖图 + * @param session [IN] ge连接会话 + * @param option [IN] 参数集. 包含调优参数及ge参数 + * @retval #AOE_SUCCESS 执行成功 + * @retval #AOE_FAILURE 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +extern "C" AoeStatus AoeOnlineTuning(ge::Graph &tuningGraph, std::vector &dependGraph, + ge::Session *session, const std::map &option); +#endif From d1bb84d4ea4ff58a4d08d2fce112b8f289175da0 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 30 Jun 2021 16:59:03 +0800 Subject: [PATCH 119/226] Fix ut. --- ge/single_op/single_op_model.h | 1 - .../hybrid/node_executor/node_executor_unittest.cc | 4 ++-- tests/ut/ge/single_op/single_op_model_unittest.cc | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index 98aed0f0..b5198e3d 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -82,7 +82,6 @@ class SingleOpModel { Status ParseTasks(); std::vector tbe_tasks_; - std::vector atomic_tasks_; std::vector aicpu_tasks_; std::string model_name_; diff --git a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc index 8a1240d3..a6f5c2de 100644 --- a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc @@ -97,7 +97,7 @@ TEST_F(NodeExecutorTest, TestInitAndFinalize) { manager.FinalizeExecutors(); ASSERT_FALSE(manager.executors_.empty()); manager.FinalizeExecutors(); - ASSERT_TRUE(manager.executors_.empty()); - ASSERT_TRUE(finalized); + // ASSERT_TRUE(manager.executors_.empty()); + // ASSERT_TRUE(finalized); } } // namespace ge diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index e4a53340..2c0073f5 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -311,7 +311,7 @@ TEST_F(UtestSingleOpModel, BuildTaskList) { ASSERT_EQ(mem_task.LaunchKernel(0), SUCCESS); } -TEST_F(UtestSingleOpModel, build_aicpu_task) { +TEST_F(UtestSingleOpModel, build_dynamic_task) { ComputeGraphPtr graph = make_shared("single_op"); GeModelPtr ge_model = make_shared(); ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph)); @@ -321,6 +321,15 @@ TEST_F(UtestSingleOpModel, build_aicpu_task) { domi::TaskDef *task_def = model_task_def->add_task(); task_def->set_type(RT_MODEL_TASK_KERNEL_EX); + domi::TaskDef *task_def2 = model_task_def->add_task(); + task_def2->set_type(RT_MODEL_TASK_KERNEL); + domi::KernelDef *kernel_def = task_def2->mutable_kernel(); + domi::KernelContext *context = kernel_def->mutable_context(); + context->set_kernel_type(6); // ccKernelType::AI_CPU + + domi::TaskDef *task_def3 = model_task_def->add_task(); + task_def3->set_type(RT_MODEL_TASK_ALL_KERNEL); + string model_data_str = "123456789"; SingleOpModel model("model", model_data_str.c_str(), model_data_str.size()); std::mutex stream_mu; @@ -329,8 +338,17 @@ TEST_F(UtestSingleOpModel, build_aicpu_task) { DynamicSingleOp single_op(0, &stream_mu, stream); model.model_helper_.model_ = ge_model; auto op_desc = std::make_shared("add", "Add"); + std::vector kernelBin; + TBEKernelPtr tbe_kernel = std::make_shared("name/Add", std::move(kernelBin)); + op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); NodePtr node = graph->AddNode(op_desc); model.op_list_[0] = node; StreamResource *res = new (std::nothrow) StreamResource(1); + + ASSERT_EQ(model.ParseTasks(), SUCCESS); + ASSERT_EQ(model.BuildTaskListForDynamicOp(res, single_op), SUCCESS); + model.tbe_tasks_.clear(); ASSERT_EQ(model.BuildTaskListForDynamicOp(res, single_op), SUCCESS); + model.aicpu_tasks_[0] = *task_def2; + model.BuildTaskListForDynamicOp(res, single_op); } From 25557f9bf05bf39cd2034ad5480956151555408e Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Wed, 30 Jun 2021 17:08:09 +0800 Subject: [PATCH 120/226] set size for dynamic input --- ge/hybrid/executor/hybrid_model_async_executor.cc | 8 ++++--- .../hybrid_model_async_executor_unittest.cc | 28 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index e0dd768d..229cce84 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -295,13 +295,15 @@ Status HybridModelAsyncExecutor::PrepareInputs(const InputData ¤t_data, Hy } } tensor_desc->SetShape(shape); - args.input_desc[input_index] = tensor_desc; - GELOGD("Update shape of input[%zu] to [%s]", input_index, tensor_desc->MutableShape().ToString().c_str()); + GELOGD("Update shape[%s] of input[%zu] to [%s]", + shape.ToString().c_str(), input_index, tensor_desc->MutableShape().ToString().c_str()); GE_CHK_GRAPH_STATUS_RET(TensorUtils::GetTensorMemorySizeInBytes(*tensor_desc, tensor_size), "[Invoke][GetTensorMemorySizeInBytes]Failed to calc tensor size," "index = %zu, shape = [%s], model_id = %u.", input_index, tensor_desc->GetShape().ToString().c_str(), model_id_); - GELOGD("Input tensor[%zu] size = %zu", input_index, tensor_size); + GELOGD("Input tensor[%zu] size = %ld", input_index, tensor_size); + TensorUtils::SetSize(*tensor_desc, tensor_size); + args.input_desc[input_index] = tensor_desc; } GE_CHECK_GE(tensor_size, 0); diff --git a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc index f772af23..c053885f 100644 --- a/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc +++ b/tests/ut/ge/hybrid/executor/hybrid_model_async_executor_unittest.cc @@ -103,4 +103,32 @@ TEST_F(UtestHybridModelAsyncExecutor, Test_execute) { context.callback_manager->callback_queue_.Push(eof_entry); ASSERT_EQ(executor.Execute(args), SUCCESS); } + +TEST_F(UtestHybridModelAsyncExecutor, test_PrepareInputs) { + ComputeGraphPtr graph = std::make_shared("test"); + GeRootModelPtr ge_root_model = make_shared(graph); + ge_root_model->SetModelName("test_name"); + GeModelPtr ge_sub_model = make_shared(); + HybridModel hybrid_model(ge_root_model); + HybridModelAsyncExecutor executor(&hybrid_model); + GeTensorDescPtr tensor_desc = make_shared(GeShape({-1, 16, 16, 3})); + tensor_desc->SetShapeRange({{1, 256}, {16, 16}, {16, 16}, {3, 3}}); + executor.input_tensor_desc_.insert({0, tensor_desc}); + executor.device_id_ = 0; + executor.input_sizes_.insert({0, -1}); + executor.is_input_dynamic_.push_back(true); + + unique_ptr data_buf(new (std::nothrow)uint8_t[3072]); + InputData input_data; + input_data.blobs.push_back(DataBuffer(data_buf.get(), 3072, false)); + input_data.shapes.push_back({1, 16, 16, 3}); + HybridModelExecutor::ExecuteArgs args; + + auto ret = executor.PrepareInputs(input_data, args); + ASSERT_EQ(ret, SUCCESS); + ASSERT_EQ(args.input_desc[0]->GetShape().ToString(), GeShape({1, 16, 16, 3}).ToString()); + int64_t tensor_size = 0; + TensorUtils::GetSize(*(args.input_desc[0]), tensor_size); + ASSERT_EQ(tensor_size, 3104); +} } // namespace ge \ No newline at end of file From 022ec1c8c050437906025bfac682efdbc5fada8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Wed, 30 Jun 2021 19:20:09 +0800 Subject: [PATCH 121/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!1842=20:=20check=20dump=20option'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/common/dump/dump_properties.cc | 243 +++---------------------- ge/common/dump/dump_properties.h | 18 +- ge/session/inner_session.cc | 2 +- tests/ut/ge/CMakeLists.txt | 1 - tests/ut/ge/common/dump_properties_unittest.cc | 126 ------------- 5 files changed, 26 insertions(+), 364 deletions(-) delete mode 100644 tests/ut/ge/common/dump_properties_unittest.cc diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 010347c0..ef755540 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -18,7 +18,6 @@ #include #include -#include #include "common/ge/ge_util.h" #include "framework/common/util.h" @@ -38,159 +37,6 @@ const uint32_t kAtomicOverflow = (0x1 << 1); const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); } // namespace namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::Split(const std::string &s, - std::vector &result, - const char *delchar) { - if (s.empty()) { - return; - } - result.clear(); - - char *buffer = new (std::nothrow)char[s.size() + 1]; - if (buffer == nullptr) { - GELOGE(FAILED, "[Split][string] failed while malloc memory, string value is:%s", s.c_str()); - REPORT_CALL_ERROR("E19999", "Memory malloc may fail when split string, get fatal exception, " - "string value is:%s", s.c_str()); - return; - } - buffer[s.size()] = '\0'; - errno_t e = strcpy_s(buffer, s.size() + 1, s.c_str()); - if (e != EOK) { - delete[] buffer; - return; - } - char *context = nullptr; - char *p = strtok_s(buffer, delchar, &context); - while (p != nullptr) { - result.emplace_back(p); - p = strtok_s(nullptr, delchar, &context); - } - delete[] buffer; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpStep(const std::string &dump_step) { - std::string modified_dum_step = dump_step + "|"; - std::smatch result; - std::vector match_vecs; - std::regex pattern(R"((\d{1,}-\d{1,}\||\d{1,}\|)+)"); - if (regex_match(modified_dum_step, result, pattern)) { - Split(result.str(), match_vecs, "|"); - if (match_vecs.empty()) { - REPORT_CALL_ERROR("E19999", "Split may get fatal exception, dump_step:%s.", dump_step.c_str()); - GELOGE(FAILED, "[Check][Param] failed. Split may get fatal exception, ge.exec.dumpStep:%s.", dump_step.c_str()); - return FAILED; - } - // 100 is the max sets of dump steps. - if (match_vecs.size() > 100) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpStep", - dump_step.c_str(), - " is not supported, only support dump <= 100 sets of data"})); - GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " - "dump_step only support dump <= 100 sets of data.", dump_step.c_str()); - return PARAM_INVALID; - } - for (const auto &match_vec : match_vecs) { - std::vector vec_after_split; - Split(match_vec, vec_after_split, "-"); - if (match_vecs.empty()) { - REPORT_CALL_ERROR("E19999", "Split may get fatal exception."); - GELOGE(FAILED, "[Check][Param] failed, split may get fatal exception."); - return FAILED; - } - if (vec_after_split.size() > 1) { - if (std::atoi(vec_after_split[0].c_str()) >= std::atoi(vec_after_split[1].c_str())) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpStep", - dump_step.c_str(), - " is not supported." - "in range steps, the first step is >= second step, correct example:'0|5|10-20"})); - GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " - "in range steps, the first step is >= second step, correct example:'0|5|10-20'", dump_step.c_str()); - return PARAM_INVALID; - } - } - } - } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpStep", - dump_step.c_str(), - " is not supported, correct example:'0|5|10|50-100."})); - GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " - "dump_step string style is error, correct example:'0|5|10|50-100.'", dump_step.c_str()); - return PARAM_INVALID; - } - return SUCCESS; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpMode(const std::string &dump_mode) { - const std::set dump_mode_list = {"input", "output", "all"}; - std::set::iterator iter; - - if ((iter = dump_mode_list.find(dump_mode)) == dump_mode_list.end()) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpMode", - dump_mode.c_str(), - " is not supported, should be one of the following:[input, output, all]"})); - GELOGE(PARAM_INVALID, "[Check][Param] the dump_debug_mode:%s, is is not supported," - "should be one of the following:[input, output, all].", dump_mode.c_str()); - return PARAM_INVALID; - } - return SUCCESS; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpPath(const std::string &input) { - if (mmIsDir(input.c_str()) != EN_OK) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpPath", - input.c_str(), - " is not a directory."})); - GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, is not directory.", input.c_str()); - return PARAM_INVALID; - } - char trusted_path[MMPA_MAX_PATH] = { "\0" }; - if (mmRealPath(input.c_str(), trusted_path, MMPA_MAX_PATH) != EN_OK) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpPath", - input.c_str(), - " dumpPath invalid."})); - GELOGE(PARAM_INVALID, "[Check][Param] the dumpPath:%s, is invalid.", input.c_str()); - return PARAM_INVALID; - } - if (mmAccess2(trusted_path, R_OK | W_OK) != EN_OK) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpPath", - input.c_str(), - " does't have read, write permissions."})); - GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, does't have read, write permissions.", input.c_str()); - return PARAM_INVALID; - } - return SUCCESS; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckEnableDump(const std::string &input) { - std::set enable_dump_option_list = {"1", "0"}; - auto it = enable_dump_option_list.find(input); - if (it == enable_dump_option_list.end()) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.enableDump", - input.c_str(), - " only support 1 or 0."})); - GELOGE(PARAM_INVALID, "[Check][Param] Not support ge.exec.enableDump or ge.exec.enableDumpDebug format:%s, " - "only support 1 or 0.", input.c_str()); - return PARAM_INVALID; - } - return SUCCESS; -} - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties::DumpProperties(const DumpProperties &other) { CopyFrom(other); } @@ -201,26 +47,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: return *this; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { - if (enable_dump_ == kEnableFlag) { - std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { - GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); - GELOGI("Get dump step %s successfully", dump_step.c_str()); - SetDumpStep(dump_step); - } - string dump_mode = "output"; - if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { - GELOGI("Get dump mode %s successfully", dump_mode.c_str()); - GE_CHK_STATUS_RET(CheckDumpMode(dump_mode), "[Check][dump_mode] failed."); - SetDumpMode(dump_mode); - } - AddPropertyValue(DUMP_ALL_MODEL, {}); - } - return SUCCESS; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOptions() { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOptions() { enable_dump_.clear(); enable_dump_debug_.clear(); dump_path_.clear(); @@ -230,32 +57,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOp is_infer_op_debug_ = false; op_debug_mode_ = 0; - std::string enable_dump = std::to_string(false); + std::string enable_dump; (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP, enable_dump); enable_dump_ = enable_dump; - if (!enable_dump_.empty()) { - GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_), "[Check][enable_dump] failed."); - } - std::string enable_dump_debug = std::to_string(false); + std::string enable_dump_debug; (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP_DEBUG, enable_dump_debug); enable_dump_debug_ = enable_dump_debug; - if (!enable_dump_debug_.empty()) { - GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_debug_), "[Check][enable_dump_debug] failed."); - } - if ((enable_dump_ == kEnableFlag) && (enable_dump_debug_ == kEnableFlag)) { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.enableDump and ge.exec.enableDumpDebug", - enable_dump_ + ", " + enable_dump_debug, - "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be set to 1 at the same time."})); - GELOGE(FAILED, "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be both set to 1 at the same time."); - return FAILED; - } + if ((enable_dump_ == kEnableFlag) || (enable_dump_debug_ == kEnableFlag)) { std::string dump_path; if (GetContext().GetOption(OPTION_EXEC_DUMP_PATH, dump_path) == GRAPH_SUCCESS) { - GE_CHK_STATUS_RET(CheckDumpPath(dump_path), "Check dump path failed."); if (!dump_path.empty() && dump_path[dump_path.size() - 1] != '/') { dump_path = dump_path + "/"; } @@ -263,21 +75,25 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOp GELOGI("Get dump path %s successfully", dump_path.c_str()); SetDumpPath(dump_path); } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpPath", - dump_path, - "ge.exec.dumpPath is not set."})); - GELOGE(FAILED, "[Check][dump_path] failed. Dump path is not set."); - return FAILED; + GELOGW("Dump path is not set"); } } - GE_CHK_STATUS_RET(SetDumpOptions(), "SetDumpOptions failed."); - - GE_CHK_STATUS_RET(SetDumpDebugOptions(), "SetDumpDebugOptions failed."); + if (enable_dump_ == kEnableFlag) { + std::string dump_step; + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + GELOGI("Get dump step %s successfully", dump_step.c_str()); + SetDumpStep(dump_step); + } + string dump_mode; + if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { + GELOGI("Get dump mode %s successfully", dump_mode.c_str()); + SetDumpMode(dump_mode); + } + AddPropertyValue(DUMP_ALL_MODEL, {}); + } - return SUCCESS; + SetDumpDebugOptions(); } // The following is the new dump scenario of the fusion operator @@ -437,20 +253,14 @@ void DumpProperties::CopyFrom(const DumpProperties &other) { } } -Status DumpProperties::SetDumpDebugOptions() { +void DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { GELOGD("Get dump debug mode %s successfully", dump_debug_mode.c_str()); } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpDebugMode", - dump_debug_mode, - "ge.exec.dumpDebugMode is not set."})); - GELOGE(PARAM_INVALID, "[Check][dump_debug_mode] failed. Dump debug mode is not set."); - - return PARAM_INVALID; + GELOGW("Dump debug mode is not set."); + return; } if (dump_debug_mode == OP_DEBUG_AICORE) { @@ -466,17 +276,10 @@ Status DumpProperties::SetDumpDebugOptions() { is_train_op_debug_ = true; op_debug_mode_ = kAllOverflow; } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpDebugMode", - dump_debug_mode, - "ge.exec.dumpDebugMode is invalid."})); - GELOGE(PARAM_INVALID, "[Set][DumpDebugOptions] failed, ge.exec.dumpDebugMode is invalid."); - return PARAM_INVALID; + GELOGW("ge.exec.dumpDebugMode is invalid."); } } else { GELOGI("ge.exec.enableDumpDebug is false or is not set."); } - return SUCCESS; } } // namespace ge diff --git a/ge/common/dump/dump_properties.h b/ge/common/dump/dump_properties.h index cbfc362d..98487491 100644 --- a/ge/common/dump/dump_properties.h +++ b/ge/common/dump/dump_properties.h @@ -23,7 +23,6 @@ #include namespace ge { -using Status = uint32_t; class DumpProperties { public: DumpProperties() = default; @@ -34,7 +33,7 @@ class DumpProperties { DumpProperties &operator=(const DumpProperties &dump); - Status InitByOptions(); + void InitByOptions(); void AddPropertyValue(const std::string &model, const std::set &layers); @@ -96,20 +95,7 @@ class DumpProperties { private: void CopyFrom(const DumpProperties &other); - Status SetDumpDebugOptions(); - - Status SetDumpOptions(); - - void Split(const std::string &s, std::vector &result, const char *delchar); - - Status CheckDumpStep(const std::string &dump_step); - - Status CheckDumpMode(const std::string &dump_mode); - - Status CheckDumpPath(const std::string &input); - - Status CheckEnableDump(const std::string &input); - + void SetDumpDebugOptions(); std::string enable_dump_; std::string enable_dump_debug_; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index 58b78f41..54e62d32 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -121,7 +121,7 @@ Status InnerSession::Initialize() { GE_CHK_RT_RET(rtSetDevice(GetContext().DeviceId())); DumpProperties dump_properties; - GE_CHK_STATUS_RET(dump_properties.InitByOptions(), "Init dump properties failed."); + dump_properties.InitByOptions(); GE_CHK_STATUS_RET(AddDumpProperties(dump_properties), "[Add][DumpProperties] failed."); ret = graph_manager_.Initialize(options_); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 5b8958b4..f808bce7 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -780,7 +780,6 @@ set(MULTI_PARTS_TEST_FILES "common/util_unittest.cc" "common/dump_manager_unittest.cc" "common/dump_op_unittest.cc" - "common/dump_properties_unittest.cc" "common/dump_exception_unittest.cc" "common/opdebug_register_unittest.cc" "common/format_transfer_unittest.cc" diff --git a/tests/ut/ge/common/dump_properties_unittest.cc b/tests/ut/ge/common/dump_properties_unittest.cc deleted file mode 100644 index 57809013..00000000 --- a/tests/ut/ge/common/dump_properties_unittest.cc +++ /dev/null @@ -1,126 +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 - -#define protected public -#define private public - -#include "common/dump/dump_properties.h" -#include "ge_local_context.h" -#include "ge/ge_api_types.h" -#include "common/debug/log.h" -#include "common/ge_inner_error_codes.h" - -namespace ge { -class UTEST_dump_properties : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -TEST_F(UTEST_dump_properties, check_dump_step) { - DumpProperties dp; - std::string dump_step{"0|3-5|10"}; - std::string unsupport_input1{"0|5-3|10"}; - std::string unsupport_input2{"one"}; - std::string unsupport_input3; - for (int i = 0; i < 200; ++i) { - unsupport_input3 += std::to_string(i) + "|"; - } - unsupport_input3.pop_back(); - Status st = dp.CheckDumpStep(dump_step); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckDumpStep(unsupport_input1); - EXPECT_NE(st, SUCCESS); - st = dp.CheckDumpStep(unsupport_input2); - EXPECT_NE(st, SUCCESS); - st = dp.CheckDumpStep(unsupport_input3); - EXPECT_NE(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, check_dump_mode) { - DumpProperties dp; - std::string dump_mode_1{"input"}; - std::string dump_mode_2{"output"}; - std::string dump_mode_3{"all"}; - std::string unsupport_input1{"mode1"}; - Status st = dp.CheckDumpMode(dump_mode_1); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckDumpMode(dump_mode_2); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckDumpMode(dump_mode_3); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckDumpMode(unsupport_input1); - EXPECT_NE(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, check_dump_path) { - DumpProperties dp; - std::string dump_path{"/tmp/"}; - std::string unsupport_input1{" \\unsupported"}; - Status st = dp.CheckDumpPath(dump_path); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckDumpPath(unsupport_input1); - EXPECT_NE(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, check_enable_dump) { - DumpProperties dp; - std::string enable_dump_t{"1"}; - std::string enable_dump_f{"0"}; - std::string unsupport_input1{"true"}; - std::string unsupport_input2{"false"}; - Status st = dp.CheckEnableDump(enable_dump_t); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckEnableDump(enable_dump_f); - EXPECT_EQ(st, SUCCESS); - st = dp.CheckEnableDump(unsupport_input1); - EXPECT_NE(st, SUCCESS); - st = dp.CheckEnableDump(unsupport_input2); - EXPECT_NE(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, init_by_options_success_1) { - DumpProperties dp; - std::map options {{OPTION_EXEC_ENABLE_DUMP, "1"}, - {OPTION_EXEC_DUMP_PATH, "/tmp/"}, - {OPTION_EXEC_DUMP_STEP, "0|1-3|10"}, - {OPTION_EXEC_DUMP_MODE, "all"}}; - GetThreadLocalContext().SetGlobalOption(options); - Status st = dp.InitByOptions(); - EXPECT_EQ(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, init_by_options_success_2) { - DumpProperties dp; - std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, - {OPTION_EXEC_DUMP_PATH, "/tmp/"}, - {OPTION_EXEC_DUMP_DEBUG_MODE, "aicore_overflow"}}; - GetThreadLocalContext().SetGlobalOption(options); - Status st = dp.InitByOptions(); - EXPECT_EQ(st, SUCCESS); -} - -TEST_F(UTEST_dump_properties, init_by_options_failed) { - DumpProperties dp; - std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, - {OPTION_EXEC_DUMP_PATH, "/tmp/"}}; - GetThreadLocalContext().SetGlobalOption(options); - Status st = dp.InitByOptions(); - EXPECT_NE(st, SUCCESS); -} -} // namespace ge \ No newline at end of file From 7fdb8aad95f00f2d360fba9bf727928f988d6adf Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 30 Jun 2021 19:51:10 +0800 Subject: [PATCH 122/226] Fix ut. --- ge/single_op/single_op.h | 1 + ge/single_op/single_op_model.cc | 42 ++++------------------ ge/single_op/single_op_model.h | 2 -- .../hybrid/node_executor/node_executor_unittest.cc | 5 +-- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/ge/single_op/single_op.h b/ge/single_op/single_op.h index 94d7227b..7e05dd5f 100755 --- a/ge/single_op/single_op.h +++ b/ge/single_op/single_op.h @@ -92,6 +92,7 @@ class DynamicSingleOp { rtStream_t stream_ = nullptr; size_t num_inputs_ = 0; size_t num_outputs_ = 0; + ComputeGraphPtr compute_graph_; }; } // namespace ge #endif // GE_SINGLE_OP_SINGLE_OP_H_ diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index e5d15beb..7f42f03c 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -529,44 +529,14 @@ Status SingleOpModel::BuildOp(StreamResource &resource, SingleOp &single_op) { return BuildTaskList(&resource, single_op); } -Status SingleOpModel::BuildModelTaskKernel(StreamResource *stream_resource, const TaskDef &task_def, - DynamicSingleOp &single_op) { - auto task_type = static_cast(task_def.type()); - const auto &context = task_type == RT_MODEL_TASK_KERNEL ? task_def.kernel().context() : - task_def.kernel_with_handle().context(); +Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &single_op) { + auto ge_model = model_helper_.GetGeModel(); + GE_CHECK_NOTNULL(ge_model); - auto kernel_type = static_cast(context.kernel_type()); - if (kernel_type == ccKernelType::TE) { - GELOGD("Building TBE task."); - TbeOpTask *tbe_task = nullptr; - GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def, &tbe_task)); - tbe_task->SetModelArgs(model_name_, model_id_); - if (tbe_task->tiling_buffer_ != nullptr) { - GELOGD("tiling buffer is not nullptr."); - tbe_task->stream_resource_ = stream_resource; - } - single_op.op_task_.reset(tbe_task); - } else if (kernel_type == ccKernelType::AI_CPU || kernel_type == ccKernelType::CUST_AI_CPU) { - GELOGD("Building AICPU_CC task"); - OpTask *task = nullptr; - uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; - GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); - GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); - task->SetModelArgs(model_name_, model_id_); - single_op.op_task_.reset(task); - } else { - GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, - "[Check][Param:TaskDef]Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", - context.kernel_type()); - REPORT_INNER_ERROR("E19999", - "BuildModelTaskKernel fail for got:%u not supported, Only TBE, AI_CPU, CUST_AI_CPU kernel are supported.", - context.kernel_type()); - return ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID; - } - return SUCCESS; -} + auto compute_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); + GE_CHECK_NOTNULL(compute_graph); + single_op.compute_graph_ = compute_graph; -Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &single_op) { if (tbe_tasks_.size() > 0) { const auto &task_def = tbe_tasks_[0]; GELOGD("Building TBE task."); diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index b5198e3d..45616d9a 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -71,8 +71,6 @@ class SingleOpModel { Status BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task); Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, uint64_t kernel_id); Status BuildCpuKernelTask(const domi::KernelDef &kernel_def, OpTask **task, uint64_t kernel_id); - Status BuildModelTaskKernel(StreamResource *stream_resource, const domi::TaskDef &task_def, - DynamicSingleOp &single_op); static void ParseOpModelParams(ModelHelper &model_helper, SingleOpModelParam ¶m); void ParseArgTable(OpTask *task, SingleOp &op); diff --git a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc index a6f5c2de..1d5bbb3d 100644 --- a/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/node_executor_unittest.cc @@ -87,6 +87,7 @@ TEST_F(NodeExecutorTest, TestGetOrCreateExecutor) { TEST_F(NodeExecutorTest, TestInitAndFinalize) { auto &manager = NodeExecutorManager::GetInstance(); manager.FinalizeExecutors(); + manager.FinalizeExecutors(); manager.EnsureInitialized(); manager.EnsureInitialized(); const NodeExecutor *executor = nullptr; @@ -97,7 +98,7 @@ TEST_F(NodeExecutorTest, TestInitAndFinalize) { manager.FinalizeExecutors(); ASSERT_FALSE(manager.executors_.empty()); manager.FinalizeExecutors(); - // ASSERT_TRUE(manager.executors_.empty()); - // ASSERT_TRUE(finalized); + ASSERT_TRUE(manager.executors_.empty()); + ASSERT_TRUE(finalized); } } // namespace ge From bf0ae87401ec1ef04fd803d79c832d53d35d1362 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 30 Jun 2021 20:09:47 +0800 Subject: [PATCH 123/226] Fix ut. --- ge/single_op/single_op_model.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 7f42f03c..9a52a83d 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -536,7 +536,6 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, auto compute_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); GE_CHECK_NOTNULL(compute_graph); single_op.compute_graph_ = compute_graph; - if (tbe_tasks_.size() > 0) { const auto &task_def = tbe_tasks_[0]; GELOGD("Building TBE task."); @@ -566,7 +565,7 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, dynamic_singleop_kernel_id)); if (aicpu_task->GetUnknownType() == DEPEND_COMPUTE) { - if (aicpu_tasks_.size() < 2) { + if (aicpu_tasks_.size() < 2) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Task]The copy task of the fourth operator was not found."); REPORT_INNER_ERROR("E19999", "The copy task of the fourth operator was not found."); return ACL_ERROR_GE_PARAM_INVALID; From 4d1ec067f3d497f6ea95ddbfc7af8d0e6da836cb Mon Sep 17 00:00:00 2001 From: lianghao Date: Wed, 30 Jun 2021 19:48:29 +0800 Subject: [PATCH 124/226] FindLastBpFromBpNode --- ge/graph/build/task_generator.cc | 44 ++++++++++------------ ge/graph/build/task_generator.h | 2 +- tests/ut/ge/graph/build/task_generator_unittest.cc | 4 +- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 5dee37d6..67289f73 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -793,7 +793,6 @@ Status TaskGenerator::AutoFindBpOpIndex(const ComputeGraphPtr &graph, ProfilingP GELOGI("Start AutoFindBpOpIndex"); NodePtr bp_node = nullptr; uint32_t current_idx = 0; - uint32_t netoutput_idx = 0; for (auto &node : graph->GetNodes(graph->GetGraphUnknownFlag())) { OpDescPtr op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); @@ -811,7 +810,6 @@ Status TaskGenerator::AutoFindBpOpIndex(const ComputeGraphPtr &graph, ProfilingP if (op_desc->GetName() == NODE_NAME_NET_OUTPUT) { if (bp_node == nullptr) { bp_node = node; - netoutput_idx = current_idx - 1; } } if (graph->GetNeedIteration()) { @@ -836,34 +834,30 @@ Status TaskGenerator::AutoFindBpOpIndex(const ComputeGraphPtr &graph, ProfilingP if (bp_node == nullptr) { GELOGW("not find bp_node."); return SUCCESS; - } else if (bp_node->GetName() == NODE_NAME_NET_OUTPUT) { - profiling_point.bp_index = netoutput_idx; - GELOGI("First bp name %s, idx %u", bp_node->GetName().c_str(), netoutput_idx); - } else { - profiling_point.bp_index = FindLastBpFromBpNode(graph, bp_node); } - return SUCCESS; + return FindLastBpFromBpNode(graph, bp_node, profiling_point.bp_index); } -uint32_t TaskGenerator::FindLastBpFromBpNode(const ComputeGraphPtr &graph, const NodePtr &bp_node) const { - uint32_t last_bp = 0; +Status TaskGenerator::FindLastBpFromBpNode(const ComputeGraphPtr &graph, const NodePtr &target_node, + uint32_t &bp_index) const { + bp_index = 0; + auto target_desc = target_node->GetOpDesc(); + GE_CHECK_NOTNULL(target_desc); OpDescPtr bp_op_desc = nullptr; - for (auto &in_anchor : bp_node->GetAllInDataAnchors()) { - auto out_anchor = in_anchor->GetPeerOutAnchor(); - if (out_anchor == nullptr || out_anchor->GetOwnerNode() == nullptr) { - continue; - } - auto out_node_desc = out_anchor->GetOwnerNode()->GetOpDesc(); - GE_CHECK_NOTNULL(out_node_desc); - if (bp_op_desc == nullptr || ((out_node_desc->GetId()) > (bp_op_desc->GetId()))) { - bp_op_desc = out_node_desc; + for (auto &in_node : target_node->GetInAllNodes()) { + GE_CHECK_NOTNULL(in_node); + auto in_node_desc = in_node->GetOpDesc(); + GE_CHECK_NOTNULL(in_node_desc); + if ((bp_op_desc == nullptr || (in_node_desc->GetId() > bp_op_desc->GetId())) && + (in_node_desc->GetStreamId() == target_desc->GetStreamId())){ + bp_op_desc = in_node_desc; } - GELOGI("bp_op_desc is %s, id is %ld", bp_op_desc->GetName().c_str(), bp_op_desc->GetId()); } if (bp_op_desc == nullptr) { - return last_bp; + GELOGI("Did not find bp node."); + return SUCCESS; } uint32_t current_idx = 0; for (auto &node : graph->GetNodes(graph->GetGraphUnknownFlag())) { @@ -871,12 +865,14 @@ uint32_t TaskGenerator::FindLastBpFromBpNode(const ComputeGraphPtr &graph, const GE_CHECK_NOTNULL(op_desc); current_idx++; if (op_desc->GetName() == bp_op_desc->GetName()) { - last_bp = current_idx; - GELOGI("First bp name %s, idx %u", op_desc->GetName().c_str(), last_bp); + bp_index = current_idx; + GELOGI("Find bp name %s, idx %u", op_desc->GetName().c_str(), bp_index); break; } } - return last_bp; + GELOGI("Last bp node[%s], type[%s], index[%u], stream id[%ld]", bp_op_desc->GetName().c_str(), + bp_op_desc->GetType().c_str(), bp_index, bp_op_desc->GetStreamId()); + return SUCCESS; } Status TaskGenerator::FindFpOfEnv(const ComputeGraphPtr &graph, const std::string &fp_point_str, diff --git a/ge/graph/build/task_generator.h b/ge/graph/build/task_generator.h index 6f460906..5d204c3c 100755 --- a/ge/graph/build/task_generator.h +++ b/ge/graph/build/task_generator.h @@ -116,7 +116,7 @@ class TaskGenerator { Status AutoFindFpOpIndex(const ComputeGraphPtr &graph, ProfilingPoint &profiling_point) const; Status AutoFindBpOpIndex(const ComputeGraphPtr &graph, ProfilingPoint &profiling_point, vector &all_reduce_nodes) const; - uint32_t FindLastBpFromBpNode(const ComputeGraphPtr &graph, const NodePtr &bp_node) const; + Status FindLastBpFromBpNode(const ComputeGraphPtr &graph, const NodePtr &bp_node, uint32_t &bp_index) const; Status FindFpOfEnv(const ComputeGraphPtr &graph, const std::string &fp_point_str, ProfilingPoint &profiling_point) const; diff --git a/tests/ut/ge/graph/build/task_generator_unittest.cc b/tests/ut/ge/graph/build/task_generator_unittest.cc index f869f1e0..1e865050 100644 --- a/tests/ut/ge/graph/build/task_generator_unittest.cc +++ b/tests/ut/ge/graph/build/task_generator_unittest.cc @@ -116,7 +116,9 @@ TEST_F(UtestTaskGeneratorTest, FindLastBpFromBpNode) { TaskGenerator task_generator(nullptr, 0); auto net_output = graph->FindNode("Node_Output"); // netoutput has no data input, return default value 0 - EXPECT_EQ(task_generator.FindLastBpFromBpNode(graph, net_output), 0); + uint32_t bp_index = 0; + EXPECT_EQ(task_generator.FindLastBpFromBpNode(graph, net_output, bp_index), 0); + EXPECT_EQ(bp_index, 2); } TEST_F(UtestTaskGeneratorTest, UpdateOpIsVarAttr) { From 55189da9b32224951143b395713954ab66b2bf42 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 30 Jun 2021 21:01:46 +0800 Subject: [PATCH 125/226] Add Magic in single_op. --- ge/single_op/task/tbe_task_builder.cc | 25 ++++++++++++++++++++++- ge/single_op/task/tbe_task_builder.h | 1 + tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 1 + tests/ut/ge/single_op/single_op_model_unittest.cc | 1 + tests/ut/ge/single_op/single_op_task_unittest.cc | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index db8ecfe2..c1bafed8 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -104,7 +104,7 @@ Status TbeTaskBuilder::DoRegisterBinary(const OpKernelBin &kernel_bin, void **bi binary.version = 0; binary.data = kernel_bin.GetBinData(); binary.length = kernel_bin.GetBinDataSize(); - binary.magic = param.core_type == 0 ? RT_DEV_BINARY_MAGIC_ELF : RT_DEV_BINARY_MAGIC_ELF_AIVEC; + GE_CHK_STATUS_RET_NOLOG(GetMagic(binary.magic)); Status ret = 0; if (task_def_.type() == RT_MODEL_TASK_ALL_KERNEL) { ret = rtRegisterAllKernel(&binary, bin_handle); @@ -416,4 +416,27 @@ Status TbeTaskBuilder::InitTilingInfo(TbeOpTask &task) { task.EnableDynamicSupport(node_, tiling_buffer, static_cast(max_size)); return SUCCESS; } + +Status TbeTaskBuilder::GetMagic(uint32_t &magic) const { + std::string json_string; + GE_IF_BOOL_EXEC(AttrUtils::GetStr(op_desc_, TVM_ATTR_NAME_MAGIC, json_string), + GELOGD("Get original type of session_graph_id.")); + if (json_string == "RT_DEV_BINARY_MAGIC_ELF") { + magic = RT_DEV_BINARY_MAGIC_ELF; + } else if (json_string == "RT_DEV_BINARY_MAGIC_ELF_AIVEC") { + magic = RT_DEV_BINARY_MAGIC_ELF_AIVEC; + } else if (json_string == "RT_DEV_BINARY_MAGIC_ELF_AICUBE") { + magic = RT_DEV_BINARY_MAGIC_ELF_AICUBE; + } else { + REPORT_INNER_ERROR("E19999", "Attr:%s in op:%s(%s), value:%s check invalid", + TVM_ATTR_NAME_MAGIC.c_str(), op_desc_->GetName().c_str(), + op_desc_->GetType().c_str(), json_string.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param] Attr:%s in op:%s(%s), value:%s check invalid", + TVM_ATTR_NAME_MAGIC.c_str(), op_desc_->GetName().c_str(), + op_desc_->GetType().c_str(), json_string.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + } // namespace ge diff --git a/ge/single_op/task/tbe_task_builder.h b/ge/single_op/task/tbe_task_builder.h index a202cbf1..6252feea 100755 --- a/ge/single_op/task/tbe_task_builder.h +++ b/ge/single_op/task/tbe_task_builder.h @@ -105,6 +105,7 @@ class TbeTaskBuilder { const SingleOpModelParam ¶m); Status DoRegisterBinary(const OpKernelBin &kernel_bin, void **bin_handle, const SingleOpModelParam ¶m) const; Status DoRegisterMeta(void *bin_handle); + Status GetMagic(uint32_t &magic) const; static Status DoRegisterFunction(void *bin_handle, const char *stub_name, const char *kernel_name); diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 1d1c4fa9..d1c51c67 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -153,6 +153,7 @@ TEST_F(UtestGeHybrid, task_update_tiling_info) { ge::AttrUtils::SetStr(op_desc, "compile_info_json", "json"); ge::AttrUtils::SetBool(op_desc, "support_dynamicshape", true); ge::AttrUtils::SetInt(op_desc, "op_para_size", 1); + ge::AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); auto node = graph->AddNode(op_desc); std::unique_ptr node_item; diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index 2c0073f5..23269814 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -338,6 +338,7 @@ TEST_F(UtestSingleOpModel, build_dynamic_task) { DynamicSingleOp single_op(0, &stream_mu, stream); model.model_helper_.model_ = ge_model; auto op_desc = std::make_shared("add", "Add"); + AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); std::vector kernelBin; TBEKernelPtr tbe_kernel = std::make_shared("name/Add", std::move(kernelBin)); op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index b0c98205..2424d209 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -54,6 +54,7 @@ TEST_F(UtestSingleOpTask, test_build_kernel_task) { auto graph = make_shared("graph"); auto op_desc = make_shared("Add", "Add"); + AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); std::vector kernelBin; TBEKernelPtr tbe_kernel = std::make_shared("name/Add", std::move(kernelBin)); op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); From 47852ba2b4e641685ce98f0c39fe97e415261524 Mon Sep 17 00:00:00 2001 From: wangkai Date: Wed, 30 Jun 2021 22:05:07 +0800 Subject: [PATCH 126/226] add ace header targets Signed-off-by: wangkai --- ge/common/CMakeLists.txt | 2 ++ ge/executor/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 313f1ff3..1872b4c2 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -95,6 +95,7 @@ target_link_libraries(ge_common PRIVATE $<$>:$> $<$>:$> $<$>:$> + $<$>:$> static_mmpa -Wl,--no-as-needed graph @@ -155,6 +156,7 @@ target_link_libraries(ge_common_static PRIVATE $<$>:$> $<$>:$> $<$>:$> + $<$>:$> ascend_protobuf_static json c_sec diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index f258dffe..44ba3131 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -186,6 +186,8 @@ target_include_directories(ge_executor SYSTEM PRIVATE ${CMAKE_BINARY_DIR}/proto/graphengine_protos #### yellow zone #### $<$>:${GE_DEPEND_DIR}/inc> + $<$>:$> + $<$>:$> #### blue zone #### $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> @@ -251,6 +253,8 @@ target_link_libraries(ge_executor_shared PRIVATE $<$>:$> $<$>:$> $<$>:$> + $<$>:$> + $<$>:$> -Wl,--no-as-needed ge_common runtime From 977d507d027bcc8c56a8f0a48b4de3000417d428 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Fri, 18 Jun 2021 09:32:57 +0800 Subject: [PATCH 127/226] check dump option --- ge/common/dump/dump_properties.cc | 243 ++++++++++++++++++++++--- ge/common/dump/dump_properties.h | 18 +- ge/session/inner_session.cc | 2 +- tests/ut/ge/CMakeLists.txt | 1 + tests/ut/ge/common/dump_properties_unittest.cc | 126 +++++++++++++ 5 files changed, 364 insertions(+), 26 deletions(-) create mode 100644 tests/ut/ge/common/dump_properties_unittest.cc diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index ef755540..84bdb7bf 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -18,6 +18,7 @@ #include #include +#include #include "common/ge/ge_util.h" #include "framework/common/util.h" @@ -37,6 +38,159 @@ const uint32_t kAtomicOverflow = (0x1 << 1); const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); } // namespace namespace ge { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::Split(const std::string &s, + std::vector &result, + const char *delchar) { + if (s.empty()) { + return; + } + result.clear(); + + char *buffer = new (std::nothrow)char[s.size() + 1]; + if (buffer == nullptr) { + GELOGE(FAILED, "[Split][string] failed while malloc memory, string value is:%s", s.c_str()); + REPORT_CALL_ERROR("E19999", "Memory malloc may fail when split string, get fatal exception, " + "string value is:%s", s.c_str()); + return; + } + buffer[s.size()] = '\0'; + errno_t e = strcpy_s(buffer, s.size() + 1, s.c_str()); + if (e != EOK) { + delete[] buffer; + return; + } + char *context = nullptr; + char *p = strtok_s(buffer, delchar, &context); + while (p != nullptr) { + result.emplace_back(p); + p = strtok_s(nullptr, delchar, &context); + } + delete[] buffer; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpStep(const std::string &dump_step) { + std::string modified_dum_step = dump_step + "|"; + std::smatch result; + std::vector match_vecs; + std::regex pattern(R"((\d{1,}-\d{1,}\||\d{1,}\|)+)"); + if (regex_match(modified_dum_step, result, pattern)) { + Split(result.str(), match_vecs, "|"); + if (match_vecs.empty()) { + REPORT_CALL_ERROR("E19999", "Split may get fatal exception, dump_step:%s.", dump_step.c_str()); + GELOGE(FAILED, "[Check][Param] failed. Split may get fatal exception, ge.exec.dumpStep:%s.", dump_step.c_str()); + return FAILED; + } + // 100 is the max sets of dump steps. + if (match_vecs.size() > 100) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported, only support dump <= 100 sets of data"})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "dump_step only support dump <= 100 sets of data.", dump_step.c_str()); + return PARAM_INVALID; + } + for (const auto &match_vec : match_vecs) { + std::vector vec_after_split; + Split(match_vec, vec_after_split, "-"); + if (match_vecs.empty()) { + REPORT_CALL_ERROR("E19999", "Split may get fatal exception."); + GELOGE(FAILED, "[Check][Param] failed, split may get fatal exception."); + return FAILED; + } + if (vec_after_split.size() > 1) { + if (std::atoi(vec_after_split[0].c_str()) >= std::atoi(vec_after_split[1].c_str())) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported." + "in range steps, the first step is >= second step, correct example:'0|5|10-20"})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "in range steps, the first step is >= second step, correct example:'0|5|10-20'", dump_step.c_str()); + return PARAM_INVALID; + } + } + } + } else { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpStep", + dump_step.c_str(), + " is not supported, correct example:'0|5|10|50-100."})); + GELOGE(PARAM_INVALID, "[Check][Param] get dump_step value:%s, " + "dump_step string style is error, correct example:'0|5|10|50-100.'", dump_step.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpMode(const std::string &dump_mode) { + const std::set dump_mode_list = {"input", "output", "all"}; + std::set::iterator iter; + + if ((iter = dump_mode_list.find(dump_mode)) == dump_mode_list.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpMode", + dump_mode.c_str(), + " is not supported, should be one of the following:[input, output, all]"})); + GELOGE(PARAM_INVALID, "[Check][Param] the dump_debug_mode:%s, is is not supported," + "should be one of the following:[input, output, all].", dump_mode.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpPath(const std::string &input) { + if (mmIsDir(input.c_str()) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " is not a directory."})); + GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, is not directory.", input.c_str()); + return PARAM_INVALID; + } + char trusted_path[MMPA_MAX_PATH] = { "\0" }; + if (mmRealPath(input.c_str(), trusted_path, MMPA_MAX_PATH) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " dumpPath invalid."})); + GELOGE(PARAM_INVALID, "[Check][Param] the dumpPath:%s, is invalid.", input.c_str()); + return PARAM_INVALID; + } + if (mmAccess2(trusted_path, M_R_OK | M_W_OK) != EN_OK) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + input.c_str(), + " does't have read, write permissions."})); + GELOGE(PARAM_INVALID, "[Check][Param] the path:%s, does't have read, write permissions.", input.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckEnableDump(const std::string &input) { + std::set enable_dump_option_list = {"1", "0"}; + auto it = enable_dump_option_list.find(input); + if (it == enable_dump_option_list.end()) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.enableDump", + input.c_str(), + " only support 1 or 0."})); + GELOGE(PARAM_INVALID, "[Check][Param] Not support ge.exec.enableDump or ge.exec.enableDumpDebug format:%s, " + "only support 1 or 0.", input.c_str()); + return PARAM_INVALID; + } + return SUCCESS; +} + FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties::DumpProperties(const DumpProperties &other) { CopyFrom(other); } @@ -47,7 +201,26 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: return *this; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOptions() { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { + if (enable_dump_ == kEnableFlag) { + std::string dump_step; + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); + GELOGI("Get dump step %s successfully", dump_step.c_str()); + SetDumpStep(dump_step); + } + string dump_mode = "output"; + if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { + GELOGI("Get dump mode %s successfully", dump_mode.c_str()); + GE_CHK_STATUS_RET(CheckDumpMode(dump_mode), "[Check][dump_mode] failed."); + SetDumpMode(dump_mode); + } + AddPropertyValue(DUMP_ALL_MODEL, {}); + } + return SUCCESS; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOptions() { enable_dump_.clear(); enable_dump_debug_.clear(); dump_path_.clear(); @@ -57,17 +230,32 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOpti is_infer_op_debug_ = false; op_debug_mode_ = 0; - std::string enable_dump; + std::string enable_dump = std::to_string(false); (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP, enable_dump); enable_dump_ = enable_dump; + if (!enable_dump_.empty()) { + GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_), "[Check][enable_dump] failed."); + } - std::string enable_dump_debug; + std::string enable_dump_debug = std::to_string(false); (void)GetContext().GetOption(OPTION_EXEC_ENABLE_DUMP_DEBUG, enable_dump_debug); enable_dump_debug_ = enable_dump_debug; - + if (!enable_dump_debug_.empty()) { + GE_CHK_STATUS_RET(CheckEnableDump(enable_dump_debug_), "[Check][enable_dump_debug] failed."); + } + if ((enable_dump_ == kEnableFlag) && (enable_dump_debug_ == kEnableFlag)) { + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.enableDump and ge.exec.enableDumpDebug", + enable_dump_ + ", " + enable_dump_debug, + "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be set to 1 at the same time."})); + GELOGE(FAILED, "ge.exec.enableDump and ge.exec.enableDumpDebug cannot be both set to 1 at the same time."); + return FAILED; + } if ((enable_dump_ == kEnableFlag) || (enable_dump_debug_ == kEnableFlag)) { std::string dump_path; if (GetContext().GetOption(OPTION_EXEC_DUMP_PATH, dump_path) == GRAPH_SUCCESS) { + GE_CHK_STATUS_RET(CheckDumpPath(dump_path), "Check dump path failed."); if (!dump_path.empty() && dump_path[dump_path.size() - 1] != '/') { dump_path = dump_path + "/"; } @@ -75,25 +263,21 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitByOpti GELOGI("Get dump path %s successfully", dump_path.c_str()); SetDumpPath(dump_path); } else { - GELOGW("Dump path is not set"); + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpPath", + dump_path, + "ge.exec.dumpPath is not set."})); + GELOGE(FAILED, "[Check][dump_path] failed. Dump path is not set."); + return FAILED; } } - if (enable_dump_ == kEnableFlag) { - std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { - GELOGI("Get dump step %s successfully", dump_step.c_str()); - SetDumpStep(dump_step); - } - string dump_mode; - if (GetContext().GetOption(OPTION_EXEC_DUMP_MODE, dump_mode) == GRAPH_SUCCESS) { - GELOGI("Get dump mode %s successfully", dump_mode.c_str()); - SetDumpMode(dump_mode); - } - AddPropertyValue(DUMP_ALL_MODEL, {}); - } + GE_CHK_STATUS_RET(SetDumpOptions(), "SetDumpOptions failed."); + + GE_CHK_STATUS_RET(SetDumpDebugOptions(), "SetDumpDebugOptions failed."); - SetDumpDebugOptions(); + return SUCCESS; } // The following is the new dump scenario of the fusion operator @@ -253,14 +437,20 @@ void DumpProperties::CopyFrom(const DumpProperties &other) { } } -void DumpProperties::SetDumpDebugOptions() { +Status DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { GELOGD("Get dump debug mode %s successfully", dump_debug_mode.c_str()); } else { - GELOGW("Dump debug mode is not set."); - return; + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpDebugMode", + dump_debug_mode, + "ge.exec.dumpDebugMode is not set."})); + GELOGE(PARAM_INVALID, "[Check][dump_debug_mode] failed. Dump debug mode is not set."); + + return PARAM_INVALID; } if (dump_debug_mode == OP_DEBUG_AICORE) { @@ -276,10 +466,17 @@ void DumpProperties::SetDumpDebugOptions() { is_train_op_debug_ = true; op_debug_mode_ = kAllOverflow; } else { - GELOGW("ge.exec.dumpDebugMode is invalid."); + REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), + std::vector({ + "ge.exec.dumpDebugMode", + dump_debug_mode, + "ge.exec.dumpDebugMode is invalid."})); + GELOGE(PARAM_INVALID, "[Set][DumpDebugOptions] failed, ge.exec.dumpDebugMode is invalid."); + return PARAM_INVALID; } } else { GELOGI("ge.exec.enableDumpDebug is false or is not set."); } + return SUCCESS; } } // namespace ge diff --git a/ge/common/dump/dump_properties.h b/ge/common/dump/dump_properties.h index 98487491..cbfc362d 100644 --- a/ge/common/dump/dump_properties.h +++ b/ge/common/dump/dump_properties.h @@ -23,6 +23,7 @@ #include namespace ge { +using Status = uint32_t; class DumpProperties { public: DumpProperties() = default; @@ -33,7 +34,7 @@ class DumpProperties { DumpProperties &operator=(const DumpProperties &dump); - void InitByOptions(); + Status InitByOptions(); void AddPropertyValue(const std::string &model, const std::set &layers); @@ -95,7 +96,20 @@ class DumpProperties { private: void CopyFrom(const DumpProperties &other); - void SetDumpDebugOptions(); + Status SetDumpDebugOptions(); + + Status SetDumpOptions(); + + void Split(const std::string &s, std::vector &result, const char *delchar); + + Status CheckDumpStep(const std::string &dump_step); + + Status CheckDumpMode(const std::string &dump_mode); + + Status CheckDumpPath(const std::string &input); + + Status CheckEnableDump(const std::string &input); + std::string enable_dump_; std::string enable_dump_debug_; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index aabbe19c..b3df08ce 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -109,7 +109,7 @@ Status InnerSession::Initialize() { GE_CHK_RT_RET(rtSetDevice(GetContext().DeviceId())); DumpProperties dump_properties; - dump_properties.InitByOptions(); + GE_CHK_STATUS_RET(dump_properties.InitByOptions(), "Init dump properties failed."); GE_CHK_STATUS_RET(AddDumpProperties(dump_properties), "[Add][DumpProperties] failed."); ret = graph_manager_.Initialize(options_); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index cf573343..d7568ccc 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -774,6 +774,7 @@ set(MULTI_PARTS_TEST_FILES "common/util_unittest.cc" "common/dump_manager_unittest.cc" "common/dump_op_unittest.cc" + "common/dump_properties_unittest.cc" "common/dump_exception_unittest.cc" "common/opdebug_register_unittest.cc" "common/format_transfer_unittest.cc" diff --git a/tests/ut/ge/common/dump_properties_unittest.cc b/tests/ut/ge/common/dump_properties_unittest.cc new file mode 100644 index 00000000..57809013 --- /dev/null +++ b/tests/ut/ge/common/dump_properties_unittest.cc @@ -0,0 +1,126 @@ +/** + * 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 + +#define protected public +#define private public + +#include "common/dump/dump_properties.h" +#include "ge_local_context.h" +#include "ge/ge_api_types.h" +#include "common/debug/log.h" +#include "common/ge_inner_error_codes.h" + +namespace ge { +class UTEST_dump_properties : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UTEST_dump_properties, check_dump_step) { + DumpProperties dp; + std::string dump_step{"0|3-5|10"}; + std::string unsupport_input1{"0|5-3|10"}; + std::string unsupport_input2{"one"}; + std::string unsupport_input3; + for (int i = 0; i < 200; ++i) { + unsupport_input3 += std::to_string(i) + "|"; + } + unsupport_input3.pop_back(); + Status st = dp.CheckDumpStep(dump_step); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input1); + EXPECT_NE(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input2); + EXPECT_NE(st, SUCCESS); + st = dp.CheckDumpStep(unsupport_input3); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_dump_mode) { + DumpProperties dp; + std::string dump_mode_1{"input"}; + std::string dump_mode_2{"output"}; + std::string dump_mode_3{"all"}; + std::string unsupport_input1{"mode1"}; + Status st = dp.CheckDumpMode(dump_mode_1); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(dump_mode_2); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(dump_mode_3); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpMode(unsupport_input1); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_dump_path) { + DumpProperties dp; + std::string dump_path{"/tmp/"}; + std::string unsupport_input1{" \\unsupported"}; + Status st = dp.CheckDumpPath(dump_path); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckDumpPath(unsupport_input1); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, check_enable_dump) { + DumpProperties dp; + std::string enable_dump_t{"1"}; + std::string enable_dump_f{"0"}; + std::string unsupport_input1{"true"}; + std::string unsupport_input2{"false"}; + Status st = dp.CheckEnableDump(enable_dump_t); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckEnableDump(enable_dump_f); + EXPECT_EQ(st, SUCCESS); + st = dp.CheckEnableDump(unsupport_input1); + EXPECT_NE(st, SUCCESS); + st = dp.CheckEnableDump(unsupport_input2); + EXPECT_NE(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_success_1) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}, + {OPTION_EXEC_DUMP_STEP, "0|1-3|10"}, + {OPTION_EXEC_DUMP_MODE, "all"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_EQ(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_success_2) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}, + {OPTION_EXEC_DUMP_DEBUG_MODE, "aicore_overflow"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_EQ(st, SUCCESS); +} + +TEST_F(UTEST_dump_properties, init_by_options_failed) { + DumpProperties dp; + std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, + {OPTION_EXEC_DUMP_PATH, "/tmp/"}}; + GetThreadLocalContext().SetGlobalOption(options); + Status st = dp.InitByOptions(); + EXPECT_NE(st, SUCCESS); +} +} // namespace ge \ No newline at end of file From 2daa03a052674a47a576fd834b20fc2e8cbf1db6 Mon Sep 17 00:00:00 2001 From: lianghuikang <505519763@qq.com> Date: Wed, 30 Jun 2021 09:08:41 +0800 Subject: [PATCH 128/226] op_select_implmode support high_precision_for_all and high_performance_for_all --- ge/ir_build/option_utils.cc | 9 +++++++-- ge/offline/main.cc | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ge/ir_build/option_utils.cc b/ge/ir_build/option_utils.cc index 16586c4e..7287fe91 100755 --- a/ge/ir_build/option_utils.cc +++ b/ge/ir_build/option_utils.cc @@ -50,6 +50,8 @@ const std::set kBufferOptimizeSupportOption = {"l1_optimize", "l2_o const char *const kBufferOptimizeSupport = "only support l2_optimize, off_optimize"; const char *const IR_OPTION_OP_SELECT_IMPLMODE_DEFAULT = "high_performance"; const char *const IR_OPTION_OP_SELECT_IMPLMODE_PRECISON = "high_precision"; +const char *const IR_OPTION_OP_SELECT_IMPLMODE_HIGH_PRECISION_FOR_ALL = "high_precision_for_all"; +const char *const IR_OPTION_OP_SELECT_IMPLMODE_HIGH_PERFORMANCE_FOR_ALL = "high_performance_for_all"; const char *const kInputShapeSample1 = "\"input_name1:n1,c1,h1,w1\""; const char *const kInputShapeSample2 = "\"input_name1:1,3,224,224\""; const char *const kSplitError1 = "size not equal to 2 split by \":\""; @@ -57,7 +59,8 @@ const char *const kEmptyError = "can not be empty"; const char *const kFloatNumError = "exist float number"; 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 kSelectImplmodeError = "only support high_performance, high_precision, " + "high_precision_for_all, high_performance_for_all"; 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"; @@ -782,7 +785,9 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: op_select_implmode = IR_OPTION_OP_SELECT_IMPLMODE_DEFAULT; } else { if (op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_DEFAULT && - op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { + op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON && + op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_HIGH_PRECISION_FOR_ALL && + op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_HIGH_PERFORMANCE_FOR_ALL) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kSelectImplmodeError}); diff --git a/ge/offline/main.cc b/ge/offline/main.cc index 4837653f..bc3b823d 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -143,7 +143,8 @@ DEFINE_string(output_type, "", DEFINE_string(op_select_implmode, "", "Optional; op select implmode! " - "Support high_precision, high_performance."); + "Support high_precision, high_performance, " + "high_precision_for_all, high_performance_for_all."); DEFINE_string(optypelist_for_implmode, "", "Optional; Nodes need use implmode selected in op_select_implmode " @@ -311,8 +312,8 @@ class GFlagUtils { "scenarios by using a configuration file.\n" " --auto_tune_mode Set tune mode. E.g.: \"GA,RL\", support configure multiple, spit by ,\n" " --op_bank_path Set the path of the custom repository generated after operator tuning with Auto Tune.\n" - " --op_select_implmode Set op select implmode. Support high_precision, high_performance. " - "default: high_performance\n" + " --op_select_implmode Set op select implmode. Support high_precision, high_performance, " + "high_precision_for_all, high_performance_for_all. default: high_performance\n" " --optypelist_for_implmode Appoint which op to select implmode, cooperated with op_select_implmode.\n" " Separate multiple nodes with commas (,). Use double quotation marks (\") " "to enclose each argument. E.g.: \"node_name1,node_name2\"\n" From 81d226b36b26d4253d32428fd48bfe256b9d3d21 Mon Sep 17 00:00:00 2001 From: lichun Date: Thu, 1 Jul 2021 16:12:24 +0800 Subject: [PATCH 129/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.h | 1 + .../compiledsubgraph/known_node_executor.cc | 21 +++++--- .../compiledsubgraph/known_node_executor.h | 2 + ge/offline/main.cc | 4 +- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 57 +++++++++++++++++++++- 5 files changed, 75 insertions(+), 10 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index 1e964855..daf0c7e6 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -300,6 +300,7 @@ class DavinciModel { return op_list_.at(index); } + void SetGlobalStep(void *global_step) { global_step_addr_ = global_step; } void *GetGlobalStep() const { return global_step_addr_; } // get task info for profiling diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 4db223e0..ea6e2965 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -182,6 +182,19 @@ Status KnownNodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) cons return SUCCESS; } +void KnownNodeExecutor::SettingDaviciModel(const HybridModel &model, const NodePtr &node, + std::shared_ptr &davinci_model) const { + // set known node flag as true + davinci_model->SetKnownNode(true); + davinci_model->SetId(model.GetModelId()); + davinci_model->SetDumpModelName(model.GetModelName()); + davinci_model->SetOmName(model.GetOmName()); + TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); + davinci_model->SetKnownShapeGlobalStep(global_step_var->MutableData()); + // set model id as root node's node id + davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); +} + Status KnownNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node, shared_ptr &task) const { GELOGI("[%s] KnownNodeExecutor::LoadTask in.", node->GetName().c_str()); @@ -199,13 +212,7 @@ Status KnownNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node std::shared_ptr davinci_model = MakeShared(0, nullptr); GE_CHECK_NOTNULL(davinci_model); - // set known node flag as true - davinci_model->SetKnownNode(true); - davinci_model->SetId(model.GetModelId()); - davinci_model->SetDumpModelName(model.GetModelName()); - davinci_model->SetOmName(model.GetOmName()); - // set model id as root node's node id - davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); + SettingDaviciModel(model, node, davinci_model); GELOGD("KnownNodeExecutor::LoadTask node id %ld.", node->GetOpDesc()->GetId()); GE_CHK_STATUS_RET(davinci_model->Assign(ge_model), diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h index 11cda846..475feeb1 100644 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h @@ -59,6 +59,8 @@ class KnownNodeExecutor : public NodeExecutor { const NodePtr &node, GeModelPtr &ge_model, ComputeGraphPtr &graph); + void SettingDaviciModel(const HybridModel &model, const NodePtr &node, + std::shared_ptr &davinci_model) const; }; } // namespace hybrid } // namespace ge diff --git a/ge/offline/main.cc b/ge/offline/main.cc index bc3b823d..a50ff931 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -1150,9 +1150,9 @@ domi::Status GenerateSingleOp(const std::string& json_file_path) { if (ret != SUCCESS) { DOMI_LOGE("Compile op failed. ge ret = %u, op index = %d", ret, index); ret = domi::FAILED; - break; + } else { + GELOGI("Compile op success. op index = %d, output = %s", index, output_path.c_str()); } - GELOGI("Compile op success. op index = %d, output = %s", index, output_path.c_str()); index += 1; } diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index 98e985f7..a8367130 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -27,6 +27,7 @@ #undef protected #include "graph/manager/graph_mem_allocator.h" #include "../graph/passes/graph_builder_utils.h" +#include "../inc/graph/utils/graph_utils.h" using namespace std; using namespace testing; @@ -48,6 +49,34 @@ class KnownNodeTaskMock : public KnownNodeTask { }; } +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; +} + +static ComputeGraphPtr BuildDataDirectConnectGraph() { + const char *kRefIndex = "_parent_node_index"; + ge::ut::GraphBuilder builder("subgraph"); + auto data = builder.AddNode("Data", "Data", 1, 1); + auto netoutput = builder.AddNode("NetOutput", "NetOutput", 1, 1); + (void)AttrUtils::SetInt(netoutput->GetOpDesc()->MutableInputDesc(0), kRefIndex, 0); + + builder.AddDataEdge(data, 0, netoutput, 0); + return builder.GetGraph(); +} + TEST_F(UnknownNodeExecutorTest, test_init_davinci_model) { auto davinci_model = std::make_shared(0, nullptr); davinci_model->SetDeviceId(0); @@ -88,4 +117,30 @@ TEST_F(UnknownNodeExecutorTest, TestParseAttrForAllocatingOutputs) { ASSERT_EQ(node_item.ref_outputs[1], const_node); ASSERT_EQ(node_item.reuse_inputs.size(), 1); ASSERT_EQ(node_item.reuse_inputs[0], 0); -} \ No newline at end of file +} + +TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { + OpDescPtr op_desc = CreateOpDesc("PartitionedCall", "PartitionedCall"); + auto root_graph = make_shared("root_graph"); + auto node = root_graph->AddNode(op_desc); + node->SetOwnerComputeGraph(root_graph); + auto sub_graph = BuildDataDirectConnectGraph(); + sub_graph->SetParentGraph(root_graph); + sub_graph->SetParentNode(node); + node->GetOpDesc()->AddSubgraphName("subgraph"); + node->GetOpDesc()->SetSubgraphInstanceName(0, "subgraph"); + root_graph->AddSubgraph("subgraph", sub_graph); + + GeRootModelPtr ge_root_model = make_shared(root_graph); + HybridModel hybrid_model(ge_root_model); + auto *step_id = new int64_t[1]; + step_id[0] = 520; + std::unique_ptr tensor_value; + tensor_value.reset(new(std::nothrow)TensorValue((void*)step_id, sizeof(step_id))); + hybrid_model.variable_tensors_.insert({"ge_global_step", std::move(tensor_value)}); + + KnownNodeExecutor known_node_executor; + std::shared_ptr davinci_model = MakeShared(0, nullptr); + known_node_executor.SettingDaviciModel(hybrid, node, davinci_model); + EXPECT_EQ(davinci_model->global_step_addr_, 520); +} From 1cc845d733e9146317b2c5f99ed2a31f9cfa9761 Mon Sep 17 00:00:00 2001 From: wqtshg Date: Thu, 1 Jul 2021 17:47:37 +0800 Subject: [PATCH 130/226] delete useless code --- ge/graph/build/model_builder.cc | 1 - ge/graph/manager/graph_var_manager.cc | 49 ------------------------ ge/graph/manager/graph_var_manager.h | 15 -------- ge/graph/manager/trans_var_data_utils.cc | 66 -------------------------------- ge/graph/manager/trans_var_data_utils.h | 11 ------ 5 files changed, 142 deletions(-) diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index e35e4e7d..2816f170 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -32,7 +32,6 @@ #include "graph/ge_attr_value.h" #include "graph/ge_context.h" #include "external/graph/ge_error_codes.h" -#include "graph/manager/graph_mem_allocator.h" #include "graph/manager/graph_var_manager.h" #include "graph/optimize/common/params.h" #include "external/graph/types.h" diff --git a/ge/graph/manager/graph_var_manager.cc b/ge/graph/manager/graph_var_manager.cc index ced8465f..89a4e45b 100755 --- a/ge/graph/manager/graph_var_manager.cc +++ b/ge/graph/manager/graph_var_manager.cc @@ -194,35 +194,6 @@ ge::Status VarResource::GetBroadCastInfo(uint32_t graph_id, const string &var_na return SUCCESS; } -ge::Status VarResource::SyncVarData2BroadCast(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr) { - GE_CHECK_NOTNULL(base_ptr); - GELOGI("SyncVarData2BroadCast graph_id: %u, var_name: %s.", graph_id, var_name.c_str()); - - VarBroadCastInfo var_broadcast_info = var_broad_cast_info_[graph_id][var_name]; - uint8_t *dst_addr = base_ptr + var_broadcast_info.input_offset; - - return ge::TransVarDataUtils::SyncVarData2BroadCast(var_name, var_tensor_desc, dst_addr, - var_broadcast_info.input_size, session_id_); -} - -ge::Status VarResource::SyncBroadCastData2Var(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr) { - GELOGI("SyncBroadCastData2Var var_name: %s", var_name.c_str()); - - VarBroadCastInfo var_broadcast_info = var_broad_cast_info_[graph_id][var_name]; - // subgraph base_ptr could be nullptr, task it as base 0 - uint8_t *dst_addr = base_ptr + var_broadcast_info.output_offset; - - return ge::TransVarDataUtils::SyncBroadCastData2Var(dst_addr, var_broadcast_info.output_size, var_name, - var_tensor_desc, session_id_); -} - -ge::Status VarResource::SyncVarData(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr) { - return SyncVarData2BroadCast(graph_id, var_name, var_tensor_desc, base_ptr); -} - bool VarResource::IsVarAddr(const int64_t &offset) { return var_offset_map_.count(offset) > 0; } rtMemType_t VarResource::GetVarMemType(const int64_t &offset) { @@ -638,16 +609,6 @@ bool VarManager::IsVarExist(const std::string &var_name) { return var_resource_->IsVarExist(var_name); } -ge::Status VarManager::SyncVarData(uint32_t graph_id, const std::string &var_name, const GeTensorDesc &var_tensor_desc, - uint8_t *base_ptr) { - std::lock_guard lock(mutex_); - if (var_resource_ == nullptr) { - GELOGW("VarManager has not been init."); - return ge::INTERNAL_ERROR; - } - return var_resource_->SyncVarData(graph_id, var_name, var_tensor_desc, base_ptr); -} - ge::Status VarManager::GetCurVarDesc(const std::string &var_name, ge::GeTensorDesc &tensor_desc) { std::lock_guard lock(mutex_); GELOGI("VarManager::GetCurVarDesc var_name = %s.", var_name.c_str()); @@ -701,16 +662,6 @@ ge::Status VarManager::RenewCurVarDesc(const std::string &var_name, ge::OpDescPt return var_resource_->RenewCurVarDesc(var_name, std::move(op_desc)); } -ge::Status VarManager::SyncBroadCastData2Var(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr) { - std::lock_guard lock(mutex_); - if (var_resource_ == nullptr) { - GELOGW("VarManager has not been init."); - return ge::INTERNAL_ERROR; - } - return var_resource_->SyncBroadCastData2Var(graph_id, var_name, var_tensor_desc, base_ptr); -} - bool VarManager::IsVarAddr(const int64_t &offset) { std::lock_guard lock(mutex_); if (var_resource_ == nullptr) { diff --git a/ge/graph/manager/graph_var_manager.h b/ge/graph/manager/graph_var_manager.h index 736466c4..f2b68e79 100755 --- a/ge/graph/manager/graph_var_manager.h +++ b/ge/graph/manager/graph_var_manager.h @@ -118,15 +118,6 @@ class VarResource { ge::Status GetBroadCastInfo(uint32_t graph_id, const string &var_name, VarBroadCastInfo &broad_cast_info); - ge::Status SyncVarData2BroadCast(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr); - - ge::Status SyncBroadCastData2Var(uint32_t graph_id, const std::string &var_name, - const GeTensorDesc &var_tensor_desc, uint8_t *base_ptr); - - ge::Status SyncVarData(uint32_t graph_id, const std::string &var_name, const GeTensorDesc &var_tensor_desc, - uint8_t *base_ptr); - Status SetTransRoad(const std::string &var_name, const VarTransRoad &trans_road) { if (var_to_trans_road_.find(var_name) != var_to_trans_road_.end()) { GELOGW("Var name: %s has already set.", var_name.c_str()); @@ -234,16 +225,10 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY VarManager { ge::Status GetVarAddr(const std::string &var_name, const ge::GeTensorDesc &tensor_desc, uint8_t **dev_ptr); - ge::Status SyncVarData(uint32_t graph_id, const std::string &var_name, const GeTensorDesc &var_tensor_desc, - uint8_t *base_ptr); - ge::Status SaveBroadCastInfo(uint32_t graph_id, const VarBroadCastInfo &broad_cast_info); ge::Status GetBroadCastInfo(uint32_t graph_id, const string &var_name, VarBroadCastInfo &broad_cast_info); - ge::Status SyncBroadCastData2Var(uint32_t graph_id, const std::string &var_name, const GeTensorDesc &var_tensor_desc, - uint8_t *base_ptr); - ge::Status GetCurVarDesc(const std::string &var_name, ge::GeTensorDesc &tensor_desc); ge::Status RenewCurVarDesc(const std::string &var_name, ge::OpDescPtr op_desc); diff --git a/ge/graph/manager/trans_var_data_utils.cc b/ge/graph/manager/trans_var_data_utils.cc index 4c25dff1..2e6ce454 100644 --- a/ge/graph/manager/trans_var_data_utils.cc +++ b/ge/graph/manager/trans_var_data_utils.cc @@ -415,72 +415,6 @@ Status CopyTensorFromSrcVarNode(const NodePtr &var_src, return SUCCESS; } } // namespace -Status TransVarDataUtils::SyncVarData2BroadCast(const string &var_name, const ge::GeTensorDesc &src_tensor_desc, - uint8_t *dst_addr, int64_t dst_addr_size, uint64_t session_id) { - GE_CHK_BOOL_RET_STATUS(dst_addr != nullptr, FAILED, "[Check][Param] dst addr is nullptr."); - uint8_t *src_host_addr = nullptr; - int64_t src_addr_size = 0; - GE_MAKE_GUARD_RTMEM(src_host_addr); - GE_CHK_STATUS_RET(SyncTensorToHost(var_name, src_tensor_desc, &src_host_addr, src_addr_size, session_id)); - - GELOGI("src_addr_size: %ld, dst_addr_size: %ld", src_addr_size, dst_addr_size); - GE_CHK_BOOL_RET_STATUS(src_addr_size == dst_addr_size, FAILED, - "[Check][Param] src_addr_size:%ld not equal to dst_addr_size:%ld", - src_addr_size, dst_addr_size); - - GE_CHK_RT_RET(rtMemcpy(dst_addr, dst_addr_size, src_host_addr, src_addr_size, RT_MEMCPY_HOST_TO_DEVICE)); - return SUCCESS; -} - -Status TransVarDataUtils::SyncBroadCastData2Var(uint8_t *src_addr, int64_t src_addr_size, const string &var_name, - const ge::GeTensorDesc &dst_tensor_desc, uint64_t session_id) { - GE_CHK_BOOL_RET_STATUS(src_addr != nullptr, FAILED, "[Check][Param] src addr is nullptr. "); - uint8_t *host_addr = nullptr; - GE_MAKE_GUARD_RTMEM(host_addr); - GE_CHK_RT_RET(rtMallocHost(reinterpret_cast(&host_addr), src_addr_size)); - GE_CHK_RT_RET(rtMemcpy(host_addr, src_addr_size, src_addr, src_addr_size, RT_MEMCPY_DEVICE_TO_HOST)); - - GE_CHK_STATUS_RET( - SyncTensorToDevice(var_name, reinterpret_cast(host_addr), src_addr_size, dst_tensor_desc, session_id)); - - return SUCCESS; -} - -Status TransVarDataUtils::SyncTensorToHost(const string &var_name, const ge::GeTensorDesc &src_tensor_desc, - uint8_t **host_addr, int64_t &src_tensor_size, uint64_t session_id) { - GE_CHK_STATUS_RET(ge::TensorUtils::GetSize(src_tensor_desc, src_tensor_size), "[Get][Size] from TensorDesc failed"); - - uint8_t *src_addr = nullptr; - GE_CHK_STATUS_RET(VarManager::Instance(session_id)->GetVarAddr(var_name, src_tensor_desc, &src_addr)); - uint8_t *mem_addr = - src_addr - - static_cast(static_cast(VarManager::Instance(session_id)->GetVarMemLogicBase())) + - static_cast( - reinterpret_cast(VarManager::Instance(session_id)->GetVarMemoryBase(RT_MEMORY_HBM))); - GE_CHK_RT_RET(rtMallocHost(reinterpret_cast(host_addr), src_tensor_size)); - - GE_CHK_RT_RET(rtMemcpy(*host_addr, src_tensor_size, mem_addr, src_tensor_size, RT_MEMCPY_DEVICE_TO_HOST)); - - GELOGI("SyncTensorToHost var_name %s, src_tensor_size %ld", var_name.c_str(), src_tensor_size); - return SUCCESS; -} - -Status TransVarDataUtils::SyncTensorToDevice(const string &var_name, const uint8_t *host_addr, uint32_t addr_size, - const ge::GeTensorDesc &dst_tensor_desc, uint64_t session_id) { - uint8_t *dst_addr = nullptr; - GE_CHK_STATUS_RET(VarManager::Instance(session_id)->GetVarAddr(var_name, dst_tensor_desc, &dst_addr)); - uint8_t *mem_addr = - dst_addr - - static_cast(static_cast(VarManager::Instance(session_id)->GetVarMemLogicBase())) + - static_cast( - reinterpret_cast(VarManager::Instance(session_id)->GetVarMemoryBase(RT_MEMORY_HBM))); - GE_CHK_RT_RET(rtMemcpy(mem_addr, addr_size, host_addr, addr_size, RT_MEMCPY_HOST_TO_DEVICE)); - - GELOGI("SyncTensorToDevice var_name %s, addr_size %u", var_name.c_str(), addr_size); - - return SUCCESS; -} - Status TransVarDataUtils::TransAllVarData(const vector &variable_nodes, uint64_t session_id, rtContext_t context, diff --git a/ge/graph/manager/trans_var_data_utils.h b/ge/graph/manager/trans_var_data_utils.h index d5096ef2..174efbb3 100755 --- a/ge/graph/manager/trans_var_data_utils.h +++ b/ge/graph/manager/trans_var_data_utils.h @@ -29,11 +29,6 @@ namespace ge { class TransVarDataUtils { public: - static ge::Status SyncVarData2BroadCast(const string &var_name, const ge::GeTensorDesc &src_tensor_desc, - uint8_t *dst_addr, int64_t dst_addr_size, uint64_t session_id_); - static ge::Status SyncBroadCastData2Var(uint8_t *src_addr, int64_t src_addr_size, const string &var_name, - const ge::GeTensorDesc &dst_tensor_desc, uint64_t session_id_); - static ge::Status TransAllVarData(const std::vector &variable_nodes, uint64_t session_id, rtContext_t context, @@ -41,12 +36,6 @@ class TransVarDataUtils { uint32_t thread_num = 16); static ge::Status CopyVarData(const ComputeGraphPtr &compute_graph, uint64_t session_id, uint32_t device_id); - - private: - static ge::Status SyncTensorToHost(const string &var_name, const ge::GeTensorDesc &src_tensor_desc, - uint8_t **host_addr, int64_t &addr_size, uint64_t session_id_); - static ge::Status SyncTensorToDevice(const string &var_name, const uint8_t *host_addr, uint32_t addr_size, - const ge::GeTensorDesc &dst_tensor_desc, uint64_t session_id_); }; } // namespace ge From 2400e65904de4e5d20731f41421853360542e04c Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 1 Jul 2021 17:49:37 +0800 Subject: [PATCH 131/226] Do not create context in hydrid executor init func. --- ge/hybrid/executor/hybrid_model_executor.cc | 4 ---- ge/hybrid/executor/hybrid_model_pipeline_executor.cc | 1 - ge/hybrid/executor/worker/task_compile_engine.cc | 11 +++++++++-- metadef | 2 +- parser | 2 +- .../ge/hybrid/executor/worker/execution_engine_unittest.cc | 12 ++++++++++++ 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 58da451c..2bb683c7 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -33,9 +33,6 @@ HybridModelExecutor::HybridModelExecutor(HybridModel *model, uint32_t device_id, } HybridModelExecutor::~HybridModelExecutor() { - if (context_.rt_gen_context != nullptr) { - (void) rtCtxDestroy(context_.rt_gen_context); - } } Status HybridModelExecutor::Init() { @@ -139,7 +136,6 @@ Status HybridModelExecutor::Cleanup() { Status HybridModelExecutor::InitExecutionContext() { GE_CHK_RT_RET(rtCtxGetCurrent(&context_.rt_context)); - GE_CHK_RT_RET(rtCtxCreate(&context_.rt_gen_context, RT_CTX_GEN_MODE, 0)); GE_CHK_RT_RET(rtCtxSetCurrent(context_.rt_context)); context_.global_step = model_->GetGlobalStep(); diff --git a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc index 45e61138..b5e66628 100644 --- a/ge/hybrid/executor/hybrid_model_pipeline_executor.cc +++ b/ge/hybrid/executor/hybrid_model_pipeline_executor.cc @@ -191,7 +191,6 @@ HybridModelPipelineExecutor::HybridModelPipelineExecutor(HybridModel *model, uin } Status StageExecutor::InitExecutionContext() { - GE_CHK_RT_RET(rtCtxCreate(&context_.rt_gen_context, RT_CTX_GEN_MODE, 0)); GE_CHK_RT_RET(rtCtxSetCurrent(context_.rt_context)); context_.model = model_; diff --git a/ge/hybrid/executor/worker/task_compile_engine.cc b/ge/hybrid/executor/worker/task_compile_engine.cc index f7da9acd..491e0997 100755 --- a/ge/hybrid/executor/worker/task_compile_engine.cc +++ b/ge/hybrid/executor/worker/task_compile_engine.cc @@ -21,10 +21,17 @@ namespace ge { namespace hybrid { Status TaskCompileEngine::Compile(NodeState &node_state, GraphExecutionContext *context) { - const auto &node_item = *node_state.GetNodeItem(); GE_CHECK_NOTNULL(context); + rtContext_t rt_gen_context = nullptr; + GE_CHK_RT_RET(rtCtxCreate(&rt_gen_context, RT_CTX_GEN_MODE, 0)); + std::function callback = [&]() { + (void) rtCtxDestroy(rt_gen_context); + GE_CHK_RT(rtCtxSetCurrent(context->rt_context)); + }; + GE_MAKE_GUARD(rt_gen_context, callback); + + const auto &node_item = *node_state.GetNodeItem(); RECORD_COMPILE_EVENT(context, node_item.NodeName().c_str(), "[Compile] Start"); - GE_CHK_RT_RET(rtCtxSetCurrent(context->rt_gen_context)); if (context->ge_context != nullptr) { GetThreadLocalContext() = *context->ge_context; diff --git a/metadef b/metadef index f3f137de..9e4a51a9 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit f3f137de034885f0c7394d7f04b41b08d450d2d2 +Subproject commit 9e4a51a9602195b82e326b853f5adbfefc3972b6 diff --git a/parser b/parser index 15a27afe..79536a19 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 15a27afefe45f2abdb78787d629163aab9437599 +Subproject commit 79536a196f89cf7a1f5852ff7304b9a7d7b12eff diff --git a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc index 07701f4d..96641c59 100644 --- a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc +++ b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc @@ -27,6 +27,7 @@ #include "hybrid/executor/hybrid_model_executor.h" #include "hybrid/executor/worker/execution_engine.h" #include "hybrid/executor/subgraph_executor.h" +#include "hybrid/executor/worker/task_compile_engine.h" #undef private #undef protected @@ -45,7 +46,14 @@ class UtestExecutionEngine : public testing::Test { }; namespace { const int kIntBase = 10; +class CompileNodeExecutor : public NodeExecutor { + public: + Status CompileTask(const HybridModel &model, const NodePtr &node, std::shared_ptr &task) const override { + return SUCCESS; + } +}; } + static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { auto op_desc = std::make_shared(name, type); op_desc->SetStreamId(0); @@ -128,4 +136,8 @@ TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { executor.InitCallback(node_state.get(), callback); ExecutionEngine execution_engine; EXPECT_EQ(execution_engine.ExecuteAsync(*node_state, node_state->GetTaskContext(), execution_context, callback), INTERNAL_ERROR); + + CompileNodeExecutor node_executor; + node_item->node_executor = &node_executor; + EXPECT_EQ(TaskCompileEngine::Compile(*node_state, &execution_context), SUCCESS); } From 41ffa8bed108b57bb472843db88800c1ad105a85 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 1 Jul 2021 17:52:32 +0800 Subject: [PATCH 132/226] Update submodule. --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 9e4a51a9..9c9907b7 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 9e4a51a9602195b82e326b853f5adbfefc3972b6 +Subproject commit 9c9907b76a457f456072af96b8cbcfb7943beccc diff --git a/parser b/parser index 79536a19..15a27afe 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 79536a196f89cf7a1f5852ff7304b9a7d7b12eff +Subproject commit 15a27afefe45f2abdb78787d629163aab9437599 From cdecf866db4f328e73e016aec3dd58b685be71b8 Mon Sep 17 00:00:00 2001 From: lichun Date: Thu, 1 Jul 2021 17:54:49 +0800 Subject: [PATCH 133/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index a8367130..435928ee 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -141,6 +141,6 @@ TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { KnownNodeExecutor known_node_executor; std::shared_ptr davinci_model = MakeShared(0, nullptr); - known_node_executor.SettingDaviciModel(hybrid, node, davinci_model); + known_node_executor.SettingDaviciModel(hybrid_model, node, davinci_model); EXPECT_EQ(davinci_model->global_step_addr_, 520); } From 70a9868d3b3e66fde3200960f8e659318c9da944 Mon Sep 17 00:00:00 2001 From: lianghao Date: Thu, 1 Jul 2021 18:02:40 +0800 Subject: [PATCH 134/226] IsEnterFeedNode --- ge/hybrid/model/node_item.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index 8e87c6e2..77bd8efd 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -24,6 +24,8 @@ namespace ge { namespace hybrid { namespace { +const uint8_t kMaxTransCount = 3; +const uint32_t kTransOpIoSize = 1; const char *const kAttrNameOriginalFusionGraph = "_original_fusion_graph"; const char *const kNodeTypeRetVal = "_RetVal"; const std::set kControlOpTypes{ @@ -39,6 +41,25 @@ const std::set kMergeOpTypes{ MERGE, REFMERGE, STREAMMERGE }; +bool IsEnterFeedNode(NodePtr node) { + // For: Enter -> node + // For: Enter -> Cast -> node + // For: Enter -> TransData -> Cast -> node + for (uint8_t i = 0; i < kMaxTransCount; ++i) { + if (kEnterOpTypes.count(NodeUtils::GetNodeType(node)) > 0) { + GELOGD("Node[%u] is Enter feed node.", node->GetName().c_str()); + return true; + } + + const auto all_nodes = node->GetInDataNodes(); + if (all_nodes.size() != kTransOpIoSize || node->GetAllInDataAnchorsSize() != kTransOpIoSize) { + return false; + } + node = all_nodes.at(0); + } + return false; +} + Status ParseInputMapping(Node &node, OpDesc &op_desc, FusedSubgraph &fused_subgraph) { uint32_t parent_index = 0; if (!AttrUtils::GetInt(op_desc, ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { @@ -399,7 +420,7 @@ void NodeItem::SetDataSend(NodeItem *node_item, int anchor_index) { data_anchors.emplace(anchor_index); } // If Enter feed Not Merge, take as root Node. - if (IsEnterOp() && (node_item->node_type != STREAMMERGE)) { + if (IsEnterFeedNode(node) && (node_item->node_type != STREAMMERGE)) { auto &data_anchors = node_item->enter_data_[this]; data_anchors.emplace(anchor_index); } @@ -419,7 +440,7 @@ void NodeItem::SetCtrlSend(NodeItem *node_item, uint32_t switch_index) { node_item->root_ctrl_.emplace(this); } // If Enter feed control signal, take as root Node. - if (IsEnterOp() && (node_item->node_type != STREAMMERGE && node_item->node_type != STREAMACTIVE)) { + if (IsEnterFeedNode(node) && (node_item->node_type != STREAMMERGE && node_item->node_type != STREAMACTIVE)) { node_item->enter_ctrl_.emplace(this); } GELOGI("Node[%s] will control node[%s]", NodeName().c_str(), node_item->NodeName().c_str()); From 1db4cac78d33622b6c54fedbb8d59b8d70f1fe66 Mon Sep 17 00:00:00 2001 From: WeiGangqiang Date: Tue, 29 Jun 2021 10:04:43 +0800 Subject: [PATCH 135/226] add graph check framework --- .clang-format | 3 +- metadef | 2 +- scripts/env/Dockerfile | 15 +++ scripts/env/ge_env.sh | 4 +- tests/depends/cce/CMakeLists.txt | 1 + tests/framework/CMakeLists.txt | 13 --- .../include/easy_graph/builder/graph_dsl.h | 22 +++- .../easy_graph/src/layout/graph_layout.cc | 8 +- .../include/ge_graph_dsl/assert/assert_error.h | 37 ++++++ .../include/ge_graph_dsl/assert/check_utils.h | 32 +++++ .../ge_graph_dsl/assert/filter_scope_guard.h} | 49 +++++--- .../include/ge_graph_dsl/assert/graph_assert.h | 59 ++++++++++ .../include/ge_graph_dsl/op_desc/op_desc_cfg.h | 6 +- .../ge_graph_dsl/src/assert/assert_error.cc | 26 +++++ .../ge_graph_dsl/src/assert/check_utils.cc | 34 ++++++ .../ge_graph_dsl/src/assert/filter_scope_guard.cc | 31 +++++ .../ge_graph_dsl/src/assert/ge_dump_filter.h | 33 ++++++ .../src/assert/ge_graph_check_dumper.cc | 79 +++++++++++++ .../src/assert/ge_graph_check_dumper.h | 49 ++++++++ .../ge_graph_dsl/src/assert/ge_graph_checker.h | 32 +++++ .../src/assert/ge_graph_default_checker.cc | 28 +++++ .../src/assert/ge_graph_default_checker.h | 41 +++++++ .../src/{ => op_desc}/op_desc_cfg_box.cc | 0 .../src/{ => op_desc}/op_desc_cfg_repo.cc | 17 ++- .../src/{ => op_desc}/op_desc_ptr_box.cc | 4 +- .../ge_graph_visitor.cc} | 12 +- .../src/{ => vistor}/ge_subgraph_vistor.cc | 0 .../ge_graph_dsl/src/{ => vistor}/graph_dsl.cc | 0 tests/framework/ge_graph_dsl/tests/CMakeLists.txt | 2 +- .../ge_graph_dsl/tests/check_graph_test.cc | 129 +++++++++++++++++++++ .../framework/ge_graph_dsl/tests/graph_dsl_test.cc | 44 +++---- .../ge_graph_dsl/tests/stub/optype_stub.cc | 6 + .../tests/test_main.cc} | 47 ++++---- .../framework/utils/builder/graph_builder_utils.cc | 48 -------- .../framework/utils/builder/graph_builder_utils.h | 55 --------- tests/st/testcase/CMakeLists.txt | 2 +- tests/st/testcase/test_framework_dummy.cc | 127 ++++++++------------ tests/st/testcase/test_ge_opt_info.cc | 20 +--- tests/st/testcase/test_main.cc | 4 +- tests/ut/common/graph/CMakeLists.txt | 1 + tests/ut/ge/CMakeLists.txt | 1 + 41 files changed, 811 insertions(+), 312 deletions(-) create mode 100644 tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/assert_error.h create mode 100644 tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/check_utils.h rename tests/framework/{utils/builder/tensor_builder_utils.cc => ge_graph_dsl/include/ge_graph_dsl/assert/filter_scope_guard.h} (68%) create mode 100644 tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/graph_assert.h create mode 100644 tests/framework/ge_graph_dsl/src/assert/assert_error.cc create mode 100644 tests/framework/ge_graph_dsl/src/assert/check_utils.cc create mode 100644 tests/framework/ge_graph_dsl/src/assert/filter_scope_guard.cc create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_dump_filter.h create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.cc create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.h create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_graph_checker.h create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.cc create mode 100644 tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.h rename tests/framework/ge_graph_dsl/src/{ => op_desc}/op_desc_cfg_box.cc (100%) rename tests/framework/ge_graph_dsl/src/{ => op_desc}/op_desc_cfg_repo.cc (53%) rename tests/framework/ge_graph_dsl/src/{ => op_desc}/op_desc_ptr_box.cc (97%) rename tests/framework/ge_graph_dsl/src/{ge_graph_vistor.cc => vistor/ge_graph_visitor.cc} (89%) rename tests/framework/ge_graph_dsl/src/{ => vistor}/ge_subgraph_vistor.cc (100%) rename tests/framework/ge_graph_dsl/src/{ => vistor}/graph_dsl.cc (100%) create mode 100644 tests/framework/ge_graph_dsl/tests/check_graph_test.cc rename tests/framework/{utils/builder/tensor_builder_utils.h => ge_graph_dsl/tests/test_main.cc} (73%) delete mode 100644 tests/framework/utils/builder/graph_builder_utils.cc delete mode 100644 tests/framework/utils/builder/graph_builder_utils.h diff --git a/.clang-format b/.clang-format index e7f9d935..6faea40d 100644 --- a/.clang-format +++ b/.clang-format @@ -52,7 +52,6 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DerivePointerAlignment: true DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true @@ -94,7 +93,7 @@ PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 200 -PointerAlignment: Left +PointerAlignment: Right RawStringFormats: - Language: Cpp Delimiters: diff --git a/metadef b/metadef index f3f137de..9c9907b7 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit f3f137de034885f0c7394d7f04b41b08d450d2d2 +Subproject commit 9c9907b76a457f456072af96b8cbcfb7943beccc diff --git a/scripts/env/Dockerfile b/scripts/env/Dockerfile index af02f7bb..923a1453 100755 --- a/scripts/env/Dockerfile +++ b/scripts/env/Dockerfile @@ -38,5 +38,20 @@ RUN wget https://github.com/ccup/lcov/archive/refs/tags/add_lcov.tar.gz -O add_l ENV PROJECT_HOME=/code/Turing/graphEngine +RUN mkdir /var/run/sshd +RUN echo "root:root" | chpasswd +RUN sed -i 's/\#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd + +ENV NOTVISIBLE "in users profile" +RUN echo "export VISIBLE=now" >> /etc/profile + +EXPOSE 22 7777 + +RUN useradd -ms /bin/bash debugger +RUN echo "debugger:ge123" | chpasswd + +CMD ["/usr/sbin/sshd" "-D" "&"] + RUN echo "alias ge=/code/Turing/graphEngine/scripts/ge.sh">>~/.bashrc diff --git a/scripts/env/ge_env.sh b/scripts/env/ge_env.sh index 18c6aa5d..10ca810f 100755 --- a/scripts/env/ge_env.sh +++ b/scripts/env/ge_env.sh @@ -21,7 +21,7 @@ MOUNT_PROJECT_HOME=$(cd $PROJECT_HOME || return; pwd) DOCKER_BUILD_ENV_NAME=${MOUNT_PROJECT_HOME#*/} DOCKER_BUILD_ENV_NAME=${DOCKER_BUILD_ENV_NAME//\//\_} -DOCKER_IMAGE_TAG=ge_build_env.1.0.6 +DOCKER_IMAGE_TAG=ge_build_env.1.0.9 DOCKER_IAMGE_NAME=joycode2art/turing DOCKER_FULL_IMAGE_NAME=${DOCKER_IAMGE_NAME}:${DOCKER_IMAGE_TAG} @@ -61,7 +61,7 @@ function enter_docker_env(){ if test -z "$(docker images |grep ${DOCKER_IAMGE_NAME} | grep ${DOCKER_IMAGE_TAG})"; then echo "please run 'ge env --pull' to download images first!" elif test -z "$(docker ps -a |grep ${DOCKER_BUILD_ENV_NAME})"; then - $docker_cmd run -it -v ${MOUNT_PROJECT_HOME}:/code/Turing/graphEngine --workdir ${docker_work_dir} --name ${DOCKER_BUILD_ENV_NAME} ${DOCKER_FULL_IMAGE_NAME} ${docker_bash_dir} + $docker_cmd run -p 7002:22 -p 7003:7777 --privileged=true -it -v ${MOUNT_PROJECT_HOME}:/code/Turing/graphEngine --workdir ${docker_work_dir} --name ${DOCKER_BUILD_ENV_NAME} ${DOCKER_FULL_IMAGE_NAME} ${docker_bash_dir} elif test -z "$(docker ps |grep ${DOCKER_BUILD_ENV_NAME})"; then $docker_cmd start ${DOCKER_BUILD_ENV_NAME} $docker_cmd exec -w ${docker_work_dir} -it ${DOCKER_BUILD_ENV_NAME} ${docker_bash_dir} diff --git a/tests/depends/cce/CMakeLists.txt b/tests/depends/cce/CMakeLists.txt index 7550c63f..05fa8133 100644 --- a/tests/depends/cce/CMakeLists.txt +++ b/tests/depends/cce/CMakeLists.txt @@ -60,6 +60,7 @@ set(SRCS "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" + "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" diff --git a/tests/framework/CMakeLists.txt b/tests/framework/CMakeLists.txt index 8a2218b4..bbab454b 100644 --- a/tests/framework/CMakeLists.txt +++ b/tests/framework/CMakeLists.txt @@ -17,16 +17,3 @@ include(cmake/graphengine.cmake) add_subdirectory(easy_graph) add_subdirectory(ge_graph_dsl) add_subdirectory(ge_running_env) - -file(GLOB_RECURSE UTILS_SRC CONFIGURE_DEPENDS - "utils/*.cc" - ) - -add_library(framework STATIC ${UTILS_SRC}) - -target_include_directories(framework - PUBLIC utils/ -) - -set_target_properties(framework PROPERTIES CXX_STANDARD 11) -target_link_libraries(framework PUBLIC ge_graph_dsl ge_with_env) diff --git a/tests/framework/easy_graph/include/easy_graph/builder/graph_dsl.h b/tests/framework/easy_graph/include/easy_graph/builder/graph_dsl.h index 4d430983..46bfe324 100644 --- a/tests/framework/easy_graph/include/easy_graph/builder/graph_dsl.h +++ b/tests/framework/easy_graph/include/easy_graph/builder/graph_dsl.h @@ -26,16 +26,32 @@ EG_NS_BEGIN //////////////////////////////////////////////////////////////// namespace detail { -template +template Graph BuildGraph(const char *name, GRAPH_BUILDER builderInDSL) { GraphBuilder builder(name); builderInDSL(builder); return std::move(*builder); } + +struct GraphDefiner { + GraphDefiner(const char *defaultName, const char *specifiedName = nullptr) { + name = specifiedName ? specifiedName : defaultName; + } + + template + auto operator|(USER_BUILDER &&userBuilder) { + GraphBuilder graphBuilder{name}; + std::forward(userBuilder)(graphBuilder); + return *graphBuilder; + } + + private: + const char *name; +}; + } // namespace detail -#define HAS_NAME(...) NOT_EMPTY_SELECT(__VA_ARGS__) -#define DEF_GRAPH(G, ...) ::EG_NS::Graph G = ::EG_NS::detail::BuildGraph(HAS_NAME(__VA_ARGS__)(__VA_ARGS__, #G), [&](::EG_NS::GraphBuilder& BUILDER) +#define DEF_GRAPH(G, ...) ::EG_NS::Graph G = ::EG_NS::detail::GraphDefiner(#G, ##__VA_ARGS__) | [&](auto &&BUILDER) #define DATA_CHAIN(...) ::EG_NS::ChainBuilder(BUILDER, ::EG_NS::EdgeType::DATA)->__VA_ARGS__ #define CTRL_CHAIN(...) ::EG_NS::ChainBuilder(BUILDER, ::EG_NS::EdgeType::CTRL)->__VA_ARGS__ #define CHAIN(...) DATA_CHAIN(__VA_ARGS__) diff --git a/tests/framework/easy_graph/src/layout/graph_layout.cc b/tests/framework/easy_graph/src/layout/graph_layout.cc index 340acf67..716bed8a 100644 --- a/tests/framework/easy_graph/src/layout/graph_layout.cc +++ b/tests/framework/easy_graph/src/layout/graph_layout.cc @@ -16,10 +16,15 @@ #include "easy_graph/layout/graph_layout.h" #include "easy_graph/layout/layout_executor.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" #include "easy_graph/graph/graph.h" EG_NS_BEGIN +namespace { +GraphEasyExecutor default_executor; +} + void GraphLayout::Config(LayoutExecutor &executor, const LayoutOption *opts) { this->executor_ = &executor; options_ = opts; @@ -27,8 +32,7 @@ void GraphLayout::Config(LayoutExecutor &executor, const LayoutOption *opts) { Status GraphLayout::Layout(const Graph &graph, const LayoutOption *opts) { const LayoutOption *options = opts ? opts : this->options_; - if (!executor_) - return EG_UNIMPLEMENTED; + if (!executor_) return static_cast(default_executor).Layout(graph, options); return executor_->Layout(graph, options); } diff --git a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/assert_error.h b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/assert_error.h new file mode 100644 index 00000000..7f5d5086 --- /dev/null +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/assert_error.h @@ -0,0 +1,37 @@ +/** + * 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. + */ +#ifndef D52AA06185E34BBFB714FFBCDAB0D53A +#define D52AA06185E34BBFB714FFBCDAB0D53A + +#include "ge_graph_dsl/ge.h" +#include +#include + +GE_NS_BEGIN + +struct AssertError : std::exception { + AssertError(const char *file, int line, const std::string &info); + + private: + const char *what() const noexcept override; + + private: + std::string info; +}; + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/check_utils.h b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/check_utils.h new file mode 100644 index 00000000..fa0ae783 --- /dev/null +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/check_utils.h @@ -0,0 +1,32 @@ +/** + * 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. + */ +#ifndef INC_31309AA0A4E44C009C22AD9351BF3410 +#define INC_31309AA0A4E44C009C22AD9351BF3410 + +#include "ge_graph_dsl/ge.h" +#include "graph/compute_graph.h" + +GE_NS_BEGIN + +using GraphCheckFun = std::function; +struct CheckUtils { + static bool CheckGraph(const std::string &phase_id, const GraphCheckFun &fun); + static void init(); +}; + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/utils/builder/tensor_builder_utils.cc b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/filter_scope_guard.h similarity index 68% rename from tests/framework/utils/builder/tensor_builder_utils.cc rename to tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/filter_scope_guard.h index f99b9107..a208c02e 100644 --- a/tests/framework/utils/builder/tensor_builder_utils.cc +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/filter_scope_guard.h @@ -1,17 +1,32 @@ -/** - * 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 "tensor_builder_utils.h" +/** + * 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. + */ +#ifndef C8B32320BD4943D588594B82FFBF2685 +#define C8B32320BD4943D588594B82FFBF2685 + +#include +#include +#include "ge_graph_dsl/ge.h" + +GE_NS_BEGIN + +struct FilterScopeGuard { + FilterScopeGuard(const std::vector &); + ~FilterScopeGuard(); +}; + +GE_NS_END + +#endif diff --git a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/graph_assert.h b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/graph_assert.h new file mode 100644 index 00000000..663907a0 --- /dev/null +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/assert/graph_assert.h @@ -0,0 +1,59 @@ +/** + * 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. + */ +#ifndef AD954C4ADF5B44F5B1CC8BCD72EE9ED6 +#define AD954C4ADF5B44F5B1CC8BCD72EE9ED6 + +#include "ge_graph_dsl/ge.h" +#include "ge_graph_dsl/assert/check_utils.h" +#include "ge_graph_dsl/assert/assert_error.h" +#include "ge_graph_dsl/assert/filter_scope_guard.h" + +GE_NS_BEGIN + +#ifdef GTEST_MESSAGE_AT_ +#define GRAPH_CHECK_MESSAGE(file, line, message) \ + GTEST_MESSAGE_AT_(file, line, message, ::testing::TestPartResult::kFatalFailure) +#elif +#define GRAPH_CHECK_MESSAGE(file, line, message) throw AssertError(file, line, message) +#endif + +namespace detail { +struct GraphAssert { + GraphAssert(const char *file, unsigned int line, const std::string &phase_id) + : file_(file), line_(line), phase_id_(phase_id) {} + + void operator|(const ::GE_NS::GraphCheckFun &check_fun) { + bool ret = ::GE_NS::CheckUtils::CheckGraph(phase_id_, check_fun); + if (!ret) { + auto message = "expect dump graph in phase: [" + phase_id_ + "], while not find the dump graph! "; + GRAPH_CHECK_MESSAGE(file_, line_, message.c_str()); + } + } + + private: + const char *file_; + unsigned int line_; + const std::string phase_id_; +}; +} // namespace detail + +#define DUMP_GRAPH_WHEN(...) ::GE_NS::FilterScopeGuard guard__COUNTER__({__VA_ARGS__}); +#define CHECK_GRAPH(phase_id) \ + ::GE_NS::detail::GraphAssert(__FILE__, __LINE__, #phase_id) | [&](const ::GE_NS::ComputeGraphPtr &graph) + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg.h b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg.h index bb2326ec..99eafa7f 100644 --- a/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg.h +++ b/tests/framework/ge_graph_dsl/include/ge_graph_dsl/op_desc/op_desc_cfg.h @@ -33,14 +33,12 @@ struct OpDescCfg { std::vector shape_; }; - OpDescCfg(const OpType &type, int in_cnt = 0, int out_cnt = 0, Format format = FORMAT_NCHW, + OpDescCfg(const OpType &type, int in_cnt = 1, int out_cnt = 1, Format format = FORMAT_NCHW, DataType data_type = DT_FLOAT, std::vector shape = {1, 1, 224, 224}) : type_(type), in_cnt_(in_cnt), out_cnt_(out_cnt), default_tensor_(format, data_type, shape) {} protected: - OpType GetType() const { - return type_; - } + OpType GetType() const { return type_; } OpType type_; int in_cnt_; int out_cnt_; diff --git a/tests/framework/ge_graph_dsl/src/assert/assert_error.cc b/tests/framework/ge_graph_dsl/src/assert/assert_error.cc new file mode 100644 index 00000000..5b74d852 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/assert_error.cc @@ -0,0 +1,26 @@ +/** + * 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 "ge_graph_dsl/assert/assert_error.h" + +GE_NS_BEGIN + +AssertError::AssertError(const char *file, int line, const std::string &info) { + this->info = std::string(file) + ":" + std::to_string(line) + "\n" + info; +} + +const char *AssertError::what() const noexcept { return info.c_str(); } + +GE_NS_END diff --git a/tests/framework/ge_graph_dsl/src/assert/check_utils.cc b/tests/framework/ge_graph_dsl/src/assert/check_utils.cc new file mode 100644 index 00000000..56bc6e81 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/check_utils.cc @@ -0,0 +1,34 @@ +/** + * 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 "ge_graph_dsl/assert/check_utils.h" +#include "graph/utils/dumper/ge_graph_dumper.h" +#include "ge_graph_default_checker.h" +#include "ge_graph_check_dumper.h" + +GE_NS_BEGIN + +bool CheckUtils::CheckGraph(const std::string &phase_id, const GraphCheckFun &fun) { + auto &dumper = dynamic_cast(GraphDumperRegistry::GetDumper()); + return dumper.CheckFor(GeGraphDefaultChecker(phase_id, fun)); +} + +void CheckUtils::init() { + static GeGraphCheckDumper checkDumper; + GraphDumperRegistry::Register(checkDumper); +} + +GE_NS_END diff --git a/tests/framework/ge_graph_dsl/src/assert/filter_scope_guard.cc b/tests/framework/ge_graph_dsl/src/assert/filter_scope_guard.cc new file mode 100644 index 00000000..4aa4795d --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/filter_scope_guard.cc @@ -0,0 +1,31 @@ +/** + * 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 "ge_graph_dsl/assert/filter_scope_guard.h" +#include "graph/utils/dumper/ge_graph_dumper.h" +#include "ge_dump_filter.h" + +GE_NS_BEGIN + +namespace { +GeDumpFilter &GetDumpFilter() { return dynamic_cast(GraphDumperRegistry::GetDumper()); } +} // namespace + +FilterScopeGuard::FilterScopeGuard(const std::vector &filter) { GetDumpFilter().Update(filter); } + +FilterScopeGuard::~FilterScopeGuard() { GetDumpFilter().Reset(); } + +GE_NS_END \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_dump_filter.h b/tests/framework/ge_graph_dsl/src/assert/ge_dump_filter.h new file mode 100644 index 00000000..47967c91 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_dump_filter.h @@ -0,0 +1,33 @@ +/** + * 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. + */ +#ifndef INC_4C6224E8F7474EF89B18CCB0E4B19FD6 +#define INC_4C6224E8F7474EF89B18CCB0E4B19FD6 + +#include +#include +#include "ge_graph_dsl/ge.h" +#include "easy_graph/infra/keywords.h" + +GE_NS_BEGIN + +INTERFACE(GeDumpFilter) { + ABSTRACT(void Update(const std::vector &)); + ABSTRACT(void Reset()); +}; + +GE_NS_END + +#endif diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.cc b/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.cc new file mode 100644 index 00000000..ba72cf86 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.cc @@ -0,0 +1,79 @@ +/** + * 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 "ge_graph_check_dumper.h" +#include "graph/model.h" +#include "graph/buffer.h" +#include "graph/utils/graph_utils.h" +#include "ge_graph_default_checker.h" + +GE_NS_BEGIN + +GeGraphCheckDumper::GeGraphCheckDumper() { Reset(); } + +bool GeGraphCheckDumper::IsNeedDump(const std::string &suffix) const { + auto iter = std::find(suffixes_.begin(), suffixes_.end(), suffix); + return (iter != suffixes_.end()); +} + +void GeGraphCheckDumper::Dump(const ge::ComputeGraphPtr &graph, const std::string &suffix) { + if (!IsNeedDump(suffix)) { + return; + } + auto iter = buffers_.find(suffix); + if (iter != buffers_.end()) { + DumpGraph(graph, iter->second); + } else { + buffers_[suffix] = Buffer(); + DumpGraph(graph, buffers_.at(suffix)); + } +} + +bool GeGraphCheckDumper::CheckFor(const GeGraphChecker &checker) { + auto iter = buffers_.find(checker.PhaseId()); + if (iter == buffers_.end()) { + return false; + } + DoCheck(checker, iter->second); + return true; +} + +void GeGraphCheckDumper::DoCheck(const GeGraphChecker &checker, ::GE_NS::Buffer &buffer) { + Model model("", ""); + Model::Load(buffer.GetData(), buffer.GetSize(), model); + auto load_graph = model.GetGraph(); + checker.Check(GraphUtils::GetComputeGraph(load_graph)); +} + +void GeGraphCheckDumper::DumpGraph(const ge::ComputeGraphPtr &graph, ::GE_NS::Buffer &buffer) { + Model model("", ""); + buffer.clear(); + model.SetGraph(GraphUtils::CreateGraphFromComputeGraph(graph)); + model.Save(buffer, true); +} + +void GeGraphCheckDumper::Update(const std::vector &new_suffixes_) { + suffixes_ = new_suffixes_; + buffers_.clear(); +} + +void GeGraphCheckDumper::Reset() { + static std::vector default_suffixes_{"PreRunAfterBuild"}; + suffixes_ = default_suffixes_; + buffers_.clear(); +} + +GE_NS_END \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.h b/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.h new file mode 100644 index 00000000..5eda52ea --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_graph_check_dumper.h @@ -0,0 +1,49 @@ +/** + * 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. + */ +#ifndef INC_8EFED0015C27464897BF64531355C810 +#define INC_8EFED0015C27464897BF64531355C810 + +#include "ge_graph_dsl/ge.h" +#include "graph/utils/dumper/ge_graph_dumper.h" +#include "ge_dump_filter.h" +#include + +GE_NS_BEGIN + +struct GeGraphChecker; + +struct GeGraphCheckDumper : GeGraphDumper, GeDumpFilter { + GeGraphCheckDumper(); + virtual void Dump(const ge::ComputeGraphPtr &graph, const std::string &suffix); + bool CheckFor(const GeGraphChecker &checker); + + private: + void DoCheck(const GeGraphChecker &checker, ::GE_NS::Buffer &buffer); + void DumpGraph(const ge::ComputeGraphPtr &graph, ::GE_NS::Buffer &buffer); + + private: + void Update(const std::vector &) override; + void Reset() override; + bool IsNeedDump(const std::string &suffix) const; + + private: + std::map buffers_; + std::vector suffixes_; +}; + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_graph_checker.h b/tests/framework/ge_graph_dsl/src/assert/ge_graph_checker.h new file mode 100644 index 00000000..c6b25b65 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_graph_checker.h @@ -0,0 +1,32 @@ +/** + * 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. + */ +#ifndef INC_5960A8F437324904BEE0690271258762 +#define INC_5960A8F437324904BEE0690271258762 + +#include "ge_graph_dsl/ge.h" +#include "easy_graph/infra/keywords.h" +#include "graph/compute_graph.h" + +GE_NS_BEGIN + +INTERFACE(GeGraphChecker) { + ABSTRACT(const std::string &PhaseId() const); + ABSTRACT(void Check(const ge::ComputeGraphPtr &graph) const); +}; + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.cc b/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.cc new file mode 100644 index 00000000..4aa48ac6 --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.cc @@ -0,0 +1,28 @@ +/** + * 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 "ge_graph_default_checker.h" + +GE_NS_BEGIN + +GeGraphDefaultChecker::GeGraphDefaultChecker(const std::string &phase_id, const GraphCheckFun &check_fun) + : phase_id_(phase_id), check_fun_(check_fun) {} + +const std::string &GeGraphDefaultChecker::PhaseId() const { return phase_id_; } + +void GeGraphDefaultChecker::Check(const ge::ComputeGraphPtr &graph) const { return check_fun_(graph); } + +GE_NS_END \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.h b/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.h new file mode 100644 index 00000000..af8f3fbe --- /dev/null +++ b/tests/framework/ge_graph_dsl/src/assert/ge_graph_default_checker.h @@ -0,0 +1,41 @@ +/** + * 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. + */ +#ifndef BCF4D96BE9FC48938DE7B7E93B551C54 +#define BCF4D96BE9FC48938DE7B7E93B551C54 + +#include "ge_graph_dsl/ge.h" +#include "ge_graph_checker.h" +#include "graph/compute_graph.h" + +GE_NS_BEGIN + +using GraphCheckFun = std::function; + +struct GeGraphDefaultChecker : GeGraphChecker { + GeGraphDefaultChecker(const std::string &, const GraphCheckFun &); + + private: + const std::string &PhaseId() const override; + void Check(const ge::ComputeGraphPtr &graph) const override; + + private: + const std::string phase_id_; + const GraphCheckFun check_fun_; +}; + +GE_NS_END + +#endif \ No newline at end of file diff --git a/tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc b/tests/framework/ge_graph_dsl/src/op_desc/op_desc_cfg_box.cc similarity index 100% rename from tests/framework/ge_graph_dsl/src/op_desc_cfg_box.cc rename to tests/framework/ge_graph_dsl/src/op_desc/op_desc_cfg_box.cc diff --git a/tests/framework/ge_graph_dsl/src/op_desc_cfg_repo.cc b/tests/framework/ge_graph_dsl/src/op_desc/op_desc_cfg_repo.cc similarity index 53% rename from tests/framework/ge_graph_dsl/src/op_desc_cfg_repo.cc rename to tests/framework/ge_graph_dsl/src/op_desc/op_desc_cfg_repo.cc index e7fa018f..19dfa4a5 100644 --- a/tests/framework/ge_graph_dsl/src/op_desc_cfg_repo.cc +++ b/tests/framework/ge_graph_dsl/src/op_desc/op_desc_cfg_repo.cc @@ -23,15 +23,22 @@ GE_NS_BEGIN namespace { -#define OP_CFG(optype, ...) \ - { \ - optype, OpDescCfg { \ - optype, __VA_ARGS__ \ - } \ +#define OP_CFG(optype, ...) \ + { \ + optype, OpDescCfg { optype, __VA_ARGS__ } \ } static std::map cfg_repo{OP_CFG(DATA, 1, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), OP_CFG(ADD, 2, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(ENTER, 1, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(MERGE, 2, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(CONSTANT, 0, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(LESS, 2, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(LOOPCOND, 1, 1, FORMAT_NCHW, DT_BOOL, {1, 1, 224, 224}), + OP_CFG(SWITCH, 2, 2, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(EXIT, 1, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(NEXTITERATION, 1, 1, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), + OP_CFG(NETOUTPUT, 2, 2, FORMAT_NCHW, DT_FLOAT, {1, 1, 224, 224}), OP_CFG(VARIABLE, 1, 1)}; } // namespace diff --git a/tests/framework/ge_graph_dsl/src/op_desc_ptr_box.cc b/tests/framework/ge_graph_dsl/src/op_desc/op_desc_ptr_box.cc similarity index 97% rename from tests/framework/ge_graph_dsl/src/op_desc_ptr_box.cc rename to tests/framework/ge_graph_dsl/src/op_desc/op_desc_ptr_box.cc index 23d4773c..1564e019 100644 --- a/tests/framework/ge_graph_dsl/src/op_desc_ptr_box.cc +++ b/tests/framework/ge_graph_dsl/src/op_desc/op_desc_ptr_box.cc @@ -19,6 +19,4 @@ USING_GE_NS -OpDescPtr OpDescPtrBox::Build(const ::EG_NS::NodeId &id) const { - return op_; -} +OpDescPtr OpDescPtrBox::Build(const ::EG_NS::NodeId &id) const { return op_; } diff --git a/tests/framework/ge_graph_dsl/src/ge_graph_vistor.cc b/tests/framework/ge_graph_dsl/src/vistor/ge_graph_visitor.cc similarity index 89% rename from tests/framework/ge_graph_dsl/src/ge_graph_vistor.cc rename to tests/framework/ge_graph_dsl/src/vistor/ge_graph_visitor.cc index d8bc2aab..c1dca646 100644 --- a/tests/framework/ge_graph_dsl/src/ge_graph_vistor.cc +++ b/tests/framework/ge_graph_dsl/src/vistor/ge_graph_visitor.cc @@ -36,17 +36,11 @@ GE_NS_BEGIN GeGraphVisitor::GeGraphVisitor() : build_graph_(std::make_shared("")) {} -void GeGraphVisitor::reset(const ComputeGraphPtr &graph) { - build_graph_ = graph; -} +void GeGraphVisitor::reset(const ComputeGraphPtr &graph) { build_graph_ = graph; } -Graph GeGraphVisitor::BuildGeGraph() const { - return GraphUtils::CreateGraphFromComputeGraph(build_graph_); -} +Graph GeGraphVisitor::BuildGeGraph() const { return GraphUtils::CreateGraphFromComputeGraph(build_graph_); } -ComputeGraphPtr GeGraphVisitor::BuildComputeGraph() const { - return build_graph_; -} +ComputeGraphPtr GeGraphVisitor::BuildComputeGraph() const { return build_graph_; } Status GeGraphVisitor::Visit(const ::EG_NS::Graph &graph) { build_graph_->SetName(graph.GetName()); diff --git a/tests/framework/ge_graph_dsl/src/ge_subgraph_vistor.cc b/tests/framework/ge_graph_dsl/src/vistor/ge_subgraph_vistor.cc similarity index 100% rename from tests/framework/ge_graph_dsl/src/ge_subgraph_vistor.cc rename to tests/framework/ge_graph_dsl/src/vistor/ge_subgraph_vistor.cc diff --git a/tests/framework/ge_graph_dsl/src/graph_dsl.cc b/tests/framework/ge_graph_dsl/src/vistor/graph_dsl.cc similarity index 100% rename from tests/framework/ge_graph_dsl/src/graph_dsl.cc rename to tests/framework/ge_graph_dsl/src/vistor/graph_dsl.cc diff --git a/tests/framework/ge_graph_dsl/tests/CMakeLists.txt b/tests/framework/ge_graph_dsl/tests/CMakeLists.txt index 40097d8b..65482679 100644 --- a/tests/framework/ge_graph_dsl/tests/CMakeLists.txt +++ b/tests/framework/ge_graph_dsl/tests/CMakeLists.txt @@ -26,7 +26,7 @@ target_compile_options(ge_graph_dsl_test PRIVATE ) set_target_properties(ge_graph_dsl_test PROPERTIES CXX_STANDARD 17) -target_link_libraries(ge_graph_dsl_test PUBLIC gtest gtest_main ge_graph_dsl) +target_link_libraries(ge_graph_dsl_test PUBLIC gtest ge_graph_dsl) include(CTest) enable_testing() diff --git a/tests/framework/ge_graph_dsl/tests/check_graph_test.cc b/tests/framework/ge_graph_dsl/tests/check_graph_test.cc new file mode 100644 index 00000000..731b7eed --- /dev/null +++ b/tests/framework/ge_graph_dsl/tests/check_graph_test.cc @@ -0,0 +1,129 @@ +/** + * 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 "gtest/gtest.h" +#include "easy_graph/layout/graph_layout.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" +#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" +#include "ge_graph_dsl/graph_dsl.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/dumper/ge_graph_dumper.h" +#include "framework/common/types.h" +#include "ge_graph_dsl/assert/graph_assert.h" +#include "graph/model.h" +#include "graph/buffer.h" + +USING_GE_NS + +class CheckGraphTest : public testing::Test { + private: + EG_NS::GraphEasyExecutor executor; + + protected: + void SetUp() { EG_NS::GraphLayout::GetInstance().Config(executor, nullptr); } + void TearDown() {} +}; + +TEST_F(CheckGraphTest, test_ge_graph_dump_is_work) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + + DUMP_GRAPH_WHEN("after_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "after_build"); + + CHECK_GRAPH(after_build) { + ASSERT_EQ(graph->GetName(), "g1"); + ASSERT_EQ(graph->GetAllNodesSize(), 2); + }; +} + +TEST_F(CheckGraphTest, test_ge_graph_dump_two_phase) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + DEF_GRAPH(g2) { + CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CTRL_CHAIN(NODE("data2", DATA)->NODE("add", ADD)); + }; + + DUMP_GRAPH_WHEN("before_build", "after_build"); + + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "before_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g2), "after_build"); + + CHECK_GRAPH(before_build) { + ASSERT_EQ(graph->GetName(), "g1"); + ASSERT_EQ(graph->GetAllNodesSize(), 2); + }; + + CHECK_GRAPH(after_build) { + ASSERT_EQ(graph->GetName(), "g2"); + ASSERT_EQ(graph->GetAllNodesSize(), 3); + }; +} + +TEST_F(CheckGraphTest, test_ge_graph_dump_one_phase_two_times) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + DEF_GRAPH(g2) { + CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); + CTRL_CHAIN(NODE("data2", DATA)->NODE("add", ADD)); + }; + + DUMP_GRAPH_WHEN("before_build") + + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "before_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g2), "before_build"); + + CHECK_GRAPH(before_build) { + ASSERT_EQ(graph->GetName(), "g2"); + ASSERT_EQ(graph->GetAllNodesSize(), 3); + }; +} + +TEST_F(CheckGraphTest, test_check_phases_is_work) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + + DUMP_GRAPH_WHEN("before_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "after_build"); + auto ret = ::GE_NS::CheckUtils::CheckGraph("after_build", [&](const ::GE_NS::ComputeGraphPtr &graph) {}); + ASSERT_FALSE(ret); +} + +TEST_F(CheckGraphTest, test_check_one_phase_dump_another_not_dump) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + + DUMP_GRAPH_WHEN("before_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "before_build"); + GraphDumperRegistry::GetDumper().Dump(ToComputeGraph(g1), "after_build"); + + CHECK_GRAPH(before_build) { + ASSERT_EQ(graph->GetName(), "g1"); + ASSERT_EQ(graph->GetAllNodesSize(), 2); + }; +} + +TEST_F(CheckGraphTest, test_model_serialize_and_unserialize_success) { + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; + auto ge_graph = ToGeGraph(g1); + + ge::Model model("", ""); + model.SetGraph(ge_graph); + Buffer buffer; + model.Save(buffer, true); + + ge::Model loadModel("", ""); + Model::Load(buffer.GetData(), buffer.GetSize(), loadModel); + auto load_graph = loadModel.GetGraph(); + + ASSERT_EQ(load_graph.GetName(), "g1"); + ASSERT_EQ(load_graph.GetAllNodes().size(), 2); +} diff --git a/tests/framework/ge_graph_dsl/tests/graph_dsl_test.cc b/tests/framework/ge_graph_dsl/tests/graph_dsl_test.cc index f7e55e3d..a8240b32 100644 --- a/tests/framework/ge_graph_dsl/tests/graph_dsl_test.cc +++ b/tests/framework/ge_graph_dsl/tests/graph_dsl_test.cc @@ -37,17 +37,13 @@ class GraphDslTest : public testing::Test { EG_NS::GraphEasyExecutor executor; protected: - void SetUp() { - EG_NS::GraphLayout::GetInstance().Config(executor, nullptr); - } + void SetUp() { EG_NS::GraphLayout::GetInstance().Config(executor, nullptr); } void TearDown() {} }; TEST_F(GraphDslTest, test_build_graph_from_optype_with_name) { - DEF_GRAPH(g1) { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - }); + DEF_GRAPH(g1) { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; auto geGraph = ToGeGraph(g1); auto computeGraph = ToComputeGraph(g1); @@ -57,9 +53,7 @@ TEST_F(GraphDslTest, test_build_graph_from_optype_with_name) { } TEST_F(GraphDslTest, test_build_graph_with_name) { - DEF_GRAPH(g1, "sample_graph") { - CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - }); + DEF_GRAPH(g1, "sample_graph") { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; auto geGraph = ToGeGraph(g1); @@ -72,7 +66,7 @@ TEST_F(GraphDslTest, test_build_from_from_op_desc_ptr) { auto data = std::make_shared("data1", DATA); auto add = std::make_shared("Add", ADD); CHAIN(NODE(data)->NODE(add)); - }); + }; auto geGraph = ToGeGraph(g1); @@ -84,7 +78,7 @@ TEST_F(GraphDslTest, test_build_from_op_desc_cfg) { auto datCfg = OP_CFG(DATA).InCnt(1).OutCnt(1); auto addCfg = OP_CFG(DATA).InCnt(1).OutCnt(1); CHAIN(NODE("data1", datCfg)->NODE("add", addCfg)); - }); + }; auto geGraph = ToGeGraph(g1); @@ -92,9 +86,7 @@ TEST_F(GraphDslTest, test_build_from_op_desc_cfg) { } TEST_F(GraphDslTest, test_build_from_op_desc_cfg_inline) { - DEF_GRAPH(g1) { - CHAIN(NODE("data1", OP_CFG(DATA).InCnt(1).OutCnt(1))->NODE("add", OP_CFG(ADD).InCnt(2).OutCnt(1))); - }); + DEF_GRAPH(g1) { CHAIN(NODE("data1", OP_CFG(DATA).InCnt(1).OutCnt(1))->NODE("add", OP_CFG(ADD).InCnt(2).OutCnt(1))); }; auto geGraph = ToGeGraph(g1); @@ -102,9 +94,7 @@ TEST_F(GraphDslTest, test_build_from_op_desc_cfg_inline) { } TEST_F(GraphDslTest, test_build_from_control_chain) { - DEF_GRAPH(g1) { - CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - }); + DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; auto geGraph = ToGeGraph(g1); @@ -112,9 +102,7 @@ TEST_F(GraphDslTest, test_build_from_control_chain) { } TEST_F(GraphDslTest, test_build_from_data_chain) { - DEF_GRAPH(g1) { - DATA_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); - }); + DEF_GRAPH(g1) { DATA_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); }; auto geGraph = ToGeGraph(g1); @@ -125,7 +113,7 @@ TEST_F(GraphDslTest, test_build_from_data_chain_with_edge) { DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data1", DATA)->EDGE(2, 2)->NODE("add")); - }); + }; auto geGraph = ToGeGraph(g1); @@ -136,7 +124,7 @@ TEST_F(GraphDslTest, test_build_graph_reused_before_node) { DEF_GRAPH(g1) { CTRL_CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data1")->EDGE(2, 2)->NODE("add")); - }); + }; auto geGraph = ToGeGraph(g1); @@ -147,7 +135,7 @@ TEST_F(GraphDslTest, test_build_graph_with_constant_folding) { DEF_GRAPH(g1) { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data2", DATA)->NODE("add")); - }); + }; auto geGraph = ToGeGraph(g1); @@ -168,7 +156,7 @@ TEST_F(GraphDslTest, test_build_complex_normal_graph_build_suggested) { ->NODE("Add4") ->NODE("Add5") ->NODE("net_output", NETOUTPUT)); - }); + }; auto geGraph = ToGeGraph(g1); @@ -187,7 +175,7 @@ TEST_F(GraphDslTest, test_build_complex_mult_normal_graph_build) { CHAIN(NODE("add2")->NODE("net_output")); CHAIN(NODE("add3")->NODE("net_output")); CTRL_CHAIN(NODE("add1")->NODE("add2")->NODE("add3")); - }); + }; auto geGraph = ToGeGraph(g1); @@ -198,17 +186,17 @@ TEST_F(GraphDslTest, test_build_graph_with_sub_graph) { DEF_GRAPH(sub_1) { CHAIN(NODE("data_i", DATA)->NODE("less", LESS)->NODE("netoutput", NETOUTPUT)); CHAIN(NODE("const_5", CONSTANTOP)->NODE("less")); - }); + }; DEF_GRAPH(sub_2) { CHAIN(NODE("data_a", DATA)->NODE("mul", MUL)->NODE("netoutput", NETOUTPUT)); CHAIN(NODE("const_2", CONSTANTOP)->NODE("mul")); - }); + }; DEF_GRAPH(g1) { CHAIN(NODE("data_a", DATA)->NODE("while", WHILE, sub_1, sub_2)->NODE("netoutput", NETOUTPUT)); CHAIN(NODE("data_i", DATA)->NODE("while")); - }); + }; sub_1.Layout(); sub_2.Layout(); diff --git a/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc b/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc index 071f8c36..533e8198 100644 --- a/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc +++ b/tests/framework/ge_graph_dsl/tests/stub/optype_stub.cc @@ -30,5 +30,11 @@ REGISTER_OPTYPE_DEFINE(MUL, "Mul"); REGISTER_OPTYPE_DEFINE(NETOUTPUT, "NetOutput"); REGISTER_OPTYPE_DEFINE(ADD, "Add"); REGISTER_OPTYPE_DEFINE(WHILE, "While"); +REGISTER_OPTYPE_DEFINE(ENTER, "Enter"); +REGISTER_OPTYPE_DEFINE(MERGE, "Merge"); +REGISTER_OPTYPE_DEFINE(LOOPCOND, "Loopcond"); +REGISTER_OPTYPE_DEFINE(SWITCH, "Switch"); +REGISTER_OPTYPE_DEFINE(EXIT, "Exit"); +REGISTER_OPTYPE_DEFINE(NEXTITERATION, "Nextiteration"); GE_NS_END diff --git a/tests/framework/utils/builder/tensor_builder_utils.h b/tests/framework/ge_graph_dsl/tests/test_main.cc similarity index 73% rename from tests/framework/utils/builder/tensor_builder_utils.h rename to tests/framework/ge_graph_dsl/tests/test_main.cc index 73656e4a..eb6112f2 100644 --- a/tests/framework/utils/builder/tensor_builder_utils.h +++ b/tests/framework/ge_graph_dsl/tests/test_main.cc @@ -1,22 +1,25 @@ -/** - * 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. - */ - -#ifndef GRAPHENGINE_LLT_ST_TENSOR_BUILDER_UTILS_H -#define GRAPHENGINE_LLT_ST_TENSOR_BUILDER_UTILS_H - -class tensor_builder_utils {}; - -#endif // GRAPHENGINE_LLT_ST_TENSOR_BUILDER_UTILS_H +/** + * 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 "ge_graph_dsl/assert/check_utils.h" + +int main(int argc, char **argv) { + ::GE_NS::CheckUtils::init(); + testing::InitGoogleTest(&argc, argv); + int ret = RUN_ALL_TESTS(); + return ret; +} diff --git a/tests/framework/utils/builder/graph_builder_utils.cc b/tests/framework/utils/builder/graph_builder_utils.cc deleted file mode 100644 index c5555235..00000000 --- a/tests/framework/utils/builder/graph_builder_utils.cc +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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 "graph_builder_utils.h" -#include "inc/external/graph/operator.h" -#include "inc/external/graph/operator_factory.h" -#include "graph/utils/graph_utils.h" - -namespace ge { -namespace st { -NodePtr ComputeGraphBuilder::AddNode(const std::string &name, const std::string &type, int in_cnt, int out_cnt, - Format format, DataType data_type, std::vector shape) { - auto tensor_desc = std::make_shared(); - tensor_desc->SetShape(GeShape(std::move(shape))); - tensor_desc->SetFormat(format); - tensor_desc->SetDataType(data_type); - - auto op_desc = std::make_shared(name, type); - for (int i = 0; i < in_cnt; ++i) { - op_desc->AddInputDesc(tensor_desc->Clone()); - } - for (int i = 0; i < out_cnt; ++i) { - op_desc->AddOutputDesc(tensor_desc->Clone()); - } - - return graph_->AddNode(op_desc); -} -void ComputeGraphBuilder::AddDataEdge(NodePtr &src_node, int src_idx, NodePtr &dst_node, int dst_idx) { - GraphUtils::AddEdge(src_node->GetOutDataAnchor(src_idx), dst_node->GetInDataAnchor(dst_idx)); -} -void ComputeGraphBuilder::AddControlEdge(NodePtr &src_node, NodePtr &dst_node) { - GraphUtils::AddEdge(src_node->GetOutControlAnchor(), dst_node->GetInControlAnchor()); -} -} // namespace st -} // namespace ge diff --git a/tests/framework/utils/builder/graph_builder_utils.h b/tests/framework/utils/builder/graph_builder_utils.h deleted file mode 100644 index 4627f082..00000000 --- a/tests/framework/utils/builder/graph_builder_utils.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - */ - -#ifndef GRAPHENGINE_LLT_ST_GRAPH_BUILDER_H -#define GRAPHENGINE_LLT_ST_GRAPH_BUILDER_H - -#include -#include - -#include "graph/compute_graph.h" -#include "graph/utils/graph_utils.h" -#include "graph/graph.h" -#include "graph/node.h" - -namespace ge { -namespace st { -class ComputeGraphBuilder { - public: - explicit ComputeGraphBuilder(const std::string &name) { - graph_ = std::make_shared(name); - } - NodePtr AddNode(const std::string &name, const std::string &type, int in_cnt, int out_cnt, - Format format = FORMAT_NCHW, DataType data_type = DT_FLOAT, - std::vector shape = {1, 1, 224, 224}); - void AddDataEdge(NodePtr &src_node, int src_idx, NodePtr &dst_node, int dst_idx); - void AddControlEdge(NodePtr &src_node, NodePtr &dst_node); - ComputeGraphPtr GetComputeGraph() { - graph_->TopologicalSorting(); - return graph_; - } - Graph GetGraph() { - graph_->TopologicalSorting(); - return GraphUtils::CreateGraphFromComputeGraph(graph_); - } - - private: - ComputeGraphPtr graph_; -}; -} // namespace st -} // namespace ge - -#endif // GRAPHENGINE_LLT_ST_GRAPH_BUILDER_H diff --git a/tests/st/testcase/CMakeLists.txt b/tests/st/testcase/CMakeLists.txt index b3663708..56b3f41b 100644 --- a/tests/st/testcase/CMakeLists.txt +++ b/tests/st/testcase/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories(graph_engine_test set_target_properties(graph_engine_test PROPERTIES CXX_STANDARD 17) -target_link_libraries(graph_engine_test PRIVATE gtest framework) +target_link_libraries(graph_engine_test PRIVATE gtest ge_graph_dsl ge_with_env) include(CTest) enable_testing() diff --git a/tests/st/testcase/test_framework_dummy.cc b/tests/st/testcase/test_framework_dummy.cc index 0abdd18b..8f13bb78 100644 --- a/tests/st/testcase/test_framework_dummy.cc +++ b/tests/st/testcase/test_framework_dummy.cc @@ -15,23 +15,12 @@ */ #include -#include #include "external/ge/ge_api.h" -#include "ge_running_env/fake_engine.h" #include "graph/debug/ge_attr_define.h" #include "framework/common/types.h" - -#include "builder/graph_builder_utils.h" #include "ge_running_env/ge_running_env_faker.h" - -#include "graph/operator_reg.h" -#include "graph/operator.h" -#define protected public -#define private public -#include "graph/utils/op_desc_utils.h" #include "ge_graph_dsl/graph_dsl.h" -#undef protected -#undef private +#include "ge_graph_dsl/assert/graph_assert.h" using namespace std; using namespace ge; @@ -57,76 +46,58 @@ namespace { * **/ Graph BuildV1ControlFlowGraph() { - // build graph - st::ComputeGraphBuilder graphBuilder("g1"); - auto data_i = graphBuilder.AddNode("data_i", DATA, 1, 1); - auto enter_i = graphBuilder.AddNode("enter_i", ENTER, 1, 1); - ge::AttrUtils::SetStr(enter_i->GetOpDesc(), ENTER_ATTR_FRAME_NAME, "1"); - auto merge_i = graphBuilder.AddNode("merge_i", MERGE, 2, 1); - auto const_5 = graphBuilder.AddNode("const_5", CONSTANT, 0, 1); - auto less = graphBuilder.AddNode("less", LESS, 2, 1); - auto loopcond = graphBuilder.AddNode("loopcond", LOOPCOND, 1, 1, FORMAT_NCHW, DT_BOOL); - auto switch_i = graphBuilder.AddNode("switch_i", SWITCH, 2, 2); - auto exit_i = graphBuilder.AddNode("switch_i", EXIT, 1, 1); - auto const_1 = graphBuilder.AddNode("const_1", CONSTANT, 0, 1); - auto add = graphBuilder.AddNode("add", ADD, 2, 1); - auto next_iteration_i = graphBuilder.AddNode("next_iteration_i", NEXTITERATION, 1, 1); - - auto data_a = graphBuilder.AddNode("data_a", DATA, 1, 1); - auto enter_a = graphBuilder.AddNode("enter_a", ENTER, 1, 1); - ge::AttrUtils::SetStr(enter_a->GetOpDesc(), ENTER_ATTR_FRAME_NAME, "1"); - auto merge_a = graphBuilder.AddNode("merge_a", MERGE, 2, 1); - auto switch_a = graphBuilder.AddNode("switch_a", SWITCH, 2, 2); - auto exit_a = graphBuilder.AddNode("exit_a", EXIT, 1, 1); - auto mul = graphBuilder.AddNode("mul", MUL, 2, 1); - auto const_2 = graphBuilder.AddNode("const_2", CONSTANT, 0, 1); - auto next_iteration_a = graphBuilder.AddNode("next_iteration_a", NEXTITERATION, 1, 1); - auto netoutput = graphBuilder.AddNode("netoutput", NETOUTPUT, 2, 2); - // i = i+1 - graphBuilder.AddDataEdge(data_i, 0, enter_i, 0); - graphBuilder.AddDataEdge(enter_i, 0, merge_i, 0); - graphBuilder.AddDataEdge(next_iteration_i, 0, merge_i, 1); - graphBuilder.AddDataEdge(merge_i, 0, less, 0); - graphBuilder.AddDataEdge(const_5, 0, less, 1); - graphBuilder.AddDataEdge(less, 0, loopcond, 0); - graphBuilder.AddDataEdge(loopcond, 0, switch_i, 1); - graphBuilder.AddDataEdge(merge_i, 0, switch_i, 0); - graphBuilder.AddDataEdge(switch_i, 0, exit_i, 0); - graphBuilder.AddDataEdge(switch_i, 1, add, 0); - graphBuilder.AddDataEdge(const_1, 0, add, 1); - graphBuilder.AddDataEdge(add, 0, next_iteration_i, 0); - graphBuilder.AddDataEdge(exit_i, 0, netoutput, 1); - // a=a*2 - graphBuilder.AddDataEdge(data_a, 0, enter_a, 0); - graphBuilder.AddDataEdge(enter_a, 0, merge_a, 0); - graphBuilder.AddDataEdge(next_iteration_a, 0, merge_a, 1); - graphBuilder.AddDataEdge(loopcond, 0, switch_a, 1); - graphBuilder.AddDataEdge(merge_a, 0, switch_a, 0); - graphBuilder.AddDataEdge(switch_a, 0, exit_a, 0); - graphBuilder.AddDataEdge(switch_a, 1, mul, 0); - graphBuilder.AddDataEdge(const_2, 0, mul, 1); - graphBuilder.AddDataEdge(mul, 0, next_iteration_a, 0); - graphBuilder.AddDataEdge(exit_a, 0, netoutput, 0); - // set const weight int64_t dims_size = 1; vector data_vec = {5}; for_each(data_vec.begin(), data_vec.end(), [&](int64_t &data) { dims_size *= data; }); vector data_value_vec(dims_size, 1); GeTensorDesc data_tensor_desc(GeShape(data_vec), FORMAT_NCHW, DT_INT32); - GeTensorPtr data_tensor = - make_shared(data_tensor_desc, (uint8_t *)data_value_vec.data(), data_value_vec.size() * sizeof(int32_t)); - OpDescUtils::SetWeights(const_5->GetOpDesc(), data_tensor); - OpDescUtils::SetWeights(const_2->GetOpDesc(), data_tensor); - OpDescUtils::SetWeights(const_1->GetOpDesc(), data_tensor); + GeTensorPtr data_tensor = make_shared(data_tensor_desc, (uint8_t *)data_value_vec.data(), + data_value_vec.size() * sizeof(int32_t)); - return graphBuilder.GetGraph(); + auto enter = OP_CFG(ENTER).Attr(ENTER_ATTR_FRAME_NAME, "1"); + auto const_op = OP_CFG(CONSTANT).Weight(data_tensor); + + DEF_GRAPH(g1) { + CHAIN(NODE("data_i", DATA) + ->NODE("enter_i", enter) + ->EDGE(0, 0) + ->NODE("merge_i", MERGE) + ->NODE("less", LESS) + ->NODE("loopcond", LOOPCOND)); + CHAIN(NODE("const_1", const_op) + ->EDGE(0, 1) + ->NODE("add", ADD) + ->NODE("iteration_i", NEXTITERATION) + ->EDGE(0, 1) + ->NODE("merge_i")); + CHAIN(NODE("const_5", const_op)->EDGE(0, 1)->NODE("less")); + CHAIN(NODE("loopcond") + ->EDGE(0, 1) + ->NODE("switch_i", SWITCH) + ->EDGE(0, 0) + ->NODE("exit_i", EXIT) + ->EDGE(0, 1) + ->NODE("netoutput", NETOUTPUT)); + CHAIN(NODE("merge_i")->EDGE(0, 0)->NODE("switch_i")->EDGE(1, 0)->NODE("add")); + CHAIN(NODE("data_a", DATA) + ->NODE("enter_a", enter) + ->NODE("merge_a", MERGE) + ->NODE("switch_a", SWITCH) + ->NODE("exit_a", EXIT) + ->EDGE(0, 0) + ->NODE("netoutput")); + CHAIN(NODE("iteration_a", NEXTITERATION)->EDGE(0, 1)->NODE("merge_a")); + CHAIN(NODE("loopcond")->EDGE(0, 1)->NODE("switch_a")->EDGE(1, 0)->NODE("mul", MUL)); + CHAIN(NODE("const_2", const_op)->EDGE(0, 1)->NODE("mul")->EDGE(0, 0)->NODE("iteration_a")); + }; + return ToGeGraph(g1); } } // namespace class FrameworkTest : public testing::Test { protected: + GeRunningEnvFaker ge_env; void SetUp() { ge_env.InstallDefault(); } void TearDown() {} - GeRunningEnvFaker ge_env; }; /// data data @@ -136,19 +107,19 @@ TEST_F(FrameworkTest, test_framework_add) { DEF_GRAPH(g1) { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data2", DATA)->NODE("add")); - }); + }; - auto graph = ToGeGraph(g1); - // new session & add graph map options; Session session(options); - auto ret = session.AddGraph(1, graph, options); - EXPECT_EQ(ret, SUCCESS); - // build input tensor + session.AddGraph(1, ToGeGraph(g1), options); std::vector inputs; - // build_graph through session - ret = session.BuildGraph(1, inputs); + auto ret = session.BuildGraph(1, inputs); + EXPECT_EQ(ret, SUCCESS); + CHECK_GRAPH(PreRunAfterBuild) { + ASSERT_EQ(graph->GetName(), "g1_1"); + ASSERT_EQ(graph->GetAllNodesSize(), 4); + }; } /** data a = 2; diff --git a/tests/st/testcase/test_ge_opt_info.cc b/tests/st/testcase/test_ge_opt_info.cc index 457473b1..2e8e5382 100644 --- a/tests/st/testcase/test_ge_opt_info.cc +++ b/tests/st/testcase/test_ge_opt_info.cc @@ -15,24 +15,12 @@ */ #include -#include "easy_graph/graph/box.h" -#include "easy_graph/graph/node.h" +#include "external/ge/ge_api.h" #include "easy_graph/builder/graph_dsl.h" -#include "easy_graph/builder/box_builder.h" -#include "easy_graph/layout/graph_layout.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_option.h" -#include "easy_graph/layout/engines/graph_easy/graph_easy_executor.h" -#include "graph/graph.h" #include "graph/compute_graph.h" #include "framework/common/types.h" -#include "graph/debug/ge_attr_define.h" +#include "graph/ge_local_context.h" #include "ge_graph_dsl/graph_dsl.h" -#include "ge_graph_dsl/op_desc/op_desc_cfg_box.h" -#define protected public -#define private public -#include "ge_opt_info/ge_opt_info.h" -#undef private -#undef protected namespace ge { class STEST_opt_info : public testing::Test { @@ -52,7 +40,7 @@ TEST_F(STEST_opt_info, get_opt_info_all) { DEF_GRAPH(g1) { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data2", DATA)->NODE("add")); - }); + }; auto graph = ToGeGraph(g1); @@ -95,7 +83,7 @@ TEST_F(STEST_opt_info, get_opt_info_success) { DEF_GRAPH(g1) { CHAIN(NODE("data1", DATA)->NODE("add", ADD)); CHAIN(NODE("data2", DATA)->NODE("add")); - }); + }; auto graph = ToGeGraph(g1); diff --git a/tests/st/testcase/test_main.cc b/tests/st/testcase/test_main.cc index a39c68aa..a7a71954 100644 --- a/tests/st/testcase/test_main.cc +++ b/tests/st/testcase/test_main.cc @@ -15,9 +15,8 @@ */ #include - -#include "common/debug/log.h" #include "external/ge/ge_api.h" +#include "ge_graph_dsl/assert/check_utils.h" #include "ge_running_env/include/ge_running_env/ge_running_env_faker.h" using namespace std; @@ -31,6 +30,7 @@ int main(int argc, char **argv) { std::cout << "ge init failed , ret code:" << init_status << endl; } GeRunningEnvFaker::BackupEnv(); + CheckUtils::init(); testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); return ret; diff --git a/tests/ut/common/graph/CMakeLists.txt b/tests/ut/common/graph/CMakeLists.txt index 73780967..ccf9ce5e 100644 --- a/tests/ut/common/graph/CMakeLists.txt +++ b/tests/ut/common/graph/CMakeLists.txt @@ -90,6 +90,7 @@ set(SRC_FILES "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" + "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 5b8958b4..d8fcd6c3 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -102,6 +102,7 @@ set(GRAPH_SRC_FILES "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" + "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" "${GE_CODE_DIR}/metadef/graph/utils/ge_ir_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" From 08bedf29f6490261c1e99140250610c94f30c411 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 1 Jul 2021 19:04:59 +0800 Subject: [PATCH 136/226] Update submodule. --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index 9c9907b7..f3f137de 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 9c9907b76a457f456072af96b8cbcfb7943beccc +Subproject commit f3f137de034885f0c7394d7f04b41b08d450d2d2 From 47b3762f6e24f1bf4eccfde786c55d27a5538943 Mon Sep 17 00:00:00 2001 From: lichun Date: Thu, 1 Jul 2021 21:03:31 +0800 Subject: [PATCH 137/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 2 +- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index ea6e2965..b903f6af 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -190,7 +190,7 @@ void KnownNodeExecutor::SettingDaviciModel(const HybridModel &model, const NodeP davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); - davinci_model->SetKnownShapeGlobalStep(global_step_var->MutableData()); + davinci_model->SetGlobalStep(global_step_var->MutableData()); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); } diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index 435928ee..dd2557d1 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -142,5 +142,5 @@ TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { KnownNodeExecutor known_node_executor; std::shared_ptr davinci_model = MakeShared(0, nullptr); known_node_executor.SettingDaviciModel(hybrid_model, node, davinci_model); - EXPECT_EQ(davinci_model->global_step_addr_, 520); + EXPECT_EQ(*(static_cast(davinci_model->global_step_addr_)), 520); } From ebf39e513d1095dfad509821e926bf2cdd72e79f Mon Sep 17 00:00:00 2001 From: y00500818 Date: Thu, 1 Jul 2021 21:28:57 +0800 Subject: [PATCH 138/226] bugfix for InferFormatForSingleOp --- ge/generator/ge_generator.cc | 10 +++++++--- inc/framework/generator/ge_generator.h | 2 +- tests/ut/ge/generator/ge_generator_unittest.cc | 11 ++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 505b1908..07355ab5 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -808,7 +808,7 @@ Status GeGenerator::CheckForSingleOp(OpDescPtr &op_desc, const vector return SUCCESS; } -Status GeGenerator::InferFormatForSingleOp(OpDescPtr &op_desc) { +Status GeGenerator::InferFormatForSingleOp(OpDescPtr &op_desc, Graph &graph) { GE_CHECK_NOTNULL(op_desc); if (OperatorFactoryImpl::GetInferFormatFunc(op_desc->GetType()) != nullptr) { auto node_op = ge::OperatorFactoryImpl::CreateOperator("node_op", op_desc->GetType()); @@ -832,7 +832,11 @@ Status GeGenerator::InferFormatForSingleOp(OpDescPtr &op_desc) { } node_op.BreakConnect(); } - auto op = OpDescUtils::CreateOperatorFromOpDesc(op_desc); + auto comp_graph = GraphUtils::GetComputeGraph(graph); + GE_CHECK_NOTNULL(comp_graph); + auto node = comp_graph->FindNode(op_desc->GetName()); + GE_CHECK_NOTNULL(node); + auto op = OpDescUtils::CreateOperatorFromNode(node); auto ret = op_desc->CallInferFormatFunc(op); if (ret != GRAPH_SUCCESS) { REPORT_INNER_ERROR("E19999", "call InferFormatFunc for single op:%s fail", @@ -879,7 +883,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in Graph graph; GE_CHK_STATUS(BuildSingleOpGraph(op_desc, inputs, outputs, name, graph), "[Build][Graph] for single op:%s fail.", op_desc->GetName().c_str()); - GE_CHK_STATUS_RET_NOLOG(InferFormatForSingleOp(op_desc)); + GE_CHK_STATUS_RET_NOLOG(InferFormatForSingleOp(op_desc, graph)); // 2. check engine type when compile online if (model_file_name == kFileNameSuffix) { diff --git a/inc/framework/generator/ge_generator.h b/inc/framework/generator/ge_generator.h index ee51d29d..5da5a593 100644 --- a/inc/framework/generator/ge_generator.h +++ b/inc/framework/generator/ge_generator.h @@ -106,7 +106,7 @@ class GE_FUNC_VISIBILITY GeGenerator { bool CheckNoAicore(const ComputeGraphPtr &graph); void RemoveConst(const vector &inputs, vector &outputs); Status CheckForSingleOp(OpDescPtr &op_desc, const vector &inputs, const vector &outputs); - Status InferFormatForSingleOp(OpDescPtr &op_desc); + Status InferFormatForSingleOp(OpDescPtr &op_desc, Graph &graph); using GeRootModelPtr = std::shared_ptr; Status SetModelNameForDump(const GeRootModelPtr &ge_root_model); diff --git a/tests/ut/ge/generator/ge_generator_unittest.cc b/tests/ut/ge/generator/ge_generator_unittest.cc index 1bb4430f..b3abb2f9 100644 --- a/tests/ut/ge/generator/ge_generator_unittest.cc +++ b/tests/ut/ge/generator/ge_generator_unittest.cc @@ -83,12 +83,16 @@ TEST_F(UtestGeGenerator, test_build_single_op_offline) { graphStatus TestFunc(Operator &op) { return 0; } graphStatus TestFunc1(Operator &op) { return 1; } TEST_F(UtestGeGenerator, test_infer_format_for_single_op) { + ComputeGraphPtr compute_graph = MakeShared("graph_name"); + auto graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); OperatorFactoryImpl::RegisterInferFormatFunc("Add", TestFunc); shared_ptr op_desc = make_shared("add", "add"); + compute_graph->AddNode(op_desc); GeGenerator generator; - EXPECT_EQ(generator.InferFormatForSingleOp(op_desc), SUCCESS); + EXPECT_EQ(generator.InferFormatForSingleOp(op_desc, graph), SUCCESS); shared_ptr op_desc1 = make_shared("Add", "Add"); - EXPECT_EQ(generator.InferFormatForSingleOp(op_desc1), SUCCESS); + compute_graph->AddNode(op_desc1); + EXPECT_EQ(generator.InferFormatForSingleOp(op_desc1, graph), SUCCESS); OperatorFactoryImpl::RegisterInferFormatFunc("MatMulV2", TestFunc1); shared_ptr op_desc2 = make_shared("MatMulV2", "MatMulV2"); GeTensorDesc tensor_desc; @@ -99,7 +103,8 @@ TEST_F(UtestGeGenerator, test_infer_format_for_single_op) { EXPECT_EQ(op_desc2->AddInputDesc(tensor_desc), GRAPH_SUCCESS); EXPECT_EQ(op_desc2->AddOutputDesc(tensor_desc), GRAPH_SUCCESS); EXPECT_EQ(op_desc2->AddOutputDesc(tensor_desc), GRAPH_SUCCESS); - EXPECT_EQ(generator.InferFormatForSingleOp(op_desc2), FAILED); + compute_graph->AddNode(op_desc2); + EXPECT_EQ(generator.InferFormatForSingleOp(op_desc2, graph), FAILED); } TEST_F(UtestGeGenerator, test_build_single_op_online) { From 2874ec935f700ce196c28a5b70c7d8070f7c9ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Fri, 25 Jun 2021 14:08:54 +0800 Subject: [PATCH 139/226] fix parallel group pass --- ge/graph/passes/parallel_group_pass.cc | 58 +++++++++++----- ge/graph/passes/parallel_group_pass.h | 1 + .../graph/passes/parallel_group_pass_unittest.cc | 80 +++++++++++++++++++++- 3 files changed, 119 insertions(+), 20 deletions(-) diff --git a/ge/graph/passes/parallel_group_pass.cc b/ge/graph/passes/parallel_group_pass.cc index 9c93f6cf..795002f1 100644 --- a/ge/graph/passes/parallel_group_pass.cc +++ b/ge/graph/passes/parallel_group_pass.cc @@ -15,7 +15,7 @@ */ #include "graph/passes/parallel_group_pass.h" - +#include #include "framework/common/debug/ge_log.h" #include "common/ge/ge_util.h" #include "framework/common/ge_inner_error_codes.h" @@ -299,24 +299,19 @@ Status ParallelGroupPass::ReplaceWithSwitchAndMerge(NodePtr pre_node, NodePtr cu for (const auto &switch_node : cur_itr->second.first) { int64_t pre_id = pre_node->GetOpDesc()->GetId(); int64_t switch_id = switch_node->GetOpDesc()->GetId(); - // avoid ring - if (pre_id > switch_id) { - auto merge_node = cur_itr->second.second; - if (AddCtrlEdge(merge_node, pre_node) != SUCCESS) { - GELOGE(FAILED, "[AddEdge][Node]Add edge for nodes: %s->%s failed.", - pre_node->GetName().c_str(), switch_node->GetName().c_str()); - REPORT_CALL_ERROR("E19999", "[AddEdge][Node]Add edge for nodes: %s->%s failed.", - pre_node->GetName().c_str(), switch_node->GetName().c_str()); - return FAILED; - } - } else { - if (AddCtrlEdge(pre_node, switch_node) != SUCCESS) { - GELOGE(FAILED, "[AddEdge][Node]Add edge for nodes: %s->%s failed.", - pre_node->GetName().c_str(), switch_node->GetName().c_str()); - REPORT_CALL_ERROR("E19999", "[AddEdge][Node]Add edge for nodes: %s->%s failed.", - pre_node->GetName().c_str(), switch_node->GetName().c_str()); - return FAILED; - } + NodePtr first_node = pre_node; + NodePtr second_node = switch_node; + if (pre_id > switch_id && IsIndirectConnect(switch_node, pre_node)) { + // avoid ring, merge->pre_node + first_node = cur_itr->second.second; + second_node = pre_node; + } + if (AddCtrlEdge(first_node, second_node) != SUCCESS) { + GELOGE(FAILED, "[AddEdge][Node]Add edge for nodes: %s->%s failed.", + first_node->GetName().c_str(), second_node->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "[AddEdge][Node]Add edge for nodes: %s->%s failed.", + first_node->GetName().c_str(), second_node->GetName().c_str()); + return FAILED; } } } else { @@ -345,4 +340,29 @@ bool ParallelGroupPass::IsWhileStreamSwitch(OpDescPtr switch_op_desc) { return (AttrUtils::GetInt(switch_op_desc, ATTR_NAME_STREAM_SWITCH_TYPE, stream_switch_type) && stream_switch_type == kLoopType); } + +bool ParallelGroupPass::IsIndirectConnect(const NodePtr &node_a, const NodePtr &node_b) { + if (node_a == nullptr || node_b == nullptr) { + GELOGW("node_a or node_b is nullptr."); + return false; + } + int64_t end_id = node_b->GetOpDesc()->GetId(); + std::queue nodes; + nodes.push(node_a); + while (!nodes.empty()) { + NodePtr tmp_node = nodes.front(); + nodes.pop(); + if (tmp_node == nullptr || tmp_node->GetOpDesc() == nullptr || + tmp_node->GetOpDesc()->GetId() > end_id) { + continue; + } + if (tmp_node == node_b) { + return true; + } + for (const auto &out_node : tmp_node->GetOutAllNodes()) { + nodes.push(out_node); + } + } + return false; +} } // namespace ge diff --git a/ge/graph/passes/parallel_group_pass.h b/ge/graph/passes/parallel_group_pass.h index cdcdabab..93b0b158 100644 --- a/ge/graph/passes/parallel_group_pass.h +++ b/ge/graph/passes/parallel_group_pass.h @@ -48,6 +48,7 @@ class ParallelGroupPass : public GraphPass { bool IsBigSmallLoopStreamSwitch(OpDescPtr switch_op_desc); bool IsWhileStreamSwitch(OpDescPtr switch_op_desc); + bool IsIndirectConnect(const NodePtr &node_a, const NodePtr &node_b); }; } // namespace ge #endif // GE_GRAPH_PASSES_PARALLEL_GROUP_PASS_H diff --git a/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc b/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc index 374fe837..a6c3ff6a 100644 --- a/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/parallel_group_pass_unittest.cc @@ -19,7 +19,8 @@ #include #define private public - +#include "inc/graph/ge_local_context.h" +#include "inc/external/ge/ge_api_types.h" #include "common/ge_inner_error_codes.h" #include "inc/pass_manager.h" #include "utils/graph_utils.h" @@ -225,6 +226,70 @@ class UtestGraphPassesParallelGgroupPass : public testing::Test { output_true_node_->GetOpDesc()->SetIsInputConst({false}); } + void BuildDefaultGraph3() { + /// input + /// \ + /// sqrt pred + /// \ / + /// Switch + /// | | + /// F T ------ + /// / \_/_ \ + /// / / \ \ + /// Merge sqrt2 sqrt3 + /// / \ \ + /// sqrt1 \ relu + /// \ \ + /// \ sqrt4 + /// \ / + /// Merge1 + input_node_ = NewNode("input", RELU, 0, 1); + AttrUtils::SetStr(input_node_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + pred_node_ = NewNode("pred", GREATER, 2, 1); + sqrt_node_ = NewNode("sqrt", SQRT, 1, 1); + cast_node_ = NewNode("cast", CAST, 2, 2); + + switch_node_t = NewNode("switch_t", STREAMSWITCH, 1, 1); + AttrUtils::SetBool(switch_node_t->GetOpDesc(), ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG, true); + switch_node_f = NewNode("switch_f", STREAMSWITCH, 1, 1); + AttrUtils::SetBool(switch_node_f->GetOpDesc(), ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG, false); + output_false_node_ = NewNode("false_output", RELU, 1, 2); + AttrUtils::SetStr(output_false_node_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + output_true_node_ = NewNode("true_output", RELU, 1, 2); + AttrUtils::SetStr(output_true_node_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + merge_node_ = NewNode("merge", STREAMMERGE, 2, 1); + sqrt_node1_ = NewNode("sqrt1", SQRT, 1, 1); + AttrUtils::SetStr(sqrt_node1_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + sqrt_node2_ = NewNode("sqrt2", SQRT, 1, 1); + AttrUtils::SetStr(sqrt_node2_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + sqrt_node3_ = NewNode("sqrt3", SQRT, 1, 1); + relu_node_ = NewNode("relu", RELU, 1, 1); + sqrt_node4_ = NewNode("sqrt4", SQRT, 1, 1); + AttrUtils::SetStr(sqrt_node4_->GetOpDesc(), ATTR_NAME_PARALLEL_GROUP, "1"); + merge_node1_ = NewNode("merge1", STREAMMERGE, 2, 1); + + GraphUtils::AddEdge(input_node_->GetOutDataAnchor(0), sqrt_node_->GetInDataAnchor(0)); + GraphUtils::AddEdge(pred_node_->GetOutDataAnchor(0), cast_node_->GetInDataAnchor(0)); + GraphUtils::AddEdge(sqrt_node_->GetOutDataAnchor(0), cast_node_->GetInDataAnchor(1)); + GraphUtils::AddEdge(cast_node_->GetOutDataAnchor(0), switch_node_t->GetInDataAnchor(0)); + GraphUtils::AddEdge(cast_node_->GetOutDataAnchor(1), switch_node_f->GetInDataAnchor(0)); + GraphUtils::AddEdge(switch_node_f->GetOutDataAnchor(0), output_false_node_->GetInDataAnchor(0)); + GraphUtils::AddEdge(switch_node_t->GetOutDataAnchor(0), output_true_node_->GetInDataAnchor(0)); + + GraphUtils::AddEdge(output_false_node_->GetOutDataAnchor(0), merge_node_->GetInDataAnchor(0)); + GraphUtils::AddEdge(output_true_node_->GetOutDataAnchor(0), merge_node_->GetInDataAnchor(1)); + GraphUtils::AddEdge(output_false_node_->GetOutDataAnchor(1), sqrt_node2_->GetInDataAnchor(0)); + GraphUtils::AddEdge(output_true_node_->GetOutDataAnchor(1), sqrt_node3_->GetInDataAnchor(0)); + + GraphUtils::AddEdge(merge_node_->GetOutDataAnchor(0), sqrt_node1_->GetInDataAnchor(0)); + GraphUtils::AddEdge(sqrt_node3_->GetOutDataAnchor(0), relu_node_->GetInDataAnchor(0)); + GraphUtils::AddEdge(relu_node_->GetOutDataAnchor(0), sqrt_node4_->GetInDataAnchor(0)); + GraphUtils::AddEdge(sqrt_node2_->GetOutDataAnchor(0), merge_node1_->GetInDataAnchor(0)); + GraphUtils::AddEdge(sqrt_node4_->GetOutDataAnchor(0), merge_node1_->GetInDataAnchor(1)); + output_false_node_->GetOpDesc()->SetIsInputConst({false}); + output_true_node_->GetOpDesc()->SetIsInputConst({false}); + } + ComputeGraphPtr graph_; ComputeGraphPtr sub_graph_; GeTensorDescPtr default_tensor_desc_; @@ -235,6 +300,9 @@ class UtestGraphPassesParallelGgroupPass : public testing::Test { NodePtr cast_node1_; NodePtr sqrt_node_; NodePtr sqrt_node1_; + NodePtr sqrt_node2_; + NodePtr sqrt_node3_; + NodePtr sqrt_node4_; NodePtr input_node_; NodePtr input_node1_; NodePtr switch_node_t; @@ -278,6 +346,16 @@ TEST_F(UtestGraphPassesParallelGgroupPass, normal_graph2) { EXPECT_EQ(true, input_node1_->GetOutControlAnchor()->IsLinkedWith(cast_node1_->GetInControlAnchor())); } +TEST_F(UtestGraphPassesParallelGgroupPass, normal_graph3) { + std::map options; + options.emplace(OPTION_GRAPH_RUN_MODE, "1"); + GetThreadLocalContext().SetGraphOption(options); + BuildDefaultGraph3(); + auto ret = pass_.Run(graph_); + EXPECT_EQ(ret, GRAPH_SUCCESS); + EXPECT_EQ(true, merge_node1_->GetOutControlAnchor()->IsLinkedWith(sqrt_node1_->GetInControlAnchor())); +} + TEST_F(UtestGraphPassesParallelGgroupPass, normal_subgraph) { BuildDefaultGraph1(); NodePtr input_node1 = NewNode("input1", RELU, 0, 1, true); From 3de58133d1d3e88d912dcc32fa07ac137bbc9a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=9B=E6=A5=A0?= Date: Fri, 2 Jul 2021 10:22:54 +0800 Subject: [PATCH 140/226] fix the chmod error when unpack .run files --- scripts/update/ge_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update/ge_update.sh b/scripts/update/ge_update.sh index d6bcd043..57266d06 100755 --- a/scripts/update/ge_update.sh +++ b/scripts/update/ge_update.sh @@ -38,7 +38,7 @@ function extract_deps_so_community() { echo "begin to extract .run file ........." chmod +x ./${DRIVER_RUN_NAME_C} - chmod +X ./${PACKAGE_NAME_C} + chmod +x ./${PACKAGE_NAME_C} [ -n "${DEP_TMP_DIR}" ] && rm -rf "${DEP_TMP_DIR}" ./${DRIVER_RUN_NAME_C} --noexec --extract=${DEP_TMP_DIR}/driver ./${PACKAGE_NAME_C} --noexec --extract=${DEP_TMP_DIR}/Packages_tmp From 9287ca4c4ca7285882d3a290d5526f1fb0310057 Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 2 Jul 2021 13:05:17 +0800 Subject: [PATCH 141/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.cc | 2 +- ge/graph/load/model_manager/davinci_model.h | 7 ------- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 7 +++---- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 7d82879f..87e0c6f2 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -4365,7 +4365,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &graph, const map void *{ diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index daf0c7e6..6cb79804 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -499,10 +499,6 @@ class DavinciModel { return exception_dumper_.DumpExceptionInfo(exception_infos); } - void SetKnownShapeGlobalStep(void *global_step) { - known_shape_global_step_ = global_step; - } - void DumperShrink() { data_dumper_.DumpShrink(); } @@ -1109,9 +1105,6 @@ class DavinciModel { vector output_descs_; vector output_formats_; - // known shape node for dump - void *known_shape_global_step_; - // op name to attrs mapping std::map>> op_name_to_attrs_; }; diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index b903f6af..c8ebd160 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -145,8 +145,6 @@ Status KnownNodeTask::InitDavinciModel(const HybridModel &model, TensorBuffer *w auto dump_properties = DumpManager::GetInstance().GetDumpProperties(model.GetSessionId()); if (dump_properties.IsDumpOpen() || dump_properties.IsOpDebugOpen()) { davinci_model_->SetDumpProperties(dump_properties); - void *global_step = model.GetGlobalStep(); - davinci_model_->SetKnownShapeGlobalStep(global_step); } void *weight = nullptr; @@ -182,7 +180,7 @@ Status KnownNodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) cons return SUCCESS; } -void KnownNodeExecutor::SettingDaviciModel(const HybridModel &model, const NodePtr &node, +void KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr &node, std::shared_ptr &davinci_model) const { // set known node flag as true davinci_model->SetKnownNode(true); @@ -190,6 +188,7 @@ void KnownNodeExecutor::SettingDaviciModel(const HybridModel &model, const NodeP davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); + GE_CHECK_NOTNULL(global_step_var); davinci_model->SetGlobalStep(global_step_var->MutableData()); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); @@ -212,7 +211,7 @@ Status KnownNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node std::shared_ptr davinci_model = MakeShared(0, nullptr); GE_CHECK_NOTNULL(davinci_model); - SettingDaviciModel(model, node, davinci_model); + SetDaviciModel(model, node, davinci_model); GELOGD("KnownNodeExecutor::LoadTask node id %ld.", node->GetOpDesc()->GetId()); GE_CHK_STATUS_RET(davinci_model->Assign(ge_model), diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h index 475feeb1..2d51db58 100644 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h @@ -59,7 +59,7 @@ class KnownNodeExecutor : public NodeExecutor { const NodePtr &node, GeModelPtr &ge_model, ComputeGraphPtr &graph); - void SettingDaviciModel(const HybridModel &model, const NodePtr &node, + void SetDaviciModel(const HybridModel &model, const NodePtr &node, std::shared_ptr &davinci_model) const; }; } // namespace hybrid From 9530a1631f5a2cfb274dac3eeef9cb9770e00222 Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 2 Jul 2021 15:34:00 +0800 Subject: [PATCH 142/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index c8ebd160..29c829be 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -188,7 +188,7 @@ void KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr & davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); - GE_CHECK_NOTNULL(global_step_var); + GE_CHK_BOOL_EXEC(global_step_var != nullptr, return); davinci_model->SetGlobalStep(global_step_var->MutableData()); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); From d74118080c8989eda1bbf9adfed4969dae6db22d Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 2 Jul 2021 15:55:23 +0800 Subject: [PATCH 143/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index dd2557d1..e6a6119e 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -141,6 +141,6 @@ TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { KnownNodeExecutor known_node_executor; std::shared_ptr davinci_model = MakeShared(0, nullptr); - known_node_executor.SettingDaviciModel(hybrid_model, node, davinci_model); + known_node_executor.SetDaviciModel(hybrid_model, node, davinci_model); EXPECT_EQ(*(static_cast(davinci_model->global_step_addr_)), 520); } From 91d70e5f93df1adea8f8bcdbd1ef9fde3582284f Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 10:43:42 +0800 Subject: [PATCH 144/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.cc | 2 +- ge/graph/load/model_manager/davinci_model.h | 7 +++++++ ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 87e0c6f2..7d82879f 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -4365,7 +4365,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &graph, const map void *{ diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index 6cb79804..daf0c7e6 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -499,6 +499,10 @@ class DavinciModel { return exception_dumper_.DumpExceptionInfo(exception_infos); } + void SetKnownShapeGlobalStep(void *global_step) { + known_shape_global_step_ = global_step; + } + void DumperShrink() { data_dumper_.DumpShrink(); } @@ -1105,6 +1109,9 @@ class DavinciModel { vector output_descs_; vector output_formats_; + // known shape node for dump + void *known_shape_global_step_; + // op name to attrs mapping std::map>> op_name_to_attrs_; }; diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 29c829be..96392fe1 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -145,6 +145,8 @@ Status KnownNodeTask::InitDavinciModel(const HybridModel &model, TensorBuffer *w auto dump_properties = DumpManager::GetInstance().GetDumpProperties(model.GetSessionId()); if (dump_properties.IsDumpOpen() || dump_properties.IsOpDebugOpen()) { davinci_model_->SetDumpProperties(dump_properties); + void *global_step = model.GetGlobalStep(); + davinci_model_->SetKnownShapeGlobalStep(); } void *weight = nullptr; From 988ef307399fc8720f4d03a8ada5af835b9db674 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 10:44:40 +0800 Subject: [PATCH 145/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 96392fe1..753cf4ba 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -146,7 +146,7 @@ Status KnownNodeTask::InitDavinciModel(const HybridModel &model, TensorBuffer *w if (dump_properties.IsDumpOpen() || dump_properties.IsOpDebugOpen()) { davinci_model_->SetDumpProperties(dump_properties); void *global_step = model.GetGlobalStep(); - davinci_model_->SetKnownShapeGlobalStep(); + davinci_model_->SetKnownShapeGlobalStep(global_step); } void *weight = nullptr; From 9321cd84f5873afa9ff8a36c21b22369588701c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Sat, 3 Jul 2021 07:26:22 +0000 Subject: [PATCH 146/226] update README_CN.md. --- README_CN.md | 53 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/README_CN.md b/README_CN.md index 0a1e9c09..48fe4216 100644 --- a/README_CN.md +++ b/README_CN.md @@ -34,18 +34,6 @@ 在训练/推理过程中,上述过程会自动执行,通过上述图操作,GE可以将前端下发的图转换为一种可以在昇腾AI处理器上高效运行的图模式。 - - -- [安装说明](#安装说明) - - [安装GE](#安装ge) - - [源码安装](#源码安装) - - [社区](#社区) - - [贡献](#贡献) - - [Release Notes](#release-notes) - - [License](#license) - - - # 安装说明 ## 安装GE @@ -54,45 +42,8 @@ GE内嵌在MindSpore安装包中,MindSpore安装完毕后,GE以三个动态 ## 源码安装 -GE也支持由源码编译,进行源码编译前,首先确保你有昇腾910 AI处理器的环境,同时系统满足以下要求: - -- GCC >= 7.3.0 -- CMake >= 3.14.0 -- Autoconf >= 2.64 -- Libtool >= 2.4.6 -- Automake >= 1.15.1 - -编译完成后会生成几个动态库,他们会链接到MindSpore中执行,无法单独运行。 - -1. 下载GE源码。 - - GE源码托管在码云平台,可由此下载。 - ``` - git clone https://gitee.com/mindspore/graphengine.git - cd graphengine - ``` - -2. 在GE根目录下执行下列命令即可进行编译。 - - ``` - bash build.sh - ``` - - > - 开始编译之前,请确保正确设置相关的环境变量。 - > - 在`build.sh`的脚本中,会进行`git clone`操作,请确保网络连接正常且git配置正确。 - > - 在`build.sh`的脚本中,默认会8线程编译,如果机器性能较差,可能会编译失败。可以通过`-j{线程数}`来控制线程数,如`bash build.sh –j4`。 - -3. 完成编译后,相应的动态库文件会生成在output文件夹中。 - -更多指令帮助,可以使用: -``` -bash build.sh –h -``` -如果想清除历史编译记录,可以如下操作: -``` -rm -rf build/ output/ -bash build.sh -``` +GE也支持由源码编译,请参考以下链接完成: +[个人开发工具链](https://gitee.com/mindspore/graphengine/blob/master/scripts/readme.md) ## 社区 From d488c042a57344e7b0759c335860eeb49a132155 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 15:38:36 +0800 Subject: [PATCH 147/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.cc | 5 +++++ ge/graph/load/model_manager/davinci_model.h | 2 +- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 9 +++++---- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 7d82879f..6bf2c6d5 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -1480,6 +1480,11 @@ Status DavinciModel::GetLabelGotoAddr(uint32_t label_index, rtMemType_t mem_type return SUCCESS; } +void DavinciModel::SetGlobalStep(void *global_step, uint64_t global_step_size) { + global_step_addr_ = global_step; + global_step_size_ = global_step_size; +} + /// @ingroup ge /// @brief LabelSet Op Initialize. /// @param [in] op_desc: LabelSet Op descriptor. diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index daf0c7e6..db53d80f 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -300,7 +300,7 @@ class DavinciModel { return op_list_.at(index); } - void SetGlobalStep(void *global_step) { global_step_addr_ = global_step; } + void SetGlobalStep(void *global_step, uint64_t global_step_size); void *GetGlobalStep() const { return global_step_addr_; } // get task info for profiling diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 753cf4ba..292969b6 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -182,7 +182,7 @@ Status KnownNodeExecutor::PrepareTask(NodeTask &task, TaskContext &context) cons return SUCCESS; } -void KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr &node, +Status KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr &node, std::shared_ptr &davinci_model) const { // set known node flag as true davinci_model->SetKnownNode(true); @@ -190,10 +190,11 @@ void KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr & davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); - GE_CHK_BOOL_EXEC(global_step_var != nullptr, return); - davinci_model->SetGlobalStep(global_step_var->MutableData()); + GE_CHECK_NOTNULL(global_step_var); + davinci_model->SetGlobalStep(global_step_var->MutableData(), global_step_var->GetSize()); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); + return SUCCESS; } Status KnownNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node, @@ -213,7 +214,7 @@ Status KnownNodeExecutor::LoadTask(const HybridModel &model, const NodePtr &node std::shared_ptr davinci_model = MakeShared(0, nullptr); GE_CHECK_NOTNULL(davinci_model); - SetDaviciModel(model, node, davinci_model); + GE_CHK_STATUS_RET_NOLOG(SetDaviciModel(model, node, davinci_model)); GELOGD("KnownNodeExecutor::LoadTask node id %ld.", node->GetOpDesc()->GetId()); GE_CHK_STATUS_RET(davinci_model->Assign(ge_model), diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h index 2d51db58..37b5a3d8 100644 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.h @@ -59,8 +59,8 @@ class KnownNodeExecutor : public NodeExecutor { const NodePtr &node, GeModelPtr &ge_model, ComputeGraphPtr &graph); - void SetDaviciModel(const HybridModel &model, const NodePtr &node, - std::shared_ptr &davinci_model) const; + Status SetDaviciModel(const HybridModel &model, const NodePtr &node, + std::shared_ptr &davinci_model) const; }; } // namespace hybrid } // namespace ge From 6bfd96b5409451eca22d82c60fad9679b167ad47 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 17:54:44 +0800 Subject: [PATCH 148/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.cc | 20 +++++++++++--------- ge/graph/load/model_manager/davinci_model.h | 7 ------- .../compiledsubgraph/known_node_executor.cc | 7 ++----- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 6bf2c6d5..2306665c 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -1547,14 +1547,16 @@ Status DavinciModel::InitLabelSet(const OpDescPtr &op_desc) { } Status DavinciModel::InitVariable(const OpDescPtr &op_desc, map &variable_by_name) { - if (op_desc->GetName() == NODE_NAME_GLOBAL_STEP) { - const auto output_sizes = ModelUtils::GetOutputSize(op_desc); - if (!output_sizes.empty()) { - global_step_size_ = output_sizes[0]; - } - const auto output_addrs = ModelUtils::GetOutputDataAddrs(runtime_param_, op_desc); - if (!output_addrs.empty()) { - global_step_addr_ = output_addrs[0]; + if (!known_node_) { + if (op_desc->GetName() == NODE_NAME_GLOBAL_STEP) { + const auto output_sizes = ModelUtils::GetOutputSize(op_desc); + if (!output_sizes.empty()) { + global_step_size_ = output_sizes[0]; + } + const auto output_addrs = ModelUtils::GetOutputDataAddrs(runtime_param_, op_desc); + if (!output_addrs.empty()) { + global_step_addr_ = output_addrs[0]; + } } } @@ -4370,7 +4372,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &graph, const map void *{ diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index db53d80f..4ff36677 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -499,10 +499,6 @@ class DavinciModel { return exception_dumper_.DumpExceptionInfo(exception_infos); } - void SetKnownShapeGlobalStep(void *global_step) { - known_shape_global_step_ = global_step; - } - void DumperShrink() { data_dumper_.DumpShrink(); } @@ -1109,9 +1105,6 @@ class DavinciModel { vector output_descs_; vector output_formats_; - // known shape node for dump - void *known_shape_global_step_; - // op name to attrs mapping std::map>> op_name_to_attrs_; }; diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 292969b6..fd33f8b9 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -145,8 +145,6 @@ Status KnownNodeTask::InitDavinciModel(const HybridModel &model, TensorBuffer *w auto dump_properties = DumpManager::GetInstance().GetDumpProperties(model.GetSessionId()); if (dump_properties.IsDumpOpen() || dump_properties.IsOpDebugOpen()) { davinci_model_->SetDumpProperties(dump_properties); - void *global_step = model.GetGlobalStep(); - davinci_model_->SetKnownShapeGlobalStep(global_step); } void *weight = nullptr; @@ -189,9 +187,8 @@ Status KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr davinci_model->SetId(model.GetModelId()); davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); - TensorValue *global_step_var = model.GetVariable(NODE_NAME_GLOBAL_STEP); - GE_CHECK_NOTNULL(global_step_var); - davinci_model->SetGlobalStep(global_step_var->MutableData(), global_step_var->GetSize()); + void *global_step = model.GetGlobalStep(); + davinci_model->SetGlobalStep(global_step, sizeof(int64_t)); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); return SUCCESS; From 95944c17963c0595091de45486204f0a5e5d9d44 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 18:05:43 +0800 Subject: [PATCH 149/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index fd33f8b9..e5663fb8 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -188,6 +188,7 @@ Status KnownNodeExecutor::SetDaviciModel(const HybridModel &model, const NodePtr davinci_model->SetDumpModelName(model.GetModelName()); davinci_model->SetOmName(model.GetOmName()); void *global_step = model.GetGlobalStep(); + GE_CHECK_NOTNULL(global_step); davinci_model->SetGlobalStep(global_step, sizeof(int64_t)); // set model id as root node's node id davinci_model->SetSubModelId(node->GetOpDesc()->GetId()); From dcdfae9453ef209439b14801514a66227524b3d0 Mon Sep 17 00:00:00 2001 From: lichun Date: Sat, 3 Jul 2021 18:14:27 +0800 Subject: [PATCH 150/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- ge/graph/load/model_manager/davinci_model.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 2306665c..9d86039a 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -4372,7 +4372,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &graph, const map void *{ From 8b9ddcbc0ebfa07193a6c468120c0e23337936fd Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 3 Jul 2021 19:10:51 +0800 Subject: [PATCH 151/226] Fix cross merge for switch --- .../passes/mark_force_unknown_for_cond_pass.cc | 64 +++++++++++++++++++--- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index aa36a43b..a9b2c70f 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -145,17 +145,63 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const NodePtr &node, std: /// @return /// void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::map> &switch_groups) { - for (auto it = switch_groups.begin(); it != switch_groups.end(); ++it) { - const auto &op_node = it->first; - const auto &op_desc = op_node->GetOpDesc(); - if (op_desc->HasAttr(ATTR_NAME_CONTROL_FLOW_GROUP)) { - continue; + // Step 0: no group assigned. such as: + // Merge1{id=0, group=} => {Switch1{id=1, group=}, Switch2{id=2, group=}} + // Merge2{id=3, group=} => {Switch1{id=1, group=}, Switch3{id=4, group=}} + // Merge3{id=5, group=} => {Switch4{id=6, group=}, Switch5{id=7, group=}} + // Merge4{id=8, group=} => {Switch1{id=1, group=}, Switch5{id=7, group=}} + std::map unique_groups; + const auto GetGroupIndex = [&unique_groups](const NodePtr &merge, const std::vector &switch_group) { + int64_t group_index = merge->GetOpDesc()->GetId(); + std::set group_ids{group_index}; + for (const auto &node : switch_group) { + if (AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index)) { + GELOGI("[%s] Get group from [%s], index[%ld]", merge->GetName().c_str(), node->GetName().c_str(), group_index); + group_ids.insert(group_index); + } + } + + const auto it = unique_groups.find(group_index); + if (it != unique_groups.end()) { + group_index = it->second; } - int64_t group_index = op_desc->GetId(); - SetControlFlowGroup(op_node, group_index); - for (const auto &n : it->second) { - SetControlFlowGroup(n, group_index); + for (auto id : group_ids) { + unique_groups[id] = group_index; + } + + return group_index; + }; + + const auto SetGroupIndex = [](const NodePtr &merge, const std::vector &switch_group, int64_t group_index) { + SetControlFlowGroup(merge, group_index); + for (const auto &node : switch_group) { + SetControlFlowGroup(node, group_index); + } + }; + + // Step 1: Set group index to merge, if switch already has group, use assigned group. + // Merge1{id=0, group=0} => {Switch1{id=1, group=0}, Switch2{id=2, group=0}} + // Merge2{id=3, group=0} => {Switch1{id=1, group=0}, Switch3{id=4, group=0}} + // Merge3{id=5, group=5} => {Switch4{id=6, group=5}, Switch5{id=7, group=5}} + // Merge4{id=8, group=0} => {Switch1{id=1, group=0}, Switch5{id=7, group=0}} + for (const auto group : switch_groups) { + int64_t group_index = GetGroupIndex(group.first, group.second); + SetGroupIndex(group.first, group.second, group_index); + } + + // Step 2: Adjust crossed merge group for unique group. + // Merge1{id=0, group=0} => {Switch1{id=1, group=0}, Switch2{id=2, group=0}} + // Merge2{id=3, group=0} => {Switch1{id=1, group=0}, Switch3{id=4, group=0}} + // Merge3{id=5, group=0} => {Switch4{id=6, group=0}, Switch5{id=7, group=0}} + // Merge4{id=8, group=0} => {Switch1{id=1, group=0}, Switch5{id=7, group=0}} + for (const auto group : switch_groups) { + int64_t group_index = -1; + (void)AttrUtils::GetInt(group.first->GetOpDesc(), ATTR_NAME_CONTROL_FLOW_GROUP, group_index); + + const auto it = unique_groups.find(group_index); + if (it != unique_groups.end() && it->first != it->second) { + SetGroupIndex(group.first, group.second, it->second); } } } From eb11a6e55c2d51456c47e100c2538e1099270cda Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 5 Jul 2021 08:41:54 +0800 Subject: [PATCH 152/226] Fix lambda expression name --- ge/graph/passes/mark_force_unknown_for_cond_pass.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index a9b2c70f..67b6c617 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -151,7 +151,7 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::map {Switch4{id=6, group=}, Switch5{id=7, group=}} // Merge4{id=8, group=} => {Switch1{id=1, group=}, Switch5{id=7, group=}} std::map unique_groups; - const auto GetGroupIndex = [&unique_groups](const NodePtr &merge, const std::vector &switch_group) { + const auto get_group_index = [&unique_groups](const NodePtr &merge, const std::vector &switch_group) { int64_t group_index = merge->GetOpDesc()->GetId(); std::set group_ids{group_index}; for (const auto &node : switch_group) { @@ -173,7 +173,7 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::map &switch_group, int64_t group_index) { + const auto set_group_index = [](const NodePtr &merge, const std::vector &switch_group, int64_t group_index) { SetControlFlowGroup(merge, group_index); for (const auto &node : switch_group) { SetControlFlowGroup(node, group_index); @@ -186,8 +186,8 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::map {Switch4{id=6, group=5}, Switch5{id=7, group=5}} // Merge4{id=8, group=0} => {Switch1{id=1, group=0}, Switch5{id=7, group=0}} for (const auto group : switch_groups) { - int64_t group_index = GetGroupIndex(group.first, group.second); - SetGroupIndex(group.first, group.second, group_index); + int64_t group_index = get_group_index(group.first, group.second); + set_group_index(group.first, group.second, group_index); } // Step 2: Adjust crossed merge group for unique group. @@ -201,7 +201,7 @@ void MarkForceUnknownForCondPass::MarkUnknownForSwitch(const std::mapfirst != it->second) { - SetGroupIndex(group.first, group.second, it->second); + set_group_index(group.first, group.second, it->second); } } } From 42c4dee78f2955d0db507fceb87f34cae1732dab Mon Sep 17 00:00:00 2001 From: wuweikang Date: Mon, 5 Jul 2021 09:59:23 +0800 Subject: [PATCH 153/226] fix dump step check --- ge/common/dump/dump_properties.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 84bdb7bf..bc645f61 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -204,7 +204,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { if (enable_dump_ == kEnableFlag) { std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS && !dump_step.empty()) { GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); GELOGI("Get dump step %s successfully", dump_step.c_str()); SetDumpStep(dump_step); From 6314c48f921201de882d64449a49342a782bffeb Mon Sep 17 00:00:00 2001 From: lichun Date: Mon, 5 Jul 2021 10:07:42 +0800 Subject: [PATCH 154/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index e6a6119e..ea499422 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -135,10 +135,9 @@ TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { HybridModel hybrid_model(ge_root_model); auto *step_id = new int64_t[1]; step_id[0] = 520; - std::unique_ptr tensor_value; - tensor_value.reset(new(std::nothrow)TensorValue((void*)step_id, sizeof(step_id))); - hybrid_model.variable_tensors_.insert({"ge_global_step", std::move(tensor_value)}); - + std::unique_ptr tensor_buf; + tensor_buf = tensor_buf->Create((void *)step_id, sizeof(int64_t)); + hybrid_model.global_step_ = std::move(tensor_buf); KnownNodeExecutor known_node_executor; std::shared_ptr davinci_model = MakeShared(0, nullptr); known_node_executor.SetDaviciModel(hybrid_model, node, davinci_model); From 27dae9195ce46815a0d71f5caa21247937ed9eb4 Mon Sep 17 00:00:00 2001 From: lichun Date: Mon, 5 Jul 2021 10:30:59 +0800 Subject: [PATCH 155/226] add global step info for known subgraph in unknown model and generate om for remained cases when some single op cases run atc failed --- tests/ut/ge/hybrid/known_node_executor_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index ea499422..b6d06f5d 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -135,7 +135,7 @@ TEST_F(UnknownNodeExecutorTest, TestSetGlobalStep) { HybridModel hybrid_model(ge_root_model); auto *step_id = new int64_t[1]; step_id[0] = 520; - std::unique_ptr tensor_buf; + std::unique_ptr tensor_buf; tensor_buf = tensor_buf->Create((void *)step_id, sizeof(int64_t)); hybrid_model.global_step_ = std::move(tensor_buf); KnownNodeExecutor known_node_executor; From a145aaac29d01c71c81f4e562ca031ce1a0c3f33 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 5 Jul 2021 20:55:40 +0800 Subject: [PATCH 156/226] Atomic task for single_op. --- ge/single_op/single_op_model.cc | 160 ++++++++++++++-------- ge/single_op/single_op_model.h | 5 +- ge/single_op/task/op_task.cc | 101 +++++++++++++- ge/single_op/task/op_task.h | 42 ++++-- ge/single_op/task/tbe_task_builder.cc | 80 ++++++++--- ge/single_op/task/tbe_task_builder.h | 26 +++- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 1 - tests/ut/ge/single_op/single_op_model_unittest.cc | 22 ++- tests/ut/ge/single_op/single_op_task_unittest.cc | 27 ++++ 9 files changed, 363 insertions(+), 101 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 9a52a83d..f8831884 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -46,7 +46,12 @@ namespace { const size_t kDataOutputNum = 1; const uint32_t kInputIndexOfData = 0; const uint32_t kOutputIndexOfData = 0; +const size_t kNumTaskWithAtomicAddrCleanTask = 2; +const size_t kNumTaskWithMemCpyTask = 2; constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; +const char *const kEngineNameAiCore = "AIcoreEngine"; +const char *const kEngineNameAiCpu = "aicpu_ascend_kernel"; +const char *const kEngineNameAiCpuTf = "aicpu_tf_kernel"; Status CheckHostMem(const std::vector &dependencies, const NodePtr &node, bool &is_host_mem) { auto op_desc = node->GetOpDesc(); @@ -395,7 +400,7 @@ void SingleOpModel::ParseArgTable(OpTask *task, SingleOp &op) { } } } - + Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task) { GE_CHECK_NOTNULL(task); auto task_type = static_cast(task_def.type()); @@ -408,7 +413,7 @@ Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask * return ACL_ERROR_GE_INTERNAL_ERROR; } - auto *tbe_task = new (std::nothrow) TbeOpTask(); + std::unique_ptr tbe_task(new (std::nothrow) TbeOpTask()); if (tbe_task == nullptr) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Create][TbeOpTask]failed."); REPORT_INNER_ERROR("E19999", "BuildKernelTask fail for new TbeOpTask."); @@ -418,12 +423,41 @@ Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask * auto builder = TbeTaskBuilder(model_name_, iter->second, task_def); auto ret = builder.BuildTask(*tbe_task, model_params_); if (ret != SUCCESS) { - delete tbe_task; - tbe_task = nullptr; + GELOGE(ret, "[Build][TbeOpTask]failed."); + REPORT_INNER_ERROR("E19999", "[Build][TbeOpTask]failed."); + return ret; + } + + *task = tbe_task.release(); + return SUCCESS; +} + +Status SingleOpModel::BuildAtomicTask(const domi::TaskDef &task_def, AtomicOpTask **task) { + GE_CHECK_NOTNULL(task); + const auto &context = task_def.kernel().context(); + auto iter = op_list_.find(context.op_index()); + if (iter == op_list_.end()) { + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Param:TaskDef]op desc not found. op index = %u", context.op_index()); + REPORT_INNER_ERROR("E19999", "BuildKernelTask fail for op desc not found. op index = %u", context.op_index()); + return ACL_ERROR_GE_INTERNAL_ERROR; + } + + std::unique_ptr atomic_task(new (std::nothrow) AtomicOpTask()); + if (atomic_task == nullptr) { + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Create][AtomicOpTask]failed."); + REPORT_INNER_ERROR("E19999", "BuildKernelTask fail for new AtomicOpTask."); + return ACL_ERROR_GE_MEMORY_ALLOCATION; + } + + auto builder = AtomicTaskBuilder(model_name_, iter->second, task_def); + auto ret = builder.BuildTask(*atomic_task, model_params_); + if (ret != SUCCESS) { + GELOGE(ret, "[Build][AtomicOpTask]failed."); + REPORT_INNER_ERROR("E19999", "[Build][AtomicOpTask]failed."); return ret; } - *task = tbe_task; + *task = atomic_task.release(); return SUCCESS; } @@ -536,9 +570,21 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, auto compute_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); GE_CHECK_NOTNULL(compute_graph); single_op.compute_graph_ = compute_graph; - if (tbe_tasks_.size() > 0) { - const auto &task_def = tbe_tasks_[0]; + + GE_CHK_BOOL_RET_STATUS(node_tasks_.size() == 1, ACL_ERROR_GE_PARAM_INVALID, + "[Check][Size]Node size must be 1, but get %zu.", node_tasks_.size()); + auto iter = node_tasks_.begin(); + auto node = iter->first; + auto task_defs = iter->second; + GE_CHK_BOOL_RET_STATUS(task_defs.size() > 0 && task_defs.size() <= kNumTaskWithAtomicAddrCleanTask, + ACL_ERROR_GE_PARAM_INVALID, "[Check][Size]task_defs size must be 1 or 2, but get %zu.", task_defs.size()); + GE_CHECK_NOTNULL(node); + auto op_desc = node->GetOpDesc(); + GE_CHECK_NOTNULL(op_desc); + const auto &lib_name = op_desc->GetOpKernelLibName(); + if (lib_name == kEngineNameAiCore) { GELOGD("Building TBE task."); + const auto &task_def = task_defs.back(); TbeOpTask *tbe_task = nullptr; GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def, &tbe_task)); tbe_task->SetModelArgs(model_name_, model_id_); @@ -546,37 +592,43 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, GELOGD("tiling buffer is not nullptr."); tbe_task->stream_resource_ = stream_resource; } + if (task_defs.size() == kNumTaskWithAtomicAddrCleanTask) { + const auto &atomic_task_def = task_defs.front(); + AtomicOpTask *atomic_task = nullptr; + GE_CHK_STATUS_RET_NOLOG(BuildAtomicTask(atomic_task_def, &atomic_task)); + atomic_task->InitAtomicAddrCleanIndices(); + tbe_task->SetAtomicTask(atomic_task); + } single_op.op_task_.reset(tbe_task); - } else if (aicpu_tasks_.size() > 0) { - const auto &task_def = aicpu_tasks_[0]; - auto task_type = static_cast(task_def.type()); - if (task_type == RT_MODEL_TASK_KERNEL) { - GELOGD("Building AICPU_CC task"); - OpTask *task = nullptr; - uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; - GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); - GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); - task->SetModelArgs(model_name_, model_id_); - single_op.op_task_.reset(task); - } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { - GELOGD("Building AICPU_TF task"); - AiCpuTask *aicpu_task = nullptr; - uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; - GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); - GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, dynamic_singleop_kernel_id)); - if (aicpu_task->GetUnknownType() == DEPEND_COMPUTE) { - if (aicpu_tasks_.size() < 2) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Task]The copy task of the fourth operator was not found."); - REPORT_INNER_ERROR("E19999", "The copy task of the fourth operator was not found."); - return ACL_ERROR_GE_PARAM_INVALID; - } - const TaskDef ©_task_def = aicpu_tasks_[1]; - GE_CHK_STATUS_RET_NOLOG(aicpu_task->SetMemCopyTask(copy_task_def.kernel_ex())); + } else if (lib_name == kEngineNameAiCpu) { + const auto &task_def = task_defs[0]; + GELOGD("Building AICPU_CC task"); + OpTask *task = nullptr; + uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; + GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); + GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); + task->SetModelArgs(model_name_, model_id_); + single_op.op_task_.reset(task); + } else if (lib_name == kEngineNameAiCpuTf) { + const auto &task_def = task_defs[0]; + GELOGD("Building AICPU_TF task"); + AiCpuTask *aicpu_task = nullptr; + uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; + GELOGI("Build dynamic singleOp TfTask, kernel_id = %lu", dynamic_singleop_kernel_id); + GE_CHK_STATUS_RET_NOLOG(BuildKernelExTask(task_def.kernel_ex(), &aicpu_task, dynamic_singleop_kernel_id)); + if (aicpu_task->GetUnknownType() == DEPEND_COMPUTE) { + if (task_defs.size() < kNumTaskWithMemCpyTask) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Task]The copy task of the fourth operator was not found."); + REPORT_INNER_ERROR("E19999", "The copy task of the fourth operator was not found."); + return ACL_ERROR_GE_PARAM_INVALID; } - aicpu_task->SetModelArgs(model_name_, model_id_); - single_op.op_task_.reset(aicpu_task); + const TaskDef ©_task_def = task_defs[1]; + GE_CHK_STATUS_RET_NOLOG(aicpu_task->SetMemCopyTask(copy_task_def.kernel_ex())); } + aicpu_task->SetModelArgs(model_name_, model_id_); + single_op.op_task_.reset(aicpu_task); } + return SUCCESS; } @@ -585,9 +637,7 @@ Status SingleOpModel::NeedHybridModel(GeModelPtr &ge_model, bool &need_hybrid_mo bool is_host_mem = false; GE_CHK_STATUS_RET(CheckInferDepend(ge_model, is_infer_depend, is_host_mem), "[Check][InferDepend] failed."); bool need_d2h_cpy = is_infer_depend && !is_host_mem; - bool aicpu_multi_task = tbe_tasks_.size() >= 1 && aicpu_tasks_.size() >= 1; - bool aicore_multi_task = tbe_tasks_.size() > 1; - need_hybrid_model = need_d2h_cpy || aicore_multi_task || aicpu_multi_task; + need_hybrid_model = need_d2h_cpy || node_tasks_.size() > 1; return SUCCESS; } @@ -601,31 +651,27 @@ Status SingleOpModel::ParseTasks() { GELOGI("[%s] Task[%d], type = [%u], DebugString = [%s]", model_name_.c_str(), i, task_def.type(), task_def.DebugString().c_str()); auto task_type = static_cast(task_def.type()); + uint32_t op_index = 0; if (task_type == RT_MODEL_TASK_KERNEL) { - const auto &kernel_def = task_def.kernel(); - const auto &context = kernel_def.context(); - auto kernel_type = static_cast(context.kernel_type()); - if (kernel_type == ccKernelType::TE) { - tbe_tasks_.emplace_back(task_def); - } else if (kernel_type == ccKernelType::AI_CPU || kernel_type == ccKernelType::CUST_AI_CPU) { - aicpu_tasks_.emplace_back(task_def); - } else { - GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, - "[Check][Param:TaskDef]Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", - context.kernel_type()); - REPORT_INNER_ERROR("E19999", - "BuildModelTaskKernel fail for got:%u not supported, Only TBE, AI_CPU, CUST_AI_CPU kernel are supported.", - context.kernel_type()); - return ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID; - } - } else if (task_type == RT_MODEL_TASK_ALL_KERNEL) { - tbe_tasks_.emplace_back(task_def); + op_index = task_def.kernel().context().op_index(); } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { - aicpu_tasks_.emplace_back(task_def); + op_index = task_def.kernel_ex().op_index(); + } else if (task_type == RT_MODEL_TASK_ALL_KERNEL) { + op_index = task_def.kernel_with_handle().context().op_index(); } else { - // skip GELOGD("Skip task type: %d", static_cast(task_type)); + continue; + } + GELOGD("op_index = %u, task_type = %d", op_index, task_type); + + auto iter = op_list_.find(op_index); + if (iter == op_list_.end()) { + GELOGE(INTERNAL_ERROR, "[Find][Node]Failed to get node by op_index = %u", op_index); + REPORT_INNER_ERROR("E19999", "Failed to get node by op_index = %u.", op_index); + return INTERNAL_ERROR; } + auto &node = iter->second; + node_tasks_[node].emplace_back(task_def); } return SUCCESS; } diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index 45616d9a..83490f5f 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -69,6 +69,7 @@ class SingleOpModel { Status BuildTaskList(StreamResource *stream_resource, SingleOp &single_op); Status BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &dynamic_single_op); Status BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task); + Status BuildAtomicTask(const domi::TaskDef &task_def, AtomicOpTask **task); Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, uint64_t kernel_id); Status BuildCpuKernelTask(const domi::KernelDef &kernel_def, OpTask **task, uint64_t kernel_id); @@ -79,9 +80,7 @@ class SingleOpModel { Status NeedHybridModel(GeModelPtr &ge_model, bool &flag); Status ParseTasks(); - std::vector tbe_tasks_; - std::vector aicpu_tasks_; - + std::map> node_tasks_; std::string model_name_; uint32_t model_id_ = 0; const void *ori_model_data_; diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index 9b8ef739..dfdec750 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -27,7 +27,6 @@ #include "common/formats/formats.h" #include "common/math/math_util.h" #include "framework/common/debug/log.h" -#include "register/op_tiling.h" #include "runtime/rt.h" #include "single_op/task/build_task_utils.h" @@ -222,19 +221,26 @@ Status TbeOpTask::LaunchKernel(rtStream_t stream) { return SUCCESS; } -Status TbeOpTask::UpdateRunInfo() { - // invoke OpParaCalculate - GELOGD("Start to invoke OpParaCalculate."); - optiling::utils::OpRunInfo run_info(0, true, 0); +Status TbeOpTask::CalcTilingInfo(optiling::utils::OpRunInfo &run_info) { auto ret = optiling::OpParaCalculateV2(*node_, run_info); if (ret != GRAPH_SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpParaCalculate] failed, ret = %u.", ret); REPORT_INNER_ERROR("E19999", "invoke OpParaCalculate failed, ret = %u.", ret); return ACL_ERROR_GE_INTERNAL_ERROR; } + return SUCCESS; +} + +Status TbeOpTask::UpdateRunInfo() { + // invoke OpParaCalculate + GELOGD("Start to invoke OpParaCalculate."); + optiling::utils::OpRunInfo run_info(0, true, 0); + GE_CHK_STATUS_RET(CalcTilingInfo(run_info), "[Calc][TilingInfo]failed."); + block_dim_ = run_info.GetBlockDim(); tiling_data_ = run_info.GetAllTilingData().str(); tiling_key_ = run_info.GetTilingKey(); + clear_atomic_ = run_info.GetClearAtomic(); run_info.GetAllWorkspaces(run_info_workspaces_); GELOGD("Done invoking OpParaCalculate successfully. block_dim = %u, tiling size = %zu, tiling_key = %u", block_dim_, tiling_data_.size(), tiling_key_); @@ -263,6 +269,14 @@ Status TbeOpTask::UpdateTensorDesc(const GeTensorDesc &src_tensor, GeTensorDesc dst_tensor.SetOriginShape(src_tensor.GetShape()); } + int64_t size = 0; + graphStatus graph_status = TensorUtils::GetTensorMemorySizeInBytes(dst_tensor, size); + if (graph_status != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get tensor size in bytes failed!"); + GELOGE(graph_status, "[Get][TensorMemorySize] In Bytes failed!"); + return FAILED; + } + TensorUtils::SetSize(dst_tensor, size); return SUCCESS; } @@ -346,6 +360,17 @@ Status TbeOpTask::AllocateWorkspaces(const vector &workspace_sizes) { return SUCCESS; } +Status TbeOpTask::CheckAndExecuteAtomic(const vector &input_desc, + const vector &input_buffers, + vector &output_desc, + vector &output_buffers, + rtStream_t stream) { + if (clear_atomic_ && atomic_task_ != nullptr) { + return atomic_task_->LaunchKernel(input_desc, input_buffers, output_desc, output_buffers, stream); + } + return SUCCESS; +} + Status TbeOpTask::UpdateTilingArgs(rtStream_t stream) { size_t args_size = input_num_ + output_num_ + workspaces_.size(); if (tiling_buffer_ != nullptr) { @@ -433,6 +458,8 @@ Status TbeOpTask::LaunchKernel(const vector &input_desc, GE_CHK_STATUS_RET_NOLOG(UpdateNodeByShape(input_desc, output_desc)); GE_CHK_STATUS_RET_NOLOG(UpdateRunInfo()); GE_CHK_STATUS_RET(AllocateWorkspaces(run_info_workspaces_), "[Allocate][Workspaces] failed."); + GE_CHK_STATUS_RET(CheckAndExecuteAtomic(input_desc, input_buffers, output_desc, output_buffers, stream), + "[Execute][AtomicTask] failed."); GE_CHK_STATUS_RET(UpdateTilingArgs(stream), "[Update][TilingArgs] failed."); GELOGD("[%s] Start to invoke rtKernelLaunch", node_->GetName().c_str()); @@ -463,6 +490,70 @@ void TbeOpTask::GetIoAddr(uintptr_t *&arg_base, size_t &arg_count) { } } +Status AtomicOpTask::UpdateIoAddr(const vector &inputs, const vector &outputs) { + uintptr_t *arg_base = reinterpret_cast(args_.get()); + for (auto atomic_output_index : atomic_output_indices_) { + if (atomic_output_index >= static_cast(outputs.size())) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Update][Args] failed, atomic index must smaller then data size."); + REPORT_INNER_ERROR("E19999", "[Update][Args] failed, atomic index must smaller then data size."); + return ACL_ERROR_GE_PARAM_INVALID; + } + auto &output_buffer = outputs[atomic_output_index]; + *arg_base++ = reinterpret_cast(output_buffer.data); + } + return SUCCESS; +} + +Status AtomicOpTask::UpdateTilingArgs(rtStream_t stream) { + if (tiling_buffer_ != nullptr) { + GELOGD("[%s] Start to copy tiling info. size = %zu", node_->GetName().c_str(), tiling_data_.size()); + GE_CHK_RT_RET(rtMemcpyAsync(tiling_buffer_, max_tiling_size_, tiling_data_.data(), tiling_data_.size(), + RT_MEMCPY_HOST_TO_DEVICE_EX, stream)); + uintptr_t *arg_base = reinterpret_cast(args_.get()); + size_t idx = atomic_output_indices_.size(); + arg_base[idx] = reinterpret_cast(tiling_buffer_); + } + return SUCCESS; +} + +Status AtomicOpTask::CalcTilingInfo(optiling::utils::OpRunInfo &run_info) { + auto ret = optiling::OpAtomicCalculateV2(*node_, run_info); + if (ret != GRAPH_SUCCESS) { + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpAtomicCalculate] failed, ret = %u.", ret); + REPORT_INNER_ERROR("E19999", "invoke OpAtomicCalculate failed, ret = %u.", ret); + return ACL_ERROR_GE_INTERNAL_ERROR; + } + return SUCCESS; +} + +Status AtomicOpTask::InitAtomicAddrCleanIndices() { + GELOGD("[%s] Start to setup AtomicAddrClean task.", op_desc_->GetName().c_str()); + std::vector atomic_output_indices; + (void) ge::AttrUtils::GetListInt(op_desc_, ATOMIC_ATTR_OUTPUT_INDEX, atomic_output_indices); + if (atomic_output_indices.empty()) { + GELOGE(INTERNAL_ERROR, "[Check][Size][%s] atomic_output_indices must not be empty.", op_desc_->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "[%s] atomic_output_indices must not be empty.", op_desc_->GetName().c_str()); + return INTERNAL_ERROR; + } + + size_t max_arg_size = tiling_buffer_ == nullptr ? arg_size_ : arg_size_ - 1; + if (atomic_output_indices.size() > max_arg_size) { + GELOGE(INTERNAL_ERROR, "[Check][Size][%s] atomic_output_indices invalid. atomic_output_indices size is %zu," + "arg size is %zu.", op_desc_->GetName().c_str(), atomic_output_indices.size(), arg_size_); + REPORT_INNER_ERROR("E19999", "[%s] atomic_output_indices invalid. atomic_output_indices size is %zu," + "arg size is %zu.", op_desc_->GetName().c_str(), atomic_output_indices.size(), arg_size_); + return INTERNAL_ERROR; + } + + for (auto output_index : atomic_output_indices) { + GELOGD("[%s] Adding output index [%ld]", op_desc_->GetName().c_str(), output_index); + GE_CHECK_GE(output_index, 0); + GE_CHECK_LE(output_index, INT32_MAX); + atomic_output_indices_.emplace_back(static_cast(output_index)); + } + return SUCCESS; +} + AiCpuBaseTask::~AiCpuBaseTask() { if (ext_info_addr_dev_ != nullptr) { (void)rtFree(ext_info_addr_dev_); diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 085bb5ff..1e100a11 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -89,6 +89,7 @@ class TbeOpTask : public OpTask { void SetKernelArgs(std::unique_ptr &&args, size_t arg_size, uint32_t block_dim, const OpDescPtr &op_desc); void SetKernelWithHandleArgs(std::unique_ptr &&args, size_t arg_size, uint32_t block_dim, const OpDescPtr &op_desc, const domi::KernelDefWithHandle& kernel_def_with_handle); + void SetAtomicTask(OpTask *task) { atomic_task_.reset(task); } Status UpdateRunInfo() override; Status SetArgIndex(); @@ -100,6 +101,14 @@ class TbeOpTask : public OpTask { const std::string &GetTaskType() const override; void SetHandle(void *handle); + protected: + NodePtr node_; + std::unique_ptr args_; + size_t arg_size_ = 0; + void *tiling_buffer_ = nullptr; + uint32_t max_tiling_size_ = 0; + std::string tiling_data_; + private: friend class SingleOpModel; friend class TbeTaskBuilder; @@ -107,31 +116,46 @@ class TbeOpTask : public OpTask { Status UpdateNodeByShape(const vector &input_desc, const vector &output_desc); Status AllocateWorkspaces(const std::vector &workspace_sizes); - Status UpdateTilingArgs(rtStream_t stream); Status DoLaunchKernel(rtStream_t stream); - Status UpdateIoAddr(const vector &inputs, const vector &outputs); + Status CheckAndExecuteAtomic(const vector &input_desc, + const vector &input_buffers, + vector &output_desc, + vector &output_buffers, + rtStream_t stream); + virtual Status UpdateTilingArgs(rtStream_t stream); + virtual Status UpdateIoAddr(const vector &inputs, const vector &outputs); + virtual Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info); const void *stub_func_ = nullptr; - std::unique_ptr args_; - size_t arg_size_ = 0; void *sm_desc_ = nullptr; std::string stub_name_; - StreamResource *stream_resource_ = nullptr; - void *tiling_buffer_ = nullptr; - uint32_t max_tiling_size_ = 0; - std::string tiling_data_; + std::vector run_info_workspaces_; std::vector workspaces_; - NodePtr node_; uint32_t tiling_key_ = 0; + bool clear_atomic_ = false; void* handle_ = nullptr; std::string original_kernel_key_; std::string node_info_; std::vector arg_index_; // data index in args size_t input_num_; // include const input size_t output_num_; + + std::unique_ptr atomic_task_; +}; + +class AtomicOpTask : public TbeOpTask { + public: + Status InitAtomicAddrCleanIndices(); + + private: + Status UpdateIoAddr(const vector &inputs, const vector &outputs) override; + Status UpdateTilingArgs(rtStream_t stream) override; + Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info) override; + std::vector atomic_output_indices_; + }; class AiCpuBaseTask : public OpTask { diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index c1bafed8..c5579a01 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -29,15 +29,8 @@ namespace ge { namespace { constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; constexpr char const *kAttrOpParamSize = "op_para_size"; +constexpr char const *kAttrAtomicOpParamSize = "atomic_op_para_size"; std::mutex g_reg_mutex; - -inline void GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) { - (void)AttrUtils::GetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name); -} - -inline TBEKernelPtr GetTbeKernel(const OpDescPtr &op_desc) { - return op_desc->TryGetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, TBEKernelPtr()); -} } // namespace KernelHolder::KernelHolder(const char *stub_func, std::shared_ptr kernel_bin) @@ -96,7 +89,15 @@ TbeTaskBuilder::TbeTaskBuilder(const std::string &model_name, const NodePtr &nod task_def_(task_def), kernel_def_(task_def.kernel()), kernel_def_with_handle_(task_def.kernel_with_handle()), - stub_name_(model_name + "/" + node->GetName() + "_tvmbin") {} + model_name_(model_name) {} + +TBEKernelPtr TbeTaskBuilder::GetTbeKernel(const OpDescPtr &op_desc) const { + return op_desc->TryGetExtAttr(OP_EXTATTR_NAME_TBE_KERNEL, TBEKernelPtr()); +} + +void TbeTaskBuilder::GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const { + (void)AttrUtils::GetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name); +} Status TbeTaskBuilder::DoRegisterBinary(const OpKernelBin &kernel_bin, void **bin_handle, const SingleOpModelParam ¶m) const { @@ -124,7 +125,7 @@ Status TbeTaskBuilder::DoRegisterBinary(const OpKernelBin &kernel_bin, void **bi Status TbeTaskBuilder::DoRegisterMeta(void *bin_handle) { std::string meta_data; - (void)AttrUtils::GetStr(op_desc_, TVM_ATTR_NAME_METADATA, meta_data); + (void)AttrUtils::GetStr(op_desc_, GetKeyForTvmMetaData(), meta_data); GELOGI("TBE: meta data: %s", meta_data.empty() ? "null" : meta_data.c_str()); if (!meta_data.empty()) { auto rt_ret = rtMetadataRegister(bin_handle, meta_data.c_str()); @@ -307,6 +308,15 @@ Status TbeTaskBuilder::GetSmDesc(void **sm_desc, const SingleOpModelParam ¶m return SUCCESS; } +Status TbeTaskBuilder::InitKernelArgs(void *arg_addr, size_t arg_size, const SingleOpModelParam ¶m) { + // copy args + std::vector tensor_device_addr_vec = BuildTaskUtils::GetKernelArgs(op_desc_, param); + void *src_addr = reinterpret_cast(tensor_device_addr_vec.data()); + uint64_t src_len = sizeof(void *) * tensor_device_addr_vec.size(); + GE_CHK_RT_RET(rtMemcpy(arg_addr, arg_size, src_addr, src_len, RT_MEMCPY_HOST_TO_HOST)); + return SUCCESS; +} + Status TbeTaskBuilder::SetKernelArgs(TbeOpTask &task, const SingleOpModelParam ¶m, const OpDescPtr &op_desc) { auto task_type = static_cast(task_def_.type()); bool is_task_all_kernel = (task_type == RT_MODEL_TASK_ALL_KERNEL); @@ -331,12 +341,7 @@ Status TbeTaskBuilder::SetKernelArgs(TbeOpTask &task, const SingleOpModelParam & kernel_def_with_handle_.context() : kernel_def_.context(); const auto *args_offset_tmp = reinterpret_cast(context.args_offset().data()); uint16_t offset = *args_offset_tmp; - - // copy args - std::vector tensor_device_addr_vec = BuildTaskUtils::GetKernelArgs(op_desc_, param); - void *src_addr = reinterpret_cast(tensor_device_addr_vec.data()); - uint64_t src_len = sizeof(void *) * tensor_device_addr_vec.size(); - GE_CHK_RT_RET(rtMemcpy(args.get() + offset, arg_size - offset, src_addr, src_len, RT_MEMCPY_HOST_TO_HOST)); + GE_CHK_STATUS_RET_NOLOG(InitKernelArgs(args.get() + offset, arg_size - offset, param)); if (is_task_all_kernel) { task.SetKernelWithHandleArgs(std::move(args), arg_size, kernel_def_with_handle_.block_dim(), op_desc, @@ -367,8 +372,15 @@ Status TbeTaskBuilder::BuildTask(TbeOpTask &task, const SingleOpModelParam ¶ } auto task_type = static_cast(task_def_.type()); - ret = task_type == RT_MODEL_TASK_ALL_KERNEL ? RegisterKernelWithHandle(task, param) : - RegisterKernel(task, param); + if (task_type == RT_MODEL_TASK_ALL_KERNEL) { + stub_name_ = model_name_ + "/" + node_->GetName() + "_tvmbin"; + ret = RegisterKernelWithHandle(task, param); + } else { + const domi::KernelDef &kernel_def = task_def_.kernel(); + stub_name_ = model_name_ + "/" + kernel_def.stub_func() + "_tvmbin"; + ret = RegisterKernel(task, param); + } + task.SetHandle(handle_); if (ret != SUCCESS) { return ret; @@ -397,8 +409,8 @@ Status TbeTaskBuilder::BuildTask(TbeOpTask &task, const SingleOpModelParam ¶ Status TbeTaskBuilder::InitTilingInfo(TbeOpTask &task) { GELOGD("Start alloc tiling data of node %s.", op_desc_->GetName().c_str()); int64_t max_size = -1; - (void)AttrUtils::GetInt(op_desc_, kAttrOpParamSize, max_size); - GELOGD("Got op param size by key: %s, ret = %ld", kAttrOpParamSize, max_size); + (void)AttrUtils::GetInt(op_desc_, GetKeyForOpParamSize(), max_size); + GELOGD("Got op param size by key: %s, ret = %ld", GetKeyForOpParamSize().c_str(), max_size); if (max_size < 0) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Get][Int] %s Invalid op_param_size: %ld.", op_desc_->GetName().c_str(), max_size); @@ -439,4 +451,32 @@ Status TbeTaskBuilder::GetMagic(uint32_t &magic) const { return SUCCESS; } +std::string TbeTaskBuilder::GetKeyForOpParamSize() const { + return kAttrOpParamSize; +} + +std::string TbeTaskBuilder::GetKeyForTvmMetaData() const { + return TVM_ATTR_NAME_METADATA; +} + +Status AtomicTaskBuilder::InitKernelArgs(void *args_addr, size_t arg_size, const SingleOpModelParam ¶m) { + return SUCCESS; +} + +std::string AtomicTaskBuilder::GetKeyForOpParamSize() const { + return kAttrAtomicOpParamSize; +} + +std::string AtomicTaskBuilder::GetKeyForTvmMetaData() const { + return ATOMIC_ATTR_TVM_METADATA; +} + +void AtomicTaskBuilder::GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const { + (void)AttrUtils::GetStr(op_desc, op_desc->GetName() + "_atomic_kernelname", kernel_name); +} + +TBEKernelPtr AtomicTaskBuilder::GetTbeKernel(const OpDescPtr &op_desc) const { + return op_desc->TryGetExtAttr(EXT_ATTR_ATOMIC_TBE_KERNEL, TBEKernelPtr()); +} + } // namespace ge diff --git a/ge/single_op/task/tbe_task_builder.h b/ge/single_op/task/tbe_task_builder.h index 6252feea..833ab0e0 100755 --- a/ge/single_op/task/tbe_task_builder.h +++ b/ge/single_op/task/tbe_task_builder.h @@ -90,10 +90,17 @@ class HandleRegistry { class TbeTaskBuilder { public: TbeTaskBuilder(const std::string &model_name, const NodePtr &node, const domi::TaskDef &task_def); - ~TbeTaskBuilder() = default; + virtual ~TbeTaskBuilder() = default; Status BuildTask(TbeOpTask &task, const SingleOpModelParam ¶m); + protected: + virtual std::string GetKeyForOpParamSize() const; + virtual std::string GetKeyForTvmMetaData() const; + virtual TBEKernelPtr GetTbeKernel(const OpDescPtr &op_desc) const; + virtual void GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const; + virtual Status InitKernelArgs(void *args_addr, size_t arg_size, const SingleOpModelParam ¶m); + private: Status InitTilingInfo(TbeOpTask &task); Status SetKernelArgs(TbeOpTask &task, const SingleOpModelParam ¶m, const OpDescPtr &op_desc); @@ -114,9 +121,24 @@ class TbeTaskBuilder { const domi::TaskDef &task_def_; const domi::KernelDef &kernel_def_; const domi::KernelDefWithHandle &kernel_def_with_handle_; - const std::string stub_name_; + const std::string model_name_; + std::string stub_name_; void *handle_ = nullptr; }; + +class AtomicTaskBuilder : public TbeTaskBuilder { + public: + AtomicTaskBuilder(const std::string &model_name, const NodePtr &node, const domi::TaskDef &task_def) + : TbeTaskBuilder(model_name, node, task_def) {} + ~AtomicTaskBuilder() override = default; + + protected: + std::string GetKeyForOpParamSize() const override; + std::string GetKeyForTvmMetaData() const override; + TBEKernelPtr GetTbeKernel(const OpDescPtr &op_desc) const override; + void GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const override; + Status InitKernelArgs(void *args_addr, size_t arg_size, const SingleOpModelParam ¶m) override; +}; } // namespace ge #endif // GE_SINGLE_OP_TASK_TBE_TASK_BUILDER_H_ diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index d1c51c67..1d1c4fa9 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -153,7 +153,6 @@ TEST_F(UtestGeHybrid, task_update_tiling_info) { ge::AttrUtils::SetStr(op_desc, "compile_info_json", "json"); ge::AttrUtils::SetBool(op_desc, "support_dynamicshape", true); ge::AttrUtils::SetInt(op_desc, "op_para_size", 1); - ge::AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); auto node = graph->AddNode(op_desc); std::unique_ptr node_item; diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index 23269814..ded1b465 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -40,6 +40,9 @@ using namespace ge; namespace { constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape"; +const char *const kEngineNameAiCore = "AIcoreEngine"; +const char *const kEngineNameAiCpu = "aicpu_ascend_kernel"; +const char *const kEngineNameAiCpuTf = "aicpu_tf_kernel"; } // namespace class UtestSingleOpModel : public testing::Test { @@ -222,6 +225,7 @@ TEST_F(UtestSingleOpModel, test_build_dynamic_op) { auto graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); model.model_helper_.model_->SetGraph(graph); + model.op_list_[0] = transdata; auto op_desc = transdata->GetOpDesc(); const vector depend_names = { "Data" }; @@ -330,7 +334,10 @@ TEST_F(UtestSingleOpModel, build_dynamic_task) { domi::TaskDef *task_def3 = model_task_def->add_task(); task_def3->set_type(RT_MODEL_TASK_ALL_KERNEL); - string model_data_str = "123456789"; + domi::TaskDef *task_def4 = model_task_def->add_task(); + task_def4->set_type(RT_MODEL_TASK_KERNEL); + + string model_data_str = "dynamic_model"; SingleOpModel model("model", model_data_str.c_str(), model_data_str.size()); std::mutex stream_mu; rtStream_t stream = nullptr; @@ -339,6 +346,7 @@ TEST_F(UtestSingleOpModel, build_dynamic_task) { model.model_helper_.model_ = ge_model; auto op_desc = std::make_shared("add", "Add"); AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); + AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); std::vector kernelBin; TBEKernelPtr tbe_kernel = std::make_shared("name/Add", std::move(kernelBin)); op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); @@ -347,9 +355,15 @@ TEST_F(UtestSingleOpModel, build_dynamic_task) { StreamResource *res = new (std::nothrow) StreamResource(1); ASSERT_EQ(model.ParseTasks(), SUCCESS); + model.node_tasks_[node] = { *task_def3, *task_def4 }; + op_desc->SetOpKernelLibName(kEngineNameAiCore); + model.BuildTaskListForDynamicOp(res, single_op); + + model.node_tasks_[node] = { *task_def }; + op_desc->SetOpKernelLibName(kEngineNameAiCpuTf); ASSERT_EQ(model.BuildTaskListForDynamicOp(res, single_op), SUCCESS); - model.tbe_tasks_.clear(); - ASSERT_EQ(model.BuildTaskListForDynamicOp(res, single_op), SUCCESS); - model.aicpu_tasks_[0] = *task_def2; + + model.node_tasks_[node] = { *task_def2 }; + op_desc->SetOpKernelLibName(kEngineNameAiCpu); model.BuildTaskListForDynamicOp(res, single_op); } diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 2424d209..51ef928f 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -154,3 +154,30 @@ TEST_F(UtestSingleOpTask, test_update_ioaddr) { task.tiling_buffer_ = nullptr; } +TEST_F(UtestSingleOpTask, test_atomic_exec) { + auto graph = make_shared("graph"); + auto op_desc = make_shared("Add", "Add"); + auto node = graph->AddNode(op_desc); + + AtomicOpTask task; + task.op_desc_ = op_desc; + task.node_ = node; + + vector inputs; + vector outputs; + task.atomic_output_indices_ = { 0 }; + task.arg_size_ = sizeof(void *) * 2; + task.args_.reset(new (std::nothrow) uint8_t[task.arg_size_]); + ASSERT_EQ(task.UpdateIoAddr(inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); + + ge::DataBuffer data_buffer; + outputs = { data_buffer }; + ASSERT_EQ(task.UpdateIoAddr(inputs, outputs), SUCCESS); + + task.tiling_buffer_ = (void *)0x0001; + ASSERT_EQ(task.UpdateTilingArgs(nullptr), SUCCESS); + task.tiling_buffer_ = nullptr; + + optiling::utils::OpRunInfo run_info(0, true, 0); + task.CalcTilingInfo(run_info); +} From 957c7fad6b5ba0b6fd24999b1e59cccf4ac81073 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 5 Jul 2021 21:23:03 +0800 Subject: [PATCH 157/226] submodule update --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index 3e14f92d..2f89122e 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 3e14f92d47abc9a2e703be2171f047553f7597e0 +Subproject commit 2f89122e1fa26b3633a8efa4bf0a0269bebf537e From 8e6c104db91e4875db542725326e3dd09ed7d419 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Mon, 5 Jul 2021 21:53:27 +0800 Subject: [PATCH 158/226] Fix ut. --- ge/single_op/single_op_model.cc | 2 +- tests/ut/ge/single_op/single_op_model_unittest.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index f8831884..a5547b39 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -596,7 +596,7 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, const auto &atomic_task_def = task_defs.front(); AtomicOpTask *atomic_task = nullptr; GE_CHK_STATUS_RET_NOLOG(BuildAtomicTask(atomic_task_def, &atomic_task)); - atomic_task->InitAtomicAddrCleanIndices(); + GE_CHK_STATUS_RET_NOLOG(atomic_task->InitAtomicAddrCleanIndices()); tbe_task->SetAtomicTask(atomic_task); } single_op.op_task_.reset(tbe_task); diff --git a/tests/ut/ge/single_op/single_op_model_unittest.cc b/tests/ut/ge/single_op/single_op_model_unittest.cc index ded1b465..7b7a05d8 100644 --- a/tests/ut/ge/single_op/single_op_model_unittest.cc +++ b/tests/ut/ge/single_op/single_op_model_unittest.cc @@ -346,7 +346,6 @@ TEST_F(UtestSingleOpModel, build_dynamic_task) { model.model_helper_.model_ = ge_model; auto op_desc = std::make_shared("add", "Add"); AttrUtils::SetStr(op_desc, TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF"); - AttrUtils::SetBool(op_desc, kAttrSupportDynamicShape, true); std::vector kernelBin; TBEKernelPtr tbe_kernel = std::make_shared("name/Add", std::move(kernelBin)); op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); From 5473a654210a312599abb2bee47b8847e311566b Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 5 Jul 2021 22:08:22 +0800 Subject: [PATCH 159/226] Split ge_executor from ge_compiler --- ge/CMakeLists.txt | 2 + ge/common/executor.h | 89 +++ ge/graph/common/local_context.cc | 17 +- ge/graph/common/local_context.h | 17 + ge/graph/execute/graph_execute.cc | 11 - ge/graph/execute/graph_execute.h | 4 - ge/graph/execute/model_executor.cc | 553 ++++++++++++++++++ ge/graph/execute/model_executor.h | 139 +++++ ge/graph/load/model_manager/model_manager.cc | 9 +- ge/graph/manager/graph_manager.cc | 626 +++------------------ ge/graph/manager/graph_manager.h | 63 +-- ge/graph/manager/graph_manager_utils.h | 6 + ge/session/inner_session.cc | 44 +- ge/session/inner_session.h | 5 + ge/single_op/task/op_task.h | 2 +- tests/ut/ge/CMakeLists.txt | 5 +- tests/ut/ge/common/datatype_transfer_unittest.cc | 22 +- .../ut/ge/graph/execute/model_executor_unittest.cc | 327 +++++++++++ .../ut/ge/graph/manager/graph_manager_unittest.cc | 124 ++-- .../folding_kernel/gather_v2_kernel_unittest.cc | 32 +- .../mark_node_unknown_shape_pass_unittest.cc | 2 +- .../passes/multi_batch_clone_pass_unittest.cc | 2 +- .../subgraph_const_migration_pass_unittest.cc | 2 +- 23 files changed, 1362 insertions(+), 741 deletions(-) create mode 100644 ge/common/executor.h create mode 100644 ge/graph/execute/model_executor.cc create mode 100644 ge/graph/execute/model_executor.h create mode 100644 tests/ut/ge/graph/execute/model_executor_unittest.cc diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 4a296e87..8fcf97ef 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -373,6 +373,7 @@ set(TRAIN_SRC_LIST "opskernel_manager/ops_kernel_builder_manager.cc" "session/inner_session.cc" "session/session_manager.cc" + "graph/execute/model_executor.cc" "single_op/single_op.cc" "single_op/single_op_manager.cc" "single_op/single_op_model.cc" @@ -475,6 +476,7 @@ set(INFER_SRC_LIST "init/gelib.cc" "session/inner_session.cc" "session/session_manager.cc" + "graph/execute/model_executor.cc" "engine_manager/dnnengine_manager.cc" "opskernel_manager/ops_kernel_manager.cc" "opskernel_manager/ops_kernel_builder_manager.cc" diff --git a/ge/common/executor.h b/ge/common/executor.h new file mode 100644 index 00000000..7f1d7ef9 --- /dev/null +++ b/ge/common/executor.h @@ -0,0 +1,89 @@ +/** + * 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. + */ +#ifndef GE_COMMON_EXECUTOR_H +#define GE_COMMON_EXECUTOR_H + +#include "external/ge/ge_api_types.h" +#include "graph/ge_local_context.h" +#include "graph/manager/graph_manager_utils.h" + +namespace ge { +struct RunArgs { + GraphNodePtr graph_node; + GraphId graph_id; + uint64_t session_id; + struct error_message::Context error_context; + std::vector input_tensor; + GeRootModelPtr ge_root_model; + GEThreadLocalContext context; + RunAsyncCallback callback; +}; + +class Executor { + public: + /// + /// @ingroup ge + /// @brief Load mode from graph. + /// @param [in] GeRootModel: root model of graph compiled. + /// @param [in] GraphNode: node of graph. + /// @return Status result of function + /// + virtual Status LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) = 0; + + /// + /// @ingroup ge + /// @brief Unload mode. + /// @param [in] GeRootModel: root model of graph compiled. + /// @param [in] graph_id: graph identifier. + /// @return Status result of function + /// + virtual Status UnloadGraph(const GeRootModelPtr &ge_root_model, uint32_t graph_id) = 0; + + /// + /// @ingroup ge + /// @brief Push model execution params to queue. + /// @param [in] RunArgs of for model execution. + /// @return Status result of function + /// + virtual Status PushGraph(const RunArgs &args) = 0; + + /// + /// @ingroup ge + /// @brief Run graph for synchronize model. + /// @param [in] graph_node: node of graph. + /// @param [in] graph_id: graph identifier. + /// @param [in] inputs: input data for the graph running. + /// @param [out] outputs: output data of the graph running + /// @return Status result of function + /// + virtual Status RunGraph(const GraphNodePtr &graph_node, GraphId graph_id, + const std::vector &inputs, std::vector &outputs) = 0; + + /// + /// @ingroup ge + /// @brief Run graph for NN synchronize model. + /// @param [in] graph_node: node of graph. + /// @param [in] graph_id: graph identifier. + /// @param [in] stream: Stream for model running. + /// @param [in] inputs: input data for the graph running. + /// @param [out] outputs: output data of the graph running + /// @return Status result of function + /// + virtual Status RunGraphWithStream(const GraphNodePtr &graph_node, GraphId graph_id, rtStream_t stream, + const std::vector &inputs, std::vector &outputs) = 0; +}; +} +#endif // GE_COMMON_EXECUTOR_H diff --git a/ge/graph/common/local_context.cc b/ge/graph/common/local_context.cc index fa2f78e0..bd747021 100644 --- a/ge/graph/common/local_context.cc +++ b/ge/graph/common/local_context.cc @@ -16,13 +16,12 @@ #include "graph/common/local_context.h" -#include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" -#include "framework/omg/omg_inner_types.h" namespace ge { namespace { thread_local OmgContext *omg_context = nullptr; +thread_local OmeContext *ome_context = nullptr; } void SetLocalOmgContext(OmgContext &context) { @@ -37,4 +36,18 @@ OmgContext &GetLocalOmgContext() { return domi::GetContext(); } } + +void SetLocalOmeContext(OmeContext &context) { + ome_context = &context; +} + +OmeContext &GetLocalOmeContext() { + if (ome_context != nullptr) { + return *ome_context; + } + + GELOGW("ome_context is nullptr."); + static OmeContext context; + return context; +} } diff --git a/ge/graph/common/local_context.h b/ge/graph/common/local_context.h index 4aa95855..751c6692 100644 --- a/ge/graph/common/local_context.h +++ b/ge/graph/common/local_context.h @@ -22,5 +22,22 @@ namespace ge { void SetLocalOmgContext(OmgContext &context); OmgContext &GetLocalOmgContext(); + + +struct OmeContext { + bool need_multi_batch = false; + std::string dynamic_node_type; + std::vector data_nodes; + std::vector getnext_nosink_nodes; + std::vector dynamic_shape_dims; + std::vector>> user_input_dims; + std::vector> user_real_input_dims; +}; + +GE_FUNC_VISIBILITY +void SetLocalOmeContext(OmeContext &context); + +GE_FUNC_VISIBILITY +OmeContext &GetLocalOmeContext(); } // namespace ge #endif // GE_GRAPH_COMMON_LOCAL_CONTEXT_H_ diff --git a/ge/graph/execute/graph_execute.cc b/ge/graph/execute/graph_execute.cc index 02d7d3ca..ba35e7c0 100755 --- a/ge/graph/execute/graph_execute.cc +++ b/ge/graph/execute/graph_execute.cc @@ -31,7 +31,6 @@ GraphExecutor::GraphExecutor() sync_run_mutex_(nullptr), condition_(nullptr), graph_run_listener_(nullptr), - graph_context_(nullptr), last_graph_id_(UINT32_MAX), malloc_flag_(false) {} @@ -79,16 +78,6 @@ Status GraphExecutor::SetCondition(std::mutex *mutex, std::condition_variable *c return SUCCESS; } -Status GraphExecutor::SetGraphContext(GraphContextPtr graph_context_ptr) { - if (graph_context_ptr == nullptr) { - REPORT_INNER_ERROR("E19999", "Check param graph_context_ptr nullptr"); - GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] input param graph_context_ptr is nullptr"); - return GE_GRAPH_PARAM_NULLPTR; - } - graph_context_ = graph_context_ptr; - return SUCCESS; -} - Status GraphExecutor::SetDynamicSize(uint32_t model_id, const std::vector &batch_num, int32_t dynamic_type) { auto model_manager = ge::ModelManager::GetInstance(); GE_CHECK_NOTNULL(model_manager); diff --git a/ge/graph/execute/graph_execute.h b/ge/graph/execute/graph_execute.h index 879a124c..b6d56dff 100755 --- a/ge/graph/execute/graph_execute.h +++ b/ge/graph/execute/graph_execute.h @@ -60,8 +60,6 @@ class GraphExecutor { Status SetCondition(std::mutex *mutex, std::condition_variable *cond, std::shared_ptr listener); - Status SetGraphContext(GraphContextPtr graph_context_ptr); - static Status SetDynamicSize(uint32_t model_id, const std::vector &batch_num, int32_t dynamic_type); void SetTrainFlag(bool is_train_graph); @@ -160,8 +158,6 @@ class GraphExecutor { // Run graph asynchronous call back listener std::shared_ptr graph_run_listener_; - GraphContextPtr graph_context_; - std::vector outputs_desc_; GraphId last_graph_id_; diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc new file mode 100644 index 00000000..50e8a5a5 --- /dev/null +++ b/ge/graph/execute/model_executor.cc @@ -0,0 +1,553 @@ +/** + * 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 "graph/execute/model_executor.h" + +#include "graph/ge_context.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/common/ge_call_wrapper.h" +#include "graph/common/local_context.h" +#include "graph/manager/graph_var_manager.h" +#include "graph/utils/tensor_adapter.h" +#include "graph/load/graph_loader.h" +#include "common/math/math_util.h" +#include "common/formats/utils/formats_trans_utils.h" + +namespace { +constexpr int32_t kBase = 10; +constexpr uint8_t kNeverLoaded = 0; +} + +namespace ge { +/// +/// @ingroup ge +/// @brief graph executor init +/// @param [in] options user config params +/// @return Status result of function +/// +Status ModelExecutor::Initialize(const map &options) { + graph_run_listener_ = MakeShared(sync_run_mutex_, condition_); + if (graph_run_listener_ == nullptr) { + REPORT_CALL_ERROR("E19999", "New GraphModelListener fail"); + GELOGE(MEMALLOC_FAILED, "[New][GraphModelListener] failed"); + return MEMALLOC_FAILED; + } + + train_graph_flag_ = ParseTrainGraphFlag(); + thread_run_flag_.store(true); + run_thread_ = std::thread(&ModelExecutor::RunThread, this); + + init_flag_ = true; + return SUCCESS; +} + +/// +/// @ingroup ge +/// @brief graph executor finalize +/// @return Status result of function +/// +Status ModelExecutor::Finalize() { + if (!init_flag_) { + GELOGW("ModelExecutor has not been initialized."); + return SUCCESS; + } + + StopQueue(); + if (run_thread_.joinable()) { + run_thread_.join(); + } + + if (graph_executor_.FreeExecuteMemory() != SUCCESS) { + GELOGW("Graph executor FreeExecuteMemory failed, resources may not be released correctly."); + } + + return SUCCESS; +} + +// OPTION_GRAPH_RUN_MODE is supposed to be a session-level option, but it used to be set to global-level in the past. +// If can not parse from session, it can parse from global by GetContext(). +bool ModelExecutor::ParseTrainGraphFlag() { + string run_mode; + if (GetContext().GetOption(OPTION_GRAPH_RUN_MODE, run_mode) == SUCCESS && !run_mode.empty()) { + if (GraphRunMode(std::strtol(run_mode.c_str(), nullptr, kBase)) >= TRAIN) { + GELOGI("Graph train flag set."); + return true; + } + } + return false; +} + +void ModelExecutor::AddGraphNode(GraphId graph_id, const GraphNodePtr &graph_node) { + std::lock_guard lock(mutex_); + graph_nodes_.emplace(graph_id, graph_node); +} + +void ModelExecutor::RemoveGraphNode(GraphId graph_id) { + std::lock_guard lock(mutex_); + graph_nodes_.erase(graph_id); +} + +/// +/// @ingroup ge +/// @brief Load mode for graph. +/// @param [in] GeRootModel: root model of graph compiled. +/// @param [in] GraphNode: node of graph. +/// @return Status result of function +/// +Status ModelExecutor::LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { + GE_CHECK_NOTNULL(graph_node); + if (ge_root_model == nullptr) { + return SUCCESS; + } + + UpdateLocalOmeContext(graph_node); + return graph_node->IsAsync() ? ModelLoadAsync(ge_root_model, graph_node) : ModelLoadSync(ge_root_model, graph_node); +} + +/// +/// @ingroup ge +/// @brief Unload mode for graph. +/// @param [in] GeRootModel: root model of graph compiled. +/// @param [in] graph_id: graph identifier. +/// @return Status result of function +/// +Status ModelExecutor::UnloadGraph(const GeRootModelPtr &ge_root_model, uint32_t graph_id) { + GE_CHECK_NOTNULL(ge_root_model); + rtError_t rt_ret = rtSetDevice(GetContext().DeviceId()); + if (rt_ret != RT_ERROR_NONE) { + GELOGW("[GraphExecutor] rtSetDevice failed, modelId=%u, graphId=%u.", ge_root_model->GetModelId(), graph_id); + return FAILED; + } + + RemoveGraphNode(graph_id); + Status ret = UnloadModel(ge_root_model, graph_id); + if (ret != SUCCESS) { + GELOGW("[GraphExecutor] unload model failed, graph_id=%u.", graph_id); + } + rt_ret = rtDeviceReset(GetContext().DeviceId()); + if (rt_ret != RT_ERROR_NONE) { + GELOGW("[GraphExecutor] rtDeviceReset failed, graphId=%u.", graph_id); + } + + return ret; +} + +Status ModelExecutor::UnloadModel(const GeRootModelPtr &ge_root_model, uint32_t graph_id) { + GE_CHECK_NOTNULL(ge_root_model); + for (size_t i = 0; i < ge_root_model->GetAllModelId().size(); ++i) { + uint32_t model_id = ge_root_model->GetAllModelId()[i]; + GELOGI("Unload model %u.", model_id); + Status ret = GraphLoader::UnloadModel(model_id); + if (ret != SUCCESS) { + GELOGE(ret, "[GraphExecutor] unload model failed, modelId=%u, graphId=%u.", model_id, graph_id); + return ret; + } + } + return SUCCESS; +} + +void ModelExecutor::StopQueue() { + thread_run_flag_.store(false); + run_args_q_.Stop(); +} + +void ModelExecutor::ReturnError(RunAsyncCallback callback, Status ret, const string &log) { + StopQueue(); + GELOGE(ret, "%s.", log.c_str()); + std::vector outputs; + callback(ret, outputs); +} + +void ModelExecutor::UpdateLocalOmeContext(const GraphNodePtr &graph_node) { + std::lock_guard lock(mutex_); + SetLocalOmeContext(graph_node->GetOmeContext()); +} + +/// +/// @ingroup ge +/// @brief Push model execution params to queue. +/// @param [in] RunArgs of for model execution. +/// @return Status result of function +/// +Status ModelExecutor::PushGraph(const RunArgs &args) { + return run_args_q_.Push(args) ? SUCCESS : FAILED; +} + +void ModelExecutor::RunThread() { + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); + if (prctl(PR_SET_NAME, ("GE_Run")) != 0) { + GELOGW("Set thread name failed."); + } + + RunArgs args; + while (thread_run_flag_) { + if (!run_args_q_.Pop(args)) { + continue; + } + + GELOGI("[RunThread] A new loop start, graph_id:%u.", args.graph_id); + ErrorManager::GetInstance().SetErrorContext(args.error_context); + GetContext().SetSessionId(args.session_id); + GetThreadLocalContext() = args.context; + UpdateLocalOmeContext(args.graph_node); + + // parse inputs.dims to vector> dynamic_dims + Status ret = ParseInputsDims(args.input_tensor); + if (ret != SUCCESS) { + ReturnError(args.callback, ret, "ParseInputsDims failed, thread exit."); + args.graph_node->Unlock(); + return; + } + + args.graph_node->UpdateLoadFlag(); + if (!args.graph_node->GetLoadFlag()) { + ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); + args.ge_root_model->SetTrainFlag(train_graph_flag_); + ret = ModelLoadAsync(args.ge_root_model, args.graph_node); + if (ret != SUCCESS || args.ge_root_model == nullptr) { + StopQueue(); + ReturnError(args.callback, ret, "LoadGraphAsync failed, thread exit."); + args.graph_node->Unlock(); + return; + } + // control the times of graph loading in multi-thread scenario + args.graph_node->DecreaseLoadCount(); + args.graph_node->IncreaseLoadRecord(); + + args.graph_node->SetLoadFlag(true); + GELOGI("LoadGraph[%u], model[%u] success and set LoadFlag to true.", args.graph_node->GetGraphId(), + args.ge_root_model->GetModelId()); + } + + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); + if (train_graph_flag_) { + graph_executor_.SetTrainFlag(train_graph_flag_); + } + + ret = graph_executor_.ExecuteGraphAsync(args.graph_id, args.graph_node->GetGeRootModel(), + args.input_tensor, args.callback); + args.graph_node->SetRunFlag(false); + if (ret != SUCCESS) { + ReturnError(args.callback, ret, "ExecuteGraphAsync failed, thread exit."); + args.graph_node->Unlock(); + return; + } + args.graph_node->Unlock(); + GELOGI("[GraphExecutor] Run graph async success, graph_id=%u.", args.graph_id); + } +} + +/// +/// @ingroup ge +/// @brief Run graph for synchronize model. +/// @param [in] graph_node: node of graph. +/// @param [in] graph_id: graph identifier. +/// @param [in] inputs: input data for the graph running. +/// @param [out] outputs: output data of the graph running +/// @return Status result of function +/// +Status ModelExecutor::RunGraph(const GraphNodePtr &graph_node, GraphId graph_id, + const std::vector &inputs, std::vector &outputs) { + Status ret = graph_executor_.SetCondition(&sync_run_mutex_, &condition_, graph_run_listener_); + if (ret != SUCCESS) { + GELOGE(GE_GRAPH_RUNGRAPH_FAILED, "[Set][Condition] failed, graph_id = %u.", graph_id); + graph_node->SetRunFlag(false); + return GE_GRAPH_RUNGRAPH_FAILED; + } + + if (train_graph_flag_) { + graph_executor_.SetTrainFlag(train_graph_flag_); + } + ret = graph_executor_.ExecuteGraph(graph_id, graph_node->GetGeRootModel(), inputs, outputs); + + graph_node->SetRunFlag(false); + if (ret != SUCCESS) { + GELOGE(ret, "[Execute][Graph] failed, graph_id = %u.", graph_id); + return ret; + } + return SUCCESS; +} + +/// +/// @ingroup ge +/// @brief Run graph for NN synchronize model. +/// @param [in] graph_node: node of graph. +/// @param [in] graph_id: graph identifier. +/// @param [in] stream: Stream for model running. +/// @param [in] inputs: input data for the graph running. +/// @param [out] outputs: output data of the graph running +/// @return Status result of function +/// +Status ModelExecutor::RunGraphWithStream(const GraphNodePtr &graph_node, GraphId graph_id, rtStream_t stream, + const std::vector &inputs, std::vector &outputs) { + auto ret = graph_executor_.SetCondition(&sync_run_mutex_, &condition_, graph_run_listener_); + if (ret != SUCCESS) { + GELOGE(GE_GRAPH_RUNGRAPH_FAILED, "[Set][Condition] failed, graph id = %u, stream = %p.", graph_id, stream); + graph_node->SetRunFlag(false); + return GE_GRAPH_RUNGRAPH_FAILED; + } + + ret = graph_executor_.ExecuteGraphWithStream(graph_id, stream, graph_node->GetGeRootModel(), inputs, outputs); + graph_node->SetRunFlag(false); + graph_node->SetIsSpecificStream(false); + if (ret != SUCCESS) { + GELOGE(ret, "[Execute][Graph] With Stream failed, graph id = %u, stream = %p.", graph_id, stream); + return ret; + } + GELOGI("[Run][GraphWithStreamAsync] run graph success, graph id = %u, stream = %p.", graph_id, stream); + return SUCCESS; +} + +Status ModelExecutor::ModelLoadSync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { + ge_root_model->SetIsSpecificStream(graph_node->IsSpecificStream()); + return ModelLoad(ge_root_model, graph_node, graph_run_listener_); +} + +Status ModelExecutor::ModelLoadAsync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { + auto listener = MakeShared(); + GE_CHECK_NOTNULL(listener); + return ModelLoad(ge_root_model, graph_node, listener); +} + +Status ModelExecutor::ModelLoad(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node, + const std::shared_ptr &listener) { + ge_root_model->SetTrainFlag(train_graph_flag_); + bool is_unknown_shape = false; + GE_CHK_STATUS_RET(ge_root_model->CheckIsUnknownShape(is_unknown_shape)); + if (!is_unknown_shape) { + if (getenv(kEnvGeuseStaticMemory) != nullptr) { + GELOGI("[LoadGraph] GE_USE_STATIC_MEMORY is seted."); + } else { + auto root_graph = ge_root_model->GetRootGraph(); + GE_CHECK_NOTNULL(root_graph); + auto name_to_model = ge_root_model->GetSubgraphInstanceNameToModel(); + GeModelPtr ge_model = name_to_model[root_graph->GetName()]; + GE_CHK_STATUS_RET(CheckAndReleaseMemory(ge_model, graph_node)); + } + } + GE_TIMESTAMP_START(LoadModelOnline); + uint32_t model_id = INVALID_MODEL_ID; + Status ret = GraphLoader::LoadModelOnline(model_id, ge_root_model, listener); + GE_TIMESTAMP_EVENT_END(LoadModelOnline, "GraphLoader::LoadModelOnline"); + if (ret != SUCCESS) { + GELOGE(ret, "[Load][ModelOnline] Failed, model_id:%u", model_id); + graph_node->SetRunFlag(false); + return ret; + } + graph_node->SetLoadFlag(true); + ge_root_model->SetModelId(model_id); + graph_node->SetGeRootModel(ge_root_model); + AddGraphNode(graph_node->GetGraphId(), graph_node); + return SUCCESS; +} + +void ModelExecutor::ReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node, + const std::vector &model_ids, uint32_t graph_id, uint64_t session_id) { + rtError_t rt_ret = rtSetDevice(GetContext().DeviceId()); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtSetDevice failed, device_id:%u", GetContext().DeviceId()); + GELOGE(RT_FAILED, "[Call][RtSetDevice] failed, device_id=%u.", GetContext().DeviceId()); + return; + } + for (auto model_id : model_ids) { + uint64_t max_memory_size = 0; + Status result = GraphLoader::GetMaxUsedMemory(model_id, max_memory_size); + if (result != SUCCESS) { + continue; + } + GELOGI("try to UnloadGraph[%u], model[%u] which MaxUsedMemory[%lu].", graph_id, model_id, max_memory_size); + if (model_ids.size() > 1) { + result = ge_model->GetSessionId(model_id, session_id); + if (result != SUCCESS) { + GELOGW("[GraphExecutor:] get session failed when dynamic memory, modelId=%u, graphId=%u.", model_id, + graph_id); + continue; + } + } + result = GraphLoader::DestroyAicpuKernel(session_id, model_id, 0); + if (result != SUCCESS) { + GELOGW("[GraphExecutor:] destroy aicpu kernel failed when dynamic memory, modelId=%u, graphId=%u.", model_id, + graph_id); + } + result = GraphLoader::UnloadModel(model_id); + if (result != SUCCESS) { + GELOGW("[GraphExecutor:] unload model failed, modelId=%u, graphId=%u.", model_id, graph_id); + } + GELOGI("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", GetContext().DeviceId()); + GELOGE(RT_FAILED, "[Call][RtDeviceReset] failed, device_id:%u.", GetContext().DeviceId()); + return; + } +} + +Status ModelExecutor::CheckAndReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node) { + GELOGI("graph_id[%u]", graph_node->GetGraphId()); + int64_t free_memory = 0; + Status result = GraphLoader::GetMemoryInfo(free_memory); + if (result != SUCCESS) { + return result; + } + + int64_t value = 0; + int64_t memory_size = AttrUtils::GetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, value) ? value : 0; + int64_t weight_size = AttrUtils::GetInt(ge_model, ATTR_MODEL_WEIGHT_SIZE, value) ? value : 0; + int64_t session_id = AttrUtils::GetInt(ge_model, MODEL_ATTR_SESSION_ID, value) ? value : 0; + + GELOGI("Graph[%u] need memory_size[%ld], weight_size[%ld], Device[%u] free_memory_size[%ld]", + graph_node->GetGraphId(), memory_size, weight_size, GetContext().DeviceId(), free_memory); + if (CheckInt64AddOverflow(memory_size, weight_size) != SUCCESS) { + REPORT_INNER_ERROR("E19999", "memory_size:%ld and weight_size:%ld will overflow after add, check invalid", + memory_size, weight_size); + GELOGE(INTERNAL_ERROR, "[Check][Param] memory_size:%ld and weight_size:%ld will overflow after add", + memory_size, weight_size); + return INTERNAL_ERROR; + } + if (free_memory >= (memory_size + weight_size)) { + return SUCCESS; + } + + std::lock_guard lock(mutex_); + for (const auto &it : graph_nodes_) { + auto graph_id = it.second->GetGraphId(); + auto model = it.second->GetGeRootModel(); + if (model == nullptr) { + continue; + } + auto model_id = model->GetModelId(); + auto model_ids = model->GetAllModelId(); + // unload model not release + bool is_unknown_shape = false; + GE_CHK_STATUS_RET(model->CheckIsUnknownShape(is_unknown_shape)); + if (is_unknown_shape) { + GELOGD("model_id[%u] graph_id[%u] is unknown model, not release memory", model_id, graph_id); + continue; + } + // not loaded,no need unload + if (!it.second->GetLoadFlag()) { + GELOGI("CheckAndReleaseMemory graph[%u] has not been loaded.", graph_id); + continue; + } + ReleaseMemory(ge_model, it.second, model_ids, graph_id, static_cast(session_id)); + } + + return SUCCESS; +} + +void ModelExecutor::ParseInputsDimsForData(const std::vector &input_tensor) { + GELOGD("Start parse input dims from data."); + for (size_t i = 0; i < input_tensor.size(); ++i) { + const TensorDesc &tensor_desc = input_tensor[i].GetTensorDesc(); + const Shape &shape = tensor_desc.GetShape(); + const auto &shape_dims = shape.GetDims(); + GELOGD("Input tensor dims is %s.", formats::JoinToString(shape_dims).c_str()); + GetLocalOmeContext().user_real_input_dims.emplace_back(shape_dims); + } +} + +Status ModelExecutor::ParseInputsDimsForGetNextNoSinkAndData(const vector &dynamic_nodes, + const std::vector &input_tensor) { + GELOGD("Start parse inputs dims when coexist data and getnext sink."); + for (size_t i = 0; i < dynamic_nodes.size(); ++i) { + auto op_desc = dynamic_nodes.at(i)->GetOpDesc(); + if (op_desc == nullptr) { + continue; + } + GeAttrValue::INT index = 0; + if (!(AttrUtils::GetInt(op_desc, ATTR_NAME_INDEX, index))) { + REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) fail", ATTR_NAME_INDEX.c_str(), + op_desc->GetName().c_str(), op_desc->GetType().c_str()); + GELOGE(PARAM_INVALID, "[Get][Attr] %s from op:%s(%s) fail", ATTR_NAME_INDEX.c_str(), + op_desc->GetName().c_str(), op_desc->GetType().c_str()); + return PARAM_INVALID; + } + if (static_cast(index) > input_tensor.size()) { + REPORT_INNER_ERROR("E19999", "Attr:%s in op:%s(%s) value:%ld > param input_tensor.size:%zu, " + "check invalid", ATTR_NAME_INDEX.c_str(), + op_desc->GetName().c_str(), op_desc->GetType().c_str(), + index, input_tensor.size()); + GELOGE(PARAM_INVALID, "[Check][Param] Attr:%s in op:%s(%s) value:%ld > param input_tensor.size:%zu", + ATTR_NAME_INDEX.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), + index, input_tensor.size()); + return PARAM_INVALID; + } + + const TensorDesc &tensor_desc = input_tensor[i].GetTensorDesc(); + const Shape &shape = tensor_desc.GetShape(); + const auto &shape_dims = shape.GetDims(); + GELOGI("Shape dims of %zu data is %s.", index, formats::JoinToString(shape_dims).c_str()); + GetLocalOmeContext().user_real_input_dims.emplace_back(std::move(shape_dims)); + } + return SUCCESS; +} + +Status ModelExecutor::ParseInputsDims(const std::vector &input_tensor) { + GELOGI("Start parse input dims of %zu input tensor.", input_tensor.size()); + GetLocalOmeContext().user_real_input_dims.clear(); + if (GetLocalOmeContext().dynamic_node_type.empty()) { + return SUCCESS; + } + + const vector &data_nodes = GetLocalOmeContext().data_nodes; + const vector &getnext_nosink_nodes = GetLocalOmeContext().getnext_nosink_nodes; + GELOGD("Data nodes count is %zu, getnext nosink nodes count is %zu.", data_nodes.size(), + getnext_nosink_nodes.size()); + if (GetLocalOmeContext().dynamic_node_type == DATA) { + if (getnext_nosink_nodes.empty()) { + // just data or data+getnext_sink + ParseInputsDimsForData(input_tensor); + } else { + // data+getnext_nosink, but only need to get shape_dims of data + if (ParseInputsDimsForGetNextNoSinkAndData(data_nodes, input_tensor) != SUCCESS) { + GELOGE(PARAM_INVALID, "[Parse][Dims] from data failed, when data coexist with getnext nosink."); + return PARAM_INVALID; + } + } + } else { + if (getnext_nosink_nodes.empty()) { + // just getnext_sink or getnext_sink+data, need to get shape_dims from aicpu op + GELOGI("Need to get dims from aicpu op: GETDYNAMICDIMS."); + return SUCCESS; + } else { + if (data_nodes.empty()) { + // just getnext_nosink + ParseInputsDimsForData(input_tensor); + } else { + // getnext_nosink + data, but only need to get shape_dims of getnext_nosink + if (ParseInputsDimsForGetNextNoSinkAndData(getnext_nosink_nodes, input_tensor) != SUCCESS) { + GELOGE(PARAM_INVALID, "[Parse][Dims] from getnext nosink failed, when data coexist with getnext nosink"); + return PARAM_INVALID; + } + } + } + } + + GELOGI("Parse %zu inputs dims success.", GetLocalOmeContext().user_real_input_dims.size()); + return SUCCESS; +} +} // namespace ge diff --git a/ge/graph/execute/model_executor.h b/ge/graph/execute/model_executor.h new file mode 100644 index 00000000..f8e717a1 --- /dev/null +++ b/ge/graph/execute/model_executor.h @@ -0,0 +1,139 @@ +/** + * 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. + */ +#ifndef GE_GRAPH_EXECUTE_MODEL_EXECUTOR_H +#define GE_GRAPH_EXECUTE_MODEL_EXECUTOR_H + +#include + +#include "common/executor.h" +#include "graph/execute/graph_execute.h" + +namespace ge { +class ModelExecutor : public Executor { + public: + /// + /// @ingroup ge + /// @brief graph executor init + /// @param [in] options user config params + /// @return Status result of function + /// + Status Initialize(const map &options); + + /// + /// @ingroup ge + /// @brief graph executor finalize + /// @return Status result of function + /// + Status Finalize(); + + /// + /// @ingroup ge + /// @brief Load mode for graph. + /// @param [in] GeRootModel: root model of graph compiled. + /// @param [in] GraphNode: node of graph. + /// @return Status result of function + /// + Status LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node); + + /// + /// @ingroup ge + /// @brief Unload mode for graph. + /// @param [in] GeRootModel: root model of graph compiled. + /// @param [in] graph_id: graph identifier. + /// @return Status result of function + /// + Status UnloadGraph(const GeRootModelPtr &ge_root_model, uint32_t graph_id); + + /// + /// @ingroup ge + /// @brief Push model execution params to queue. + /// @param [in] RunArgs of for model execution. + /// @return Status result of function + /// + Status PushGraph(const RunArgs &args); + + /// + /// @ingroup ge + /// @brief Run graph for synchronize model. + /// @param [in] graph_node: node of graph. + /// @param [in] graph_id: graph identifier. + /// @param [in] inputs: input data for the graph running. + /// @param [out] outputs: output data of the graph running + /// @return Status result of function + /// + Status RunGraph(const GraphNodePtr &graph_node, GraphId graph_id, + const std::vector &inputs, std::vector &outputs); + + /// + /// @ingroup ge + /// @brief Run graph for NN synchronize model. + /// @param [in] graph_node: node of graph. + /// @param [in] graph_id: graph identifier. + /// @param [in] stream: Stream for model running. + /// @param [in] inputs: input data for the graph running. + /// @param [out] outputs: output data of the graph running + /// @return Status result of function + /// + Status RunGraphWithStream(const GraphNodePtr &graph_node, GraphId graph_id, rtStream_t stream, + const std::vector &inputs, std::vector &outputs); + + private: + bool ParseTrainGraphFlag(); + + void AddGraphNode(GraphId graph_id, const GraphNodePtr &graph_node); + void RemoveGraphNode(GraphId graph_id); + + Status ModelLoadSync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node); + Status ModelLoadAsync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node); + Status ModelLoad(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node, + const std::shared_ptr &listener); + + Status UnloadModel(const GeRootModelPtr &ge_root_model, uint32_t graph_id); + + void ReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node, const std::vector &model_ids, + uint32_t graph_id, uint64_t session_id); + Status CheckAndReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node); + + void UpdateLocalOmeContext(const GraphNodePtr &graph_node); + + void RunThread(); + void StopQueue(); + void ReturnError(RunAsyncCallback callback, Status ret, const string &log); + + void ParseInputsDimsForData(const std::vector &input_tensor); + Status ParseInputsDimsForGetNextNoSinkAndData(const vector &dynamic_nodes, + const std::vector &input_tensor); + Status ParseInputsDims(const std::vector &input_tensor); + + bool init_flag_{false}; + bool train_graph_flag_{false}; + GraphExecutor graph_executor_; + + std::mutex mutex_; + std::map graph_nodes_; + + std::thread run_thread_; + std::atomic_bool thread_run_flag_{false}; + BlockingQueue run_args_q_; + + // for run graph synchronous return + std::mutex sync_run_mutex_; + std::condition_variable condition_; + // run graph synchronization call back listener + std::shared_ptr graph_run_listener_; +}; +} +#endif // GE_GRAPH_EXECUTE_MODEL_EXECUTOR_H \ No newline at end of file diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 3c31014d..45540ba0 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -513,8 +513,7 @@ Status ModelManager::GetCurDynamicDims(const vector> &user_real_ } GELOGD("Cur dynamic dims is %s.", formats::JoinToString(cur_dynamic_dims).c_str()); bool cur_dynamic_dims_valid = false; - std::vector shape_strs = ge::StringUtils::Split(GetLocalOmgContext().dynamic_dims, ';'); - for (auto dynamic_dim : shape_strs) { + for (auto dynamic_dim : GetLocalOmeContext().dynamic_shape_dims) { if (dynamic_dim == formats::JoinToString(cur_dynamic_dims)) { cur_dynamic_dims_valid = true; break; @@ -556,10 +555,10 @@ Status ModelManager::DataInputTensor(uint32_t model_id, const std::vector cur_dynamic_dims; - if (!GetLocalOmgContext().user_real_input_dims.empty()) { - if (GetCurDynamicDims(GetLocalOmgContext().user_real_input_dims, GetLocalOmgContext().user_input_dims, + if (!GetLocalOmeContext().user_real_input_dims.empty()) { + if (GetCurDynamicDims(GetLocalOmeContext().user_real_input_dims, GetLocalOmeContext().user_input_dims, cur_dynamic_dims) != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Get][CurDynamicDims] [Train_Dynamic] Failed to Parse real_dynamic_dims."); return INTERNAL_ERROR; diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 04e0f51c..b2528cdd 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -164,26 +164,12 @@ ge::Status CheckFpCeilingMode() { } // namespace namespace ge { -GraphManager::GraphManager() - : thread_run_flag_(false), - graph_run_listener_(nullptr), - init_flag_(false) { -} - -Status GraphManager::Initialize(const std::map &options) { +Status GraphManager::Initialize(const std::map &options, Executor *executor) { ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); if (init_flag_) { GELOGW("[Initialize] GraphManager already initialized."); return SUCCESS; } - - // malloc - graph_run_listener_ = MakeShared(sync_run_mutex_, condition_); - if (graph_run_listener_ == nullptr) { - REPORT_CALL_ERROR("E19999", "New GraphModelListener fail"); - GELOGE(MEMALLOC_FAILED, "[New][GraphModelListener] failed"); - return MEMALLOC_FAILED; - } // graph context graph_context_ = MakeShared(); if (graph_context_ == nullptr) { @@ -211,31 +197,18 @@ Status GraphManager::Initialize(const std::map &options) { return ret; } - graph_map_.clear(); - cache_helper_map_.clear(); - graph_id_to_add_graph_cond_.clear(); - graph_count_.clear(); + executor_ = executor; init_flag_ = true; thread_run_flag_ = true; - prerun_thread_ = std::thread(GraphManager::PreRunThread, this); - run_thread_ = std::thread(GraphManager::RunThread, this); + prerun_thread_ = std::thread(&GraphManager::PreRunThread, this); return SUCCESS; } Status GraphManager::UnloadModel(GeRootModelPtr ge_root_model, uint32_t graph_id) { - Status ret = SUCCESS; - for (size_t i = 0; i < ge_root_model->GetAllModelId().size(); ++i) { - uint32_t model_id = ge_root_model->GetAllModelId()[i]; - GELOGI("Unload model %u.", model_id); - ret = GraphLoader::UnloadModel(model_id); - if (ret != SUCCESS) { - GELOGW("[GraphManager] unload model failed, modelId=%u, graphId=%u.", model_id, graph_id); - return ret; - } - } - return ret; + GE_CHECK_NOTNULL(executor_); + return executor_->UnloadGraph(ge_root_model, graph_id); } Status GraphManager::Finalize() { @@ -244,23 +217,13 @@ Status GraphManager::Finalize() { return SUCCESS; } - if (graph_executor_.FreeExecuteMemory() != SUCCESS) { - GELOGW("Graph executor FreeExecuteMemory failed, resources may not be released correctly."); - } - - StopQueue(this); - + StopQueue(); if (prerun_thread_.joinable()) { prerun_thread_.join(); } - if (run_thread_.joinable()) { - run_thread_.join(); - } // check graph whether running or not Status unload_model_ret = SUCCESS; - Status ret; - rtError_t rt_ret; for (auto iter = graph_map_.begin(); iter != graph_map_.end(); ++iter) { GraphNodePtr graph_node = iter->second; if (graph_node->GetRunFlag()) { @@ -271,22 +234,10 @@ Status GraphManager::Finalize() { // unload model auto ge_root_model = graph_node->GetGeRootModel(); if (ge_root_model != nullptr && ge_root_model->GetModelId() != INVALID_MODEL_ID && graph_node->GetLoadFlag()) { - rt_ret = rtSetDevice(GetContext().DeviceId()); - if (rt_ret != RT_ERROR_NONE) { - GELOGW("[GraphManager] rtSetDevice failed, modelId=%u, graphId=%u.", ge_root_model->GetModelId(), iter->first); - unload_model_ret = FAILED; - continue; - } - ret = UnloadModel(ge_root_model, iter->first); + Status ret = UnloadModel(ge_root_model, iter->first); if (ret != SUCCESS) { - GELOGW("[GraphManager] unload model failed, graph_id=%u.", iter->first); unload_model_ret = ret; - } - rt_ret = rtDeviceReset(GetContext().DeviceId()); - if (rt_ret != RT_ERROR_NONE) { - GELOGW("[GraphManager] rtDeviceReset failed, graphId=%u.", iter->first); - unload_model_ret = FAILED; - continue; + GELOGW("[GraphManager] unload model failed, graph_id=%u.", iter->first); } } @@ -1122,12 +1073,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: return ret; } } - ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); - if (!graph_node->IsAsync()) { - ret = LoadGraph(ge_root_model, graph_node); - } else { - ret = LoadGraphAsync(ge_root_model, graph_node); - } + ret = LoadGraph(ge_root_model, graph_node); if (ret != SUCCESS) { GELOGE(ret, "[Load][Graph] Failed, graph_id:%u.", graph_node->GetGraphId()); return ret; @@ -1135,13 +1081,8 @@ 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(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 { - ret = LoadGraphAsync(ge_root_model_ptr, graph_node); - } + ret = LoadGraph(ge_root_model, graph_node); if (ret != SUCCESS) { GELOGE(ret, "[Load][Graph] Failed, graph_id:%u.", graph_node->GetGraphId()); return ret; @@ -1149,40 +1090,16 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: } return ret; } + Status GraphManager::LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { GELOGI("[LoadGraph] run_graph_flag[%d], graph_id[%u]", options_.run_graph_flag, graph_node->GetGraphId()); - if (options_.run_graph_flag && ge_root_model != nullptr) { - ge_root_model->SetTrainFlag(GetTrainFlag()); - // synchronization run graph with model - std::shared_ptr model_listener = GetModelListener(); - ModelIdInfo model_id_info; - bool is_unknown_shape = false; - GE_CHK_STATUS_RET(ge_root_model->CheckIsUnknownShape(is_unknown_shape)); - if (!is_unknown_shape) { - if (getenv(kEnvGeuseStaticMemory) != nullptr) { - GELOGI("[LoadGraph] GE_USE_STATIC_MEMORY is seted."); - } else { - auto root_graph = ge_root_model->GetRootGraph(); - GE_CHECK_NOTNULL(root_graph); - auto name_to_model = ge_root_model->GetSubgraphInstanceNameToModel(); - GeModelPtr ge_model = name_to_model[root_graph->GetName()]; - GE_CHK_STATUS_RET(CheckAndReleaseMemory(ge_model, graph_node)); - } - } - ge_root_model->SetIsSpecificStream(graph_node->IsSpecificStream()); - GE_TIMESTAMP_START(LoadGraph); - Status ret = GraphLoader::LoadModelOnline(model_id_info.model_id, ge_root_model, model_listener); - GE_TIMESTAMP_EVENT_END(LoadGraph, "GraphManager::LoadGraph"); - if (ret != SUCCESS) { - GELOGE(ret, "[Load][Model] failed, ret:%d", ret); - graph_node->SetRunFlag(false); - return ret; - } - graph_node->SetLoadFlag(true); - ge_root_model->SetModelId(model_id_info.model_id); - graph_node->SetGeRootModel(ge_root_model); + if (!options_.run_graph_flag) { + return SUCCESS; } - return SUCCESS; + + ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); + GE_CHECK_NOTNULL(executor_); + return executor_->LoadGraph(ge_root_model, graph_node); } Status GraphManager::LoadFromCache(const GraphNodePtr &graph_node, const ModelCacheHelperPtr &cache_helper, @@ -1272,45 +1189,14 @@ Status GraphManager::SaveCacheAfterBuild(uint32_t graph_id, ge::ComputeGraphPtr Status GraphManager::InnerRunGraph(GraphNodePtr &graph_node, const GraphId &graph_id, const std::vector &inputs, std::vector &outputs) { - Status ret = graph_executor_.SetCondition(&sync_run_mutex_, &condition_, graph_run_listener_); - if (ret != SUCCESS) { - GELOGE(GE_GRAPH_RUNGRAPH_FAILED, "[Set][Condition] failed, graph_id = %u.", graph_id); - graph_node->SetRunFlag(false); - return GE_GRAPH_RUNGRAPH_FAILED; - } - - if (GetTrainFlag()) { - GE_CHK_STATUS_RET(graph_executor_.SetGraphContext(GetGraphContext())); - graph_executor_.SetTrainFlag(options_.train_graph_flag); - } - ret = graph_executor_.ExecuteGraph(graph_id, graph_node->GetGeRootModel(), inputs, outputs); - - graph_node->SetRunFlag(false); - if (ret != SUCCESS) { - GELOGE(ret, "[Execute][Graph] failed, graph_id = %u.", graph_id); - return ret; - } - return SUCCESS; + GE_CHECK_NOTNULL(executor_); + return executor_->RunGraph(graph_node, graph_id, inputs, outputs); } Status GraphManager::InnerRunGraphWithStream(GraphNodePtr &graph_node, const GraphId &graph_id, rtStream_t stream, const std::vector &inputs, std::vector &outputs) { - auto ret = graph_executor_.SetCondition(&sync_run_mutex_, &condition_, graph_run_listener_); - if (ret != SUCCESS) { - GELOGE(GE_GRAPH_RUNGRAPH_FAILED, "[Set][Condition] failed, graph id = %u, stream = %p.", graph_id, stream); - graph_node->SetRunFlag(false); - return GE_GRAPH_RUNGRAPH_FAILED; - } - - ret = graph_executor_.ExecuteGraphWithStream(graph_id, stream, graph_node->GetGeRootModel(), inputs, outputs); - graph_node->SetRunFlag(false); - graph_node->SetIsSpecificStream(false); - if (ret != SUCCESS) { - GELOGE(ret, "[Execute][Graph] With Stream failed, graph id = %u, stream = %p.", graph_id, stream); - return ret; - } - GELOGI("[Run][GraphWithStreamAsync] run graph success, graph id = %u, stream = %p.", graph_id, stream); - return SUCCESS; + GE_CHECK_NOTNULL(executor_); + return executor_->RunGraphWithStream(graph_node, graph_id, stream, inputs, outputs); } Status GraphManager::RunGraphWithStreamAsync(const GraphId &graph_id, rtStream_t stream, uint64_t session_id, @@ -1665,38 +1551,18 @@ Status GraphManager::RemoveGraph(const GraphId &graph_id) { std::lock_guard lock(unload_model_mutex_); - Status middle_ret; - rtError_t rt_ret; var_acc_ctrl_.RemoveGraph(graph_id); RemoveGraphNode(graph_id); - RemoveModelCacheHelper(graph_id); auto ge_root_model = graph_node->GetGeRootModel(); if (CheckModelLoad(ge_root_model, graph_node->GetLoadFlag())) { - rt_ret = rtSetDevice(GetContext().DeviceId()); - if (rt_ret != RT_ERROR_NONE) { - REPORT_CALL_ERROR("E19999", "Call rtSetDevice failed, device_id:%u, graph_id:%u", - GetContext().DeviceId(), graph_id); - GELOGE(RT_FAILED, "[Call][RtSetDevice] failed, modelId=%u, graphId=%u.", ge_root_model->GetModelId(), - graph_id); - return FAILED; - } - // same graph may be added for several times, different models were created separately, - // unload them respectively. - middle_ret = UnloadModel(ge_root_model, graph_id); + Status middle_ret = UnloadModel(ge_root_model, graph_id); if (middle_ret != SUCCESS) { REPORT_INNER_ERROR("E19999", "UnloadModel for graph:%u failed, check invalid", graph_id); GELOGE(middle_ret, "[Unload][Model] model failed, graph_id=%u.", graph_id); ret = middle_ret; } - rt_ret = rtDeviceReset(GetContext().DeviceId()); - if (rt_ret != RT_ERROR_NONE) { - REPORT_CALL_ERROR("E19999", "Call rtDeviceReset failed, device_id:%u, graph_id:%u", - GetContext().DeviceId(), graph_id); - GELOGE(RT_FAILED, "[Call][RtDeviceReset] failed, device_id:%u, graph_id:%u", GetContext().DeviceId(), graph_id); - ret = FAILED; - } } RemoveCompilerStages(graph_id); @@ -2120,8 +1986,6 @@ Status GraphManager::SummaryHandle(const GraphId &graph_id, std::vector &outputs) { GELOGI("[GraphManager] CheckpointHandle, outputsSize=%zu.", outputs.size()); - std::vector outputs_desc = graph_executor_.GetOutputsDesc(); - GELOGI("[GraphManager] CheckpointHandle, outputsDescSize=%zu.", outputs_desc.size()); std::map save_results; NodePtr netoutput = nullptr; @@ -2786,160 +2650,6 @@ void GraphManager::ChangeConstTypeWhenTraining(const ComputeGraphPtr &compute_gr } } -Status GraphManager::LoadGraphAsync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { - GELOGI("[LoadGraphAsync] run_graph_flag[%d], graph_id[%u]", options_.run_graph_flag, graph_node->GetGraphId()); - if (options_.run_graph_flag && ge_root_model != nullptr) { - ge_root_model->SetTrainFlag(GetTrainFlag()); - // synchronization run graph with model - ModelIdInfo model_id_info; - bool is_unknown_shape = false; - GE_CHK_STATUS_RET(ge_root_model->CheckIsUnknownShape(is_unknown_shape)); - if (!is_unknown_shape) { - if (getenv(kEnvGeuseStaticMemory) != nullptr) { - GELOGI("[LoadGraphAsync] GE_USE_STATIC_MEMORY is seted."); - } else { - auto root_graph = ge_root_model->GetRootGraph(); - GE_CHECK_NOTNULL(root_graph); - auto name_to_model = ge_root_model->GetSubgraphInstanceNameToModel(); - GeModelPtr ge_model = name_to_model[root_graph->GetName()]; - GE_CHK_STATUS_RET(CheckAndReleaseMemory(ge_model, graph_node)); - } - } - GE_TIMESTAMP_START(LoadGraph); - auto listener = MakeShared(); - GE_CHECK_NOTNULL(listener); - Status ret = GraphLoader::LoadModelOnline(model_id_info.model_id, ge_root_model, listener); - GE_TIMESTAMP_EVENT_END(LoadGraph, "GraphManager::LoadGraphAsync"); - if (ret != SUCCESS) { - GELOGE(ret, "[Load][ModelOnline] Failed, model_id:%u", model_id_info.model_id); - graph_node->SetRunFlag(false); - return ret; - } - graph_node->SetLoadFlag(true); - ge_root_model->SetModelId(model_id_info.model_id); - graph_node->SetGeRootModel(ge_root_model); - } - return SUCCESS; -} - -void GraphManager::ReleaseMemory(const GeModelPtr &ge_model, GraphNodePtr &graph_node, - const std::vector &model_ids, uint32_t graph_id, uint64_t session_id) { - rtError_t rt_ret = rtSetDevice(GetContext().DeviceId()); - if (rt_ret != RT_ERROR_NONE) { - REPORT_CALL_ERROR("E19999", "Call rtSetDevice failed, device_id:%u", GetContext().DeviceId()); - GELOGE(RT_FAILED, "[Call][RtSetDevice] failed, device_id=%u.", GetContext().DeviceId()); - return; - } - for (auto model_id : model_ids) { - uint64_t max_memory_size = 0; - Status result = GraphLoader::GetMaxUsedMemory(model_id, max_memory_size); - if (result != SUCCESS) { - continue; - } - GELOGI("CheckAndReleaseMemory try to UnloadGraph[%u], model[%u] which MaxUsedMemory[%lu].", graph_id, model_id, - max_memory_size); - if (model_ids.size() > 1) { - result = ge_model->GetSessionId(model_id, session_id); - if (result != SUCCESS) { - GELOGW("[GraphManager:] get session failed when dynamic memory, modelId=%u, graphId=%u.", model_id, - graph_id); - continue; - } - } - result = GraphLoader::DestroyAicpuKernel(session_id, model_id, 0); - if (result != SUCCESS) { - GELOGW("[GraphManager:] destroy aicpu kernel failed when dynamic memory, modelId=%u, graphId=%u.", model_id, - graph_id); - } - result = GraphLoader::UnloadModel(model_id); - if (result != SUCCESS) { - GELOGW("[GraphManager:] unload model failed, modelId=%u, graphId=%u.", model_id, graph_id); - } - 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", GetContext().DeviceId()); - GELOGE(RT_FAILED, "[Call][RtDeviceReset] failed, device_id:%u.", GetContext().DeviceId()); - return; - } -} - -Status GraphManager::CheckAndReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node) { - GELOGI("CheckAndReleaseMemory graph_id[%u]", graph_node->GetGraphId()); - int64_t value = 0; - bool ret = ge::AttrUtils::GetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, value); - int64_t memory_size = ret ? value : 0; - ret = ge::AttrUtils::GetInt(ge_model, ATTR_MODEL_WEIGHT_SIZE, value); - int64_t weight_size = ret ? value : 0; - ret = ge::AttrUtils::GetInt(ge_model, MODEL_ATTR_SESSION_ID, value); - uint64_t session_id = ret ? value : 0; - - int64_t free_memory = 0; - Status result = GraphLoader::GetMemoryInfo(free_memory); - if (result != SUCCESS) { - return result; - } - - GELOGI( - "CheckAndReleaseMemory Graph[%u] need memory_size[%ld], weight_size[%ld]," - " Device[%u] free_memory_size[%ld]", - graph_node->GetGraphId(), memory_size, weight_size, GetContext().DeviceId(), free_memory); - if (ge::CheckInt64AddOverflow(memory_size, weight_size) != SUCCESS) { - REPORT_INNER_ERROR("E19999", "memory_size:%ld and weight_size:%ld will overflow after add, check invalid", - memory_size, weight_size); - GELOGE(INTERNAL_ERROR, "[Check][Param] memory_size:%ld and weight_size:%ld will overflow after add", - memory_size, weight_size); - return INTERNAL_ERROR; - } - if (free_memory >= (memory_size + weight_size)) { - return SUCCESS; - } - - std::lock_guard lock(unload_model_mutex_); - - std::map graph_map; - { - std::lock_guard lock(member_mutex_); - graph_map = graph_map_; - } - - for (auto &it : graph_map) { - auto graph_id = it.second->GetGraphId(); - auto model = it.second->GetGeRootModel(); - if (model == nullptr) { - continue; - } - auto model_id = model->GetModelId(); - auto model_ids = model->GetAllModelId(); - // unload model not release - bool is_unknown_shape = false; - GE_CHK_STATUS_RET(model->CheckIsUnknownShape(is_unknown_shape)); - if (is_unknown_shape) { - GELOGD("model_id[%u] graph_id[%u] is unknown model, not release memory", model_id, graph_id); - continue; - } - // not loaded,no need unload - if (!it.second->GetLoadFlag()) { - GELOGI("CheckAndReleaseMemory graph[%u] has not been loaded.", graph_id); - continue; - } - ReleaseMemory(ge_model, it.second, model_ids, graph_id, session_id); - } - - return SUCCESS; -} - Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager, GraphId root_graph_id, const SubGraphInfoPtr &sub_graph_info_ptr, const std::string &root_graph_name, @@ -3069,14 +2779,14 @@ Status GraphManager::IncreBuild(const GraphNodePtr &graph_node, GeModelPtr &ge_m return FAILED; } -Status GraphManager::CheckIncreBuildAndPreRun(GraphManager *graph_manager, const PreRunArgs &args, +Status GraphManager::CheckIncreBuildAndPreRun(const PreRunArgs &args, GraphNodePtr &graph_node, GeRootModelPtr &ge_root_model) { - if (!graph_manager->IsGraphNeedBuild(graph_node)) { + if (!IsGraphNeedBuild(graph_node)) { ge_root_model = graph_node->GetGeRootModel(); return SUCCESS; } if (graph_node->GetBuildFlag()) { - ReturnError(graph_manager, args.callback, PARAM_INVALID, + ReturnError(args.callback, PARAM_INVALID, "The graph " + std::to_string(graph_node->GetGraphId()) + " need to re-build, you should remove it" " from GE first, then AddGraph again and rebuild it."); @@ -3084,55 +2794,53 @@ Status GraphManager::CheckIncreBuildAndPreRun(GraphManager *graph_manager, const } // check need incre build. GeModelPtr ge_model = nullptr; - if (graph_manager->IncreBuild(graph_node, ge_model) != SUCCESS) { + if (IncreBuild(graph_node, ge_model) != SUCCESS) { std::vector ge_inputs; for (const auto &item: args.input_tensor) { ge_inputs.emplace_back(TensorAdapter::AsGeTensor(item)); } - Status ret = graph_manager->PreRun(graph_node, ge_inputs, ge_root_model, args.session_id); + Status ret = PreRun(graph_node, ge_inputs, ge_root_model, args.session_id); // release rts generate context RtContextUtil::GetInstance().DestroyRtContexts(args.session_id, graph_node->GetGraphId()); if (ret != SUCCESS) { - ReturnError(graph_manager, args.callback, ret, "PreRun Failed."); + ReturnError(args.callback, ret, "PreRun Failed."); return ret; } } graph_node->SetBuildFlag(true); - graph_manager->var_acc_ctrl_.SetGraphBuildEnd(graph_node->GetGraphId()); + var_acc_ctrl_.SetGraphBuildEnd(graph_node->GetGraphId()); return SUCCESS; } -void GraphManager::PreRunThread(GraphManager *graph_manager) { +void GraphManager::PreRunThread() { if (prctl(PR_SET_NAME, ("GE_PreRun")) != 0) { GELOGW("Set thread name failed."); } PreRunArgs args; - while (graph_manager->thread_run_flag_) { - bool pop_status = graph_manager->prerun_args_q_.Pop(args); - if (!pop_status) { + while (thread_run_flag_) { + if (!prerun_args_q_.Pop(args)) { continue; } GELOGI("[PreRunThread] A new loop start, graph_id:%u.", args.graph_id); - ErrorManager::GetInstance().SetErrorContext(args.error_context); ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GetContext().SetSessionId(args.session_id); GetThreadLocalContext() = args.context; - graph_manager->UpdateLocalOmgContext(args.graph_id); + UpdateLocalOmgContext(args.graph_id); // find graph GraphNodePtr graph_node = nullptr; - Status ret = graph_manager->GetGraphNode(args.graph_id, graph_node); + Status ret = GetGraphNode(args.graph_id, graph_node); if (ret != SUCCESS) { - ReturnError(graph_manager, args.callback, GE_GRAPH_GRAPH_NODE_NULL, + ReturnError(args.callback, GE_GRAPH_GRAPH_NODE_NULL, "[RunGraph] graph not exist, graph_id=" + std::to_string(args.graph_id)); return; } // more than one graph owns same graph_id uint32_t count = 0; - if (graph_manager->GetGraphCount(args.graph_id, count) != SUCCESS) { + if (GetGraphCount(args.graph_id, count) != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Get][GraphCount] failed, graph id:%u.", args.graph_id); return; } @@ -3142,7 +2850,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { // In online inference concurrency senario, graph_node is allowed to be locked for 'count' times graph_node->SetSemSize(count); graph_node->Lock(); - graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, + PushGraph(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, graph_node->GetGeRootModel(), GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end. Start to run with cached build model."); continue; @@ -3151,7 +2859,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { graph_node->Lock(); if (graph_node->GetRunFlag()) { - ReturnError(graph_manager, args.callback, GE_GRAPH_ALREADY_RUNNING, + ReturnError(args.callback, GE_GRAPH_ALREADY_RUNNING, "[RunGraph] graph already running, graph id=" + std::to_string(args.graph_id)); graph_node->Unlock(); return; @@ -3162,25 +2870,25 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { ComputeGraphPtr compute_graph_tmp = GraphUtils::GetComputeGraph(*(graph_node->GetGraph())); if (compute_graph_tmp == nullptr) { - ReturnError(graph_manager, args.callback, GE_GRAPH_GRAPH_NODE_NULL, + ReturnError(args.callback, GE_GRAPH_GRAPH_NODE_NULL, "[RunGraph] compute_graph_tmp is NULL, graph id = %u."); graph_node->Unlock(); return; } // when set incre build, save cache helper. - graph_manager->AddModelCacheHelperToMap(args.graph_id, args.session_id, compute_graph_tmp); + AddModelCacheHelperToMap(args.graph_id, args.session_id, compute_graph_tmp); std::vector ge_models; - if (graph_manager->options_.local_fmk_op_flag) { - graph_manager->GetCompilerStages(graph_node->GetGraphId()).optimizer.TranFrameOp(compute_graph_tmp); + if (options_.local_fmk_op_flag) { + GetCompilerStages(graph_node->GetGraphId()).optimizer.TranFrameOp(compute_graph_tmp); } // it will not execute graph preprocess, optimize, parition, build if the graph has built successful. GELOGI("Start for run graph async."); GeRootModelPtr ge_root_model = nullptr; - ret = CheckIncreBuildAndPreRun(graph_manager, args, graph_node, ge_root_model); + ret = CheckIncreBuildAndPreRun(args, graph_node, ge_root_model); if (ret != SUCCESS) { graph_node->SetRunFlag(false); if (!ge::Analyzer::GetInstance()->IsEnableNetAnalyzeDebug()) { @@ -3193,252 +2901,49 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { continue; } } - graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, + + PushGraph(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, args.input_tensor, ge_root_model, GetThreadLocalContext(), args.callback })); GELOGI("[PreRunThread] Loop end."); } } -void GraphManager::ParseInputsDimsForData(const std::vector &input_tensor) { - GELOGD("Start parse input dims from data."); - for (size_t i = 0; i < input_tensor.size(); ++i) { - const TensorDesc &tensor_desc = input_tensor[i].GetTensorDesc(); - const Shape &shape = tensor_desc.GetShape(); - const auto &shape_dims = shape.GetDims(); - GELOGD("Input tensor dims is %s.", formats::JoinToString(shape_dims).c_str()); - GetLocalOmgContext().user_real_input_dims.emplace_back(shape_dims); - } -} - -Status GraphManager::ParseInputsDimsForGetNexNosinkAndData(const vector &dynamic_nodes, - const std::vector &input_tensor) { - GELOGD("Start parse inputs dims when coexist data and getnext sink."); - for (size_t i = 0; i < dynamic_nodes.size(); ++i) { - auto op_desc = dynamic_nodes.at(i)->GetOpDesc(); - if (op_desc == nullptr) { - continue; - } - GeAttrValue::INT index = 0; - if (!(AttrUtils::GetInt(op_desc, ATTR_NAME_INDEX, index))) { - REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) fail", ATTR_NAME_INDEX.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str()); - GELOGE(PARAM_INVALID, "[Get][Attr] %s from op:%s(%s) fail", ATTR_NAME_INDEX.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str()); - return PARAM_INVALID; - } - if (static_cast(index) > input_tensor.size()) { - REPORT_INNER_ERROR("E19999", "Attr:%s in op:%s(%s) value:%ld > param input_tensor.size:%zu, " - "check invalid", ATTR_NAME_INDEX.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str(), - index, input_tensor.size()); - GELOGE(PARAM_INVALID, "[Check][Param] Attr:%s in op:%s(%s) value:%ld > param input_tensor.size:%zu", - ATTR_NAME_INDEX.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), - index, input_tensor.size()); - return PARAM_INVALID; - } - - const TensorDesc &tensor_desc = input_tensor[i].GetTensorDesc(); - const Shape &shape = tensor_desc.GetShape(); - const auto &shape_dims = shape.GetDims(); - GELOGI("Shape dims of %zu data is %s.", index, formats::JoinToString(shape_dims).c_str()); - GetLocalOmgContext().user_real_input_dims.emplace_back(std::move(shape_dims)); +void GraphManager::PushGraph(const RunArgs &args) { + if (executor_ == nullptr) { + GELOGW("Just compile model, not support execute."); + return; } - return SUCCESS; -} -Status GraphManager::ParseInputsDims(const std::vector &input_tensor) { - GELOGI("Start parse input dims of %zu input tensor.", input_tensor.size()); - GetLocalOmgContext().user_real_input_dims.clear(); - if (!GetLocalOmgContext().dynamic_node_type.empty()) { - vector data_nodes; - vector getnext_nosink_nodes; - data_nodes = GetLocalOmgContext().data_nodes; - getnext_nosink_nodes = GetLocalOmgContext().getnext_nosink_nodes; - GELOGD("Data nodes count is %zu, getnext nosink nodes count is %zu.", data_nodes.size(), - getnext_nosink_nodes.size()); - if (GetLocalOmgContext().dynamic_node_type == DATA) { - if (getnext_nosink_nodes.empty()) { - // just data or data+getnext_sink - ParseInputsDimsForData(input_tensor); - } else { - // data+getnext_nosink, but only need to get shape_dims of data - if (ParseInputsDimsForGetNexNosinkAndData(data_nodes, input_tensor) != SUCCESS) { - GELOGE(PARAM_INVALID, "[Parse][Dims] from data failed, when data coexist with getnext nosink."); - return PARAM_INVALID; - } - } - } else { - if (getnext_nosink_nodes.empty()) { - // just getnext_sink or getnext_sink+data, need to get shape_dims from aicpu op - GELOGI("Need to get dims from aicpu op: GETDYNAMICDIMS."); - return SUCCESS; - } else { - if (data_nodes.empty()) { - // just getnext_nosink - ParseInputsDimsForData(input_tensor); - } else { - // getnext_nosink + data, but only need to get shape_dims of getnext_nosink - if (ParseInputsDimsForGetNexNosinkAndData(getnext_nosink_nodes, input_tensor) != SUCCESS) { - GELOGE(PARAM_INVALID, "[Parse][Dims] from getnext nosink failed, when data coexist with getnext nosink"); - return PARAM_INVALID; - } - } - } - } - } - GELOGI("Parse %zu inputs dims success.", GetLocalOmgContext().user_real_input_dims.size()); - return SUCCESS; + (void)executor_->PushGraph(args); } -void GraphManager::RunThread(GraphManager *graph_manager) { - ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); - if (prctl(PR_SET_NAME, ("GE_Run")) != 0) { - GELOGW("Set thread name failed."); - } - - RunArgs args; - while (graph_manager->thread_run_flag_) { - bool pop_status = graph_manager->run_args_q_.Pop(args); - if (!pop_status) { - continue; - } - - GELOGI("[RunThread] A new loop start, graph_id:%u.", args.graph_id); - - ErrorManager::GetInstance().SetErrorContext(args.error_context); - GetContext().SetSessionId(args.session_id); - GetThreadLocalContext() = args.context; - graph_manager->UpdateLocalOmgContext(args.graph_id); - - Status ret; - // parse inputs.dims to vector> dynamic_dims - ret = graph_manager->ParseInputsDims(args.input_tensor); - if (ret != SUCCESS) { - ReturnError(graph_manager, args.callback, ret, "ParseInputsDims failed, thread exit."); - args.graph_node->Unlock(); - return; - } - - args.graph_node->UpdateLoadFlag(); - if (!args.graph_node->GetLoadFlag()) { - 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) { - StopQueue(graph_manager); - ReturnError(graph_manager, args.callback, ret, "LoadGraphAsync failed, thread exit."); - args.graph_node->Unlock(); - return; - } - // control the times of graph loading in multi-thread scenario - args.graph_node->DecreaseLoadCount(); - args.graph_node->IncreaseLoadRecord(); +void GraphManager::SetRunContext(const GraphNodePtr &graph_node) { + OmeContext ome_context; + ome_context.need_multi_batch = GetLocalOmgContext().need_multi_batch; + ome_context.dynamic_node_type = GetLocalOmgContext().dynamic_node_type; + ome_context.dynamic_shape_dims = StringUtils::Split(GetLocalOmgContext().dynamic_dims, ';'); + ome_context.user_input_dims = GetLocalOmgContext().user_input_dims; - args.graph_node->SetLoadFlag(true); - GELOGI("LoadGraph[%u], model[%u] success and set LoadFlag to true.", args.graph_node->GetGraphId(), - args.ge_root_model->GetModelId()); - } + ome_context.data_nodes = GetLocalOmgContext().data_nodes; + ome_context.getnext_nosink_nodes = GetLocalOmgContext().getnext_nosink_nodes; - 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) { - GELOGW("[GraphManager] SetGraphContext failed, graph_id=%u.", args.graph_id); - } - graph_manager->graph_executor_.SetTrainFlag(graph_manager->options_.train_graph_flag); - } + ome_context.user_real_input_dims = GetLocalOmgContext().user_real_input_dims; - ret = graph_manager->graph_executor_.ExecuteGraphAsync(args.graph_id, args.graph_node->GetGeRootModel(), - args.input_tensor, args.callback); - args.graph_node->SetRunFlag(false); - if (ret != SUCCESS) { - ReturnError(graph_manager, args.callback, ret, "ExecuteGraphAsync failed, thread exit."); - args.graph_node->Unlock(); - return; - } - args.graph_node->Unlock(); - GELOGI("[GraphManager] Run graph async success, graph_id=%u.", args.graph_id); - } + graph_node->SetOmeContext(ome_context); } -void GraphManager::StopQueue(GraphManager *graph_manager) { - if (graph_manager == nullptr) { - return; - } - - graph_manager->thread_run_flag_.store(false); - graph_manager->prerun_args_q_.Stop(); - graph_manager->run_args_q_.Stop(); +void GraphManager::StopQueue() { + thread_run_flag_.store(false); + prerun_args_q_.Stop(); } -void GraphManager::ReturnError(GraphManager *graph_manager, RunAsyncCallback callback, Status ret, const string &log) { - if (graph_manager == nullptr) { - return; - } - StopQueue(graph_manager); +void GraphManager::ReturnError(RunAsyncCallback callback, Status ret, const string &log) { + StopQueue(); GELOGE(ret, "%s.", log.c_str()); std::vector outputs; callback(ret, outputs); } -void GraphManager::ReturnError(GraphManager *graph_manager, GraphNodePtr &graph_node, RunAsyncCallback callback, - Status ret, const string &log) { - std::vector outputs; - auto compute_graph = GraphUtils::GetComputeGraph(*graph_node->GetGraph()); - if (graph_manager == nullptr || compute_graph == nullptr) { - REPORT_INNER_ERROR("E19999", "Param graph_manager or compute_graph in graph_node is nullptr, check invalid"); - GELOGE(GRAPH_FAILED, "[Check][Param] compute graph or graph manager is nullptr"); - callback(GRAPH_FAILED, outputs); - return; - } - - for (const auto &node : compute_graph->GetAllNodes()) { - if (node->GetType() != "NetOutput") { - continue; - } - for (size_t i = 0; i < node->GetAllInDataAnchorsSize(); i++) { - auto input_desc = node->GetOpDesc()->MutableInputDesc(i); - GeShape ge_shape(input_desc->GetShape().GetDims()); - GeTensorDesc ge_tensor_desc; - ge_tensor_desc.SetShape(ge_shape); - GeTensor ge_tensor(ge_tensor_desc); - int64_t len = 1; - if (input_desc->GetShape().GetDims() != std::vector({})) { - len = input_desc->GetShape().GetShapeSize(); - } - if (len < 0) { - REPORT_INNER_ERROR("E19999", "InputIndex:%zu ShapeSize:%ld of op:%s(%s) < 0, unknown shape is not support, " - "check invalid", i, len, - node->GetName().c_str(), node->GetType().c_str()); - GELOGE(GRAPH_FAILED, "[Check][Param] InputIndex:%zu ShapeSize:%ld of op:%s(%s) < 0, " - "unknown shape is not support", i, len, node->GetName().c_str(), node->GetType().c_str()); - callback(GRAPH_FAILED, outputs); - return; - } else if (len == 0) { - GELOGI("getted shape size is 0.Do process as empty tensor!"); - len = 1; - } - auto length = GetSizeInBytes(len, input_desc->GetDataType()); - auto aligned_ptr = MakeShared(length, kAlignment); - if (aligned_ptr == nullptr) { - REPORT_CALL_ERROR("E19999", "New AlignedPtr failed, len:%ld", length); - GELOGE(GRAPH_FAILED, "[Create][AlignedPtr] failed, len:%ld", length); - return; - } - ge_tensor.SetData(aligned_ptr, length); - ge::Tensor tensor = TensorAdapter::AsTensor(ge_tensor); - // To avoid global step too small and can not stop, totally set a bigger value - auto ptr = aligned_ptr->MutableGet(); - for (int64_t i = 0; i < length; i++) { - ptr[i] = 0x7F; // here stands for a positive max value - } - outputs.emplace_back(std::move(tensor)); - } - } - callback(SUCCESS, outputs); - return; -} - bool GraphManager::IsGraphNeedRebuild(uint32_t graph_id) { // find graph GraphNodePtr graph_node = nullptr; @@ -3649,6 +3154,7 @@ Status GraphManager::Build(const GraphNodePtr &graph_node, ComputeGraphPtr &comp GraphUtils::DumpGEGraph(compute_graph, "Build", is_always_dump); GraphUtils::DumpGEGraphToOnnx(*compute_graph, "Build"); + SetRunContext(graph_node); graph_node->SetGeRootModel(ge_root_model); return SUCCESS; } diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 3475da6d..6773787c 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -31,7 +31,6 @@ #include "external/graph/types.h" #include "external/ge/ge_api_types.h" #include "graph/build/graph_builder.h" -#include "graph/execute/graph_execute.h" #include "graph/ge_local_context.h" #include "graph/load/graph_loader.h" #include "graph/manager/graph_manager_utils.h" @@ -41,11 +40,12 @@ #include "graph/preprocess/graph_preprocess.h" #include "graph/tuning_utils.h" #include "model/ge_model.h" +#include "common/executor.h" namespace ge { class GraphManager { public: - GraphManager(); + GraphManager() = default; ~GraphManager() = default; /// @@ -54,7 +54,7 @@ class GraphManager { /// @param [in] options user config params /// @return Status result of function /// - Status Initialize(const std::map &options); + Status Initialize(const std::map &options, Executor *executor = nullptr); /// /// @ingroup ge_graph @@ -113,7 +113,7 @@ class GraphManager { /// @param [out] outputs output data /// @return Status result of function /// - Status RunGraphWithStreamAsync(const GraphId &graph_id, rtStream_t stream, uint64_t session_id, + Status RunGraphWithStreamAsync(const GraphId &graph_id, rtStream_t stream, uint64_t session_id, const std::vector &inputs, std::vector &outputs); /// @@ -227,34 +227,18 @@ class GraphManager { RunAsyncCallback callback; }; - struct RunArgs { - GraphNodePtr graph_node; - GraphId graph_id; - uint64_t session_id; - struct error_message::Context error_context; - std::vector input_tensor; - GeRootModelPtr ge_root_model; - GEThreadLocalContext context; - RunAsyncCallback callback; - }; - void AddGraphNode(GraphId graph_id, const GraphNodePtr &graph_node); void RemoveGraphNode(GraphId graph_id); bool HasGraphNode(GraphId graph_id); Status GetGraphNode(const GraphId &graph_id, GraphNodePtr &out); - std::shared_ptr GetModelListener() const { return graph_run_listener_; } - static Status ProcessSubGraphWithMultiThreads(GraphManager *graph_manager, GraphId root_graph_id, const SubGraphInfoPtr &sub_graph_info_ptr, const std::string &root_graph_name, uint64_t session_id, 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); - Status ParseInputsDimsForGetNexNosinkAndData(const vector &dynamic_nodes, - const std::vector &input_tensor); + Status RunCustomPass(const GraphNodePtr &graph_node); Status PreRun(const GraphNodePtr &graph_node, const std::vector &inputs, GeRootModelPtr &ge_root_model, uint64_t session_id = INVALID_SESSION_ID); @@ -350,10 +334,6 @@ class GraphManager { Status SubexpressionMigration(ComputeGraphPtr &compute_graph); - Status LoadGraphAsync(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node); - - Status CheckAndReleaseMemory(const GeModelPtr &ge_model, const GraphNodePtr &graph_node); - bool CheckModelLoad(const GeRootModelPtr &ge_model, bool load_flag); Status LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node); @@ -368,12 +348,12 @@ class GraphManager { void RemoveModelCacheHelper(const GraphId &graph_id); ModelCacheHelperPtr FindModelCacheHelper(GraphId graph_id); - static void PreRunThread(GraphManager *graph_manager); - static void RunThread(GraphManager *graph_manager); - static void StopQueue(GraphManager *graph_manager); - static void ReturnError(GraphManager *graph_manager, RunAsyncCallback callback, Status ret, const string &log); - static void ReturnError(GraphManager *graph_manager, GraphNodePtr &graph_node, RunAsyncCallback callback, - Status ret, const string &log); + void SetRunContext(const GraphNodePtr &graph_node); + void PushGraph(const RunArgs &args); + + void PreRunThread(); + void StopQueue(); + void ReturnError(RunAsyncCallback callback, Status ret, const string &log); void ChangeConstTypeWhenTraining(const ComputeGraphPtr &compute_graph); @@ -409,11 +389,7 @@ class GraphManager { CompilerStages &GetCompilerStages(GraphId graph_id); void RemoveCompilerStages(GraphId graph_id); - static Status CheckIncreBuildAndPreRun(GraphManager *graph_manager, const PreRunArgs &args, GraphNodePtr &graph_node, - GeRootModelPtr &ge_root_model); - - void ReleaseMemory(const GeModelPtr &ge_model, GraphNodePtr &graph_node, const std::vector &model_ids, - uint32_t graph_id, uint64_t session_id); + Status CheckIncreBuildAndPreRun(const PreRunArgs &args, GraphNodePtr &graph_node, GeRootModelPtr &ge_root_model); Status CheckRepeatAdd(uint32_t graph_id, bool &is_added); @@ -431,34 +407,25 @@ class GraphManager { static Status CheckGraphAdded(const GraphId &graph_id, const Graph &graph); - std::atomic_bool thread_run_flag_; + std::atomic_bool thread_run_flag_{false}; BlockingQueue prerun_args_q_{}; - BlockingQueue run_args_q_{}; std::thread prerun_thread_; - std::thread run_thread_; ComputeGraphPtr compute_graph_; std::map graph_map_; std::map cache_helper_map_; - // for run graph synchronous return - std::mutex sync_run_mutex_; - std::condition_variable condition_; - // run graph synchronization call back listener - std::shared_ptr graph_run_listener_; - // summary and checkpoint callback function list for ME, key is summary or checkpoint std::map &)>> me_callback_map_; std::map &)>> callback_map_; - bool init_flag_; - + bool init_flag_{false}; GraphManagerOptions options_; GraphContextPtr graph_context_ = nullptr; map omg_contexts_; map compiler_stages_; - GraphExecutor graph_executor_; + Executor *executor_{nullptr}; VarAccelerateCtrl var_acc_ctrl_; diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index 6ed76e57..9cec6b6d 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -33,6 +33,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" +#include "graph/common/local_context.h" #include "external/graph/graph.h" #include "graph/model.h" #include "model/ge_model.h" @@ -154,6 +155,9 @@ class GraphNode { bool GetRunFlag() const { return run_flag_; } void SetRunFlag(bool flag) { run_flag_ = flag; } + void SetOmeContext(const OmeContext &context) { context_ = context; } + OmeContext &GetOmeContext() { return context_; } + bool IsAsync() const { return async_; } void SetAsync(bool flag) { async_ = flag; } @@ -196,6 +200,8 @@ class GraphNode { bool run_flag_; std::vector subgraph_ptr_list_; + OmeContext context_; + GraphPtr graph_; ComputeGraphPtr compute_graph_; bool build_flag_; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index 58b78f41..236ec783 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -124,7 +124,7 @@ Status InnerSession::Initialize() { GE_CHK_STATUS_RET(dump_properties.InitByOptions(), "Init dump properties failed."); GE_CHK_STATUS_RET(AddDumpProperties(dump_properties), "[Add][DumpProperties] failed."); - ret = graph_manager_.Initialize(options_); + ret = InnerInitialize(); if (ret != SUCCESS) { GELOGE(ret, "[Init][GraphManager] failed, InnerSession:%lu.", session_id_); REPORT_CALL_ERROR("E19999", "GraphManager initialize failed, InnerSession:%lu.", session_id_); @@ -136,7 +136,7 @@ Status InnerSession::Initialize() { if (ret != SUCCESS) { GELOGE(ret, "[Set][MemoryMallocSize] failed."); REPORT_CALL_ERROR("E19999", "VarManager SetMemoryMallocSize failed, InnerSession:%lu.", session_id_); - (void)graph_manager_.Finalize(); + (void)InnerFinalize(); GE_CHK_STATUS(RemoveDumpProperties(), "[Remove][DumpProperties] failed."); GE_CHK_RT(rtDeviceReset(static_cast(GetContext().DeviceId()))); return ret; @@ -162,7 +162,7 @@ Status InnerSession::Finalize() { return SUCCESS; } UpdateThreadContext(std::map{}); - Status ret = graph_manager_.Finalize(); + Status ret = InnerFinalize(); if (ret != SUCCESS) { // Subsequent code execution is required, so no return is required GELOGE(ret, "[Finalize][GraphManager] failed, InnerSession:%lu.", session_id_); @@ -188,6 +188,44 @@ Status InnerSession::Finalize() { return ret; } +Status InnerSession::InnerInitialize() { + Status ret = model_executor_.Initialize(options_); + if (ret != SUCCESS) { + GELOGE(ret, "[Init][GraphExecutor] failed, InnerSession:%lu.", session_id_); + REPORT_CALL_ERROR("E19999", "GraphExecutor initialize failed, InnerSession:%lu.", session_id_); + GE_CHK_STATUS(RemoveDumpProperties(), "[Remove][DumpProperties] failed."); + return ret; + } + + ret = graph_manager_.Initialize(options_, &model_executor_); + if (ret != SUCCESS) { + GELOGE(ret, "[Init][GraphManager] failed, InnerSession:%lu.", session_id_); + REPORT_CALL_ERROR("E19999", "GraphManager initialize failed, InnerSession:%lu.", session_id_); + GE_CHK_STATUS(RemoveDumpProperties(), "[Remove][DumpProperties] failed."); + return ret; + } + + return SUCCESS; +} + +Status InnerSession::InnerFinalize() { + Status ret = graph_manager_.Finalize(); + if (ret != SUCCESS) { + // Subsequent code execution is required, so no return is required + GELOGE(ret, "[Finalize][GraphManager] failed, InnerSession:%lu.", session_id_); + REPORT_CALL_ERROR("E19999", "GraphManager Finalize failed, InnerSession:%lu.", session_id_); + } + + ret = model_executor_.Finalize(); + if (ret != SUCCESS) { + // Subsequent code execution is required, so no return is required + GELOGE(ret, "[Finalize][GraphExecutor] failed, InnerSession:%lu.", session_id_); + REPORT_CALL_ERROR("E19999", "GraphExecutor Finalize failed, InnerSession:%lu.", session_id_); + } + + return SUCCESS; +} + Status InnerSession::GetVariable(const std::string &name, Tensor &val) { UpdateThreadContext(std::map{}); return graph_manager_.GetVariable(name, val); diff --git a/ge/session/inner_session.h b/ge/session/inner_session.h index 35fe4692..afc273ac 100644 --- a/ge/session/inner_session.h +++ b/ge/session/inner_session.h @@ -23,6 +23,7 @@ #include "framework/common/ge_types.h" #include "external/ge/ge_api_types.h" #include "graph/manager/graph_manager.h" +#include "graph/execute/model_executor.h" namespace ge { class InnerSession { @@ -82,10 +83,14 @@ class InnerSession { void SetRtSocVersion(); private: + Status InnerInitialize(); + Status InnerFinalize(); + bool init_flag_; uint64_t session_id_; std::map options_; GraphManager graph_manager_; + ModelExecutor model_executor_; std::mutex resource_mutex_; // AddGraph, RemoveGraph and Finalize use void UpdateThreadContext(const std::map &options); void UpdateThreadContext(uint32_t graph_id); diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 085bb5ff..a73bcfda 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -268,7 +268,7 @@ class MemcpyAsyncTask : public OpTask { friend class SingleOpModel; friend class RtsKernelTaskBuilder; - uintptr_t addresses_[kAddressNum]; + uintptr_t addresses_[kAddressNum] = {0}; size_t dst_max_; size_t count_; rtMemcpyKind_t kind_; diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index d8fcd6c3..7832c7b0 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -161,8 +161,9 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" "${GE_CODE_DIR}/ge/common/profiling/ge_profiling.cc" "${GE_CODE_DIR}/ge/graph/manager/host_mem_manager.cc" - "${GE_CODE_DIR}/ge/graph/manager/memory_api.cc" + "${GE_CODE_DIR}/ge/graph/manager/memory_api.cc" "${GE_CODE_DIR}/ge/session/inner_session.cc" + "${GE_CODE_DIR}/ge/graph/execute/model_executor.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" "${GE_CODE_DIR}/ge/graph/execute/graph_execute.cc" "${GE_CODE_DIR}/ge/graph/preprocess/graph_preprocess.cc" @@ -469,6 +470,7 @@ set(GRAPH_BUILD_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/client/ge_api.cc" "${GE_CODE_DIR}/ge/session/inner_session.cc" "${GE_CODE_DIR}/ge/session/session_manager.cc" + "${GE_CODE_DIR}/ge/graph/execute/model_executor.cc" "${GE_CODE_DIR}/ge/engine_manager/dnnengine_manager.cc" "${GE_CODE_DIR}/ge/plugin/engine/engine_manage.cc" "${GE_CODE_DIR}/ge/graph/build/logical_stream_allocator.cc" @@ -810,6 +812,7 @@ set(MULTI_PARTS_TEST_FILES "graph/build/task_generator_unittest.cc" "graph/build/buffer_pool_mem_assigner_unittest.cc" "graph/execute/graph_execute_unittest.cc" + "graph/execute/model_executor_unittest.cc" "graph/preprocess/graph_preprocess_unittest.cc" "graph/manager/hcom_util_unittest.cc" "graph/manager/graph_caching_allocator_unittest.cc" diff --git a/tests/ut/ge/common/datatype_transfer_unittest.cc b/tests/ut/ge/common/datatype_transfer_unittest.cc index c311a7cf..ea131b2c 100644 --- a/tests/ut/ge/common/datatype_transfer_unittest.cc +++ b/tests/ut/ge/common/datatype_transfer_unittest.cc @@ -47,7 +47,7 @@ TEST_F(UtestDataTypeTransfer, fp16_fp32) { EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); bool is_equal = true; - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { if (abs((reinterpret_cast(result.data.get()))[i] - ret[i]) > 1.0e-6) { is_equal = false; break; @@ -60,7 +60,7 @@ TEST_F(UtestDataTypeTransfer, fp16_fp32) { CastArgs args2{reinterpret_cast(ret), sizeof(ret) / sizeof(ret[0]), DT_FLOAT, DT_FLOAT16}; EXPECT_EQ(transfer2.TransDataType(args2, result2), SUCCESS); EXPECT_EQ(result2.length, sizeof(data)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result2.data.get()))[i].val, data[i].val); } EXPECT_EQ(TransDataType(args2, result2), SUCCESS); @@ -81,7 +81,7 @@ TEST_F(UtestDataTypeTransfer, int32_fp16) { CastArgs args{reinterpret_cast(data), sizeof(ret) / sizeof(ret[0]), DT_INT32, DT_FLOAT16}; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result.data.get()))[i].val, ret[i].val); } @@ -91,7 +91,7 @@ TEST_F(UtestDataTypeTransfer, int32_fp16) { EXPECT_EQ(transfer2.TransDataType(args2, result2), SUCCESS); EXPECT_EQ(result2.length, sizeof(data)); bool is_equal = true; - for (int i = 0; i < sizeof(data) / sizeof(data[0]); ++i) { + for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) { if (abs((reinterpret_cast(result2.data.get()))[i] - data[i]) / abs(data[i]) > 0.05) { is_equal = false; break; @@ -154,7 +154,7 @@ TEST_F(UtestDataTypeTransfer, fp32_fp16) { EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); bool is_equal = true; - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { if (abs((reinterpret_cast(result.data.get()))[i] - ret[i]) > 1.0e-6) { is_equal = false; break; @@ -167,7 +167,7 @@ TEST_F(UtestDataTypeTransfer, fp32_fp16) { CastArgs args2{reinterpret_cast(ret), sizeof(data) / sizeof(data[0]), DT_FLOAT, DT_FLOAT16}; EXPECT_EQ(transfer2.TransDataType(args2, result2), SUCCESS); EXPECT_EQ(result2.length, sizeof(data)); - for (int i = 0; i < sizeof(data) / sizeof(data[0]); ++i) { + for (size_t i = 0; i < sizeof(data) / sizeof(data[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result2.data.get()))[i].val, data[i].val); } } @@ -238,7 +238,7 @@ TEST_F(UtestDataTypeTransfer, uint8_fp32) { DataTypeTransfer transfer; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_EQ((reinterpret_cast(result.data.get()))[i], ret[i]); } } @@ -259,7 +259,7 @@ TEST_F(UtestDataTypeTransfer, uint8_int32) { DataTypeTransfer transfer; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_EQ((reinterpret_cast(result.data.get()))[i], ret[i]); } } @@ -282,7 +282,7 @@ TEST_F(UtestDataTypeTransfer, fp32_int32) { DataTypeTransfer transfer; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result.data.get()))[i], ret[i]); } } @@ -304,7 +304,7 @@ TEST_F(UtestDataTypeTransfer, int32_fp32) { DataTypeTransfer transfer; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result.data.get()))[i], ret[i]); } } @@ -329,7 +329,7 @@ TEST_F(UtestDataTypeTransfer, int32_uint8) { DataTypeTransfer transfer; EXPECT_EQ(transfer.TransDataType(args, result), SUCCESS); EXPECT_EQ(result.length, sizeof(ret)); - for (int i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { + for (size_t i = 0; i < sizeof(ret) / sizeof(ret[0]); ++i) { EXPECT_FLOAT_EQ((reinterpret_cast(result.data.get()))[i], ret[i]); } } diff --git a/tests/ut/ge/graph/execute/model_executor_unittest.cc b/tests/ut/ge/graph/execute/model_executor_unittest.cc new file mode 100644 index 00000000..33643993 --- /dev/null +++ b/tests/ut/ge/graph/execute/model_executor_unittest.cc @@ -0,0 +1,327 @@ +/** + * 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 + +#define protected public +#define private public +#include "graph/execute/model_executor.h" +#include "graph/manager/graph_manager.h" +#include "graph/load/model_manager/model_manager.h" +#include "graph/load/model_manager/davinci_model.h" + +using namespace std; + +namespace ge { +class UtestModelExecutorTest : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +static NodePtr CreateNode(ComputeGraph &graph, const string &name, const string &type, int in_num, int out_num) { + OpDescPtr op_desc = std::make_shared(name, type); + op_desc->SetStreamId(0); + static int32_t index = 0; + op_desc->SetId(index++); + + GeTensorDesc tensor(GeShape(), FORMAT_ND, DT_INT64); + TensorUtils::SetSize(tensor, 64); + vector input_offset; + for (int i = 0; i < in_num; i++) { + op_desc->AddInputDesc(tensor); + input_offset.emplace_back(index * 64 + i * 64); + } + op_desc->SetInputOffset(input_offset); + + vector output_offset; + for (int i = 0; i < out_num; i++) { + op_desc->AddOutputDesc(tensor); + output_offset.emplace_back(index * 64 + in_num * 64 + i * 64); + } + op_desc->SetOutputOffset(output_offset); + + op_desc->SetWorkspace({}); + op_desc->SetWorkspaceBytes({}); + op_desc->SetOpKernelLibName("DNN_VM_RTS_OP_STORE"); + + return graph.AddNode(op_desc); +} + +TEST_F(UtestModelExecutorTest, test_load_graph_sync) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GeModelPtr ge_model = MakeShared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(compute_graph)); + ge_root_model->SetSubgraphInstanceNameToModel(compute_graph->GetName(), ge_model); + + GraphId graph_id = 1; + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(true); + graph_node->SetAsync(false); + + EXPECT_EQ(model_executor.LoadGraph(ge_root_model, graph_node), SUCCESS); + EXPECT_EQ(model_executor.UnloadGraph(ge_root_model, graph_id), SUCCESS); + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_load_graph_async) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + Graph graph("test_graph"); + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GeModelPtr ge_model = MakeShared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(compute_graph)); + ge_root_model->SetSubgraphInstanceNameToModel(compute_graph->GetName(), ge_model); + + GraphId graph_id = 1; + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(true); + graph_node->SetAsync(true); + + EXPECT_EQ(model_executor.LoadGraph(ge_root_model, graph_node), SUCCESS); + + EXPECT_EQ(model_executor.UnloadGraph(ge_root_model, graph_id), SUCCESS); + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_load_graph_failed) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + Graph graph("test_graph"); + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GraphId graph_id = 1; + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(true); + graph_node->SetAsync(true); + + // GeModel is null, DavinciModel::Assign will return FAILED + setenv(kEnvGeuseStaticMemory, "1", true); + EXPECT_EQ(model_executor.LoadGraph(ge_root_model, graph_node), FAILED); + EXPECT_EQ(model_executor.UnloadGraph(ge_root_model, graph_id), SUCCESS); + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); + unsetenv(kEnvGeuseStaticMemory); +} + +TEST_F(UtestModelExecutorTest, test_check_and_release_memory) { + { + auto listener = MakeShared(); + shared_ptr davinci_model1 = MakeShared(1, listener); + davinci_model1->SetId(1); + ModelManager::GetInstance()->InsertModel(1, davinci_model1); + shared_ptr davinci_model2 = MakeShared(2, listener); + davinci_model1->SetId(2); + ModelManager::GetInstance()->InsertModel(2, davinci_model2); + } + + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + GeModelPtr ge_model = make_shared(); + int64_t memory_size = 25 * 1024UL * 1024UL * 1024UL; + int64_t weight_size = 25 * 1024UL * 1024UL * 1024UL; + uint64_t session_id = 0; + EXPECT_TRUE(AttrUtils::SetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, memory_size)); + EXPECT_TRUE(AttrUtils::SetInt(ge_model, ATTR_MODEL_WEIGHT_SIZE, weight_size)); + EXPECT_TRUE(AttrUtils::SetInt(ge_model, MODEL_ATTR_SESSION_ID, session_id)); + + GraphId graph_id = 1; + GraphNodePtr graph_node = MakeShared(graph_id); + model_executor.AddGraphNode(graph_id, graph_node); + + ComputeGraphPtr compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + ge_root_model->SetModelId(1); + ge_root_model->SetModelId(2); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(true); + + EXPECT_EQ(model_executor.CheckAndReleaseMemory(ge_model, graph_node), SUCCESS); + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, parse_inputs_dims_data) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + OmeContext context; + SetLocalOmeContext(context); + ComputeGraphPtr compute_graph = MakeShared("test_graph"); + const auto data1 = CreateNode(*compute_graph, DATA, "data1", 1, 1); + const auto next1 = CreateNode(*compute_graph, GETNEXT, "data1", 1, 1); + + Tensor tensor; + std::vector input_tensors; + input_tensors.emplace_back(tensor); + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // dynamic_node_type is empty, just return + + context.dynamic_node_type = DATA; + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // ParseInputsDimsForData + + context.getnext_nosink_nodes.emplace_back(next1); + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // ParseInputsDimsForGetNexNosinkAndData + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, parse_inputs_dims_getnext) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + OmeContext context; + SetLocalOmeContext(context); + ComputeGraphPtr compute_graph = MakeShared("test_graph"); + const auto data1 = CreateNode(*compute_graph, DATA, "data1", 1, 1); + const auto next1 = CreateNode(*compute_graph, GETNEXT, "data1", 1, 1); + + Tensor tensor; + std::vector input_tensors; + input_tensors.emplace_back(tensor); + + context.dynamic_node_type = GETNEXT; + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // just getnext_sink + + context.getnext_nosink_nodes.emplace_back(next1); + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // ParseInputsDimsForData + + context.data_nodes.emplace_back(data1); + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), PARAM_INVALID); // ParseInputsDimsForGetNexNosinkAndData + AttrUtils::SetInt(next1->GetOpDesc(), ATTR_NAME_INDEX, 0); + EXPECT_EQ(model_executor.ParseInputsDims(input_tensors), SUCCESS); // ParseInputsDimsForGetNexNosinkAndData + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_run_thread) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + GraphId graph_id = 1; + uint64_t session_id = 0; + error_message::Context error_context; + GEThreadLocalContext context; + const auto callback = [](Status status, std::vector &outputs) { }; + + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GeModelPtr ge_model = MakeShared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(compute_graph)); + ge_root_model->SetSubgraphInstanceNameToModel(compute_graph->GetName(), ge_model); + + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(false); + graph_node->SetAsync(true); + graph_node->IncreaseLoadCount(); + graph_node->Lock(); + + Tensor tensor; + std::vector input_tensors; + input_tensors.emplace_back(tensor); + + RunArgs run_args{graph_node, graph_id, session_id, error_context, input_tensors, ge_root_model, context, callback}; + EXPECT_EQ(model_executor.PushGraph(run_args), SUCCESS); + + while (model_executor.run_args_q_.Size() > 0) { + usleep(10); // 0.01ms, Wait for RunThread. + } + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +static void test_run_graph(ModelExecutor &model_executor) { + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GeModelPtr ge_model = MakeShared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(compute_graph)); + ge_root_model->SetSubgraphInstanceNameToModel(compute_graph->GetName(), ge_model); + + GraphId graph_id = 1; + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(false); + graph_node->SetAsync(false); // RunGraph is Synchronization. + EXPECT_EQ(model_executor.LoadGraph(ge_root_model, graph_node), SUCCESS); + + std::vector inputs; + std::vector outputs; + EXPECT_EQ(model_executor.RunGraph(graph_node, graph_id, inputs, outputs), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_run_graph_train) { + GetThreadLocalContext().SetGlobalOption({{OPTION_GRAPH_RUN_MODE, "1"}}); + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + test_run_graph(model_executor); + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_run_graph_infer) { + GetThreadLocalContext().SetGlobalOption({}); + GetThreadLocalContext().SetSessionOption({}); + GetThreadLocalContext().SetGraphOption({}); + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + test_run_graph(model_executor); + EXPECT_EQ(model_executor.Finalize(), SUCCESS); +} + +TEST_F(UtestModelExecutorTest, test_run_graph_with_stream) { + ModelExecutor model_executor; + EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + + GraphId graph_id = 1; + auto compute_graph = MakeShared("test_graph"); + GeRootModelPtr ge_root_model = MakeShared(compute_graph); + + GeModelPtr ge_model = MakeShared(); + ge_model->SetGraph(GraphUtils::CreateGraphFromComputeGraph(compute_graph)); + ge_root_model->SetSubgraphInstanceNameToModel(compute_graph->GetName(), ge_model); + + GraphNodePtr graph_node = MakeShared(graph_id); + graph_node->SetGeRootModel(ge_root_model); + graph_node->SetLoadFlag(false); + graph_node->SetAsync(true); + + GeTensor tensor; + std::vector inputs{tensor}; + std::vector outputs; + + rtStream_t stream = nullptr; + rtStreamCreate(&stream, 0); + EXPECT_EQ(model_executor.RunGraphWithStream(graph_node, graph_id, stream, inputs, outputs), 145003); + + EXPECT_EQ(model_executor.Finalize(), SUCCESS); + rtStreamDestroy(stream); +} +} // 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 9bae10eb..9663e90f 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -15,20 +15,9 @@ */ #include + #include #include -#define protected public -#define private public -#include "graph/manager/graph_manager.h" -#include "graph/load/model_manager/model_manager.h" -#include "graph/load/model_manager/davinci_model.h" -#define const -#include "common/helper/model_cache_helper.h" -#undef const -#include "init/gelib.h" -#undef private -#undef public - #include #include #include @@ -38,6 +27,14 @@ #include #include +#define protected public +#define private public +#include "graph/manager/graph_manager.h" +#define const +#include "common/helper/model_cache_helper.h" +#undef const +#include "init/gelib.h" + #include "common/math/math_util.h" #include "common/thread_pool.h" #include "common/dump/dump_manager.h" @@ -121,7 +118,6 @@ using namespace std; using namespace testing; -using namespace ge; using namespace domi; namespace { @@ -129,6 +125,8 @@ const uint32_t kNotAdded = 0; const uint32_t kStartAdd = 1; const uint32_t kDoneAdded = 2; } + +namespace ge { class UtestGraphManagerTest : public testing::Test { protected: void SetUp() {} @@ -136,6 +134,31 @@ class UtestGraphManagerTest : public testing::Test { void TearDown() {} }; +class StubExecutor : public Executor { + public: + Status LoadGraph(const GeRootModelPtr &ge_root_model, const GraphNodePtr &graph_node) { + return SUCCESS; + } + + Status UnloadGraph(const GeRootModelPtr &ge_root_model, uint32_t graph_id) { + return SUCCESS; + } + + Status PushGraph(const RunArgs &args) { + return SUCCESS; + } + + Status RunGraph(const GraphNodePtr &graph_node, GraphId graph_id, + const std::vector &inputs, std::vector &outputs) { + return SUCCESS; + } + + Status RunGraphWithStream(const GraphNodePtr &graph_node, GraphId graph_id, rtStream_t stream, + const std::vector &inputs, std::vector &outputs){ + return SUCCESS; + } +}; + void CreateGraph(Graph &graph) { TensorDesc desc(ge::Shape({1, 3, 224, 224})); uint32_t size = desc.GetShape().GetShapeSize(); @@ -288,26 +311,20 @@ TEST_F(UtestGraphManagerTest, test_remove_graph_1) { TEST_F(UtestGraphManagerTest, test_remove_graph_2) { GraphId graph_id = 1; GraphManager graph_manager; + StubExecutor stub_executor; + graph_manager.executor_ = &stub_executor; + GraphNodePtr graph_node = MakeShared(graph_id); Graph graph("test_graph"); CreateGraph(graph); auto compute_graph = GraphUtils::GetComputeGraph(graph); GeRootModelPtr ge_root_model = MakeShared(compute_graph); - auto model_manager = ModelManager::GetInstance(); - auto listener = MakeShared(); - shared_ptr davinci_model1 = MakeShared(1, listener); - davinci_model1->SetId(1); - shared_ptr davinci_model2 = MakeShared(2, listener); - davinci_model1->SetId(2); - model_manager->InsertModel(1, davinci_model1); - model_manager->InsertModel(2, davinci_model2); ge_root_model->SetModelId(1); ge_root_model->SetModelId(2); graph_node->SetGeRootModel(ge_root_model); graph_node->SetLoadFlag(true); graph_manager.AddGraphNode(graph_id, graph_node); - Status status = graph_manager.RemoveGraph(graph_id); - EXPECT_EQ(status, ge::SUCCESS); + EXPECT_EQ(graph_manager.RemoveGraph(graph_id), SUCCESS); } TEST_F(UtestGraphManagerTest, test_pre_run_thread) { @@ -327,7 +344,7 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread) { GraphNodePtr graph_node = MakeShared(graph_id); graph_manager.AddGraphNode(graph_id, graph_node); - graph_manager.PreRunThread(&graph_manager); + graph_manager.PreRunThread(); // end with failed } @@ -355,48 +372,10 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread_2) { graph_manager.AddGraphNode(graph_id, graph_node_2); ret = graph_manager.prerun_args_q_.Push({graph_id, input_tensor, session_id, error_context, context, callback}); EXPECT_EQ(ret, true); - graph_manager.PreRunThread(&graph_manager); + graph_manager.PreRunThread(); // end with failed } -TEST_F(UtestGraphManagerTest, test_check_and_release_memory) { - - GraphManager graph_manager; - GeModelPtr ge_model = make_shared(); - int64_t memory_size = 25 * 1024UL * 1024UL * 1024UL; - int64_t weight_size = 25 * 1024UL * 1024UL * 1024UL; - uint64_t session_id = 0; - ge::AttrUtils::SetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, memory_size); - ge::AttrUtils::SetInt(ge_model, ATTR_MODEL_WEIGHT_SIZE, weight_size); - ge::AttrUtils::SetInt(ge_model, MODEL_ATTR_SESSION_ID, session_id); - - - GraphId graph_id = 1; - GraphNodePtr graph_node = MakeShared(graph_id); - graph_manager.AddGraphNode(graph_id, graph_node); - graph_manager.IncreaseGraphCount(graph_id); - graph_manager.IncreaseGraphCount(graph_id); - - auto model_manager = ModelManager::GetInstance(); - auto listener = MakeShared(); - shared_ptr davinci_model1 = MakeShared(1, listener); - davinci_model1->SetId(1); - shared_ptr davinci_model2 = MakeShared(2, listener); - davinci_model1->SetId(2); - model_manager->InsertModel(1, davinci_model1); - model_manager->InsertModel(2, davinci_model2); - ComputeGraphPtr compute_graph = MakeShared("test_graph"); - bool is_dynamic_shape = false; - (void)AttrUtils::GetBool(compute_graph, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, is_dynamic_shape); - GeRootModelPtr ge_root_model = MakeShared(compute_graph); - ge_root_model->SetModelId(1); - ge_root_model->SetModelId(2); - graph_node->SetGeRootModel(ge_root_model); - graph_node->SetLoadFlag(true); - Status status = graph_manager.CheckAndReleaseMemory(ge_model, graph_node); - EXPECT_EQ(status, ge::SUCCESS); -} - TEST_F(UtestGraphManagerTest, test_check_incre_build_and_pre_run_1) { // no need to build GraphId graph_id = 1; @@ -406,7 +385,7 @@ TEST_F(UtestGraphManagerTest, test_check_incre_build_and_pre_run_1) { GraphManager::PreRunArgs arg; GraphNodePtr graph_node = MakeShared(graph_id); graph_node->SetBuildFlag(true); - Status status = graph_manager.CheckIncreBuildAndPreRun(&graph_manager, arg, graph_node, ge_root_model); + Status status = graph_manager.CheckIncreBuildAndPreRun(arg, graph_node, ge_root_model); EXPECT_EQ(status, ge::SUCCESS); } @@ -422,7 +401,7 @@ TEST_F(UtestGraphManagerTest, test_check_incre_build_and_pre_run_2) { graph_node->SetBuildFlag(true); graph_node->Lock(); graph_manager.var_acc_ctrl_.graph_ids_need_rebuild_.insert(graph_id); - Status status = graph_manager.CheckIncreBuildAndPreRun(&graph_manager, arg, graph_node, ge_root_model); + Status status = graph_manager.CheckIncreBuildAndPreRun(arg, graph_node, ge_root_model); EXPECT_EQ(status, ge::PARAM_INVALID); } @@ -437,7 +416,7 @@ TEST_F(UtestGraphManagerTest, test_check_incre_build_and_pre_run_3) { GraphNodePtr graph_node = MakeShared(graph_id); graph_node->SetBuildFlag(false); graph_node->Lock(); - Status status = graph_manager.CheckIncreBuildAndPreRun(&graph_manager, arg, graph_node, ge_root_model); + Status status = graph_manager.CheckIncreBuildAndPreRun(arg, graph_node, ge_root_model); EXPECT_NE(status, ge::SUCCESS); } @@ -471,14 +450,6 @@ TEST_F(UtestGraphManagerTest, test_add_graph_with_copy_fail) { EXPECT_NE(status, ge::SUCCESS); } -TEST_F(UtestGraphManagerTest, ParseInputsDimsForData_success) { - GraphManager graph_manager; - std::vector input_tensors; - ge::Tensor tensor; - input_tensors.emplace_back(tensor); - graph_manager.ParseInputsDimsForData(input_tensors); -} - TEST_F(UtestGraphManagerTest, test_prerunthread_failed_1) { GraphId graph_id = 1; GraphManager graph_manager; @@ -509,7 +480,7 @@ TEST_F(UtestGraphManagerTest, test_prerunthread_failed_1) { graph_node->SetRunFlag(false); // function return. graph_manager.prerun_args_q_.Push(args); - auto t1 = std::thread(GraphManager::PreRunThread, &graph_manager); + auto t1 = std::thread(&GraphManager::PreRunThread, &graph_manager); if (t1.joinable()) { t1.join(); } @@ -549,7 +520,7 @@ TEST_F(UtestGraphManagerTest, test_prerunthread_failed_2) { int ret = setenv("ENABLE_NETWORK_ANALYSIS_DEBUG", "1", 1); EXPECT_EQ(ret, 0); graph_manager.prerun_args_q_.Push(args); - auto t1 = std::thread(GraphManager::PreRunThread, &graph_manager); + auto t1 = std::thread(&GraphManager::PreRunThread, &graph_manager); if (t1.joinable()) { t1.join(); } @@ -593,3 +564,4 @@ TEST_F(UtestGraphManagerTest, ChangeAndDeleteConst_success) { auto all_nodes = graph->GetDirectNode(); EXPECT_EQ(all_nodes.size(), 3); } +} // namespace ge diff --git a/tests/ut/ge/graph/passes/folding_kernel/gather_v2_kernel_unittest.cc b/tests/ut/ge/graph/passes/folding_kernel/gather_v2_kernel_unittest.cc index 0083146b..ad165d25 100644 --- a/tests/ut/ge/graph/passes/folding_kernel/gather_v2_kernel_unittest.cc +++ b/tests/ut/ge/graph/passes/folding_kernel/gather_v2_kernel_unittest.cc @@ -92,7 +92,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis0VersionA) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -139,7 +139,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis0VersionB) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {3, 3}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -186,7 +186,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT64Axis0) { GeTensorPtr tensor_out = outputs[0]; int64_t *data_buf = (int64_t *)tensor_out->GetData().data(); vector expect_out = {3, 3}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -233,7 +233,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis0) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {11, 12, 13, 14, 15, 16, 17, 18, 19, 11, 12, 13, 14, 15, 16, 17, 18, 19}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -279,7 +279,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis0And1) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -327,7 +327,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis1) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {4, 5, 6, 4, 5, 6, 14, 15, 16, 14, 15, 16}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -374,7 +374,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis2) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {1, 1, 4, 4, 7, 7, 11, 11, 14, 14, 17, 17}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -422,7 +422,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT32Axis3) { GeTensorPtr tensor_out = outputs[0]; int32_t *data_buf = (int32_t *)tensor_out->GetData().data(); vector expect_out = {1, 2, 4, 5, 7, 8, 11, 12, 14, 15, 17, 18, 1, 2, 4, 5, 7, 8, 11, 12, 14, 15, 17, 18}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -470,7 +470,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT8Axis0) { GeTensorPtr tensor_out = outputs[0]; int8_t *data_buf = (int8_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -517,7 +517,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, INT16Axis0) { GeTensorPtr tensor_out = outputs[0]; int16_t *data_buf = (int16_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -564,7 +564,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, UINT8Axis0) { GeTensorPtr tensor_out = outputs[0]; uint8_t *data_buf = (uint8_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -611,7 +611,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, UINT16Axis0) { GeTensorPtr tensor_out = outputs[0]; uint16_t *data_buf = (uint16_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -658,7 +658,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, UINT32Axis0) { GeTensorPtr tensor_out = outputs[0]; uint32_t *data_buf = (uint32_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -705,7 +705,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, UINT64Axis0) { GeTensorPtr tensor_out = outputs[0]; uint64_t *data_buf = (uint64_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { EXPECT_EQ(*(data_buf + i), expect_out[i]); } } @@ -753,7 +753,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, DoubleAxis0) { GeTensorPtr tensor_out = outputs[0]; double *data_buf = (double *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { double diff = *(data_buf + i) - expect_out[i]; bool is_same = fabs(diff) < 0.0001 ? true : false; EXPECT_EQ(is_same, true); @@ -802,7 +802,7 @@ TEST_F(UtestGraphPassesFoldingKernelGatherV2Kernel, Float16Axis0) { GeTensorPtr tensor_out = outputs[0]; fp16_t *data_buf = (fp16_t *)tensor_out->GetData().data(); vector expect_out = {2, 2}; - for (int i = 0; i < expect_out.size(); i++) { + for (size_t i = 0; i < expect_out.size(); i++) { double diff = (double)*(data_buf + i) - (double)expect_out[i]; bool is_same = fabs(diff) < 0.0001 ? true : false; EXPECT_EQ(is_same, true); diff --git a/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc b/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc index 5157e510..c7d36582 100644 --- a/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc @@ -33,7 +33,7 @@ protected: void SetUp() {} void TearDown() {} public: - NodePtr MakeNode(const ComputeGraphPtr &graph, uint32_t in_num, uint32_t out_num, string name, string type) { + NodePtr MakeNode(const ComputeGraphPtr &graph, int in_num, int out_num, string name, string type) { GeTensorDesc test_desc(GeShape(), FORMAT_NCHW, DT_FLOAT); auto op_desc = std::make_shared(name, type); for (auto i = 0; i < in_num; ++i) { diff --git a/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc b/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc index 1b75a613..c752cea4 100644 --- a/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc @@ -45,7 +45,7 @@ protected: } public: - NodePtr MakeNode(const ComputeGraphPtr &graph, uint32_t in_num, uint32_t out_num, string name, string type) { + NodePtr MakeNode(const ComputeGraphPtr &graph, int in_num, int out_num, string name, string type) { GeTensorDesc test_desc(GeShape(), FORMAT_NCHW, DT_FLOAT); auto op_desc = std::make_shared(name, type); for (auto i = 0; i < in_num; ++i) { diff --git a/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc b/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc index 00157395..c633c0e1 100644 --- a/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc @@ -32,7 +32,7 @@ class UtestSubgraphConstMigrationPass : public testing::Test { void TearDown() {} public: - NodePtr MakeNode(const ComputeGraphPtr &graph, uint32_t in_num, uint32_t out_num, string name, string type) { + NodePtr MakeNode(const ComputeGraphPtr &graph, int in_num, int out_num, string name, string type) { GeTensorDesc test_desc(GeShape(), FORMAT_NCHW, DT_FLOAT); auto op_desc = std::make_shared(name, type); for (auto i = 0; i < in_num; ++i) { From 27bdd194f78e263d4664a3dd56223751d7f2cbb2 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 5 Jul 2021 22:39:28 +0800 Subject: [PATCH 160/226] delete defined but not used --- ge/graph/manager/graph_manager.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index b2528cdd..96dc59c5 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -129,8 +129,6 @@ 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; -const size_t kAlignment = 64; bool IsTailingOptimization() { string is_tailing_optimization_option; From 99367eb363a4911a9eb098bb7ca6fb4f3c74f15b Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 6 Jul 2021 10:03:38 +0800 Subject: [PATCH 161/226] Add UT for InnerSession --- tests/ut/ge/session/inner_session_unittest.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/ut/ge/session/inner_session_unittest.cc b/tests/ut/ge/session/inner_session_unittest.cc index 0d20f06a..80cc2834 100644 --- a/tests/ut/ge/session/inner_session_unittest.cc +++ b/tests/ut/ge/session/inner_session_unittest.cc @@ -19,21 +19,18 @@ #define private public #define protected public #include "session/inner_session.h" -#undef private -#undef protected - using namespace std; namespace ge { -class Utest_Inner_session : public testing::Test { +class UtestInnerSession : public testing::Test { protected: void SetUp() override {} void TearDown() override {} }; -TEST_F(Utest_Inner_session, build_graph_success) { +TEST_F(UtestInnerSession, build_graph_success) { std::map options; uint64_t session_id = 1; InnerSession inner_seesion(session_id, options); @@ -44,17 +41,15 @@ TEST_F(Utest_Inner_session, build_graph_success) { EXPECT_NE(ret, ge::SUCCESS); } -TEST_F(Utest_Inner_session, initialize) { - std::map options = { - {ge::MODIFY_MIXLIST, "/modify.json"} - }; +TEST_F(UtestInnerSession, initialize) { + std::map options = {}; uint64_t session_id = 1; InnerSession inner_session(session_id, options); - auto ret = inner_session.Initialize(); - EXPECT_NE(ret, ge::SUCCESS); + EXPECT_EQ(inner_session.Initialize(), SUCCESS); + EXPECT_EQ(inner_session.Finalize(), SUCCESS); } -TEST_F(Utest_Inner_session, check_op_precision_mode) { +TEST_F(UtestInnerSession, check_op_precision_mode) { std::map options = { {ge::OP_PRECISION_MODE, "./op_precision_mode.ini"} }; From f2022b92cce348f7dc10d05363571438ff85f337 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 6 Jul 2021 10:09:54 +0800 Subject: [PATCH 162/226] Fix ut. --- tests/ut/ge/single_op/single_op_task_unittest.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 51ef928f..f6ae0dbf 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -158,16 +158,21 @@ TEST_F(UtestSingleOpTask, test_atomic_exec) { auto graph = make_shared("graph"); auto op_desc = make_shared("Add", "Add"); auto node = graph->AddNode(op_desc); - AtomicOpTask task; task.op_desc_ = op_desc; task.node_ = node; vector inputs; vector outputs; - task.atomic_output_indices_ = { 0 }; + std::vector atomic_output_indices; + ge::AttrUtils::SetListInt(op_desc, ATOMIC_ATTR_OUTPUT_INDEX, atomic_output_indices); + ASSERT_EQ(task.InitAtomicAddrCleanIndices(), INTERNAL_ERROR); + atomic_output_indices = { 0 }; + ge::AttrUtils::SetListInt(op_desc, ATOMIC_ATTR_OUTPUT_INDEX, atomic_output_indices); + ASSERT_EQ(task.InitAtomicAddrCleanIndices(), INTERNAL_ERROR); task.arg_size_ = sizeof(void *) * 2; task.args_.reset(new (std::nothrow) uint8_t[task.arg_size_]); + ASSERT_EQ(task.InitAtomicAddrCleanIndices(), SUCCESS); ASSERT_EQ(task.UpdateIoAddr(inputs, outputs), ACL_ERROR_GE_PARAM_INVALID); ge::DataBuffer data_buffer; From 1f5afea9635d8ddd5d29a64d99fbf439760d3155 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 6 Jul 2021 20:09:45 +0800 Subject: [PATCH 163/226] Separate unit test files --- tests/ut/ge/CMakeLists.txt | 378 +++++++++++++++------------------------------ 1 file changed, 128 insertions(+), 250 deletions(-) diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 7832c7b0..a1abdfff 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -134,6 +134,7 @@ set(PARSER_SRC_FILES "${GE_CODE_DIR}/parser/parser/common/model_saver.cc" "${GE_CODE_DIR}/parser/parser/common/parser_types.cc" "${GE_CODE_DIR}/parser/parser/common/parser_inner_ctx.cc" + "${GE_CODE_DIR}/parser/parser/tensorflow/iterator_fusion_pass.cc" ) set(COMMON_SRC_FILES @@ -155,21 +156,12 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/init/gelib.cc" "${GE_CODE_DIR}/ge/engine_manager/dnnengine_manager.cc" "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_manager.cc" - "${GE_CODE_DIR}/ge/session/session_manager.cc" "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_builder_manager.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/model_manager.cc" "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" "${GE_CODE_DIR}/ge/common/profiling/ge_profiling.cc" "${GE_CODE_DIR}/ge/graph/manager/host_mem_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/memory_api.cc" - "${GE_CODE_DIR}/ge/session/inner_session.cc" - "${GE_CODE_DIR}/ge/graph/execute/model_executor.cc" "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" - "${GE_CODE_DIR}/ge/graph/execute/graph_execute.cc" - "${GE_CODE_DIR}/ge/graph/preprocess/graph_preprocess.cc" - "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model_stub.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/davinci_model.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/data_inputer.cc" "${GE_CODE_DIR}/ge/common/dump/dump_properties.cc" "${GE_CODE_DIR}/ge/common/helper/model_helper.cc" "${GE_CODE_DIR}/ge/common/dump/dump_manager.cc" @@ -179,128 +171,16 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" "${GE_CODE_DIR}/ge/model/ge_root_model.cc" "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/common/dump/dump_server.cc" - "${GE_CODE_DIR}/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc" "${GE_CODE_DIR}/ge/graph/preprocess/multi_batch_copy_graph.cc" "${GE_CODE_DIR}/ge/graph/optimize/mem_rw_conflict_optimize.cc" - "${GE_CODE_DIR}/ge/graph/passes/pass_manager.cc" - "${GE_CODE_DIR}/ge/graph/passes/resource_pair_add_control_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/resource_pair_remove_control_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/pass_utils.cc" - "${GE_CODE_DIR}/ge/graph/passes/base_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/bitcast_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/constant_folding_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/aicpu_constant_folding_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/reshape_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/reshape_recovery_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transop_breadth_fusion_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transop_depth_fusion_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/same_transdata_breadth_fusion_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transop_without_reshape_fusion_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/compile_nodes_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/variable_prepare_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/variable_ref_delete_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/subgraph_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/data_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/net_output_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/replace_transshape_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/constant_fuse_same_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/print_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/no_use_reshape_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/iterator_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/input_output_connection_identify_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/atomic_addr_clean_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/mark_same_addr_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/mark_graph_unknown_status_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/mark_agnostic_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/dimension_compute_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/dimension_adjust_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/get_original_format_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/shape_operate_op_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/assert_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/dropout_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/infer_base_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/infershape_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/infer_value_range_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/unused_const_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/permute_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/ctrl_edge_transfer_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/end_of_sequence_add_control_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/stop_gradient_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/prevent_gradient_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/identity_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/ref_identity_delete_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/placeholder_with_default_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/snapshot_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/guarantee_const_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/var_is_initialized_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/parallel_concat_start_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/folding_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/cast_translate_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/prune_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/merge_to_stream_merge_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/merge_input_memcpy_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/switch_to_stream_switch_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/mark_force_unknown_for_cond_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/attach_stream_label_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/multi_batch_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/multi_batch_clone_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/subexpression_migration_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/subgraph_const_migration_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/unused_args_clean_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/next_iteration_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/control_trigger_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/cond_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/cond_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/for_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/enter_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/assign_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/inplace_support_check_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/addn_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/common_subexpression_elimination_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transop_symmetry_elimination_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/save_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/switch_dead_branch_elimination.cc" - "${GE_CODE_DIR}/ge/graph/passes/switch_logic_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/switch_data_edges_bypass.cc" - "${GE_CODE_DIR}/ge/graph/passes/merge_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/variable_op_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/cast_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/transpose_transdata_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/hccl_memcpy_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/hccl_continuous_memcpy_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/flow_ctrl_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/global_step_insert_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/link_gen_mask_nodes_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/replace_with_empty_const_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/hccl_group_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/hccl_tailing_optimization_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/memcpy_addr_async_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/set_input_output_offset_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/remove_same_const_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/useless_control_out_remove_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/parallel_group_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/buffer_pool_memory_pass.cc" - "${GE_CODE_DIR}/ge/graph/passes/mark_node_unknown_shape_pass.cc" "${GE_CODE_DIR}/ge/model/ge_model.cc" "${GE_CODE_DIR}/ge/common/cust_aicpu_kernel_store.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/model_utils.cc" - "${GE_CODE_DIR}/ge/graph/load/model_manager/zero_copy_offset.cc" - "${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/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" "${GE_CODE_DIR}/ge/common/auth/file_saver.cc" "${GE_CODE_DIR}/ge/graph/manager/util/debug.cc" "${GE_CODE_DIR}/ge/common/debug/memory_dumper.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" "${GE_CODE_DIR}/ge/graph/load/graph_loader.cc" "${GE_CODE_DIR}/ge/graph/optimize/graph_optimize.cc" "${GE_CODE_DIR}/ge/graph/build/graph_builder.cc" @@ -315,13 +195,10 @@ set(COMMON_SRC_FILES "${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/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" "${GE_CODE_DIR}/ge/graph/build/run_context.cc" "${GE_CODE_DIR}/ge/graph/build/stream_graph_optimizer.cc" "${GE_CODE_DIR}/ge/graph/build/task_generator.cc" - "${GE_CODE_DIR}/ge/graph/partition/graph_partition.cc" "${GE_CODE_DIR}/ge/graph/partition/engine_place.cc" "${GE_CODE_DIR}/ge/graph/build/stream_allocator.cc" "${GE_CODE_DIR}/ge/graph/build/memory/memory_assigner.cc" @@ -348,10 +225,10 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_mem_manager.cc" "${GE_CODE_DIR}/ge/common/dump/dump_op.cc" "${GE_CODE_DIR}/ge/common/model_saver.cc" - "${GE_CODE_DIR}/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc" "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" "${GE_CODE_DIR}/ge/session/omg.cc" + "${GE_CODE_DIR}/ge/common/thread_pool.cc" "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" ) @@ -375,57 +252,26 @@ set(COMMON_FORMAT_SRC_FILES "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc" "${GE_CODE_DIR}/ge/common/formats/utils/formats_trans_utils.cc" "${GE_CODE_DIR}/ge/graph/manager/util/hcom_util.cc" - "${GE_CODE_DIR}/ge/common/dump/dump_manager.cc" ) -set(GRAPH_OPTIMIZE_COMMON_SRC_FILES - "${GE_CODE_DIR}/ge/graph/optimize/graph_optimize.cc" - "${GE_CODE_DIR}/ge/graph/optimize/summary_optimize.cc" - "${GE_CODE_DIR}/ge/graph/optimize/mem_rw_conflict_optimize.cc" -) - - set(GRAPH_PREPARE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/preprocess/graph_preprocess.cc" "${GE_CODE_DIR}/ge/graph/preprocess/insert_op/util_insert_aipp_op.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/preprocess/insert_op/base_insert_op.cc" ) -set(GRAPH_PARTITION_COMMON_SRC_FILES - "${GE_CODE_DIR}/ge/graph/partition/graph_partition.cc" - "${GE_CODE_DIR}/ge/plugin/engine/dnnengines.cc" - "${GE_CODE_DIR}/ge/graph/partition/engine_place.cc" -) - -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/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" - "${GE_CODE_DIR}/ge/graph/manager/graph_caching_allocator.cc" - "${GE_CODE_DIR}/ge/graph/manager/session_scope_mem_allocator.cc" - "${GE_CODE_DIR}/ge/graph/manager/rdma_pool_allocator.cc" - "${GE_CODE_DIR}/ge/graph/manager/host_mem_allocator.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_mem_manager.cc" - "${GE_CODE_DIR}/ge/common/thread_pool.cc" -) - -set(DISTINCT_GRAPH_LOAD_SRC_FILES - "${GE_CODE_DIR}/ge/graph/manager/util/hcom_util.cc" - "${GE_CODE_DIR}/ge/graph/manager/util/debug.cc" - "${GE_CODE_DIR}/ge/common/properties_manager.cc" - "${GE_CODE_DIR}/ge/common/profiling/profiling_manager.cc" - "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" - "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" - "${GE_CODE_DIR}/ge/common/util.cc" +set(GRAPH_DAVINCI_MODEL_SRC_FILES + "${GE_CODE_DIR}/ge/graph/load/model_manager/aipp_utils.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/cpu_queue_schedule.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/data_dumper.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/data_inputer.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/davinci_model.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/model_manager.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/model_utils.cc" + "${GE_CODE_DIR}/ge/graph/load/model_manager/zero_copy_offset.cc" + "${GE_CODE_DIR}/ge/graph/load/model_manager/zero_copy_task.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/tbe_handle_store.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/task_info.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/event_record_task_info.cc" @@ -447,45 +293,24 @@ set(DISTINCT_GRAPH_LOAD_SRC_FILES "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/ffts_task_info.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" - "${GE_CODE_DIR}/ge/model/ge_model.cc" - "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" - "${GE_CODE_DIR}/ge/common/debug/memory_dumper.cc" - "${GE_CODE_DIR}/ge/executor/ge_executor.cc" - "${GE_CODE_DIR}/ge/common/auth/file_saver.cc" + "${GE_CODE_DIR}/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc" "${GE_CODE_DIR}/ge/graph/manager/model_manager/event_manager.cc" ) set(GRAPH_EXECUTE_COMMON_SRC_FILES - "${GE_CODE_DIR}/ge/graph/execute/graph_execute.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" - "${GE_CODE_DIR}/ge/graph/manager/util/rt_context_util.cc" - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" - "${GE_CODE_DIR}/ge/graph/manager/graph_context.h" + "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model_stub.cc" ) set(GRAPH_BUILD_COMMON_SRC_FILES - "${GE_CODE_DIR}/ge/graph/build/graph_builder.cc" - "${GE_CODE_DIR}/ge/graph/build/task_generator.cc" + "${GE_CODE_DIR}/ge/graph/manager/graph_manager.cc" "${GE_CODE_DIR}/ge/client/ge_api.cc" "${GE_CODE_DIR}/ge/session/inner_session.cc" "${GE_CODE_DIR}/ge/session/session_manager.cc" "${GE_CODE_DIR}/ge/graph/execute/model_executor.cc" - "${GE_CODE_DIR}/ge/engine_manager/dnnengine_manager.cc" + "${GE_CODE_DIR}/ge/graph/execute/graph_execute.cc" + "${GE_CODE_DIR}/ge/plugin/engine/dnnengines.cc" "${GE_CODE_DIR}/ge/plugin/engine/engine_manage.cc" - "${GE_CODE_DIR}/ge/graph/build/logical_stream_allocator.cc" - "${GE_CODE_DIR}/ge/graph/build/stream_allocator.cc" - "${GE_CODE_DIR}/ge/graph/build/memory/block_mem_assigner.cc" - "${GE_CODE_DIR}/ge/graph/build/memory/binary_block_mem_assigner.cc" - "${GE_CODE_DIR}/ge/graph/build/memory/hybrid_mem_assigner.cc" - "${GE_CODE_DIR}/ge/graph/build/memory/max_block_mem_assigner.cc" - "${GE_CODE_DIR}/ge/model/ge_model.cc" - "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" - "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" - "${GE_CODE_DIR}/ge/common/thread_pool.cc" - "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" - "${GE_CODE_DIR}/ge/graph/build/run_context.cc" - "${GE_CODE_DIR}/ge/graph/common/local_context.cc" + "${GE_CODE_DIR}/ge/graph/manager/graph_context.cc" ) set(GRAPH_PASS_COMMON_SRC_FILES @@ -495,7 +320,6 @@ set(GRAPH_PASS_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/variable_ref_delete_op_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/atomic_addr_clean_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/constant_folding_pass.cc" - "${GE_CODE_DIR}/parser/parser/tensorflow/iterator_fusion_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/iterator_op_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/net_output_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/print_op_pass.cc" @@ -534,7 +358,6 @@ set(GRAPH_PASS_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/same_transdata_breadth_fusion_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/compile_nodes_pass.cc" - "${GE_CODE_DIR}/ge/graph/common/transop_util.cc" "${GE_CODE_DIR}/ge/graph/passes/flow_ctrl_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/parallel_group_pass.cc" #"${GE_CODE_DIR}/ge/graph/optimize/optimizer/allreduce_fusion_pass.cc" @@ -546,10 +369,106 @@ set(GRAPH_PASS_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/infer_base_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/infershape_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/infer_value_range_pass.cc" - "${GE_CODE_DIR}/ge/ge_local_engine/engine/host_cpu_engine.cc" - "${GE_CODE_DIR}/ge/analyzer/analyzer.cc" + "${GE_CODE_DIR}/ge/graph/passes/resource_pair_add_control_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/resource_pair_remove_control_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/pass_utils.cc" + "${GE_CODE_DIR}/ge/graph/passes/base_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/bitcast_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/constant_folding_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/aicpu_constant_folding_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/reshape_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/reshape_recovery_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transop_breadth_fusion_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transop_depth_fusion_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/same_transdata_breadth_fusion_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transop_without_reshape_fusion_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/compile_nodes_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/variable_prepare_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/variable_ref_delete_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/variable_ref_useless_control_out_delete_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/subgraph_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/data_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/net_output_pass.cc" - "${GE_CODE_DIR}/ge/graph/common/local_context.cc" + "${GE_CODE_DIR}/ge/graph/passes/replace_transshape_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/constant_fuse_same_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/fuse_data_nodes_with_common_input_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/print_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/no_use_reshape_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/iterator_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/input_output_connection_identify_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/atomic_addr_clean_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/mark_same_addr_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/mark_graph_unknown_status_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/mark_agnostic_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/dimension_compute_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/dimension_adjust_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/get_original_format_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/shape_operate_op_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/assert_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/dropout_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_base_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infershape_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/infer_value_range_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/unused_const_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/permute_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/ctrl_edge_transfer_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/end_of_sequence_add_control_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/stop_gradient_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/prevent_gradient_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/identity_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/ref_identity_delete_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/placeholder_with_default_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/snapshot_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/guarantee_const_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/var_is_initialized_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/parallel_concat_start_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/folding_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/cast_translate_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/prune_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/merge_to_stream_merge_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/merge_input_memcpy_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/switch_to_stream_switch_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/mark_force_unknown_for_cond_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/attach_stream_label_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/multi_batch_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/multi_batch_clone_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/subexpression_migration_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/subgraph_const_migration_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/unused_args_clean_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/next_iteration_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/control_trigger_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/cond_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/cond_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/for_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/enter_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/assign_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/inplace_support_check_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/addn_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/common_subexpression_elimination_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transop_symmetry_elimination_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/save_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/switch_dead_branch_elimination.cc" + "${GE_CODE_DIR}/ge/graph/passes/switch_logic_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/switch_data_edges_bypass.cc" + "${GE_CODE_DIR}/ge/graph/passes/merge_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/variable_op_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/cast_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/transpose_transdata_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/hccl_continuous_memcpy_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/flow_ctrl_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/global_step_insert_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/link_gen_mask_nodes_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/replace_with_empty_const_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/hccl_group_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/hccl_tailing_optimization_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/memcpy_addr_async_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/set_input_output_offset_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/remove_same_const_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/useless_control_out_remove_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/parallel_group_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/buffer_pool_memory_pass.cc" + "${GE_CODE_DIR}/ge/graph/passes/mark_node_unknown_shape_pass.cc" ) set(KERNEL_SRC_FILES @@ -590,6 +509,7 @@ set(KERNEL_SRC_FILES ) set(SINGLE_OP_SRC_FILES + "${GE_CODE_DIR}/ge/executor/ge_executor.cc" "${GE_CODE_DIR}/ge/single_op/task/build_task_utils.cc" "${GE_CODE_DIR}/ge/single_op/task/op_task.cc" "${GE_CODE_DIR}/ge/single_op/task/tbe_task_builder.cc" @@ -623,7 +543,6 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/node_executor/aicore/aicore_op_task.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/aicore/aicore_task_builder.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/aicore/aicore_task_compiler.cc" - "${GE_CODE_DIR}/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/ge_local/ge_local_node_executor.cc" @@ -639,10 +558,6 @@ set(SINGLE_OP_SRC_FILES "${GE_CODE_DIR}/ge/hybrid/hybrid_davinci_model.cc" ) -set(GE_OPT_INFO_SRC_FILES - "${GE_CODE_DIR}/ge/ge_opt_info/ge_opt_info.cc" -) - # test files set(COMMON_TEST_FILES "graph/passes/graph_builder_utils.cc" @@ -817,7 +732,7 @@ set(MULTI_PARTS_TEST_FILES "graph/manager/hcom_util_unittest.cc" "graph/manager/graph_caching_allocator_unittest.cc" "graph/manager/host_mem_allocator_unittest.cc" - "graph/manager/memory_api_unittest.cc" + "graph/manager/memory_api_unittest.cc" "graph/manager/session_scope_mem_allocator_unittest.cc" "graph/manager/run_graph_unittest.cc" "graph/partition/dynamic_shape_partition_unittest.cc" @@ -973,57 +888,19 @@ target_link_libraries(ge_prepare_common PRIVATE json ) -# build graph optimize common -add_library(ge_optimize_common STATIC ${GRAPH_OPTIMIZE_COMMON_SRC_FILES} ${PROTO_HDRS}) - -target_compile_definitions(ge_optimize_common PRIVATE - google=ascend_private -) - -target_compile_options(ge_optimize_common PRIVATE - -g --coverage -fprofile-arcs -ftest-coverage - -Werror=format -) - -target_link_libraries(ge_optimize_common PRIVATE - $ - ascend_protobuf - c_sec - json -) - -# build graph partition common -add_library(ge_partition_common STATIC ${GRAPH_PARTITION_COMMON_SRC_FILES} ${PROTO_HDRS}) - -target_compile_definitions(ge_partition_common PRIVATE - google=ascend_private -) - -target_compile_options(ge_partition_common PRIVATE - -g --coverage -fprofile-arcs -ftest-coverage - -Werror=format -) - -target_link_libraries(ge_partition_common PRIVATE - $ - ascend_protobuf - c_sec - json -) - # build build graph load common -add_library(ge_load_common STATIC ${GRAPH_LOAD_COMMON_SRC_FILES} ${PROTO_HDRS}) +add_library(ge_davinci_model STATIC ${GRAPH_DAVINCI_MODEL_SRC_FILES} ${PROTO_HDRS}) -target_compile_definitions(ge_load_common PRIVATE +target_compile_definitions(ge_davinci_model PRIVATE google=ascend_private ) -target_compile_options(ge_load_common PRIVATE +target_compile_options(ge_davinci_model PRIVATE -g --coverage -fprofile-arcs -ftest-coverage -Werror=format ) -target_link_libraries(ge_load_common PRIVATE +target_link_libraries(ge_davinci_model PRIVATE $ c_sec ascend_protobuf @@ -1126,14 +1003,14 @@ target_compile_definitions(ut_libge_multiparts_utest PRIVATE target_link_libraries(ut_libge_multiparts_utest $ - ge_build_common ge_load_common ge_execute_common ge_optimize_common ge_partition_common ge_prepare_common - ge_single_op ge_ut_common_format ge_ut_common + -Wl,--whole-archive + ge_davinci_model ge_build_common ge_prepare_common ge_execute_common ge_pass_common ge_ut_common_format ge_ut_common + -Wl,--no-whole-archive gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov ) # libge_others_utest add_executable(ut_libge_others_utest - ${GE_OPT_INFO_SRC_FILES} ${COMMON_TEST_FILES} ${PASS_TEST_FILES} ${EXECUTE_TEST_FILES} @@ -1148,7 +1025,9 @@ target_compile_options(ut_libge_others_utest PRIVATE target_link_libraries(ut_libge_others_utest $ - ge_load_common ge_execute_common ge_ut_common ge_ut_common_format + -Wl,--whole-archive + ge_davinci_model ge_build_common ge_prepare_common ge_pass_common ge_execute_common ge_ut_common ge_ut_common_format + -Wl,--no-whole-archive gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov ) @@ -1166,7 +1045,9 @@ target_compile_options(ut_libge_kernel_utest PRIVATE target_link_libraries(ut_libge_kernel_utest $ - ge_load_common ge_ut_common ge_ut_common_format + -Wl,--whole-archive + ge_davinci_model ge_build_common ge_prepare_common ge_pass_common ge_execute_common ge_ut_common ge_ut_common_format + -Wl,--no-whole-archive gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lgcov ) @@ -1176,7 +1057,6 @@ add_executable(ut_libge_distinct_load_utest ${GENERATOR_TEST_FILES} ${EXECUTOR_TEST_FILES} ${DISTINCT_GRAPH_LOAD_TEST_FILES} - ${DISTINCT_GRAPH_LOAD_SRC_FILES} ${SINGLE_OP_TEST_FILES} ${PROFILING_MNG_TEST_FILES} ${HYBRID_TEST_FILES} @@ -1195,9 +1075,7 @@ target_compile_definitions(ut_libge_distinct_load_utest PRIVATE target_link_libraries(ut_libge_distinct_load_utest $ -Wl,--whole-archive - ge_single_op + ge_single_op ge_davinci_model ge_build_common ge_prepare_common ge_pass_common ge_ut_common ge_ut_common_format -Wl,--no-whole-archive - ge_execute_common ge_load_common - ge_prepare_common ge_optimize_common ge_build_common ge_partition_common ge_ut_common ge_ut_common_format gtest gtest_main gmock gmock_main ${COMMON_SHARED_LIBRARIES} -lrt -ldl -lpthread -lgcov ) From 3b261ee4a453b6c62fe33fef5708985bed8594a6 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Mon, 5 Jul 2021 09:59:23 +0800 Subject: [PATCH 164/226] fix dump step check --- ge/common/dump/dump_properties.cc | 14 ++++---------- tests/ut/ge/common/dump_properties_unittest.cc | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 84bdb7bf..099920e7 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -204,7 +204,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { if (enable_dump_ == kEnableFlag) { std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS && !dump_step.empty()) { GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); GELOGI("Get dump step %s successfully", dump_step.c_str()); SetDumpStep(dump_step); @@ -441,16 +441,10 @@ Status DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { - GELOGD("Get dump debug mode %s successfully", dump_debug_mode.c_str()); + GELOGD("Get ge.exec.dumpDebugMode %s successfully", dump_debug_mode.c_str()); } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpDebugMode", - dump_debug_mode, - "ge.exec.dumpDebugMode is not set."})); - GELOGE(PARAM_INVALID, "[Check][dump_debug_mode] failed. Dump debug mode is not set."); - - return PARAM_INVALID; + GELOGW("ge.exec.dumpDebugMode is not set."); + return SUCCESS; } if (dump_debug_mode == OP_DEBUG_AICORE) { diff --git a/tests/ut/ge/common/dump_properties_unittest.cc b/tests/ut/ge/common/dump_properties_unittest.cc index 57809013..3623bc6d 100644 --- a/tests/ut/ge/common/dump_properties_unittest.cc +++ b/tests/ut/ge/common/dump_properties_unittest.cc @@ -115,12 +115,12 @@ TEST_F(UTEST_dump_properties, init_by_options_success_2) { EXPECT_EQ(st, SUCCESS); } -TEST_F(UTEST_dump_properties, init_by_options_failed) { +TEST_F(UTEST_dump_properties, init_by_options_success_3) { DumpProperties dp; std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, {OPTION_EXEC_DUMP_PATH, "/tmp/"}}; GetThreadLocalContext().SetGlobalOption(options); Status st = dp.InitByOptions(); - EXPECT_NE(st, SUCCESS); + EXPECT_EQ(st, SUCCESS); } } // namespace ge \ No newline at end of file From 6da309710797d305774156125857e0de0dcfd57c Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 6 Jul 2021 21:21:02 +0800 Subject: [PATCH 165/226] Fix review comments. --- ge/single_op/single_op_model.cc | 36 +++++++++++++++--------- ge/single_op/single_op_model.h | 2 +- ge/single_op/task/op_task.cc | 32 ++++++++++++--------- ge/single_op/task/op_task.h | 14 +++++---- ge/single_op/task/tbe_task_builder.cc | 10 +++---- ge/single_op/task/tbe_task_builder.h | 6 ++-- tests/ut/ge/single_op/single_op_task_unittest.cc | 5 +++- 7 files changed, 62 insertions(+), 43 deletions(-) diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index a5547b39..426d3233 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -432,7 +432,7 @@ Status SingleOpModel::BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask * return SUCCESS; } -Status SingleOpModel::BuildAtomicTask(const domi::TaskDef &task_def, AtomicOpTask **task) { +Status SingleOpModel::BuildAtomicTask(const domi::TaskDef &task_def, AtomicAddrCleanOpTask **task) { GE_CHECK_NOTNULL(task); const auto &context = task_def.kernel().context(); auto iter = op_list_.find(context.op_index()); @@ -442,18 +442,18 @@ Status SingleOpModel::BuildAtomicTask(const domi::TaskDef &task_def, AtomicOpTas return ACL_ERROR_GE_INTERNAL_ERROR; } - std::unique_ptr atomic_task(new (std::nothrow) AtomicOpTask()); + std::unique_ptr atomic_task(new (std::nothrow) AtomicAddrCleanOpTask()); if (atomic_task == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Create][AtomicOpTask]failed."); - REPORT_INNER_ERROR("E19999", "BuildKernelTask fail for new AtomicOpTask."); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Create][AtomicAddrCleanOpTask]failed."); + REPORT_INNER_ERROR("E19999", "BuildKernelTask fail for new AtomicAddrCleanOpTask."); return ACL_ERROR_GE_MEMORY_ALLOCATION; } - auto builder = AtomicTaskBuilder(model_name_, iter->second, task_def); + auto builder = AtomicAddrCleanTaskBuilder(model_name_, iter->second, task_def); auto ret = builder.BuildTask(*atomic_task, model_params_); if (ret != SUCCESS) { - GELOGE(ret, "[Build][AtomicOpTask]failed."); - REPORT_INNER_ERROR("E19999", "[Build][AtomicOpTask]failed."); + GELOGE(ret, "[Build][AtomicAddrCleanOpTask]failed."); + REPORT_INNER_ERROR("E19999", "[Build][AtomicAddrCleanOpTask]failed."); return ret; } @@ -571,13 +571,21 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, GE_CHECK_NOTNULL(compute_graph); single_op.compute_graph_ = compute_graph; - GE_CHK_BOOL_RET_STATUS(node_tasks_.size() == 1, ACL_ERROR_GE_PARAM_INVALID, - "[Check][Size]Node size must be 1, but get %zu.", node_tasks_.size()); + if (node_tasks_.size() != 1) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size]Node size must be 1, but get %zu.", node_tasks_.size()); + REPORT_INNER_ERROR("E19999", "[Check][Size]Node size must be 1, but get %zu.", node_tasks_.size()); + return ACL_ERROR_GE_PARAM_INVALID; + } + auto iter = node_tasks_.begin(); auto node = iter->first; - auto task_defs = iter->second; - GE_CHK_BOOL_RET_STATUS(task_defs.size() > 0 && task_defs.size() <= kNumTaskWithAtomicAddrCleanTask, - ACL_ERROR_GE_PARAM_INVALID, "[Check][Size]task_defs size must be 1 or 2, but get %zu.", task_defs.size()); + const auto &task_defs = iter->second; + if (task_defs.size() <= 0 || task_defs.size() > kNumTaskWithAtomicAddrCleanTask) { + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Size]Node size must be 1, but get %zu.", node_tasks_.size()); + REPORT_INNER_ERROR("E19999", "[Check][Size]task_defs size must be 1 or 2, but get %zu.", task_defs.size()); + return ACL_ERROR_GE_PARAM_INVALID; + } + GE_CHECK_NOTNULL(node); auto op_desc = node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); @@ -594,10 +602,10 @@ Status SingleOpModel::BuildTaskListForDynamicOp(StreamResource *stream_resource, } if (task_defs.size() == kNumTaskWithAtomicAddrCleanTask) { const auto &atomic_task_def = task_defs.front(); - AtomicOpTask *atomic_task = nullptr; + AtomicAddrCleanOpTask *atomic_task = nullptr; GE_CHK_STATUS_RET_NOLOG(BuildAtomicTask(atomic_task_def, &atomic_task)); GE_CHK_STATUS_RET_NOLOG(atomic_task->InitAtomicAddrCleanIndices()); - tbe_task->SetAtomicTask(atomic_task); + tbe_task->SetAtomicAddrCleanTask(atomic_task); } single_op.op_task_.reset(tbe_task); } else if (lib_name == kEngineNameAiCpu) { diff --git a/ge/single_op/single_op_model.h b/ge/single_op/single_op_model.h index 83490f5f..b1cd161c 100755 --- a/ge/single_op/single_op_model.h +++ b/ge/single_op/single_op_model.h @@ -69,7 +69,7 @@ class SingleOpModel { Status BuildTaskList(StreamResource *stream_resource, SingleOp &single_op); Status BuildTaskListForDynamicOp(StreamResource *stream_resource, DynamicSingleOp &dynamic_single_op); Status BuildKernelTask(const domi::TaskDef &task_def, TbeOpTask **task); - Status BuildAtomicTask(const domi::TaskDef &task_def, AtomicOpTask **task); + Status BuildAtomicTask(const domi::TaskDef &task_def, AtomicAddrCleanOpTask **task); Status BuildKernelExTask(const domi::KernelExDef &kernel_def, AiCpuTask **task, uint64_t kernel_id); Status BuildCpuKernelTask(const domi::KernelDef &kernel_def, OpTask **task, uint64_t kernel_id); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index dfdec750..c6c99ab0 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -268,15 +268,6 @@ Status TbeOpTask::UpdateTensorDesc(const GeTensorDesc &src_tensor, GeTensorDesc dst_tensor.SetShape(GeShape(std::move(storage_shape))); dst_tensor.SetOriginShape(src_tensor.GetShape()); } - - int64_t size = 0; - graphStatus graph_status = TensorUtils::GetTensorMemorySizeInBytes(dst_tensor, size); - if (graph_status != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Get tensor size in bytes failed!"); - GELOGE(graph_status, "[Get][TensorMemorySize] In Bytes failed!"); - return FAILED; - } - TensorUtils::SetSize(dst_tensor, size); return SUCCESS; } @@ -490,7 +481,12 @@ void TbeOpTask::GetIoAddr(uintptr_t *&arg_base, size_t &arg_count) { } } -Status AtomicOpTask::UpdateIoAddr(const vector &inputs, const vector &outputs) { +Status AtomicAddrCleanOpTask::UpdateNodeByShape(const vector &input_desc, + const vector &output_desc) { + return SUCCESS; +} + +Status AtomicAddrCleanOpTask::UpdateIoAddr(const vector &inputs, const vector &outputs) { uintptr_t *arg_base = reinterpret_cast(args_.get()); for (auto atomic_output_index : atomic_output_indices_) { if (atomic_output_index >= static_cast(outputs.size())) { @@ -500,11 +496,21 @@ Status AtomicOpTask::UpdateIoAddr(const vector &inputs, const vector } auto &output_buffer = outputs[atomic_output_index]; *arg_base++ = reinterpret_cast(output_buffer.data); + + auto tensor_desc = op_desc_->MutableOutputDesc(atomic_output_index); + int64_t size = 0; + graphStatus graph_status = TensorUtils::GetTensorMemorySizeInBytes(*tensor_desc, size); + if (graph_status != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get tensor size in bytes failed!"); + GELOGE(graph_status, "[Get][TensorMemorySize] In Bytes failed!"); + return FAILED; + } + TensorUtils::SetSize(*tensor_desc, size); } return SUCCESS; } -Status AtomicOpTask::UpdateTilingArgs(rtStream_t stream) { +Status AtomicAddrCleanOpTask::UpdateTilingArgs(rtStream_t stream) { if (tiling_buffer_ != nullptr) { GELOGD("[%s] Start to copy tiling info. size = %zu", node_->GetName().c_str(), tiling_data_.size()); GE_CHK_RT_RET(rtMemcpyAsync(tiling_buffer_, max_tiling_size_, tiling_data_.data(), tiling_data_.size(), @@ -516,7 +522,7 @@ Status AtomicOpTask::UpdateTilingArgs(rtStream_t stream) { return SUCCESS; } -Status AtomicOpTask::CalcTilingInfo(optiling::utils::OpRunInfo &run_info) { +Status AtomicAddrCleanOpTask::CalcTilingInfo(optiling::utils::OpRunInfo &run_info) { auto ret = optiling::OpAtomicCalculateV2(*node_, run_info); if (ret != GRAPH_SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Invoke][OpAtomicCalculate] failed, ret = %u.", ret); @@ -526,7 +532,7 @@ Status AtomicOpTask::CalcTilingInfo(optiling::utils::OpRunInfo &run_info) { return SUCCESS; } -Status AtomicOpTask::InitAtomicAddrCleanIndices() { +Status AtomicAddrCleanOpTask::InitAtomicAddrCleanIndices() { GELOGD("[%s] Start to setup AtomicAddrClean task.", op_desc_->GetName().c_str()); std::vector atomic_output_indices; (void) ge::AttrUtils::GetListInt(op_desc_, ATOMIC_ATTR_OUTPUT_INDEX, atomic_output_indices); diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 1e100a11..0ce4cbae 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -89,7 +89,7 @@ class TbeOpTask : public OpTask { void SetKernelArgs(std::unique_ptr &&args, size_t arg_size, uint32_t block_dim, const OpDescPtr &op_desc); void SetKernelWithHandleArgs(std::unique_ptr &&args, size_t arg_size, uint32_t block_dim, const OpDescPtr &op_desc, const domi::KernelDefWithHandle& kernel_def_with_handle); - void SetAtomicTask(OpTask *task) { atomic_task_.reset(task); } + void SetAtomicAddrCleanTask(OpTask *task) { atomic_task_.reset(task); } Status UpdateRunInfo() override; Status SetArgIndex(); @@ -108,13 +108,13 @@ class TbeOpTask : public OpTask { void *tiling_buffer_ = nullptr; uint32_t max_tiling_size_ = 0; std::string tiling_data_; + size_t input_num_; // include const input + size_t output_num_; private: friend class SingleOpModel; friend class TbeTaskBuilder; static Status UpdateTensorDesc(const GeTensorDesc &src_tensor, GeTensorDesc &dst_tensor); - Status UpdateNodeByShape(const vector &input_desc, - const vector &output_desc); Status AllocateWorkspaces(const std::vector &workspace_sizes); Status DoLaunchKernel(rtStream_t stream); Status CheckAndExecuteAtomic(const vector &input_desc, @@ -122,6 +122,8 @@ class TbeOpTask : public OpTask { vector &output_desc, vector &output_buffers, rtStream_t stream); + virtual Status UpdateNodeByShape(const vector &input_desc, + const vector &output_desc); virtual Status UpdateTilingArgs(rtStream_t stream); virtual Status UpdateIoAddr(const vector &inputs, const vector &outputs); virtual Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info); @@ -140,17 +142,17 @@ class TbeOpTask : public OpTask { std::string original_kernel_key_; std::string node_info_; std::vector arg_index_; // data index in args - size_t input_num_; // include const input - size_t output_num_; std::unique_ptr atomic_task_; }; -class AtomicOpTask : public TbeOpTask { +class AtomicAddrCleanOpTask : public TbeOpTask { public: Status InitAtomicAddrCleanIndices(); private: + Status UpdateNodeByShape(const vector &input_desc, + const vector &output_desc) override; Status UpdateIoAddr(const vector &inputs, const vector &outputs) override; Status UpdateTilingArgs(rtStream_t stream) override; Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info) override; diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index c5579a01..017dac25 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -459,23 +459,23 @@ std::string TbeTaskBuilder::GetKeyForTvmMetaData() const { return TVM_ATTR_NAME_METADATA; } -Status AtomicTaskBuilder::InitKernelArgs(void *args_addr, size_t arg_size, const SingleOpModelParam ¶m) { +Status AtomicAddrCleanTaskBuilder::InitKernelArgs(void *args_addr, size_t arg_size, const SingleOpModelParam ¶m) { return SUCCESS; } -std::string AtomicTaskBuilder::GetKeyForOpParamSize() const { +std::string AtomicAddrCleanTaskBuilder::GetKeyForOpParamSize() const { return kAttrAtomicOpParamSize; } -std::string AtomicTaskBuilder::GetKeyForTvmMetaData() const { +std::string AtomicAddrCleanTaskBuilder::GetKeyForTvmMetaData() const { return ATOMIC_ATTR_TVM_METADATA; } -void AtomicTaskBuilder::GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const { +void AtomicAddrCleanTaskBuilder::GetKernelName(const OpDescPtr &op_desc, std::string &kernel_name) const { (void)AttrUtils::GetStr(op_desc, op_desc->GetName() + "_atomic_kernelname", kernel_name); } -TBEKernelPtr AtomicTaskBuilder::GetTbeKernel(const OpDescPtr &op_desc) const { +TBEKernelPtr AtomicAddrCleanTaskBuilder::GetTbeKernel(const OpDescPtr &op_desc) const { return op_desc->TryGetExtAttr(EXT_ATTR_ATOMIC_TBE_KERNEL, TBEKernelPtr()); } diff --git a/ge/single_op/task/tbe_task_builder.h b/ge/single_op/task/tbe_task_builder.h index 833ab0e0..06d17901 100755 --- a/ge/single_op/task/tbe_task_builder.h +++ b/ge/single_op/task/tbe_task_builder.h @@ -126,11 +126,11 @@ class TbeTaskBuilder { void *handle_ = nullptr; }; -class AtomicTaskBuilder : public TbeTaskBuilder { +class AtomicAddrCleanTaskBuilder : public TbeTaskBuilder { public: - AtomicTaskBuilder(const std::string &model_name, const NodePtr &node, const domi::TaskDef &task_def) + AtomicAddrCleanTaskBuilder(const std::string &model_name, const NodePtr &node, const domi::TaskDef &task_def) : TbeTaskBuilder(model_name, node, task_def) {} - ~AtomicTaskBuilder() override = default; + ~AtomicAddrCleanTaskBuilder() override = default; protected: std::string GetKeyForOpParamSize() const override; diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index f6ae0dbf..3e3160c2 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -157,8 +157,11 @@ TEST_F(UtestSingleOpTask, test_update_ioaddr) { TEST_F(UtestSingleOpTask, test_atomic_exec) { auto graph = make_shared("graph"); auto op_desc = make_shared("Add", "Add"); + GeTensorDesc desc; + op_desc->AddInputDesc(desc); + op_desc->AddOutputDesc(desc); auto node = graph->AddNode(op_desc); - AtomicOpTask task; + AtomicAddrCleanOpTask task; task.op_desc_ = op_desc; task.node_ = node; From 6b962fdee48d35df50d286f02c3b1e9e366b96a3 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 7 Jul 2021 10:16:10 +0800 Subject: [PATCH 166/226] delete cce stub & AUX_SOURCE_DIRECTORY for graph --- CMakeLists.txt | 12 +- tests/CMakeLists.txt | 2 +- tests/depends/cce/CMakeLists.txt | 98 ----- tests/depends/cce/src/cce_stub.cc | 576 ---------------------------- tests/depends/cce/src/op_kernel_registry.cc | 29 -- tests/ut/common/graph/CMakeLists.txt | 65 +--- tests/ut/ge/CMakeLists.txt | 86 ++--- 7 files changed, 51 insertions(+), 817 deletions(-) delete mode 100644 tests/depends/cce/CMakeLists.txt delete mode 100644 tests/depends/cce/src/cce_stub.cc delete mode 100644 tests/depends/cce/src/op_kernel_registry.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 41520b14..ac0240d9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ else () elseif(PLATFORM STREQUAL "inference") find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR}) find_module(runtime libruntime.so ${ASCEND_ACL_DIR}) - find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) + find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) find_module(msprofiler_ext libmsprofiler.a ${ASCEND_ACL_DIR}) if(PRODUCT STREQUAL "flr3") elseif(PRODUCT STREQUAL "flr1") @@ -119,12 +119,12 @@ else () find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) endif() elseif(PLATFORM STREQUAL "all") - find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) - find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR}) + find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) + find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR}) find_module(msprofiler_fwk_ext libmsprofiler_fwk.a ${ASCEND_RUNTIME_DIR}) - find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) - find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) - find_module(msprofiler_ext libmsprofiler.a ${ASCEND_ACL_DIR}) + find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) + find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) + find_module(msprofiler_ext libmsprofiler.a ${ASCEND_ACL_DIR}) else() message(STATUS "PLATFORM param is invalid, should be train or inference, you choose nothing!") endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3dd94051..f5dab366 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,7 +15,7 @@ project(tests CXX C) find_package(Threads) -add_subdirectory(depends/cce) + add_subdirectory(depends/slog) add_subdirectory(depends/mmpa) add_subdirectory(depends/runtime) diff --git a/tests/depends/cce/CMakeLists.txt b/tests/depends/cce/CMakeLists.txt deleted file mode 100644 index 05fa8133..00000000 --- a/tests/depends/cce/CMakeLists.txt +++ /dev/null @@ -1,98 +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. -# ============================================================================ - -#cmake_minimum_required(VERSION 2.8) - -project(STUB_CCE) - -set(CMAKE_CXX_STANDARD 11) - -include_directories(${GE_CODE_DIR}/inc) -include_directories(${GE_CODE_DIR}/inc/framework) -include_directories(${GE_CODE_DIR}/metadef/inc/graph) -include_directories(${GE_CODE_DIR}/inc/external) -include_directories(${GE_CODE_DIR}/metadef/inc/external) -include_directories(${GE_CODE_DIR}/metadef/inc/external/graph) -include_directories(${GE_CODE_DIR}/metadef) -include_directories(${GE_CODE_DIR}/metadef/inc) -include_directories(${GE_CODE_DIR}/metadef/graph) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/cce) -include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) -include_directories(${CMAKE_BINARY_DIR}) -include_directories(${CMAKE_BINARY_DIR}/proto/ge) -set(PROTO_LIST - "${GE_CODE_DIR}/metadef/proto/om.proto" - "${GE_CODE_DIR}/metadef/proto/ge_ir.proto" - "${GE_CODE_DIR}/metadef/proto/task.proto" -) - -protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) - -set(SRCS - "${GE_CODE_DIR}/metadef/graph/ge_attr_define.cc" - "${GE_CODE_DIR}/metadef/graph/anchor.cc" - "${GE_CODE_DIR}/metadef/graph/ge_attr_value.cc" - "${GE_CODE_DIR}/metadef/graph/buffer.cc" - "${GE_CODE_DIR}/metadef/graph/aligned_ptr.cc" - "${GE_CODE_DIR}/metadef/graph/compute_graph.cc" - "${GE_CODE_DIR}/metadef/graph/graph.cc" - "${GE_CODE_DIR}/metadef/graph/model.cc" - "${GE_CODE_DIR}/metadef/graph/model_serialize.cc" - "${GE_CODE_DIR}/metadef/graph/node.cc" - "${GE_CODE_DIR}/metadef/graph/op_desc.cc" - "${GE_CODE_DIR}/metadef/graph/operator.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc" - "${GE_CODE_DIR}/metadef/graph/tensor.cc" - "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" - "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" - "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" - "${GE_CODE_DIR}/metadef/ops/op_imp.cpp" - "${GE_CODE_DIR}/metadef/graph/shape_refiner.cc" - "${GE_CODE_DIR}/metadef/graph/ge_tensor.cc" - "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" -) -add_library(cce_ge_stub SHARED src/cce_stub.cc ${PROTO_SRCS} ${PROTO_HDRS}) - -target_compile_definitions(cce_ge_stub PRIVATE - google=ascend_private -) - -target_link_libraries(cce_ge_stub - $ - -Wl,--no-as-needed - ascend_protobuf - -Wl,--as-needed - c_sec -) - -add_library(cce_stub SHARED ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS}) - -target_compile_definitions(cce_stub PRIVATE - google=ascend_private -) - -target_link_libraries(cce_stub PRIVATE - $ - -Wl,--no-as-needed - ascend_protobuf - -Wl,--as-needed - c_sec -) diff --git a/tests/depends/cce/src/cce_stub.cc b/tests/depends/cce/src/cce_stub.cc deleted file mode 100644 index 03df3d0c..00000000 --- a/tests/depends/cce/src/cce_stub.cc +++ /dev/null @@ -1,576 +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 -#include -#include -#include -#include - -#include "cce/optimizer/fusion_engine.h" -#include "common/op/attr_value_util.h" -#include "graph/utils/tensor_utils.h" -#include "graph/utils/graph_utils.h" - -using namespace cce; -using namespace std; -using namespace ge; -using namespace fusion; - -uint64_t global_mem_base = 0; - -namespace cce { -#define DIM_MAX_SIZE 8 -static const uint32_t C0 = 16; -struct tagCcPad {}; -struct tagCcConvolution {}; - -struct tagCcLRN {}; - -struct tagCcFasterRcnnProposal {}; -struct tagCcRoiAlign {}; -struct tagCcBatchNorm {}; -struct tagCcDetectpostprocess {}; - -struct tagCcSsdDetectionOutput {}; - -struct tagCcRefinedetDetectionOutput {}; - -struct tagCcMsrGenerateRpnProposals {}; - -struct tagCcFilter { - vector dims; -}; - -struct tagCcTensor { - ccTensorFormat_t format; - ccDataType_t data_type; - uint32_t dim_cnt; - int32_t real_dim_cnt; - uint32_t data_size; - int32_t dim_buf[DIM_MAX_SIZE]; - int32_t stride_buf[DIM_MAX_SIZE]; -}; - -typedef struct tagCcPooling { - ccPoolingMode_t mode; - ccPaddingMode_t pad_mode; - ccNanPropagation_t max_pooling_nan_opt; - uint32_t dim_cnt; - int32_t window_dim[6]; - int32_t padding[6]; - int32_t stride[6]; -} ccPooling_t; - -struct tagCcActivation {}; - -struct tagCcFasterRcnnDetectionOutput {}; -struct tagCcSpatialTransformer {}; - -struct tagCcPower {}; -struct tagCcResizeBilinear {}; -struct tagCcSsdNormalize {}; -struct tagCcSsdPostProcessor {}; -struct tagCcSsdPriorBox {}; -struct tagCcPsRoiPooling {}; - -struct tagMsrFastRcnnPredictions {}; -struct tagCcPRelu {}; -struct tagCcStridedSlice {}; - -struct tagCcStridedSliceAttrs {}; - -struct tagCcRnn {}; - -struct tagCcArgmaxmin {}; - -typedef struct tagCcLog { - ccDataType_t data_type; - uint32_t param_cnt; -} ccLog_t; -typedef struct tagCcLog *ccLogDescriptor_t; - -struct tagCcPadV2 {}; - -ccStatus_t ccGetPadV2OutputDim(const ccTensorDescriptor_t x_desc, const ccPadV2Descriptor_t pad_desc, int32_t *dim_cnt, - int32_t dim[], int32_t dim_len) { - *dim_cnt = 4; - dim[0] = 1; - dim[1] = 2; - dim[2] = 2; - dim[3] = 3; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccPadV2Forward(ccHandle_t handle, const ccPadV2Descriptor_t pad_desc, const void *alpha, - const ccTensorDescriptor_t x_desc, const void *x, const void *beta, - const ccTensorDescriptor_t output_desc, void *output) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccCreatePadV2Descriptor(ccPadV2Descriptor_t *pad_desc) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccDestroyPadV2Descriptor(ccPadV2Descriptor_t *pad_desc) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccSetKernelOpMap(ccHandle_t handle) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccDataDumpForward(ccHandle_t handle, const void *buffer, const uint64_t buf_len, const uint32_t task_index) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetPadV2Descriptor(ccPadV2Descriptor_t pad_desc, const int32_t pad_shape_cnt, - const int32_t pad_shape_low[], const int32_t pad_shape_high[], - const ccPadMode_t pad_mode, const void *pad_value, const ccDataType_t pad_value_type) { - return CC_STATUS_SUCCESS; -} - -struct tagCcYoloDetectionOutput { - ccYoloVersion_t yolo_version; - uint32_t net_h; - uint32_t net_w; - uint32_t post_top_k; - uint32_t classes; - float nms_threshold; - float iou_thre_decay; - float coor_scale_factor; - bool relative; - float obj_threshold; - float cls_threshold; - uint32_t bias_num; - float *bias; -}; - -struct tagCcYoloRegion {}; - -struct tagCcEltwise {}; - -struct tagCcHashTableLookup {}; - -struct tagCcEmbeddingAttnDecoder {}; -struct tagNonMaxSuppression {}; - -struct tagCcArcSinCos {}; -struct tagCcPow {}; -struct tagCcConcatFive2Four_t {}; -struct tagCcConcatFour2Five_t {}; - -ccStatus_t ccCreatePowDescriptor(ccPowDescriptor_t *pow_desc) { - *pow_desc = new tagCcPow(); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetPowDescriptor(ccPowDescriptor_t pow_desc, ccDataType_t data_type, uint32_t param_cnt) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccDestroyPowDescriptor(ccPowDescriptor_t *pow_desc) { - if (nullptr == pow_desc) { - return CC_STATUS_BAD_PARAM; - } - - delete *pow_desc; - *pow_desc = 0; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccPowForward(ccHandle_t handle, const ccPowDescriptor_t pow_desc, const void *pow_param, const void *alpha, - const ccTensorDescriptor_t x_desc, const void *x, const ccTensorDescriptor_t y_desc, - const void *y, const void *beta, const ccTensorDescriptor_t z_desc, void *z) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccLogicalOrForward(ccHandle_t handle, const void *alpha, const ccTensorDescriptor_t x_desc, const void *x, - const ccTensorDescriptor_t y_desc, const void *y, const void *beta, - const ccTensorDescriptor_t output_desc, void *output) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccCompareForward(ccHandle_t handle, ccCompareType_t compare_type, const void *alpha, - const ccTensorDescriptor_t x_desc, const void *x, const ccTensorDescriptor_t y_desc, - const void *y, const void *beta, const ccTensorDescriptor_t output_desc, void *output) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccGetCompareOutputDim(const ccTensorDescriptor_t x_desc, const ccTensorDescriptor_t y_desc, int32_t *dim_cnt, - int32_t *dim, int32_t dim_len) { - *dim_cnt = 4; - dim[0] = 1; - dim[1] = 1; - dim[2] = 1; - dim[3] = 1; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccArcTanForward(ccHandle_t handle, const void *alpha, const ccTensorDescriptor_t x_desc, const void *x, - const void *beta, const ccTensorDescriptor_t y_desc, void *y) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccAtanhForward(ccHandle_t handle, const void *alpha, const ccTensorDescriptor_t x_desc, const void *x, - const void *beta, const ccTensorDescriptor_t y_desc, void *y) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccIsDepthwiseHighPerformance(int32_t input_n, int32_t input_c, int32_t input_h, int32_t input_w, - int32_t filter_n, int32_t filter_c, int32_t filter_h, int32_t filter_w, - int32_t dilation_h, int32_t dilation_w, int32_t pad_h_head, int32_t pad_h_tail, - int32_t pad_w_head, int32_t pad_w_tail, int32_t stride_h, int32_t stride_w, - int32_t group_num, bool &is_high_performance, bool is_quant, - ccDataType_t input_data_type, ccDataType_t output_data_type) { - is_high_performance = true; - return CC_STATUS_SUCCESS; -} - -struct tagCcSpaceToBatch {}; - -struct tagCcBatchToSpace {}; - -struct tagCcResizeNearestNeighbor {}; - -ccStatus_t ccGetStream(ccHandle_t handle, rtStream_t *stream_id) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccGetRtVersion(uint32_t *count) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccDestroyTensorDescriptor(ccTensorDescriptor_t *tensor_desc) { - if (nullptr == tensor_desc) { - return CC_STATUS_BAD_PARAM; - } - delete *tensor_desc; - *tensor_desc = 0; - return CC_STATUS_SUCCESS; -} -ccStatus_t ccDestroyFilterDescriptor(ccFilterDescriptor_t *filter_desc) { - delete *filter_desc; - *filter_desc = 0; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccGetFilterSizeInBytes(const ccFilterDescriptor_t filter_desc, uint32_t *size) { - *size = filter_desc->dims[0] * filter_desc->dims[1] * filter_desc->dims[2] * filter_desc->dims[3] * sizeof(float); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccTransFilter(const ccFilterDescriptor_t w_desc, const void *w, ccFilterDescriptor_t y_desc, void *y, - uint32_t y_size_in_bytes) { - y = const_cast(w); - - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccCreateTensorDescriptor(ccTensorDescriptor_t *tensor_desc) { - *tensor_desc = new tagCcTensor(); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetTensor4dDescriptor(ccTensorDescriptor_t tensor_desc, ccTensorFormat_t format, ccDataType_t data_type, - int32_t n, int32_t c, int32_t h, int32_t w) { - if (CC_TENSOR_NHWC == format) { - tensor_desc->dim_buf[0] = n; - tensor_desc->dim_buf[1] = h; - tensor_desc->dim_buf[2] = w; - tensor_desc->dim_buf[3] = c; - } else { - tensor_desc->dim_buf[0] = n; - tensor_desc->dim_buf[1] = c; - tensor_desc->dim_buf[2] = h; - tensor_desc->dim_buf[3] = w; - } - tensor_desc->dim_cnt = 4; - tensor_desc->data_type = data_type; - tensor_desc->format = format; - tensor_desc->data_size = n * c * h * w * sizeof(data_type); - return CC_STATUS_SUCCESS; -} -ccStatus_t ccGetTensorSizeInBytes(const ccTensorDescriptor_t tensor_desc, uint32_t *size) { - if ((NULL == tensor_desc) || (NULL == size)) { - return CC_STATUS_BAD_PARAM; - } - *size = tensor_desc->data_size; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccGetTensorMemorySizeInBytes(const ccTensorDescriptor_t tensor_desc, uint32_t *size) { - *size = tensor_desc->data_size; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccCreateFilterDescriptor(ccFilterDescriptor_t *filter_desc) { - *filter_desc = new tagCcFilter(); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetFilter4dDescriptor(ccFilterDescriptor_t filter_desc, ccTensorFormat_t format, ccDataType_t data_type, - int32_t k, int32_t c, int32_t h, int32_t w) { - filter_desc->dims.push_back(k); - filter_desc->dims.push_back(c); - filter_desc->dims.push_back(h); - filter_desc->dims.push_back(w); - - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetFilterFractalDescriptor(ccFilterDescriptor_t filter_desc, ccTensorFormat_t format, - ccDataType_t data_type, int32_t k, int32_t c, int32_t h, int32_t w) { - filter_desc->dims.push_back(k); - filter_desc->dims.push_back(c); - filter_desc->dims.push_back(h); - filter_desc->dims.push_back(w); - - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetStream(ccHandle_t handle, rtStream_t stream_id) { return CC_STATUS_SUCCESS; } -ccStatus_t ccCreatePoolingMaskDescriptor(ccTensorDescriptor_t *pooling_mask_desc) { - *pooling_mask_desc = new tagCcTensor(); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetPoolingMaskTensorDescriptor(ccTensorDescriptor_t tensor_desc, ccTensorFormat_t format, - ccDataType_t data_type, int32_t n, int32_t c, int32_t h, int32_t w, - int32_t window_h, int32_t window_w) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetFilter6dDescriptor(ccTensorDescriptor_t filter_desc, ccTensorFormat_t format, ccDataType_t data_type, - int32_t c1, int32_t h, int32_t w, int32_t n, int32_t co, int32_t c0) { - return CC_STATUS_SUCCESS; -} - -/// @ingroup dnn -/// @brief get the format and dimcnt of GeTensor -/// @param [in] tensor_desc descriptor of tensor -/// @param [in|out] format point to format -/// @return ccStatus_t -ccStatus_t ccGetTensorFormat(const ccTensorDescriptor_t tensor_desc, ccTensorFormat_t *format) { - *format = tensor_desc->format; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccTransTensor(const ccTensorDescriptor_t x_desc, const void *x, const ccTensorDescriptor_t y_desc, void *y, - uint32_t y_size_in_bytes) { - return CC_STATUS_SUCCESS; -} -void cceSysInit() {} - -bool compilerStubFree() { return true; } - -bool compilerStubInit() { return true; } - -ccStatus_t ccSetInt8Filter4dDescriptor(ccFilterDescriptor_t filter_desc, ccTensorFormat_t format, - ccDataType_t data_type, int32_t k, int32_t c, int32_t h, int32_t w, - ccDataType_t output_data_type) { - filter_desc->dims.push_back(k); - filter_desc->dims.push_back(c); - filter_desc->dims.push_back(h); - filter_desc->dims.push_back(w); - - return CC_STATUS_SUCCESS; -} -ccStatus_t ccSetTensorNdDescriptor(ccTensorDescriptor_t tensor_desc, ccDataType_t data_type, int32_t dim_cnt, - int32_t dimA[]) { - tensor_desc->data_type = data_type; - tensor_desc->data_size = sizeof(data_type); - for (int32_t i = 0; i < dim_cnt; i++) { - tensor_desc->data_size = tensor_desc->data_size * dimA[i]; - } - tensor_desc->format = CC_TENSOR_ND; - return CC_STATUS_SUCCESS; -} - -ccStatus_t CceProfilingConfig(const char *target, const char *job_ctx, uint32_t flag) { return CC_STATUS_SUCCESS; } -ccStatus_t ccSetTensorRealDimCnt(ccTensorDescriptor_t tensor_desc, int32_t real_dim_cnt) { - if (tensor_desc != NULL && tensor_desc != nullptr) { - tensor_desc->real_dim_cnt = real_dim_cnt; - } - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccGetTensorRealDimCnt(ccTensorDescriptor_t tensor_desc, int32_t *real_dim_cnt) { - *real_dim_cnt = tensor_desc->real_dim_cnt; - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetQuantizeFactors(ccQuantizeDescriptor_t quantize_info, ccScaleValueMode_t scale_val_mode, - const uint16_t *scale, const uint16_t *offset, const uint8_t *offset_pad) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetReQuantizeFactors(ccQuantizeDescriptor_t quantize_info, ccScaleValueMode_t scale_val_mode, - const uint16_t *scale_rq, const uint16_t *next_layer_offset, - const int32_t *offset_w) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetDeQuantizeFactors(ccQuantizeDescriptor_t quantize_info, ccScaleValueMode_t scale_val_mode, - const uint16_t *scale_dq, const int32_t *offset_w) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetQuantizeAlgoAndScaleType(ccQuantizeDescriptor_t quantize_info, ccQuantizeAlgo_t quant_algo, - ccScaleType_t scale_type, bool relu_flag) { - return CC_STATUS_SUCCESS; -} -ccStatus_t ccPrintTimeStat() { return CC_STATUS_SUCCESS; } -ccStatus_t ccSetModelId(ccHandle_t handle, uint32_t model_id) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccGetKernelContext(rtStream_t stream_id, ccOpContext &op_context) { - if (stream_id == nullptr) { - op_context.kernelType = ccKernelType::TE; - } else { - op_context.kernelType = ccKernelType::CCE_AI_CORE; - op_context.opId = 1; - op_context.kernelFuncId = 1; - op_context.isFlowtable = true; - op_context.opCount = 1; - op_context.opIndex2[0] = 0; - } - - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccUpdateKernelArgs(ccOpContext &op_context, uint64_t data_base_addr, uint64_t weight_base_addr, - uint64_t variable_base_addr, void *args_addr, uint64_t args_size, void *l2ctrl_addr) { - return CC_STATUS_SUCCESS; -} -ccStatus_t ccGetKernelArgsAddrs(ccOpContext &op_context, void *args_addr, uint64_t args_size, void *l2ctrl_addr, - std::vector &op_addrs_info) { - // cce - ccOpAddrsInfo tmp_op_addrs_info; - uint64_t tmp_input = (uint64_t)global_mem_base; - tmp_op_addrs_info.addrPos = &tmp_input; - tmp_op_addrs_info.addrData = tmp_input; - op_addrs_info.push_back(tmp_op_addrs_info); - - uint64_t tmp_output = (uint64_t)(global_mem_base + 5476352); - tmp_op_addrs_info.addrPos = &tmp_output; - tmp_op_addrs_info.addrData = tmp_output; - op_addrs_info.push_back(tmp_op_addrs_info); - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccSetKernelArgs(std::vector &date_info) { return CC_STATUS_SUCCESS; } -} // namespace cce -// ccFusion no namespace -ccStatus_t ccFusionStart(ccHandle_t handle, uint32_t graph_id, uint32_t init_flag, CceFusionMemCfg_t mem_cfg) { - return CC_STATUS_SUCCESS; -} - -//???ccFusion ????namespace cce?? -ccStatus_t ccFusionStart(ccHandle_t handle, uint32_t graph_id, uint32_t init_flag, uint32_t addr_change_flag) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t ccFusionEnd(ccHandle_t handle, uint32_t graph_id) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccFusionTaskEnd(ccHandle_t handle, uint32_t graph_id) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccKernelLaunchRepeat(ccHandle_t handle) { return CC_STATUS_SUCCESS; } - -ccStatus_t ccKernelDelete(ccHandle_t handle) { return CC_STATUS_SUCCESS; } - -ccStatus_t cce::ccSetTensorFormat(cce::tagCcTensor *, cce::tagCcTensorFormat) { return CC_STATUS_SUCCESS; } - -namespace fusion { -uint32_t BufferFusion(std::shared_ptr, std::shared_ptr, bool) { return 0; } - -uint32_t BufferFusionTrain(std::shared_ptr, std::shared_ptr) { return 0; } - -uint32_t GraphFusionTrain(ge::ComputeGraphPtr orig_graph, ge::ComputeGraphPtr fusion_graph) { return 0; } -} // namespace fusion -namespace fusion { -using namespace ge; - -uint32_t Fusion(ComputeGraphPtr model_graph, ComputeGraphPtr fusion_graph, kScopeNodeMap_t &te_fusion_map) { - OpDescPtr op_def_a = std::make_shared(); - op_def_a->SetName("reduction_nd"); - op_def_a->SetType("reduction_nd"); - - GeTensorDescPtr v_input_desc = std::make_shared(); - op_def_a->AddInputDesc(*v_input_desc); - - vector v_input; - v_input.push_back(0); - op_def_a->SetInputOffset(v_input); - - GeTensorDesc input_desc = op_def_a->GetInputDesc(0); - input_desc.SetFormat(FORMAT_NCHW); - input_desc.SetDataType(DT_FLOAT); - input_desc.SetShape(GeShape({1, 3, 5, 5})); - ge::TensorUtils::SetSize(input_desc, 192); - ge::TensorUtils::SetRealDimCnt(input_desc, 4); - - GeTensorDescPtr output_desc = std::make_shared(); - op_def_a->AddOutputDesc(*output_desc); - - output_desc->SetFormat(FORMAT_NCHW); - output_desc->SetDataType(DT_FLOAT); - output_desc->SetShape(GeShape({1, 3, 5})); - ge::TensorUtils::SetSize(*output_desc, 96); - ge::TensorUtils::SetRealDimCnt(*output_desc, 3); - - OpDescPtr op_def_b = std::make_shared(); - op_def_b->SetName("transdata_1"); - op_def_b->SetType("TransData"); - - int stream_num = 1; - int flag = 0; - - NodePtr node_a = fusion_graph->AddNode(op_def_a); - NodePtr node_b = fusion_graph->AddNode(op_def_b); - - GraphUtils::AddEdge(node_a->GetOutDataAnchor(0), node_b->GetInDataAnchor(0)); - int32_t a = 1; - int32_t b = 2; - - AttrUtils::SetInt(op_def_a, "fusion_scope", a); - AttrUtils::SetInt(op_def_b, "fusion_scope", b); - - vector node_list1; - node_list1.push_back(node_a); - vector node_list2; - node_list2.push_back(node_b); - te_fusion_map[1] = node_list1; - te_fusion_map[2] = node_list2; - - return FUSION_STATUS_SUCCESS; -} - -uint32_t FusionTaskBuild(cce::ccHandle_t cc_handle, ge::ComputeGraphPtr fusion_graph, ge::Buffer &buffer, - ModelRes &model_res, std::vector &task_def_list_) { - TaskDef task_def_temp; - task_def_list_.push_back(task_def_temp); - - return FUSION_STATUS_SUCCESS; -} -uint32_t GraphFusion(ge::ComputeGraphPtr orig_graph, ge::ComputeGraphPtr fusion_graph) { - *fusion_graph = *orig_graph; - return FUSION_STATUS_SUCCESS; -} - -void FusionTaskBuildComplete(std::vector cc_handle_list) { return; } - -} // namespace fusion - -ccStatus_t cce::ccSetTensorDescriptorQuantizeParam(ccTensorDescriptor_t tensor_desc, - const ccVecQuantizePara_t *vec_quantize_para) { - return CC_STATUS_SUCCESS; -} - -ccStatus_t cce::ccSetAllOffsetQuantizeFactors(ccQuantizeDescriptor_t quantize_info, const uint8_t *offset_w, - const uint8_t *offset_d, const uint16_t *scale_req, - const uint16_t *offset_d_next) { - return CC_STATUS_SUCCESS; -} diff --git a/tests/depends/cce/src/op_kernel_registry.cc b/tests/depends/cce/src/op_kernel_registry.cc deleted file mode 100644 index 5ccd1391..00000000 --- a/tests/depends/cce/src/op_kernel_registry.cc +++ /dev/null @@ -1,29 +0,0 @@ -#include "register/op_kernel_registry.h" - -namespace ge { -class OpKernelRegistry::OpKernelRegistryImpl { - -}; - -OpKernelRegistry::OpKernelRegistry() { -} - -OpKernelRegistry::~OpKernelRegistry() { - -} - -bool OpKernelRegistry::IsRegistered(const std::string &op_type) { - return false; -} - -std::unique_ptr OpKernelRegistry::CreateHostCpuOp(const std::string &op_type) { - return nullptr; -} - -void OpKernelRegistry::RegisterHostCpuOp(const std::string &op_type, CreateFn create_fn) { -} - -HostCpuOpRegistrar::HostCpuOpRegistrar(const char *op_type, HostCpuOp *(*create_fn)()) { - -} -} // namespace ge \ No newline at end of file diff --git a/tests/ut/common/graph/CMakeLists.txt b/tests/ut/common/graph/CMakeLists.txt index ccf9ce5e..a8092705 100644 --- a/tests/ut/common/graph/CMakeLists.txt +++ b/tests/ut/common/graph/CMakeLists.txt @@ -61,53 +61,26 @@ set(UT_FILES "testcase/ge_graph/ge_model_unittest.cc" ) -set(SRC_FILES - "${GE_CODE_DIR}/metadef/graph/option/ge_local_context.cc" - "${GE_CODE_DIR}/metadef/graph/option/ge_context.cc" - "${GE_CODE_DIR}/metadef/graph/anchor.cc" - "${GE_CODE_DIR}/metadef/graph/ge_attr_value.cc" - "${GE_CODE_DIR}/metadef/graph/attr_value.cc" - "${GE_CODE_DIR}/metadef/graph/buffer.cc" - "${GE_CODE_DIR}/metadef/graph/aligned_ptr.cc" - "${GE_CODE_DIR}/metadef/graph/compute_graph.cc" - "${GE_CODE_DIR}/metadef/graph/ge_attr_define.cc" - "${GE_CODE_DIR}/metadef/graph/graph.cc" - "${GE_CODE_DIR}/metadef/graph/gnode.cc" - "${GE_CODE_DIR}/metadef/graph/ascend_string.cc" - "${GE_CODE_DIR}/metadef/graph/model.cc" - "${GE_CODE_DIR}/metadef/graph/model_serialize.cc" - "${GE_CODE_DIR}/metadef/graph/node.cc" - "${GE_CODE_DIR}/metadef/graph/op_desc.cc" - "${GE_CODE_DIR}/metadef/graph/operator.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc" - "${GE_CODE_DIR}/metadef/graph/tensor.cc" - "${GE_CODE_DIR}/metadef/graph/types.cc" - "${GE_CODE_DIR}/metadef/graph/ge_tensor.cc" - "${GE_CODE_DIR}/metadef/graph/shape_refiner.cc" - "${GE_CODE_DIR}/metadef/graph/format_refiner.cc" - "${GE_CODE_DIR}/metadef/graph/inference_context.cc" - "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" - "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" - "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/ge_ir_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/tensor_utils.cc" - "${GE_CODE_DIR}/metadef/ops/op_imp.cpp" - "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" - "${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc" - "${GE_CODE_DIR}/metadef/graph/ref_relation.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/expand_dimension.cc" - "${GE_CODE_DIR}/metadef/graph/utils/transformer_utils.cc" -) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph GRAPH_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/detail GRAPH_DETAIL_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/opsproto GRAPH_OPSPROTO_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/option GRAPH_OPTION_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils GRAPH_UTILS_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils/dumper GRAPH_DUMPER_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) -#add_executable(ut_libgraph ${UT_FILES} ${SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) -add_executable(ut_libgraph ${UT_FILES} ${SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) +add_executable(ut_libgraph ${UT_FILES} + ${GRAPH_SRC_FILES} + ${GRAPH_UTILS_SRC_FILES} + ${GRAPH_OPSPROTO_SRC_FILES} + ${GRAPH_OPTION_SRC_FILES} + ${GRAPH_DETAIL_SRC_FILES} + ${GRAPH_DUMPER_SRC_FILES} + ${GRAPH_OPS_SRC_FILES} + ${TRANSFORMER_SRC_FILES} + ${PROTO_SRCS} ${PROTO_HDRS} +) target_compile_options(ut_libgraph PRIVATE -g --coverage -fprofile-arcs -ftest-coverage diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index a1abdfff..ed06bfe6 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -20,6 +20,7 @@ set(CMAKE_CXX_STANDARD 11) set(PROTO_LIST "${GE_CODE_DIR}/metadef/proto/om.proto" "${GE_CODE_DIR}/metadef/proto/ge_ir.proto" + "${GE_CODE_DIR}/metadef/proto/task.proto" "${GE_CODE_DIR}/metadef/proto/ge_api.proto" "${GE_CODE_DIR}/metadef/proto/insert_op.proto" "${GE_CODE_DIR}/metadef/proto/dump_task.proto" @@ -69,62 +70,19 @@ include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR}/proto/ge) include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) -set(GRAPH_SRC_FILES - "${GE_CODE_DIR}/metadef/graph/option/ge_local_context.cc" - "${GE_CODE_DIR}/metadef/graph/option/ge_context.cc" - "${GE_CODE_DIR}/metadef/graph/ge_attr_define.cc" - "${GE_CODE_DIR}/metadef/graph/anchor.cc" - "${GE_CODE_DIR}/metadef/graph/ge_attr_value.cc" - "${GE_CODE_DIR}/metadef/graph/attr_value.cc" - "${GE_CODE_DIR}/metadef/graph/buffer.cc" - "${GE_CODE_DIR}/metadef/graph/aligned_ptr.cc" - "${GE_CODE_DIR}/metadef/graph/compute_graph.cc" - "${GE_CODE_DIR}/metadef/graph/graph.cc" - "${GE_CODE_DIR}/metadef/graph/gnode.cc" - "${GE_CODE_DIR}/metadef/graph/ascend_string.cc" - "${GE_CODE_DIR}/metadef/graph/inference_context.cc" - "${GE_CODE_DIR}/metadef/graph/shape_refiner.cc" - "${GE_CODE_DIR}/metadef/graph/model.cc" - "${GE_CODE_DIR}/metadef/graph/model_serialize.cc" - "${GE_CODE_DIR}/metadef/graph/node.cc" - "${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc" - "${GE_CODE_DIR}/metadef/graph/op_desc.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cc" - "${GE_CODE_DIR}/metadef/third_party/transformer/src/expand_dimension.cc" - "${GE_CODE_DIR}/metadef/graph/operator.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory.cc" - "${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc" - "${GE_CODE_DIR}/metadef/graph/ge_tensor.cc" - "${GE_CODE_DIR}/metadef/graph/ref_relation.cc" - "${GE_CODE_DIR}/metadef/graph/tensor.cc" - "${GE_CODE_DIR}/metadef/graph/types.cc" - "${GE_CODE_DIR}/metadef/graph/detail/attributes_holder.cc" - "${GE_CODE_DIR}/metadef/graph/utils/anchor_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/graph_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/dumper/ge_graph_dumper.cc" - "${GE_CODE_DIR}/metadef/graph/utils/ge_ir_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/node_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/op_desc_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/tensor_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/type_utils.cc" - "${GE_CODE_DIR}/metadef/graph/utils/transformer_utils.cc" - "${GE_CODE_DIR}/metadef/graph/debug/graph_debug.cc" - "${GE_CODE_DIR}/metadef/graph/opsproto/opsproto_manager.cc" - "${GE_CODE_DIR}/metadef/ops/op_imp.cpp" - "${GE_CODE_DIR}/metadef/register/register.cpp" - "${GE_CODE_DIR}/metadef/register/register_pass.cpp" - "${GE_CODE_DIR}/metadef/register/op_kernel_registry.cpp" - "${GE_CODE_DIR}/metadef/register/auto_mapping_util.cpp" - "${GE_CODE_DIR}/metadef/register/tensor_assign.cpp" - "${GE_CODE_DIR}/metadef/register/register_format_transfer.cc" - "${GE_CODE_DIR}/metadef/graph/format_refiner.cc" - "${GE_CODE_DIR}/metadef/register/ops_kernel_builder_registry.cc" - "${GE_CODE_DIR}/metadef/register/op_tiling.cpp" - "${GE_CODE_DIR}/metadef/graph/utils/tuning_utils.cc" - "${GE_CODE_DIR}/metadef/register/op_tiling_registry.cpp" - "${GE_CODE_DIR}/metadef/register/op_tiling_registry_impl.cpp" -) + +#### GRAPH_SRC_FILES #### +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph GRAPH_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/debug GRAPH_DEBUG_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/detail GRAPH_DETAIL_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/opsproto GRAPH_OPSPROTO_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/option GRAPH_OPTION_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils GRAPH_UTILS_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils/dumper GRAPH_DUMPER_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/register GRAPH_REGISTER_SRC_FILES) +AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) + set(PARSER_SRC_FILES "${GE_CODE_DIR}/parser/parser/common/op_map.cc" @@ -259,7 +217,6 @@ set(GRAPH_PREPARE_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/preprocess/insert_op/util_insert_aipp_op.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/preprocess/insert_op/base_insert_op.cc" ) set(GRAPH_DAVINCI_MODEL_SRC_FILES @@ -360,7 +317,6 @@ set(GRAPH_PASS_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/passes/compile_nodes_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/flow_ctrl_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/parallel_group_pass.cc" - #"${GE_CODE_DIR}/ge/graph/optimize/optimizer/allreduce_fusion_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/folding_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/variable_op_pass.cc" "${GE_CODE_DIR}/ge/graph/passes/transpose_transdata_pass.cc" @@ -570,7 +526,6 @@ set(DISTINCT_GRAPH_LOAD_TEST_FILES #"graph/load/new_model_manager_data_inputer_unittest.cc" #"graph/load/new_model_manager_davinci_model_unittest.cc" "graph/load/model_manager_unittest.cc" - #"graph/load/new_model_manager_task_build_unittest.cc" "graph/load/new_model_manager_model_manager_aicpu_unittest.cc" "graph/load/end_graph_task_unittest.cc" "graph/load/new_model_manager_event_manager_unittest.cc" @@ -795,7 +750,6 @@ set(OTHERS_TEST_FILES list(APPEND COMMON_SHARED_LIBRARIES c_sec slog_stub - cce_ge_stub runtime_stub profiler_stub mmpa_stub @@ -808,7 +762,17 @@ list(APPEND COMMON_SHARED_LIBRARIES # build graph add_library(ge_ut_graph STATIC - ${GRAPH_SRC_FILES} ${PARSER_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS} + ${GRAPH_SRC_FILES} + ${GRAPH_DEBUG_SRC_FILES} + ${GRAPH_DETAIL_SRC_FILES} + ${GRAPH_OPSPROTO_SRC_FILES} + ${GRAPH_OPTION_SRC_FILES} + ${GRAPH_UTILS_SRC_FILES} + ${GRAPH_DUMPER_SRC_FILES} + ${GRAPH_OPS_SRC_FILES} + ${GRAPH_REGISTER_SRC_FILES} + ${TRANSFORMER_SRC_FILES} + ${PARSER_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS} ) target_compile_definitions(ge_ut_graph PRIVATE From db53f82c78dd8d90de48b7f576011f3b27db6138 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 7 Jul 2021 10:50:20 +0800 Subject: [PATCH 167/226] Use FILE GLOB_RECURSE for AUX_SOURCE_DIRECTORY --- tests/ut/common/graph/CMakeLists.txt | 19 +++++++------------ tests/ut/ge/CMakeLists.txt | 21 +++++++-------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/tests/ut/common/graph/CMakeLists.txt b/tests/ut/common/graph/CMakeLists.txt index a8092705..8da69c14 100644 --- a/tests/ut/common/graph/CMakeLists.txt +++ b/tests/ut/common/graph/CMakeLists.txt @@ -61,22 +61,17 @@ set(UT_FILES "testcase/ge_graph/ge_model_unittest.cc" ) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph GRAPH_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/detail GRAPH_DETAIL_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/opsproto GRAPH_OPSPROTO_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/option GRAPH_OPTION_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils GRAPH_UTILS_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils/dumper GRAPH_DUMPER_SRC_FILES) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH0 ${GE_CODE_DIR}/metadef/graph/*.cc) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH1 ${GE_CODE_DIR}/metadef/graph/*/*.cc) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH2 ${GE_CODE_DIR}/metadef/graph/*/*/*.cc) + AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) add_executable(ut_libgraph ${UT_FILES} - ${GRAPH_SRC_FILES} - ${GRAPH_UTILS_SRC_FILES} - ${GRAPH_OPSPROTO_SRC_FILES} - ${GRAPH_OPTION_SRC_FILES} - ${GRAPH_DETAIL_SRC_FILES} - ${GRAPH_DUMPER_SRC_FILES} + ${GRAPH_SRC_FILES_DEPTH0} + ${GRAPH_SRC_FILES_DEPTH1} + ${GRAPH_SRC_FILES_DEPTH2} ${GRAPH_OPS_SRC_FILES} ${TRANSFORMER_SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS} diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index ed06bfe6..42fa6128 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -72,13 +72,10 @@ include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) #### GRAPH_SRC_FILES #### -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph GRAPH_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/debug GRAPH_DEBUG_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/detail GRAPH_DETAIL_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/opsproto GRAPH_OPSPROTO_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/option GRAPH_OPTION_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils GRAPH_UTILS_SRC_FILES) -AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/graph/utils/dumper GRAPH_DUMPER_SRC_FILES) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH0 ${GE_CODE_DIR}/metadef/graph/*.cc) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH1 ${GE_CODE_DIR}/metadef/graph/*/*.cc) +FILE(GLOB_RECURSE GRAPH_SRC_FILES_DEPTH2 ${GE_CODE_DIR}/metadef/graph/*/*/*.cc) + AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/ops GRAPH_OPS_SRC_FILES) AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/register GRAPH_REGISTER_SRC_FILES) AUX_SOURCE_DIRECTORY(${GE_CODE_DIR}/metadef/third_party/transformer/src TRANSFORMER_SRC_FILES) @@ -762,13 +759,9 @@ list(APPEND COMMON_SHARED_LIBRARIES # build graph add_library(ge_ut_graph STATIC - ${GRAPH_SRC_FILES} - ${GRAPH_DEBUG_SRC_FILES} - ${GRAPH_DETAIL_SRC_FILES} - ${GRAPH_OPSPROTO_SRC_FILES} - ${GRAPH_OPTION_SRC_FILES} - ${GRAPH_UTILS_SRC_FILES} - ${GRAPH_DUMPER_SRC_FILES} + ${GRAPH_SRC_FILES_DEPTH0} + ${GRAPH_SRC_FILES_DEPTH1} + ${GRAPH_SRC_FILES_DEPTH2} ${GRAPH_OPS_SRC_FILES} ${GRAPH_REGISTER_SRC_FILES} ${TRANSFORMER_SRC_FILES} From e9a9a9b88e8de86cec86497f90344e49c6dcbbeb Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Wed, 7 Jul 2021 10:59:01 +0800 Subject: [PATCH 168/226] Fix bug of tiling workspace --- ge/hybrid/node_executor/aicore/aicore_op_task.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/node_executor/aicore/aicore_op_task.cc b/ge/hybrid/node_executor/aicore/aicore_op_task.cc index b34cc0c6..fe9bba9a 100644 --- a/ge/hybrid/node_executor/aicore/aicore_op_task.cc +++ b/ge/hybrid/node_executor/aicore/aicore_op_task.cc @@ -372,9 +372,6 @@ Status AiCoreOpTask::UpdateTilingInfo(TaskContext &context) { // update op args by tiling info block_dim_ = tiling_info.GetBlockDim(); clear_atomic_ = tiling_info.GetClearAtomic(); - std::vector workspaces; - tiling_info.GetAllWorkspaces(workspaces); - op_desc->SetWorkspaceBytes(workspaces); tiling_data_ = tiling_info.GetAllTilingData().str(); tiling_key_ = tiling_info.GetTilingKey(); @@ -417,6 +414,11 @@ Status AiCoreOpTask::CalcTilingInfo(const NodePtr &node, OpRunInfo &tiling_info) GE_CHK_STATUS_RET(optiling::OpParaCalculateV2(*node, tiling_info), "[Invoke][OpParaCalculate]Failed calc tiling data of node %s.", node->GetName().c_str()); + // Only non atomic task need update workspace + auto op_desc = node->GetOpDesc(); + std::vector workspaces; + tiling_info.GetAllWorkspaces(workspaces); + op_desc->SetWorkspaceBytes(workspaces); GELOGD("[%s] Done invoking OpParaCalculate successfully.", node->GetName().c_str()); return SUCCESS; } From 43cdd9d732a53220f24ae5738df1118ba780f2a4 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 7 Jul 2021 18:20:50 +0800 Subject: [PATCH 169/226] Detach SessionManager from GELib --- ge/CMakeLists.txt | 9 ++++-- ge/client/ge_api.cc | 57 ++++++++++++++++++++++++++------------ ge/graph/execute/model_executor.cc | 12 +++++++- ge/graph/execute/model_executor.h | 3 +- ge/init/gelib.cc | 28 ------------------- ge/init/gelib.h | 12 ++++---- ge/session/inner_session.cc | 4 +-- ge/session/session_manager.cc | 5 ---- ge/session/session_manager.h | 40 +++++++++++++------------- 9 files changed, 86 insertions(+), 84 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 8fcf97ef..9fff30f7 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -474,9 +474,6 @@ set(INFER_SRC_LIST "common/ge/plugin_manager.cc" "common/ge/op_tiling_manager.cc" "init/gelib.cc" - "session/inner_session.cc" - "session/session_manager.cc" - "graph/execute/model_executor.cc" "engine_manager/dnnengine_manager.cc" "opskernel_manager/ops_kernel_manager.cc" "opskernel_manager/ops_kernel_builder_manager.cc" @@ -721,6 +718,12 @@ set(INFER_SRC_LIST "ge_opt_info/ge_opt_info.cc" ) +set(RUNNER_SRC_LIST + "client/ge_api.cc" + "session/inner_session.cc" + "session/session_manager.cc" +) + if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") ############ libge_runner.so ############ diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index aa88cfb4..e62965c9 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -47,6 +47,7 @@ const int32_t kMaxStrLen = 128; static bool g_ge_initialized = false; static std::mutex g_ge_release_mutex; // GEFinalize and ~Session use +static std::shared_ptr g_session_manager; namespace ge { void GetOpsProtoPath(std::string &opsproto_path) { @@ -148,6 +149,22 @@ Status GEInitializeImpl(const std::map &options) { return FAILED; } + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); + GELOGI("sessionManager initial."); + GE_TIMESTAMP_START(SessionManagerInitialize); + g_session_manager = MakeShared(); + if (g_session_manager == nullptr) { + GELOGE(GE_CLI_INIT_FAILED, "[Init][Create]SessionManager failed"); + return FAILED; + } + ret = g_session_manager->Initialize(options); + GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); + if (ret != SUCCESS) { + GELOGE(ret, "[Init][SessionManager] GE session manager initial failed."); + REPORT_CALL_ERROR("E19999", "SessionManager initialize failed."); + return ret; + } + // 7.check return status, return if (!g_ge_initialized) { // Initialize success, first time calling initialize @@ -217,6 +234,12 @@ Status GEFinalize() { ret = middle_ret; } } + + GELOGI("SessionManager finalization."); + if (g_session_manager != nullptr) { + (void)g_session_manager->Finalize(); // always success. + } + middle_ret = TBEPluginManager::Instance().Finalize(); if (middle_ret != SUCCESS) { ret = middle_ret; @@ -272,7 +295,7 @@ Session::Session(const std::map &options) { GELOGT(TRACE_RUNNING, "Creating session"); uint64_t session_id = 0; - Status ret = instance_ptr->SessionManagerObj().CreateSession(options, session_id); + Status ret = g_session_manager->CreateSession(options, session_id); GELOGT(TRACE_RUNNING, "Session id is %lu", session_id); // check return status, return, update session id if success @@ -321,7 +344,7 @@ Session::Session(const std::map &options) { str_options[key] = val; } uint64_t session_id = 0; - Status ret = instance_ptr->SessionManagerObj().CreateSession(str_options, session_id); + Status ret = g_session_manager->CreateSession(str_options, session_id); GELOGT(TRACE_RUNNING, "Session id is %lu", session_id); // check return status, return, update session id if success @@ -359,7 +382,7 @@ Session::~Session() { GELOGT(TRACE_RUNNING, "Destroying session"); - ret = instance_ptr->SessionManagerObj().DestroySession(session_id); + ret = g_session_manager->DestroySession(session_id); } catch (google::protobuf::FatalException &e) { GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " "because get fatalException."); @@ -397,7 +420,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::mapSessionManagerObj().AddGraph(sessionId_, graph_id, graph, options); + Status ret = g_session_manager->AddGraph(sessionId_, graph_id, graph, options); if (ret != SUCCESS) { GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", @@ -435,7 +458,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, std::string val = option.second.GetString(); str_options[key] = val; } - Status ret = instance_ptr->SessionManagerObj().AddGraph(sessionId_, graph_id, graph, str_options); + Status ret = g_session_manager->AddGraph(sessionId_, graph_id, graph, str_options); if (ret != SUCCESS) { GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", @@ -472,7 +495,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, str_options.insert({it->first.GetString(), it->second.GetString()}); } GELOGD("Adding graph to session"); - Status ret = instance_ptr->SessionManagerObj().AddGraphWithCopy(sessionId_, graph_id, graph, str_options); + Status ret = g_session_manager->AddGraphWithCopy(sessionId_, graph_id, graph, str_options); if (ret != SUCCESS) { GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", @@ -502,7 +525,7 @@ Status Session::RemoveGraph(uint32_t graph_id) { } GELOGT(TRACE_RUNNING, "Removing Graph from session"); - Status ret = instance_ptr->SessionManagerObj().RemoveGraph(sessionId_, graph_id); + Status ret = g_session_manager->RemoveGraph(sessionId_, graph_id); // check return status, return if (ret != SUCCESS) { GELOGE(ret, @@ -583,7 +606,7 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); - Status ret = instance_ptr->SessionManagerObj().RunGraph(sessionId_, graph_id, graph_inputs, outputs); + Status ret = g_session_manager->RunGraph(sessionId_, graph_id, graph_inputs, outputs); // check return status if (ret != SUCCESS) { GELOGE(ret, @@ -631,7 +654,7 @@ Status Session::RunGraphWithStreamAsync(uint32_t graph_id, void *stream, const s return FAILED; } GELOGT(TRACE_RUNNING, "Run Graph Run graph with stream asyn."); - Status ret = instance_ptr->SessionManagerObj().RunGraphWithStreamAsync(sessionId_, graph_id, stream, inputs, + Status ret = g_session_manager->RunGraphWithStreamAsync(sessionId_, graph_id, stream, inputs, outputs); if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]Run graph with stream asyn Failed," @@ -648,7 +671,7 @@ Status Session::RunGraphWithStreamAsync(uint32_t graph_id, void *stream, const s // Register Call Back Status Session::RegisterCallBackFunc(const std::string &key, const pCallBackFunc &callback) { ErrorManager::GetInstance().GenWorkStreamIdDefault(); - return ge::GELib::GetInstance()->SessionManagerObj().RegisterCallBackFunc(sessionId_, key, callback); + return g_session_manager->RegisterCallBackFunc(sessionId_, key, callback); } Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFunc &callback) { @@ -657,7 +680,7 @@ Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFu if (key != nullptr) { str_key = key; } - return ge::GELib::GetInstance()->SessionManagerObj().RegisterCallBackFunc(sessionId_, str_key, callback); + return g_session_manager->RegisterCallBackFunc(sessionId_, str_key, callback); } // Build Graph @@ -675,7 +698,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); - Status ret = instance_ptr->SessionManagerObj().BuildGraph(sessionId_, graph_id, inputs); + Status ret = g_session_manager->BuildGraph(sessionId_, graph_id, inputs); if (ret != SUCCESS) { GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", @@ -702,7 +725,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector &inp return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); - Status ret = instance_ptr->SessionManagerObj().BuildGraph(sessionId_, graph_id, inputs); + Status ret = g_session_manager->BuildGraph(sessionId_, graph_id, inputs); if (ret != SUCCESS) { GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", @@ -733,7 +756,7 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector & GELOGW( "The callback function will not be checked. Please ensure that the implementation of the function is trusted."); - Status ret = ge::GELib::GetInstance()->SessionManagerObj().RunGraphAsync(sessionId_, graph_id, inputs, callback); + Status ret = g_session_manager->RunGraphAsync(sessionId_, graph_id, inputs, callback); if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]RunGraphAsync Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); @@ -757,7 +780,7 @@ Status Session::GetVariables(const std::vector &var_names, std::vec return FAILED; } GELOGT(TRACE_RUNNING, "Get Variables"); - Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, var_names, var_values); + Status ret = g_session_manager->GetVariables(sessionId_, var_names, var_values); if (ret != SUCCESS) { GELOGE(ret, "[Get][Variables]Failed, error code:%u, session_id:%lu.", ret, sessionId_); return FAILED; @@ -787,7 +810,7 @@ Status Session::GetVariables(const std::vector &var_names, std::ve } str_var_names.emplace_back(var_name.GetString()); } - Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, str_var_names, var_values); + Status ret = g_session_manager->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.", @@ -798,6 +821,6 @@ Status Session::GetVariables(const std::vector &var_names, std::ve } bool Session::IsGraphNeedRebuild(uint32_t graph_id) { - return ge::GELib::GetInstance()->SessionManagerObj().IsGraphNeedRebuild(sessionId_, graph_id); + return g_session_manager->IsGraphNeedRebuild(sessionId_, graph_id); } } // namespace ge diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index 50e8a5a5..7c31614d 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -23,6 +23,7 @@ #include "graph/manager/graph_var_manager.h" #include "graph/utils/tensor_adapter.h" #include "graph/load/graph_loader.h" +#include "graph/load/model_manager/model_manager.h" #include "common/math/math_util.h" #include "common/formats/utils/formats_trans_utils.h" @@ -38,7 +39,7 @@ namespace ge { /// @param [in] options user config params /// @return Status result of function /// -Status ModelExecutor::Initialize(const map &options) { +Status ModelExecutor::Initialize(const map &options, uint64_t session_id) { graph_run_listener_ = MakeShared(sync_run_mutex_, condition_); if (graph_run_listener_ == nullptr) { REPORT_CALL_ERROR("E19999", "New GraphModelListener fail"); @@ -46,6 +47,14 @@ Status ModelExecutor::Initialize(const map &options) { return MEMALLOC_FAILED; } + auto model_manager = ModelManager::GetInstance(); + GE_CHECK_NOTNULL(model_manager); + GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, + REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); + GELOGE(FAILED, "[Enable][ExceptionDump] failed."); + return FAILED); + + session_id_ = session_id; train_graph_flag_ = ParseTrainGraphFlag(); thread_run_flag_.store(true); run_thread_ = std::thread(&ModelExecutor::RunThread, this); @@ -74,6 +83,7 @@ Status ModelExecutor::Finalize() { GELOGW("Graph executor FreeExecuteMemory failed, resources may not be released correctly."); } + ModelManager::GetInstance()->DestroyAicpuSession(session_id_); return SUCCESS; } diff --git a/ge/graph/execute/model_executor.h b/ge/graph/execute/model_executor.h index f8e717a1..f11441e9 100644 --- a/ge/graph/execute/model_executor.h +++ b/ge/graph/execute/model_executor.h @@ -30,7 +30,7 @@ class ModelExecutor : public Executor { /// @param [in] options user config params /// @return Status result of function /// - Status Initialize(const map &options); + Status Initialize(const map &options, uint64_t session_id); /// /// @ingroup ge @@ -120,6 +120,7 @@ class ModelExecutor : public Executor { bool init_flag_{false}; bool train_graph_flag_{false}; + uint64_t session_id_{0}; GraphExecutor graph_executor_; std::mutex mutex_; diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index b34871a9..f7296144 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -38,7 +38,6 @@ #include "graph/common/ge_call_wrapper.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" -#include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_mem_manager.h" #include "graph/manager/host_mem_manager.h" #include "graph/manager/graph_var_manager.h" @@ -160,18 +159,6 @@ Status GELib::InnerInitialize(const map &options) { return initOpsBuilderStatus; } - ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); - GELOGI("sessionManager initial."); - GE_TIMESTAMP_START(SessionManagerInitialize); - Status initSmStatus = sessionManager_.Initialize(options); - GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); - if (initSmStatus != SUCCESS) { - GELOGE(initSmStatus, "[Init][SessionManager] GE session manager initial failed."); - REPORT_CALL_ERROR("E19999", "SessionManager initialize failed."); - RollbackInit(); - return initSmStatus; - } - GELOGI("Start to initialize HostCpuEngine"); GE_TIMESTAMP_START(HostCpuEngineInitialize); Status initHostCpuEngineStatus = HostCpuEngine::GetInstance().Initialize(); @@ -209,12 +196,6 @@ Status GELib::SystemInitialize(const map &options) { // In train and infer, profiling is always needed. InitProfiling(this->options_); - auto model_manager = ModelManager::GetInstance(); - GE_CHECK_NOTNULL(model_manager); - GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); - GELOGE(FAILED, "[Enable][ExceptionDump] failed."); - return FAILED); // 1.`is_train_mode_` means case: train // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer // these two case with logical device id @@ -454,12 +435,6 @@ Status GELib::Finalize() { GELOGW("engineManager finalize failed"); final_state = mid_state; } - GELOGI("sessionManager finalization."); - mid_state = sessionManager_.Finalize(); - if (mid_state != SUCCESS) { - GELOGW("sessionManager finalize failed"); - final_state = mid_state; - } GELOGI("opsBuilderManager finalization."); mid_state = OpsKernelBuilderManager::Instance().Finalize(); @@ -539,9 +514,6 @@ void GELib::RollbackInit() { if (opsManager_.init_flag_) { (void)opsManager_.Finalize(); } - if (sessionManager_.init_flag_) { - (void)sessionManager_.Finalize(); - } MemManager::Instance().Finalize(); HostMemManager::Instance().Finalize(); VarManagerPool::Instance().Destory(); diff --git a/ge/init/gelib.h b/ge/init/gelib.h index eb367578..5e66be51 100644 --- a/ge/init/gelib.h +++ b/ge/init/gelib.h @@ -22,7 +22,13 @@ #include #include "engine_manager/dnnengine_manager.h" #include "opskernel_manager/ops_kernel_manager.h" -#include "session/session_manager.h" +#include "graph/tuning_utils.h" +#include "graph/operator_factory.h" +#include "graph/ge_local_context.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/graph_utils.h" +#include "graph/utils/anchor_utils.h" +#include "graph/manager/graph_var_manager.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/ge_types.h" @@ -53,9 +59,6 @@ class GE_FUNC_VISIBILITY GELib { // get OpsKernelManager object OpsKernelManager &OpsKernelManagerObj() { return opsManager_; } - // get SessionManager object - SessionManager &SessionManagerObj() { return sessionManager_; } - // get Initial flag bool InitFlag() const { return init_flag_; } @@ -90,7 +93,6 @@ class GE_FUNC_VISIBILITY GELib { DNNEngineManager engineManager_; OpsKernelManager opsManager_; - SessionManager sessionManager_; std::mutex status_mutex_; bool init_flag_ = false; Options options_; diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index 236ec783..fcb9d233 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -30,7 +30,6 @@ #include "graph/ge_global_options.h" #include "graph/ge_local_context.h" #include "graph/common/local_context.h" -#include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_var_manager.h" #include "graph/manager/graph_mem_manager.h" #include "graph/utils/tensor_adapter.h" @@ -169,7 +168,6 @@ Status InnerSession::Finalize() { REPORT_CALL_ERROR("E19999", "GraphManager Finalize failed, InnerSession:%lu.", session_id_); } - ModelManager::GetInstance()->DestroyAicpuSession(session_id_); init_flag_ = false; // release var memory GELOGI("VarManager free var memory."); @@ -189,7 +187,7 @@ Status InnerSession::Finalize() { } Status InnerSession::InnerInitialize() { - Status ret = model_executor_.Initialize(options_); + Status ret = model_executor_.Initialize(options_, session_id_); if (ret != SUCCESS) { GELOGE(ret, "[Init][GraphExecutor] failed, InnerSession:%lu.", session_id_); REPORT_CALL_ERROR("E19999", "GraphExecutor initialize failed, InnerSession:%lu.", session_id_); diff --git a/ge/session/session_manager.cc b/ge/session/session_manager.cc index fdf37d06..486dfd58 100755 --- a/ge/session/session_manager.cc +++ b/ge/session/session_manager.cc @@ -20,7 +20,6 @@ #include "common/ge/ge_util.h" #include "framework/common/debug/ge_log.h" #include "graph/ge_context.h" -#include "graph/load/model_manager/model_manager.h" #include "graph/manager/util/rt_context_util.h" using std::map; @@ -105,10 +104,6 @@ Status SessionManager::DestroySession(SessionId session_id) { return GE_SESSION_NOT_EXIST; } - if (ModelManager::GetInstance() != nullptr) { - ModelManager::GetInstance()->DestroyAicpuSession(session_id); - } - // Unified destruct rt_context RtContextUtil::GetInstance().DestroyRtContexts(session_id); diff --git a/ge/session/session_manager.h b/ge/session/session_manager.h index 4c3429c2..4a0b9d66 100644 --- a/ge/session/session_manager.h +++ b/ge/session/session_manager.h @@ -31,9 +31,26 @@ namespace ge { using SessionPtr = std::shared_ptr; class SessionManager { - friend class GELib; - public: + SessionManager() = default; + + ~SessionManager() = default; + + /// + /// @ingroup ge_session + /// @brief initialize session manager + /// @param [in] options session manager config options + /// @return Status result of function + /// + Status Initialize(const std::map &options); + + /// + /// @ingroup ge_session + /// @brief finalize session manager + /// @return Status result of function + /// + Status Finalize(); + /// /// @ingroup ge_session /// @brief create session @@ -181,25 +198,6 @@ class SessionManager { bool IsGraphNeedRebuild(SessionId session_id, uint32_t graph_id); private: - SessionManager() = default; - - ~SessionManager() = default; - - /// - /// @ingroup ge_session - /// @brief initialize session manager - /// @param [in] options session manager config options - /// @return Status result of function - /// - Status Initialize(const std::map &options); - - /// - /// @ingroup ge_session - /// @brief finalize session manager - /// @return Status result of function - /// - Status Finalize(); - bool HasSession(SessionId session_id); Status GetNextSessionId(SessionId &next_session_id); From 91d15cdc13a7acf67151afa990b6bdefaec84221 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 7 Jul 2021 18:43:12 +0800 Subject: [PATCH 170/226] Fix UT --- tests/ut/ge/graph/execute/model_executor_unittest.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/ut/ge/graph/execute/model_executor_unittest.cc b/tests/ut/ge/graph/execute/model_executor_unittest.cc index 33643993..d4e0e3a4 100644 --- a/tests/ut/ge/graph/execute/model_executor_unittest.cc +++ b/tests/ut/ge/graph/execute/model_executor_unittest.cc @@ -63,7 +63,7 @@ static NodePtr CreateNode(ComputeGraph &graph, const string &name, const string TEST_F(UtestModelExecutorTest, test_load_graph_sync) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); auto compute_graph = MakeShared("test_graph"); GeRootModelPtr ge_root_model = MakeShared(compute_graph); @@ -86,7 +86,7 @@ TEST_F(UtestModelExecutorTest, test_load_graph_sync) { TEST_F(UtestModelExecutorTest, test_load_graph_async) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); Graph graph("test_graph"); auto compute_graph = MakeShared("test_graph"); @@ -111,7 +111,7 @@ TEST_F(UtestModelExecutorTest, test_load_graph_async) { TEST_F(UtestModelExecutorTest, test_load_graph_failed) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); Graph graph("test_graph"); auto compute_graph = MakeShared("test_graph"); @@ -144,7 +144,7 @@ TEST_F(UtestModelExecutorTest, test_check_and_release_memory) { } ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); GeModelPtr ge_model = make_shared(); int64_t memory_size = 25 * 1024UL * 1024UL * 1024UL; @@ -171,7 +171,7 @@ TEST_F(UtestModelExecutorTest, test_check_and_release_memory) { TEST_F(UtestModelExecutorTest, parse_inputs_dims_data) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); OmeContext context; SetLocalOmeContext(context); @@ -195,7 +195,7 @@ TEST_F(UtestModelExecutorTest, parse_inputs_dims_data) { TEST_F(UtestModelExecutorTest, parse_inputs_dims_getnext) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); OmeContext context; SetLocalOmeContext(context); @@ -223,7 +223,7 @@ TEST_F(UtestModelExecutorTest, parse_inputs_dims_getnext) { TEST_F(UtestModelExecutorTest, test_run_thread) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); GraphId graph_id = 1; uint64_t session_id = 0; @@ -281,7 +281,7 @@ static void test_run_graph(ModelExecutor &model_executor) { TEST_F(UtestModelExecutorTest, test_run_graph_train) { GetThreadLocalContext().SetGlobalOption({{OPTION_GRAPH_RUN_MODE, "1"}}); ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); test_run_graph(model_executor); EXPECT_EQ(model_executor.Finalize(), SUCCESS); } @@ -291,14 +291,14 @@ TEST_F(UtestModelExecutorTest, test_run_graph_infer) { GetThreadLocalContext().SetSessionOption({}); GetThreadLocalContext().SetGraphOption({}); ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); test_run_graph(model_executor); EXPECT_EQ(model_executor.Finalize(), SUCCESS); } TEST_F(UtestModelExecutorTest, test_run_graph_with_stream) { ModelExecutor model_executor; - EXPECT_EQ(model_executor.Initialize({}), SUCCESS); + EXPECT_EQ(model_executor.Initialize({}, 0), SUCCESS); GraphId graph_id = 1; auto compute_graph = MakeShared("test_graph"); From cd27cbf7e2573a16b653be83381c4ab85fd1f6eb Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 7 Jul 2021 21:12:36 +0800 Subject: [PATCH 171/226] Add UT for Session --- ge/client/ge_api.cc | 275 ++++++++++++--------------------- ge/graph/execute/model_executor.cc | 4 +- ge/graph/manager/graph_manager.cc | 4 +- tests/ut/ge/session/ge_api_unittest.cc | 112 +++++++++++++- 4 files changed, 211 insertions(+), 184 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index e62965c9..3cf7c3c4 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -71,8 +71,7 @@ Status CheckOptionsValid(const std::map &options) { auto job_id_iter = options.find(OPTION_EXEC_JOB_ID); if (job_id_iter != options.end()) { if (job_id_iter->second.length() > kMaxStrLen) { - GELOGE(PARAM_INVALID, "[Check][JobId]Failed," - "the job_id [%s] string length: %zu > max string length: %d", + GELOGE(PARAM_INVALID, "[Check][JobId]Failed, 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, @@ -96,8 +95,7 @@ Status GEInitializeImpl(const std::map &options) { std::string path_base = ge::GELib::GetPath(); auto ret = ErrorManager::GetInstance().Init(path_base); if (ret != SUCCESS) { - GELOGE(GE_CLI_INIT_FAILED, - "[Init][PathBase]Init failed when pass param path_base:%s", path_base.c_str()); + 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; } @@ -118,11 +116,9 @@ Status GEInitializeImpl(const std::map &options) { bool is_proto_init = manager->Initialize(option_tmp); GE_TIMESTAMP_END(GEInitialize, "GEInitialize::ManagerInitialize"); if (!is_proto_init) { - GELOGE(GE_CLI_INIT_FAILED, - "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", + GELOGE(GE_CLI_INIT_FAILED, "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", opsproto_path.c_str()); - REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", - opsproto_path.c_str()); + REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", opsproto_path.c_str()); return FAILED; } @@ -190,8 +186,7 @@ Status GEInitialize(const std::map &options) { for (auto &option : options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { GELOGE(FAILED, "[Check][Param]Options invalid, first or second option is nullptr."); - REPORT_INNER_ERROR("E19999", "Check parameter's options invalid," - "the first or second option is nullptr."); + REPORT_INNER_ERROR("E19999", "Check parameter's options invalid, the first or second option is nullptr."); return FAILED; } std::string key = option.first.GetString(); @@ -274,22 +269,12 @@ std::string GEGetWarningMsg() { Session::Session(const std::map &options) { ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GELOGT(TRACE_INIT, "Start to construct session."); - ErrorManager::GetInstance().GenWorkStreamIdDefault(); // check init status sessionId_ = 0; if (!g_ge_initialized) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Construct][Session]Failed because lack GEInitialize call before."); - REPORT_INNER_ERROR("E19999", - "Creating session failed because lack GEInitialize call before."); - return; - } - // call Initialize - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Construct][Session]Failed, GELib instance is nullptr or it is not InitFlag"); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return; } @@ -311,32 +296,21 @@ Session::Session(const std::map &options) { Session::Session(const std::map &options) { ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GELOGT(TRACE_INIT, "Session Constructor start"); - ErrorManager::GetInstance().GenWorkStreamIdDefault(); // check init status sessionId_ = 0; if (!g_ge_initialized) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Construct][Session]Failed because lack GEInitialize call before."); - REPORT_INNER_ERROR("E19999", - "Creating session failed because lack GEInitialize call before."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return; } // call Initialize - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Construct][Session]Failed, the GELib instance is nullptr or is not InitFlag"); - return; - } - GELOGT(TRACE_RUNNING, "Creating session"); std::map str_options; for (auto &option : options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { GELOGE(FAILED, "[Construct][Session]Failed, the first or second option is nullptr."); - REPORT_INNER_ERROR("E19999", "Creating session's options invalid," - "the first or second option is nullptr."); + REPORT_INNER_ERROR("E19999", "Creating session's options invalid, the first or second option is nullptr."); return; } std::string key = option.first.GetString(); @@ -373,19 +347,12 @@ Session::~Session() { try { uint64_t session_id = sessionId_; // call DestroySession - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGW("GE is not yet initialized or is finalized."); - return; - } GELOGT(TRACE_RUNNING, "Session id is %lu", session_id); - GELOGT(TRACE_RUNNING, "Destroying session"); ret = g_session_manager->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"); } @@ -400,9 +367,7 @@ Session::~Session() { // Add Graph Status Session::AddGraph(uint32_t graph_id, const Graph &graph) { - ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); std::map options; - ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); return AddGraph(graph_id, graph, options); } @@ -411,20 +376,16 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Add][Graph]Failed because GELib instance is nullptr or it is not InitFlag."); - REPORT_INNER_ERROR("E19999", - "AddGraph Failed, GELib instance is nullptr or it is not InitFlag."); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGD("Adding graph to session"); Status ret = g_session_manager->AddGraph(sessionId_, graph_id, graph, options); if (ret != SUCCESS) { - GELOGE(ret, - "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); return FAILED; } GELOGD("AddGraph finished in Session."); @@ -432,26 +393,22 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map &options) { +Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map &options) { 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(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Add][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); - REPORT_INNER_ERROR("E19999", - "AddGraph Failed, GELib instance is nullptr or it is not InitFlag."); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGD("Adding graph to session"); std::map str_options; for (auto &option : options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { GELOGE(FAILED, "[Add][Graph]Failed, the first or second option is nullptr."); - REPORT_INNER_ERROR("E19999", - "Add Graph Failed, the first or second option is nullptr."); + REPORT_INNER_ERROR("E19999", "Add Graph Failed, the first or second option is nullptr."); return FAILED; } std::string key = option.first.GetString(); @@ -460,9 +417,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, } Status ret = g_session_manager->AddGraph(sessionId_, graph_id, graph, str_options); if (ret != SUCCESS) { - GELOGE(ret, - "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); return FAILED; } GELOGD("AddGraph finished in Session."); @@ -470,8 +425,6 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, } Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph) { - ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); - ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::map options; return AddGraphWithCopy(graph_id, graph, options); } @@ -482,14 +435,12 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, 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(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Add][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); - REPORT_INNER_ERROR("E19999", - "AddGraph Failed, GELib instance is nullptr or is not InitFlag."); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + std::map str_options; for (auto it = options.begin(); it != options.end(); ++it) { str_options.insert({it->first.GetString(), it->second.GetString()}); @@ -497,9 +448,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, GELOGD("Adding graph to session"); Status ret = g_session_manager->AddGraphWithCopy(sessionId_, graph_id, graph, str_options); if (ret != SUCCESS) { - GELOGE(ret, - "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); return FAILED; } GELOGD("AddGraph finished in Session."); @@ -510,17 +459,11 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, Status Session::RemoveGraph(uint32_t graph_id) { ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Session RemoveGraph start"); - ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); // call RemoveGraph - 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, " - "session_id %lu, graph_id %u", sessionId_, graph_id); - REPORT_INNER_ERROR("E19999", - "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %u", sessionId_, graph_id); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } @@ -528,11 +471,9 @@ Status Session::RemoveGraph(uint32_t graph_id) { Status ret = g_session_manager->RemoveGraph(sessionId_, graph_id); // check return status, return if (ret != SUCCESS) { - GELOGE(ret, - "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); - REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " - "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); + GELOGE(ret, "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", 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"); @@ -591,29 +532,21 @@ void PrintOutputResult(std::vector &outputs) { Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, std::vector &outputs) { ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Session RunGraph start"); - ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); - std::vector graph_inputs = inputs; - // call RunGraph - 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, " - "session_id %lu, graph_id %u", sessionId_, graph_id); - REPORT_INNER_ERROR("E19999", - "RunGraph Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %u", sessionId_, graph_id); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + + // call RunGraph GELOGT(TRACE_RUNNING, "Running Graph"); - Status ret = g_session_manager->RunGraph(sessionId_, graph_id, graph_inputs, outputs); + Status ret = g_session_manager->RunGraph(sessionId_, graph_id, inputs, outputs); // check return status if (ret != SUCCESS) { - GELOGE(ret, - "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); - REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " - "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); + GELOGE(ret, "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", 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; } @@ -632,30 +565,15 @@ Status Session::RunGraphWithStreamAsync(uint32_t graph_id, void *stream, const s std::vector &outputs) { ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Start to run graph with stream async."); - ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]Run graph with stream async failed, the GELib instance is nullptr," - "session id = %lu, graph id = %u, stream = %p.", sessionId_, graph_id, stream); - REPORT_INNER_ERROR("E19999", - "Run graph with stream async failed, the GELib instance is nullptr" - "session id = %lu, graph id = %u, stream = %p.", sessionId_, graph_id, stream); - return FAILED; - } - if (!instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]Run graph with stream asyn failed, the GELib instance is not init," - "session id = %lu, graph id = %u, stream = %p.", sessionId_, graph_id, stream); - REPORT_INNER_ERROR("E19999", - "Run graph with stream asyn failed, the GELib instance is not init," - "session id = %lu, graph id = %u, stream = %p.", sessionId_, graph_id, stream); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Run Graph Run graph with stream asyn."); - Status ret = g_session_manager->RunGraphWithStreamAsync(sessionId_, graph_id, stream, inputs, - outputs); + Status ret = g_session_manager->RunGraphWithStreamAsync(sessionId_, graph_id, stream, inputs, outputs); if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]Run graph with stream asyn Failed," "error code = %u, session id = %lu, graph id = %u, stream = %p.", ret, sessionId_, graph_id, stream); @@ -671,11 +589,23 @@ Status Session::RunGraphWithStreamAsync(uint32_t graph_id, void *stream, const s // Register Call Back Status Session::RegisterCallBackFunc(const std::string &key, const pCallBackFunc &callback) { ErrorManager::GetInstance().GenWorkStreamIdDefault(); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); + return FAILED; + } + return g_session_manager->RegisterCallBackFunc(sessionId_, key, callback); } Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFunc &callback) { ErrorManager::GetInstance().GenWorkStreamIdDefault(); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); + return FAILED; + } + std::string str_key; if (key != nullptr) { str_key = key; @@ -687,24 +617,18 @@ Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFu Status Session::BuildGraph(uint32_t graph_id, const std::vector &inputs) { 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, " - "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, " - "session_id %lu, graph_id %u", sessionId_, graph_id); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Building Graph"); Status ret = g_session_manager->BuildGraph(sessionId_, graph_id, inputs); if (ret != SUCCESS) { - GELOGE(ret, - "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); - REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " - "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); + GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", 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; @@ -714,24 +638,18 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector Status Session::BuildGraph(uint32_t graph_id, const std::vector &inputs) { 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, " - "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, " - "session_id %lu, graph_id %u", sessionId_, graph_id); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Building Graph"); Status ret = g_session_manager->BuildGraph(sessionId_, graph_id, inputs); if (ret != SUCCESS) { - GELOGE(ret, - "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); - REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " - "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); + GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", 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; @@ -742,16 +660,12 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector & RunAsyncCallback callback) { 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, " - "session_id %lu, graph_id %u", sessionId_, graph_id); - REPORT_INNER_ERROR("E19999", - "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %u", sessionId_, graph_id); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); GELOGW( "The callback function will not be checked. Please ensure that the implementation of the function is trusted."); @@ -760,8 +674,8 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector & if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]RunGraphAsync Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); - REPORT_CALL_ERROR("E19999", "RunGraphAsync Failed, error code:%u, session_id:%lu, " - "graph_id:%u", ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "RunGraphAsync Failed, error code:%u, session_id:%lu, graph_id:%u", + ret, sessionId_, graph_id); return FAILED; } return SUCCESS; @@ -771,14 +685,12 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector & Status Session::GetVariables(const std::vector &var_names, std::vector &var_values) { 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, - "[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."); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Get Variables"); Status ret = g_session_manager->GetVariables(sessionId_, var_names, var_values); if (ret != SUCCESS) { @@ -792,14 +704,12 @@ Status Session::GetVariables(const std::vector &var_names, std::vec Status Session::GetVariables(const std::vector &var_names, std::vector &var_values) { 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, - "[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."); + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); return FAILED; } + GELOGT(TRACE_RUNNING, "Get Variables"); std::vector str_var_names; for (auto &var_name : var_names) { @@ -813,14 +723,19 @@ Status Session::GetVariables(const std::vector &var_names, std::ve Status ret = g_session_manager->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_); + REPORT_CALL_ERROR("E19999", "Get variables failed, error code:%u, session_id:%lu.", ret, sessionId_); return FAILED; } return SUCCESS; } bool Session::IsGraphNeedRebuild(uint32_t graph_id) { + if (!g_ge_initialized) { + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed because lack GEInitialize call before."); + REPORT_INNER_ERROR("E19999", "Creating session failed because lack GEInitialize call before."); + return false; + } + return g_session_manager->IsGraphNeedRebuild(sessionId_, graph_id); } } // namespace ge diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index 7c31614d..36d21e1c 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -178,7 +178,9 @@ void ModelExecutor::ReturnError(RunAsyncCallback callback, Status ret, const str StopQueue(); GELOGE(ret, "%s.", log.c_str()); std::vector outputs; - callback(ret, outputs); + if (callback != nullptr) { + callback(ret, outputs); + } } void ModelExecutor::UpdateLocalOmeContext(const GraphNodePtr &graph_node) { diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 96dc59c5..a3605ec2 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -2939,7 +2939,9 @@ void GraphManager::ReturnError(RunAsyncCallback callback, Status ret, const stri StopQueue(); GELOGE(ret, "%s.", log.c_str()); std::vector outputs; - callback(ret, outputs); + if (callback != nullptr) { + callback(ret, outputs); + } } bool GraphManager::IsGraphNeedRebuild(uint32_t graph_id) { diff --git a/tests/ut/ge/session/ge_api_unittest.cc b/tests/ut/ge/session/ge_api_unittest.cc index 9a7058f3..93e6a52c 100644 --- a/tests/ut/ge/session/ge_api_unittest.cc +++ b/tests/ut/ge/session/ge_api_unittest.cc @@ -26,8 +26,6 @@ #include "proto/ge_ir.pb.h" #include "inc/external/ge/ge_api.h" #include "session/session_manager.h" -#undef protected -#undef private using namespace std; @@ -71,4 +69,114 @@ TEST_F(UtestGeApi, ge_initialize_modify_mixlist) { auto ret = GEInitialize(options); ASSERT_NE(ret, SUCCESS); } + +TEST_F(UtestGeApi, ge_not_initialized) { + EXPECT_EQ(GEFinalize(), SUCCESS); + + std::map options; + std::map ascend_options; + Session session(options); + + GraphId graph_id = 1; + const auto compute_graph = MakeShared("test_graph"); + Graph graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); + + EXPECT_EQ(session.AddGraph(graph_id, graph), FAILED); + EXPECT_EQ(session.AddGraph(graph_id, graph, ascend_options), FAILED); + + EXPECT_EQ(session.AddGraphWithCopy(graph_id, graph), FAILED); + EXPECT_EQ(session.AddGraphWithCopy(graph_id, graph, ascend_options), FAILED); + + vector inputs; + vector tensors; + EXPECT_EQ(session.BuildGraph(graph_id, inputs), FAILED); + EXPECT_EQ(session.BuildGraph(graph_id, tensors), FAILED); + + vector outputs; + EXPECT_EQ(session.RunGraph(graph_id, inputs, outputs), FAILED); + EXPECT_EQ(session.RunGraphWithStreamAsync(graph_id, nullptr, inputs, outputs), FAILED); + EXPECT_EQ(session.RunGraphAsync(graph_id, inputs, nullptr), FAILED); + + vector var_inputs; + EXPECT_EQ(session.GetVariables(var_inputs, outputs), FAILED); + + vector var_names; + EXPECT_EQ(session.GetVariables(var_names, outputs), FAILED); + + std::string key; + pCallBackFunc ge_callback; + EXPECT_EQ(session.RegisterCallBackFunc(key, ge_callback), FAILED); + + session::pCallBackFunc session_callback; + EXPECT_EQ(session.RegisterCallBackFunc(key.c_str(), session_callback), FAILED); + + EXPECT_FALSE(session.IsGraphNeedRebuild(graph_id)); + + EXPECT_EQ(session.RemoveGraph(graph_id), FAILED); + EXPECT_EQ(GEFinalize(), SUCCESS); +} + +TEST_F(UtestGeApi, ge_session_ascend_string) { + std::map options; + EXPECT_EQ(GEInitialize(options), SUCCESS); + + Session session(options); + + GraphId graph_id = 1; + const auto compute_graph = MakeShared("test_graph"); + EXPECT_EQ(session.AddGraph(graph_id, GraphUtils::CreateGraphFromComputeGraph(compute_graph)), SUCCESS); + + EXPECT_TRUE(session.IsGraphNeedRebuild(graph_id)); + + EXPECT_EQ(session.RemoveGraph(graph_id), SUCCESS); + + EXPECT_EQ(GEFinalize(), SUCCESS); +} + +TEST_F(UtestGeApi, ge_session_test) { + std::map options; + EXPECT_EQ(GEInitialize(options), SUCCESS); + + std::map ascend_options; + Session session(options); + + GraphId graph_id = 1; + const auto compute_graph = MakeShared("test_graph"); + Graph graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); + + EXPECT_EQ(session.AddGraph(graph_id, graph), SUCCESS); + EXPECT_EQ(session.AddGraph(graph_id, graph, ascend_options), SUCCESS); + + EXPECT_EQ(session.AddGraphWithCopy(graph_id, graph), FAILED); + EXPECT_EQ(session.AddGraphWithCopy(graph_id, graph, ascend_options), FAILED); + + vector inputs; + vector tensors; + EXPECT_EQ(session.BuildGraph(graph_id, inputs), FAILED); + EXPECT_EQ(session.BuildGraph(graph_id, tensors), FAILED); + + vector outputs; + EXPECT_EQ(session.RunGraph(graph_id, inputs, outputs), FAILED); + EXPECT_EQ(session.RunGraphWithStreamAsync(graph_id, nullptr, inputs, outputs), FAILED); + EXPECT_EQ(session.RunGraphAsync(graph_id, inputs, nullptr), SUCCESS); // Push to queue. + + vector var_inputs; + EXPECT_EQ(session.GetVariables(var_inputs, outputs), FAILED); + + vector var_names; + EXPECT_EQ(session.GetVariables(var_names, outputs), FAILED); + + std::string key; + pCallBackFunc ge_callback; + EXPECT_EQ(session.RegisterCallBackFunc(key, ge_callback), SUCCESS); + + session::pCallBackFunc session_callback; + EXPECT_EQ(session.RegisterCallBackFunc(key.c_str(), session_callback), SUCCESS); + + EXPECT_TRUE(session.IsGraphNeedRebuild(graph_id)); + + EXPECT_EQ(session.RemoveGraph(graph_id), SUCCESS); + EXPECT_EQ(GEFinalize(), SUCCESS); +} + } // namespace ge From ea95be37a7116eea96a48511519aaaa5f5e59a2f Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 8 Jul 2021 13:50:00 +0800 Subject: [PATCH 172/226] Revert EnableExceptionDump --- ge/graph/execute/model_executor.cc | 7 ------- ge/init/gelib.cc | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index 36d21e1c..bcbc08e6 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -47,13 +47,6 @@ Status ModelExecutor::Initialize(const map &options, uint64_t se return MEMALLOC_FAILED; } - auto model_manager = ModelManager::GetInstance(); - GE_CHECK_NOTNULL(model_manager); - GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); - GELOGE(FAILED, "[Enable][ExceptionDump] failed."); - return FAILED); - session_id_ = session_id; train_graph_flag_ = ParseTrainGraphFlag(); thread_run_flag_.store(true); diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index f7296144..132d4680 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -38,6 +38,7 @@ #include "graph/common/ge_call_wrapper.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" +#include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_mem_manager.h" #include "graph/manager/host_mem_manager.h" #include "graph/manager/graph_var_manager.h" @@ -196,6 +197,12 @@ Status GELib::SystemInitialize(const map &options) { // In train and infer, profiling is always needed. InitProfiling(this->options_); + auto model_manager = ModelManager::GetInstance(); + GE_CHECK_NOTNULL(model_manager); + GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, + REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); + GELOGE(FAILED, "[Enable][ExceptionDump] failed."); + return FAILED); // 1.`is_train_mode_` means case: train // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer // these two case with logical device id From cca94f97fb4a8c21fc85bf21c08d146804965a59 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 8 Jul 2021 13:52:19 +0800 Subject: [PATCH 173/226] Fix case_load_model_encypt_type_unsupported --- ge/hybrid/model/node_item.cc | 4 ++-- tests/ut/ge/graph/load/model_manager_unittest.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ge/hybrid/model/node_item.cc b/ge/hybrid/model/node_item.cc index 77bd8efd..f66d4638 100644 --- a/ge/hybrid/model/node_item.cc +++ b/ge/hybrid/model/node_item.cc @@ -25,7 +25,7 @@ namespace ge { namespace hybrid { namespace { const uint8_t kMaxTransCount = 3; -const uint32_t kTransOpIoSize = 1; +const uint8_t kTransOpIoSize = 1; const char *const kAttrNameOriginalFusionGraph = "_original_fusion_graph"; const char *const kNodeTypeRetVal = "_RetVal"; const std::set kControlOpTypes{ @@ -47,7 +47,7 @@ bool IsEnterFeedNode(NodePtr node) { // For: Enter -> TransData -> Cast -> node for (uint8_t i = 0; i < kMaxTransCount; ++i) { if (kEnterOpTypes.count(NodeUtils::GetNodeType(node)) > 0) { - GELOGD("Node[%u] is Enter feed node.", node->GetName().c_str()); + GELOGD("Node[%s] is Enter feed node.", node->GetName().c_str()); return true; } diff --git a/tests/ut/ge/graph/load/model_manager_unittest.cc b/tests/ut/ge/graph/load/model_manager_unittest.cc index d9e4eabd..a0644510 100644 --- a/tests/ut/ge/graph/load/model_manager_unittest.cc +++ b/tests/ut/ge/graph/load/model_manager_unittest.cc @@ -78,7 +78,7 @@ class UtestModelManagerModelManager : public testing::Test { const int model_len = 10; data.model_len = sizeof(ModelFileHeader) + model_len; data.model_data = new uint8_t[data.model_len]; - memset((uint8_t *)data.model_data + sizeof(ModelFileHeader), 10, model_len); + memset((uint8_t *)data.model_data + sizeof(ModelFileHeader), 0, model_len); ModelFileHeader *header = (ModelFileHeader *)data.model_data; header->magic = MODEL_FILE_MAGIC_NUM; @@ -93,7 +93,7 @@ class UtestModelManagerModelManager : public testing::Test { data.key = ENC_KEY; data.model_data = new uint8_t[data.model_len]; uint8_t data_ori[model_len]; - memset(data_ori, 10, model_len); + memset(data_ori, 0, model_len); ModelFileHeader *header = (ModelFileHeader *)data.model_data; header->magic = MODEL_FILE_MAGIC_NUM; header->version = MODEL_VERSION; @@ -224,6 +224,7 @@ TEST_F(UtestModelManagerModelManager, case_load_model_encypt_type_unsupported) { ModelFileHeader *header = (ModelFileHeader *)data.model_data; header->is_encrypt = 255; uint32_t model_id = 1; + // Error for: LoadModelPartitionTable: Invalid partition_table->num:0 EXPECT_EQ(mm.LoadModelOffline(model_id, data, nullptr, nullptr), ACL_ERROR_GE_PARAM_INVALID); delete[](uint8_t *) data.model_data; } From 4077301b37a6852c2a116335195b529e2bdd63e4 Mon Sep 17 00:00:00 2001 From: zhupuxu Date: Thu, 8 Jul 2021 15:33:19 +0800 Subject: [PATCH 174/226] fix bug for step info Signed-off-by: zhupuxu --- ge/common/profiling/ge_profiling.cc | 14 ++++---------- ge/common/profiling/profiling_manager.cc | 2 ++ ge/common/profiling/profiling_manager.h | 3 +++ ge/single_op/single_op.cc | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index c00af058..fd104e90 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -230,21 +230,15 @@ ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream REPORT_CALL_ERROR("E19999", "Get logic device id failed, ret 0x%X", rt_ret); return ge::FAILED; } + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetStepInfoIndex(index_id); if (is_first_run && tag_id == kStepStart) { - GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, - kModelId, - tag_id, - stream, - device_id)); + GE_CHK_STATUS_RET_NOLOG(profiling_manager.ProfileStepInfo(index_id, kModelId, tag_id, stream, device_id)); is_first_run = false; return ge::SUCCESS; } if (!is_first_run && tag_id == kStepEnd) { - GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, - kModelId, - tag_id, - stream, - device_id)); + GE_CHK_STATUS_RET_NOLOG(profiling_manager.ProfileStepInfo(index_id, kModelId, tag_id, stream, device_id)); is_first_run = true; return ge::SUCCESS; } diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 6707d78e..7fd63d7e 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -69,6 +69,7 @@ ProfilingManager::ProfilingManager() : is_load_profiling_(false), is_execute_profiling_(false), is_training_trace_(false), subscribe_count_(0) { prof_cb_.msprofCtrlCallback = nullptr; prof_cb_.msprofReporterCallback = nullptr; + index_id_ = UINT64_MAX; } ProfilingManager::~ProfilingManager() {} @@ -604,6 +605,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfFi is_load_profiling_ = false; is_training_trace_ = false; is_execute_profiling_ = false; + index_id_ = UINT64_MAX; // profiling plugin uninit PluginUnInit(); diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index 049a4df4..25929895 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -101,6 +101,8 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { void GetOpInputOutputInfo(const OpDescPtr &op, TaskDescInfo &task_desc_info) const; void ReportData(const int32_t &device_id, const std::string &data, const std::string &tag_name); Status ProfileStepInfo(uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id); + void SetStepInfoIndex(uint64_t index_id) { index_id_ = index_id; } + uint64_t GetStepInfoIndex() { return index_id_; } private: Status InitFromOptions(const Options &options, MsprofGeOptions &prof_conf); Status ParseOptions(const std::string &options); @@ -127,6 +129,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { std::string fp_point_; std::string bp_point_; uint32_t reporter_max_len_ = 0; + uint64_t index_id_; }; } // namespace ge #endif // GE_COMMON_PROFILING_PROFILING_MANAGER_H_ diff --git a/ge/single_op/single_op.cc b/ge/single_op/single_op.cc index 763d0fa4..a82c30ba 100755 --- a/ge/single_op/single_op.cc +++ b/ge/single_op/single_op.cc @@ -58,7 +58,7 @@ Status ProfilingTaskInfo(OpTask *op_task, const string &shape_type) { tmp_task_desc_info.op_name.c_str(), tmp_task_desc_info.model_name.c_str()); tmp_task_desc_info.shape_type = shape_type; - tmp_task_desc_info.cur_iter_num = 0; + tmp_task_desc_info.cur_iter_num = ProfilingManager::Instance().GetStepInfoIndex(); tmp_task_desc_info.task_type = op_task->GetTaskType(); std::vector task_desc_info; From d642976cb69fbd5b296372209d1becfeebacdb40 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Fri, 9 Jul 2021 16:43:43 +0800 Subject: [PATCH 175/226] Sort CMakeLists.txt SRC_LIST --- ge/CMakeLists.txt | 1102 ++++++++++++---------- ge/graph/manager/graph_manager.h | 1 - tests/ut/ge/graph/load/model_manager_unittest.cc | 33 +- 3 files changed, 624 insertions(+), 512 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 9fff30f7..eec992c8 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -2,7 +2,6 @@ if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) add_subdirectory(common) add_subdirectory(plugin/engine) add_subdirectory(ge_local_engine) - add_subdirectory(executor) add_subdirectory(offline) elseif (ENABLE_D) add_subdirectory(common) @@ -109,7 +108,346 @@ target_link_libraries(ge_proto_client PRIVATE endif () ################################################################## -set(TRAIN_SRC_LIST +set(EXECUTOR_SRC_LIST + #"analyzer/analyzer.cc" + #"client/ge_api.cc" + "common/dump/dump_manager.cc" + "common/dump/dump_op.cc" + "common/dump/dump_properties.cc" + "common/dump/exception_dumper.cc" + "common/dump/opdebug_register.cc" + #"common/formats/format_transfers/datatype_transfer.cc" + #"common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" + #"common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" + #"common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" + #"common/formats/format_transfers/format_transfer_fractal_nz.cc" + #"common/formats/format_transfers/format_transfer_fractal_z.cc" + #"common/formats/format_transfers/format_transfer_fractal_zz.cc" + #"common/formats/format_transfers/format_transfer_fracz_hwcn.cc" + #"common/formats/format_transfers/format_transfer_fracz_nchw.cc" + #"common/formats/format_transfers/format_transfer_fracz_nhwc.cc" + #"common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" + #"common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" + #"common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" + #"common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" + #"common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" + "common/formats/format_transfers/format_transfer_transpose.cc" + #"common/formats/formats.cc" + "common/formats/utils/formats_trans_utils.cc" + "common/fp16_t.cc" + "common/ge/op_tiling_manager.cc" + "common/ge/plugin_manager.cc" + #"common/helper/model_cache_helper.cc" + "common/profiling/ge_profiling.cc" + #"common/profiling/ge_runner_profiling.cc" + "common/profiling/profiling_manager.cc" + #"engine_manager/dnnengine_manager.cc" + "executor/ge_executor.cc" + "ge_local_engine/engine/host_cpu_engine.cc" + #"ge_opt_info/ge_opt_info.cc" + #"generator/ge_generator.cc" + #"generator/generator_api.cc" + #"graph/build/graph_builder.cc" + #"graph/build/label_allocator.cc" + #"graph/build/logical_stream_allocator.cc" + #"graph/build/memory/binary_block_mem_assigner.cc" + #"graph/build/memory/block_mem_assigner.cc" + #"graph/build/memory/buffer_pool_mem_assigner.cc" + #"graph/build/memory/graph_mem_assigner.cc" + #"graph/build/memory/hybrid_mem_assigner.cc" + #"graph/build/memory/max_block_mem_assigner.cc" + #"graph/build/memory/memory_assigner.cc" + "graph/build/memory/var_mem_assign_util.cc" + #"graph/build/model_builder.cc" + #"graph/build/run_context.cc" + #"graph/build/stream_allocator.cc" + #"graph/build/stream_graph_optimizer.cc" + #"graph/build/task_generator.cc" + "graph/common/bcast.cc" + "graph/common/local_context.cc" + "graph/common/omg_util.cc" + #"graph/common/transop_util.cc" + "graph/execute/graph_execute.cc" + "graph/execute/model_executor.cc" + #"graph/label/case_label_maker.cc" + #"graph/label/if_label_maker.cc" + #"graph/label/label_maker.cc" + #"graph/label/partitioned_call_label_maker.cc" + #"graph/label/while_label_maker.cc" + "graph/load/graph_loader.cc" + "graph/load/model_manager/aipp_utils.cc" + "graph/load/model_manager/cpu_queue_schedule.cc" + "graph/load/model_manager/data_dumper.cc" + "graph/load/model_manager/data_inputer.cc" + "graph/load/model_manager/davinci_model.cc" + "graph/load/model_manager/model_manager.cc" + "graph/load/model_manager/model_utils.cc" + "graph/load/model_manager/task_info/end_graph_task_info.cc" + "graph/load/model_manager/task_info/event_record_task_info.cc" + "graph/load/model_manager/task_info/event_wait_task_info.cc" + "graph/load/model_manager/task_info/ffts_task_info.cc" + "graph/load/model_manager/task_info/fusion_start_task_info.cc" + "graph/load/model_manager/task_info/fusion_stop_task_info.cc" + #"graph/load/model_manager/task_info/hccl_task_info.cc" # Just for runner. + "graph/load/model_manager/task_info/kernel_ex_task_info.cc" + "graph/load/model_manager/task_info/kernel_task_info.cc" + "graph/load/model_manager/task_info/label_goto_ex_task_info.cc" + "graph/load/model_manager/task_info/label_set_task_info.cc" + "graph/load/model_manager/task_info/label_switch_by_index_task_info.cc" + "graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc" + "graph/load/model_manager/task_info/memcpy_async_task_info.cc" + "graph/load/model_manager/task_info/model_exit_task_info.cc" + "graph/load/model_manager/task_info/profiler_trace_task_info.cc" + "graph/load/model_manager/task_info/stream_active_task_info.cc" + "graph/load/model_manager/task_info/stream_switch_task_info.cc" + "graph/load/model_manager/task_info/stream_switchn_task_info.cc" + "graph/load/model_manager/task_info/super_kernel/super_kernel.cc" + "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" + "graph/load/model_manager/task_info/task_info.cc" + "graph/load/model_manager/tbe_handle_store.cc" + "graph/load/model_manager/zero_copy_offset.cc" + "graph/load/model_manager/zero_copy_task.cc" + "graph/manager/graph_caching_allocator.cc" + #"graph/manager/graph_context.cc" + #"graph/manager/graph_manager.cc" + "graph/manager/graph_manager_utils.cc" + "graph/manager/graph_mem_allocator.cc" + "graph/manager/graph_mem_manager.cc" + "graph/manager/graph_var_manager.cc" + "graph/manager/host_mem_allocator.cc" + "graph/manager/host_mem_manager.cc" + #"graph/manager/memory_api.cc" # Just for runner. + #"graph/manager/model_manager/event_manager.cc" + "graph/manager/rdma_pool_allocator.cc" + "graph/manager/session_scope_mem_allocator.cc" + "graph/manager/trans_var_data_utils.cc" + "graph/manager/util/debug.cc" + #"graph/manager/util/hcom_util.cc" # Just for runner. + #"graph/manager/util/rt_context_util.cc" + #"graph/manager/util/variable_accelerate_ctrl.cc" + #"graph/optimize/graph_optimize.cc" + #"graph/optimize/mem_rw_conflict_optimize.cc" + #"graph/optimize/summary_optimize.cc" + #"graph/partition/dynamic_shape_partition.cc" + #"graph/partition/engine_place.cc" + #"graph/partition/graph_partition.cc" + #"graph/partition/stage_partition.cc" + #"graph/passes/addn_pass.cc" + #"graph/passes/aicpu_constant_folding_pass.cc" + #"graph/passes/assert_pass.cc" + #"graph/passes/assign_remove_pass.cc" + #"graph/passes/atomic_addr_clean_pass.cc" + #"graph/passes/attach_stream_label_pass.cc" + #"graph/passes/base_pass.cc" + #"graph/passes/bitcast_pass.cc" + #"graph/passes/buffer_pool_memory_pass.cc" + #"graph/passes/cast_remove_pass.cc" + #"graph/passes/cast_translate_pass.cc" + #"graph/passes/common_subexpression_elimination_pass.cc" + #"graph/passes/compile_nodes_pass.cc" + #"graph/passes/cond_pass.cc" + #"graph/passes/cond_remove_pass.cc" + #"graph/passes/constant_folding_pass.cc" + #"graph/passes/constant_fuse_same_pass.cc" + #"graph/passes/control_trigger_pass.cc" + #"graph/passes/ctrl_edge_transfer_pass.cc" + #"graph/passes/data_pass.cc" + #"graph/passes/dimension_adjust_pass.cc" + #"graph/passes/dimension_compute_pass.cc" + #"graph/passes/dropout_pass.cc" + #"graph/passes/end_of_sequence_add_control_pass.cc" + #"graph/passes/enter_pass.cc" + #"graph/passes/flow_ctrl_pass.cc" + #"graph/passes/folding_pass.cc" + #"graph/passes/for_pass.cc" + #"graph/passes/fuse_data_nodes_with_common_input_pass.cc" + #"graph/passes/get_original_format_pass.cc" + #"graph/passes/global_step_insert_pass.cc" + #"graph/passes/guarantee_const_pass.cc" + #"graph/passes/hccl_continuous_memcpy_pass.cc" + #"graph/passes/hccl_group_pass.cc" + #"graph/passes/hccl_memcpy_pass.cc" + #"graph/passes/hccl_tailing_optimization_pass.cc" + #"graph/passes/identity_pass.cc" + #"graph/passes/infer_base_pass.cc" + #"graph/passes/infer_value_range_pass.cc" + #"graph/passes/infershape_pass.cc" + #"graph/passes/inplace_support_check_pass.cc" + #"graph/passes/input_output_connection_identify_pass.cc" + #"graph/passes/iterator_op_pass.cc" + #"graph/passes/link_gen_mask_nodes_pass.cc" + #"graph/passes/mark_agnostic_pass.cc" + #"graph/passes/mark_force_unknown_for_cond_pass.cc" + #"graph/passes/mark_graph_unknown_status_pass.cc" + #"graph/passes/mark_node_unknown_shape_pass.cc" + #"graph/passes/mark_same_addr_pass.cc" + #"graph/passes/memcpy_addr_async_pass.cc" + #"graph/passes/merge_input_memcpy_pass.cc" + #"graph/passes/merge_pass.cc" + #"graph/passes/merge_to_stream_merge_pass.cc" + #"graph/passes/multi_batch_clone_pass.cc" + #"graph/passes/multi_batch_pass.cc" + #"graph/passes/net_output_pass.cc" + #"graph/passes/next_iteration_pass.cc" + #"graph/passes/no_use_reshape_remove_pass.cc" + #"graph/passes/parallel_concat_start_op_pass.cc" + #"graph/passes/parallel_group_pass.cc" + #"graph/passes/pass_manager.cc" + "graph/passes/pass_utils.cc" + #"graph/passes/permute_pass.cc" + #"graph/passes/placeholder_with_default_pass.cc" + #"graph/passes/prevent_gradient_pass.cc" + #"graph/passes/print_op_pass.cc" + #"graph/passes/prune_pass.cc" + #"graph/passes/ref_identity_delete_op_pass.cc" + #"graph/passes/remove_same_const_pass.cc" + #"graph/passes/replace_transshape_pass.cc" + #"graph/passes/replace_with_empty_const_pass.cc" + #"graph/passes/reshape_recovery_pass.cc" + #"graph/passes/reshape_remove_pass.cc" + #"graph/passes/resource_pair_add_control_pass.cc" + #"graph/passes/resource_pair_remove_control_pass.cc" + #"graph/passes/same_transdata_breadth_fusion_pass.cc" + #"graph/passes/save_pass.cc" + #"graph/passes/set_input_output_offset_pass.cc" + #"graph/passes/shape_operate_op_remove_pass.cc" + #"graph/passes/snapshot_pass.cc" + #"graph/passes/stop_gradient_pass.cc" + #"graph/passes/subexpression_migration_pass.cc" + #"graph/passes/subgraph_const_migration_pass.cc" + #"graph/passes/subgraph_pass.cc" + #"graph/passes/switch_data_edges_bypass.cc" + #"graph/passes/switch_dead_branch_elimination.cc" + #"graph/passes/switch_logic_remove_pass.cc" + #"graph/passes/switch_to_stream_switch_pass.cc" + #"graph/passes/transop_breadth_fusion_pass.cc" + #"graph/passes/transop_depth_fusion_pass.cc" + #"graph/passes/transop_nearby_allreduce_fusion_pass.cc" + #"graph/passes/transop_symmetry_elimination_pass.cc" + #"graph/passes/transop_without_reshape_fusion_pass.cc" + #"graph/passes/transpose_transdata_pass.cc" + #"graph/passes/unused_args_clean_pass.cc" + #"graph/passes/unused_const_pass.cc" + #"graph/passes/useless_control_out_remove_pass.cc" + #"graph/passes/var_is_initialized_op_pass.cc" + #"graph/passes/variable_op_pass.cc" + #"graph/passes/variable_prepare_op_pass.cc" + #"graph/passes/variable_ref_delete_op_pass.cc" + #"graph/passes/variable_ref_useless_control_out_delete_pass.cc" + #"graph/preprocess/graph_preprocess.cc" + #"graph/preprocess/insert_op/ge_aipp_op.cc" + #"graph/preprocess/insert_op/util_insert_aipp_op.cc" + #"graph/preprocess/multi_batch_copy_graph.cc" + #"graph/preprocess/multi_batch_options.cc" + "host_kernels/add_kernel.cc" + "host_kernels/broadcast_args_kernel.cc" + "host_kernels/broadcast_gradient_args_kernel.cc" + "host_kernels/cast_kernel.cc" + "host_kernels/concat_offset_kernel.cc" + "host_kernels/concat_v2_kernel.cc" + "host_kernels/dynamic_stitch_kernel.cc" + "host_kernels/empty_kernel.cc" + "host_kernels/expanddims_kernel.cc" + "host_kernels/fill_kernel.cc" + "host_kernels/floordiv_kernel.cc" + "host_kernels/floormod_kernel.cc" + "host_kernels/gather_v2_kernel.cc" + "host_kernels/greater_kernel.cc" + "host_kernels/identity_kernel.cc" + "host_kernels/kernel_utils.cc" + "host_kernels/maximum_kernel.cc" + "host_kernels/mul_kernel.cc" + "host_kernels/pack_kernel.cc" + "host_kernels/permute_kernel.cc" + "host_kernels/range_kernel.cc" + "host_kernels/rank_kernel.cc" + "host_kernels/reduce_prod_kernel.cc" + "host_kernels/reformat_kernel.cc" + "host_kernels/reshape_kernel.cc" + "host_kernels/rsqrt_kernel.cc" + "host_kernels/shape_kernel.cc" + "host_kernels/shape_n_kernel.cc" + "host_kernels/size_kernel.cc" + "host_kernels/slice_d_kernel.cc" + "host_kernels/slice_kernel.cc" + "host_kernels/squeeze_kernel.cc" + "host_kernels/ssd_prior_box_kernel.cc" + "host_kernels/strided_slice_kernel.cc" + "host_kernels/sub_kernel.cc" + "host_kernels/transdata_kernel.cc" + "host_kernels/transpose_kernel.cc" + "host_kernels/unpack_kernel.cc" + "host_kernels/unsqueeze_kernel.cc" + "hybrid/common/npu_memory_allocator.cc" + "hybrid/common/tensor_value.cc" + "hybrid/executor/hybrid_execution_context.cc" + "hybrid/executor/hybrid_model_async_executor.cc" + "hybrid/executor/hybrid_model_executor.cc" + "hybrid/executor/hybrid_model_pipeline_executor.cc" + "hybrid/executor/hybrid_profiler.cc" + "hybrid/executor/node_done_manager.cc" + "hybrid/executor/node_state.cc" + "hybrid/executor/rt_callback_manager.cc" + "hybrid/executor/subgraph_context.cc" + "hybrid/executor/subgraph_executor.cc" + "hybrid/executor/worker/execution_engine.cc" + "hybrid/executor/worker/shape_inference_engine.cc" + "hybrid/executor/worker/task_compile_engine.cc" + "hybrid/hybrid_davinci_model.cc" + "hybrid/model/graph_item.cc" + "hybrid/model/hybrid_model.cc" + "hybrid/model/hybrid_model_builder.cc" + "hybrid/model/node_item.cc" + "hybrid/node_executor/aicore/aicore_node_executor.cc" + "hybrid/node_executor/aicore/aicore_op_task.cc" + "hybrid/node_executor/aicore/aicore_task_builder.cc" + #"hybrid/node_executor/aicore/aicore_task_compiler.cc" + "hybrid/node_executor/aicpu/aicpu_ext_info.cc" + "hybrid/node_executor/aicpu/aicpu_node_executor.cc" + "hybrid/node_executor/compiledsubgraph/known_node_executor.cc" + "hybrid/node_executor/controlop/control_op_executor.cc" + "hybrid/node_executor/ge_local/ge_local_node_executor.cc" + #"hybrid/node_executor/hccl/hccl_node_executor.cc" # Just for runner. + "hybrid/node_executor/host_cpu/host_cpu_node_executor.cc" + "hybrid/node_executor/node_executor.cc" + "hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc" + "hybrid/node_executor/rts/rts_node_executor.cc" + "hybrid/node_executor/rts/rts_node_task.cc" + "hybrid/node_executor/rts/rts_task_factory.cc" + "hybrid/node_executor/task_context.cc" + #"init/gelib.cc" + #"ir_build/attr_options/keep_dtype_option.cc" + #"ir_build/attr_options/utils.cc" + #"ir_build/attr_options/weight_compress_option.cc" + #"ir_build/ge_ir_build.cc" + #"ir_build/option_utils.cc" + "model/ge_model.cc" + "model/ge_root_model.cc" + "opskernel_manager/ops_kernel_builder_manager.cc" + #"opskernel_manager/ops_kernel_manager.cc" + #"session/inner_session.cc" + #"session/session_manager.cc" + "single_op/single_op.cc" + "single_op/single_op_manager.cc" + "single_op/single_op_model.cc" + "single_op/stream_resource.cc" + "single_op/task/aicpu_kernel_task_builder.cc" + "single_op/task/aicpu_task_builder.cc" + "single_op/task/build_task_utils.cc" + "single_op/task/op_task.cc" + "single_op/task/rts_kernel_task_builder.cc" + "single_op/task/tbe_task_builder.cc" +) + +################################################################## +set(COMPILER_SRC_LIST + "analyzer/analyzer.cc" + "common/dump/dump_manager.cc" + "common/dump/dump_op.cc" + "common/dump/dump_properties.cc" + "common/dump/dump_server.cc" + "common/dump/exception_dumper.cc" + "common/dump/opdebug_register.cc" "common/formats/format_transfers/datatype_transfer.cc" "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" @@ -123,30 +461,33 @@ set(TRAIN_SRC_LIST "common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" "common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" "common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" + "common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" "common/formats/format_transfers/format_transfer_transpose.cc" "common/formats/formats.cc" "common/formats/utils/formats_trans_utils.cc" "common/fp16_t.cc" - "common/ge/plugin_manager.cc" "common/ge/op_tiling_manager.cc" + "common/ge/plugin_manager.cc" "common/helper/model_cache_helper.cc" "common/profiling/profiling_manager.cc" - "common/dump/dump_manager.cc" - "common/dump/exception_dumper.cc" - "common/dump/dump_properties.cc" - "common/dump/opdebug_register.cc" - "common/dump/dump_op.cc" - "common/profiling/ge_profiling.cc" - "common/profiling/ge_runner_profiling.cc" "engine_manager/dnnengine_manager.cc" "ge_local_engine/engine/host_cpu_engine.cc" + "ge_opt_info/ge_opt_info.cc" "generator/ge_generator.cc" "generator/generator_api.cc" "graph/build/graph_builder.cc" "graph/build/label_allocator.cc" "graph/build/logical_stream_allocator.cc" + "graph/build/memory/binary_block_mem_assigner.cc" + "graph/build/memory/block_mem_assigner.cc" + "graph/build/memory/buffer_pool_mem_assigner.cc" + "graph/build/memory/graph_mem_assigner.cc" + "graph/build/memory/hybrid_mem_assigner.cc" + "graph/build/memory/max_block_mem_assigner.cc" + "graph/build/memory/memory_assigner.cc" + "graph/build/memory/var_mem_assign_util.cc" "graph/build/model_builder.cc" "graph/build/run_context.cc" "graph/build/stream_allocator.cc" @@ -156,35 +497,34 @@ set(TRAIN_SRC_LIST "graph/common/local_context.cc" "graph/common/omg_util.cc" "graph/common/transop_util.cc" - "graph/execute/graph_execute.cc" + #"graph/execute/graph_execute.cc" "graph/label/case_label_maker.cc" "graph/label/if_label_maker.cc" "graph/label/label_maker.cc" "graph/label/partitioned_call_label_maker.cc" "graph/label/while_label_maker.cc" "graph/load/graph_loader.cc" + "graph/load/model_manager/aipp_utils.cc" "graph/load/model_manager/cpu_queue_schedule.cc" "graph/load/model_manager/data_dumper.cc" "graph/load/model_manager/data_inputer.cc" "graph/load/model_manager/davinci_model.cc" "graph/load/model_manager/model_manager.cc" "graph/load/model_manager/model_utils.cc" - "graph/load/model_manager/aipp_utils.cc" "graph/load/model_manager/task_info/end_graph_task_info.cc" - "graph/load/model_manager/task_info/model_exit_task_info.cc" "graph/load/model_manager/task_info/event_record_task_info.cc" "graph/load/model_manager/task_info/event_wait_task_info.cc" "graph/load/model_manager/task_info/ffts_task_info.cc" "graph/load/model_manager/task_info/fusion_start_task_info.cc" "graph/load/model_manager/task_info/fusion_stop_task_info.cc" - "graph/load/model_manager/task_info/hccl_task_info.cc" "graph/load/model_manager/task_info/kernel_ex_task_info.cc" "graph/load/model_manager/task_info/kernel_task_info.cc" + "graph/load/model_manager/task_info/label_goto_ex_task_info.cc" "graph/load/model_manager/task_info/label_set_task_info.cc" "graph/load/model_manager/task_info/label_switch_by_index_task_info.cc" - "graph/load/model_manager/task_info/label_goto_ex_task_info.cc" "graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc" "graph/load/model_manager/task_info/memcpy_async_task_info.cc" + "graph/load/model_manager/task_info/model_exit_task_info.cc" "graph/load/model_manager/task_info/profiler_trace_task_info.cc" "graph/load/model_manager/task_info/stream_active_task_info.cc" "graph/load/model_manager/task_info/stream_switch_task_info.cc" @@ -193,542 +533,209 @@ set(TRAIN_SRC_LIST "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" "graph/load/model_manager/task_info/task_info.cc" "graph/load/model_manager/tbe_handle_store.cc" - "graph/load/model_manager/zero_copy_task.cc" "graph/load/model_manager/zero_copy_offset.cc" + "graph/load/model_manager/zero_copy_task.cc" + "graph/manager/graph_caching_allocator.cc" "graph/manager/graph_context.cc" "graph/manager/graph_manager.cc" "graph/manager/graph_manager_utils.cc" "graph/manager/graph_mem_allocator.cc" - "graph/manager/graph_caching_allocator.cc" - "graph/manager/session_scope_mem_allocator.cc" + "graph/manager/graph_mem_manager.cc" "graph/manager/graph_var_manager.cc" - "graph/manager/host_mem_manager.cc" - "graph/manager/rdma_pool_allocator.cc" "graph/manager/host_mem_allocator.cc" - "graph/manager/graph_mem_manager.cc" - "graph/manager/memory_api.cc" + "graph/manager/host_mem_manager.cc" "graph/manager/model_manager/event_manager.cc" + "graph/manager/rdma_pool_allocator.cc" + "graph/manager/session_scope_mem_allocator.cc" "graph/manager/trans_var_data_utils.cc" "graph/manager/util/debug.cc" - "graph/manager/util/hcom_util.cc" "graph/manager/util/rt_context_util.cc" "graph/manager/util/variable_accelerate_ctrl.cc" "graph/optimize/graph_optimize.cc" "graph/optimize/mem_rw_conflict_optimize.cc" "graph/optimize/summary_optimize.cc" + "graph/partition/dynamic_shape_partition.cc" "graph/partition/engine_place.cc" "graph/partition/graph_partition.cc" + "graph/partition/stage_partition.cc" "graph/passes/addn_pass.cc" "graph/passes/aicpu_constant_folding_pass.cc" "graph/passes/assert_pass.cc" - "graph/passes/input_output_connection_identify_pass.cc" + "graph/passes/assign_remove_pass.cc" "graph/passes/atomic_addr_clean_pass.cc" - "graph/passes/mark_same_addr_pass.cc" - "graph/passes/mark_graph_unknown_status_pass.cc" - "graph/passes/mark_node_unknown_shape_pass.cc" - "graph/passes/mark_agnostic_pass.cc" - "graph/partition/dynamic_shape_partition.cc" - "graph/partition/stage_partition.cc" + "graph/passes/attach_stream_label_pass.cc" "graph/passes/base_pass.cc" "graph/passes/bitcast_pass.cc" + "graph/passes/buffer_pool_memory_pass.cc" "graph/passes/cast_remove_pass.cc" "graph/passes/cast_translate_pass.cc" "graph/passes/common_subexpression_elimination_pass.cc" - "graph/passes/transop_symmetry_elimination_pass.cc" "graph/passes/compile_nodes_pass.cc" + "graph/passes/cond_pass.cc" + "graph/passes/cond_remove_pass.cc" "graph/passes/constant_folding_pass.cc" "graph/passes/constant_fuse_same_pass.cc" - "graph/passes/fuse_data_nodes_with_common_input_pass.cc" - "graph/passes/remove_same_const_pass.cc" - "graph/passes/useless_control_out_remove_pass.cc" "graph/passes/control_trigger_pass.cc" + "graph/passes/ctrl_edge_transfer_pass.cc" + "graph/passes/data_pass.cc" "graph/passes/dimension_adjust_pass.cc" "graph/passes/dimension_compute_pass.cc" "graph/passes/dropout_pass.cc" - "graph/passes/hccl_group_pass.cc" - "graph/passes/hccl_tailing_optimization_pass.cc" + "graph/passes/end_of_sequence_add_control_pass.cc" "graph/passes/enter_pass.cc" - "graph/passes/assign_remove_pass.cc" - "graph/passes/inplace_support_check_pass.cc" "graph/passes/flow_ctrl_pass.cc" + "graph/passes/folding_pass.cc" + "graph/passes/for_pass.cc" + "graph/passes/fuse_data_nodes_with_common_input_pass.cc" + "graph/passes/get_original_format_pass.cc" "graph/passes/global_step_insert_pass.cc" - "host_kernels/transpose_kernel.cc" - "host_kernels/add_kernel.cc" - "host_kernels/broadcast_args_kernel.cc" - "host_kernels/broadcast_gradient_args_kernel.cc" - "host_kernels/cast_kernel.cc" - "host_kernels/concat_offset_kernel.cc" - "host_kernels/concat_v2_kernel.cc" - "host_kernels/dynamic_stitch_kernel.cc" - "host_kernels/identity_kernel.cc" - "host_kernels/empty_kernel.cc" - "host_kernels/expanddims_kernel.cc" - "host_kernels/fill_kernel.cc" - "host_kernels/floordiv_kernel.cc" - "host_kernels/floormod_kernel.cc" - "host_kernels/gather_v2_kernel.cc" - "host_kernels/greater_kernel.cc" - "host_kernels/kernel_utils.cc" - "host_kernels/maximum_kernel.cc" - "host_kernels/mul_kernel.cc" - "host_kernels/pack_kernel.cc" - "host_kernels/permute_kernel.cc" - "host_kernels/range_kernel.cc" - "host_kernels/rank_kernel.cc" - "host_kernels/reduce_prod_kernel.cc" - "host_kernels/reshape_kernel.cc" - "host_kernels/rsqrt_kernel.cc" - "host_kernels/shape_kernel.cc" - "host_kernels/shape_n_kernel.cc" - "host_kernels/size_kernel.cc" - "host_kernels/slice_d_kernel.cc" - "host_kernels/slice_kernel.cc" - "host_kernels/squeeze_kernel.cc" - "host_kernels/unsqueeze_kernel.cc" - "host_kernels/ssd_prior_box_kernel.cc" - "host_kernels/strided_slice_kernel.cc" - "host_kernels/sub_kernel.cc" - "host_kernels/transdata_kernel.cc" - "host_kernels/unpack_kernel.cc" - "host_kernels/reformat_kernel.cc" - "graph/passes/folding_pass.cc" - "graph/passes/get_original_format_pass.cc" "graph/passes/guarantee_const_pass.cc" - "graph/passes/hccl_memcpy_pass.cc" "graph/passes/hccl_continuous_memcpy_pass.cc" + "graph/passes/hccl_group_pass.cc" + "graph/passes/hccl_memcpy_pass.cc" + "graph/passes/hccl_tailing_optimization_pass.cc" "graph/passes/identity_pass.cc" - "graph/passes/ref_identity_delete_op_pass.cc" "graph/passes/infer_base_pass.cc" - "graph/passes/infershape_pass.cc" "graph/passes/infer_value_range_pass.cc" + "graph/passes/infershape_pass.cc" + "graph/passes/inplace_support_check_pass.cc" + "graph/passes/input_output_connection_identify_pass.cc" "graph/passes/iterator_op_pass.cc" "graph/passes/link_gen_mask_nodes_pass.cc" + "graph/passes/mark_agnostic_pass.cc" + "graph/passes/mark_force_unknown_for_cond_pass.cc" + "graph/passes/mark_graph_unknown_status_pass.cc" + "graph/passes/mark_node_unknown_shape_pass.cc" + "graph/passes/mark_same_addr_pass.cc" + "graph/passes/memcpy_addr_async_pass.cc" + "graph/passes/merge_input_memcpy_pass.cc" "graph/passes/merge_pass.cc" - "graph/passes/multi_batch_pass.cc" + "graph/passes/merge_to_stream_merge_pass.cc" "graph/passes/multi_batch_clone_pass.cc" - "graph/passes/subexpression_migration_pass.cc" - "graph/passes/subgraph_const_migration_pass.cc" - "graph/passes/unused_args_clean_pass.cc" + "graph/passes/multi_batch_pass.cc" "graph/passes/net_output_pass.cc" "graph/passes/next_iteration_pass.cc" "graph/passes/no_use_reshape_remove_pass.cc" - "graph/passes/pass_manager.cc" - "graph/passes/pass_utils.cc" - "graph/passes/permute_pass.cc" - "graph/passes/placeholder_with_default_pass.cc" - "graph/passes/prevent_gradient_pass.cc" - "graph/passes/print_op_pass.cc" - "graph/passes/prune_pass.cc" - "graph/passes/ctrl_edge_transfer_pass.cc" - "graph/passes/replace_with_empty_const_pass.cc" - "graph/passes/reshape_remove_pass.cc" - "graph/passes/reshape_recovery_pass.cc" - "graph/passes/resource_pair_add_control_pass.cc" - "graph/passes/resource_pair_remove_control_pass.cc" - "graph/passes/same_transdata_breadth_fusion_pass.cc" - "graph/passes/save_pass.cc" - "graph/passes/shape_operate_op_remove_pass.cc" - "graph/passes/snapshot_pass.cc" - "graph/passes/stop_gradient_pass.cc" - "graph/passes/subgraph_pass.cc" - "graph/passes/data_pass.cc" - "graph/passes/switch_data_edges_bypass.cc" - "graph/passes/switch_logic_remove_pass.cc" - "graph/passes/merge_to_stream_merge_pass.cc" - "graph/passes/merge_input_memcpy_pass.cc" - "graph/passes/switch_to_stream_switch_pass.cc" - "graph/passes/mark_force_unknown_for_cond_pass.cc" - "graph/passes/attach_stream_label_pass.cc" - "graph/passes/switch_dead_branch_elimination.cc" - "graph/passes/replace_transshape_pass.cc" - "graph/passes/transop_breadth_fusion_pass.cc" - "graph/passes/transop_depth_fusion_pass.cc" - "graph/passes/transop_nearby_allreduce_fusion_pass.cc" - "graph/passes/transop_without_reshape_fusion_pass.cc" - "graph/passes/transpose_transdata_pass.cc" - "graph/passes/unused_const_pass.cc" - "graph/passes/var_is_initialized_op_pass.cc" "graph/passes/parallel_concat_start_op_pass.cc" - "graph/passes/cond_pass.cc" - "graph/passes/cond_remove_pass.cc" - "graph/passes/for_pass.cc" - "graph/passes/variable_op_pass.cc" - "graph/passes/variable_prepare_op_pass.cc" - "graph/passes/variable_ref_delete_op_pass.cc" - "graph/passes/variable_ref_useless_control_out_delete_pass.cc" - "graph/passes/end_of_sequence_add_control_pass.cc" - "graph/passes/memcpy_addr_async_pass.cc" "graph/passes/parallel_group_pass.cc" - "graph/passes/set_input_output_offset_pass.cc" - "graph/passes/buffer_pool_memory_pass.cc" - "graph/preprocess/graph_preprocess.cc" - "graph/preprocess/insert_op/ge_aipp_op.cc" - "graph/preprocess/insert_op/util_insert_aipp_op.cc" - "graph/preprocess/multi_batch_options.cc" - "graph/preprocess/multi_batch_copy_graph.cc" - "init/gelib.cc" - "model/ge_model.cc" - "model/ge_root_model.cc" - "opskernel_manager/ops_kernel_manager.cc" - "opskernel_manager/ops_kernel_builder_manager.cc" - "session/inner_session.cc" - "session/session_manager.cc" - "graph/execute/model_executor.cc" - "single_op/single_op.cc" - "single_op/single_op_manager.cc" - "single_op/single_op_model.cc" - "single_op/stream_resource.cc" - "single_op/task/build_task_utils.cc" - "single_op/task/op_task.cc" - "single_op/task/tbe_task_builder.cc" - "single_op/task/aicpu_task_builder.cc" - "single_op/task/aicpu_kernel_task_builder.cc" - "single_op/task/rts_kernel_task_builder.cc" - "hybrid/common/tensor_value.cc" - "hybrid/common/npu_memory_allocator.cc" - "hybrid/executor/rt_callback_manager.cc" - "hybrid/executor/node_state.cc" - "hybrid/executor/node_done_manager.cc" - "hybrid/executor/hybrid_profiler.cc" - "hybrid/executor/hybrid_model_executor.cc" - "hybrid/executor/hybrid_model_pipeline_executor.cc" - "hybrid/executor/hybrid_model_async_executor.cc" - "hybrid/executor/hybrid_execution_context.cc" - "hybrid/executor/subgraph_context.cc" - "hybrid/executor/subgraph_executor.cc" - "hybrid/executor/worker/task_compile_engine.cc" - "hybrid/executor/worker/shape_inference_engine.cc" - "hybrid/executor/worker/execution_engine.cc" - "hybrid/model/hybrid_model.cc" - "hybrid/model/hybrid_model_builder.cc" - "hybrid/model/node_item.cc" - "hybrid/model/graph_item.cc" - "hybrid/node_executor/aicore/aicore_node_executor.cc" - "hybrid/node_executor/aicore/aicore_op_task.cc" - "hybrid/node_executor/aicore/aicore_task_builder.cc" - "hybrid/node_executor/aicore/aicore_task_compiler.cc" - "hybrid/node_executor/aicpu/aicpu_ext_info.cc" - "hybrid/node_executor/aicpu/aicpu_node_executor.cc" - "hybrid/node_executor/compiledsubgraph/known_node_executor.cc" - "hybrid/node_executor/ge_local/ge_local_node_executor.cc" - "hybrid/node_executor/host_cpu/host_cpu_node_executor.cc" - "hybrid/node_executor/controlop/control_op_executor.cc" - "hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc" - "hybrid/node_executor/hccl/hccl_node_executor.cc" - "hybrid/node_executor/rts/rts_node_executor.cc" - "hybrid/node_executor/rts/rts_node_task.cc" - "hybrid/node_executor/rts/rts_task_factory.cc" - "hybrid/node_executor/node_executor.cc" - "hybrid/node_executor/task_context.cc" - "hybrid/hybrid_davinci_model.cc" - "executor/ge_executor.cc" - "client/ge_api.cc" - "analyzer/analyzer.cc" - "ir_build/ge_ir_build.cc" - "ir_build/attr_options/utils.cc" - "ir_build/attr_options/keep_dtype_option.cc" - "ir_build/attr_options/weight_compress_option.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" - "graph/build/memory/block_mem_assigner.cc" - "graph/build/memory/hybrid_mem_assigner.cc" - "graph/build/memory/max_block_mem_assigner.cc" - "graph/build/memory/var_mem_assign_util.cc" - "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" -) - -set(INFER_SRC_LIST - "graph/manager/trans_var_data_utils.cc" - "common/fp16_t.cc" - "common/formats/utils/formats_trans_utils.cc" - "common/formats/format_transfers/datatype_transfer.cc" - "common/formats/format_transfers/format_transfer_transpose.cc" - "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_fractal_z.cc" - "common/formats/format_transfers/format_transfer_fractal_nz.cc" - "common/formats/format_transfers/format_transfer_fractal_zz.cc" - "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" - "common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" - "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" - "common/formats/format_transfers/format_transfer_fracz_nchw.cc" - "common/formats/format_transfers/format_transfer_fracz_nhwc.cc" - "common/formats/format_transfers/format_transfer_fracz_hwcn.cc" - "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" - "common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" - "common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" - "common/formats/formats.cc" - "common/profiling/profiling_manager.cc" - "common/dump/dump_properties.cc" - "common/dump/exception_dumper.cc" - "common/dump/dump_manager.cc" - "common/dump/dump_op.cc" - "common/dump/opdebug_register.cc" - "common/dump/dump_server.cc" - "common/helper/model_cache_helper.cc" - "ge_local_engine/engine/host_cpu_engine.cc" - "common/ge/plugin_manager.cc" - "common/ge/op_tiling_manager.cc" - "init/gelib.cc" - "engine_manager/dnnengine_manager.cc" - "opskernel_manager/ops_kernel_manager.cc" - "opskernel_manager/ops_kernel_builder_manager.cc" - "graph/manager/graph_manager.cc" - "graph/manager/graph_manager_utils.cc" - "graph/manager/graph_context.cc" - "graph/preprocess/graph_preprocess.cc" - "graph/preprocess/multi_batch_options.cc" - "graph/preprocess/multi_batch_copy_graph.cc" - "graph/execute/graph_execute.cc" - "graph/load/graph_loader.cc" - "graph/optimize/graph_optimize.cc" - "graph/optimize/mem_rw_conflict_optimize.cc" - "graph/optimize/summary_optimize.cc" - "graph/build/graph_builder.cc" - "graph/partition/engine_place.cc" - "graph/partition/graph_partition.cc" - "graph/partition/dynamic_shape_partition.cc" - "graph/partition/stage_partition.cc" - "generator/ge_generator.cc" - "generator/generator_api.cc" - "graph/manager/graph_var_manager.cc" - "graph/manager/host_mem_manager.cc" - "graph/manager/rdma_pool_allocator.cc" - "graph/manager/host_mem_allocator.cc" - "graph/manager/graph_mem_allocator.cc" - "graph/manager/graph_caching_allocator.cc" - "graph/manager/session_scope_mem_allocator.cc" - "graph/manager/graph_mem_manager.cc" - "model/ge_model.cc" - "model/ge_root_model.cc" - "graph/common/transop_util.cc" "graph/passes/pass_manager.cc" - "graph/passes/resource_pair_add_control_pass.cc" - "graph/passes/resource_pair_remove_control_pass.cc" "graph/passes/pass_utils.cc" - "graph/passes/base_pass.cc" - "graph/passes/bitcast_pass.cc" - "graph/passes/constant_folding_pass.cc" - "graph/passes/aicpu_constant_folding_pass.cc" - "graph/passes/reshape_remove_pass.cc" - "graph/passes/reshape_recovery_pass.cc" - "graph/passes/transop_breadth_fusion_pass.cc" - "graph/passes/transop_depth_fusion_pass.cc" - "graph/passes/transop_nearby_allreduce_fusion_pass.cc" - "graph/passes/same_transdata_breadth_fusion_pass.cc" - "graph/passes/transop_without_reshape_fusion_pass.cc" - "graph/passes/compile_nodes_pass.cc" - "graph/passes/variable_prepare_op_pass.cc" - "graph/passes/variable_ref_delete_op_pass.cc" - "graph/passes/variable_ref_useless_control_out_delete_pass.cc" - "graph/passes/subgraph_pass.cc" - "graph/passes/data_pass.cc" - "graph/passes/net_output_pass.cc" - "graph/passes/replace_transshape_pass.cc" - "graph/passes/constant_fuse_same_pass.cc" - "graph/passes/fuse_data_nodes_with_common_input_pass.cc" - "graph/passes/print_op_pass.cc" - "graph/passes/no_use_reshape_remove_pass.cc" - "graph/passes/iterator_op_pass.cc" - "graph/passes/input_output_connection_identify_pass.cc" - "graph/passes/atomic_addr_clean_pass.cc" - "graph/passes/mark_same_addr_pass.cc" - "graph/passes/mark_graph_unknown_status_pass.cc" - "graph/passes/mark_node_unknown_shape_pass.cc" - "graph/passes/mark_agnostic_pass.cc" - "graph/common/omg_util.cc" - "graph/common/bcast.cc" - "graph/common/local_context.cc" - "graph/passes/dimension_compute_pass.cc" - "graph/passes/dimension_adjust_pass.cc" - "graph/passes/get_original_format_pass.cc" - "graph/passes/shape_operate_op_remove_pass.cc" - "graph/passes/assert_pass.cc" - "graph/passes/dropout_pass.cc" - "graph/passes/infer_base_pass.cc" - "graph/passes/infershape_pass.cc" - "graph/passes/infer_value_range_pass.cc" - "graph/passes/unused_const_pass.cc" "graph/passes/permute_pass.cc" - "graph/passes/ctrl_edge_transfer_pass.cc" - "graph/passes/end_of_sequence_add_control_pass.cc" - "host_kernels/broadcast_gradient_args_kernel.cc" - "host_kernels/greater_kernel.cc" - "host_kernels/gather_v2_kernel.cc" - "host_kernels/maximum_kernel.cc" - "host_kernels/floormod_kernel.cc" - "host_kernels/floordiv_kernel.cc" - "host_kernels/range_kernel.cc" - "host_kernels/shape_kernel.cc" - "host_kernels/size_kernel.cc" - "host_kernels/shape_n_kernel.cc" - "host_kernels/rank_kernel.cc" - "host_kernels/broadcast_args_kernel.cc" - "host_kernels/fill_kernel.cc" - "host_kernels/empty_kernel.cc" - "host_kernels/expanddims_kernel.cc" - "host_kernels/reshape_kernel.cc" - "host_kernels/squeeze_kernel.cc" - "host_kernels/unsqueeze_kernel.cc" - "host_kernels/kernel_utils.cc" - "host_kernels/cast_kernel.cc" - "host_kernels/transdata_kernel.cc" - "host_kernels/unpack_kernel.cc" - "host_kernels/transpose_kernel.cc" - "host_kernels/permute_kernel.cc" - "host_kernels/pack_kernel.cc" - "host_kernels/concat_v2_kernel.cc" - "host_kernels/concat_offset_kernel.cc" - "host_kernels/strided_slice_kernel.cc" - "host_kernels/ssd_prior_box_kernel.cc" - "host_kernels/add_kernel.cc" - "host_kernels/sub_kernel.cc" - "host_kernels/mul_kernel.cc" - "host_kernels/reduce_prod_kernel.cc" - "host_kernels/rsqrt_kernel.cc" - "host_kernels/slice_kernel.cc" - "host_kernels/slice_d_kernel.cc" - "host_kernels/dynamic_stitch_kernel.cc" - "host_kernels/identity_kernel.cc" - "host_kernels/reformat_kernel.cc" - "graph/passes/stop_gradient_pass.cc" - "graph/passes/prevent_gradient_pass.cc" - "graph/passes/identity_pass.cc" - "graph/passes/ref_identity_delete_op_pass.cc" "graph/passes/placeholder_with_default_pass.cc" - "graph/passes/snapshot_pass.cc" - "graph/passes/guarantee_const_pass.cc" - "graph/passes/var_is_initialized_op_pass.cc" - "graph/passes/parallel_concat_start_op_pass.cc" - "graph/passes/folding_pass.cc" - "graph/passes/cast_translate_pass.cc" - "graph/passes/prune_pass.cc" - "graph/passes/merge_to_stream_merge_pass.cc" - "graph/passes/merge_input_memcpy_pass.cc" - "graph/passes/switch_to_stream_switch_pass.cc" - "graph/passes/mark_force_unknown_for_cond_pass.cc" - "graph/passes/attach_stream_label_pass.cc" - "graph/passes/multi_batch_pass.cc" - "graph/passes/multi_batch_clone_pass.cc" - "graph/passes/subexpression_migration_pass.cc" - "graph/passes/subgraph_const_migration_pass.cc" - "graph/passes/unused_args_clean_pass.cc" - "graph/passes/next_iteration_pass.cc" - "graph/passes/control_trigger_pass.cc" - "graph/passes/cond_pass.cc" - "graph/passes/cond_remove_pass.cc" - "graph/passes/for_pass.cc" - "graph/passes/enter_pass.cc" - "graph/passes/assign_remove_pass.cc" - "graph/passes/inplace_support_check_pass.cc" - "graph/passes/addn_pass.cc" - "graph/passes/common_subexpression_elimination_pass.cc" + "graph/passes/prevent_gradient_pass.cc" + "graph/passes/print_op_pass.cc" + "graph/passes/prune_pass.cc" + "graph/passes/ref_identity_delete_op_pass.cc" "graph/passes/remove_same_const_pass.cc" - "graph/passes/useless_control_out_remove_pass.cc" - "graph/passes/transop_symmetry_elimination_pass.cc" + "graph/passes/replace_transshape_pass.cc" + "graph/passes/replace_with_empty_const_pass.cc" + "graph/passes/reshape_recovery_pass.cc" + "graph/passes/reshape_remove_pass.cc" + "graph/passes/resource_pair_add_control_pass.cc" + "graph/passes/resource_pair_remove_control_pass.cc" + "graph/passes/same_transdata_breadth_fusion_pass.cc" "graph/passes/save_pass.cc" + "graph/passes/set_input_output_offset_pass.cc" + "graph/passes/shape_operate_op_remove_pass.cc" + "graph/passes/snapshot_pass.cc" + "graph/passes/stop_gradient_pass.cc" + "graph/passes/subexpression_migration_pass.cc" + "graph/passes/subgraph_const_migration_pass.cc" + "graph/passes/subgraph_pass.cc" + "graph/passes/switch_data_edges_bypass.cc" "graph/passes/switch_dead_branch_elimination.cc" "graph/passes/switch_logic_remove_pass.cc" - "graph/passes/switch_data_edges_bypass.cc" - "graph/passes/merge_pass.cc" - "graph/passes/variable_op_pass.cc" - "graph/passes/cast_remove_pass.cc" + "graph/passes/switch_to_stream_switch_pass.cc" + "graph/passes/transop_breadth_fusion_pass.cc" + "graph/passes/transop_depth_fusion_pass.cc" + "graph/passes/transop_nearby_allreduce_fusion_pass.cc" + "graph/passes/transop_symmetry_elimination_pass.cc" + "graph/passes/transop_without_reshape_fusion_pass.cc" "graph/passes/transpose_transdata_pass.cc" - "graph/passes/hccl_memcpy_pass.cc" - "graph/passes/hccl_continuous_memcpy_pass.cc" - "graph/passes/flow_ctrl_pass.cc" - "graph/passes/global_step_insert_pass.cc" - "graph/passes/link_gen_mask_nodes_pass.cc" - "graph/passes/replace_with_empty_const_pass.cc" - "graph/passes/hccl_group_pass.cc" - "graph/passes/hccl_tailing_optimization_pass.cc" - "graph/passes/memcpy_addr_async_pass.cc" - "graph/passes/set_input_output_offset_pass.cc" - "graph/passes/parallel_group_pass.cc" - "graph/passes/buffer_pool_memory_pass.cc" - "graph/manager/model_manager/event_manager.cc" - "graph/manager/util/rt_context_util.cc" - "graph/manager/util/variable_accelerate_ctrl.cc" - "graph/manager/util/debug.cc" - "graph/load/model_manager/model_manager.cc" - "graph/load/model_manager/data_inputer.cc" - "graph/load/model_manager/davinci_model.cc" - "graph/load/model_manager/model_utils.cc" - "graph/load/model_manager/aipp_utils.cc" - "graph/load/model_manager/tbe_handle_store.cc" - "graph/load/model_manager/cpu_queue_schedule.cc" - "graph/load/model_manager/zero_copy_task.cc" - "graph/load/model_manager/zero_copy_offset.cc" - "graph/load/model_manager/data_dumper.cc" - "graph/load/model_manager/task_info/task_info.cc" - "graph/load/model_manager/task_info/event_record_task_info.cc" - "graph/load/model_manager/task_info/event_wait_task_info.cc" - "graph/load/model_manager/task_info/ffts_task_info.cc" - "graph/load/model_manager/task_info/fusion_start_task_info.cc" - "graph/load/model_manager/task_info/fusion_stop_task_info.cc" - "graph/load/model_manager/task_info/kernel_ex_task_info.cc" - "graph/load/model_manager/task_info/kernel_task_info.cc" - "graph/load/model_manager/task_info/label_set_task_info.cc" - "graph/load/model_manager/task_info/label_switch_by_index_task_info.cc" - "graph/load/model_manager/task_info/label_goto_ex_task_info.cc" - "graph/load/model_manager/task_info/memcpy_async_task_info.cc" - "graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc" - "graph/load/model_manager/task_info/profiler_trace_task_info.cc" - "graph/load/model_manager/task_info/stream_active_task_info.cc" - "graph/load/model_manager/task_info/stream_switch_task_info.cc" - "graph/load/model_manager/task_info/stream_switchn_task_info.cc" - "graph/load/model_manager/task_info/end_graph_task_info.cc" - "graph/load/model_manager/task_info/model_exit_task_info.cc" - "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" - "graph/load/model_manager/task_info/super_kernel/super_kernel.cc" - "hybrid/hybrid_davinci_model_stub.cc" - "ir_build/ge_ir_build.cc" - "ir_build/attr_options/utils.cc" - "ir_build/attr_options/keep_dtype_option.cc" - "ir_build/attr_options/weight_compress_option.cc" - "ir_build/option_utils.cc" + "graph/passes/unused_args_clean_pass.cc" + "graph/passes/unused_const_pass.cc" + "graph/passes/useless_control_out_remove_pass.cc" + "graph/passes/var_is_initialized_op_pass.cc" + "graph/passes/variable_op_pass.cc" + "graph/passes/variable_prepare_op_pass.cc" + "graph/passes/variable_ref_delete_op_pass.cc" + "graph/passes/variable_ref_useless_control_out_delete_pass.cc" + "graph/preprocess/graph_preprocess.cc" "graph/preprocess/insert_op/ge_aipp_op.cc" "graph/preprocess/insert_op/util_insert_aipp_op.cc" + "graph/preprocess/multi_batch_copy_graph.cc" + "graph/preprocess/multi_batch_options.cc" + "host_kernels/add_kernel.cc" + "host_kernels/broadcast_args_kernel.cc" + "host_kernels/broadcast_gradient_args_kernel.cc" + "host_kernels/cast_kernel.cc" + "host_kernels/concat_offset_kernel.cc" + "host_kernels/concat_v2_kernel.cc" + "host_kernels/dynamic_stitch_kernel.cc" + "host_kernels/empty_kernel.cc" + "host_kernels/expanddims_kernel.cc" + "host_kernels/fill_kernel.cc" + "host_kernels/floordiv_kernel.cc" + "host_kernels/floormod_kernel.cc" + "host_kernels/gather_v2_kernel.cc" + "host_kernels/greater_kernel.cc" + "host_kernels/identity_kernel.cc" + "host_kernels/kernel_utils.cc" + "host_kernels/maximum_kernel.cc" + "host_kernels/mul_kernel.cc" + "host_kernels/pack_kernel.cc" + "host_kernels/permute_kernel.cc" + "host_kernels/range_kernel.cc" + "host_kernels/rank_kernel.cc" + "host_kernels/reduce_prod_kernel.cc" + "host_kernels/reformat_kernel.cc" + "host_kernels/reshape_kernel.cc" + "host_kernels/rsqrt_kernel.cc" + "host_kernels/shape_kernel.cc" + "host_kernels/shape_n_kernel.cc" + "host_kernels/size_kernel.cc" + "host_kernels/slice_d_kernel.cc" + "host_kernels/slice_kernel.cc" + "host_kernels/squeeze_kernel.cc" + "host_kernels/ssd_prior_box_kernel.cc" + "host_kernels/strided_slice_kernel.cc" + "host_kernels/sub_kernel.cc" + "host_kernels/transdata_kernel.cc" + "host_kernels/transpose_kernel.cc" + "host_kernels/unpack_kernel.cc" + "host_kernels/unsqueeze_kernel.cc" + #"hybrid/hybrid_davinci_model_stub.cc" "hybrid/node_executor/aicpu/aicpu_ext_info.cc" - "graph/build/model_builder.cc" - "graph/build/task_generator.cc" - "graph/build/stream_allocator.cc" - "graph/build/logical_stream_allocator.cc" - "graph/build/stream_graph_optimizer.cc" - "graph/build/run_context.cc" - "graph/build/label_allocator.cc" - "graph/label/label_maker.cc" - "graph/label/if_label_maker.cc" - "graph/label/case_label_maker.cc" - "graph/label/while_label_maker.cc" - "graph/label/partitioned_call_label_maker.cc" - "analyzer/analyzer.cc" - "graph/build/memory/memory_assigner.cc" - "graph/build/memory/graph_mem_assigner.cc" - "graph/build/memory/binary_block_mem_assigner.cc" - "graph/build/memory/block_mem_assigner.cc" - "graph/build/memory/hybrid_mem_assigner.cc" - "graph/build/memory/max_block_mem_assigner.cc" - "graph/build/memory/var_mem_assign_util.cc" - "graph/build/memory/buffer_pool_mem_assigner.cc" - "ge_opt_info/ge_opt_info.cc" + "init/gelib.cc" + "ir_build/attr_options/keep_dtype_option.cc" + "ir_build/attr_options/utils.cc" + "ir_build/attr_options/weight_compress_option.cc" + "ir_build/ge_ir_build.cc" + "ir_build/option_utils.cc" + "model/ge_model.cc" + "model/ge_root_model.cc" + "opskernel_manager/ops_kernel_builder_manager.cc" + "opskernel_manager/ops_kernel_manager.cc" ) set(RUNNER_SRC_LIST "client/ge_api.cc" "session/inner_session.cc" "session/session_manager.cc" + "common/profiling/ge_runner_profiling.cc" + "graph/manager/memory_api.cc" + "graph/manager/util/hcom_util.cc" + "graph/load/model_manager/task_info/hccl_task_info.cc" + "hybrid/node_executor/hccl/hccl_node_executor.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") ############ libge_runner.so ############ add_library(ge_runner SHARED - ${TRAIN_SRC_LIST} + ${EXECUTOR_SRC_LIST} + ${COMPILER_SRC_LIST} + ${RUNNER_SRC_LIST} $,msprofiler_fwk,msprofiler_fwk_object>> ) @@ -777,6 +784,8 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external ${GE_CODE_DIR}/../abl/licctrl + ${GE_CODE_DIR}/../ace/comop/inc + ${GE_CODE_DIR}/../ace/comop/inc/external #### blue zone ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include @@ -814,7 +823,8 @@ target_link_libraries(ge_runner PRIVATE ############ libge_compiler.so ############ add_library(ge_compiler SHARED - ${INFER_SRC_LIST} + "hybrid/hybrid_davinci_model_stub.cc" + ${COMPILER_SRC_LIST} ) add_dependencies(ge_compiler @@ -854,6 +864,8 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external ${GE_CODE_DIR}/../abl/adump/external ${GE_CODE_DIR}/../abl/licctrl + ${GE_CODE_DIR}/../ace/comop/inc + ${GE_CODE_DIR}/../ace/comop/inc/external #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include @@ -886,6 +898,138 @@ target_link_libraries(ge_compiler PRIVATE -ldl ) +######## libge_executor.a ######## +add_library(ge_executor STATIC + ${EXECUTOR_SRC_LIST} +) + +add_dependencies(ge_executor + graphengine_protos +) + +target_compile_options(ge_executor PRIVATE + $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> + $<$,$>:/MTd> + $<$,$>:/MT> + $<$:-Werror=unused-variable> + $<$:-Werror=unused-const-variable -Werror=format> +) + +target_compile_definitions(ge_executor PRIVATE + PROTOBUF_INLINE_NOT_IN_HEADERS=0 + DAVINCI_SUPPORT_PROFILING + google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> + $<$:ONLY_COMPILE_OPEN_SRC> + LOG_CPP +) + +target_include_directories(ge_executor SYSTEM PRIVATE + ${GE_CODE_DIR}/ge + ${GE_CODE_DIR}/inc + ${GE_CODE_DIR}/inc/external + ${GE_CODE_DIR}/inc/framework + ${METADEF_DIR}/inc + ${METADEF_DIR}/inc/external + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/graphengine_protos + #### yellow zone #### + ${GE_CODE_DIR}/../ace/comop/inc + ${GE_CODE_DIR}/../ace/comop/inc/external + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:$> + $<$>:$> + #### blue zone #### + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> +) + +target_link_libraries(ge_executor PRIVATE + $ + $<$>:$> + $<$>:$> + $<$>:$> + json + ascend_protobuf_static + c_sec + $<$>:-lrt> + -ldl +) + +######## libge_executor.so ######## +add_library(ge_executor_shared SHARED + ${EXECUTOR_SRC_LIST} +) + +add_dependencies(ge_executor_shared + graphengine_protos +) + +target_compile_options(ge_executor_shared PRIVATE + -fno-common + -Werror + -O2 + -Wno-deprecated-declarations + -fvisibility=hidden +) + +target_compile_definitions(ge_executor_shared PRIVATE + PROTOBUF_INLINE_NOT_IN_HEADERS=0 + DAVINCI_SUPPORT_PROFILING + google=ascend_private + FUNC_VISIBILITY + $<$:ONLY_COMPILE_OPEN_SRC> +) + +target_include_directories(ge_executor_shared PRIVATE + ${GE_CODE_DIR}/ge + ${GE_CODE_DIR}/inc + ${GE_CODE_DIR}/inc/external + ${GE_CODE_DIR}/inc/framework + ${METADEF_DIR}/inc + ${METADEF_DIR}/inc/external + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/graphengine_protos + #### yellow zone #### + ${GE_CODE_DIR}/../ace/comop/inc + ${GE_CODE_DIR}/../ace/comop/inc/external + $<$>:${GE_DEPEND_DIR}/inc> + #### blue zone #### + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> +) + +target_link_options(ge_executor_shared PRIVATE + -Wl,-Bsymbolic + -Wl,--exclude-libs,ALL +) + +target_link_libraries(ge_executor_shared PRIVATE + $ + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> + -Wl,--no-as-needed + ge_common + runtime + slog + graph + register + error_manager + ascend_protobuf + c_sec + -Wl,--as-needed + json + $<$>:-lrt> + -ldl +) + +set_target_properties(ge_executor_shared PROPERTIES + OUTPUT_NAME ge_executor +) + ############ libascendcl.so ############ file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") #add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) @@ -1081,7 +1225,7 @@ add_custom_command( set(INSTALL_BASE_DIR "") set(INSTALL_LIBRARY_DIR lib) -install(TARGETS ge_runner ge_compiler opensrc_ascendcl OPTIONAL +install(TARGETS ge_runner ge_compiler ge_executor_shared opensrc_ascendcl OPTIONAL LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} ) diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 6773787c..763654bd 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -32,7 +32,6 @@ #include "external/ge/ge_api_types.h" #include "graph/build/graph_builder.h" #include "graph/ge_local_context.h" -#include "graph/load/graph_loader.h" #include "graph/manager/graph_manager_utils.h" #include "graph/manager/util/variable_accelerate_ctrl.h" #include "graph/optimize/graph_optimize.h" diff --git a/tests/ut/ge/graph/load/model_manager_unittest.cc b/tests/ut/ge/graph/load/model_manager_unittest.cc index a0644510..166ae4af 100644 --- a/tests/ut/ge/graph/load/model_manager_unittest.cc +++ b/tests/ut/ge/graph/load/model_manager_unittest.cc @@ -54,31 +54,13 @@ class UtestModelManagerModelManager : public testing::Test { } void SetUp() {} - void TearDown() {} - void CreateGraph(Graph &graph) { - TensorDesc desc(ge::Shape({1, 3, 224, 224})); - uint32_t size = desc.GetShape().GetShapeSize(); - desc.SetSize(size); - auto data = op::Data("Data").set_attr_index(0); - data.update_input_desc_data(desc); - data.update_output_desc_out(desc); - - auto flatten = op::Flatten("Flatten").set_input_x(data, data.name_out_out()); - - std::vector inputs{data}; - std::vector outputs{flatten}; - std::vector targets{flatten}; - // Graph graph("test_graph"); - graph.SetInputs(inputs).SetOutputs(outputs).SetTargets(targets); - } - void GenUnencryptModelData(ModelData &data) { const int model_len = 10; data.model_len = sizeof(ModelFileHeader) + model_len; data.model_data = new uint8_t[data.model_len]; - memset((uint8_t *)data.model_data + sizeof(ModelFileHeader), 0, model_len); + memset(data.model_data, 0, data.model_len); ModelFileHeader *header = (ModelFileHeader *)data.model_data; header->magic = MODEL_FILE_MAGIC_NUM; @@ -88,19 +70,6 @@ class UtestModelManagerModelManager : public testing::Test { header->is_checksum = ModelCheckType::CHECK; } - void GenEncryptModelData(ModelData &data) { - const int model_len = 10; - data.key = ENC_KEY; - data.model_data = new uint8_t[data.model_len]; - uint8_t data_ori[model_len]; - memset(data_ori, 0, model_len); - ModelFileHeader *header = (ModelFileHeader *)data.model_data; - header->magic = MODEL_FILE_MAGIC_NUM; - header->version = MODEL_VERSION; - header->is_encrypt = ModelEncryptType::ENCRYPTED; - header->length = 10; // encrypt_len; - } - void LoadStandardModelData(ModelData &data) { data.model_len = 512; data.model_data = new uint8_t[data.model_len]; From eb0d262cb64d8acebe453714aa895d7714fb432e Mon Sep 17 00:00:00 2001 From: wuweikang Date: Fri, 9 Jul 2021 17:30:33 +0800 Subject: [PATCH 176/226] update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 84e7ab39..3ace5b6f 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 84e7ab39b0daf7ca2b2f5549e3279647da7875e2 +Subproject commit 3ace5b6f10e0af784a1c3211fd769d6e8860e864 diff --git a/parser b/parser index ffd94df4..db68a1a4 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit ffd94df471f7dd2b1928cc8d27e43e7210aaa7e7 +Subproject commit db68a1a4f1a6ae69dbf9a5f338392d50ea3874e3 From fdab42b28ddb2f2a54b681205c7175dd57850844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=A3=8A?= Date: Fri, 9 Jul 2021 14:50:30 +0800 Subject: [PATCH 177/226] fixex coverity warning --- ge/graph/load/model_manager/davinci_model.cc | 32 +++++++++++----------- ge/hybrid/executor/worker/execution_engine.cc | 2 +- ge/hybrid/model/hybrid_model_builder.cc | 2 ++ ge/hybrid/node_executor/hccl/hccl_node_executor.cc | 3 +- ge/ir_build/ge_ir_build.cc | 1 + 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 9d86039a..ddd6c0c4 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -387,8 +387,8 @@ Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weigh Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) { if (is_feature_map_mem_has_inited_) { - REPORT_INNER_ERROR("E19999", "Call InitFeatureMapMem more than once, model_id:%u, check invalid", model_id_); - GELOGE(PARAM_INVALID, "[Check][Param] call InitFeatureMapMem more than once, model_id:%u", model_id_); + REPORT_INNER_ERROR("E19999", "InitFeatureMapMem is called more than once, model_id:%u, check invalid", model_id_); + GELOGE(PARAM_INVALID, "[Check][Param] InitFeatureMapMem is called more than once, model_id:%u", model_id_); return PARAM_INVALID; } is_feature_map_mem_has_inited_ = true; @@ -456,8 +456,7 @@ Status DavinciModel::InitVariableMem() { void DavinciModel::InitRuntimeParams() { int64_t value = 0; - bool ret; - ret = ge::AttrUtils::GetInt(ge_model_, ATTR_MODEL_MEMORY_SIZE, value); + bool ret = ge::AttrUtils::GetInt(ge_model_, ATTR_MODEL_MEMORY_SIZE, value); runtime_param_.mem_size = ret ? (uint64_t)value : 0; ret = ge::AttrUtils::GetInt(ge_model_, ATTR_MODEL_WEIGHT_SIZE, value); runtime_param_.weight_size = ret ? (uint64_t)value : 0; @@ -983,7 +982,7 @@ Status DavinciModel::InitDataOp(const ComputeGraphPtr &graph, const NodePtr &nod // op_desc Checked by Init: Data, valid. auto op_desc = node->GetOpDesc(); if (node->GetOwnerComputeGraph() != graph) { - GELOGI("Skip subgraph Data node: %s.", op_desc->GetName().c_str()); + GELOGI("Skip Data node: %s in subgraph.", op_desc->GetName().c_str()); return SUCCESS; } @@ -1195,7 +1194,7 @@ Status DavinciModel::InitRealSizeAndShapeInfo(const ComputeGraphPtr &compute_gra GELOGD("No need to get size and shape of netoutput in subgraph."); return SUCCESS; } - GELOGD("Start init real size and shape info of %s.", node->GetName().c_str()); + GELOGD("Start to initialize real size and shape info of %s.", node->GetName().c_str()); GetAllGearsInfo(node); if (is_getnext_sink_dynamic_) { GE_IF_BOOL_EXEC(GetGetDynamicDimsNodeInfo(node) != SUCCESS, @@ -1238,7 +1237,7 @@ void DavinciModel::GetAllGearsInfo(const NodePtr &node) { } if (!gear_info.empty()) { all_gears_info_.emplace_back(gear_info); - GELOGD("Init all gears info from %s, gaer info is %s", node->GetName().c_str(), + GELOGD("Init all gears info from %s, gear info is %s", node->GetName().c_str(), formats::JoinToString(gear_info).c_str()); } } @@ -1318,7 +1317,7 @@ Status DavinciModel::GetGearAndRealOutSizeInfo(const ComputeGraphPtr &graph, con Status DavinciModel::GetRealOutputSizeOfCase(const ComputeGraphPtr &graph, size_t input_index, const NodePtr &case_node) { - GELOGD("Start get output size of %s, which is %zu input to netoutput", case_node->GetName().c_str(), input_index); + GELOGD("Start to get output size of %s, which is %zu input to netoutput", case_node->GetName().c_str(), input_index); const auto &func_desc = case_node->GetOpDesc(); GE_CHECK_NOTNULL(func_desc); std::map, int64_t> gear_and_real_out_size_info; @@ -2227,10 +2226,10 @@ void DavinciModel::CreateOutput(uint32_t index, const OpDescPtr &op_desc, InputO dims[i] = shape.GetDim(i); } } else { // FOR FORMAT_NHWC or FORMAT_NCHW - dims[0] = shape.GetDim(format == FORMAT_NHWC ? NHWC_DIM_N : NCHW_DIM_N); // 0: first dim - dims[1] = shape.GetDim(format == FORMAT_NHWC ? NHWC_DIM_C : NCHW_DIM_C); // 1: second dim - dims[2] = shape.GetDim(format == FORMAT_NHWC ? NHWC_DIM_H : NCHW_DIM_H); // 2: third dim - dims[3] = shape.GetDim(format == FORMAT_NHWC ? NHWC_DIM_W : NCHW_DIM_W); // 3: forth dim + dims[0] = shape.GetDim((format == FORMAT_NHWC) ? NHWC_DIM_N : NCHW_DIM_N); // 0: first dim + dims[1] = shape.GetDim((format == FORMAT_NHWC) ? NHWC_DIM_C : NCHW_DIM_C); // 1: second dim + dims[2] = shape.GetDim((format == FORMAT_NHWC) ? NHWC_DIM_H : NCHW_DIM_H); // 2: third dim + dims[3] = shape.GetDim((format == FORMAT_NHWC) ? NHWC_DIM_W : NCHW_DIM_W); // 3: forth dim } output.shape_info.num = dims[0]; // 0: first dim output.shape_info.channel = dims[1]; // 1: second dim @@ -2741,7 +2740,7 @@ Status DavinciModel::ReturnResult(uint32_t data_id, const bool rslt_flg, const b } if (!has_output_node_) { - GELOGW("Output tensor list is empty, model id: %u", model_id_); + GELOGW("The tensor list of output is empty, model id: %u", model_id_); GE_CHK_STATUS(listener_->OnComputeDone(model_id_, data_id, INTERNAL_ERROR, outputs), "[Call][OnComputeDone] failed, model_id:%u, data_id:%u.", model_id_, data_id); return INTERNAL_ERROR; @@ -3071,7 +3070,7 @@ Status DavinciModel::CreateKnownZeroCopyMap(const vector &inputs, const GELOGI("output %zu, v addr %p, r addr %p, p addr %p", i, addr_list[i], addr, outputs[i]); } - GELOGI("success, known input data info size: %zu, known output data info size: %zu", + GELOGI("create map for zero copy success, known input data info size: %zu, known output data info size: %zu", known_input_data_info_.size(), known_output_data_info_.size()); return SUCCESS; } @@ -3106,12 +3105,12 @@ Status DavinciModel::UpdateKnownZeroCopyAddr(vector &total_io_addrs, boo total_io_addrs[i] = known_output_data_info_.at(total_io_addrs[i]); } } - GELOGI("success, total io addrs size: %zu", total_io_addrs.size()); + GELOGI("update known zero copy addr success, total io addrs size: %zu", total_io_addrs.size()); return SUCCESS; } Status DavinciModel::UpdateKnownNodeArgs(const vector &inputs, const vector &outputs) { - GELOGI("DavinciModel::UpdateKnownNodeArgs in"); + GELOGI("DavinciModel::UpdateKnownNodeArgs begin"); GE_CHK_STATUS_RET(CreateKnownZeroCopyMap(inputs, outputs), "[Call][CreateKnownZeroCopyMap] failed, model_id:%u.", model_id_); total_io_addrs_.clear(); @@ -3683,6 +3682,7 @@ Status DavinciModel::InitConstant(const OpDescPtr &op_desc) { elem_num = 1; } uint64_t *buff = reinterpret_cast(tensor->MutableData().data()); + GE_CHECK_NOTNULL(buff); if (ge::CheckInt64Uint32MulOverflow(elem_num, kBytes * kStringHeadElems) != SUCCESS) { GELOGE(FAILED, "[Call][CheckInt64Uint32MulOverflow] Shape size:%ld is invalid", elem_num); return FAILED; diff --git a/ge/hybrid/executor/worker/execution_engine.cc b/ge/hybrid/executor/worker/execution_engine.cc index ca864244..4bd02193 100755 --- a/ge/hybrid/executor/worker/execution_engine.cc +++ b/ge/hybrid/executor/worker/execution_engine.cc @@ -428,7 +428,7 @@ Status ExecutionEngine::ValidateInputTensors(const NodeState &node_state, const continue; } - int64_t expected_size; + int64_t expected_size = 0; (void)TensorUtils::GetSize(*tensor_desc, expected_size); GELOGD("[%s] Input[%d] expects [%ld] bytes.", task_context.GetNodeName(), i, expected_size); auto size_diff = expected_size - static_cast(input_tensor->GetSize()); diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 554ddbbb..8f015420 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -900,6 +900,7 @@ Status HybridModelBuilder::LoadGraph() { GE_CHECK_NOTNULL(node_item); AscendString graph_name; GE_CHK_GRAPH_STATUS_RET(it.second->GetGraph().GetName(graph_name), "Failed to get subgraph name"); + GE_CHECK_NOTNULL(graph_name.GetString()); auto subgraph = hybrid_model_.GetRootGraph()->GetSubgraph(graph_name.GetString()); GE_CHECK_NOTNULL(subgraph); GE_CHK_STATUS_RET(IdentifyVariableOutputs(*node_item, subgraph), @@ -967,6 +968,7 @@ Status HybridModelBuilder::HandleDtString(const GeTensor &tensor, void *var_addr auto &mutable_tensor = const_cast(tensor); uint64_t *buff = reinterpret_cast(mutable_tensor.MutableData().data()); + GE_CHECK_NOTNULL(buff); GE_CHK_BOOL_RET_STATUS(ge::CheckInt64Uint32MulOverflow(elem_num, kBytes * kStringHeadElems) == SUCCESS, FAILED, "[Invoke][CheckInt64Uint32MulOverflow] failed because Shape size is invalid."); auto offset = static_cast(elem_num * kBytes * kStringHeadElems); diff --git a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc index 3f887819..31f2c7a1 100644 --- a/ge/hybrid/node_executor/hccl/hccl_node_executor.cc +++ b/ge/hybrid/node_executor/hccl/hccl_node_executor.cc @@ -417,7 +417,7 @@ Status BuildGatherAllToAllParams(TaskContext &context, HcomGatherAllToAllVParams } params.recvtype = iter->second; - int64_t addr_len; + int64_t addr_len = 0; (void) ge::AttrUtils::GetInt(op_desc, "addr_length", addr_len); params.addrLength = static_cast(addr_len); @@ -460,6 +460,7 @@ Status AllToAllNodeTask::ExecuteAsync(TaskContext &context, std::function &inputs, const vector &outputs, Graph &graph) { ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); + GE_CHECK_NOTNULL(op_type.GetString()); 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); From f7c45d81140f1bcdceb011219454ce724cbae23e Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Fri, 9 Jul 2021 19:28:05 +0800 Subject: [PATCH 178/226] mmSetCurrentThreadName --- ge/graph/execute/model_executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index bcbc08e6..2fc7b0af 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -193,7 +193,7 @@ Status ModelExecutor::PushGraph(const RunArgs &args) { void ModelExecutor::RunThread() { ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); - if (prctl(PR_SET_NAME, ("GE_Run")) != 0) { + if (mmSetCurrentThreadName("GE_Run") != EN_OK) { GELOGW("Set thread name failed."); } From 8aa46479fa227ab9e4b4044a35e26bd6edd0d64f Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Fri, 9 Jul 2021 19:44:18 +0800 Subject: [PATCH 179/226] mmSetCurrentThreadName stub --- tests/depends/mmpa/src/mmpa_stub.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/depends/mmpa/src/mmpa_stub.cc b/tests/depends/mmpa/src/mmpa_stub.cc index b0f1fb87..8801aacd 100644 --- a/tests/depends/mmpa/src/mmpa_stub.cc +++ b/tests/depends/mmpa/src/mmpa_stub.cc @@ -381,3 +381,8 @@ INT32 mmGetPid() { return (INT32)getpid(); } + +INT32 mmSetCurrentThreadName(const CHAR *name) +{ + return EN_OK; +} \ No newline at end of file From bd76e4d1dd79789d5d4522e867a82637997c3237 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sat, 10 Jul 2021 09:21:48 +0800 Subject: [PATCH 180/226] Get thre_pool from stream resource in single_op executor. --- ge/hybrid/executor/hybrid_model_executor.cc | 5 +++-- ge/hybrid/executor/hybrid_model_executor.h | 2 +- ge/hybrid/executor/subgraph_executor.cc | 20 ++++++++++++++++---- ge/hybrid/executor/subgraph_executor.h | 6 ++++-- ge/single_op/single_op_model.cc | 4 +++- ge/single_op/stream_resource.cc | 11 +++++++++++ ge/single_op/stream_resource.h | 3 +++ metadef | 2 +- parser | 2 +- tests/ut/ge/single_op/stream_resource_unittest.cc | 3 +++ 10 files changed, 46 insertions(+), 12 deletions(-) diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index 2bb683c7..dd8aace6 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -35,10 +35,11 @@ HybridModelExecutor::HybridModelExecutor(HybridModel *model, uint32_t device_id, HybridModelExecutor::~HybridModelExecutor() { } -Status HybridModelExecutor::Init() { +Status HybridModelExecutor::Init(ThreadPool *thread_pool) { GELOGD("Start to init HybridGraphEngine."); GE_CHK_STATUS_RET_NOLOG(InitExecutionContext()); - root_graph_executor_.reset(new (std::nothrow) SubgraphExecutor(model_->GetRootGraphItem(), &context_)); + root_graph_executor_.reset( + new (std::nothrow) SubgraphExecutor(model_->GetRootGraphItem(), &context_, false, thread_pool)); GE_CHECK_NOTNULL(root_graph_executor_); GELOGD("HybridGraphEngine initialized successfully."); return SUCCESS; diff --git a/ge/hybrid/executor/hybrid_model_executor.h b/ge/hybrid/executor/hybrid_model_executor.h index 102e4f8b..dbec7adf 100644 --- a/ge/hybrid/executor/hybrid_model_executor.h +++ b/ge/hybrid/executor/hybrid_model_executor.h @@ -39,7 +39,7 @@ class HybridModelExecutor { ~HybridModelExecutor(); - Status Init(); + Status Init(ThreadPool *thread_pool = nullptr); const GraphExecutionContext* GetContext() const { return &context_; diff --git a/ge/hybrid/executor/subgraph_executor.cc b/ge/hybrid/executor/subgraph_executor.cc index 33a2846c..7fcdec5d 100644 --- a/ge/hybrid/executor/subgraph_executor.cc +++ b/ge/hybrid/executor/subgraph_executor.cc @@ -28,20 +28,30 @@ constexpr int kDefaultQueueSize = 16; constexpr int kDataInputIndex = 0; } -SubgraphExecutor::SubgraphExecutor(const GraphItem *graph_item, GraphExecutionContext *context, bool force_infer_shape) +SubgraphExecutor::SubgraphExecutor(const GraphItem *graph_item, GraphExecutionContext *context, bool force_infer_shape, + ThreadPool *pre_run_pool) : graph_item_(graph_item), context_(context), force_infer_shape_(force_infer_shape), - pre_run_pool_(kDefaultThreadNum), + pre_run_pool_(pre_run_pool), + own_thread_pool_(false), ready_queue_(kDefaultQueueSize) { } SubgraphExecutor::~SubgraphExecutor() { + if (own_thread_pool_ && pre_run_pool_ != nullptr) { + delete pre_run_pool_; + } GELOGD("[%s] SubgraphExecutor destroyed.", graph_item_->GetName().c_str()); } Status SubgraphExecutor::Init(const std::vector &inputs, const std::vector &input_desc) { + if (pre_run_pool_ == nullptr) { + pre_run_pool_ = new (std::nothrow) ThreadPool(kDefaultThreadNum); + GE_CHECK_NOTNULL(pre_run_pool_); + own_thread_pool_ = true; + } subgraph_context_.reset(new(std::nothrow)SubgraphContext(graph_item_, context_)); GE_CHECK_NOTNULL(subgraph_context_); GE_CHK_STATUS_RET(subgraph_context_->Init(), @@ -254,7 +264,8 @@ Status SubgraphExecutor::PrepareNode(const NodeItem &node_item, int group) { // only do shape inference and compilation for nodes with dynamic shapes. if (node_item.is_dynamic) { - auto prepare_future = pre_run_pool_.commit([this, p_node_state]() -> Status { + GE_CHECK_NOTNULL(pre_run_pool_); + auto prepare_future = pre_run_pool_->commit([this, p_node_state]() -> Status { GetContext().SetSessionId(context_->session_id); GetContext().SetContextId(context_->context_id); GE_CHK_STATUS_RET_NOLOG(InferShape(shape_inference_engine_.get(), *p_node_state)); @@ -349,7 +360,8 @@ Status SubgraphExecutor::NodeScheduled(NodeState *node_state) { node_state->GetNodeItem()->data_send_.size(), node_state->GetNodeItem()->ctrl_send_.size(), node_state->GetSwitchIndex(), node_state->GetMergeIndex()); - auto future = pre_run_pool_.commit([this, node_state]() -> Status { + GE_CHECK_NOTNULL(pre_run_pool_); + auto future = pre_run_pool_->commit([this, node_state]() -> Status { RECORD_CALLBACK_EVENT(context_, node_state->GetName().c_str(), "[NodeScheduled] Start"); std::function callback = [&](const NodeItem *node_item) { const auto &node_name = node_item->node_name; diff --git a/ge/hybrid/executor/subgraph_executor.h b/ge/hybrid/executor/subgraph_executor.h index 76732c37..be11ff59 100644 --- a/ge/hybrid/executor/subgraph_executor.h +++ b/ge/hybrid/executor/subgraph_executor.h @@ -33,7 +33,8 @@ namespace hybrid { // Executor for executing a subgraph class SubgraphExecutor { public: - SubgraphExecutor(const GraphItem *graph_item, GraphExecutionContext *context, bool force_infer_shape = false); + SubgraphExecutor(const GraphItem *graph_item, GraphExecutionContext *context, bool force_infer_shape = false, + ThreadPool *pre_run_pool = nullptr); ~SubgraphExecutor(); Status InitForPartialExecution(const std::vector &inputs, @@ -124,7 +125,8 @@ class SubgraphExecutor { GraphExecutionContext *context_; std::unique_ptr subgraph_context_; bool force_infer_shape_; - ThreadPool pre_run_pool_; + ThreadPool *pre_run_pool_; + bool own_thread_pool_; BlockingQueue ready_queue_; std::unique_ptr shape_inference_engine_; diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 426d3233..ca07d2ae 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -713,7 +713,9 @@ Status SingleOpModel::BuildDynamicOp(StreamResource &resource, DynamicSingleOp & device_id, resource.GetStream())); GE_CHECK_NOTNULL(single_op.hybrid_model_executor_); - GE_CHK_STATUS_RET(single_op.hybrid_model_executor_->Init(), "[Init][HybridModelExecutor]Failed."); + ThreadPool *thread_pool = nullptr; + GE_CHK_STATUS_RET_NOLOG(resource.GetThreadPool(&thread_pool)); + GE_CHK_STATUS_RET(single_op.hybrid_model_executor_->Init(thread_pool), "[Init][HybridModelExecutor]Failed."); return SUCCESS; } return BuildTaskListForDynamicOp(&resource, single_op); diff --git a/ge/single_op/stream_resource.cc b/ge/single_op/stream_resource.cc index 9fe8f26a..10a8f72b 100755 --- a/ge/single_op/stream_resource.cc +++ b/ge/single_op/stream_resource.cc @@ -25,6 +25,7 @@ namespace ge { namespace { // limit available device mem size 1M const uint32_t kFuzzDeviceBufferSize = 1 * 1024 * 1024; +constexpr int kDefaultThreadNum = 4; } StreamResource::StreamResource(uintptr_t resource_id) : resource_id_(resource_id) { @@ -219,6 +220,16 @@ Status StreamResource::BuildOperator(const ModelData &model_data, SingleOp **sin return SUCCESS; } +Status StreamResource::GetThreadPool(ThreadPool **thread_pool) { + GE_CHECK_NOTNULL(thread_pool); + if (thread_pool_ == nullptr) { + thread_pool_.reset(new (std::nothrow) ThreadPool(kDefaultThreadNum)); + GE_CHECK_NOTNULL(thread_pool_); + } + *thread_pool = thread_pool_.get(); + return SUCCESS; +} + const uint8_t *StreamResource::GetMemoryBase() const { if (memory_list_.empty()) { return nullptr; diff --git a/ge/single_op/stream_resource.h b/ge/single_op/stream_resource.h index 8986634b..f1e1bebb 100755 --- a/ge/single_op/stream_resource.h +++ b/ge/single_op/stream_resource.h @@ -54,6 +54,8 @@ class StreamResource { return device_buffer_; } + Status GetThreadPool(ThreadPool **thread_pool); + private: uint8_t *DoMallocMemory(const std::string &purpose, size_t size, @@ -66,6 +68,7 @@ class StreamResource { std::vector weight_list_; std::unordered_map> op_map_; std::unordered_map> dynamic_op_map_; + std::unique_ptr thread_pool_; rtStream_t stream_ = nullptr; std::mutex mu_; std::mutex stream_mu_; diff --git a/metadef b/metadef index 3ace5b6f..84e7ab39 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 3ace5b6f10e0af784a1c3211fd769d6e8860e864 +Subproject commit 84e7ab39b0daf7ca2b2f5549e3279647da7875e2 diff --git a/parser b/parser index db68a1a4..ffd94df4 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit db68a1a4f1a6ae69dbf9a5f338392d50ea3874e3 +Subproject commit ffd94df471f7dd2b1928cc8d27e43e7210aaa7e7 diff --git a/tests/ut/ge/single_op/stream_resource_unittest.cc b/tests/ut/ge/single_op/stream_resource_unittest.cc index e07fc39d..e4ab469e 100644 --- a/tests/ut/ge/single_op/stream_resource_unittest.cc +++ b/tests/ut/ge/single_op/stream_resource_unittest.cc @@ -66,6 +66,9 @@ TEST_F(UtestStreamResource, test_build_op) { res.op_map_[0].reset(single_op); res.dynamic_op_map_[1].reset(dynamic_single_op); + ThreadPool *thread_pool = nullptr; + EXPECT_EQ(res.GetThreadPool(&thread_pool), SUCCESS); + EXPECT_EQ(res.GetOperator(0), nullptr); EXPECT_EQ(res.GetDynamicOperator(1), nullptr); EXPECT_EQ(res.BuildOperator(model_data, &single_op, 0), SUCCESS); From f96e62ad9204bc789de8416bae7b34457511f9ac Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sat, 10 Jul 2021 09:23:40 +0800 Subject: [PATCH 181/226] Update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index 84e7ab39..f9a47a45 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 84e7ab39b0daf7ca2b2f5549e3279647da7875e2 +Subproject commit f9a47a45cdd7e6dc507a15291fcb769f96b859b3 diff --git a/parser b/parser index ffd94df4..b42a99ea 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit ffd94df471f7dd2b1928cc8d27e43e7210aaa7e7 +Subproject commit b42a99ea6e1be75156650675fd0aeabca6cb3de9 From ca3b811ba1142c69ac31865e2d4df779d5dcf576 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Sat, 10 Jul 2021 15:39:27 +0800 Subject: [PATCH 182/226] Fix root node for MergeInputNodes --- ge/hybrid/model/hybrid_model_builder.cc | 5 +- ge/opskernel_manager/ops_kernel_manager.cc | 2 +- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 139 +++++++++++++++++++---------- 3 files changed, 98 insertions(+), 48 deletions(-) diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index f8ec6db1..c722d269 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -588,7 +588,10 @@ Status HybridModelBuilder::MergeInputNodes(ComputeGraph &graph) { for (auto &peer_in_data_anchor : out_data_anchor->GetPeerInDataAnchors()) { auto dst_node = peer_in_data_anchor->GetOwnerNode(); GE_CHECK_NOTNULL(dst_node); - root_nodes.emplace(dst_node); + const auto in_nodes = dst_node->GetInDataNodes(); + if (std::all_of(in_nodes.begin(), in_nodes.end(), [](const NodePtr &n) { return n->GetType() == DATA; })) { + root_nodes.emplace(dst_node); + } GE_CHK_STATUS_RET_NOLOG(DoUnlinkDataAnchors(out_data_anchor, peer_in_data_anchor)); GE_CHK_STATUS_RET_NOLOG(DoLinkDataAnchors(src_out_anchor, peer_in_data_anchor)); } diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index fc7bbdc2..d35ebda5 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -279,7 +279,7 @@ void OpsKernelManager::InitOpsKernelInfo() { if (it.second.empty()) { continue; } - auto comp_func = [this, &instance_ptr](const OpInfo &op_a, const OpInfo &op_b) -> bool { + auto comp_func = [&instance_ptr](const OpInfo &op_a, const OpInfo &op_b) -> bool { const string &a = op_a.engine; const string &b = op_b.engine; // check if a or b is registered diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index 1d1c4fa9..b09211cb 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -43,14 +43,11 @@ #include "graph/testcase/ge_graph/graph_builder_utils.h" #include "single_op/task/build_task_utils.h" #include "graph/op_desc_impl.h" -#undef private -#undef protected using namespace std; -using namespace testing; -using namespace ge; -using namespace hybrid; +namespace ge { +using namespace hybrid; class UtestGeHybrid : public testing::Test { protected: @@ -61,16 +58,30 @@ class UtestGeHybrid : public testing::Test { } }; -static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { +static ge::OpDescPtr CreateOpDesc(string name = "", string type = "", int in_num = 0, int out_num = 0) { auto op_desc = std::make_shared(name, type); op_desc->SetStreamId(0); - op_desc->SetId(0); + static int32_t index = 0; + op_desc->SetId(index++); + + GeTensorDesc tensor(GeShape(), FORMAT_ND, DT_INT64); + TensorUtils::SetSize(tensor, 64); + vector input_offset; + for (int i = 0; i < in_num; ++i) { + op_desc->AddInputDesc(tensor); + input_offset.emplace_back(index * 64 + i * 64); + } + op_desc->SetInputOffset(input_offset); + + vector output_offset; + for (int i = 0; i < out_num; ++i) { + op_desc->AddOutputDesc(tensor); + output_offset.emplace_back(index * 64 + in_num * 64 + i * 64); + } + op_desc->SetOutputOffset(output_offset); 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; @@ -414,49 +425,84 @@ TEST_F(UtestGeHybrid, test_parse_parallel_group) { } TEST_F(UtestGeHybrid, unfold_subgraphs_success) { - ComputeGraphPtr merged_graph = nullptr; + ComputeGraphPtr root_graph = std::make_shared("root_graph"); + auto partitioned_call_op_desc = CreateOpDesc("partitioned_call", PARTITIONEDCALL, 3, 1); + auto partitioned_call_node = root_graph->AddNode(partitioned_call_op_desc); + partitioned_call_op_desc->AddSubgraphName("f"); + partitioned_call_op_desc->SetSubgraphInstanceName(0, "sub_graph"); ComputeGraphPtr sub_sub_graph1 = std::make_shared("while_cond"); - OpDescPtr sub_sub_graph_while_cond_data_op_desc = CreateOpDesc("cond_data", DATA); - NodePtr sub_sub_graph_while_cond_data_node = sub_sub_graph1->AddNode(sub_sub_graph_while_cond_data_op_desc); + { + OpDescPtr sub_sub_graph_while_cond_data_op_desc = CreateOpDesc("cond_data", DATA); + NodePtr sub_sub_graph_while_cond_data_node = sub_sub_graph1->AddNode(sub_sub_graph_while_cond_data_op_desc); + sub_sub_graph1->SetParentGraph(root_graph); + root_graph->AddSubGraph(sub_sub_graph1); + } ComputeGraphPtr sub_sub_graph2 = std::make_shared("while_body"); - /*OpDescPtr sub_sub_graph_while_body_const_op_desc = CreateOpDesc("body_const", CONSTANT); - NodePtr sub_sub_graph_while_body_const_node = sub_sub_graph2->AddNode(sub_sub_graph_while_body_const_op_desc);*/ - OpDescPtr sub_sub_graph_while_body_data_op_desc = CreateOpDesc("body_data", DATA); - NodePtr sub_sub_graph_while_body_data_node = sub_sub_graph2->AddNode(sub_sub_graph_while_body_data_op_desc); - sub_sub_graph2->SetGraphUnknownFlag(true); - /*OpDescPtr sub_sub_graph_while_body_add_op_desc = CreateOpDesc("body_add", ADD); - NodePtr sub_sub_graph_while_body_add_node = sub_sub_graph2->AddNode(sub_sub_graph_while_body_add_node); - sub_sub_graph_while_body_add_node->AddLinkFrom(sub_sub_graph_while_body_data_node); - sub_sub_graph_while_body_add_node->AddLinkFrom(sub_sub_graph_while_body_const_node);*/ + { + OpDescPtr sub_sub_graph_while_body_data_op_desc = CreateOpDesc("body_data", DATA); + NodePtr sub_sub_graph_while_body_data_node = sub_sub_graph2->AddNode(sub_sub_graph_while_body_data_op_desc); + sub_sub_graph2->SetGraphUnknownFlag(true); + sub_sub_graph2->SetParentGraph(root_graph); + root_graph->AddSubGraph(sub_sub_graph2); + } + // Will unfold to merged_graph. ComputeGraphPtr sub_graph = std::make_shared("sub_graph"); - OpDescPtr sub_graph_while_op_desc = CreateOpDesc("while", WHILE); - NodePtr sub_graph_while_node = sub_graph->AddNode(sub_graph_while_op_desc); - sub_graph->SetGraphUnknownFlag(true); - sub_graph_while_node->GetOpDesc()->AddSubgraphName("while_cond"); - sub_graph_while_node->GetOpDesc()->AddSubgraphName("while_body"); - sub_graph_while_node->GetOpDesc()->SetSubgraphInstanceName(0, "while_cond"); - sub_graph_while_node->GetOpDesc()->SetSubgraphInstanceName(1, "while_body"); + { + OpDescPtr sub_graph_data1_op_desc = CreateOpDesc("data1", DATA, 1, 1); + OpDescPtr sub_graph_data2_op_desc = CreateOpDesc("data2", DATA, 1, 1); + OpDescPtr sub_graph_data3_op_desc = CreateOpDesc("data3", DATA, 1, 1); + NodePtr sub_graph_data1_node = sub_graph->AddNode(sub_graph_data1_op_desc); + NodePtr sub_graph_data2_node = sub_graph->AddNode(sub_graph_data2_op_desc); + NodePtr sub_graph_data3_node = sub_graph->AddNode(sub_graph_data3_op_desc); + + AttrUtils::SetInt(sub_graph_data1_op_desc, ATTR_NAME_PARENT_NODE_INDEX, 0); + AttrUtils::SetInt(sub_graph_data2_op_desc, ATTR_NAME_PARENT_NODE_INDEX, 1); + AttrUtils::SetInt(sub_graph_data3_op_desc, ATTR_NAME_PARENT_NODE_INDEX, 2); + + OpDescPtr sub_graph_while_op_desc = CreateOpDesc("while", WHILE, 2, 2); + NodePtr sub_graph_while_node = sub_graph->AddNode(sub_graph_while_op_desc); + sub_sub_graph1->SetParentNode(sub_graph_while_node); + sub_sub_graph2->SetParentNode(sub_graph_while_node); + sub_graph_while_op_desc->AddSubgraphName("while_cond"); + sub_graph_while_op_desc->SetSubgraphInstanceName(0, "while_cond"); + sub_graph_while_op_desc->AddSubgraphName("while_body"); + sub_graph_while_op_desc->SetSubgraphInstanceName(1, "while_body"); + + OpDescPtr sub_graph_matmul_op_desc = CreateOpDesc("matmul", MATMUL, 2, 1); + NodePtr sub_graph_matmul_node = sub_graph->AddNode(sub_graph_matmul_op_desc); + + OpDescPtr sub_graph_output_op_desc = CreateOpDesc("output", NETOUTPUT, 1, 1); + NodePtr sub_graph_output_node = sub_graph->AddNode(sub_graph_output_op_desc); + + GraphUtils::AddEdge(sub_graph_data1_node->GetOutDataAnchor(0), sub_graph_while_node->GetInDataAnchor(0)); + GraphUtils::AddEdge(sub_graph_data2_node->GetOutDataAnchor(0), sub_graph_while_node->GetInDataAnchor(1)); + GraphUtils::AddEdge(sub_graph_data3_node->GetOutDataAnchor(0), sub_graph_matmul_node->GetInDataAnchor(0)); + GraphUtils::AddEdge(sub_graph_while_node->GetOutDataAnchor(0), sub_graph_matmul_node->GetInDataAnchor(1)); + GraphUtils::AddEdge(sub_graph_matmul_node->GetOutDataAnchor(0), sub_graph_output_node->GetInDataAnchor(0)); + + sub_graph->SetGraphUnknownFlag(true); + sub_graph->SetParentNode(partitioned_call_node); + sub_graph->SetParentGraph(root_graph); + root_graph->AddSubGraph(sub_graph); + } - ComputeGraphPtr root_graph = std::make_shared("root_graph"); - auto partitioned_call_op_desc = MakeShared("partitioned_call", PARTITIONEDCALL); - auto partitioned_call_node = root_graph->AddNode(partitioned_call_op_desc); - partitioned_call_node->GetOpDesc()->AddSubgraphName("sub_graph"); - partitioned_call_node->GetOpDesc()->SetSubgraphInstanceName(0, "sub_graph"); - - root_graph->AddSubGraph(sub_sub_graph1); - root_graph->AddSubGraph(sub_sub_graph2); - sub_sub_graph1->SetParentGraph(root_graph); - sub_sub_graph2->SetParentGraph(root_graph); - sub_sub_graph1->SetParentNode(sub_graph_while_node); - sub_sub_graph2->SetParentNode(sub_graph_while_node); - - root_graph->AddSubGraph(sub_graph); - sub_graph->SetParentNode(partitioned_call_node); - sub_graph->SetParentGraph(root_graph); + OpDescPtr graph_data1_op_desc = CreateOpDesc("data1", DATA, 1, 1); + OpDescPtr graph_data2_op_desc = CreateOpDesc("data2", DATA, 1, 1); + OpDescPtr graph_data3_op_desc = CreateOpDesc("data3", DATA, 1, 1); + NodePtr graph_data1_node = root_graph->AddNode(graph_data1_op_desc); + NodePtr graph_data2_node = root_graph->AddNode(graph_data2_op_desc); + NodePtr graph_data3_node = root_graph->AddNode(graph_data3_op_desc); + AttrUtils::SetInt(graph_data1_op_desc, ATTR_NAME_INDEX, 0); + AttrUtils::SetInt(graph_data2_op_desc, ATTR_NAME_INDEX, 1); + AttrUtils::SetInt(graph_data3_op_desc, ATTR_NAME_INDEX, 2); + GraphUtils::AddEdge(graph_data1_node->GetOutDataAnchor(0), partitioned_call_node->GetInDataAnchor(0)); + GraphUtils::AddEdge(graph_data2_node->GetOutDataAnchor(0), partitioned_call_node->GetInDataAnchor(1)); + GraphUtils::AddEdge(graph_data3_node->GetOutDataAnchor(0), partitioned_call_node->GetInDataAnchor(2)); + ComputeGraphPtr merged_graph = nullptr; GeRootModelPtr root_model = MakeShared(root_graph); HybridModel hybrid_model(root_model); HybridModelBuilder hybrid_model_builder(hybrid_model); @@ -787,4 +833,5 @@ TEST_F(UtestGeHybrid, TestTaskExecuteAsync) { std::vector> tasks; AiCoreNodeTask node_task(std::move(tasks)); ASSERT_EQ(node_task.ExecuteAsync(task_context, nullptr), SUCCESS); -} \ No newline at end of file +} +} // namespace ge \ No newline at end of file From 69a8d570d0d911ff49d9d39f8e30550e378216d8 Mon Sep 17 00:00:00 2001 From: zhupuxu Date: Fri, 9 Jul 2021 17:49:27 +0800 Subject: [PATCH 183/226] graph id Signed-off-by: zhupuxu --- ge/common/profiling/ge_profiling.cc | 32 ++++++ ge/common/profiling/profiling_manager.cc | 51 +++++++++- ge/common/profiling/profiling_manager.h | 19 +++- ge/graph/execute/graph_execute.cc | 44 +++++++- ge/graph/execute/graph_execute.h | 5 + ge/graph/load/model_manager/davinci_model.cc | 13 ++- ge/graph/load/model_manager/model_manager.cc | 22 +++- ge/graph/manager/graph_manager.cc | 5 + ge/session/inner_session.cc | 4 + inc/framework/common/profiling/ge_profiling.h | 2 + .../ut/ge/graph/execute/graph_execute_unittest.cc | 44 ++++++++ tests/ut/ge/graph/load/model_manager_unittest.cc | 30 +++++- .../ge/profiling/ge_profiling_manager_unittest.cc | 113 +++++++++++++++++++++ 13 files changed, 370 insertions(+), 14 deletions(-) diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index fd104e90..1b5e5c84 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -20,9 +20,11 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" #include "graph/load/graph_loader.h" +#include "graph/ge_context.h" #include "init/gelib.h" #include "framework/common/ge_inner_error_codes.h" #include "model/ge_model.h" +#include "framework/omg/omg_inner_types.h" namespace { const uint32_t kDeviceListIndex = 3; @@ -35,6 +37,7 @@ const std::string kProfilingStop = "prof_stop"; const std::string kProfModelSubscribe = "prof_model_subscribe"; const std::string kProfModelUnsubscribe = "prof_model_cancel_subscribe"; const std::string kRtSetDeviceRegName = "profiling"; +const std::string kPofilingModelId = "modelId"; const std::map kProfCommandTypeMap = { {kProfCommandhandleInit, kProfilingInit}, @@ -195,6 +198,31 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le return ge::PARAM_INVALID; } } + auto &profiling_manager = ge::ProfilingManager::Instance(); + auto is_train = domi::GetContext().train_flag; + if (type == kProfCommandhandleModelSubscribe && is_train) { + profiling_manager.SetSubscribeInfo(prof_config_param->profSwitch, prof_config_param->modelId, true); + return ge::SUCCESS; + } + auto is_subscribe = profiling_manager.GetSubscribeInfo().is_subscribe; + if (type == kProfCommandhandleModelUnsubscribe && is_subscribe) { + prof_params.clear(); + prof_params.emplace_back(kPofilingModelId); + uint32_t model_id = 0; + // GraphId is actually stored in prof_config_param + uint32_t graph_id = prof_config_param->modelId; + auto ret = profiling_manager.GetModelIdFromGraph(graph_id, model_id); + if (ret != ge::SUCCESS) { + GELOGE(ret, "graph_id:%u not not found", graph_id); + REPORT_INPUT_ERROR("E10001", std::vector({"value", "parameter", "reason"}), + std::vector({std::to_string(graph_id), + "GraphToModelMap", + "graph_id does not exist!"})); + return ge::FAILED; + } + + prof_params.emplace_back(std::to_string(model_id)); + } ge::GraphLoader graph_loader; ge::Command command; command.cmd_params.clear(); @@ -248,3 +276,7 @@ ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream "tag id must be 0 when first run, must be 1 when second run"})); return ge::FAILED; } + +ge::Status ProfGetDeviceFormGraphId(uint32_t graph_id, uint32_t &device_id) { + return ge::ProfilingManager::Instance().GetDeviceIdFromGraph(graph_id, device_id); +} diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 7fd63d7e..0464491d 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -66,10 +66,13 @@ const std::string kIdx = "idx"; namespace ge { ProfilingManager::ProfilingManager() - : is_load_profiling_(false), is_execute_profiling_(false), is_training_trace_(false), subscribe_count_(0) { - prof_cb_.msprofCtrlCallback = nullptr; - prof_cb_.msprofReporterCallback = nullptr; - index_id_ = UINT64_MAX; + : is_load_profiling_(false), + is_execute_profiling_(false), + is_training_trace_(false), + subscribe_count_(0), + prof_cb_({nullptr, nullptr}), + index_id_(UINT64_MAX), + subscribe_info_({false, 0, 0}) { } ProfilingManager::~ProfilingManager() {} @@ -610,6 +613,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfFi // profiling plugin uninit PluginUnInit(); + CleanSubscribeInfo(); + int32_t dev_num = -1; rtError_t rt_ret = rtProfilerStop(PROF_MODEL_LOAD_MASK, dev_num, nullptr); if (rt_ret != RT_ERROR_NONE) { @@ -632,6 +637,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfFi } device_id_module_map_.clear(); device_id_.clear(); + device_id_map_.clear(); + model_id_map_.clear(); GELOGI("Prof finalize success."); #endif return SUCCESS; @@ -1057,4 +1064,40 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetFpBpP return; } +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::GetDeviceIdFromGraph( + uint32_t graph_id, uint32_t &device_id) { + auto iter = device_id_map_.find(graph_id); + if (iter != device_id_map_.end()) { + device_id = iter->second; + return SUCCESS; + } + REPORT_CALL_ERROR("E19999", "graph_id:%u does not exist!", graph_id); + GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%u does not exist!", graph_id); + return FAILED; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::SetSubscribeInfo( + uint64_t prof_switch, uint32_t model_id, bool is_subscribe) { + subscribe_info_.is_subscribe = is_subscribe; + subscribe_info_.prof_switch = prof_switch; + subscribe_info_.graph_id = model_id; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::CleanSubscribeInfo() { + subscribe_info_.is_subscribe = false; + subscribe_info_.prof_switch = 0; + subscribe_info_.graph_id = 0; +} + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::GetModelIdFromGraph( + uint32_t graph_id, uint32_t &model_id) { + auto iter = model_id_map_.find(graph_id); + if (iter != model_id_map_.end()) { + model_id = iter->second; + return SUCCESS; + } + REPORT_CALL_ERROR("E19999", "graph_id:%u does not exist!", graph_id); + GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%u does not exist!", graph_id); + return FAILED; +} } // namespace ge diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index 25929895..e5137562 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -62,6 +62,12 @@ struct DeviceSubsInfo { uint32_t subscribe_count; }; +struct ProfSubscribeInfo { + bool is_subscribe; + uint64_t prof_switch; + uint32_t graph_id; +}; + struct MsprofCallback { MsprofCtrlCallback msprofCtrlCallback; MsprofReporterCallback msprofReporterCallback; @@ -102,7 +108,15 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { void ReportData(const int32_t &device_id, const std::string &data, const std::string &tag_name); Status ProfileStepInfo(uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id); void SetStepInfoIndex(uint64_t index_id) { index_id_ = index_id; } - uint64_t GetStepInfoIndex() { return index_id_; } + uint64_t GetStepInfoIndex() const { return index_id_; } + void SetGraphIdToDeviceMap(uint32_t graph_id, uint32_t device_id) { device_id_map_[graph_id] = device_id; } + Status GetDeviceIdFromGraph(uint32_t graph_id, uint32_t &device_id); + void SetSubscribeInfo(uint64_t prof_switch, uint32_t model_id, bool is_subscribe); + const ProfSubscribeInfo &GetSubscribeInfo() const { return subscribe_info_; } + void CleanSubscribeInfo(); + void SetGraphIdToModelMap(uint32_t graph_id, uint32_t model_id) { model_id_map_[graph_id] = model_id; } + Status GetModelIdFromGraph(uint32_t graph_id, uint32_t &model_id); + private: Status InitFromOptions(const Options &options, MsprofGeOptions &prof_conf); Status ParseOptions(const std::string &options); @@ -130,6 +144,9 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { std::string bp_point_; uint32_t reporter_max_len_ = 0; uint64_t index_id_; + std::map device_id_map_; // key: graph_id, value: device_id + std::map model_id_map_; // key: graph_id, value: model_id + ProfSubscribeInfo subscribe_info_; }; } // namespace ge #endif // GE_COMMON_PROFILING_PROFILING_MANAGER_H_ diff --git a/ge/graph/execute/graph_execute.cc b/ge/graph/execute/graph_execute.cc index ba35e7c0..03abf91f 100755 --- a/ge/graph/execute/graph_execute.cc +++ b/ge/graph/execute/graph_execute.cc @@ -21,6 +21,7 @@ #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/davinci_model.h" +#include "common/profiling/profiling_manager.h" namespace ge { using Uint32Pair = pair; @@ -365,7 +366,11 @@ Status GraphExecutor::ExecuteGraph(GraphId graph_id, const GeRootModelPtr &ge_ro GELOGE(GE_GRAPH_SYNC_MODEL_FAILED, "[SyncExecute][Model] Error! graph id:%u", graph_id); return GE_GRAPH_SYNC_MODEL_FAILED; } - + ret = ModelSubscribe(graph_id); + if (ret != SUCCESS) { + GELOGE(ret, "[Call][ModelSubscribe] failed, graph_id:%u", graph_id); + return ret; + } return SUCCESS; } @@ -776,4 +781,41 @@ Status GraphExecutor::GetOpDescInfo(uint32_t device_id, uint32_t stream_id, uint } return SUCCESS; } + +Status GraphExecutor::GetModelByID(uint32_t model_id, std::shared_ptr &davinci_model) { + auto model_manager = ge::ModelManager::GetInstance(); + GE_CHECK_NOTNULL(model_manager); + davinci_model = model_manager->GetModel(static_cast(model_id)); + if (davinci_model == nullptr) { + REPORT_INNER_ERROR("E19999", "GetModel from model_manager fail, model_id:%u", model_id); + GELOGE(ge::FAILED, "[Get][Model] failed, Model id:%d is invaild or model is not loaded.", model_id); + return ge::FAILED; + } + return ge::SUCCESS; +} + +Status GraphExecutor::ModelSubscribe(uint32_t graph_id) { + auto &profiling_manager = ProfilingManager::Instance(); + const auto &subcribe_info = profiling_manager.GetSubscribeInfo(); + if (subcribe_info.is_subscribe) { + std::shared_ptr davinci_model = nullptr; + uint32_t model_id = 0; + Status ret = profiling_manager.GetModelIdFromGraph(graph_id, model_id); + if (ret != SUCCESS) { + GELOGE(ret, "[Call][GetModelIdFromGraph] failed, graph_id:%u", graph_id); + return ret; + } + ret = GetModelByID(model_id, davinci_model); + if (ret != SUCCESS) { + GELOGE(ret, "[Call][GetModelByID] failed, model_id:%u", model_id); + return ret; + } + ret = profiling_manager.ProfModelSubscribe(subcribe_info.prof_switch, davinci_model.get()); + if (ret != SUCCESS) { + GELOGE(ret, "[Call][ProfModelSubscribe] failed"); + return ret; + } + } + return SUCCESS; +} } // namespace ge diff --git a/ge/graph/execute/graph_execute.h b/ge/graph/execute/graph_execute.h index b6d56dff..56e322f1 100755 --- a/ge/graph/execute/graph_execute.h +++ b/ge/graph/execute/graph_execute.h @@ -38,6 +38,7 @@ #include "graph/model.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" +#include "graph/load/model_manager/davinci_model.h" namespace ge { class GraphExecutor { @@ -148,6 +149,10 @@ class GraphExecutor { static Status SetCallback(uint32_t model_id, const GeRootModelPtr &ge_root_model, const RunAsyncCallback &callback); + Status ModelSubscribe(uint32_t graph_id); + + Status GetModelByID(uint32_t model_id, std::shared_ptr &davinci_model); + bool init_flag_; bool train_graph_flag_; diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index ddd6c0c4..1d6f7aff 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -62,6 +62,7 @@ #include "graph/common/omg_util.h" #include "graph/build/memory/block_mem_assigner.h" #include "graph/manager/session_scope_mem_allocator.h" +#include "framework/omg/omg_inner_types.h" // create std::thread, catch exceptions using try/catch #define CREATE_STD_THREAD(thread_id, func, args) \ @@ -763,8 +764,16 @@ void DavinciModel::SaveSpecifyAttrValues(const OpDescPtr &op_desc) { } Status DavinciModel::ReportProfilingData() { - ProfilingManager::Instance().ReportProfilingData(model_id_, GetTaskDescInfo()); - GE_CHK_STATUS(SinkModelProfile(), "[Sink][ModelProfile] failed, model_id:%u.", model_id_); + bool is_train = domi::GetContext().train_flag; + auto model_id = model_id_; + auto &profiling_manager = ProfilingManager::Instance(); + auto graph_id = runtime_param_.graph_id; + if (is_train) { + GELOGD("Replace model_id:%u with graph_id:%u, when training.", model_id, graph_id); + model_id = graph_id; + } + profiling_manager.ReportProfilingData(model_id, GetTaskDescInfo()); + GE_CHK_STATUS(SinkModelProfile(), "[Sink][ModelProfile] failed, model_id:%u.", model_id); return SUCCESS; } diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 8b44daea..f1db6a99 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -368,7 +368,17 @@ Status ModelManager::LoadModelOnline(uint32_t &model_id, const shared_ptrGetRuntimeParam().graph_id; + if(subcribe_info.graph_id == graph_id) { + profiling_manager.SetGraphIdToModelMap(graph_id, model_id); + } + else { + GELOGW("graph_id:%u is not in subcribe info.", graph_id); + } + } return ret; } @@ -758,12 +768,15 @@ Status ModelManager::HandleProfModelUnsubscribeCommand(const Command &command) { if (ret != SUCCESS) { return ret; } - - if (ProfilingManager::Instance().ProfModelUnsubscribe(static_cast(davinci_model.get())) != SUCCESS) { + auto &profiling_manager = ProfilingManager::Instance(); + if (profiling_manager.ProfModelUnsubscribe(static_cast(davinci_model.get())) != SUCCESS) { GELOGE(FAILED, "[Handle][ProfModelUnsubscribe] failed."); return FAILED; } - + auto is_subscribe = profiling_manager.GetSubscribeInfo().is_subscribe; + if (is_subscribe) { + profiling_manager.CleanSubscribeInfo(); + } return SUCCESS; } @@ -1826,5 +1839,4 @@ Status ModelManager::CheckAicpuOpList(GeModelPtr ge_model) { "[Call][LaunchKernelCheckAicpuOp] failed."); return SUCCESS; } - } // namespace ge diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index a3605ec2..84ed3ab0 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -109,6 +109,7 @@ #include "register/custom_pass_helper.h" #include "external/graph/types.h" #include "common/util/error_manager/error_manager.h" +#include "common/profiling/profiling_manager.h" namespace { const char *const kSummary = "Summary"; @@ -462,6 +463,9 @@ Status GraphManager::AddGraph(const GraphId &graph_id, const Graph &graph, const std::map &options, const OmgContext &omg_context) { IncreaseGraphCount(graph_id); + auto device_id = GetContext().DeviceId(); + GELOGD("Device id is %u", device_id); + ProfilingManager::Instance().SetGraphIdToDeviceMap(graph_id, device_id); // validation for adding graphs of same graph_id in multi-thread secenario // 1.previous thread owns same graph_id has finished the AddGraph procession if (GetAddGraphCondition(graph_id) == kDoneAdded) { @@ -1715,6 +1719,7 @@ Status GraphManager::ParseTrainGraphFlag(bool &train_flag) { train_flag = true; } } + domi::GetContext().train_flag = train_flag; GELOGI("Is train flag: %d.", train_flag); return SUCCESS; } diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index fcb9d233..1dcc2996 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -35,6 +35,7 @@ #include "graph/utils/tensor_adapter.h" #include "runtime/mem.h" #include "ir_build/option_utils.h" +#include "common/profiling/profiling_manager.h" namespace ge { namespace { @@ -231,6 +232,9 @@ Status InnerSession::GetVariable(const std::string &name, Tensor &val) { Status InnerSession::AddGraph(uint32_t graph_id, const Graph &graph) { std::map options; + auto device_id = GetContext().DeviceId(); + GELOGD("Device id is %u", device_id); + ProfilingManager::Instance().SetGraphIdToDeviceMap(graph_id, device_id); return AddGraph(graph_id, graph, options); } diff --git a/inc/framework/common/profiling/ge_profiling.h b/inc/framework/common/profiling/ge_profiling.h index 7a238b2f..c87c082c 100644 --- a/inc/framework/common/profiling/ge_profiling.h +++ b/inc/framework/common/profiling/ge_profiling.h @@ -50,4 +50,6 @@ GE_FUNC_VISIBILITY ge::Status ProfCommandHandle(ProfCommandHandleType type, void /// GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream); +GE_FUNC_VISIBILITY ge::Status ProfGetDeviceFormGraphId(uint32_t graph_id, uint32_t &device_id); + #endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ diff --git a/tests/ut/ge/graph/execute/graph_execute_unittest.cc b/tests/ut/ge/graph/execute/graph_execute_unittest.cc index 6d982454..3e32405b 100644 --- a/tests/ut/ge/graph/execute/graph_execute_unittest.cc +++ b/tests/ut/ge/graph/execute/graph_execute_unittest.cc @@ -17,6 +17,8 @@ #include #include +#include "common/profiling/profiling_manager.h" + #define protected public #define private public #include "graph/execute/graph_execute.h" @@ -125,4 +127,46 @@ TEST_F(UtestGraphExecuteTest, test_set_callback) { auto status = executor.SetCallback(1, ge_root_model, callback); EXPECT_EQ(status, SUCCESS); } + +TEST_F(UtestGraphExecuteTest, test_without_subscribe) { + GraphExecutor executor; + auto ret = executor.ModelSubscribe(1); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(UtestGraphExecuteTest, test_with_subscribe_failed1) { + GraphExecutor executor; + uint32_t graph_id = 1; + auto &profiling_manager = ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, 1, true); + auto ret = executor.ModelSubscribe(graph_id); + profiling_manager.CleanSubscribeInfo(); + EXPECT_NE(ret, SUCCESS); +} + +TEST_F(UtestGraphExecuteTest, test_with_subscribe_failed2) { + GraphExecutor executor; + uint32_t graph_id = 1; + uint32_t model_id = 1; + auto &profiling_manager = ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, 1, true); + profiling_manager.SetGraphIdToModelMap(2, model_id); + auto ret = executor.ModelSubscribe(graph_id); + profiling_manager.CleanSubscribeInfo(); + EXPECT_NE(ret, SUCCESS); +} + +TEST_F(UtestGraphExecuteTest, test_with_subscribe_success) { + GraphExecutor executor; + uint32_t graph_id = 1; + uint32_t model_id = 1; + GraphNodePtr graph_node = std::make_shared(graph_id); + DavinciModel model(model_id, nullptr); + auto &profiling_manager = ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, 1, true); + profiling_manager.SetGraphIdToModelMap(graph_id, model_id); + auto ret = executor.ModelSubscribe(graph_id); + profiling_manager.CleanSubscribeInfo(); + EXPECT_EQ(ret, SUCCESS); +} } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/graph/load/model_manager_unittest.cc b/tests/ut/ge/graph/load/model_manager_unittest.cc index 166ae4af..65b70a24 100644 --- a/tests/ut/ge/graph/load/model_manager_unittest.cc +++ b/tests/ut/ge/graph/load/model_manager_unittest.cc @@ -26,6 +26,7 @@ #include "graph/load/graph_loader.h" #include "graph/load/model_manager/davinci_model.h" #include "graph/ops_stub.h" +#include "common/profiling/profiling_manager.h" using namespace std; using namespace testing; @@ -135,7 +136,8 @@ class UtestModelManagerModelManager : public testing::Test { class DModelListener : public ModelListener { public: DModelListener(){}; - uint32_t OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t resultCode) { return 0; } + uint32_t OnComputeDone(uint32_t model_id, uint32_t data_index, + uint32_t resultCode, std::vector &outputs) { return 0; } }; TEST_F(UtestModelManagerModelManager, case_is_need_hybrid_load) { @@ -426,4 +428,30 @@ TEST_F(UtestModelManagerModelManager, test_launch_kernel_cust_aicpu) { EXPECT_EQ(mm.LaunchKernelCustAicpuSo("deleteCustOp"), SUCCESS); EXPECT_TRUE(mm.cust_aicpu_so_.empty()); } + +shared_ptr listerner(new DModelListener()); +TEST_F(UtestModelManagerModelManager, test_load_model_online) { + ModelManager mm; + uint32_t model_id = 1; + ComputeGraphPtr graph = std::make_shared("test"); + GeRootModelPtr ge_root_model = make_shared(graph); + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, model_id, true); + Status ret = mm.LoadModelOnline(model_id, ge_root_model, listerner); + profiling_manager.CleanSubscribeInfo(); +} + +TEST_F(UtestModelManagerModelManager, command_profiling) { + ModelManager manager; + uint32_t model_id = 1; + Command cmd; + auto model = std::make_shared(1, listerner); + model->SetId(model_id); + cmd.cmd_params.push_back("modelId"); + cmd.cmd_params.push_back(to_string(model_id)); + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, model_id, true); + Status ret = manager.HandleProfModelUnsubscribeCommand(cmd); + profiling_manager.CleanSubscribeInfo(); +} } // namespace ge diff --git a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc index aae3f535..35879df8 100644 --- a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc +++ b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc @@ -21,11 +21,16 @@ #include #include +#include "graph/load/model_manager/davinci_model.h" + #define protected public #define private public #include "common/profiling/profiling_manager.h" #include "graph/ge_local_context.h" #include "inc/framework/common/profiling/ge_profiling.h" +#include "graph/manager/graph_manager.h" +#include "graph/ops_stub.h" +#include "inc/framework/omg/omg_inner_types.h" #undef protected #undef private @@ -43,6 +48,23 @@ int32_t ReporterCallback(uint32_t moduleId, uint32_t type, void *data, uint32_t return -1; } +void CreateGraph(Graph &graph) { + TensorDesc desc(ge::Shape({1, 3, 224, 224})); + uint32_t size = desc.GetShape().GetShapeSize(); + desc.SetSize(size); + auto data = op::Data("Data").set_attr_index(0); + data.update_input_desc_data(desc); + data.update_output_desc_out(desc); + + auto flatten = op::Flatten("Flatten").set_input_x(data, data.name_out_out()); + + std::vector inputs{data}; + std::vector outputs{flatten}; + std::vector targets{flatten}; + // Graph graph("test_graph"); + graph.SetInputs(inputs).SetOutputs(outputs).SetTargets(targets); +} + TEST_F(UtestGeProfilinganager, init_success) { setenv("PROFILING_MODE", "true", true); Options options; @@ -133,3 +155,94 @@ TEST_F(UtestGeProfilinganager, set_step_info_failed) { Status ret = ProfSetStepInfo(index_id, 1, stream); EXPECT_EQ(ret, ge::FAILED); } + +TEST_F(UtestGeProfilinganager, get_device_from_graph) { + GraphId graph_id = 1; + uint32_t device_id = 0; + GraphManager graph_manager; + GraphNodePtr graph_node = MakeShared(graph_id); + graph_manager.AddGraphNode(graph_id, graph_node); + graph_manager.SetAddGraphCondition(graph_id, 2); + Graph graph("test_graph"); + CreateGraph(graph); + std::map options; + OmgContext context; + Status ret = graph_manager.AddGraph(graph_id, graph, options, context); + EXPECT_EQ(ret, ge::SUCCESS); + ret = ProfGetDeviceFormGraphId(graph_id, device_id); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST_F(UtestGeProfilinganager, handle_subscribe_info) { + ProfCommandHandleType prof_type = kProfCommandhandleModelSubscribe; + ProfCommandHandleData prof_data; + prof_data.profSwitch = 0; + prof_data.modelId = 1; + domi::GetContext().train_flag = true; + auto prof_ptr = std::make_shared(prof_data); + Status ret = ProfCommandHandle(prof_type, static_cast(prof_ptr.get()), sizeof(prof_data)); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST_F(UtestGeProfilinganager, handle_unsubscribe_info) { + ProfCommandHandleType prof_type = kProfCommandhandleModelUnsubscribe; + ProfCommandHandleData prof_data; + prof_data.profSwitch = 0; + prof_data.modelId = 1; + domi::GetContext().train_flag = true; + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, 1, true); + auto prof_ptr = std::make_shared(prof_data); + Status ret = ProfCommandHandle(prof_type, static_cast(prof_ptr.get()), sizeof(prof_data)); + profiling_manager.CleanSubscribeInfo(); +} + +TEST_F(UtestGeProfilinganager, set_subscribe_info) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetSubscribeInfo(0, 1, true); + const auto &subInfo = profiling_manager.GetSubscribeInfo(); + EXPECT_EQ(subInfo.prof_switch, 0); + EXPECT_EQ(subInfo.graph_id, 1); + EXPECT_EQ(subInfo.is_subscribe, true); +} + +TEST_F(UtestGeProfilinganager, clean_subscribe_info) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.CleanSubscribeInfo(); + const auto &subInfo = profiling_manager.GetSubscribeInfo(); + EXPECT_EQ(subInfo.prof_switch, 0); + EXPECT_EQ(subInfo.graph_id, 0); + EXPECT_EQ(subInfo.is_subscribe, false); +} + +TEST_F(UtestGeProfilinganager, get_model_id_success) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetGraphIdToModelMap(0, 1); + uint32_t model_id = 0; + Status ret = profiling_manager.GetModelIdFromGraph(0, model_id); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST_F(UtestGeProfilinganager, get_model_id_failed) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetGraphIdToModelMap(0, 1); + uint32_t model_id = 0; + Status ret = profiling_manager.GetModelIdFromGraph(10, model_id); + EXPECT_EQ(ret, ge::FAILED); +} + +TEST_F(UtestGeProfilinganager, get_device_id_success) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetGraphIdToDeviceMap(0, 1); + uint32_t device_id = 0; + Status ret = profiling_manager.GetDeviceIdFromGraph(0, device_id); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST_F(UtestGeProfilinganager, get_device_id_failed) { + auto &profiling_manager = ge::ProfilingManager::Instance(); + profiling_manager.SetGraphIdToDeviceMap(0, 1); + uint32_t device_id = 0; + Status ret = profiling_manager.GetDeviceIdFromGraph(10, device_id); + EXPECT_EQ(ret, ge::FAILED); +} From ecd48b072de0337cdd023397f0b34f4e181b43eb Mon Sep 17 00:00:00 2001 From: y00500818 Date: Wed, 7 Jul 2021 15:27:27 +0800 Subject: [PATCH 184/226] bugfix for RecoverTransRoadForVar --- ge/graph/preprocess/graph_preprocess.cc | 20 +++++++++---------- .../graph/preprocess/graph_preprocess_unittest.cc | 23 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index d7f33b4b..8d59d9f9 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -415,16 +415,16 @@ Status UpdateVarFormats(const NodePtr &var, const GeTensorDesc &tensor_desc) { Status RecoverTransRoadForVar(const NodePtr &var, const VarTransRoad &road) { GE_CHECK_NOTNULL(var); - int index = 0; + static std::atomic_int index(0); NodePtr last_node = var; for (auto iter = road.rbegin(); iter != road.rend(); ++iter) { auto trans_name = var->GetName() + "_trans_" + std::to_string(index++); auto ret = RecoverOneTransNodeForVar(trans_name, *iter, last_node, last_node); if (ret != SUCCESS) { - REPORT_CALL_ERROR("E19999", "Failed to recover trans node for variable %s, index %d, type %s", - var->GetName().c_str(), index, iter->node_type.c_str()); - GELOGE(INTERNAL_ERROR, "[Recover][TransNode] for variable %s, index %d, type %s", var->GetName().c_str(), - index, iter->node_type.c_str()); + REPORT_CALL_ERROR("E19999", "Failed to recover trans node for variable %s, index %s, type %s", + var->GetName().c_str(), std::to_string(index).c_str(), iter->node_type.c_str()); + GELOGE(INTERNAL_ERROR, "[Recover][TransNode] for variable %s, index %s, type %s", var->GetName().c_str(), + std::to_string(index).c_str(), iter->node_type.c_str()); return INTERNAL_ERROR; } // set stream_label @@ -460,17 +460,17 @@ Status RecoverTransRoadForVar(const NodePtr &var, const VarTransRoad &road) { Status RecoverTransRoadForVarRef(const std::set &nodes, const VarTransRoad &road) { for (auto &var : nodes) { GE_CHECK_NOTNULL(var); - int index = 0; + static std::atomic_int index(0); NodePtr last_node = var; GELOGI("Recover trans nodes for variable ref %s", var->GetName().c_str()); for (auto iter = road.rbegin(); iter != road.rend(); ++iter) { auto trans_name = var->GetName() + "_trans_" + std::to_string(index++); auto ret = RecoverOneTransNodeForVarRef(trans_name, *iter, last_node, last_node); if (ret != SUCCESS) { - REPORT_CALL_ERROR("E19999", "Failed to recover trans node for variable %s, index %d, type %s", - var->GetName().c_str(), index, iter->node_type.c_str()); - GELOGE(INTERNAL_ERROR, "[Recover][TransNode] for variable %s failed, index %d, type %s", - var->GetName().c_str(), index, iter->node_type.c_str()); + REPORT_CALL_ERROR("E19999", "Failed to recover trans node for variable %s, index %s, type %s", + var->GetName().c_str(), std::to_string(index).c_str(), iter->node_type.c_str()); + GELOGE(INTERNAL_ERROR, "[Recover][TransNode] for variable %s failed, index %s, type %s", + var->GetName().c_str(), std::to_string(index).c_str(), iter->node_type.c_str()); return INTERNAL_ERROR; } // set stream_label diff --git a/tests/ut/ge/graph/preprocess/graph_preprocess_unittest.cc b/tests/ut/ge/graph/preprocess/graph_preprocess_unittest.cc index e53a9f96..b1c07d81 100644 --- a/tests/ut/ge/graph/preprocess/graph_preprocess_unittest.cc +++ b/tests/ut/ge/graph/preprocess/graph_preprocess_unittest.cc @@ -23,6 +23,7 @@ #include "graph/passes/graph_builder_utils.h" #include "graph/utils/attr_utils.h" #include "graph/debug/ge_attr_define.h" +#include "graph/manager/graph_var_manager.h" #define private public #define protected public @@ -285,4 +286,26 @@ TEST_F(UtestGraphPreproces, test_prepare_dyn_shape) { GraphPrepare graph_prepare; EXPECT_EQ(graph_prepare.PrepareDynShape(graph_node, user_input, compute_graph, 0), SUCCESS); } + +TEST_F(UtestGraphPreproces, test_updar_variable_formats) { + auto builder = ut::GraphBuilder("g1"); + auto var = builder.AddNode("var", VARIABLE, 1, 1); + auto g1 = builder.GetGraph(); + g1->SetSessionID(0); + TransNodeInfo trans_node_info; + VarTransRoad fusion_road; + fusion_road.emplace_back(trans_node_info); + VarManager::Instance(g1->GetSessionID())->SetTransRoad(var->GetName(), fusion_road); + GraphPrepare graph_prepare; + EXPECT_EQ(graph_prepare.UpdateVariableFormats(g1), INTERNAL_ERROR); + + auto builder1 = ut::GraphBuilder("g2"); + auto var1 = builder1.AddNode("var1", VARIABLE, 1, 1); + auto g2 = builder1.GetGraph(); + g2->SetSessionID(0); + VarTransRoad fusion_road1; + VarManager::Instance(g2->GetSessionID())->SetTransRoad(var1->GetName(), fusion_road1); + AttrUtils::SetStr(var1->GetOpDesc(), REF_VAR_SRC_VAR_NAME, "var1"); + EXPECT_EQ(graph_prepare.UpdateVariableFormats(g2), SUCCESS); +} } \ No newline at end of file From 4e5b81838d7429f0dd545722d85d54a5c3989579 Mon Sep 17 00:00:00 2001 From: wqtshg Date: Mon, 12 Jul 2021 10:27:07 +0800 Subject: [PATCH 185/226] all-in-one---runtime unitize --- ge/CMakeLists.txt | 27 +++++++++++++++------- ge/offline/CMakeLists.txt | 3 ++- ge/opskernel_manager/ops_kernel_builder_manager.cc | 10 ++++++++ metadef | 2 +- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index eec992c8..c22f88d8 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -786,12 +786,12 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../abl/licctrl ${GE_CODE_DIR}/../ace/comop/inc ${GE_CODE_DIR}/../ace/comop/inc/external - #### blue zone + #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_options(ge_runner PRIVATE @@ -800,6 +800,11 @@ target_link_options(ge_runner PRIVATE target_link_libraries(ge_runner PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> adump_server static_mmpa ge_proto_common @@ -869,9 +874,9 @@ target_include_directories(ge_compiler SYSTEM PRIVATE #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain - ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain> + $<$:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info> ) target_link_options(ge_compiler PRIVATE @@ -880,6 +885,11 @@ target_link_options(ge_compiler PRIVATE target_link_libraries(ge_compiler PRIVATE $ + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> + $<$>:$> static_mmpa ge_proto_common -Wl,--no-as-needed @@ -890,7 +900,8 @@ target_link_libraries(ge_compiler PRIVATE c_sec error_manager slog - runtime_compile + $<$>:$> + $<$:$> opt_feature -Wl,--as-needed json diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index 3a320226..e11e4a03 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -62,7 +62,8 @@ target_link_libraries(atc_atc.bin PRIVATE parser_common gflags json - runtime_compile + $<$>:$> + $<$:$> slog static_mmpa -lrt diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index 33ffddf5..9f981302 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -20,6 +20,7 @@ namespace ge { namespace { +#ifdef ONLY_COMPILE_OPEN_SRC const std::vector kBasicBuilderLibs = { "libge_local_opskernel_builder.so", "libhost_cpu_opskernel_builder.so", @@ -27,6 +28,15 @@ const std::vector kBasicBuilderLibs = { "libaicpu_ascend_builder.so", "libaicpu_tf_builder.so" }; +#else +const std::vector kBasicBuilderLibs = { + "libge_local_opskernel_builder.so", + "libhost_cpu_opskernel_builder.so", + "librts_engine.so", + "libaicpu_ascend_engine.so", + "libaicpu_tf_engine.so" +}; +#endif const std::vector kHcclBuilderLibs = { "libhcom_opskernel_builder.so", diff --git a/metadef b/metadef index f9a47a45..d5101eed 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit f9a47a45cdd7e6dc507a15291fcb769f96b859b3 +Subproject commit d5101eed670e0ecf8391db616c12582ed577adab From 729aa9d0573f0834366168890b84245994defeb1 Mon Sep 17 00:00:00 2001 From: wq160 Date: Wed, 7 Jul 2021 14:35:05 +0800 Subject: [PATCH 186/226] deal with unknown value range --- ge/graph/passes/infer_value_range_pass.cc | 24 ++++++++++++++---- ge/graph/passes/infer_value_range_pass.h | 2 +- .../passes/infer_value_range_pass_unittest.cc | 29 ++++++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/ge/graph/passes/infer_value_range_pass.cc b/ge/graph/passes/infer_value_range_pass.cc index 03a18fdb..c183a599 100644 --- a/ge/graph/passes/infer_value_range_pass.cc +++ b/ge/graph/passes/infer_value_range_pass.cc @@ -85,8 +85,16 @@ graphStatus InferValueRangePass::Infer(NodePtr &node) { return GRAPH_SUCCESS; } - // if input value range has -1, cpu kernel cannot calculate correctly, so set {1:-1} - if (InputHasUnknownValueRange(node)) { + // Deal with scenes with unknown value range + bool has_unknown_value_range = false; + bool has_zero_in_value_range = false; + CheckInputValueRange(node, has_unknown_value_range, has_zero_in_value_range); + if (has_unknown_value_range) { + if (has_zero_in_value_range) { + // When there is zero in input value range, it is unreasonable to always set output value range {1:-1}. + GELOGW("Node %s has -1 and 0 in value range, skip setting value range.", node->GetName().c_str()); + return GRAPH_NOT_CHANGED; + } GELOGI("Node %s has unknown value range in input tensors, set value range {1:-1}, and skip cpu kernel.", node->GetName().c_str()); return GenerateWorstValueRange(node); @@ -188,14 +196,21 @@ bool InferValueRangePass::InputIsConstOrHasValueRange(const NodePtr &node) const return input_is_const_or_has_value_range; } -bool InferValueRangePass::InputHasUnknownValueRange(const NodePtr &node) const { - bool has_unknown_value_range = false; +void InferValueRangePass::CheckInputValueRange(const NodePtr &node, bool &has_unknown_value_range, + bool &has_zero_in_value_range) const { + has_unknown_value_range = false; + has_zero_in_value_range = false; auto cur_op_desc = node->GetOpDesc(); for (const auto &input_desc : cur_op_desc->GetAllInputsDescPtr()) { std::vector> input_desc_value_range; input_desc->GetValueRange(input_desc_value_range); if (!input_desc_value_range.empty()) { for (const auto &range : input_desc_value_range) { + if (range.first == 0 || range.second == 0) { + GELOGD("Node %s input tensors have zero in value range %s.", node->GetName().c_str(), + formats::RangeToString(input_desc_value_range).c_str()); + has_zero_in_value_range = true; + } if (range.first == -1 || range.second == -1) { GELOGD("Node %s input tensors have unknown value range, value range is %s.", node->GetName().c_str(), formats::RangeToString(input_desc_value_range).c_str()); @@ -204,7 +219,6 @@ bool InferValueRangePass::InputHasUnknownValueRange(const NodePtr &node) const { } } } - return has_unknown_value_range; } graphStatus InferValueRangePass::UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) { diff --git a/ge/graph/passes/infer_value_range_pass.h b/ge/graph/passes/infer_value_range_pass.h index eb485c87..503b5a9f 100644 --- a/ge/graph/passes/infer_value_range_pass.h +++ b/ge/graph/passes/infer_value_range_pass.h @@ -34,7 +34,7 @@ class InferValueRangePass : public InferBasePass { bool InputIsDynamic(const NodePtr &node) const; bool InputIsConstOrHasValueRange(const NodePtr &node) const; - bool InputHasUnknownValueRange(const NodePtr &node) const; + void CheckInputValueRange(const NodePtr &node, bool &has_unknown_value_range, bool &has_zero_in_value_range) const; graphStatus GenerateWorstValueRange(NodePtr &node); template graphStatus ConstructData(const GeTensorDesc &tensor_desc, bool use_floor_value, GeTensorPtr &output_ptr); diff --git a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc index c39755b3..014d87dc 100644 --- a/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/infer_value_range_pass_unittest.cc @@ -365,6 +365,35 @@ TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHave EXPECT_EQ(unknown_target_value_range, output_value_range); } +TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHaveZeroInValueRange) { + // shape --- add --- sqrt + auto graph = std::make_shared("test_graph"); + GeTensorDesc shape_tensor_desc(GeShape({2}), ge::FORMAT_NCHW, ge::DT_INT64); + std::vector> unknown_value_range = {make_pair(1, -1), make_pair(0, 240)}; + shape_tensor_desc.SetValueRange(unknown_value_range); + auto shape_op_desc = std::make_shared("Shape", "Shape"); + shape_op_desc->AddOutputDesc(shape_tensor_desc); + auto shape_node = graph->AddNode(shape_op_desc); + + GeTensorDesc add_tensor_desc(GeShape({2}), ge::FORMAT_NCHW, ge::DT_INT64); + auto add_op_desc = std::make_shared("Add", "Add"); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddInputDesc(shape_tensor_desc); + add_op_desc->AddOutputDesc(add_tensor_desc); + auto add_node = graph->AddNode(add_op_desc); + + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(0)); + ge::GraphUtils::AddEdge(shape_node->GetOutDataAnchor(0), add_node->GetInDataAnchor(1)); + + // test unknown value range + InferValueRangePass infer_pass; + EXPECT_EQ(infer_pass.Run(add_node), SUCCESS); + auto output_0_desc = add_node->GetOpDesc()->GetOutputDesc(0); + std::vector> out_value_range; + output_0_desc.GetValueRange(out_value_range); + EXPECT_EQ(out_value_range.size(), 0); +} + TEST_F(UtestGraphInferValueRangePass, CallRun_NoSubgraph_UseCpuKernel_InputsHaveUnKnownValueRange_ScalarOutput) { // shape --- add --- sqrt // constant / From 238c7dfe1e3ccf4c0d62d21b48edc05d0bd90257 Mon Sep 17 00:00:00 2001 From: zhupuxu Date: Mon, 12 Jul 2021 14:22:01 +0800 Subject: [PATCH 187/226] reduce cm Signed-off-by: zhupuxu --- ge/common/profiling/ge_profiling.cc | 45 +++++++++++++++++----------- ge/graph/load/model_manager/model_manager.cc | 2 +- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index 1b5e5c84..fcd01a12 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -50,6 +50,22 @@ const std::map kProfCommandTypeMap = { const uint64_t kModelId = ge::INVALID_MODEL_ID; const uint16_t kStepStart = 0; const uint16_t kStepEnd = 1; + +ge::Status NeedUnsubscribe(ProfCommandHandleType type, bool is_subscribe, + uint32_t graph_id, vector &prof_params) { + if (type == kProfCommandhandleModelUnsubscribe && is_subscribe) { + prof_params.clear(); + prof_params.emplace_back(kPofilingModelId); + uint32_t model_id = 0; + auto ret = ge::ProfilingManager::Instance().GetModelIdFromGraph(graph_id, model_id); + if (ret != ge::SUCCESS) { + GELOGE(ret, "graph_id:%u not not found", graph_id); + return ret; + } + prof_params.emplace_back(std::to_string(model_id)); + } + return ge::SUCCESS; +} } // namespace bool TransProfConfigToParam(const ProfCommandHandleData &profCommand, vector &prof_config_params) { @@ -205,23 +221,16 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le return ge::SUCCESS; } auto is_subscribe = profiling_manager.GetSubscribeInfo().is_subscribe; - if (type == kProfCommandhandleModelUnsubscribe && is_subscribe) { - prof_params.clear(); - prof_params.emplace_back(kPofilingModelId); - uint32_t model_id = 0; - // GraphId is actually stored in prof_config_param - uint32_t graph_id = prof_config_param->modelId; - auto ret = profiling_manager.GetModelIdFromGraph(graph_id, model_id); - if (ret != ge::SUCCESS) { - GELOGE(ret, "graph_id:%u not not found", graph_id); - REPORT_INPUT_ERROR("E10001", std::vector({"value", "parameter", "reason"}), - std::vector({std::to_string(graph_id), - "GraphToModelMap", - "graph_id does not exist!"})); - return ge::FAILED; - } - - prof_params.emplace_back(std::to_string(model_id)); + // GraphId is actually stored in prof_config_param + auto graph_id = prof_config_param->modelId; + ge::Status ret = NeedUnsubscribe(type, is_subscribe, graph_id, prof_params); + if (ret != ge::SUCCESS) { + GELOGE(ret, "graph_id:%u not not found", graph_id); + REPORT_INPUT_ERROR("E10001", std::vector({"value", "parameter", "reason"}), + std::vector({std::to_string(graph_id), + "GraphToModelMap", + "graph_id does not exist!"})); + return ge::FAILED; } ge::GraphLoader graph_loader; ge::Command command; @@ -236,7 +245,7 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le if (type == kProfCommandhandleStart || type == kProfCommandhandleStop) { GELOGI("Profiling device nums:%s , deviceID:[%s]", prof_params[0].c_str(), prof_params[kDeviceListIndex].c_str()); } - ge::Status ret = graph_loader.CommandHandle(command); + ret = graph_loader.CommandHandle(command); if (ret != ge::SUCCESS) { GELOGE(ret, "[Handle][Command]Handle profiling command failed, command type %s, error_code %u", iter->second.c_str(), ret); diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index f1db6a99..5af503b2 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -372,7 +372,7 @@ Status ModelManager::LoadModelOnline(uint32_t &model_id, const shared_ptrGetRuntimeParam().graph_id; - if(subcribe_info.graph_id == graph_id) { + if (subcribe_info.graph_id == graph_id) { profiling_manager.SetGraphIdToModelMap(graph_id, model_id); } else { From e23e98bfa63acc4042b7cd6303a1904435db213c Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 12 Jul 2021 19:06:22 +0800 Subject: [PATCH 188/226] Add aicore_task_compiler.cc to executor --- ge/CMakeLists.txt | 15 +++++++++------ ge/engine_manager/dnnengine_manager.cc | 1 - ge/init/gelib.cc | 1 - ge/opskernel_manager/ops_kernel_manager.cc | 10 ---------- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index c22f88d8..5470542f 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -109,7 +109,7 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST - #"analyzer/analyzer.cc" + "analyzer/analyzer.cc" #"client/ge_api.cc" "common/dump/dump_manager.cc" "common/dump/dump_op.cc" @@ -141,7 +141,7 @@ set(EXECUTOR_SRC_LIST "common/profiling/ge_profiling.cc" #"common/profiling/ge_runner_profiling.cc" "common/profiling/profiling_manager.cc" - #"engine_manager/dnnengine_manager.cc" + "engine_manager/dnnengine_manager.cc" "executor/ge_executor.cc" "ge_local_engine/engine/host_cpu_engine.cc" #"ge_opt_info/ge_opt_info.cc" @@ -401,7 +401,7 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/aicore/aicore_node_executor.cc" "hybrid/node_executor/aicore/aicore_op_task.cc" "hybrid/node_executor/aicore/aicore_task_builder.cc" - #"hybrid/node_executor/aicore/aicore_task_compiler.cc" + "hybrid/node_executor/aicore/aicore_task_compiler.cc" "hybrid/node_executor/aicpu/aicpu_ext_info.cc" "hybrid/node_executor/aicpu/aicpu_node_executor.cc" "hybrid/node_executor/compiledsubgraph/known_node_executor.cc" @@ -415,7 +415,7 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/rts/rts_node_task.cc" "hybrid/node_executor/rts/rts_task_factory.cc" "hybrid/node_executor/task_context.cc" - #"init/gelib.cc" + "init/gelib.cc" #"ir_build/attr_options/keep_dtype_option.cc" #"ir_build/attr_options/utils.cc" #"ir_build/attr_options/weight_compress_option.cc" @@ -424,7 +424,7 @@ set(EXECUTOR_SRC_LIST "model/ge_model.cc" "model/ge_root_model.cc" "opskernel_manager/ops_kernel_builder_manager.cc" - #"opskernel_manager/ops_kernel_manager.cc" + "opskernel_manager/ops_kernel_manager.cc" #"session/inner_session.cc" #"session/session_manager.cc" "single_op/single_op.cc" @@ -445,7 +445,7 @@ set(COMPILER_SRC_LIST "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/dump_properties.cc" - "common/dump/dump_server.cc" + #"common/dump/dump_server.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" "common/formats/format_transfers/datatype_transfer.cc" @@ -828,6 +828,7 @@ target_link_libraries(ge_runner PRIVATE ############ libge_compiler.so ############ add_library(ge_compiler SHARED + "common/dump/dump_server.cc" "hybrid/hybrid_davinci_model_stub.cc" ${COMPILER_SRC_LIST} ) @@ -962,6 +963,7 @@ target_link_libraries(ge_executor PRIVATE $<$>:$> $<$>:$> json + ge_proto_client ascend_protobuf_static c_sec $<$>:-lrt> @@ -1024,6 +1026,7 @@ target_link_libraries(ge_executor_shared PRIVATE $<$>:$> -Wl,--no-as-needed ge_common + ge_proto_client runtime slog graph diff --git a/ge/engine_manager/dnnengine_manager.cc b/ge/engine_manager/dnnengine_manager.cc index 9e338295..0fadd993 100644 --- a/ge/engine_manager/dnnengine_manager.cc +++ b/ge/engine_manager/dnnengine_manager.cc @@ -16,7 +16,6 @@ #include "engine_manager/dnnengine_manager.h" -#include #include #include #include diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 132d4680..0350328d 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -16,7 +16,6 @@ #include "init/gelib.h" -#include #include #include #include diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index d35ebda5..60958872 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -16,17 +16,7 @@ #include "opskernel_manager/ops_kernel_manager.h" -#include -#include -#include -#include - -#include -#include -#include #include "init/gelib.h" -#include "framework/common/debug/ge_log.h" -#include "external/ge/ge_api.h" #include "proto/optimizer_priority.pb.h" namespace { From 87fd8b270b2a280680e0663bed504965fd6756a2 Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Sat, 10 Jul 2021 17:23:31 +0800 Subject: [PATCH 189/226] single op support null tensor --- ge/graph/manager/util/hcom_util.cc | 3 +- ge/single_op/task/op_task.cc | 16 ++++++-- tests/ut/ge/graph/manager/hcom_util_unittest.cc | 11 ++++++ tests/ut/ge/single_op/single_op_task_unittest.cc | 48 ++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 6 deletions(-) diff --git a/ge/graph/manager/util/hcom_util.cc b/ge/graph/manager/util/hcom_util.cc index 8e12ff27..021a458e 100644 --- a/ge/graph/manager/util/hcom_util.cc +++ b/ge/graph/manager/util/hcom_util.cc @@ -109,8 +109,7 @@ Status HcomOmeUtil::GetHcomCount(const ge::ConstOpDescPtr &op_desc, HcclDataType GE_CHK_STATUS_RET(ge::TensorUtils::GetSize(*op_desc->GetInputDescPtr(i), input_size), "[Get][Size] from TensorDesc failed, op:%s, input index:%zu", op_desc->GetName().c_str(), i); // dynamic shape hccl op get size from output tensor desc - if (op_desc->HasAttr(ATTR_NAME_IS_UNKNOWN_SHAPE)) { - GE_CHECK_NOTNULL(op_desc->GetOutputDescPtr(i)); + if (op_desc->HasAttr(ATTR_NAME_IS_UNKNOWN_SHAPE) && (op_desc->GetOutputDescPtr(i) != nullptr)) { GE_CHK_STATUS_RET(ge::TensorUtils::GetSize(*op_desc->GetOutputDescPtr(i), input_size), "[Get][Size] from TensorDesc failed, op:%s, input index:%zu", op_desc->GetName().c_str(), i); } diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index c6c99ab0..dbc90ac5 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -746,16 +746,24 @@ Status AiCpuBaseTask::UpdateIoAddr(const vector &inputs, const vecto GE_CHK_BOOL_RET_STATUS(non_const_index < inputs.size(), ACL_ERROR_GE_PARAM_INVALID, "[Check][Size] Input size is %zu, but get non_const_index is %zu", inputs.size(), non_const_index); auto addr = inputs[non_const_index].data; - GE_CHECK_NOTNULL(addr); - GELOGD("AICpuTask input[%zu] addr = %p", input_index, addr); + uint64_t length = inputs[non_const_index].length; + if (length != 0 && addr == nullptr) { + GELOGE(PARAM_INVALID, "[Check][Addr]AiCpuTask input[%zu] addr is nullptr, length = %lu", input_index, length); + return PARAM_INVALID; + } + GELOGD("AICpuTask input[%zu] addr = %p, length = %lu.", input_index, addr, length); *arg_base++ = reinterpret_cast(addr); non_const_index++; } for (size_t i = 0; i < outputs.size(); ++i) { auto addr = outputs[i].data; - GE_CHECK_NOTNULL(addr); - GELOGD("AICpuTask output[%zu] addr = %p", i, addr); + uint64_t length = outputs[i].length; + if (length != 0 && addr == nullptr) { + GELOGE(PARAM_INVALID, "[Check][Addr]AiCpuTask output[%zu] addr is nullptr, length = %lu", i, length); + return PARAM_INVALID; + } + GELOGD("AICpuTask output[%zu] addr = %p, length = %lu.", i, addr, length); *arg_base++ = reinterpret_cast(addr); } diff --git a/tests/ut/ge/graph/manager/hcom_util_unittest.cc b/tests/ut/ge/graph/manager/hcom_util_unittest.cc index 9f104f5f..4aeeddb9 100644 --- a/tests/ut/ge/graph/manager/hcom_util_unittest.cc +++ b/tests/ut/ge/graph/manager/hcom_util_unittest.cc @@ -94,4 +94,15 @@ TEST_F(UtestHcomUtil, test_GetHcomCount_succ) { auto ret = hcom_ome_util.GetHcomCount(op_desc, HCCL_DATA_TYPE_FP32, true, count); EXPECT_EQ(ret, 0); } + +TEST_F(UtestHcomUtil, test_GetHcomCount_succ_2) { + ComputeGraphPtr graph = std::make_shared("test"); + NodePtr node = NodeBuilder("node", HCOMSEND).AddInputDesc({1, 1, 224, 224}).Build(graph); + auto op_desc = node->GetOpDesc(); + HcomOmeUtil hcom_util; + int count = 0; + auto ret = hcom_util.GetHcomCount(op_desc, HCCL_DATA_TYPE_FP32, true, count); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(count, 224 * 224); +} } // namespace ge \ No newline at end of file diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 3e3160c2..8964df74 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -189,3 +189,51 @@ TEST_F(UtestSingleOpTask, test_atomic_exec) { optiling::utils::OpRunInfo run_info(0, true, 0); task.CalcTilingInfo(run_info); } + +TEST_F(UtestSingleOpTask, test_aicpu_task_update_io_addr) { + AiCpuCCTask task; + task.num_inputs_ = 2; + task.num_outputs_ = 1; + task.input_is_const_ = {true, false}; + int total_addr = 3; + uint32_t* addrs[total_addr] = {nullptr, nullptr, nullptr}; + task.io_addr_ = reinterpret_cast(addrs); + task.io_addr_num_ = total_addr; + + { + vector inputs(1, DataBuffer()); + vector outputs(1, DataBuffer()); + auto ret = task.UpdateIoAddr(inputs, outputs); + ASSERT_EQ(ret, SUCCESS); + ASSERT_EQ(addrs[0], nullptr); + ASSERT_EQ(addrs[1], nullptr); + ASSERT_EQ(addrs[2], nullptr); + } + + { + uint32_t data_buf[2]; + vector inputs{DataBuffer(&data_buf[0], 4, false)}; + vector outputs{DataBuffer(&data_buf[1], 4, false)}; + auto ret = task.UpdateIoAddr(inputs, outputs); + ASSERT_EQ(ret, SUCCESS); + ASSERT_EQ(addrs[0], nullptr); + ASSERT_EQ(addrs[1], &data_buf[0]); + ASSERT_EQ(addrs[2], &data_buf[1]); + } + + { + uint32_t data_buf[2]; + vector inputs{DataBuffer(nullptr, 4, false)}; + vector outputs{DataBuffer(&data_buf[1], 4, false)}; + auto ret = task.UpdateIoAddr(inputs, outputs); + ASSERT_EQ(ret, PARAM_INVALID); + } + + { + uint32_t data_buf[2]; + vector inputs{DataBuffer(&data_buf[0], 4, false)}; + vector outputs{DataBuffer(nullptr, 4, false)}; + auto ret = task.UpdateIoAddr(inputs, outputs); + ASSERT_EQ(ret, PARAM_INVALID); + } +} From 56337a19936667867eb5fdafd4f5a4fe6fbdf0ac Mon Sep 17 00:00:00 2001 From: wqtshg Date: Mon, 12 Jul 2021 20:57:02 +0800 Subject: [PATCH 190/226] all in one--runtime --- ge/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 5470542f..aca8145b 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -786,6 +786,9 @@ target_include_directories(ge_runner SYSTEM PRIVATE ${GE_CODE_DIR}/../abl/licctrl ${GE_CODE_DIR}/../ace/comop/inc ${GE_CODE_DIR}/../ace/comop/inc/external + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:$> + $<$>:$> #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include @@ -872,6 +875,9 @@ target_include_directories(ge_compiler SYSTEM PRIVATE ${GE_CODE_DIR}/../abl/licctrl ${GE_CODE_DIR}/../ace/comop/inc ${GE_CODE_DIR}/../ace/comop/inc/external + $<$>:${GE_DEPEND_DIR}/inc> + $<$>:$> + $<$>:$> #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include From 8c6a15b480da71f2af1bb768a117e169de5f1ba7 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 13 Jul 2021 10:34:05 +0800 Subject: [PATCH 191/226] Clean MakeLists --- ge/CMakeLists.txt | 206 ------------------------------------- ge/graph/execute/model_executor.cc | 7 ++ ge/graph/label/while_label_maker.h | 104 ++++++++++--------- ge/init/gelib.cc | 7 -- 4 files changed, 60 insertions(+), 264 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 5470542f..2fa96735 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -110,70 +110,27 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST "analyzer/analyzer.cc" - #"client/ge_api.cc" "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/dump_properties.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" - #"common/formats/format_transfers/datatype_transfer.cc" - #"common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" - #"common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" - #"common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" - #"common/formats/format_transfers/format_transfer_fractal_nz.cc" - #"common/formats/format_transfers/format_transfer_fractal_z.cc" - #"common/formats/format_transfers/format_transfer_fractal_zz.cc" - #"common/formats/format_transfers/format_transfer_fracz_hwcn.cc" - #"common/formats/format_transfers/format_transfer_fracz_nchw.cc" - #"common/formats/format_transfers/format_transfer_fracz_nhwc.cc" - #"common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" - #"common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" - #"common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" - #"common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" - #"common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" "common/formats/format_transfers/format_transfer_transpose.cc" - #"common/formats/formats.cc" "common/formats/utils/formats_trans_utils.cc" "common/fp16_t.cc" "common/ge/op_tiling_manager.cc" "common/ge/plugin_manager.cc" - #"common/helper/model_cache_helper.cc" "common/profiling/ge_profiling.cc" - #"common/profiling/ge_runner_profiling.cc" "common/profiling/profiling_manager.cc" "engine_manager/dnnengine_manager.cc" "executor/ge_executor.cc" "ge_local_engine/engine/host_cpu_engine.cc" - #"ge_opt_info/ge_opt_info.cc" - #"generator/ge_generator.cc" - #"generator/generator_api.cc" - #"graph/build/graph_builder.cc" - #"graph/build/label_allocator.cc" - #"graph/build/logical_stream_allocator.cc" - #"graph/build/memory/binary_block_mem_assigner.cc" - #"graph/build/memory/block_mem_assigner.cc" - #"graph/build/memory/buffer_pool_mem_assigner.cc" - #"graph/build/memory/graph_mem_assigner.cc" - #"graph/build/memory/hybrid_mem_assigner.cc" - #"graph/build/memory/max_block_mem_assigner.cc" - #"graph/build/memory/memory_assigner.cc" "graph/build/memory/var_mem_assign_util.cc" - #"graph/build/model_builder.cc" - #"graph/build/run_context.cc" - #"graph/build/stream_allocator.cc" - #"graph/build/stream_graph_optimizer.cc" - #"graph/build/task_generator.cc" "graph/common/bcast.cc" "graph/common/local_context.cc" "graph/common/omg_util.cc" - #"graph/common/transop_util.cc" "graph/execute/graph_execute.cc" "graph/execute/model_executor.cc" - #"graph/label/case_label_maker.cc" - #"graph/label/if_label_maker.cc" - #"graph/label/label_maker.cc" - #"graph/label/partitioned_call_label_maker.cc" - #"graph/label/while_label_maker.cc" "graph/load/graph_loader.cc" "graph/load/model_manager/aipp_utils.cc" "graph/load/model_manager/cpu_queue_schedule.cc" @@ -208,8 +165,6 @@ set(EXECUTOR_SRC_LIST "graph/load/model_manager/zero_copy_offset.cc" "graph/load/model_manager/zero_copy_task.cc" "graph/manager/graph_caching_allocator.cc" - #"graph/manager/graph_context.cc" - #"graph/manager/graph_manager.cc" "graph/manager/graph_manager_utils.cc" "graph/manager/graph_mem_allocator.cc" "graph/manager/graph_mem_manager.cc" @@ -217,128 +172,12 @@ set(EXECUTOR_SRC_LIST "graph/manager/host_mem_allocator.cc" "graph/manager/host_mem_manager.cc" #"graph/manager/memory_api.cc" # Just for runner. - #"graph/manager/model_manager/event_manager.cc" "graph/manager/rdma_pool_allocator.cc" "graph/manager/session_scope_mem_allocator.cc" "graph/manager/trans_var_data_utils.cc" "graph/manager/util/debug.cc" #"graph/manager/util/hcom_util.cc" # Just for runner. - #"graph/manager/util/rt_context_util.cc" - #"graph/manager/util/variable_accelerate_ctrl.cc" - #"graph/optimize/graph_optimize.cc" - #"graph/optimize/mem_rw_conflict_optimize.cc" - #"graph/optimize/summary_optimize.cc" - #"graph/partition/dynamic_shape_partition.cc" - #"graph/partition/engine_place.cc" - #"graph/partition/graph_partition.cc" - #"graph/partition/stage_partition.cc" - #"graph/passes/addn_pass.cc" - #"graph/passes/aicpu_constant_folding_pass.cc" - #"graph/passes/assert_pass.cc" - #"graph/passes/assign_remove_pass.cc" - #"graph/passes/atomic_addr_clean_pass.cc" - #"graph/passes/attach_stream_label_pass.cc" - #"graph/passes/base_pass.cc" - #"graph/passes/bitcast_pass.cc" - #"graph/passes/buffer_pool_memory_pass.cc" - #"graph/passes/cast_remove_pass.cc" - #"graph/passes/cast_translate_pass.cc" - #"graph/passes/common_subexpression_elimination_pass.cc" - #"graph/passes/compile_nodes_pass.cc" - #"graph/passes/cond_pass.cc" - #"graph/passes/cond_remove_pass.cc" - #"graph/passes/constant_folding_pass.cc" - #"graph/passes/constant_fuse_same_pass.cc" - #"graph/passes/control_trigger_pass.cc" - #"graph/passes/ctrl_edge_transfer_pass.cc" - #"graph/passes/data_pass.cc" - #"graph/passes/dimension_adjust_pass.cc" - #"graph/passes/dimension_compute_pass.cc" - #"graph/passes/dropout_pass.cc" - #"graph/passes/end_of_sequence_add_control_pass.cc" - #"graph/passes/enter_pass.cc" - #"graph/passes/flow_ctrl_pass.cc" - #"graph/passes/folding_pass.cc" - #"graph/passes/for_pass.cc" - #"graph/passes/fuse_data_nodes_with_common_input_pass.cc" - #"graph/passes/get_original_format_pass.cc" - #"graph/passes/global_step_insert_pass.cc" - #"graph/passes/guarantee_const_pass.cc" - #"graph/passes/hccl_continuous_memcpy_pass.cc" - #"graph/passes/hccl_group_pass.cc" - #"graph/passes/hccl_memcpy_pass.cc" - #"graph/passes/hccl_tailing_optimization_pass.cc" - #"graph/passes/identity_pass.cc" - #"graph/passes/infer_base_pass.cc" - #"graph/passes/infer_value_range_pass.cc" - #"graph/passes/infershape_pass.cc" - #"graph/passes/inplace_support_check_pass.cc" - #"graph/passes/input_output_connection_identify_pass.cc" - #"graph/passes/iterator_op_pass.cc" - #"graph/passes/link_gen_mask_nodes_pass.cc" - #"graph/passes/mark_agnostic_pass.cc" - #"graph/passes/mark_force_unknown_for_cond_pass.cc" - #"graph/passes/mark_graph_unknown_status_pass.cc" - #"graph/passes/mark_node_unknown_shape_pass.cc" - #"graph/passes/mark_same_addr_pass.cc" - #"graph/passes/memcpy_addr_async_pass.cc" - #"graph/passes/merge_input_memcpy_pass.cc" - #"graph/passes/merge_pass.cc" - #"graph/passes/merge_to_stream_merge_pass.cc" - #"graph/passes/multi_batch_clone_pass.cc" - #"graph/passes/multi_batch_pass.cc" - #"graph/passes/net_output_pass.cc" - #"graph/passes/next_iteration_pass.cc" - #"graph/passes/no_use_reshape_remove_pass.cc" - #"graph/passes/parallel_concat_start_op_pass.cc" - #"graph/passes/parallel_group_pass.cc" - #"graph/passes/pass_manager.cc" "graph/passes/pass_utils.cc" - #"graph/passes/permute_pass.cc" - #"graph/passes/placeholder_with_default_pass.cc" - #"graph/passes/prevent_gradient_pass.cc" - #"graph/passes/print_op_pass.cc" - #"graph/passes/prune_pass.cc" - #"graph/passes/ref_identity_delete_op_pass.cc" - #"graph/passes/remove_same_const_pass.cc" - #"graph/passes/replace_transshape_pass.cc" - #"graph/passes/replace_with_empty_const_pass.cc" - #"graph/passes/reshape_recovery_pass.cc" - #"graph/passes/reshape_remove_pass.cc" - #"graph/passes/resource_pair_add_control_pass.cc" - #"graph/passes/resource_pair_remove_control_pass.cc" - #"graph/passes/same_transdata_breadth_fusion_pass.cc" - #"graph/passes/save_pass.cc" - #"graph/passes/set_input_output_offset_pass.cc" - #"graph/passes/shape_operate_op_remove_pass.cc" - #"graph/passes/snapshot_pass.cc" - #"graph/passes/stop_gradient_pass.cc" - #"graph/passes/subexpression_migration_pass.cc" - #"graph/passes/subgraph_const_migration_pass.cc" - #"graph/passes/subgraph_pass.cc" - #"graph/passes/switch_data_edges_bypass.cc" - #"graph/passes/switch_dead_branch_elimination.cc" - #"graph/passes/switch_logic_remove_pass.cc" - #"graph/passes/switch_to_stream_switch_pass.cc" - #"graph/passes/transop_breadth_fusion_pass.cc" - #"graph/passes/transop_depth_fusion_pass.cc" - #"graph/passes/transop_nearby_allreduce_fusion_pass.cc" - #"graph/passes/transop_symmetry_elimination_pass.cc" - #"graph/passes/transop_without_reshape_fusion_pass.cc" - #"graph/passes/transpose_transdata_pass.cc" - #"graph/passes/unused_args_clean_pass.cc" - #"graph/passes/unused_const_pass.cc" - #"graph/passes/useless_control_out_remove_pass.cc" - #"graph/passes/var_is_initialized_op_pass.cc" - #"graph/passes/variable_op_pass.cc" - #"graph/passes/variable_prepare_op_pass.cc" - #"graph/passes/variable_ref_delete_op_pass.cc" - #"graph/passes/variable_ref_useless_control_out_delete_pass.cc" - #"graph/preprocess/graph_preprocess.cc" - #"graph/preprocess/insert_op/ge_aipp_op.cc" - #"graph/preprocess/insert_op/util_insert_aipp_op.cc" - #"graph/preprocess/multi_batch_copy_graph.cc" - #"graph/preprocess/multi_batch_options.cc" "host_kernels/add_kernel.cc" "host_kernels/broadcast_args_kernel.cc" "host_kernels/broadcast_gradient_args_kernel.cc" @@ -416,17 +255,10 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/rts/rts_task_factory.cc" "hybrid/node_executor/task_context.cc" "init/gelib.cc" - #"ir_build/attr_options/keep_dtype_option.cc" - #"ir_build/attr_options/utils.cc" - #"ir_build/attr_options/weight_compress_option.cc" - #"ir_build/ge_ir_build.cc" - #"ir_build/option_utils.cc" "model/ge_model.cc" "model/ge_root_model.cc" "opskernel_manager/ops_kernel_builder_manager.cc" "opskernel_manager/ops_kernel_manager.cc" - #"session/inner_session.cc" - #"session/session_manager.cc" "single_op/single_op.cc" "single_op/single_op_manager.cc" "single_op/single_op_model.cc" @@ -445,9 +277,6 @@ set(COMPILER_SRC_LIST "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/dump_properties.cc" - #"common/dump/dump_server.cc" - "common/dump/exception_dumper.cc" - "common/dump/opdebug_register.cc" "common/formats/format_transfers/datatype_transfer.cc" "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" @@ -497,44 +326,12 @@ set(COMPILER_SRC_LIST "graph/common/local_context.cc" "graph/common/omg_util.cc" "graph/common/transop_util.cc" - #"graph/execute/graph_execute.cc" "graph/label/case_label_maker.cc" "graph/label/if_label_maker.cc" "graph/label/label_maker.cc" "graph/label/partitioned_call_label_maker.cc" "graph/label/while_label_maker.cc" - "graph/load/graph_loader.cc" - "graph/load/model_manager/aipp_utils.cc" - "graph/load/model_manager/cpu_queue_schedule.cc" - "graph/load/model_manager/data_dumper.cc" - "graph/load/model_manager/data_inputer.cc" - "graph/load/model_manager/davinci_model.cc" - "graph/load/model_manager/model_manager.cc" "graph/load/model_manager/model_utils.cc" - "graph/load/model_manager/task_info/end_graph_task_info.cc" - "graph/load/model_manager/task_info/event_record_task_info.cc" - "graph/load/model_manager/task_info/event_wait_task_info.cc" - "graph/load/model_manager/task_info/ffts_task_info.cc" - "graph/load/model_manager/task_info/fusion_start_task_info.cc" - "graph/load/model_manager/task_info/fusion_stop_task_info.cc" - "graph/load/model_manager/task_info/kernel_ex_task_info.cc" - "graph/load/model_manager/task_info/kernel_task_info.cc" - "graph/load/model_manager/task_info/label_goto_ex_task_info.cc" - "graph/load/model_manager/task_info/label_set_task_info.cc" - "graph/load/model_manager/task_info/label_switch_by_index_task_info.cc" - "graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc" - "graph/load/model_manager/task_info/memcpy_async_task_info.cc" - "graph/load/model_manager/task_info/model_exit_task_info.cc" - "graph/load/model_manager/task_info/profiler_trace_task_info.cc" - "graph/load/model_manager/task_info/stream_active_task_info.cc" - "graph/load/model_manager/task_info/stream_switch_task_info.cc" - "graph/load/model_manager/task_info/stream_switchn_task_info.cc" - "graph/load/model_manager/task_info/super_kernel/super_kernel.cc" - "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" - "graph/load/model_manager/task_info/task_info.cc" - "graph/load/model_manager/tbe_handle_store.cc" - "graph/load/model_manager/zero_copy_offset.cc" - "graph/load/model_manager/zero_copy_task.cc" "graph/manager/graph_caching_allocator.cc" "graph/manager/graph_context.cc" "graph/manager/graph_manager.cc" @@ -704,7 +501,6 @@ set(COMPILER_SRC_LIST "host_kernels/transpose_kernel.cc" "host_kernels/unpack_kernel.cc" "host_kernels/unsqueeze_kernel.cc" - #"hybrid/hybrid_davinci_model_stub.cc" "hybrid/node_executor/aicpu/aicpu_ext_info.cc" "init/gelib.cc" "ir_build/attr_options/keep_dtype_option.cc" @@ -828,8 +624,6 @@ target_link_libraries(ge_runner PRIVATE ############ libge_compiler.so ############ add_library(ge_compiler SHARED - "common/dump/dump_server.cc" - "hybrid/hybrid_davinci_model_stub.cc" ${COMPILER_SRC_LIST} ) diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index 2fc7b0af..d1683f1d 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -47,6 +47,13 @@ Status ModelExecutor::Initialize(const map &options, uint64_t se return MEMALLOC_FAILED; } + const auto model_manager = ModelManager::GetInstance(); + GE_CHECK_NOTNULL(model_manager); + Status status = model_manager->EnableExceptionDump(options); + if (status != SUCCESS) { + return status; + } + session_id_ = session_id; train_graph_flag_ = ParseTrainGraphFlag(); thread_run_flag_.store(true); diff --git a/ge/graph/label/while_label_maker.h b/ge/graph/label/while_label_maker.h index 6c30475b..1561b860 100644 --- a/ge/graph/label/while_label_maker.h +++ b/ge/graph/label/while_label_maker.h @@ -19,57 +19,59 @@ #include "graph/node.h" #include "graph/label/label_maker.h" -/******************************************************************************* - +------------+ - | Node | - +------------+ - | Node | - +------------+ - | While | - +------------+ - +-----------+ - | Node | +------------+ - +-----------+ | LabelSet |\ - | Node | +------------+ \ - +-----------+ |StreamActive| \ - | Node | +------------+ A - +-----------+ | c | | - | While | +------------+ | - +-----------+ | o | | - | Node | +------------+ | - +-----------+ | n | | - | Node | +------------+ | - +-----------+ | d | | - | Node | +------------+ | - +-----------+ /|SwitchByIdx | | - / +------------+ | - ====> / | - | \ +------------+ | - | \|LabelSet(1) | | - | +------------+ | - | |StreamActive| | - | +------------+ | - +-----------+ +-----------+ | | b | | - | c | | b | | +------------+ | - +-----------+ +-----------+ | | o | | - | o | | o | | +------------+ | - +-----------+ +-----------+ | | d | | - | n | | d | | +------------+ | - +-----------+ +-----------+ | | y | / - | d | | y | V +------------+ / - +-----------+ +-----------+ \ | LabelGoto |/ - \ +------------+ - \|LabelSet(0) | - +------------+ - - +------------+ - | Node | - +------------+ - | Node | - +------------+ - | Node | - +------------+ -*******************************************************************************/ +/*********************************************************************************************************************** + +------------+ Step0: DavinciModel::InitNodes + | Node | + +------------+ rtLabelCreateExV2 + | Node | + +------------+ + | Node | + +------------+ + | While | + +------------+ + +-----------+ Step1: TaskInfo::Init + | Node | +------------+ + +-----------+ | LabelSet(0)|\ LabelSetTaskInfo --> id=0 + | Node | +------------+ \ + +-----------+ |StreamActive| \ If active_stream_list empty, not task. + | Node | +------------+ A + +-----------+ | c | | + | While | +------------+ | + +-----------+ | o | | + | Node | +------------+ | + +-----------+ | n | | + | Node | +------------+ | + +-----------+ | d | | + | Node | +------------+ | + +-----------+ /|SwitchByIdx | | LabelSwitchByIndexTaskInfo --> rtLabelListCpy({1,2}) + / +------------+ | + ====> / | + | \ +------------+ | + | \| LabelSet(1)| | LabelSetTaskInfo --> id=1 + | +------------+ | + | |StreamActive| | If active_stream_list empty, not task. + | +------------+ | + +-----------+ +-----------+ | | b | | + | c | | b | | +------------+ | + +-----------+ +-----------+ | | o | | + | o | | o | | +------------+ | + +-----------+ +-----------+ | | d | | + | n | | d | | +------------+ | + +-----------+ +-----------+ | | y | / + | d | | y | V +------------+ / + +-----------+ +-----------+ \ | LabelGoto |/ LabelGotoExTaskInfo --> GetLabelGotoAddr(id=0) + \ +------------+ + \| LabelSet(2)| LabelSetTaskInfo --> id=2 + +------------+ + Step2: TaskInfo::Distribute + +------------+ + | Node | LabelSetTaskInfo --> rtLabelSet + +------------+ LabelSwitchByIndexTaskInfo --> rtLabelSwitchByIndex + | Node | LabelSetTaskInfo --> rtLabelSet + +------------+ LabelGotoExTaskInfo --> rtLabelSwitchByIndex + | Node | LabelSetTaskInfo --> rtLabelSet + +------------+ +***********************************************************************************************************************/ namespace ge { class WhileOpLabelMaker : public LabelMaker { public: diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 0350328d..1a2f0d5b 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -37,7 +37,6 @@ #include "graph/common/ge_call_wrapper.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" -#include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_mem_manager.h" #include "graph/manager/host_mem_manager.h" #include "graph/manager/graph_var_manager.h" @@ -196,12 +195,6 @@ Status GELib::SystemInitialize(const map &options) { // In train and infer, profiling is always needed. InitProfiling(this->options_); - auto model_manager = ModelManager::GetInstance(); - GE_CHECK_NOTNULL(model_manager); - GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); - GELOGE(FAILED, "[Enable][ExceptionDump] failed."); - return FAILED); // 1.`is_train_mode_` means case: train // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer // these two case with logical device id From c99de0ec98175f2601d163511bca6e4b5e31e9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Tue, 13 Jul 2021 15:14:02 +0800 Subject: [PATCH 192/226] update submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index d5101eed..5a9605f6 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit d5101eed670e0ecf8391db616c12582ed577adab +Subproject commit 5a9605f6cb1204a729a51fe36bc614cf1d94a496 diff --git a/parser b/parser index b42a99ea..7a2daaa2 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit b42a99ea6e1be75156650675fd0aeabca6cb3de9 +Subproject commit 7a2daaa2625505e1a15e1faa46c90df1a23dd6fa From 82f767585cff6a9678447512948b456903ba921f Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Tue, 13 Jul 2021 15:32:29 +0800 Subject: [PATCH 193/226] fix static check warning --- ge/graph/common/omg_util.h | 9 ++++----- tests/ut/ge/graph/optimize/graph_optimize_unittest.cc | 11 ++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ge/graph/common/omg_util.h b/ge/graph/common/omg_util.h index d55cc7c8..83057dfb 100644 --- a/ge/graph/common/omg_util.h +++ b/ge/graph/common/omg_util.h @@ -27,11 +27,10 @@ #include "graph/node.h" namespace ge { -namespace { -const int64_t kBufferPoolMemAlignSize = 512; -const uint32_t kBufferPoolNodeOutIndex = 0; -const uint32_t kEventReuseThreshold = 65500; -} // namespace +static constexpr int64_t kBufferPoolMemAlignSize = 512; +static constexpr uint32_t kBufferPoolNodeOutIndex = 0; +static constexpr uint32_t kEventReuseThreshold = 65500; + /// /// @brief get the Original Type of FrameworkOp /// @param [in] node diff --git a/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc b/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc index 5468ec97..7f26aa8c 100644 --- a/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc +++ b/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc @@ -32,14 +32,14 @@ using namespace ge; namespace { const char *const kVectorCore = "VectorCore"; const char *const kAicoreEngine = "AIcoreEngine"; -string CreateEngineConfigJson() { +void CreateEngineConfigJson(string &dir_path, string &file_path) { GELOGI("Begin to create engine config json file."); string base_path = PluginManager::GetPath(); GELOGI("Base path is %s.", base_path.c_str()); - string dir_path = base_path.substr(0, base_path.rfind('/') + 1) + "plugin/nnengine/ge_config"; + dir_path = base_path.substr(0, base_path.rfind('/') + 1) + "plugin/nnengine/ge_config"; string cmd = "mkdir -p " + dir_path; system(cmd.c_str()); - string file_path = dir_path + "/engine_conf.json"; + file_path = dir_path + "/engine_conf.json"; GELOGI("Begin to write into the config file: %s.", file_path.c_str()); ofstream ofs(file_path, ios::out); EXPECT_EQ(!ofs, false); @@ -56,7 +56,6 @@ string CreateEngineConfigJson() { "}"; ofs.close(); GELOGI("Json config file %s has been written.", file_path.c_str()); - return file_path; } void DeleteFile(const string &file_name) { @@ -69,14 +68,16 @@ void DeleteFile(const string &file_name) { class UtestGraphOptimizeTest : public testing::Test { protected: void SetUp() { - config_file_ = CreateEngineConfigJson(); + CreateEngineConfigJson(config_dir_, config_file_); } void TearDown() { DeleteFile(config_file_); + DeleteFile(config_dir_); } private: + string config_dir_; string config_file_; }; From 4f049ae644495582cb5707cb16c572dc9dc74f5a Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Tue, 13 Jul 2021 17:13:38 +0800 Subject: [PATCH 194/226] modify ge common so --- .clang-format | 2 +- ge/CMakeLists.txt | 13 -- ge/client/ge_api.cc | 2 +- ge/common/CMakeLists.txt | 15 ++- ge/common/auth/file_saver.cc | 22 ++-- ge/{graph => }/common/bcast.cc | 4 +- ge/{graph => }/common/bcast.h | 6 +- ge/common/context/ctx.cc | 2 +- ge/common/cust_aicpu_kernel_store.h | 2 +- ge/common/debug/memory_dumper.cc | 11 +- ge/common/dump/dump_manager.cc | 19 ++- ge/common/dump/dump_properties.cc | 74 +++++------ ge/common/fmk_error_codes.cc | 7 +- .../format_transfers/format_transfer_transpose.h | 1 - ge/common/formats/formats.cc | 16 +-- ge/common/formats/utils/formats_trans_utils.cc | 5 +- ge/common/fp16_t.cc | 74 ++++++++--- ge/common/ge/datatype_util.h | 2 +- ge/common/ge/tbe_plugin_manager.cc | 6 +- ge/{graph => }/common/ge_call_wrapper.h | 0 ge/common/ge_format_util.cc | 4 +- ge/common/helper/model_cache_helper.h | 2 +- ge/common/helper/model_helper.cc | 77 +++++------ ge/common/helper/om_file_helper.cc | 40 +++--- ge/common/kernel_store.h | 2 +- ge/{graph => }/common/local_context.cc | 2 +- ge/{graph => }/common/local_context.h | 0 ge/common/math/fp16_math.cc | 28 ++-- ge/{ => common}/model/ge_model.cc | 2 +- ge/{ => common}/model/ge_model.h | 12 +- ge/{ => common}/model/ge_root_model.cc | 3 +- ge/{ => common}/model/ge_root_model.h | 2 +- ge/common/model_parser/model_parser.cc | 12 +- ge/common/model_saver.cc | 3 +- ge/{graph => }/common/omg_util.cc | 22 ++-- ge/{graph => }/common/omg_util.h | 0 ge/common/op/attr_value_util.cc | 141 ++++++++++----------- ge/common/op/ge_op_utils.cc | 41 ++---- ge/common/profiling/ge_profiling.cc | 2 +- ge/common/profiling/profiling_manager.cc | 65 ++++------ ge/common/profiling/profiling_manager.h | 2 +- ge/common/properties_manager.cc | 15 +-- ge/common/tbe_kernel_store.h | 2 +- ge/common/thread_pool.cc | 4 +- ge/common/thread_pool.h | 2 +- ge/{graph => }/common/transop_util.cc | 4 +- ge/{graph => }/common/transop_util.h | 2 +- ge/common/util.cc | 34 ++--- ge/executor/CMakeLists.txt | 14 +- ge/executor/module.mk | 6 +- ge/ge_inference.mk | 8 +- ge/ge_runner.mk | 8 +- ge/generator/ge_generator.cc | 2 +- ge/graph/build/graph_builder.cc | 4 +- ge/graph/build/graph_builder.h | 2 +- ge/graph/build/logical_stream_allocator.cc | 2 +- ge/graph/build/memory/block_mem_assigner.cc | 2 +- ge/graph/build/memory/buffer_pool_mem_assigner.cc | 2 +- ge/graph/build/memory/graph_mem_assigner.cc | 2 +- ge/graph/build/memory/var_mem_assign_util.cc | 2 +- ge/graph/build/model_builder.cc | 6 +- ge/graph/build/model_builder.h | 2 +- ge/graph/build/run_context.cc | 2 +- ge/graph/build/stream_allocator.cc | 2 +- ge/graph/build/task_generator.cc | 2 +- ge/graph/execute/model_executor.cc | 4 +- ge/graph/load/model_manager/davinci_model.cc | 6 +- ge/graph/load/model_manager/davinci_model.h | 2 +- ge/graph/load/model_manager/model_manager.cc | 4 +- ge/graph/load/model_manager/model_manager.h | 2 +- ge/graph/manager/graph_manager.cc | 10 +- ge/graph/manager/graph_manager.h | 2 +- ge/graph/manager/graph_manager_utils.h | 6 +- ge/graph/optimize/graph_optimize.cc | 2 +- ge/graph/optimize/mem_rw_conflict_optimize.cc | 2 +- ge/graph/partition/dynamic_shape_partition.cc | 2 +- ge/graph/partition/graph_partition.cc | 2 +- ge/graph/partition/graph_partition.h | 2 + ge/graph/passes/atomic_addr_clean_pass.cc | 2 +- ge/graph/passes/attach_stream_label_pass.cc | 2 +- ge/graph/passes/buffer_pool_memory_pass.cc | 2 +- ge/graph/passes/cast_remove_pass.cc | 2 +- ge/graph/passes/cast_translate_pass.cc | 2 +- ge/graph/passes/compile_nodes_pass.cc | 2 +- ge/graph/passes/control_trigger_pass.cc | 2 +- ge/graph/passes/dimension_adjust_pass.h | 2 +- ge/graph/passes/flow_ctrl_pass.cc | 2 +- ge/graph/passes/get_original_format_pass.cc | 2 +- ge/graph/passes/guarantee_const_pass.cc | 2 +- ge/graph/passes/hccl_tailing_optimization_pass.cc | 2 +- ge/graph/passes/identity_pass.cc | 2 +- ge/graph/passes/infershape_pass.cc | 2 +- ge/graph/passes/iterator_op_pass.cc | 2 +- .../passes/mark_force_unknown_for_cond_pass.cc | 2 +- ge/graph/passes/mark_node_unknown_shape_pass.cc | 2 +- ge/graph/passes/merge_input_memcpy_pass.cc | 2 +- ge/graph/passes/merge_pass.cc | 2 +- ge/graph/passes/merge_to_stream_merge_pass.cc | 2 +- ge/graph/passes/multi_batch_clone_pass.cc | 4 +- ge/graph/passes/multi_batch_pass.cc | 2 +- ge/graph/passes/net_output_pass.cc | 2 +- ge/graph/passes/next_iteration_pass.cc | 2 +- ge/graph/passes/pass_manager.cc | 2 +- ge/graph/passes/pass_utils.cc | 2 +- ge/graph/passes/permute_pass.cc | 2 +- ge/graph/passes/placeholder_with_default_pass.cc | 2 +- ge/graph/passes/prevent_gradient_pass.cc | 2 +- ge/graph/passes/print_op_pass.h | 2 +- ge/graph/passes/ref_identity_delete_op_pass.cc | 2 +- ge/graph/passes/replace_transshape_pass.cc | 2 +- ge/graph/passes/snapshot_pass.cc | 2 +- ge/graph/passes/stop_gradient_pass.h | 2 +- ge/graph/passes/switch_dead_branch_elimination.cc | 2 +- ge/graph/passes/switch_to_stream_switch_pass.cc | 2 +- ge/graph/passes/transop_breadth_fusion_pass.cc | 2 +- ge/graph/passes/transop_depth_fusion_pass.cc | 2 +- .../passes/transop_nearby_allreduce_fusion_pass.cc | 2 +- .../passes/transop_symmetry_elimination_pass.cc | 2 +- .../passes/transop_without_reshape_fusion_pass.cc | 2 +- ge/graph/passes/variable_op_pass.h | 2 +- ge/graph/passes/variable_prepare_op_pass.cc | 2 +- ge/graph/preprocess/graph_preprocess.cc | 6 +- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 2 +- ge/graph/preprocess/multi_batch_copy_graph.cc | 4 +- ge/graph/preprocess/multi_batch_options.cc | 4 +- ge/host_kernels/add_kernel.cc | 2 +- ge/host_kernels/broadcast_args_kernel.cc | 2 +- ge/host_kernels/broadcast_gradient_args_kernel.cc | 2 +- ge/host_kernels/cast_kernel.cc | 2 +- ge/host_kernels/floormod_kernel.cc | 2 +- ge/host_kernels/greater_kernel.cc | 2 +- ge/host_kernels/maximum_kernel.cc | 2 +- ge/host_kernels/mul_kernel.cc | 2 +- ge/host_kernels/permute_kernel.cc | 2 +- ge/host_kernels/sub_kernel.cc | 2 +- ge/host_kernels/transdata_kernel.cc | 2 +- ge/hybrid/hybrid_davinci_model.h | 2 +- ge/hybrid/model/hybrid_model.h | 2 +- ge/hybrid/model/hybrid_model_builder.cc | 2 +- ge/hybrid/model/hybrid_model_builder.h | 2 +- ge/init/gelib.cc | 2 +- ge/ir_build/attr_options/utils.cc | 2 +- ge/ir_build/ge_ir_build.cc | 2 +- ge/session/inner_session.cc | 2 +- inc/framework/common/helper/model_helper.h | 20 ++- tests/ut/ge/CMakeLists.txt | 13 +- tests/ut/ge/common/fp16_unittest.cc | 56 ++++++++ tests/ut/ge/graph/build/model_builder_unittest.cc | 2 +- tests/ut/ge/graph/graph_load_unittest.cc | 2 +- tests/ut/ge/graph/load/model_helper_unittest.cc | 2 +- .../ut/ge/graph/manager/graph_manager_unittest.cc | 10 +- .../partition/dynamic_shape_partition_unittest.cc | 2 +- .../mark_node_unknown_shape_pass_unittest.cc | 2 +- .../passes/multi_batch_clone_pass_unittest.cc | 2 +- .../subgraph_const_migration_pass_unittest.cc | 2 +- tests/ut/ge/graph/transop_util_unittest.cc | 2 +- tests/ut/ge/hybrid/ge_hybrid_unittest.cc | 4 +- .../hybrid/model/hybrid_model_builder_unittest.cc | 2 +- .../ge_local/ge_local_node_executor_unittest.cc | 2 +- .../host_cpu/host_cpu_node_task_unittest.cc | 2 +- .../node_executor/rts/rts_node_task_unittest.cc | 2 +- 161 files changed, 592 insertions(+), 599 deletions(-) rename ge/{graph => }/common/bcast.cc (98%) rename ge/{graph => }/common/bcast.h (98%) rename ge/{graph => }/common/ge_call_wrapper.h (100%) rename ge/{graph => }/common/local_context.cc (97%) rename ge/{graph => }/common/local_context.h (100%) rename ge/{ => common}/model/ge_model.cc (99%) rename ge/{ => common}/model/ge_model.h (90%) rename ge/{ => common}/model/ge_root_model.cc (95%) rename ge/{ => common}/model/ge_root_model.h (98%) rename ge/{graph => }/common/omg_util.cc (95%) rename ge/{graph => }/common/omg_util.h (100%) rename ge/{graph => }/common/transop_util.cc (97%) rename ge/{graph => }/common/transop_util.h (95%) create mode 100644 tests/ut/ge/common/fp16_unittest.cc diff --git a/.clang-format b/.clang-format index 6faea40d..dd8abe32 100644 --- a/.clang-format +++ b/.clang-format @@ -11,7 +11,7 @@ AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All +AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index dead6aa5..cb4c84b1 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -112,7 +112,6 @@ set(EXECUTOR_SRC_LIST "analyzer/analyzer.cc" "common/dump/dump_manager.cc" "common/dump/dump_op.cc" - "common/dump/dump_properties.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" "common/formats/format_transfers/format_transfer_transpose.cc" @@ -126,9 +125,6 @@ set(EXECUTOR_SRC_LIST "executor/ge_executor.cc" "ge_local_engine/engine/host_cpu_engine.cc" "graph/build/memory/var_mem_assign_util.cc" - "graph/common/bcast.cc" - "graph/common/local_context.cc" - "graph/common/omg_util.cc" "graph/execute/graph_execute.cc" "graph/execute/model_executor.cc" "graph/load/graph_loader.cc" @@ -255,8 +251,6 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/rts/rts_task_factory.cc" "hybrid/node_executor/task_context.cc" "init/gelib.cc" - "model/ge_model.cc" - "model/ge_root_model.cc" "opskernel_manager/ops_kernel_builder_manager.cc" "opskernel_manager/ops_kernel_manager.cc" "single_op/single_op.cc" @@ -274,7 +268,6 @@ set(EXECUTOR_SRC_LIST ################################################################## set(COMPILER_SRC_LIST "analyzer/analyzer.cc" - "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/dump_properties.cc" "common/formats/format_transfers/datatype_transfer.cc" @@ -322,10 +315,6 @@ set(COMPILER_SRC_LIST "graph/build/stream_allocator.cc" "graph/build/stream_graph_optimizer.cc" "graph/build/task_generator.cc" - "graph/common/bcast.cc" - "graph/common/local_context.cc" - "graph/common/omg_util.cc" - "graph/common/transop_util.cc" "graph/label/case_label_maker.cc" "graph/label/if_label_maker.cc" "graph/label/label_maker.cc" @@ -508,8 +497,6 @@ set(COMPILER_SRC_LIST "ir_build/attr_options/weight_compress_option.cc" "ir_build/ge_ir_build.cc" "ir_build/option_utils.cc" - "model/ge_model.cc" - "model/ge_root_model.cc" "opskernel_manager/ops_kernel_builder_manager.cc" "opskernel_manager/ops_kernel_manager.cc" ) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 3cf7c3c4..e4a016b3 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -29,7 +29,7 @@ #include "graph/opsproto_manager.h" #include "graph/utils/type_utils.h" #include "graph/manager/util/rt_context_util.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "register/op_registry.h" #include "common/ge/tbe_plugin_manager.h" #include "common/util/error_manager/error_manager.h" diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 1872b4c2..0d41b86f 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -2,16 +2,23 @@ set(SRC_LIST "context/ctx.cc" "model_saver.cc" "ge/datatype_util.cc" + "ge/plugin_manager.cc" + "ge/op_tiling_manager.cc" "helper/om_file_helper.cc" "helper/model_helper.cc" - "../model/ge_model.cc" - "../model/ge_root_model.cc" + "model/ge_model.cc" + "model/ge_root_model.cc" + "bcast.cc" + "local_context.cc" + "omg_util.cc" + "transop_util.cc" "auth/file_saver.cc" "fp16_t.cc" "math/fp16_math.cc" "debug/memory_dumper.cc" "formats/utils/formats_trans_utils.cc" "dump/dump_properties.cc" + "dump/dump_manager.cc" "formats/format_transfers/datatype_transfer.cc" "formats/format_transfers/format_transfer_transpose.cc" "formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" @@ -63,7 +70,7 @@ target_compile_definitions(ge_common PRIVATE ) target_compile_options(ge_common PRIVATE - -fvisibility=hidden + -fvisibility=default -O2 -Werror -Wno-deprecated-declarations @@ -183,7 +190,7 @@ target_compile_definitions(ge_common PRIVATE ) target_compile_options(ge_common PRIVATE - -fvisibility=hidden + -fvisibility=default -O2 -Werror -Wno-deprecated-declarations diff --git a/ge/common/auth/file_saver.cc b/ge/common/auth/file_saver.cc index 57ab901b..d6f24497 100755 --- a/ge/common/auth/file_saver.cc +++ b/ge/common/auth/file_saver.cc @@ -238,7 +238,7 @@ Status FileSaver::SaveToBuffWithFileHeader(const ModelFileHeader &file_header, return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(const std::string &file_path) { +Status FileSaver::CheckPath(const std::string &file_path) { // Determine file path length if (file_path.size() >= MMPA_MAX_PATH) { GELOGE(FAILED, "[Check][FilePath]Failed, file path's length:%zu > mmpa_max_path:%d", @@ -271,8 +271,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const ModelFileHeader *model_file_header) { +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"); @@ -301,19 +301,18 @@ FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -FileSaver::SaveToFile(const string &file_path, ModelFileHeader &file_header, ModelPartitionTable &model_partition_table, - const std::vector &partition_datas) { +Status FileSaver::SaveToFile(const string &file_path, ModelFileHeader &file_header, + ModelPartitionTable &model_partition_table, + const std::vector &partition_datas) { const Status ret = SaveWithFileHeader(file_path, file_header, model_partition_table, partition_datas); GE_CHK_BOOL_RET_STATUS(ret == SUCCESS, FAILED, "save file failed, file_path:%s, file header len:%u.", file_path.c_str(), file_header.length); return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -FileSaver::SaveToFile(const string &file_path, ModelFileHeader &file_header, - vector &model_partition_tables, - const vector> &all_partition_datas) { +Status FileSaver::SaveToFile(const string &file_path, ModelFileHeader &file_header, + vector &model_partition_tables, + const vector> &all_partition_datas) { const Status ret = SaveWithFileHeader(file_path, file_header, model_partition_tables, all_partition_datas); GE_CHK_BOOL_RET_STATUS(ret == SUCCESS, FAILED, "save file failed, file_path:%s, file header len:%u.", file_path.c_str(), file_header.length); @@ -372,8 +371,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const void *data, - int len) { +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); diff --git a/ge/graph/common/bcast.cc b/ge/common/bcast.cc similarity index 98% rename from ge/graph/common/bcast.cc rename to ge/common/bcast.cc index fcc8f9a1..a4e8d1a1 100644 --- a/ge/graph/common/bcast.cc +++ b/ge/common/bcast.cc @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "graph/common/bcast.h" +#include "common/bcast.h" #include #include "common/math_util.h" -#include "framework/common/util.h" +#include "common/util.h" using domi::Status; diff --git a/ge/graph/common/bcast.h b/ge/common/bcast.h similarity index 98% rename from ge/graph/common/bcast.h rename to ge/common/bcast.h index 184751fe..a8399896 100644 --- a/ge/graph/common/bcast.h +++ b/ge/common/bcast.h @@ -21,11 +21,11 @@ #include #include -#include "framework/common/debug/log.h" -#include "framework/common/types.h" +#include "common/debug/log.h" +#include "common/types.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "external/graph/attr_value.h" +#include "graph/attr_value.h" #include "graph/ge_tensor.h" #include "graph/utils/tensor_adapter.h" diff --git a/ge/common/context/ctx.cc b/ge/common/context/ctx.cc index 9fe2f8c7..8e138ade 100755 --- a/ge/common/context/ctx.cc +++ b/ge/common/context/ctx.cc @@ -18,7 +18,7 @@ using ge::OmgContext; namespace domi { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OmgContext &GetContext() { +OmgContext &GetContext() { static OmgContext context; return context; } diff --git a/ge/common/cust_aicpu_kernel_store.h b/ge/common/cust_aicpu_kernel_store.h index 033a636b..38124587 100755 --- a/ge/common/cust_aicpu_kernel_store.h +++ b/ge/common/cust_aicpu_kernel_store.h @@ -21,7 +21,7 @@ namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY CustAICPUKernelStore : public KernelStore { +class CustAICPUKernelStore : public KernelStore { public: CustAICPUKernelStore(); ~CustAICPUKernelStore() {} diff --git a/ge/common/debug/memory_dumper.cc b/ge/common/debug/memory_dumper.cc index 78ef2daa..f4a49440 100644 --- a/ge/common/debug/memory_dumper.cc +++ b/ge/common/debug/memory_dumper.cc @@ -30,13 +30,12 @@ const int kInvalidFd = (-1); } // namespace namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY MemoryDumper::MemoryDumper() : fd_(kInvalidFd) {} +MemoryDumper::MemoryDumper() : fd_(kInvalidFd) {} -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY MemoryDumper::~MemoryDumper() { Close(); } +MemoryDumper::~MemoryDumper() { Close(); } // Dump the data to the file -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile(const char *filename, void *data, - int64_t len) { +Status MemoryDumper::DumpToFile(const char *filename, void *data, int64_t len) { #ifdef FMK_SUPPORT_DUMP GE_CHECK_NOTNULL(filename); GE_CHECK_NOTNULL(data); @@ -81,7 +80,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile } // Open file -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Open(const char *filename) { +Status MemoryDumper::Open(const char *filename) { GE_CHK_BOOL_RET_STATUS(filename != nullptr, FAILED, "Incorrect parameter. filename is nullptr"); // Try to remove file first for reduce the close time by overwriting way @@ -104,7 +103,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Open(const } // Dump the data to file -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void *data, uint32_t len) const { +Status MemoryDumper::Dump(void *data, uint32_t len) const { GE_CHK_BOOL_RET_STATUS(data != nullptr, FAILED, "Incorrect parameter. data is nullptr"); #ifdef FMK_SUPPORT_DUMP diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index ebe16fed..da8160ff 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -15,6 +15,7 @@ */ #include "common/dump/dump_manager.h" + #include "framework/common/debug/ge_log.h" #include "framework/common/debug/log.h" @@ -26,7 +27,7 @@ const uint64_t kInferSessionId = 0; const uint32_t kAllOverflow = 3; } // namespace namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpManager &DumpManager::GetInstance() { +DumpManager &DumpManager::GetInstance() { static DumpManager instance; return instance; } @@ -74,7 +75,7 @@ void DumpManager::SetDumpList(const DumpConfig &dump_config, DumpProperties &dum Status DumpManager::SetNormalDumpConf(const DumpConfig &dump_config, DumpProperties &dump_properties) { if (dump_config.dump_status == kDumpOn) { - GELOGI("Only do normal dump process, dump status is %s.", dump_config.dump_status.c_str()); + GELOGI("Only do normal dump process, dump status is %s", dump_config.dump_status.c_str()); dump_properties.SetDumpStatus(dump_config.dump_status); std::string dump_op_switch = dump_config.dump_op_switch; dump_properties.SetDumpOpSwitch(dump_op_switch); @@ -104,8 +105,8 @@ Status DumpManager::SetNormalDumpConf(const DumpConfig &dump_config, DumpPropert Status DumpManager::SetDumpPath(const DumpConfig &dump_config, DumpProperties &dump_properties) { std::string dump_path = dump_config.dump_path; if (dump_path.empty()) { - GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty"); - REPORT_INNER_ERROR("E19999", "Dump path check is empty"); + GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty."); + REPORT_INNER_ERROR("E19999", "Dump path check is empty."); return PARAM_INVALID; } if (dump_path[dump_path.size() - 1] != '/') { @@ -117,7 +118,7 @@ Status DumpManager::SetDumpPath(const DumpConfig &dump_config, DumpProperties &d return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf(const DumpConfig &dump_config) { +Status DumpManager::SetDumpConf(const DumpConfig &dump_config) { DumpProperties dump_properties; if (!NeedDoDump(dump_config, dump_properties)) { GELOGD("No need do dump process."); @@ -131,8 +132,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const DumpProperties &DumpManager::GetDumpProperties( - uint64_t session_id) { +const DumpProperties &DumpManager::GetDumpProperties(uint64_t session_id) { std::lock_guard lock(mutex_); auto iter = dump_properties_map_.find(session_id); if (iter != dump_properties_map_.end()) { @@ -142,13 +142,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const DumpProperties &DumpManag return default_properties; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpManager::AddDumpProperties( - uint64_t session_id, const DumpProperties &dump_properties) { +void DumpManager::AddDumpProperties(uint64_t session_id, const DumpProperties &dump_properties) { std::lock_guard lock(mutex_); dump_properties_map_.emplace(session_id, dump_properties); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpManager::RemoveDumpProperties(uint64_t session_id) { +void DumpManager::RemoveDumpProperties(uint64_t session_id) { std::lock_guard lock(mutex_); auto iter = dump_properties_map_.find(session_id); if (iter != dump_properties_map_.end()) { diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 099920e7..3bed76d9 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -38,9 +38,7 @@ const uint32_t kAtomicOverflow = (0x1 << 1); const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); } // namespace namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::Split(const std::string &s, - std::vector &result, - const char *delchar) { +void DumpProperties::Split(const std::string &s, std::vector &result, const char *delchar) { if (s.empty()) { return; } @@ -68,7 +66,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::Split(cons delete[] buffer; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpStep(const std::string &dump_step) { +Status DumpProperties::CheckDumpStep(const std::string &dump_step) { std::string modified_dum_step = dump_step + "|"; std::smatch result; std::vector match_vecs; @@ -126,7 +124,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDum return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpMode(const std::string &dump_mode) { +Status DumpProperties::CheckDumpMode(const std::string &dump_mode) { const std::set dump_mode_list = {"input", "output", "all"}; std::set::iterator iter; @@ -143,7 +141,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDum return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDumpPath(const std::string &input) { +Status DumpProperties::CheckDumpPath(const std::string &input) { if (mmIsDir(input.c_str()) != EN_OK) { REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), std::vector({ @@ -175,7 +173,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckDum return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckEnableDump(const std::string &input) { +Status DumpProperties::CheckEnableDump(const std::string &input) { std::set enable_dump_option_list = {"1", "0"}; auto it = enable_dump_option_list.find(input); if (it == enable_dump_option_list.end()) { @@ -191,17 +189,16 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::CheckEna return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties::DumpProperties(const DumpProperties &other) { +DumpProperties::DumpProperties(const DumpProperties &other) { CopyFrom(other); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties::operator=( - const DumpProperties &other) { +DumpProperties &DumpProperties::operator=(const DumpProperties &other) { CopyFrom(other); return *this; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { +Status DumpProperties::SetDumpOptions() { if (enable_dump_ == kEnableFlag) { std::string dump_step; if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS && !dump_step.empty()) { @@ -220,7 +217,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpO return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOptions() { +Status DumpProperties::InitByOptions() { enable_dump_.clear(); enable_dump_debug_.clear(); dump_path_.clear(); @@ -281,8 +278,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::InitByOp } // The following is the new dump scenario of the fusion operator -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::AddPropertyValue( - const std::string &model, const std::set &layers) { +void DumpProperties::AddPropertyValue(const std::string &model, const std::set &layers) { for (const std::string &layer : layers) { GELOGI("This model %s config to dump layer %s", model.c_str(), layer.c_str()); } @@ -290,18 +286,18 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::AddPropert model_dump_properties_map_[model] = layers; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::DeletePropertyValue(const std::string &model) { +void DumpProperties::DeletePropertyValue(const std::string &model) { auto iter = model_dump_properties_map_.find(model); if (iter != model_dump_properties_map_.end()) { model_dump_properties_map_.erase(iter); } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::ClearDumpPropertyValue() { +void DumpProperties::ClearDumpPropertyValue() { model_dump_properties_map_.clear(); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::ClearDumpInfo() { +void DumpProperties::ClearDumpInfo() { enable_dump_.clear(); enable_dump_debug_.clear(); dump_path_.clear(); @@ -314,7 +310,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::ClearDumpI op_debug_mode_ = 0; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::set DumpProperties::GetAllDumpModel() const { +std::set DumpProperties::GetAllDumpModel() const { std::set model_list; for (auto &iter : model_dump_properties_map_) { model_list.insert(iter.first); @@ -323,8 +319,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::set DumpPrope return model_list; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::set DumpProperties::GetPropertyValue( - const std::string &model) const { +std::set DumpProperties::GetPropertyValue(const std::string &model) const { auto iter = model_dump_properties_map_.find(model); if (iter != model_dump_properties_map_.end()) { return iter->second; @@ -332,8 +327,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::set DumpPrope return {}; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool DumpProperties::IsLayerNeedDump( - const std::string &model, const std::string &om_name, const std::string &op_name) const { +bool DumpProperties::IsLayerNeedDump(const std::string &model, const std::string &om_name, + const std::string &op_name) const { // if dump all GELOGD("model name is %s om name is %s op is %s in layer need dump", model.c_str(), om_name.c_str(), op_name.c_str()); if (model_dump_properties_map_.find(DUMP_ALL_MODEL) != model_dump_properties_map_.end()) { @@ -353,67 +348,66 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool DumpProperties::IsLayerNee return model_iter->second.find(op_name) != model_iter->second.end(); } - GELOGD("Model %s is not seated to be dump.", model.c_str()); + GELOGD("Model %s is not seated to be dump", model.c_str()); return false; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetDumpPath(const std::string &path) { +void DumpProperties::SetDumpPath(const std::string &path) { dump_path_ = path; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::string &DumpProperties::GetDumpPath() const { +const std::string &DumpProperties::GetDumpPath() const { return dump_path_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetDumpStep(const std::string &step) { +void DumpProperties::SetDumpStep(const std::string &step) { dump_step_ = step; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::string &DumpProperties::GetDumpStep() const { +const std::string &DumpProperties::GetDumpStep() const { return dump_step_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetDumpMode(const std::string &mode) { +void DumpProperties::SetDumpMode(const std::string &mode) { dump_mode_ = mode; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::string &DumpProperties::GetDumpMode() const { +const std::string &DumpProperties::GetDumpMode() const { return dump_mode_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetDumpStatus(const std::string &status) { +void DumpProperties::SetDumpStatus(const std::string &status) { dump_status_ = status; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::string &DumpProperties::GetDumpStatus() const { +const std::string &DumpProperties::GetDumpStatus() const { return dump_status_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::InitInferOpDebug() { +void DumpProperties::InitInferOpDebug() { is_infer_op_debug_ = true; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetOpDebugMode(const uint32_t &op_debug_mode) { +void DumpProperties::SetOpDebugMode(const uint32_t &op_debug_mode) { op_debug_mode_ = op_debug_mode; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void DumpProperties::SetDumpOpSwitch( - const std::string &dump_op_switch) { +void DumpProperties::SetDumpOpSwitch(const std::string &dump_op_switch) { dump_op_switch_ = dump_op_switch; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::string &DumpProperties::GetDumpOpSwitch() const { +const std::string &DumpProperties::GetDumpOpSwitch() const { return dump_op_switch_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool DumpProperties::IsSingleOpNeedDump() const { +bool DumpProperties::IsSingleOpNeedDump() const { if (dump_op_switch_ == kDumpStatusOpen) { return true; } return false; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool DumpProperties::IsDumpOpen() const { +bool DumpProperties::IsDumpOpen() const { if (enable_dump_ == kEnableFlag || dump_status_ == kDumpStatusOpen) { return true; } @@ -441,7 +435,7 @@ Status DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { - GELOGD("Get ge.exec.dumpDebugMode %s successfully", dump_debug_mode.c_str()); + GELOGD("Get ge.exec.dumpDebugMode %s successfully.", dump_debug_mode.c_str()); } else { GELOGW("ge.exec.dumpDebugMode is not set."); return SUCCESS; @@ -469,7 +463,7 @@ Status DumpProperties::SetDumpDebugOptions() { return PARAM_INVALID; } } else { - GELOGI("ge.exec.enableDumpDebug is false or is not set."); + GELOGI("ge.exec.enableDumpDebug is false or is not set"); } return SUCCESS; } diff --git a/ge/common/fmk_error_codes.cc b/ge/common/fmk_error_codes.cc index ddb8089d..180af0e2 100755 --- a/ge/common/fmk_error_codes.cc +++ b/ge/common/fmk_error_codes.cc @@ -17,19 +17,18 @@ #include "framework/common/fmk_error_codes.h" namespace domi { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY StatusFactory *StatusFactory::Instance() { +StatusFactory *StatusFactory::Instance() { static StatusFactory instance; return &instance; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void StatusFactory::RegisterErrorNo(uint32_t err, - const std::string &desc) { +void StatusFactory::RegisterErrorNo(uint32_t err, const std::string &desc) { if (err_desc_.find(err) != err_desc_.end()) { return; } err_desc_[err] = desc; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string StatusFactory::GetErrDesc(uint32_t err) { +std::string StatusFactory::GetErrDesc(uint32_t err) { auto iter_find = err_desc_.find(err); if (iter_find == err_desc_.end()) { return ""; diff --git a/ge/common/formats/format_transfers/format_transfer_transpose.h b/ge/common/formats/format_transfers/format_transfer_transpose.h index 7fa19ff0..b608777c 100755 --- a/ge/common/formats/format_transfers/format_transfer_transpose.h +++ b/ge/common/formats/format_transfers/format_transfer_transpose.h @@ -33,7 +33,6 @@ Status TransposeWithShapeCheck(const uint8_t *src, const std::vector &s Status GetPermByForamt(Format src_format, Format dst_format, std::vector &perm); - class FormatTransferTranspose : public FormatTransfer { public: Status TransFormat(const TransArgs &args, TransResult &result) override; diff --git a/ge/common/formats/formats.cc b/ge/common/formats/formats.cc index 9e97a4d2..5a454d60 100755 --- a/ge/common/formats/formats.cc +++ b/ge/common/formats/formats.cc @@ -17,6 +17,7 @@ #include "common/formats/formats.h" #include + #include #include #include @@ -32,7 +33,7 @@ namespace ge { namespace formats { -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransFormat(const TransArgs &args, TransResult &result) { +Status TransFormat(const TransArgs &args, TransResult &result) { auto transfer = BuildFormatTransfer(args); if (transfer == nullptr) { std::string error = "Failed to trans data from format " + @@ -56,11 +57,8 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransFormat(const TransArg return transfer->TransFormat(args, result); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransShape(Format src_format, - const std::vector &src_shape, - DataType data_type, - Format dst_format, - std::vector &dst_shape) { +Status TransShape(Format src_format, const std::vector &src_shape, DataType data_type, Format dst_format, + std::vector &dst_shape) { formats::TransArgs args; args.src_format = src_format; args.dst_format = dst_format; @@ -76,7 +74,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransShape(Format src_form return transfer->TransShape(src_format, src_shape, data_type, dst_format, dst_shape); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransDataType(const CastArgs &args, TransResult &result) { +Status TransDataType(const CastArgs &args, TransResult &result) { auto transfer = BuildDataTypeTransfer(args); if (transfer == nullptr) { std::string error = "Failed to trans data from datatype " + @@ -95,11 +93,11 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status TransDataType(const CastAr return transfer->TransDataType(args, result); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY bool IsTransFormatSupport(const TransArgs &args) { +bool IsTransFormatSupport(const TransArgs &args) { return FormatTransferExists(args); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY bool IsTransDataTypeSupport(const CastArgs &args) { +bool IsTransDataTypeSupport(const CastArgs &args) { return DataTypeTransferExists(args); } } // namespace formats diff --git a/ge/common/formats/utils/formats_trans_utils.cc b/ge/common/formats/utils/formats_trans_utils.cc index db1812d0..63ad424f 100755 --- a/ge/common/formats/utils/formats_trans_utils.cc +++ b/ge/common/formats/utils/formats_trans_utils.cc @@ -41,15 +41,14 @@ int64_t GetCubeSizeByDataType(DataType data_type) { } } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY std::string ShapeToString(const GeShape &shape) { +std::string ShapeToString(const GeShape &shape) { return ShapeToString(shape.GetDims()); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY std::string ShapeToString(const std::vector &shape) { +std::string ShapeToString(const std::vector &shape) { return JoinToString(shape); } -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY std::string RangeToString(const std::vector> &ranges) { bool first = true; std::stringstream ss; diff --git a/ge/common/fp16_t.cc b/ge/common/fp16_t.cc index 2f94323d..adb55dfb 100755 --- a/ge/common/fp16_t.cc +++ b/ge/common/fp16_t.cc @@ -1180,20 +1180,40 @@ fp16_t &fp16_t::operator=(const double &d_val) { } // convert -fp16_t::operator float() const { return Fp16ToFloat(val); } -fp16_t::operator double() const { return Fp16ToDouble(val); } -fp16_t::operator int8_t() const { return Fp16ToInt8(val); } -fp16_t::operator uint8_t() const { return Fp16ToUInt8(val); } -fp16_t::operator int16_t() const { return Fp16ToInt16(val); } -fp16_t::operator uint16_t() const { return Fp16ToUInt16(val); } -fp16_t::operator int32_t() const { return Fp16ToInt32(val); } -fp16_t::operator uint32_t() const { return Fp16ToUInt32(val); } +fp16_t::operator float() const { + return Fp16ToFloat(val); +} +fp16_t::operator double() const { + return Fp16ToDouble(val); +} +fp16_t::operator int8_t() const { + return Fp16ToInt8(val); +} +fp16_t::operator uint8_t() const { + return Fp16ToUInt8(val); +} +fp16_t::operator int16_t() const { + return Fp16ToInt16(val); +} +fp16_t::operator uint16_t() const { + return Fp16ToUInt16(val); +} +fp16_t::operator int32_t() const { + return Fp16ToInt32(val); +} +fp16_t::operator uint32_t() const { + return Fp16ToUInt32(val); +} // Cannot be used, just in order to solve the compile error -fp16_t::operator int64_t() const { return 0; } +fp16_t::operator int64_t() const { + return 0; +} // Cannot be used, just in order to solve the compile error -fp16_t::operator uint64_t() const { return 0; } +fp16_t::operator uint64_t() const { + return 0; +} -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int fp16_t::IsInf() { +int fp16_t::IsInf() { if ((val & kFp16AbsMax) == kFp16ExpMask) { if (val & kFp16SignMask) { return -1; @@ -1205,12 +1225,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int fp16_t::IsInf() { } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY float fp16_t::ToFloat() const { return Fp16ToFloat(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY double fp16_t::ToDouble() const { return Fp16ToDouble(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int8_t fp16_t::ToInt8() const { return Fp16ToInt8(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint8_t fp16_t::ToUInt8() const { return Fp16ToUInt8(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int16_t fp16_t::ToInt16() const { return Fp16ToInt16(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint16_t fp16_t::ToUInt16() const { return Fp16ToUInt16(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int32_t fp16_t::ToInt32() const { return Fp16ToInt32(val); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t fp16_t::ToUInt32() const { return Fp16ToUInt32(val); } +float fp16_t::ToFloat() const { + return Fp16ToFloat(val); +} +double fp16_t::ToDouble() const { + return Fp16ToDouble(val); +} +int8_t fp16_t::ToInt8() const { + return Fp16ToInt8(val); +} +uint8_t fp16_t::ToUInt8() const { + return Fp16ToUInt8(val); +} +int16_t fp16_t::ToInt16() const { + return Fp16ToInt16(val); +} +uint16_t fp16_t::ToUInt16() const { + return Fp16ToUInt16(val); +} +int32_t fp16_t::ToInt32() const { + return Fp16ToInt32(val); +} +uint32_t fp16_t::ToUInt32() const { + return Fp16ToUInt32(val); +} } // namespace ge diff --git a/ge/common/ge/datatype_util.h b/ge/common/ge/datatype_util.h index c3b41b81..82c8d259 100644 --- a/ge/common/ge/datatype_util.h +++ b/ge/common/ge/datatype_util.h @@ -42,7 +42,7 @@ static std::map CONST_OPDATA_TYPE_SIZE_MAP = { {ge::DT_UINT8, kGeSizeUint8}, {ge::DT_UINT16, kGeSizeUint16}, {ge::DT_UINT32, kGeSizeUint32}, {ge::DT_UINT64, kGeSizeUint64}, {ge::DT_DOUBLE, kGeSizeDouble}, {ge::DT_BOOL, kGeSizeBool}}; -class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY DataTypeUtil { +class DataTypeUtil { public: static bool DataTypeTranslatable(const ge::DataType &src_out_data_type, const ge::DataType &dst_in_data_type); static const std::vector &GetTranslatableDataTypesBySrc(const ge::DataType &src_out_data_type); diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index 70c1ab94..3680a8bb 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -42,7 +42,7 @@ const int kBaseInt = 10; std::map TBEPluginManager::options_ = {}; // Get Singleton Instance -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY TBEPluginManager &TBEPluginManager::Instance() { +TBEPluginManager &TBEPluginManager::Instance() { static TBEPluginManager instance_ptr_; return instance_ptr_; } @@ -61,7 +61,7 @@ Status TBEPluginManager::ClearHandles_() { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status TBEPluginManager::Finalize() { +Status TBEPluginManager::Finalize() { Status ret = ClearHandles_(); return ret; } @@ -207,7 +207,6 @@ void TBEPluginManager::LoadCustomOpLib() { } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void TBEPluginManager::LoadPluginSo(const std::map &options) { vector file_list; string caffe_parser_path; @@ -246,7 +245,6 @@ void TBEPluginManager::LoadPluginSo(const std::map &options) { } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void TBEPluginManager::InitPreparation(const std::map &options) { options_.insert(options.begin(), options.end()); // Load TBE plugin diff --git a/ge/graph/common/ge_call_wrapper.h b/ge/common/ge_call_wrapper.h similarity index 100% rename from ge/graph/common/ge_call_wrapper.h rename to ge/common/ge_call_wrapper.h diff --git a/ge/common/ge_format_util.cc b/ge/common/ge_format_util.cc index f3dee571..0ffa686f 100755 --- a/ge/common/ge_format_util.cc +++ b/ge/common/ge_format_util.cc @@ -18,9 +18,7 @@ #include "common/formats/formats.h" namespace ge { -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Status GeFormatUtil::TransShape(const TensorDesc &src_desc, - Format dst_format, - std::vector &dst_shape) { +Status GeFormatUtil::TransShape(const TensorDesc &src_desc, Format dst_format, std::vector &dst_shape) { return formats::TransShape(src_desc.GetFormat(), src_desc.GetShape().GetDims(), src_desc.GetDataType(), dst_format, dst_shape); } diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h index 13253cbe..f0831075 100755 --- a/ge/common/helper/model_cache_helper.h +++ b/ge/common/helper/model_cache_helper.h @@ -24,7 +24,7 @@ #include "external/ge/ge_api_error_codes.h" #include "graph/compute_graph.h" #include "graph/manager/graph_var_manager.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" namespace ge { using Json = nlohmann::json; diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 4e760a4a..2608b1e1 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -33,7 +33,7 @@ const uint32_t kStatiOmFileModelNum = 1; namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelHelper::~ModelHelper() { (void)ReleaseLocalModelData(); } +ModelHelper::~ModelHelper() { (void)ReleaseLocalModelData(); } Status ModelHelper::SaveModelPartition(std::shared_ptr &om_file_save_helper, ModelPartitionType type, const uint8_t *data, size_t size, size_t model_index) { @@ -108,8 +108,8 @@ Status ModelHelper::SaveSizeToModelDef(const GeModelPtr &ge_model) { return SUCCESS; } -Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save_helper, - const GeModelPtr &ge_model, ge::Buffer &model_buffer, size_t model_index) { +Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save_helper, 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, "[Creat][Model]Failed, Model %s Ptr", ge_model->GetName().c_str()); @@ -143,8 +143,8 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save return SUCCESS; } -Status ModelHelper::SaveModelWeights(std::shared_ptr &om_file_save_helper, - const GeModelPtr &ge_model, size_t model_index) { +Status ModelHelper::SaveModelWeights(std::shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, + size_t model_index) { auto ge_model_weight = ge_model->GetWeight(); GELOGD("WEIGHTS_DATA size is %zu, %p", ge_model_weight.GetSize(), ge_model_weight.GetData()); // weight is not necessary @@ -187,8 +187,8 @@ Status ModelHelper::SaveModelCustAICPU(std::shared_ptr &om_fil return SUCCESS; } -Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_save_helper, - const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { +Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_save_helper, 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, "[Creat][ModelTaskDef]Failed, it is nullptr, " @@ -231,8 +231,8 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ return SUCCESS; } -Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_save_helper, - const GeModelPtr &ge_model, size_t model_num) { +Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_save_helper, const GeModelPtr &ge_model, + size_t model_num) { // Save target/version to model_header ModelFileHeader &model_header = om_file_save_helper->GetModelFileHeader(); model_header.platform_type = ge_model->GetPlatformType(); @@ -246,8 +246,10 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[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 " + "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; @@ -271,9 +273,9 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s return SUCCESS; } -Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_file_save_helper, - const GeModelPtr &ge_model, ge::Buffer &model_buffer, - ge::Buffer &task_buffer, size_t model_index) { +Status ModelHelper::SaveAllModelPartiton(std::shared_ptr &om_file_save_helper, + 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][ModelDef]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); @@ -316,10 +318,8 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmModel(const GeModelPtr &ge_model, - const SaveParam &save_param, - const std::string &output_file, - ModelBufferData& model) { +Status ModelHelper::SaveToOmModel(const GeModelPtr &ge_model, const SaveParam &save_param, + const std::string &output_file, ModelBufferData &model) { if (output_file.empty()) { GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix, " "model %s", ge_model->GetName().c_str()); @@ -367,13 +367,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRootModel( - const GeRootModelPtr &ge_root_model, - const SaveParam &save_param, - const std::string &output_file, - ModelBufferData& model, - bool is_unknown_shape) { - +Status ModelHelper::SaveToOmRootModel(const GeRootModelPtr &ge_root_model, const SaveParam &save_param, + const std::string &output_file, ModelBufferData &model, bool is_unknown_shape) { GE_CHECK_NOTNULL(ge_root_model); GE_IF_BOOL_EXEC(ge_root_model == nullptr, GELOGE(FAILED, "[Check][GERootModel]Ge_root_model is nullptr"); @@ -466,8 +461,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { +Status ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { if (output_file.empty()) { 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()); @@ -545,7 +539,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin return (ret == SUCCESS ? SUCCESS : FAILED); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { +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, "[Load][Model]Model_data is nullptr or model_data_size is 0"); @@ -597,7 +591,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { +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, "[Load][RootModel] " "Model_data is nullptr or model data is empty."); @@ -783,7 +777,6 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & return SUCCESS; } - Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { @@ -814,7 +807,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { +Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); @@ -838,9 +831,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper, - GeModelPtr &cur_model, - size_t mode_index) { +Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index) { ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition, mode_index) != SUCCESS) { GELOGE(FAILED, "Get task model partition failed."); @@ -915,8 +906,8 @@ Status ModelHelper::LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper) { return SUCCESS; } -Status ModelHelper::LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper, - GeModelPtr &cur_model, size_t mode_index) { +Status ModelHelper::LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, + size_t mode_index) { // Load cust aicpu kernels ModelPartition partition_kernel_def; CustAICPUKernelStore kernel_store; @@ -933,7 +924,7 @@ Status ModelHelper::LoadCustAICPUKernelStore(OmFileLoadHelper &om_load_helper, return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeModelPtr ModelHelper::GetGeModel() { +GeModelPtr ModelHelper::GetGeModel() { if (model_ != nullptr) { return model_; } @@ -946,7 +937,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeModelPtr ModelHelper::GetGeMo return out_model; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeRootModelPtr ModelHelper::GetGeRootModel() { +GeRootModelPtr ModelHelper::GetGeRootModel() { if (root_model_ != nullptr) { return root_model_; } @@ -959,7 +950,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY GeRootModelPtr ModelHelper::Get return out_model; } - Status ModelHelper::ReleaseLocalModelData() noexcept { Status result = SUCCESS; if (model_addr_tmp_ != nullptr) { @@ -976,8 +966,7 @@ Status ModelHelper::ReleaseLocalModelData() noexcept { return result; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::GetBaseNameFromFileName( - const string &file_name, string &base_name) { +Status ModelHelper::GetBaseNameFromFileName(const string &file_name, string &base_name) { GELOGD("Get base_name from file, file_name:%s", file_name.c_str()); GE_CHK_BOOL_EXEC_WARN(!file_name.empty(), return FAILED, "File path may not valid, check params --output"); size_t start_position = 0; @@ -992,8 +981,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::GetBaseName return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::GetModelNameFromMergedGraphName( - const string &graph_name, string &model_name) { +Status ModelHelper::GetModelNameFromMergedGraphName(const string &graph_name, string &model_name) { GELOGD("Get model_name from graph_name, graph_name:%s", graph_name.c_str()); // this can only be used after merged graph(graph name will be append with "_x", x is index); GE_CHK_BOOL_EXEC_WARN(!graph_name.empty(), return FAILED, "File path may not valid, check params --output"); @@ -1035,8 +1023,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file, can't be parsed"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "[Parse][ModelContent]Failed because of invalid om file %s, please check om param", - model_file); + "[Parse][ModelContent]Failed because of invalid om file %s, please check om param", model_file); return ret; } diff --git a/ge/common/helper/om_file_helper.cc b/ge/common/helper/om_file_helper.cc index cd13c5d8..a42316ff 100644 --- a/ge/common/helper/om_file_helper.cc +++ b/ge/common/helper/om_file_helper.cc @@ -18,10 +18,11 @@ #include #include -#include "common/math/math_util.h" + #include "common/auth/file_saver.h" -#include "framework/common/debug/log.h" +#include "common/math/math_util.h" #include "framework/common/debug/ge_log.h" +#include "framework/common/debug/log.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/util.h" @@ -32,7 +33,7 @@ const int32_t kOptionalNum = 2; } namespace ge { // For Load -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(const ge::ModelData &model) { +Status OmFileLoadHelper::Init(const ge::ModelData &model) { if (CheckModelValid(model) != SUCCESS) { return FAILED; } @@ -42,8 +43,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(c return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(uint8_t *model_data, - const uint32_t model_data_size) { +Status OmFileLoadHelper::Init(uint8_t *model_data, const uint32_t model_data_size) { Status status = LoadModelPartitionTable(model_data, model_data_size); if (status != SUCCESS) { return status; @@ -52,9 +52,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(u return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(uint8_t *model_data, - uint32_t model_data_size, - uint32_t model_num) { +Status OmFileLoadHelper::Init(uint8_t *model_data, uint32_t model_data_size, uint32_t model_num) { Status status = LoadModelPartitionTable(model_data, model_data_size, model_num); if (status != SUCCESS) { return status; @@ -64,8 +62,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::Init(u } // Use both -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::GetModelPartition(ModelPartitionType type, - ModelPartition &partition) { +Status OmFileLoadHelper::GetModelPartition(ModelPartitionType type, ModelPartition &partition) { if (!is_inited_) { GELOGE(PARAM_INVALID, "OmFileLoadHelper has not been initialized!"); return PARAM_INVALID; @@ -90,9 +87,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::GetMod return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileLoadHelper::GetModelPartition(ModelPartitionType type, - ModelPartition &partition, - size_t model_index) { +Status OmFileLoadHelper::GetModelPartition(ModelPartitionType type, ModelPartition &partition, size_t model_index) { if (!is_inited_) { GELOGE(PARAM_INVALID, "OmFileLoadHelper has not been initialized!"); return PARAM_INVALID; @@ -248,12 +243,11 @@ Status OmFileLoadHelper::LoadModelPartitionTable(uint8_t *model_data, uint32_t m return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY const std::vector - &OmFileSaveHelper::GetModelPartitions() const { +const std::vector &OmFileSaveHelper::GetModelPartitions() const { return context_.partition_datas_; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelPartitionTable *OmFileSaveHelper::GetPartitionTable() { +ModelPartitionTable *OmFileSaveHelper::GetPartitionTable() { auto partition_size = static_cast(context_.partition_datas_.size()); // Build ModelPartitionTable, flex array context_.partition_table_.clear(); @@ -272,8 +266,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelPartitionTable *OmFileSave return partition_table; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelPartitionTable *OmFileSaveHelper::GetPartitionTable( - size_t cur_ctx_index) { +ModelPartitionTable *OmFileSaveHelper::GetPartitionTable(size_t cur_ctx_index) { auto &cur_ctx = model_contexts_[cur_ctx_index]; auto partition_size = static_cast(cur_ctx.partition_datas_.size()); // Build ModelPartitionTable, flex array @@ -293,8 +286,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelPartitionTable *OmFileSave return partition_table; } - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OmFileSaveHelper::AddPartition(ModelPartition &partition) { +Status OmFileSaveHelper::AddPartition(ModelPartition &partition) { if (ge::CheckUint32AddOverflow(context_.model_data_len_, partition.size) != SUCCESS) { GELOGE(FAILED, "UINT32 %u and %u addition can result in overflow!", context_.model_data_len_, partition.size); return FAILED; @@ -379,8 +371,8 @@ Status OmFileSaveHelper::SaveModelToFile(const char *output_file, ModelBufferDat #endif } -Status OmFileSaveHelper::SaveRootModel(const SaveParam &save_param, const char *output_file, - ModelBufferData &model, bool is_offline) { +Status OmFileSaveHelper::SaveRootModel(const SaveParam &save_param, const char *output_file, ModelBufferData &model, + bool is_offline) { (void)save_param.cert_file; (void)save_param.ek_file; (void)save_param.encode_mode; @@ -409,8 +401,8 @@ Status OmFileSaveHelper::SaveRootModel(const SaveParam &save_param, const char * model_header_.length += size_of_table + cur_model_data_len; model_partition_tabels.push_back(tmp_table); all_model_partitions.push_back(cur_ctx.partition_datas_); - GELOGD("sizeof(ModelPartitionTable):%u, cur_model_data_len:%u, cur_context_index:%zu", - size_of_table, cur_model_data_len, ctx_index); + GELOGD("sizeof(ModelPartitionTable):%u, cur_model_data_len:%u, cur_context_index:%zu", size_of_table, + cur_model_data_len, ctx_index); } Status ret; if (is_offline) { diff --git a/ge/common/kernel_store.h b/ge/common/kernel_store.h index b3f4a62e..e7b867a3 100755 --- a/ge/common/kernel_store.h +++ b/ge/common/kernel_store.h @@ -48,7 +48,7 @@ struct KernelStoreItemHead { uint32_t bin_len; }; -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY KernelStore { +class KernelStore { public: KernelStore() = default; virtual ~KernelStore() = default; diff --git a/ge/graph/common/local_context.cc b/ge/common/local_context.cc similarity index 97% rename from ge/graph/common/local_context.cc rename to ge/common/local_context.cc index bd747021..e31f2342 100644 --- a/ge/graph/common/local_context.cc +++ b/ge/common/local_context.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/graph/common/local_context.h b/ge/common/local_context.h similarity index 100% rename from ge/graph/common/local_context.h rename to ge/common/local_context.h diff --git a/ge/common/math/fp16_math.cc b/ge/common/math/fp16_math.cc index 6a9c2fb3..c2dfeb61 100755 --- a/ge/common/math/fp16_math.cc +++ b/ge/common/math/fp16_math.cc @@ -18,7 +18,7 @@ #include "external/register/register_types.h" namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t sqrt(fp16_t fp) { +fp16_t sqrt(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -29,7 +29,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t sqrt(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t rsqrt(fp16_t fp) { +fp16_t rsqrt(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -40,7 +40,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t rsqrt(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t rcp(fp16_t fp) { +fp16_t rcp(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -51,7 +51,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t rcp(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t exp(fp16_t fp) { +fp16_t exp(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -63,7 +63,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t exp(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t pow2(fp16_t fp) { +fp16_t pow2(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -75,7 +75,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t pow2(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t pow10(fp16_t fp) { +fp16_t pow10(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -87,7 +87,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t pow10(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t ln(fp16_t fp) { +fp16_t ln(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -99,7 +99,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t ln(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t log2(fp16_t fp) { +fp16_t log2(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -111,7 +111,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t log2(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t log10(fp16_t fp) { +fp16_t log10(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -123,7 +123,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t log10(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t cos(fp16_t fp) { +fp16_t cos(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -135,7 +135,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t cos(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t sin(fp16_t fp) { +fp16_t sin(fp16_t fp) { fp16_t ret; // Convert half precision float number to double double dVal = fp; @@ -147,13 +147,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t sin(fp16_t fp) { return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t abs(fp16_t fp) { +fp16_t abs(fp16_t fp) { fp16_t ret; ret.val = (fp.val & kFp16AbsMax); return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t max(fp16_t fp1, fp16_t fp2) { +fp16_t max(fp16_t fp1, fp16_t fp2) { if (fp1 >= fp2) { return fp1; } else { @@ -161,7 +161,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t max(fp16_t fp1, fp16_t f } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY fp16_t min(fp16_t fp1, fp16_t fp2) { +fp16_t min(fp16_t fp1, fp16_t fp2) { if (fp1 <= fp2) { return fp1; } else { diff --git a/ge/model/ge_model.cc b/ge/common/model/ge_model.cc similarity index 99% rename from ge/model/ge_model.cc rename to ge/common/model/ge_model.cc index 1bf35afc..7fc58b6d 100755 --- a/ge/model/ge_model.cc +++ b/ge/common/model/ge_model.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include #include "framework/common/debug/log.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/model/ge_model.h b/ge/common/model/ge_model.h similarity index 90% rename from ge/model/ge_model.h rename to ge/common/model/ge_model.h index 6356c621..0e791746 100755 --- a/ge/model/ge_model.h +++ b/ge/common/model/ge_model.h @@ -31,7 +31,7 @@ namespace ge { const uint32_t INVALID_MODEL_ID = 0xFFFFFFFFUL; -class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeModel : public AttrHolder { +class GeModel : public AttrHolder { public: GeModel(); ~GeModel() = default; @@ -82,13 +82,13 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeModel : public AttrHolder private: void Init(); - ProtoAttrMapHelper attrs_; + ProtoAttrMapHelper attrs_; /*lint !e148*/ Graph graph_; - std::shared_ptr task_; - TBEKernelStore tbe_kernal_store_; - CustAICPUKernelStore cust_aicpu_kernal_store_; - Buffer weights_buffer_; + std::shared_ptr task_; /*lint !e148*/ + TBEKernelStore tbe_kernal_store_; /*lint !e148*/ + CustAICPUKernelStore cust_aicpu_kernal_store_; /*lint !e148*/ + Buffer weights_buffer_; /*lint !e148*/ std::string name_; uint32_t version_ = {0}; diff --git a/ge/model/ge_root_model.cc b/ge/common/model/ge_root_model.cc similarity index 95% rename from ge/model/ge_root_model.cc rename to ge/common/model/ge_root_model.cc index b6a1e175..3fe10991 100644 --- a/ge/model/ge_root_model.cc +++ b/ge/common/model/ge_root_model.cc @@ -14,8 +14,9 @@ * limitations under the License. */ -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" #include "graph/debug/ge_attr_define.h" + namespace ge { void GeRootModel::SetSubgraphInstanceNameToModel(string instance_name, GeModelPtr ge_model) { subgraph_instance_name_to_model_.insert(std::pair(instance_name, ge_model)); diff --git a/ge/model/ge_root_model.h b/ge/common/model/ge_root_model.h similarity index 98% rename from ge/model/ge_root_model.h rename to ge/common/model/ge_root_model.h index 9e8e116e..e9ba3da6 100755 --- a/ge/model/ge_root_model.h +++ b/ge/common/model/ge_root_model.h @@ -15,7 +15,7 @@ */ #include #include "graph/compute_graph.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #ifndef GE_MODEL_GE_ROOT_MODEL_H_ #define GE_MODEL_GE_ROOT_MODEL_H_ diff --git a/ge/common/model_parser/model_parser.cc b/ge/common/model_parser/model_parser.cc index 7447cdf8..5d1869be 100644 --- a/ge/common/model_parser/model_parser.cc +++ b/ge/common/model_parser/model_parser.cc @@ -23,12 +23,10 @@ #include "framework/common/helper/model_helper.h" namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelParserBase::ModelParserBase() {} -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelParserBase::~ModelParserBase() {} +ModelParserBase::ModelParserBase() {} +ModelParserBase::~ModelParserBase() {} -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelParserBase::LoadFromFile(const char *model_path, - int32_t priority, - ge::ModelData &model_data) { +Status ModelParserBase::LoadFromFile(const char *model_path, int32_t priority, ge::ModelData &model_data) { std::string real_path = RealPath(model_path); if (real_path.empty()) { GELOGE(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "[Check][Param]Model file path %s is invalid", @@ -81,9 +79,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelParserBase::LoadFro return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelParserBase::ParseModelContent(const ge::ModelData &model, - uint8_t *&model_data, - uint32_t &model_len) { +Status ModelParserBase::ParseModelContent(const ge::ModelData &model, uint8_t *&model_data, uint32_t &model_len) { // Parameter validity check GE_CHECK_NOTNULL(model.model_data); diff --git a/ge/common/model_saver.cc b/ge/common/model_saver.cc index 24e837f7..56045030 100755 --- a/ge/common/model_saver.cc +++ b/ge/common/model_saver.cc @@ -29,8 +29,7 @@ namespace ge { const uint32_t kInteval = 2; -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFile(const char *file_path, - const Json &model) { +Status ModelSaver::SaveJsonToFile(const char *file_path, const Json &model) { Status ret = SUCCESS; if (file_path == nullptr || SUCCESS != CheckPath(file_path)) { GELOGE(FAILED, "[Check][OutputFile]Failed, file %s", file_path); diff --git a/ge/graph/common/omg_util.cc b/ge/common/omg_util.cc similarity index 95% rename from ge/graph/common/omg_util.cc rename to ge/common/omg_util.cc index b2017e4d..31e4270a 100644 --- a/ge/graph/common/omg_util.cc +++ b/ge/common/omg_util.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" @@ -59,8 +59,8 @@ Status SetStreamLabel(const ge::NodePtr &node, const std::string &label) { if (!AttrUtils::SetStr(tmp_desc, ge::ATTR_NAME_STREAM_LABEL, label)) { REPORT_INNER_ERROR("E19999", "Set Attr:%s fail for op:%s(%s)", ATTR_NAME_STREAM_LABEL.c_str(), node->GetName().c_str(), node->GetType().c_str()); - GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_STREAM_LABEL.c_str(), - node->GetName().c_str(), node->GetType().c_str()); + GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_STREAM_LABEL.c_str(), node->GetName().c_str(), + node->GetType().c_str()); return FAILED; } @@ -100,8 +100,8 @@ Status SetActiveLabelList(const ge::NodePtr &node, const std::vectorGetName().c_str(), node->GetType().c_str()); - GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_ACTIVE_LABEL_LIST.c_str(), - node->GetName().c_str(), node->GetType().c_str()); + GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_ACTIVE_LABEL_LIST.c_str(), node->GetName().c_str(), + node->GetType().c_str()); return FAILED; } @@ -163,8 +163,8 @@ Status SetOriginalNodeName(const ge::NodePtr &node, const std::string &orig_name if (!AttrUtils::SetStr(tmp_desc, ge::ATTR_NAME_ORIG_NODE_NAME, orig_name)) { REPORT_INNER_ERROR("E19999", "Set Attr:%s fail for op:%s(%s)", ATTR_NAME_ORIG_NODE_NAME.c_str(), node->GetName().c_str(), node->GetType().c_str()); - GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_ORIG_NODE_NAME.c_str(), - node->GetName().c_str(), node->GetType().c_str()); + GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_ORIG_NODE_NAME.c_str(), node->GetName().c_str(), + node->GetType().c_str()); return FAILED; } @@ -207,8 +207,8 @@ Status SetNextIteration(const NodePtr &node, const NodePtr &next) { if (!AttrUtils::SetStr(op_desc, ATTR_NAME_NEXT_ITERATION, name)) { REPORT_INNER_ERROR("E19999", "Set Attr:%s fail for op:%s(%s)", ATTR_NAME_NEXT_ITERATION.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); - GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_NEXT_ITERATION.c_str(), - op_desc->GetName().c_str(), op_desc->GetType().c_str()); + GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_NEXT_ITERATION.c_str(), op_desc->GetName().c_str(), + op_desc->GetType().c_str()); return FAILED; } return SUCCESS; @@ -290,8 +290,8 @@ void SetControlFlowGroup(const NodePtr &node, int64_t group) { if (!AttrUtils::SetInt(op_desc, ATTR_NAME_CONTROL_FLOW_GROUP, group)) { REPORT_INNER_ERROR("E19999", "Set Attr:%s fail for op:%s(%s)", ATTR_NAME_CONTROL_FLOW_GROUP.c_str(), node->GetName().c_str(), node->GetType().c_str()); - GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_CONTROL_FLOW_GROUP.c_str(), - node->GetName().c_str(), node->GetType().c_str()); + GELOGE(FAILED, "[Set][Attr] %s fail for op:%s(%s)", ATTR_NAME_CONTROL_FLOW_GROUP.c_str(), node->GetName().c_str(), + node->GetType().c_str()); } } } // namespace ge diff --git a/ge/graph/common/omg_util.h b/ge/common/omg_util.h similarity index 100% rename from ge/graph/common/omg_util.h rename to ge/common/omg_util.h diff --git a/ge/common/op/attr_value_util.cc b/ge/common/op/attr_value_util.cc index 8be0ecd1..fd5b842a 100644 --- a/ge/common/op/attr_value_util.cc +++ b/ge/common/op/attr_value_util.cc @@ -77,37 +77,33 @@ DEFINE_SET_ATTR_VALUE_LIST(const std::string &, s); } \ } while (0); -#define DEFINE_ADD_ATTR_VALUE(KEY_TYPE, VALUE_TYPE) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddOpAttr(KEY_TYPE map_key, VALUE_TYPE value, OpDef *op_def) { \ - GE_CHECK_NOTNULL_JUST_RETURN(op_def); \ - auto attr = op_def->mutable_attr(); \ - ADD_TO_ATTR_MAP(map_key, value, attr) \ - } \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddOpAttr(KEY_TYPE map_key, VALUE_TYPE value, \ - AttrDefMap *attr_map) { \ - ADD_TO_ATTR_MAP(map_key, value, attr_map) \ - } \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddModelAttr(KEY_TYPE map_key, VALUE_TYPE value, \ - ModelDef *model_def) { \ - GE_CHECK_NOTNULL_JUST_RETURN(model_def); \ - auto attr = model_def->mutable_attr(); \ - ADD_TO_ATTR_MAP(map_key, value, attr) \ +#define DEFINE_ADD_ATTR_VALUE(KEY_TYPE, VALUE_TYPE) \ + void AddOpAttr(KEY_TYPE map_key, VALUE_TYPE value, OpDef *op_def) { \ + GE_CHECK_NOTNULL_JUST_RETURN(op_def); \ + auto attr = op_def->mutable_attr(); \ + ADD_TO_ATTR_MAP(map_key, value, attr) \ + } \ + void AddOpAttr(KEY_TYPE map_key, VALUE_TYPE value, AttrDefMap *attr_map) { \ + ADD_TO_ATTR_MAP(map_key, value, attr_map) \ + } \ + void AddModelAttr(KEY_TYPE map_key, VALUE_TYPE value, ModelDef *model_def) { \ + GE_CHECK_NOTNULL_JUST_RETURN(model_def); \ + auto attr = model_def->mutable_attr(); \ + ADD_TO_ATTR_MAP(map_key, value, attr) \ } -#define DEFINE_ADD_ATTR_VALUE_LIST(KEY_TYPE, VALUE_TYPE) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddOpAttrList(KEY_TYPE map_key, VALUE_TYPE value, \ - OpDef *op_def) { \ - GE_CHECK_NOTNULL_JUST_RETURN(op_def); \ - auto attr = op_def->mutable_attr(); \ - ADD_TO_ATTR_MAP_LIST(map_key, value, attr) \ - } \ - FMK_FUNC_DEV_VISIBILITY void AddOpAttrList(KEY_TYPE map_key, VALUE_TYPE value, AttrDefMap *attr_map) { \ - ADD_TO_ATTR_MAP_LIST(map_key, value, attr_map) \ - } \ - FMK_FUNC_DEV_VISIBILITY void AddModelAttrList(KEY_TYPE map_key, VALUE_TYPE value, ModelDef *model_def) { \ - GE_CHECK_NOTNULL_JUST_RETURN(model_def); \ - auto attr = model_def->mutable_attr(); \ - ADD_TO_ATTR_MAP_LIST(map_key, value, attr) \ +#define DEFINE_ADD_ATTR_VALUE_LIST(KEY_TYPE, VALUE_TYPE) \ + void AddOpAttrList(KEY_TYPE map_key, VALUE_TYPE value, OpDef *op_def) { \ + GE_CHECK_NOTNULL_JUST_RETURN(op_def); \ + auto attr = op_def->mutable_attr(); \ + ADD_TO_ATTR_MAP_LIST(map_key, value, attr) \ + } \ + void AddOpAttrList(KEY_TYPE map_key, VALUE_TYPE value, AttrDefMap *attr_map) { \ + ADD_TO_ATTR_MAP_LIST(map_key, value, attr_map)} FMK_FUNC_DEV_VISIBILITY void \ + AddModelAttrList(KEY_TYPE map_key, VALUE_TYPE value, ModelDef *model_def) { \ + GE_CHECK_NOTNULL_JUST_RETURN(model_def); \ + auto attr = model_def->mutable_attr(); \ + ADD_TO_ATTR_MAP_LIST(map_key, value, attr) \ } DEFINE_ADD_ATTR_VALUE(const std::string &, const std::string &); @@ -127,46 +123,42 @@ DEFINE_ADD_ATTR_VALUE_LIST(const std::string &, const bool); DEFINE_ADD_ATTR_VALUE_LIST(const std::string &, const int64_t); DEFINE_ADD_ATTR_VALUE_LIST(const std::string &, const std::string &); -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddOpAttr(const std::string &map_key, AttrDef &attr, - OpDef *op_def) { +void AddOpAttr(const std::string &map_key, AttrDef &attr, OpDef *op_def) { GE_CHECK_NOTNULL_JUST_RETURN(op_def); GE_CHECK_NOTNULL_JUST_RETURN(op_def->mutable_attr()); (void)op_def->mutable_attr()->insert(AttrDefPair(map_key, attr)); } -#define DEFINE_GET_ATTR_VALUE(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetAttrDefValue(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, \ - const AttrDefMap &attr) { \ - auto it = attr.find(map_key); \ - if (it != attr.end()) { \ - *value = it->second.FIELD(); \ - return true; \ - } \ - return false; \ +#define DEFINE_GET_ATTR_VALUE(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ + bool GetAttrDefValue(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, const AttrDefMap &attr) { \ + auto it = attr.find(map_key); \ + if (it != attr.end()) { \ + *value = it->second.FIELD(); \ + return true; \ + } \ + return false; \ } -#define DEFINE_GET_ATTR_POINT_REF(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetAttrDefValue(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE *&value, \ - AttrDefMap *attr) { \ - GE_RT_FALSE_CHECK_NOTNULL(attr); \ - auto it = attr->find(map_key); \ - if (it != attr->end()) { \ - value = it->second.mutable_##FIELD(); \ - return true; \ - } \ - return false; \ +#define DEFINE_GET_ATTR_POINT_REF(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ + bool GetAttrDefValue(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE *&value, AttrDefMap *attr) { \ + GE_RT_FALSE_CHECK_NOTNULL(attr); \ + auto it = attr->find(map_key); \ + if (it != attr->end()) { \ + value = it->second.mutable_##FIELD(); \ + return true; \ + } \ + return false; \ } -#define DEFINE_GET_ATTR_CONST_POINT_REF(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetAttrDefValue( \ - ARG_TYPE_KEY map_key, const ARG_TYPE_VALUE *&value, const AttrDefMap &attr) { \ - auto it = attr.find(map_key); \ - if (it == attr.end()) { \ - return false; \ - } \ - \ - value = &(it->second.FIELD()); \ - return true; \ +#define DEFINE_GET_ATTR_CONST_POINT_REF(ARG_TYPE_KEY, ARG_TYPE_VALUE, FIELD) \ + bool GetAttrDefValue(ARG_TYPE_KEY map_key, const ARG_TYPE_VALUE *&value, const AttrDefMap &attr) { \ + auto it = attr.find(map_key); \ + if (it == attr.end()) { \ + return false; \ + } \ + \ + value = &(it->second.FIELD()); \ + return true; \ } #define DEFINE_GET_BYTES_ATTR_VALUE(ARG_TYPE_KEY, ARG_TYPE_VALUE) \ @@ -216,16 +208,14 @@ DEFINE_GET_ATTR_CONST_POINT_REF(const std::string &, NamedAttrs, func); DEFINE_GET_BYTES_ATTR_VALUE(const std::string &, std::string *); -#define DEFINE_GET_OP_ATTR(ARG_TYPE_KEY, ARG_TYPE_VALUE) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetOpAttr(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, \ - const OpDef *op_def) { \ - GE_RT_FALSE_CHECK_NOTNULL(op_def); \ - return GetAttrDefValue(map_key, value, op_def->attr()); \ - } \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetModelAttr(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, \ - const ModelDef *model_def) { \ - GE_RT_FALSE_CHECK_NOTNULL(model_def); \ - return GetAttrDefValue(map_key, value, model_def->attr()); \ +#define DEFINE_GET_OP_ATTR(ARG_TYPE_KEY, ARG_TYPE_VALUE) \ + bool GetOpAttr(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, const OpDef *op_def) { \ + GE_RT_FALSE_CHECK_NOTNULL(op_def); \ + return GetAttrDefValue(map_key, value, op_def->attr()); \ + } \ + bool GetModelAttr(ARG_TYPE_KEY map_key, ARG_TYPE_VALUE value, const ModelDef *model_def) { \ + GE_RT_FALSE_CHECK_NOTNULL(model_def); \ + return GetAttrDefValue(map_key, value, model_def->attr()); \ } DEFINE_GET_OP_ATTR(const std::string &, std::string *); @@ -238,8 +228,7 @@ DEFINE_GET_OP_ATTR(const std::string &, bool *); DEFINE_GET_OP_ATTR(const std::string &, AttrDef_ListValue *); #define DEFINE_GET_BT_ATTR(ARG_TYPE_KEY, ARG_TYPE_VALUE) \ - FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool GetBytesAttr(ARG_TYPE_KEY key, ARG_TYPE_VALUE value, \ - const OpDef *op_def) { \ + bool GetBytesAttr(ARG_TYPE_KEY key, ARG_TYPE_VALUE value, const OpDef *op_def) { \ GE_RT_FALSE_CHECK_NOTNULL(op_def); \ return GetBytesValue(key, value, op_def->attr()); \ } \ @@ -250,7 +239,7 @@ DEFINE_GET_OP_ATTR(const std::string &, AttrDef_ListValue *); DEFINE_GET_BT_ATTR(const std::string &, std::string *); -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool HasOpAttr(const OpDef *op_def, const std::string &attr_name) { +bool HasOpAttr(const OpDef *op_def, const std::string &attr_name) { if (op_def == nullptr) { return false; } @@ -263,8 +252,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool HasOpAttr(const OpDef *op_ return false; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddModelAttr(const std::string &map_key, const void *value, - size_t size, ModelDef *model_def) { +void AddModelAttr(const std::string &map_key, const void *value, size_t size, ModelDef *model_def) { if (model_def == nullptr) { return; } @@ -280,8 +268,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddModelAttr(const std::st } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void AddOpBytesAttr(const std::string &key, const void *value, - size_t size, OpDef *op_def) { +void AddOpBytesAttr(const std::string &key, const void *value, size_t size, OpDef *op_def) { if (op_def == nullptr) { return; } diff --git a/ge/common/op/ge_op_utils.cc b/ge/common/op/ge_op_utils.cc index 99b5733c..429ce909 100644 --- a/ge/common/op/ge_op_utils.cc +++ b/ge/common/op/ge_op_utils.cc @@ -115,8 +115,7 @@ const int NORMAL_TENSOR_SIZE = 4; #define AIPP_CONVERT_LIST_FLOAT(KEY, REQUIRED) AIPP_CONVERT_LIST_FORMAT(KEY, float, REQUIRED, GeAttrValue::FLOAT) -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -OpUtils::ConvertAippParams(const GeAttrValue::NAMED_ATTRS &aipp_attr, domi::AippOpParams *aipp_params) { +Status OpUtils::ConvertAippParams(const GeAttrValue::NAMED_ATTRS &aipp_attr, domi::AippOpParams *aipp_params) { GE_CHECK_NOTNULL(aipp_params); AIPP_CONVERT_FORMAT_EX(aipp_mode, domi::AippOpParams::AippMode, int32_t, GeAttrValue::INT); AIPP_CONVERT_INT(related_input_rank); @@ -178,8 +177,7 @@ OpUtils::ConvertAippParams(const GeAttrValue::NAMED_ATTRS &aipp_attr, domi::Aipp return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OpUtils::TransferDim(const std::vector &dim, - std::vector &dim_vector) { +Status OpUtils::TransferDim(const std::vector &dim, std::vector &dim_vector) { size_t input_shape_size = dim.size(); std::list new_dim_list; for (auto dim_temp : dim) { @@ -301,9 +299,9 @@ Status OpUtils::SetOutputSliceDataByDataType(void *data, int64_t data_size, cons return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OpUtils::SetOutputSliceData( - void *data, int64_t data_size, int32_t data_type, std::vector &input_dims, std::vector &begin, - std::vector &output_dims, GeTensor *output, std::vector &stride) { +Status OpUtils::SetOutputSliceData(void *data, int64_t data_size, int32_t data_type, std::vector &input_dims, + std::vector &begin, std::vector &output_dims, GeTensor *output, + std::vector &stride) { if (data == nullptr || output == nullptr) { GELOGE(PARAM_INVALID, "[Check][Param]Input param is nullptr"); REPORT_INNER_ERROR("E19999", "Input param is nullptr"); @@ -352,9 +350,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OpUtils::SetOutputSliceD return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OpUtils::TransDataHWCK2KCHW(const void *input, int64_t h, - int64_t w, int64_t c, int64_t k, - void **output) { +void OpUtils::TransDataHWCK2KCHW(const void *input, int64_t h, int64_t w, int64_t c, int64_t k, void **output) { if (input == nullptr) { return; } @@ -386,9 +382,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OpUtils::TransDataHWCK2KCH *output = buf; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OpUtils::TransDataKCHW2HWCK(const void *input, int64_t k, - int64_t c, int64_t h, int64_t w, - void *output) { +void OpUtils::TransDataKCHW2HWCK(const void *input, int64_t k, int64_t c, int64_t h, int64_t w, void *output) { if ((input == nullptr) || (output == nullptr)) { GELOGD("%s[%d]: input param is nullptr.", __FILE__, __LINE__); return; @@ -417,31 +411,22 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void OpUtils::TransDataKCHW2HWC vector OpUtils::GetWeights(const ge::Node &node) { return OpDescUtils::GetWeights(node); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY vector OpUtils::GetWeights(ge::ConstNodePtr node) { - return OpDescUtils::GetWeights(node); -} +vector OpUtils::GetWeights(ge::ConstNodePtr node) { return OpDescUtils::GetWeights(node); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY vector OpUtils::MutableWeights(const ge::Node &node) { - return OpDescUtils::MutableWeights(node); -} +vector OpUtils::MutableWeights(const ge::Node &node) { return OpDescUtils::MutableWeights(node); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY vector OpUtils::MutableWeights(const ge::NodePtr node) { - return OpDescUtils::MutableWeights(node); -} +vector OpUtils::MutableWeights(const ge::NodePtr node) { return OpDescUtils::MutableWeights(node); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OpUtils::SetWeights(ge::Node &node, - const vector &weights) { +Status OpUtils::SetWeights(ge::Node &node, const vector &weights) { return OpDescUtils::SetWeights(node, weights); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status OpUtils::SetWeights(ge::NodePtr node, - const vector &weights) { +Status OpUtils::SetWeights(ge::NodePtr node, const vector &weights) { return OpDescUtils::SetWeights(node, weights); } // The caller guarantees that the input sensor is constant -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status -OpUtils::GetShapeDataFromConstTensor(const ConstGeTensorPtr &tensor, DataType type, std::vector &dims) { +Status OpUtils::GetShapeDataFromConstTensor(const ConstGeTensorPtr &tensor, DataType type, std::vector &dims) { if (tensor == nullptr) { GELOGE(PARAM_INVALID, "[Check][Param]Input tensor is nullptr"); REPORT_INNER_ERROR("E19999", "Input tensor is nullptr"); diff --git a/ge/common/profiling/ge_profiling.cc b/ge/common/profiling/ge_profiling.cc index fcd01a12..a5857b35 100644 --- a/ge/common/profiling/ge_profiling.cc +++ b/ge/common/profiling/ge_profiling.cc @@ -23,7 +23,7 @@ #include "graph/ge_context.h" #include "init/gelib.h" #include "framework/common/ge_inner_error_codes.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "framework/omg/omg_inner_types.h" namespace { diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index 0464491d..e8f41cc4 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -77,12 +77,12 @@ ProfilingManager::ProfilingManager() ProfilingManager::~ProfilingManager() {} -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager &ProfilingManager::Instance() { +ProfilingManager &ProfilingManager::Instance() { static ProfilingManager profiling_manager; return profiling_manager; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ge::Status ProfilingManager::Init(const Options &options) { +ge::Status ProfilingManager::Init(const Options &options) { #ifdef DAVINCI_SUPPORT_PROFILING vector().swap(device_id_); subscribe_count_ = 0; @@ -221,7 +221,7 @@ ge::Status ProfilingManager::ParseOptions(const std::string &options) { return ge::SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::StopProfiling() { +void ProfilingManager::StopProfiling() { #ifdef DAVINCI_SUPPORT_PROFILING uint64_t module = GetProfilingModule(); // The following if case will not be executed in normal case, inc case of ProfStopProfiling is abnormal @@ -259,8 +259,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::StopProf #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ProfilingOpInputOutInfo( - const TaskDescInfo &task, Json &task_json) { +void ProfilingManager::ProfilingOpInputOutInfo(const TaskDescInfo &task, Json &task_json) { #ifdef DAVINCI_SUPPORT_PROFILING for (size_t i = 0; i < task.input_format.size(); i++) { Json tmp_input; @@ -286,8 +285,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::Profilin #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ProfilingTaskDescInfo( - uint32_t model_id, const std::vector &task_desc_info, const int32_t &device_id) { +void ProfilingManager::ProfilingTaskDescInfo(uint32_t model_id, const std::vector &task_desc_info, + const int32_t &device_id) { #ifdef DAVINCI_SUPPORT_PROFILING for (const auto &task : task_desc_info) { Json task_info; @@ -324,8 +323,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::Profilin #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfileStepInfo( - uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, int32_t device_id) { +Status ProfilingManager::ProfileStepInfo(uint64_t index_id, uint64_t model_id, uint16_t tag_id, rtStream_t stream, + int32_t device_id) { #ifdef DAVINCI_SUPPORT_PROFILING if (!is_load_profiling_ && subscribe_count_ == 0) { GELOGD("Profiling is not turned on, no need to profile step info."); @@ -385,8 +384,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::Profil return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportData( - const int32_t &device_id, const string &data, const string &tag_name) { +void ProfilingManager::ReportData(const int32_t &device_id, const string &data, const string &tag_name) { #ifdef DAVINCI_SUPPORT_PROFILING ReporterData reporter_data{}; int ret = -1; @@ -426,8 +424,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportProfilingData( - uint32_t model_id, const std::vector &task_desc_info) { +void ProfilingManager::ReportProfilingData(uint32_t model_id, const std::vector &task_desc_info) { #ifdef DAVINCI_SUPPORT_PROFILING int32_t logic_device_id = 0; rtError_t rt_ret = rtGetDevice(&logic_device_id); @@ -443,7 +440,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportPr #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t ProfilingManager::GetProfilingModule() { +uint64_t ProfilingManager::GetProfilingModule() { uint64_t module = PROF_MODEL_EXECUTE_MASK | PROF_RUNTIME_API_MASK | PROF_RUNTIME_TRACE_MASK | @@ -485,8 +482,7 @@ void ProfilingManager::UpdateSubscribeDeviceModuleMap(std::string prof_type, uin #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfModelSubscribe( - uint64_t module, void *model) { +Status ProfilingManager::ProfModelSubscribe(uint64_t module, void *model) { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); uint64_t model_load_mask = module & PROF_MODEL_LOAD_MASK; @@ -526,8 +522,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfMo return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfModelUnsubscribe( - void *model) { +Status ProfilingManager::ProfModelUnsubscribe(void *model) { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); if (subscribe_count_ == 0) { @@ -568,7 +563,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfMo return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfInit(uint64_t module) { +Status ProfilingManager::ProfInit(uint64_t module) { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); uint64_t model_load_mask = module & PROF_MODEL_LOAD_MASK; @@ -602,7 +597,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfIn return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfFinalize() { +Status ProfilingManager::ProfFinalize() { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); is_load_profiling_ = false; @@ -697,8 +692,8 @@ Status ProfilingManager::ProfParseDeviceId(const std::map &config_para, - int32_t &device_num, vector &device_list) { +Status ProfilingManager::ProfParseParam(const std::map &config_para, int32_t &device_num, + vector &device_list) { #ifdef DAVINCI_SUPPORT_PROFILING // device num auto iter = config_para.find(kConfigNumsdev); @@ -747,8 +742,7 @@ Status ProfilingManager::ProfParseParam(const std::map return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfStartProfiling( - uint64_t module, const std::map &config_para) { +Status ProfilingManager::ProfStartProfiling(uint64_t module, const std::map &config_para) { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); uint64_t training_trace_mask = module & PROF_TRAINING_TRACE_MASK; @@ -803,8 +797,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfStopProfiling(uint64_t module, - const std::map &config_para) { +Status ProfilingManager::ProfStopProfiling(uint64_t module, const std::map &config_para) { #ifdef DAVINCI_SUPPORT_PROFILING std::lock_guard lock(mutex_); int32_t device_num = 0; @@ -855,8 +848,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::ProfSt return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::UpdateDeviceIdModuleMap(string prof_type, - uint64_t module, const vector &device_list) { +void ProfilingManager::UpdateDeviceIdModuleMap(string prof_type, uint64_t module, const vector &device_list) { #ifdef DAVINCI_SUPPORT_PROFILING if (prof_type == kProfStart) { for (uint32_t i = 0; i < device_list.size(); i++) { @@ -886,7 +878,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::UpdateDe #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ProfilingManager::ProfilingModelExecuteOn() const { +bool ProfilingManager::ProfilingModelExecuteOn() const { int32_t logic_device_id = 0; rtError_t rt_ret = rtGetDevice(&logic_device_id); if (rt_ret != RT_ERROR_NONE) { @@ -904,7 +896,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ProfilingManager::Profilin return execute_model_prof_on; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::PluginInit() { +Status ProfilingManager::PluginInit() { if (prof_cb_.msprofReporterCallback == nullptr) { GELOGE(ge::PARAM_INVALID, "[Check][Param]MsprofReporterCallback callback is nullptr"); REPORT_INNER_ERROR("E19999", "MsprofReporterCallback callback is nullptr"); @@ -933,7 +925,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::Plugin return SUCCESS; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::PluginUnInit() const { +void ProfilingManager::PluginUnInit() const { #ifdef DAVINCI_SUPPORT_PROFILING if (prof_cb_.msprofReporterCallback == nullptr) { GELOGE(ge::PARAM_INVALID, "[Check][Param]MsprofReporterCallback callback is nullptr"); @@ -950,8 +942,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::PluginUn #endif } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::CallMsprofReport( - ReporterData &reporter_data) const { +Status ProfilingManager::CallMsprofReport(ReporterData &reporter_data) const { if (prof_cb_.msprofReporterCallback == nullptr) { GELOGE(ge::PARAM_INVALID, "[Check][Param]MsprofReporterCallback callback is nullptr"); REPORT_INNER_ERROR("E19999", "MsprofReporterCallback callback is nullptr"); @@ -1007,14 +998,12 @@ void ProfilingManager::GetOpOutputInfo(const OpDescPtr &op, TaskDescInfo &task_d task_desc_info.output_data_type = output_data_type.empty() ? data_type_default : output_data_type; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetOpInputOutputInfo( - const OpDescPtr &op, TaskDescInfo &task_desc_info) const { +void ProfilingManager::GetOpInputOutputInfo(const OpDescPtr &op, TaskDescInfo &task_desc_info) const { GetOpInputInfo(op, task_desc_info); GetOpOutputInfo(op, task_desc_info); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetFpBpPoint( - std::string &fp_point, std::string &bp_point) { +void ProfilingManager::GetFpBpPoint(std::string &fp_point, std::string &bp_point) { // Env or options mode, fp_point_/bp_point_ have initiliazed on profiling init if (!fp_point_.empty() && !bp_point_.empty()) { fp_point = fp_point_; @@ -1025,7 +1014,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetFpBpP } // ProfApi mode and training trace is set // Parse options first - char env_profiling_options[MSPROF_OPTIONS_DEF_LEN_MAX] = { 0x00 }; + char env_profiling_options[MSPROF_OPTIONS_DEF_LEN_MAX] = {0x00}; bool is_profiling_valid = false; std::string profiling_options; if (ge::GetContext().GetOption(OPTION_EXEC_PROFILING_OPTIONS, profiling_options) == SUCCESS && diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index e5137562..86371d51 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -73,7 +73,7 @@ struct MsprofCallback { MsprofReporterCallback msprofReporterCallback; }; -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { +class ProfilingManager { public: ProfilingManager(); virtual ~ProfilingManager(); diff --git a/ge/common/properties_manager.cc b/ge/common/properties_manager.cc index 0c5ef1fe..aeabb008 100644 --- a/ge/common/properties_manager.cc +++ b/ge/common/properties_manager.cc @@ -35,13 +35,13 @@ PropertiesManager::PropertiesManager() : is_inited_(false), delimiter("=") {} PropertiesManager::~PropertiesManager() {} // singleton -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY PropertiesManager &PropertiesManager::Instance() { +PropertiesManager &PropertiesManager::Instance() { static PropertiesManager instance; return instance; } // Initialize property configuration -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool PropertiesManager::Init(const std::string &file_path) { +bool PropertiesManager::Init(const std::string &file_path) { std::lock_guard lock(mutex_); if (is_inited_) { GELOGW("Already inited, will be initialized again"); @@ -139,8 +139,7 @@ std::string PropertiesManager::Trim(const std::string &str) { } // Get property value, if not found, return "" -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string PropertiesManager::GetPropertyValue( - const std::string &map_key) { +std::string PropertiesManager::GetPropertyValue(const std::string &map_key) { std::lock_guard lock(mutex_); auto iter = properties_map_.find(map_key); if (properties_map_.end() != iter) { @@ -151,21 +150,19 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string PropertiesManager:: } // Set property value -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void PropertiesManager::SetPropertyValue(const std::string &map_key, - const std::string &value) { +void PropertiesManager::SetPropertyValue(const std::string &map_key, const std::string &value) { std::lock_guard lock(mutex_); properties_map_[map_key] = value; } // return properties_map_ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::map -PropertiesManager::GetPropertyMap() { +std::map PropertiesManager::GetPropertyMap() { std::lock_guard lock(mutex_); return properties_map_; } // Set separator -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void PropertiesManager::SetPropertyDelimiter(const std::string &de) { +void PropertiesManager::SetPropertyDelimiter(const std::string &de) { std::lock_guard lock(mutex_); delimiter = de; } diff --git a/ge/common/tbe_kernel_store.h b/ge/common/tbe_kernel_store.h index 6304af50..1492bdd9 100755 --- a/ge/common/tbe_kernel_store.h +++ b/ge/common/tbe_kernel_store.h @@ -21,7 +21,7 @@ namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY TBEKernelStore : public KernelStore { +class TBEKernelStore : public KernelStore { public: TBEKernelStore(); ~TBEKernelStore() {} diff --git a/ge/common/thread_pool.cc b/ge/common/thread_pool.cc index f9b7bb99..56f8ee60 100644 --- a/ge/common/thread_pool.cc +++ b/ge/common/thread_pool.cc @@ -26,7 +26,7 @@ #include "external/register/register_types.h" namespace ge { -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ThreadPool::ThreadPool(uint32_t size) : is_stoped_(false) { +ThreadPool::ThreadPool(uint32_t size) : is_stoped_(false) { idle_thrd_num_ = size < 1 ? 1 : size; for (uint32_t i = 0; i < idle_thrd_num_; ++i) { @@ -34,7 +34,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ThreadPool::ThreadPool(uint32_t } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ThreadPool::~ThreadPool() { +ThreadPool::~ThreadPool() { is_stoped_.store(true); { std::unique_lock lock{m_lock_}; diff --git a/ge/common/thread_pool.h b/ge/common/thread_pool.h index 7e52edcc..777a3c9b 100755 --- a/ge/common/thread_pool.h +++ b/ge/common/thread_pool.h @@ -37,7 +37,7 @@ namespace ge { using ThreadTask = std::function; -class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY ThreadPool { +class ThreadPool { public: explicit ThreadPool(uint32_t size = 4); ~ThreadPool(); diff --git a/ge/graph/common/transop_util.cc b/ge/common/transop_util.cc similarity index 97% rename from ge/graph/common/transop_util.cc rename to ge/common/transop_util.cc index 871ecdb1..914e80aa 100755 --- a/ge/graph/common/transop_util.cc +++ b/ge/common/transop_util.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "graph/common/transop_util.h" +#include "common/transop_util.h" -#include "framework/common/types.h" +#include "common/types.h" #include "graph/utils/type_utils.h" #include "framework/common/debug/ge_log.h" diff --git a/ge/graph/common/transop_util.h b/ge/common/transop_util.h similarity index 95% rename from ge/graph/common/transop_util.h rename to ge/common/transop_util.h index 883ae41b..57e4adad 100644 --- a/ge/graph/common/transop_util.h +++ b/ge/common/transop_util.h @@ -23,7 +23,7 @@ #include "graph/node.h" namespace ge { -class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil { +class TransOpUtil { public: static bool IsTransOp(const NodePtr &node); diff --git a/ge/common/util.cc b/ge/common/util.cc index dfb5bac4..6d77dbc8 100644 --- a/ge/common/util.cc +++ b/ge/common/util.cc @@ -70,7 +70,7 @@ static bool ReadProtoFromCodedInputStream(CodedInputStream &coded_stream, Messag return proto->ParseFromCodedStream(&coded_stream); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromArray(const void *data, int size, Message *proto) { +bool ReadProtoFromArray(const void *data, int size, Message *proto) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((proto == nullptr || data == nullptr || size == 0), return false, "incorrect parameter. proto is nullptr || data is nullptr || size is 0"); @@ -112,8 +112,7 @@ long GetFileLength(const std::string &input_file) { * @return false fail * @return true success */ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, - int &length) { +bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_name == nullptr), return false, "incorrect parameter. file is nullptr"); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((buffer == nullptr), return false, "incorrect parameter. buffer is nullptr"); @@ -141,8 +140,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadBytesFromBinaryFile(co return true; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadBytesFromBinaryFile(const char *file_name, - std::vector &buffer) { +bool ReadBytesFromBinaryFile(const char *file_name, std::vector &buffer) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_name == nullptr), return false, "incorrect parameter. file path is null"); std::string real_path = RealPath(file_name); @@ -177,7 +175,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadBytesFromBinaryFile(co * @return -1 fail * @return 0 success */ -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std::string &directory_path) { +int CreateDirectory(const std::string &directory_path) { GE_CHK_BOOL_EXEC(!directory_path.empty(), return -1, "directory path is empty."); auto dir_path_len = directory_path.length(); if (dir_path_len >= MMPA_MAX_PATH) { @@ -219,7 +217,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std:: return 0; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string CurrentTimeInStr() { +std::string CurrentTimeInStr() { std::time_t now = std::time(nullptr); std::tm *ptm = std::localtime(&now); if (ptm == nullptr) { @@ -235,8 +233,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string CurrentTimeInStr() return std::string(buffer); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromText(const char *file, - google::protobuf::Message *message) { +bool ReadProtoFromText(const char *file, google::protobuf::Message *message) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file == nullptr || message == nullptr), return false, "incorrect parameter. nullptr == file || nullptr == message"); @@ -266,8 +263,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromText(const ch return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromMem(const char *data, int size, - google::protobuf::Message *message) { +bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *message) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((data == nullptr || message == nullptr), return false, "incorrect parameter. data is nullptr || message is nullptr"); std::string str(data, static_cast(size)); @@ -281,7 +277,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromMem(const cha return ret; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() { +uint64_t GetCurrentTimestamp() { mmTimeval tv{}; int ret = mmGetTimeOfDay(&tv, nullptr); GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); @@ -289,7 +285,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() return static_cast(total_use_time); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() { +uint32_t GetCurrentSecondTimestap() { mmTimeval tv{}; int ret = mmGetTimeOfDay(&tv, nullptr); GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); @@ -297,7 +293,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimest return static_cast(total_use_time); } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInt64MulOverflow(int64_t a, int64_t b) { +bool CheckInt64MulOverflow(int64_t a, int64_t b) { if (a > 0) { if (b > 0) { if (a > (INT64_MAX / b)) { @@ -322,7 +318,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInt64MulOverflow(int6 return true; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string RealPath(const char *path) { +std::string RealPath(const char *path) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(path == nullptr, return "", "path pointer is NULL."); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(strlen(path) >= MMPA_MAX_PATH, ErrorManager::GetInstance().ATCReportErrMessage("E19002", {"filepath", "size"}, @@ -349,8 +345,7 @@ void PathValidErrReport(const std::string &file_path, const std::string &atc_par } } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInputPathValid(const std::string &file_path, - const std::string &atc_param) { +bool CheckInputPathValid(const std::string &file_path, const std::string &atc_param) { // The specified path is empty std::map args_map; if (file_path.empty()) { @@ -395,8 +390,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInputPathValid(const return true; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckOutputPathValid(const std::string &file_path, - const std::string &atc_param) { +bool CheckOutputPathValid(const std::string &file_path, const std::string &atc_param) { // The specified path is empty if (file_path.empty()) { if (!atc_param.empty()) { @@ -552,7 +546,7 @@ FMK_FUNC_HOST_VISIBILITY bool IsValidFile(const char *file_path) { return true; } -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status CheckPath(const char *path, size_t length) { +Status CheckPath(const char *path, size_t length) { if (path == nullptr) { GELOGE(PARAM_INVALID, "[Check][Param]Config path is invalid"); REPORT_CALL_ERROR("E19999", "Config path is invalid"); diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 44ba3131..54cb7639 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -1,13 +1,9 @@ set(SRC_LIST "ge_executor.cc" "../common/profiling/profiling_manager.cc" - "../common/ge/plugin_manager.cc" - "../common/ge/op_tiling_manager.cc" - "../common/dump/dump_properties.cc" - "../common/dump/exception_dumper.cc" - "../common/dump/dump_manager.cc" "../common/dump/dump_op.cc" "../common/dump/opdebug_register.cc" + "../common/dump/exception_dumper.cc" "../common/profiling/ge_profiling.cc" "../graph/load/graph_loader.cc" "../graph/execute/graph_execute.cc" @@ -22,8 +18,6 @@ set(SRC_LIST "../graph/manager/rdma_pool_allocator.cc" "../graph/manager/host_mem_allocator.cc" "../hybrid/node_executor/aicpu/aicpu_ext_info.cc" - "../model/ge_model.cc" - "../model/ge_root_model.cc" "../graph/load/model_manager/davinci_model.cc" "../graph/load/model_manager/model_manager.cc" "../graph/load/model_manager/tbe_handle_store.cc" @@ -55,7 +49,6 @@ set(SRC_LIST "../graph/load/model_manager/task_info/model_exit_task_info.cc" "../graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" "../graph/load/model_manager/task_info/super_kernel/super_kernel.cc" - "../graph/common/local_context.cc" "../opskernel_manager/ops_kernel_builder_manager.cc" "../single_op/single_op_manager.cc" "../single_op/single_op_model.cc" @@ -102,7 +95,6 @@ set(SRC_LIST "../hybrid/node_executor/task_context.cc" "../hybrid/hybrid_davinci_model.cc" "../ge_local_engine/engine/host_cpu_engine.cc" - "../graph/common/omg_util.cc" "../graph/manager/host_mem_manager.cc" "../graph/build/memory/var_mem_assign_util.cc" "../host_kernels/transpose_kernel.cc" @@ -144,10 +136,6 @@ set(SRC_LIST "../host_kernels/transdata_kernel.cc" "../host_kernels/unpack_kernel.cc" "../graph/passes/pass_utils.cc" - "../graph/common/bcast.cc" - "../common/fp16_t.cc" - "../common/formats/format_transfers/format_transfer_transpose.cc" - "../common/formats/utils/formats_trans_utils.cc" ) ######## libge_executor.a ######## diff --git a/ge/executor/module.mk b/ge/executor/module.mk index 7a7e2b51..430efa75 100644 --- a/ge/executor/module.mk +++ b/ge/executor/module.mk @@ -63,7 +63,7 @@ local_ge_executor_src_files := \ ../single_op/task/aicpu_task_builder.cc \ ../single_op/task/aicpu_kernel_task_builder.cc \ ../hybrid/node_executor/aicpu/aicpu_ext_info.cc \ - ../graph/common/local_context.cc \ + ../common/local_context.cc \ ../hybrid/common/tensor_value.cc \ ../hybrid/common/npu_memory_allocator.cc \ ../hybrid/executor/rt_callback_manager.cc \ @@ -102,7 +102,7 @@ local_ge_executor_src_files := \ ../hybrid/node_executor/task_context.cc \ ../hybrid/hybrid_davinci_model.cc \ ../ge_local_engine/engine/host_cpu_engine.cc \ - ../graph/common/omg_util.cc \ + ../common/omg_util.cc \ ../graph/manager/host_mem_manager.cc \ ../graph/build/memory/var_mem_assign_util.cc \ ../host_kernels/transpose_kernel.cc \ @@ -144,7 +144,7 @@ local_ge_executor_src_files := \ ../host_kernels/transdata_kernel.cc \ ../host_kernels/unpack_kernel.cc \ ../graph/passes/pass_utils.cc \ - ../graph/common/bcast.cc \ + ../common/bcast.cc \ ../common/fp16_t.cc \ ../common/formats/format_transfers/format_transfer_transpose.cc \ ../common/formats/utils/formats_trans_utils.cc \ diff --git a/ge/ge_inference.mk b/ge/ge_inference.mk index a56eaadf..3fd8be1a 100755 --- a/ge/ge_inference.mk +++ b/ge/ge_inference.mk @@ -80,7 +80,7 @@ ANALYZER_SRC_FILES:= \ OMG_HOST_SRC_FILES := \ model/ge_model.cc \ model/ge_root_model.cc \ - graph/common/transop_util.cc \ + common/transop_util.cc \ graph/passes/pass_manager.cc \ graph/passes/resource_pair_add_control_pass.cc \ graph/passes/resource_pair_remove_control_pass.cc \ @@ -115,9 +115,9 @@ OMG_HOST_SRC_FILES := \ graph/passes/mark_graph_unknown_status_pass.cc \ graph/passes/mark_node_unknown_shape_pass.cc \ graph/passes/mark_agnostic_pass.cc \ - graph/common/omg_util.cc \ - graph/common/bcast.cc \ - graph/common/local_context.cc \ + common/omg_util.cc \ + common/bcast.cc \ + common/local_context.cc \ graph/passes/dimension_compute_pass.cc \ graph/passes/dimension_adjust_pass.cc \ graph/passes/get_original_format_pass.cc \ diff --git a/ge/ge_runner.mk b/ge/ge_runner.mk index 8ca8572c..d6462542 100644 --- a/ge/ge_runner.mk +++ b/ge/ge_runner.mk @@ -43,10 +43,10 @@ LIBGE_LOCAL_SRC_FILES := \ graph/build/stream_allocator.cc \ graph/build/stream_graph_optimizer.cc \ graph/build/task_generator.cc \ - graph/common/bcast.cc \ - graph/common/local_context.cc \ - graph/common/omg_util.cc \ - graph/common/transop_util.cc \ + common/bcast.cc \ + common/local_context.cc \ + common/omg_util.cc \ + common/transop_util.cc \ graph/execute/graph_execute.cc \ graph/label/case_label_maker.cc \ graph/label/if_label_maker.cc \ diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 07355ab5..45eaed59 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -36,7 +36,7 @@ #include "graph/utils/graph_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "analyzer/analyzer.h" using std::map; diff --git a/ge/graph/build/graph_builder.cc b/ge/graph/build/graph_builder.cc index 96dea02e..e1398d1f 100644 --- a/ge/graph/build/graph_builder.cc +++ b/ge/graph/build/graph_builder.cc @@ -21,14 +21,14 @@ #include "graph/build/logical_stream_allocator.h" #include "graph/build/run_context.h" #include "graph/build/stream_graph_optimizer.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/ge_context.h" #include "graph/manager/graph_var_manager.h" #include "graph/passes/mark_same_addr_pass.h" #include "graph/utils/node_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "graph/ge_context.h" #include "opskernel_manager/ops_kernel_builder_manager.h" #include "graph/utils/op_desc_utils.h" diff --git a/ge/graph/build/graph_builder.h b/ge/graph/build/graph_builder.h index c4b16814..6ed14dae 100644 --- a/ge/graph/build/graph_builder.h +++ b/ge/graph/build/graph_builder.h @@ -38,7 +38,7 @@ #include "graph/partition/graph_partition.h" #include "graph/utils/graph_utils.h" #include "graph/utils/tensor_utils.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" namespace ge { class GraphBuilder { diff --git a/ge/graph/build/logical_stream_allocator.cc b/ge/graph/build/logical_stream_allocator.cc index 58763aa9..3d6ca74a 100644 --- a/ge/graph/build/logical_stream_allocator.cc +++ b/ge/graph/build/logical_stream_allocator.cc @@ -22,7 +22,7 @@ #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" using std::map; using std::set; diff --git a/ge/graph/build/memory/block_mem_assigner.cc b/ge/graph/build/memory/block_mem_assigner.cc index 159e68a7..7d0db676 100755 --- a/ge/graph/build/memory/block_mem_assigner.cc +++ b/ge/graph/build/memory/block_mem_assigner.cc @@ -34,7 +34,7 @@ #include "graph/debug/ge_attr_define.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/optimize/common/params.h" #include "framework/omg/omg_inner_types.h" #include "runtime/mem.h" diff --git a/ge/graph/build/memory/buffer_pool_mem_assigner.cc b/ge/graph/build/memory/buffer_pool_mem_assigner.cc index d66fe038..ca197e02 100644 --- a/ge/graph/build/memory/buffer_pool_mem_assigner.cc +++ b/ge/graph/build/memory/buffer_pool_mem_assigner.cc @@ -15,7 +15,7 @@ */ #include "graph/build/memory/buffer_pool_mem_assigner.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/tensor_utils.h" #include "framework/common/util.h" #include "graph/compute_graph.h" diff --git a/ge/graph/build/memory/graph_mem_assigner.cc b/ge/graph/build/memory/graph_mem_assigner.cc index e086940a..f8878383 100755 --- a/ge/graph/build/memory/graph_mem_assigner.cc +++ b/ge/graph/build/memory/graph_mem_assigner.cc @@ -24,7 +24,7 @@ #include "graph/build/memory/hybrid_mem_assigner.h" #include "graph/build/memory/var_mem_assign_util.h" #include "graph/build/memory/block_mem_assigner.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_attr_value.h" #include "graph/manager/graph_var_manager.h" diff --git a/ge/graph/build/memory/var_mem_assign_util.cc b/ge/graph/build/memory/var_mem_assign_util.cc index adddf6bd..dc7c3b01 100755 --- a/ge/graph/build/memory/var_mem_assign_util.cc +++ b/ge/graph/build/memory/var_mem_assign_util.cc @@ -18,7 +18,7 @@ #include #include "framework/common/types.h" #include "framework/common/debug/ge_log.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/graph_mem_allocator.h" #include "graph/manager/graph_var_manager.h" diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index 2816f170..897be1f8 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -25,9 +25,9 @@ #include "external/graph/attr_value.h" #include "graph/buffer.h" #include "graph/build/stream_allocator.h" -#include "graph/common/omg_util.h" -#include "graph/common/ge_call_wrapper.h" -#include "graph/common/local_context.h" +#include "common/omg_util.h" +#include "common/ge_call_wrapper.h" +#include "common/local_context.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_attr_value.h" #include "graph/ge_context.h" diff --git a/ge/graph/build/model_builder.h b/ge/graph/build/model_builder.h index 151e6006..d87976dd 100644 --- a/ge/graph/build/model_builder.h +++ b/ge/graph/build/model_builder.h @@ -32,7 +32,7 @@ #include "graph/manager/graph_manager_utils.h" #include "graph/model.h" #include "graph/node.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "framework/omg/omg_inner_types.h" namespace ge { diff --git a/ge/graph/build/run_context.cc b/ge/graph/build/run_context.cc index e7f07c0a..e629bddc 100644 --- a/ge/graph/build/run_context.cc +++ b/ge/graph/build/run_context.cc @@ -18,7 +18,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { RunContextUtil::~RunContextUtil() { DestroyRtModelResources(); } diff --git a/ge/graph/build/stream_allocator.cc b/ge/graph/build/stream_allocator.cc index bc34a228..987a77f7 100644 --- a/ge/graph/build/stream_allocator.cc +++ b/ge/graph/build/stream_allocator.cc @@ -22,7 +22,7 @@ #include "framework/common/fmk_error_codes.h" #include "framework/common/types.h" #include "graph/build/logical_stream_allocator.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_context.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 67289f73..7bb2e2f6 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -29,7 +29,7 @@ #include "graph/utils/node_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "init/gelib.h" #include "graph/ge_local_context.h" #include "external/ge/ge_api_types.h" diff --git a/ge/graph/execute/model_executor.cc b/ge/graph/execute/model_executor.cc index d1683f1d..993ba8c3 100644 --- a/ge/graph/execute/model_executor.cc +++ b/ge/graph/execute/model_executor.cc @@ -18,8 +18,8 @@ #include "graph/ge_context.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/ge_call_wrapper.h" -#include "graph/common/local_context.h" +#include "common/ge_call_wrapper.h" +#include "common/local_context.h" #include "graph/manager/graph_var_manager.h" #include "graph/utils/tensor_adapter.h" #include "graph/load/graph_loader.h" diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 1d6f7aff..aba06173 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -32,7 +32,7 @@ #include "common/thread_pool.h" #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_context.h" @@ -57,9 +57,9 @@ #include "runtime/rt_model.h" #include "runtime/stream.h" #include "securec.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "common/formats/utils/formats_trans_utils.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/build/memory/block_mem_assigner.h" #include "graph/manager/session_scope_mem_allocator.h" #include "framework/omg/omg_inner_types.h" diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index 4ff36677..fe89f66f 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -49,7 +49,7 @@ #include "mmpa/mmpa_api.h" #include "proto/task.pb.h" #include "graph/load/model_manager/task_info/task_info.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" using std::mutex; using std::thread; diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 5af503b2..d0d88e66 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -23,9 +23,9 @@ #include "common/dump/dump_manager.h" #include "framework/common/l2_cache_optimize.h" #include "common/profiling/profiling_manager.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/load/model_manager/davinci_model.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" #include "common/formats/utils/formats_trans_utils.h" namespace ge { diff --git a/ge/graph/load/model_manager/model_manager.h b/ge/graph/load/model_manager/model_manager.h index 63a03dd7..6389d6db 100755 --- a/ge/graph/load/model_manager/model_manager.h +++ b/ge/graph/load/model_manager/model_manager.h @@ -17,7 +17,7 @@ #ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_MODEL_MANAGER_H_ #define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_MODEL_MANAGER_H_ -#include +#include #include #include #include diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 84ed3ab0..7d72d85b 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -29,9 +29,9 @@ #include "common/dump/dump_manager.h" #include "ge_opt_info/ge_opt_info.h" #include "analyzer/analyzer.h" -#include "graph/common/ge_call_wrapper.h" -#include "graph/common/local_context.h" -#include "graph/common/transop_util.h" +#include "common/ge_call_wrapper.h" +#include "common/local_context.h" +#include "common/transop_util.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" #include "graph/manager/util/rt_context_util.h" @@ -103,8 +103,8 @@ #include "inc/pass_manager.h" #include "init/gelib.h" #include "ir_build/option_utils.h" -#include "graph/common/local_context.h" -#include "graph/common/omg_util.h" +#include "common/local_context.h" +#include "common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" #include "register/custom_pass_helper.h" #include "external/graph/types.h" diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 763654bd..84d2b11e 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -38,7 +38,7 @@ #include "graph/partition/graph_partition.h" #include "graph/preprocess/graph_preprocess.h" #include "graph/tuning_utils.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "common/executor.h" namespace ge { diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index 9cec6b6d..14eb67f2 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -33,11 +33,11 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "graph/compute_graph.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "external/graph/graph.h" #include "graph/model.h" -#include "model/ge_model.h" -#include "model/ge_root_model.h" +#include "common/model/ge_model.h" +#include "common/model/ge_root_model.h" #include "external/register/register_fmk_types.h" #include "external/ge/ge_api_types.h" diff --git a/ge/graph/optimize/graph_optimize.cc b/ge/graph/optimize/graph_optimize.cc index 55f374eb..a321ed43 100644 --- a/ge/graph/optimize/graph_optimize.cc +++ b/ge/graph/optimize/graph_optimize.cc @@ -17,7 +17,7 @@ #include "graph/optimize/graph_optimize.h" #include "graph/ge_context.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/passes/dimension_adjust_pass.h" #include "inc/pass_manager.h" #include "init/gelib.h" diff --git a/ge/graph/optimize/mem_rw_conflict_optimize.cc b/ge/graph/optimize/mem_rw_conflict_optimize.cc index 7e7ab908..2edb1828 100644 --- a/ge/graph/optimize/mem_rw_conflict_optimize.cc +++ b/ge/graph/optimize/mem_rw_conflict_optimize.cc @@ -17,7 +17,7 @@ #include #include "common/ge/ge_util.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/optimize/graph_optimize.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/partition/dynamic_shape_partition.cc b/ge/graph/partition/dynamic_shape_partition.cc index 8fc19ff2..cd98b6c5 100755 --- a/ge/graph/partition/dynamic_shape_partition.cc +++ b/ge/graph/partition/dynamic_shape_partition.cc @@ -31,7 +31,7 @@ #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/utils/op_desc_utils.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #define REQUIRE(cond, ...) \ do { \ diff --git a/ge/graph/partition/graph_partition.cc b/ge/graph/partition/graph_partition.cc index 6f221d97..86c9f1fd 100755 --- a/ge/graph/partition/graph_partition.cc +++ b/ge/graph/partition/graph_partition.cc @@ -28,7 +28,7 @@ #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" #include "graph/manager/graph_manager_utils.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/utils/graph_utils.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/partition/graph_partition.h b/ge/graph/partition/graph_partition.h index 560aa9e7..6c21fabe 100644 --- a/ge/graph/partition/graph_partition.h +++ b/ge/graph/partition/graph_partition.h @@ -70,6 +70,8 @@ class GraphPartitioner { // Return all subgraphs const Graph2SubGraphInfoList &GetSubGraphMap(); + const Graph2InputNodesSubGraphInfo &GetSubGraphInfoMap() {return graph_2_input_subgraph_; } + private: Status MergeSubGraph(ge::ComputeGraphPtr &output_merged_compute_graph, const ge::ComputeGraphPtr &original_compute_graph); diff --git a/ge/graph/passes/atomic_addr_clean_pass.cc b/ge/graph/passes/atomic_addr_clean_pass.cc index cc22d126..13700e2e 100755 --- a/ge/graph/passes/atomic_addr_clean_pass.cc +++ b/ge/graph/passes/atomic_addr_clean_pass.cc @@ -24,7 +24,7 @@ #include "framework/common/ge_inner_error_codes.h" #include "common/ge/ge_util.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/node_utils.h" #include "init/gelib.h" diff --git a/ge/graph/passes/attach_stream_label_pass.cc b/ge/graph/passes/attach_stream_label_pass.cc index bcf86bc2..71d74500 100644 --- a/ge/graph/passes/attach_stream_label_pass.cc +++ b/ge/graph/passes/attach_stream_label_pass.cc @@ -16,7 +16,7 @@ #include "graph/passes/attach_stream_label_pass.h" #include "external/ge/ge_api_types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" using std::string; diff --git a/ge/graph/passes/buffer_pool_memory_pass.cc b/ge/graph/passes/buffer_pool_memory_pass.cc index 8a64da59..deb25325 100644 --- a/ge/graph/passes/buffer_pool_memory_pass.cc +++ b/ge/graph/passes/buffer_pool_memory_pass.cc @@ -18,7 +18,7 @@ #include #include -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/node_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/op_desc_utils.h" diff --git a/ge/graph/passes/cast_remove_pass.cc b/ge/graph/passes/cast_remove_pass.cc index 564b311d..1e1f4eb4 100644 --- a/ge/graph/passes/cast_remove_pass.cc +++ b/ge/graph/passes/cast_remove_pass.cc @@ -18,7 +18,7 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/cast_translate_pass.cc b/ge/graph/passes/cast_translate_pass.cc index d49424c8..704faeda 100644 --- a/ge/graph/passes/cast_translate_pass.cc +++ b/ge/graph/passes/cast_translate_pass.cc @@ -22,7 +22,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/passes/pass_utils.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/compile_nodes_pass.cc b/ge/graph/passes/compile_nodes_pass.cc index 1e734178..c5976f11 100755 --- a/ge/graph/passes/compile_nodes_pass.cc +++ b/ge/graph/passes/compile_nodes_pass.cc @@ -22,7 +22,7 @@ #include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/op_desc.h" using domi::ImplyType; diff --git a/ge/graph/passes/control_trigger_pass.cc b/ge/graph/passes/control_trigger_pass.cc index 85505dc5..d81edefd 100644 --- a/ge/graph/passes/control_trigger_pass.cc +++ b/ge/graph/passes/control_trigger_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/control_trigger_pass.h" #include #include "common/ge/ge_util.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/type_utils.h" namespace ge { diff --git a/ge/graph/passes/dimension_adjust_pass.h b/ge/graph/passes/dimension_adjust_pass.h index a84f0d8d..cba283ed 100755 --- a/ge/graph/passes/dimension_adjust_pass.h +++ b/ge/graph/passes/dimension_adjust_pass.h @@ -21,7 +21,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/passes/base_pass.h" #include "graph/utils/attr_utils.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/flow_ctrl_pass.cc b/ge/graph/passes/flow_ctrl_pass.cc index 87896dc3..e75a4592 100755 --- a/ge/graph/passes/flow_ctrl_pass.cc +++ b/ge/graph/passes/flow_ctrl_pass.cc @@ -22,7 +22,7 @@ #include "framework/common/debug/ge_log.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "common/ge/ge_util.h" #include "graph/manager/graph_var_manager.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/passes/get_original_format_pass.cc b/ge/graph/passes/get_original_format_pass.cc index 4b27dd0e..0da4c5cc 100644 --- a/ge/graph/passes/get_original_format_pass.cc +++ b/ge/graph/passes/get_original_format_pass.cc @@ -25,7 +25,7 @@ #include "framework/omg/omg_inner_types.h" #include "graph/utils/attr_utils.h" #include "graph/utils/op_desc_utils.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" using domi::DOMI_TENSOR_NCHW; using domi::DOMI_TENSOR_NHWC; diff --git a/ge/graph/passes/guarantee_const_pass.cc b/ge/graph/passes/guarantee_const_pass.cc index b1df73a9..06bc821c 100644 --- a/ge/graph/passes/guarantee_const_pass.cc +++ b/ge/graph/passes/guarantee_const_pass.cc @@ -21,7 +21,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/attr_utils.h" #include "graph/utils/graph_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/hccl_tailing_optimization_pass.cc b/ge/graph/passes/hccl_tailing_optimization_pass.cc index d952885d..fe606067 100644 --- a/ge/graph/passes/hccl_tailing_optimization_pass.cc +++ b/ge/graph/passes/hccl_tailing_optimization_pass.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "graph/passes/hccl_tailing_optimization_pass.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" namespace ge { Status HcclTailingOptimizationPass::Run(ComputeGraphPtr graph) { diff --git a/ge/graph/passes/identity_pass.cc b/ge/graph/passes/identity_pass.cc index f0653983..0a346bb1 100755 --- a/ge/graph/passes/identity_pass.cc +++ b/ge/graph/passes/identity_pass.cc @@ -19,7 +19,7 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/node_utils.h" #include "graph/utils/attr_utils.h" #include "graph/debug/ge_attr_define.h" diff --git a/ge/graph/passes/infershape_pass.cc b/ge/graph/passes/infershape_pass.cc index 60a2f09a..a5e64519 100755 --- a/ge/graph/passes/infershape_pass.cc +++ b/ge/graph/passes/infershape_pass.cc @@ -22,7 +22,7 @@ #include "graph/shape_refiner.h" #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/iterator_op_pass.cc b/ge/graph/passes/iterator_op_pass.cc index d1de809d..57416017 100644 --- a/ge/graph/passes/iterator_op_pass.cc +++ b/ge/graph/passes/iterator_op_pass.cc @@ -26,7 +26,7 @@ #include "common/ge/ge_util.h" #include "framework/common/debug/ge_log.h" #include "graph/anchor.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "external/graph/graph.h" #include "graph/node.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc index 67b6c617..3989e54f 100644 --- a/ge/graph/passes/mark_force_unknown_for_cond_pass.cc +++ b/ge/graph/passes/mark_force_unknown_for_cond_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/mark_force_unknown_for_cond_pass.h" #include "graph/utils/node_utils.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { namespace { diff --git a/ge/graph/passes/mark_node_unknown_shape_pass.cc b/ge/graph/passes/mark_node_unknown_shape_pass.cc index c040e846..eadd3ca7 100644 --- a/ge/graph/passes/mark_node_unknown_shape_pass.cc +++ b/ge/graph/passes/mark_node_unknown_shape_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/mark_node_unknown_shape_pass.h" #include "graph/utils/node_utils.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" namespace ge { namespace { diff --git a/ge/graph/passes/merge_input_memcpy_pass.cc b/ge/graph/passes/merge_input_memcpy_pass.cc index 044d4ad9..97a17d99 100644 --- a/ge/graph/passes/merge_input_memcpy_pass.cc +++ b/ge/graph/passes/merge_input_memcpy_pass.cc @@ -18,7 +18,7 @@ #include "common/ge/ge_util.h" #include "external/ge/ge_api_types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { Status MergeInputMemcpyPass::Run(ComputeGraphPtr graph) { diff --git a/ge/graph/passes/merge_pass.cc b/ge/graph/passes/merge_pass.cc index fec9c6d0..2ddfcaab 100644 --- a/ge/graph/passes/merge_pass.cc +++ b/ge/graph/passes/merge_pass.cc @@ -22,7 +22,7 @@ #include "framework/common/debug/ge_log.h" #include "common/ge/ge_util.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/passes/merge_to_stream_merge_pass.cc b/ge/graph/passes/merge_to_stream_merge_pass.cc index c58def59..e91410e1 100644 --- a/ge/graph/passes/merge_to_stream_merge_pass.cc +++ b/ge/graph/passes/merge_to_stream_merge_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/merge_to_stream_merge_pass.h" #include "common/ge/ge_util.h" #include "external/ge/ge_api_types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { Status MergeToStreamMergePass::Run(ComputeGraphPtr graph) { diff --git a/ge/graph/passes/multi_batch_clone_pass.cc b/ge/graph/passes/multi_batch_clone_pass.cc index d36b4186..b25239b1 100755 --- a/ge/graph/passes/multi_batch_clone_pass.cc +++ b/ge/graph/passes/multi_batch_clone_pass.cc @@ -18,14 +18,14 @@ #include "common/formats/utils/formats_trans_utils.h" #include "common/ge/ge_util.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/preprocess/multi_batch_options.h" #include "graph/utils/node_utils.h" #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "register/op_registry.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { namespace { diff --git a/ge/graph/passes/multi_batch_pass.cc b/ge/graph/passes/multi_batch_pass.cc index 25d629fa..9fba362c 100644 --- a/ge/graph/passes/multi_batch_pass.cc +++ b/ge/graph/passes/multi_batch_pass.cc @@ -19,7 +19,7 @@ #include #include #include "common/ge/ge_util.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/type_utils.h" #include "common/formats/utils/formats_trans_utils.h" diff --git a/ge/graph/passes/net_output_pass.cc b/ge/graph/passes/net_output_pass.cc index 30455fa0..9aea4863 100644 --- a/ge/graph/passes/net_output_pass.cc +++ b/ge/graph/passes/net_output_pass.cc @@ -27,7 +27,7 @@ #include "framework/common/ge_inner_error_codes.h" #include "framework/omg/omg_inner_types.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/passes/pass_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/next_iteration_pass.cc b/ge/graph/passes/next_iteration_pass.cc index 1c2d7218..af3e4d2d 100644 --- a/ge/graph/passes/next_iteration_pass.cc +++ b/ge/graph/passes/next_iteration_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/next_iteration_pass.h" #include "common/ge/ge_util.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/node_utils.h" using std::string; diff --git a/ge/graph/passes/pass_manager.cc b/ge/graph/passes/pass_manager.cc index 7c9aa414..afd2e4a7 100644 --- a/ge/graph/passes/pass_manager.cc +++ b/ge/graph/passes/pass_manager.cc @@ -19,7 +19,7 @@ #include "framework/common/types.h" #include "framework/common/util.h" #include "graph/utils/node_utils.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "framework/omg/omg_inner_types.h" namespace ge { diff --git a/ge/graph/passes/pass_utils.cc b/ge/graph/passes/pass_utils.cc index d5306f5f..0e056a0f 100644 --- a/ge/graph/passes/pass_utils.cc +++ b/ge/graph/passes/pass_utils.cc @@ -27,7 +27,7 @@ #include "common/ge/ge_util.h" #include "framework/common/op/ge_op_utils.h" #include "framework/common/types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_tensor.h" #include "graph/manager/graph_var_manager.h" diff --git a/ge/graph/passes/permute_pass.cc b/ge/graph/passes/permute_pass.cc index 21222b2c..f3045b1a 100644 --- a/ge/graph/passes/permute_pass.cc +++ b/ge/graph/passes/permute_pass.cc @@ -24,7 +24,7 @@ #include "inc/kernel.h" #include "inc/kernel_factory.h" #include "framework/omg/omg_inner_types.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" using domi::DOMI_TENSOR_ND; using domi::DOMI_TENSOR_NHWC; diff --git a/ge/graph/passes/placeholder_with_default_pass.cc b/ge/graph/passes/placeholder_with_default_pass.cc index 893ee798..bc51b217 100644 --- a/ge/graph/passes/placeholder_with_default_pass.cc +++ b/ge/graph/passes/placeholder_with_default_pass.cc @@ -18,7 +18,7 @@ #include #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { Status PlaceholderWithDefaultPass::Run(NodePtr &node) { diff --git a/ge/graph/passes/prevent_gradient_pass.cc b/ge/graph/passes/prevent_gradient_pass.cc index c531fd2f..8b8b17bd 100644 --- a/ge/graph/passes/prevent_gradient_pass.cc +++ b/ge/graph/passes/prevent_gradient_pass.cc @@ -19,7 +19,7 @@ #include #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { Status PreventGradientPass::Run(NodePtr &node) { diff --git a/ge/graph/passes/print_op_pass.h b/ge/graph/passes/print_op_pass.h index 7ee19d5d..96501dc5 100755 --- a/ge/graph/passes/print_op_pass.h +++ b/ge/graph/passes/print_op_pass.h @@ -20,7 +20,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/types.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "external/graph/graph.h" #include "graph/passes/base_pass.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/ref_identity_delete_op_pass.cc b/ge/graph/passes/ref_identity_delete_op_pass.cc index 7bc5804b..46bc7467 100644 --- a/ge/graph/passes/ref_identity_delete_op_pass.cc +++ b/ge/graph/passes/ref_identity_delete_op_pass.cc @@ -17,7 +17,7 @@ #include "graph/passes/ref_identity_delete_op_pass.h" #include #include -#include "graph/common/transop_util.h" +#include "common/transop_util.h" namespace ge { Status RefIdentityDeleteOpPass::Run(ComputeGraphPtr graph) { diff --git a/ge/graph/passes/replace_transshape_pass.cc b/ge/graph/passes/replace_transshape_pass.cc index c7844619..0e1701ab 100644 --- a/ge/graph/passes/replace_transshape_pass.cc +++ b/ge/graph/passes/replace_transshape_pass.cc @@ -21,7 +21,7 @@ #include "common/ge/ge_util.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/debug/ge_log.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/utils/graph_utils.h" namespace ge { diff --git a/ge/graph/passes/snapshot_pass.cc b/ge/graph/passes/snapshot_pass.cc index 95733e67..a6cd79a3 100644 --- a/ge/graph/passes/snapshot_pass.cc +++ b/ge/graph/passes/snapshot_pass.cc @@ -18,7 +18,7 @@ #include #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { Status SnapshotPass::Run(NodePtr &node) { diff --git a/ge/graph/passes/stop_gradient_pass.h b/ge/graph/passes/stop_gradient_pass.h index 5132b889..5f022200 100755 --- a/ge/graph/passes/stop_gradient_pass.h +++ b/ge/graph/passes/stop_gradient_pass.h @@ -20,7 +20,7 @@ #include "framework/common/debug/ge_log.h" #include "framework/common/types.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/passes/base_pass.h" namespace ge { diff --git a/ge/graph/passes/switch_dead_branch_elimination.cc b/ge/graph/passes/switch_dead_branch_elimination.cc index 3c6c57d0..284111ba 100644 --- a/ge/graph/passes/switch_dead_branch_elimination.cc +++ b/ge/graph/passes/switch_dead_branch_elimination.cc @@ -19,7 +19,7 @@ #include #include #include "framework/common/debug/ge_log.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/passes/pass_utils.h" #include "graph/utils/graph_utils.h" diff --git a/ge/graph/passes/switch_to_stream_switch_pass.cc b/ge/graph/passes/switch_to_stream_switch_pass.cc index 7fecae31..acbf27e3 100644 --- a/ge/graph/passes/switch_to_stream_switch_pass.cc +++ b/ge/graph/passes/switch_to_stream_switch_pass.cc @@ -18,7 +18,7 @@ #include #include "common/ge/ge_util.h" #include "external/ge/ge_api_types.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/ge_context.h" #include "graph/utils/type_utils.h" diff --git a/ge/graph/passes/transop_breadth_fusion_pass.cc b/ge/graph/passes/transop_breadth_fusion_pass.cc index 5b8e1940..88db9501 100644 --- a/ge/graph/passes/transop_breadth_fusion_pass.cc +++ b/ge/graph/passes/transop_breadth_fusion_pass.cc @@ -20,7 +20,7 @@ #include #include "framework/common/types.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/utils/node_utils.h" namespace ge { diff --git a/ge/graph/passes/transop_depth_fusion_pass.cc b/ge/graph/passes/transop_depth_fusion_pass.cc index 66ce346a..3ce54e50 100755 --- a/ge/graph/passes/transop_depth_fusion_pass.cc +++ b/ge/graph/passes/transop_depth_fusion_pass.cc @@ -23,7 +23,7 @@ #include "graph/ge_tensor.h" #include "graph/op_desc.h" #include "graph/utils/graph_utils.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/utils/node_utils.h" namespace ge { diff --git a/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc b/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc index 483575a4..437926ef 100644 --- a/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc +++ b/ge/graph/passes/transop_nearby_allreduce_fusion_pass.cc @@ -19,7 +19,7 @@ #include "framework/common/debug/log.h" #include "framework/common/types.h" #include "graph/utils/graph_utils.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" namespace ge { Status TransOpNearbyAllreduceFusionPass::Run(NodePtr &node) { diff --git a/ge/graph/passes/transop_symmetry_elimination_pass.cc b/ge/graph/passes/transop_symmetry_elimination_pass.cc index fe0e48f9..2bd00206 100644 --- a/ge/graph/passes/transop_symmetry_elimination_pass.cc +++ b/ge/graph/passes/transop_symmetry_elimination_pass.cc @@ -18,7 +18,7 @@ #include "common/formats/utils/formats_trans_utils.h" #include "framework/common/debug/ge_log.h" #include "framework/common/util.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/utils/node_utils.h" diff --git a/ge/graph/passes/transop_without_reshape_fusion_pass.cc b/ge/graph/passes/transop_without_reshape_fusion_pass.cc index 10e619b9..58145fe7 100644 --- a/ge/graph/passes/transop_without_reshape_fusion_pass.cc +++ b/ge/graph/passes/transop_without_reshape_fusion_pass.cc @@ -22,7 +22,7 @@ #include "common/ge/ge_util.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "graph/compute_graph.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_tensor.h" diff --git a/ge/graph/passes/variable_op_pass.h b/ge/graph/passes/variable_op_pass.h index d442fdf4..e314fd12 100755 --- a/ge/graph/passes/variable_op_pass.h +++ b/ge/graph/passes/variable_op_pass.h @@ -18,7 +18,7 @@ #define GE_GRAPH_PASSES_VARIABLE_OP_PASS_H_ #include #include -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "external/graph/graph.h" #include "graph/manager/graph_var_manager.h" #include "graph/manager/util/variable_accelerate_ctrl.h" diff --git a/ge/graph/passes/variable_prepare_op_pass.cc b/ge/graph/passes/variable_prepare_op_pass.cc index 3bb9a2fa..288ff185 100644 --- a/ge/graph/passes/variable_prepare_op_pass.cc +++ b/ge/graph/passes/variable_prepare_op_pass.cc @@ -21,7 +21,7 @@ #include "common/ge/ge_util.h" #include "external/graph/graph.h" #include "framework/common/debug/ge_log.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/debug/ge_attr_define.h" #include "graph/node.h" #include "graph/utils/tensor_utils.h" diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 8d59d9f9..2efe623e 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -28,9 +28,9 @@ #include "common/math/math_util.h" #include "framework/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" +#include "common/ge_call_wrapper.h" +#include "common/local_context.h" +#include "common/transop_util.h" #include "graph/ge_context.h" #include "graph/shape_refiner.h" #include "graph/manager/graph_var_manager.h" diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 48bfa3e6..7a89a1f4 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -39,7 +39,7 @@ #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "proto/insert_op.pb.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #define SAVE_AIPP_ATTR(KEY, SAVE_TYPE) \ do { \ diff --git a/ge/graph/preprocess/multi_batch_copy_graph.cc b/ge/graph/preprocess/multi_batch_copy_graph.cc index fd3a4e91..d88cf6cd 100644 --- a/ge/graph/preprocess/multi_batch_copy_graph.cc +++ b/ge/graph/preprocess/multi_batch_copy_graph.cc @@ -38,8 +38,8 @@ #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "inc/pass_manager.h" -#include "graph/common/local_context.h" -#include "graph/common/omg_util.h" +#include "common/local_context.h" +#include "common/omg_util.h" using std::set; using std::string; diff --git a/ge/graph/preprocess/multi_batch_options.cc b/ge/graph/preprocess/multi_batch_options.cc index 21cbc0c2..9cda6194 100644 --- a/ge/graph/preprocess/multi_batch_options.cc +++ b/ge/graph/preprocess/multi_batch_options.cc @@ -25,11 +25,11 @@ #include "graph/debug/ge_attr_define.h" #include "graph/utils/node_utils.h" #include "graph/ge_context.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "framework/common/types.h" #include "graph/compute_graph.h" #include "graph/utils/graph_utils.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { namespace multibatch { diff --git a/ge/host_kernels/add_kernel.cc b/ge/host_kernels/add_kernel.cc index 1c206018..eb0ea86d 100644 --- a/ge/host_kernels/add_kernel.cc +++ b/ge/host_kernels/add_kernel.cc @@ -19,7 +19,7 @@ #include #include "common/math/math_util.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/broadcast_args_kernel.cc b/ge/host_kernels/broadcast_args_kernel.cc index 796142f4..660717ad 100644 --- a/ge/host_kernels/broadcast_args_kernel.cc +++ b/ge/host_kernels/broadcast_args_kernel.cc @@ -22,7 +22,7 @@ #include "framework/common/types.h" #include "framework/common/util.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/passes/pass_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/broadcast_gradient_args_kernel.cc b/ge/host_kernels/broadcast_gradient_args_kernel.cc index 59993171..8b9e3fb5 100644 --- a/ge/host_kernels/broadcast_gradient_args_kernel.cc +++ b/ge/host_kernels/broadcast_gradient_args_kernel.cc @@ -22,7 +22,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/passes/pass_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/cast_kernel.cc b/ge/host_kernels/cast_kernel.cc index 3f09974f..2d2f463c 100644 --- a/ge/host_kernels/cast_kernel.cc +++ b/ge/host_kernels/cast_kernel.cc @@ -28,7 +28,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/floormod_kernel.cc b/ge/host_kernels/floormod_kernel.cc index bef6d014..1d101667 100644 --- a/ge/host_kernels/floormod_kernel.cc +++ b/ge/host_kernels/floormod_kernel.cc @@ -23,7 +23,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/greater_kernel.cc b/ge/host_kernels/greater_kernel.cc index 3e62db04..0cc895c4 100644 --- a/ge/host_kernels/greater_kernel.cc +++ b/ge/host_kernels/greater_kernel.cc @@ -25,7 +25,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/maximum_kernel.cc b/ge/host_kernels/maximum_kernel.cc index 314bc7be..0e28fcdc 100644 --- a/ge/host_kernels/maximum_kernel.cc +++ b/ge/host_kernels/maximum_kernel.cc @@ -25,7 +25,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/mul_kernel.cc b/ge/host_kernels/mul_kernel.cc index e3657197..608f351d 100644 --- a/ge/host_kernels/mul_kernel.cc +++ b/ge/host_kernels/mul_kernel.cc @@ -25,7 +25,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/permute_kernel.cc b/ge/host_kernels/permute_kernel.cc index 93d56415..9e9462b6 100755 --- a/ge/host_kernels/permute_kernel.cc +++ b/ge/host_kernels/permute_kernel.cc @@ -24,7 +24,7 @@ #include "framework/common/op/ge_op_utils.h" #include "framework/common/types.h" #include "framework/common/util.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" #include "common/formats/formats.h" diff --git a/ge/host_kernels/sub_kernel.cc b/ge/host_kernels/sub_kernel.cc index 84c334b0..0aebb946 100644 --- a/ge/host_kernels/sub_kernel.cc +++ b/ge/host_kernels/sub_kernel.cc @@ -23,7 +23,7 @@ #include "framework/common/debug/log.h" #include "common/math/math_util.h" #include "framework/common/op/ge_op_utils.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/host_kernels/transdata_kernel.cc b/ge/host_kernels/transdata_kernel.cc index a06db78b..7d44fdae 100644 --- a/ge/host_kernels/transdata_kernel.cc +++ b/ge/host_kernels/transdata_kernel.cc @@ -28,7 +28,7 @@ #include "framework/common/util.h" #include "framework/common/debug/ge_log.h" #include "framework/common/ge_inner_error_codes.h" -#include "graph/common/bcast.h" +#include "common/bcast.h" #include "host_kernels/kernel_utils.h" #include "graph/utils/type_utils.h" #include "inc/kernel_factory.h" diff --git a/ge/hybrid/hybrid_davinci_model.h b/ge/hybrid/hybrid_davinci_model.h index 34503b01..abab74f6 100644 --- a/ge/hybrid/hybrid_davinci_model.h +++ b/ge/hybrid/hybrid_davinci_model.h @@ -20,7 +20,7 @@ #include #include "external/ge/ge_api_error_codes.h" #include "graph/load/model_manager/data_inputer.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/model/hybrid_model.h b/ge/hybrid/model/hybrid_model.h index 77246e20..3cb936f6 100644 --- a/ge/hybrid/model/hybrid_model.h +++ b/ge/hybrid/model/hybrid_model.h @@ -27,7 +27,7 @@ #include "hybrid/common/tensor_value.h" #include "hybrid/model/node_item.h" #include "hybrid/model/graph_item.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" namespace ge { namespace hybrid { diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index c722d269..44115240 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -21,7 +21,7 @@ #include "graph/ge_context.h" #include "graph/build/memory/var_mem_assign_util.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" #include "graph/load/model_manager/model_utils.h" #include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_var_manager.h" diff --git a/ge/hybrid/model/hybrid_model_builder.h b/ge/hybrid/model/hybrid_model_builder.h index 05830e82..3592d3d2 100644 --- a/ge/hybrid/model/hybrid_model_builder.h +++ b/ge/hybrid/model/hybrid_model_builder.h @@ -25,7 +25,7 @@ #include "graph/node.h" #include "hybrid/model/hybrid_model.h" #include "hybrid/model/node_item.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" namespace ge { class VarManager; diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 1a2f0d5b..2491715b 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -34,7 +34,7 @@ #include "analyzer/analyzer.h" #include "external/ge/ge_api_types.h" #include "ge_local_engine/engine/host_cpu_engine.h" -#include "graph/common/ge_call_wrapper.h" +#include "common/ge_call_wrapper.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" #include "graph/manager/graph_mem_manager.h" diff --git a/ge/ir_build/attr_options/utils.cc b/ge/ir_build/attr_options/utils.cc index 5398c220..23bb0b7b 100644 --- a/ge/ir_build/attr_options/utils.cc +++ b/ge/ir_build/attr_options/utils.cc @@ -17,7 +17,7 @@ #include #include "graph/debug/ge_attr_define.h" #include "framework/common/debug/ge_log.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { namespace { const std::string CFG_PRE_OPTYPE = "OpType::"; diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index e1cd5d29..cafc534d 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -33,7 +33,7 @@ #include "graph/ge_global_options.h" #include "init/gelib.h" #include "ir_build/option_utils.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #include "graph/shape_refiner.h" #include "graph/opsproto_manager.h" #include "inc/pass_manager.h" diff --git a/ge/session/inner_session.cc b/ge/session/inner_session.cc index 1dcc2996..b9c44ef1 100755 --- a/ge/session/inner_session.cc +++ b/ge/session/inner_session.cc @@ -29,7 +29,7 @@ #include "graph/ge_context.h" #include "graph/ge_global_options.h" #include "graph/ge_local_context.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/manager/graph_var_manager.h" #include "graph/manager/graph_mem_manager.h" #include "graph/utils/tensor_adapter.h" diff --git a/inc/framework/common/helper/model_helper.h b/inc/framework/common/helper/model_helper.h index e25d5d6f..2a63291c 100644 --- a/inc/framework/common/helper/model_helper.h +++ b/inc/framework/common/helper/model_helper.h @@ -22,10 +22,10 @@ #include "common/fmk_types.h" #include "common/helper/om_file_helper.h" +#include "common/model/ge_model.h" +#include "common/model/ge_root_model.h" #include "common/types.h" #include "graph/model.h" -#include "model/ge_model.h" -#include "model/ge_root_model.h" namespace ge { class GE_FUNC_VISIBILITY ModelHelper { @@ -42,13 +42,21 @@ class GE_FUNC_VISIBILITY ModelHelper { Status LoadRootModel(const ge::ModelData &model_data); Status GetModelBufferData(ge::ModelBufferData &model); - const ModelFileHeader *GetFileHeader() const { return file_header_; } + const ModelFileHeader *GetFileHeader() const { + return file_header_; + } GeModelPtr GetGeModel(); GeRootModelPtr GetGeRootModel(); - void SetSaveMode(bool val) { is_offline_ = val; } - bool GetSaveMode(void) const { return is_offline_; } - bool GetModelType() const { return is_unknown_shape_model_; }; + void SetSaveMode(bool val) { + is_offline_ = val; + } + bool GetSaveMode(void) const { + return is_offline_; + } + bool GetModelType() const { + return is_unknown_shape_model_; + }; Status GetBaseNameFromFileName(const std::string &file_name, std::string &base_name); Status GetModelNameFromMergedGraphName(const std::string &graph_name, std::string &model_name); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 42fa6128..856d9d43 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -104,8 +104,8 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/opskernel_manager/ops_kernel_manager.cc" "${GE_CODE_DIR}/ge/generator/ge_generator.cc" "${GE_CODE_DIR}/ge/generator/generator_api.cc" - "${GE_CODE_DIR}/ge/graph/common/omg_util.cc" - "${GE_CODE_DIR}/ge/graph/common/bcast.cc" + "${GE_CODE_DIR}/ge/common/omg_util.cc" + "${GE_CODE_DIR}/ge/common/bcast.cc" "${GE_CODE_DIR}/ge/common/util.cc" "${GE_CODE_DIR}/ge/common/ge/op_tiling_manager.cc" "${GE_CODE_DIR}/ge/init/gelib.cc" @@ -124,12 +124,12 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/common/dump/opdebug_register.cc" "${GE_CODE_DIR}/ge/common/dump/dump_op.cc" "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" - "${GE_CODE_DIR}/ge/model/ge_root_model.cc" + "${GE_CODE_DIR}/ge/common/model/ge_root_model.cc" "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" "${GE_CODE_DIR}/ge/common/dump/dump_server.cc" "${GE_CODE_DIR}/ge/graph/preprocess/multi_batch_copy_graph.cc" "${GE_CODE_DIR}/ge/graph/optimize/mem_rw_conflict_optimize.cc" - "${GE_CODE_DIR}/ge/model/ge_model.cc" + "${GE_CODE_DIR}/ge/common/model/ge_model.cc" "${GE_CODE_DIR}/ge/common/cust_aicpu_kernel_store.cc" "${GE_CODE_DIR}/ge/common/kernel_store.cc" "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" @@ -169,10 +169,10 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/manager/graph_var_manager.cc" "${GE_CODE_DIR}/ge/analyzer/analyzer.cc" "${GE_CODE_DIR}/ge/common/thread_pool.cc" - "${GE_CODE_DIR}/ge/graph/common/transop_util.cc" + "${GE_CODE_DIR}/ge/common/transop_util.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_manager_utils.cc" "${GE_CODE_DIR}/ge/graph/manager/trans_var_data_utils.cc" - "${GE_CODE_DIR}/ge/graph/common/local_context.cc" + "${GE_CODE_DIR}/ge/common/local_context.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_caching_allocator.cc" "${GE_CODE_DIR}/ge/graph/manager/session_scope_mem_allocator.cc" "${GE_CODE_DIR}/ge/graph/manager/rdma_pool_allocator.cc" @@ -648,6 +648,7 @@ set(MULTI_PARTS_TEST_FILES "graph/transop_util_unittest.cc" "common/datatype_transfer_unittest.cc" "common/util_unittest.cc" + "common/fp16_unittest.cc" "common/dump_manager_unittest.cc" "common/dump_op_unittest.cc" "common/dump_properties_unittest.cc" diff --git a/tests/ut/ge/common/fp16_unittest.cc b/tests/ut/ge/common/fp16_unittest.cc new file mode 100644 index 00000000..a9590fe2 --- /dev/null +++ b/tests/ut/ge/common/fp16_unittest.cc @@ -0,0 +1,56 @@ +/** + * 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 "common/fp16_t.h" + +namespace ge { +namespace formats { +class UtestFP16 : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UtestFP16, fp16_to_other) { + fp16_t test; + float num = test.ToFloat(); + EXPECT_EQ(num, 0.0); + + double num2 = test.ToDouble(); + EXPECT_EQ(num2, 0); + + int16_t num3 = test.ToInt16(); + EXPECT_EQ(num3, 0); + + int32_t num4 = test.ToInt32(); + EXPECT_EQ(num4, 0); + + int8_t num5 = test.ToInt8(); + EXPECT_EQ(num5, 0); + + uint16_t num6 = test.ToUInt16(); + EXPECT_EQ(num6, 0); + + uint32_t num7 = test.ToUInt16(); + EXPECT_EQ(num7, 0); + + uint8_t num8 = test.ToUInt8(); + EXPECT_EQ(num8, 0); +} +} // namespace formats +} // namespace ge diff --git a/tests/ut/ge/graph/build/model_builder_unittest.cc b/tests/ut/ge/graph/build/model_builder_unittest.cc index d544e1a3..4f061e27 100644 --- a/tests/ut/ge/graph/build/model_builder_unittest.cc +++ b/tests/ut/ge/graph/build/model_builder_unittest.cc @@ -17,7 +17,7 @@ #include #include -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/anchor.h" #include "graph/attr_value.h" #include "graph/debug/ge_attr_define.h" diff --git a/tests/ut/ge/graph/graph_load_unittest.cc b/tests/ut/ge/graph/graph_load_unittest.cc index cbcefd03..93282a5e 100644 --- a/tests/ut/ge/graph/graph_load_unittest.cc +++ b/tests/ut/ge/graph/graph_load_unittest.cc @@ -36,7 +36,7 @@ #include "framework/common/ge_inner_error_codes.h" #include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_manager_utils.h" -#include "model/ge_model.h" +#include "common/model/ge_model.h" #undef private #undef protected diff --git a/tests/ut/ge/graph/load/model_helper_unittest.cc b/tests/ut/ge/graph/load/model_helper_unittest.cc index 8fd8f014..8af329ed 100644 --- a/tests/ut/ge/graph/load/model_helper_unittest.cc +++ b/tests/ut/ge/graph/load/model_helper_unittest.cc @@ -20,7 +20,7 @@ #include "framework/common/helper/model_helper.h" #include "framework/omg/model_tool.h" #include "framework/omg/ge_init.h" -#include "ge/model/ge_model.h" +#include "ge/common/model/ge_model.h" #undef private #undef protected diff --git a/tests/ut/ge/graph/manager/graph_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_manager_unittest.cc index 9663e90f..518cfdcd 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -39,9 +39,9 @@ #include "common/thread_pool.h" #include "common/dump/dump_manager.h" #include "analyzer/analyzer.h" -#include "graph/common/ge_call_wrapper.h" -#include "graph/common/local_context.h" -#include "graph/common/transop_util.h" +#include "common/ge_call_wrapper.h" +#include "common/local_context.h" +#include "common/transop_util.h" #include "graph/ge_context.h" #include "graph/ge_global_options.h" #include "graph/manager/util/rt_context_util.h" @@ -108,8 +108,8 @@ #include "graph/utils/tensor_adapter.h" #include "inc/pass_manager.h" #include "ir_build/option_utils.h" -#include "graph/common/local_context.h" -#include "graph/common/omg_util.h" +#include "common/local_context.h" +#include "common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" #include "../passes/graph_builder_utils.h" #include "register/custom_pass_helper.h" diff --git a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc index da1abd0f..1d19a8bd 100644 --- a/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc +++ b/tests/ut/ge/graph/partition/dynamic_shape_partition_unittest.cc @@ -24,7 +24,7 @@ #include "inc/framework/common/types.h" #include "utils/graph_utils.h" #include "graph/debug/ge_attr_define.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" namespace ge { namespace { diff --git a/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc b/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc index c7d36582..7d4663b3 100644 --- a/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/mark_node_unknown_shape_pass_unittest.cc @@ -24,7 +24,7 @@ #include "common/ge_inner_error_codes.h" #include "inc/pass_manager.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #undef private namespace ge { diff --git a/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc b/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc index c752cea4..9ec254d7 100644 --- a/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/multi_batch_clone_pass_unittest.cc @@ -22,7 +22,7 @@ #include "inc/pass_manager.h" #include "graph/utils/tensor_utils.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/passes/multi_batch_pass.h" #include "graph/preprocess/multi_batch_copy_graph.h" #include "graph/preprocess/insert_op/util_insert_aipp_op.h" diff --git a/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc b/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc index c633c0e1..6565295c 100644 --- a/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/subgraph_const_migration_pass_unittest.cc @@ -20,7 +20,7 @@ #include #include "framework/omg/omg_inner_types.h" -#include "graph/common/local_context.h" +#include "common/local_context.h" #include "graph/passes/subgraph_const_migration_pass.h" #include "inc/pass_manager.h" #include "register/op_registry.h" diff --git a/tests/ut/ge/graph/transop_util_unittest.cc b/tests/ut/ge/graph/transop_util_unittest.cc index 9f645c22..02aa97bf 100644 --- a/tests/ut/ge/graph/transop_util_unittest.cc +++ b/tests/ut/ge/graph/transop_util_unittest.cc @@ -16,7 +16,7 @@ #include -#include "graph/common/transop_util.h" +#include "common/transop_util.h" #include "common/debug/log.h" #include "common/types.h" diff --git a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc index b09211cb..782a06d6 100644 --- a/tests/ut/ge/hybrid/ge_hybrid_unittest.cc +++ b/tests/ut/ge/hybrid/ge_hybrid_unittest.cc @@ -25,8 +25,8 @@ #include "hybrid/model/hybrid_model_builder.h" #include "hybrid/model/hybrid_model.h" #include "hybrid/node_executor/node_executor.h" -#include "model/ge_model.h" -#include "model/ge_root_model.h" +#include "common/model/ge_model.h" +#include "common/model/ge_root_model.h" #include "hybrid/node_executor/aicore/aicore_op_task.h" #include "framework/common/taskdown_common.h" #include "framework/common/debug/log.h" diff --git a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc index 10f7c0fe..eb6030dc 100644 --- a/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc +++ b/tests/ut/ge/hybrid/model/hybrid_model_builder_unittest.cc @@ -29,7 +29,7 @@ #include "graph/utils/graph_utils.h" #include "graph/debug/ge_attr_define.h" #include "graph/ge_local_context.h" -#include "graph/common/omg_util.h" +#include "common/omg_util.h" using namespace std; using namespace testing; diff --git a/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc index e4d211f9..53b28762 100644 --- a/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc @@ -22,7 +22,7 @@ #define protected public #include "hybrid/executor/subgraph_context.h" #include "hybrid/node_executor/ge_local/ge_local_node_executor.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" #undef protected #undef private diff --git a/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc b/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc index b113fa9b..bb134175 100644 --- a/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc @@ -22,7 +22,7 @@ #define protected public #include "hybrid/executor/subgraph_context.h" #include "hybrid/node_executor/host_cpu/host_cpu_node_executor.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" #include "graph/passes/graph_builder_utils.h" #include "aicpu/common/aicpu_task_struct.h" #include "graph/manager/graph_mem_manager.h" diff --git a/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc b/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc index 109e5192..d21ae1e0 100644 --- a/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/rts/rts_node_task_unittest.cc @@ -22,7 +22,7 @@ #define protected public #include "hybrid/executor/subgraph_context.h" #include "hybrid/node_executor/rts/rts_node_executor.h" -#include "model/ge_root_model.h" +#include "common/model/ge_root_model.h" using namespace std; using namespace testing; From b8882fd650f8080026a31d4721fc7fbab75fc783 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Tue, 13 Jul 2021 20:36:08 +0800 Subject: [PATCH 195/226] Sort common\CMakeLists.txt --- ge/common/CMakeLists.txt | 102 +++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/ge/common/CMakeLists.txt b/ge/common/CMakeLists.txt index 0d41b86f..99d6ead3 100755 --- a/ge/common/CMakeLists.txt +++ b/ge/common/CMakeLists.txt @@ -1,55 +1,55 @@ set(SRC_LIST - "context/ctx.cc" - "model_saver.cc" - "ge/datatype_util.cc" - "ge/plugin_manager.cc" - "ge/op_tiling_manager.cc" - "helper/om_file_helper.cc" - "helper/model_helper.cc" - "model/ge_model.cc" - "model/ge_root_model.cc" - "bcast.cc" - "local_context.cc" - "omg_util.cc" - "transop_util.cc" - "auth/file_saver.cc" - "fp16_t.cc" - "math/fp16_math.cc" - "debug/memory_dumper.cc" - "formats/utils/formats_trans_utils.cc" - "dump/dump_properties.cc" - "dump/dump_manager.cc" - "formats/format_transfers/datatype_transfer.cc" - "formats/format_transfers/format_transfer_transpose.cc" - "formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" - "formats/format_transfers/format_transfer_fractal_z.cc" - "formats/format_transfers/format_transfer_fractal_nz.cc" - "formats/format_transfers/format_transfer_fractal_zz.cc" - "formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" - "formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" - "formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" - "formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" - "formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" - "formats/format_transfers/format_transfer_fracz_nchw.cc" - "formats/format_transfers/format_transfer_fracz_nhwc.cc" - "formats/format_transfers/format_transfer_fracz_hwcn.cc" - "formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" - "formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" - "formats/format_transfers/format_transfer_nchw_fz_c04.cc" - "formats/formats.cc" - "ge_format_util.cc" - "fmk_error_codes.cc" - "util.cc" - "properties_manager.cc" - "types.cc" - "model_parser/model_parser.cc" - "kernel_store.cc" - "tbe_kernel_store.cc" - "cust_aicpu_kernel_store.cc" - "op/attr_value_util.cc" - "op/ge_op_utils.cc" - "thread_pool.cc" - "ge/tbe_plugin_manager.cc" + "${GE_CODE_DIR}/ge/common/auth/file_saver.cc" + "${GE_CODE_DIR}/ge/common/bcast.cc" + "${GE_CODE_DIR}/ge/common/context/ctx.cc" + "${GE_CODE_DIR}/ge/common/cust_aicpu_kernel_store.cc" + "${GE_CODE_DIR}/ge/common/debug/memory_dumper.cc" + "${GE_CODE_DIR}/ge/common/dump/dump_manager.cc" + "${GE_CODE_DIR}/ge/common/dump/dump_properties.cc" + "${GE_CODE_DIR}/ge/common/fmk_error_codes.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/datatype_transfer.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fractal_z.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" + "${GE_CODE_DIR}/ge/common/formats/format_transfers/format_transfer_transpose.cc" + "${GE_CODE_DIR}/ge/common/formats/formats.cc" + "${GE_CODE_DIR}/ge/common/formats/utils/formats_trans_utils.cc" + "${GE_CODE_DIR}/ge/common/fp16_t.cc" + "${GE_CODE_DIR}/ge/common/ge/datatype_util.cc" + "${GE_CODE_DIR}/ge/common/ge/op_tiling_manager.cc" + "${GE_CODE_DIR}/ge/common/ge/plugin_manager.cc" + "${GE_CODE_DIR}/ge/common/ge/tbe_plugin_manager.cc" + "${GE_CODE_DIR}/ge/common/ge_format_util.cc" + "${GE_CODE_DIR}/ge/common/helper/model_helper.cc" + "${GE_CODE_DIR}/ge/common/helper/om_file_helper.cc" + "${GE_CODE_DIR}/ge/common/kernel_store.cc" + "${GE_CODE_DIR}/ge/common/local_context.cc" + "${GE_CODE_DIR}/ge/common/math/fp16_math.cc" + "${GE_CODE_DIR}/ge/common/model/ge_model.cc" + "${GE_CODE_DIR}/ge/common/model/ge_root_model.cc" + "${GE_CODE_DIR}/ge/common/model_parser/model_parser.cc" + "${GE_CODE_DIR}/ge/common/model_saver.cc" + "${GE_CODE_DIR}/ge/common/omg_util.cc" + "${GE_CODE_DIR}/ge/common/op/attr_value_util.cc" + "${GE_CODE_DIR}/ge/common/op/ge_op_utils.cc" + "${GE_CODE_DIR}/ge/common/properties_manager.cc" + "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" + "${GE_CODE_DIR}/ge/common/thread_pool.cc" + "${GE_CODE_DIR}/ge/common/transop_util.cc" + "${GE_CODE_DIR}/ge/common/types.cc" + "${GE_CODE_DIR}/ge/common/util.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL) From 3128929306fcc3983fa1f6e230814df2cf917c3d Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 14 Jul 2021 12:45:41 +0800 Subject: [PATCH 196/226] aicore_task_compiler.cc to runner --- ge/CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index cb4c84b1..d1a0da0f 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -109,7 +109,6 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST - "analyzer/analyzer.cc" "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/exception_dumper.cc" @@ -121,7 +120,6 @@ set(EXECUTOR_SRC_LIST "common/ge/plugin_manager.cc" "common/profiling/ge_profiling.cc" "common/profiling/profiling_manager.cc" - "engine_manager/dnnengine_manager.cc" "executor/ge_executor.cc" "ge_local_engine/engine/host_cpu_engine.cc" "graph/build/memory/var_mem_assign_util.cc" @@ -236,7 +234,6 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/aicore/aicore_node_executor.cc" "hybrid/node_executor/aicore/aicore_op_task.cc" "hybrid/node_executor/aicore/aicore_task_builder.cc" - "hybrid/node_executor/aicore/aicore_task_compiler.cc" "hybrid/node_executor/aicpu/aicpu_ext_info.cc" "hybrid/node_executor/aicpu/aicpu_node_executor.cc" "hybrid/node_executor/compiledsubgraph/known_node_executor.cc" @@ -250,9 +247,7 @@ set(EXECUTOR_SRC_LIST "hybrid/node_executor/rts/rts_node_task.cc" "hybrid/node_executor/rts/rts_task_factory.cc" "hybrid/node_executor/task_context.cc" - "init/gelib.cc" "opskernel_manager/ops_kernel_builder_manager.cc" - "opskernel_manager/ops_kernel_manager.cc" "single_op/single_op.cc" "single_op/single_op_manager.cc" "single_op/single_op_model.cc" @@ -510,6 +505,7 @@ set(RUNNER_SRC_LIST "graph/manager/util/hcom_util.cc" "graph/load/model_manager/task_info/hccl_task_info.cc" "hybrid/node_executor/hccl/hccl_node_executor.cc" + "hybrid/node_executor/aicore/aicore_task_compiler.cc" ) if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) @@ -750,7 +746,6 @@ target_link_libraries(ge_executor PRIVATE $<$>:$> $<$>:$> json - ge_proto_client ascend_protobuf_static c_sec $<$>:-lrt> @@ -813,7 +808,6 @@ target_link_libraries(ge_executor_shared PRIVATE $<$>:$> -Wl,--no-as-needed ge_common - ge_proto_client runtime slog graph From 5bf4d4c4245b801b754efd46c3c865f8659260f8 Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 14 Jul 2021 15:38:58 +0800 Subject: [PATCH 197/226] assign graph memory max size and variable memory max size adaptively --- ge/graph/manager/graph_var_manager.cc | 47 ++++++++++++++++++++++++++----- ge/graph/manager/graph_var_manager.h | 3 ++ tests/depends/runtime/src/runtime_stub.cc | 6 ++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/ge/graph/manager/graph_var_manager.cc b/ge/graph/manager/graph_var_manager.cc index 89a4e45b..5138a0f5 100755 --- a/ge/graph/manager/graph_var_manager.cc +++ b/ge/graph/manager/graph_var_manager.cc @@ -20,6 +20,7 @@ #include "graph/manager/graph_mem_manager.h" #include "graph/manager/trans_var_data_utils.h" #include "graph/utils/type_utils.h" +#include "graph/ge_context.h" using std::map; using std::string; @@ -767,24 +768,54 @@ Status VarManager::GetChangedGraphId(const std::string &var_name, uint32_t &grap return var_resource_->GetChangedGraphId(var_name, graph_id); } +Status VarManager::GetTotalMemorySize(size_t &total_mem_size) { + rtError_t rt_ret = rtSetDevice(GetContext().DeviceId()); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtSetDevice failed, device_id:%u, ret:0x%X", + GetContext().DeviceId(), rt_ret); + GELOGE(RT_FAILED, "[Call][RtSetDevice] failed, device_id:%u, ret:0x%X", GetContext().DeviceId(), rt_ret); + return RT_FAILED; + } + size_t free_mem = 0; + rt_ret = rtMemGetInfoEx(RT_MEMORYINFO_HBM, &free_mem, &total_mem_size); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtMemGetInfo failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtMemGetInfo] failed, ret:0x%X", rt_ret); + return RT_FAILED; + } + rt_ret = rtDeviceReset(GetContext().DeviceId()); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtDeviceReset failed, device_id:%u, ret:0x%X", + GetContext().DeviceId(), rt_ret); + GELOGE(RT_FAILED, "[Call][RtDeviceReset] failed, device_id:%u, ret:0x%X", GetContext().DeviceId(), rt_ret); + return RT_FAILED; + } + return SUCCESS; +} + Status VarManager::SetMemoryMallocSize(const map &options) { + size_t total_mem_size = 0; + Status ret = VarManager::GetTotalMemorySize(total_mem_size); + if (ret != SUCCESS) { + return ret; + } + GEEVENT("Total memory size is %zu", total_mem_size); + + graph_mem_max_size_ = floor(total_mem_size * kGraphMemoryManagerMallocRatio); + var_mem_max_size_ = floor(total_mem_size * kVarMemoryManagerMallocRatio); + auto it = options.find(GRAPH_MEMORY_MAX_SIZE); - if (it == options.end()) { - graph_mem_max_size_ = kGraphMemoryManagerMallocMaxSize; - } else { + if (it != options.end()) { string graph_memory_manager_malloc_max_size = it->second; ge::Status ret = ParseMemoryMallocSize(graph_memory_manager_malloc_max_size, graph_mem_max_size_); if (ret != SUCCESS) { GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "[Call][ParseMemoryMallocSize] failed, session id:%lu.", session_id_); return ge::GE_GRAPH_OPTIONS_INVALID; } - GELOGI("The max size for graph mem is set to %zu", graph_mem_max_size_); } it = options.find(VARIABLE_MEMORY_MAX_SIZE); - if (it == options.end()) { - var_mem_max_size_ = kMemoryVarManagerMallocSize; - } else { + if (it != options.end()) { string memory_var_manager_malloc_size = it->second; ge::Status ret = ParseMemoryMallocSize(memory_var_manager_malloc_size, var_mem_max_size_); if (ret != SUCCESS) { @@ -793,6 +824,8 @@ Status VarManager::SetMemoryMallocSize(const map &options) { } } + GEEVENT("The graph_mem_max_size is %zu and the var_mem_max_size is %zu", graph_mem_max_size_, var_mem_max_size_); + var_mem_logic_base_ = graph_mem_max_size_ + kGraphMemoryBuffer; if (var_mem_logic_base_ > kMaxMemorySize) { REPORT_INNER_ERROR("E19999", "var_login_base:%zu can not exeed limit:%zu, session_id:%lu, check invalid", diff --git a/ge/graph/manager/graph_var_manager.h b/ge/graph/manager/graph_var_manager.h index f2b68e79..a1b45959 100755 --- a/ge/graph/manager/graph_var_manager.h +++ b/ge/graph/manager/graph_var_manager.h @@ -43,6 +43,8 @@ const size_t kMaxMemorySize = 256UL * 1024UL * 1024UL * 1024UL; const char kEnvGeuseStaticMemory[] = "GE_USE_STATIC_MEMORY"; const uint64_t kSessionMemAlignSize = 512; const size_t kSessionMemAlignUnit = 2; +const double kGraphMemoryManagerMallocRatio = 26.0 / 32.0; +const double kVarMemoryManagerMallocRatio = 5.0 / 32.0; enum MemStatus { NORMAL = 0, @@ -301,6 +303,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY VarManager { mutable std::recursive_mutex mutex_; Status ParseMemoryMallocSize(std::string &memory_size, size_t &my_size); + Status GetTotalMemorySize(size_t &total_mem_size); }; class VarManagerPool { diff --git a/tests/depends/runtime/src/runtime_stub.cc b/tests/depends/runtime/src/runtime_stub.cc index 0c9e2c27..a8f7e59a 100644 --- a/tests/depends/runtime/src/runtime_stub.cc +++ b/tests/depends/runtime/src/runtime_stub.cc @@ -193,6 +193,12 @@ rtError_t rtMemGetInfo(size_t *free, size_t *total) { return RT_ERROR_NONE; } +rtError_t rtMemGetInfoEx(rtMemInfoType_t memInfoType, size_t *free, size_t *total) { + *free = 512UL * 1024UL * 1024UL; + *total = 1024UL * 1024UL * 1024UL; + return RT_ERROR_NONE; +} + rtError_t rtMemAllocManaged(void **ptr, uint64_t size, uint32_t flag) { return RT_ERROR_NONE; } rtError_t rtMemFreeManaged(void *ptr) { return RT_ERROR_NONE; } From e271d40b9ce1e673b2d550a70a27b2b328ce4433 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Wed, 14 Jul 2021 15:41:17 +0800 Subject: [PATCH 198/226] delete common file form compoler --- ge/CMakeLists.txt | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index d1a0da0f..f83d2607 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -109,15 +109,9 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST - "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" - "common/formats/format_transfers/format_transfer_transpose.cc" - "common/formats/utils/formats_trans_utils.cc" - "common/fp16_t.cc" - "common/ge/op_tiling_manager.cc" - "common/ge/plugin_manager.cc" "common/profiling/ge_profiling.cc" "common/profiling/profiling_manager.cc" "executor/ge_executor.cc" @@ -264,29 +258,6 @@ set(EXECUTOR_SRC_LIST set(COMPILER_SRC_LIST "analyzer/analyzer.cc" "common/dump/dump_op.cc" - "common/dump/dump_properties.cc" - "common/formats/format_transfers/datatype_transfer.cc" - "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" - "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" - "common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" - "common/formats/format_transfers/format_transfer_fractal_nz.cc" - "common/formats/format_transfers/format_transfer_fractal_z.cc" - "common/formats/format_transfers/format_transfer_fractal_zz.cc" - "common/formats/format_transfers/format_transfer_fracz_hwcn.cc" - "common/formats/format_transfers/format_transfer_fracz_nchw.cc" - "common/formats/format_transfers/format_transfer_fracz_nhwc.cc" - "common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" - "common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" - "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_transpose.cc" - "common/formats/formats.cc" - "common/formats/utils/formats_trans_utils.cc" - "common/fp16_t.cc" - "common/ge/op_tiling_manager.cc" - "common/ge/plugin_manager.cc" "common/helper/model_cache_helper.cc" "common/profiling/profiling_manager.cc" "engine_manager/dnnengine_manager.cc" From fec3176277626c8e80c69a2d76ed36f08cd7ae43 Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 14 Jul 2021 16:31:09 +0800 Subject: [PATCH 199/226] assign graph memory max size and variable memory max size adaptively --- tests/ut/ge/CMakeLists.txt | 1 + .../ge/graph/manager/graph_var_manager_unittest.cc | 63 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/ut/ge/graph/manager/graph_var_manager_unittest.cc diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 856d9d43..773a2686 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -690,6 +690,7 @@ set(MULTI_PARTS_TEST_FILES "graph/manager/run_graph_unittest.cc" "graph/partition/dynamic_shape_partition_unittest.cc" "graph/manager/graph_manager_unittest.cc" + "graph/manager/graph_var_manager_unittest.cc" "graph/optimize/mem_rw_conflict_optimize_unittest.cc" "graph/optimize/graph_optimize_unittest.cc" "session/omg_omg_unittest.cc" diff --git a/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc new file mode 100644 index 00000000..3eda6c47 --- /dev/null +++ b/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc @@ -0,0 +1,63 @@ +/** + * 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 + +#define protected public +#define private public +#include "graph/manager/graph_var_manager.h" +#include "graph/ge_context.h" +#undef protected +#undef private + +namespace ge { +class UtestGraphVarManagerTest : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UtestGraphVarManagerTest, test_get_total_memory_size) { + size_t total_mem_size = 0; + Status ret = VarManager::Instance(0)->GetTotalMemorySize(total_mem_size); + EXPECT_EQ(total_mem_size, 1024UL * 1024UL * 1024UL); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_no_related_option) { + const map options{}; + Status ret = VarManager::Instance(0)->SetMemoryMallocSize(options); + EXPECT_EQ(VarManager::Instance(0)->graph_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (26.0f / 32.0f))); + EXPECT_EQ(VarManager::Instance(0)->var_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (5.0f / 32.0f))); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_with_user_specify_graph_mem_max_size) { + const map options{{"ge.graphMemoryMaxSize", 1024UL * 1024UL * 1024UL / 2}}; + Status ret = VarManager::Instance(0)->SetMemoryMallocSize(options); + EXPECT_EQ(VarManager::Instance(0)->graph_mem_max_size_, floor(1024UL * 1024UL * 1024UL / 2)); + EXPECT_EQ(VarManager::Instance(0)->var_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (5.0f / 32.0f))); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_with_user_specify_var_mem_max_size) { + const map options{{"ge.variableMemoryMaxSize", 1024UL * 1024UL * 1024UL / 2}}; + Status ret = VarManager::Instance(0)->SetMemoryMallocSize(options); + EXPECT_EQ(VarManager::Instance(0)->graph_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (26.0f / 32.0f))); + EXPECT_EQ(VarManager::Instance(0)->var_mem_max_size_, floor(1024UL * 1024UL * 1024UL / 2)); + EXPECT_EQ(ret, SUCCESS); +} +} // namespace ge From 3fd107039848df8f7e6a403beee4cf73ca30ee1c Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 14 Jul 2021 16:59:49 +0800 Subject: [PATCH 200/226] assign graph memory max size and variable memory max size adaptively --- tests/ut/ge/graph/manager/graph_var_manager_unittest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc index 3eda6c47..c20e786d 100644 --- a/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_var_manager_unittest.cc @@ -46,7 +46,7 @@ TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_no_related_option) } TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_with_user_specify_graph_mem_max_size) { - const map options{{"ge.graphMemoryMaxSize", 1024UL * 1024UL * 1024UL / 2}}; + const map options{{"ge.graphMemoryMaxSize", "536870912"}}; Status ret = VarManager::Instance(0)->SetMemoryMallocSize(options); EXPECT_EQ(VarManager::Instance(0)->graph_mem_max_size_, floor(1024UL * 1024UL * 1024UL / 2)); EXPECT_EQ(VarManager::Instance(0)->var_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (5.0f / 32.0f))); @@ -54,7 +54,7 @@ TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_with_user_specify_g } TEST_F(UtestGraphVarManagerTest, test_set_memory_malloc_size_with_user_specify_var_mem_max_size) { - const map options{{"ge.variableMemoryMaxSize", 1024UL * 1024UL * 1024UL / 2}}; + const map options{{"ge.variableMemoryMaxSize", "536870912"}}; Status ret = VarManager::Instance(0)->SetMemoryMallocSize(options); EXPECT_EQ(VarManager::Instance(0)->graph_mem_max_size_, floor(1024UL * 1024UL * 1024UL * (26.0f / 32.0f))); EXPECT_EQ(VarManager::Instance(0)->var_mem_max_size_, floor(1024UL * 1024UL * 1024UL / 2)); From 191f381cc5251711c4f65ef11f7262f47e583068 Mon Sep 17 00:00:00 2001 From: wangxiaotian22 Date: Tue, 13 Jul 2021 11:49:50 +0800 Subject: [PATCH 201/226] runtime api transfer --- .../model_manager/task_info/kernel_ex_task_info.cc | 3 +- .../model_manager/task_info/kernel_ex_task_info.h | 1 + .../model_manager/task_info/kernel_task_info.cc | 7 +- .../node_executor/aicpu/aicpu_node_executor.cc | 15 +- inc/external/OWNERS | 10 ++ tests/depends/runtime/src/runtime_stub.cc | 15 ++ tests/ut/ge/CMakeLists.txt | 1 + .../aicpu/aicpu_node_executor_unittest.cc | 168 +++++++++++++++++++++ 8 files changed, 209 insertions(+), 11 deletions(-) create mode 100644 inc/external/OWNERS create mode 100644 tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc index a4b3de75..ee358b5c 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc @@ -106,6 +106,7 @@ Status KernelExTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davin // 1. Copy context from kernelExDef.private to workspace uint32_t op_index = kernel_ex_def.op_index(); OpDescPtr op_desc = davinci_model_->GetOpByIndex(op_index); + op_desc_ = op_desc; if (op_desc == nullptr) { REPORT_INNER_ERROR("E19999", "Can't get op_desc from davinci_model by index:%u", op_index); GELOGE(INTERNAL_ERROR, "[Get][Op] by index failed, index:%u is out of range!", op_index); @@ -422,7 +423,7 @@ Status KernelExTaskInfo::Distribute() { if (topic_type_flag_ > 0) { dump_flag_ = dump_flag_ | topic_type_flag_; } - rtError_t rt_ret = rtKernelLaunchEx(kernel_buf_, kernel_buf_size_, dump_flag_, stream_); + rtError_t rt_ret = rtKernelLaunchFwk(op_desc_->GetName().c_str(), kernel_buf_, kernel_buf_size_, dump_flag_, stream_); if (rt_ret != RT_ERROR_NONE) { REPORT_CALL_ERROR("E19999", "Call rtKernelLaunchEx failed, ret:0x%X", rt_ret); GELOGE(RT_FAILED, "[Call][RtKernelLaunchEx] failed, ret:0x%X", rt_ret); diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h index 1b77b715..7d07eb7f 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h @@ -70,6 +70,7 @@ class KernelExTaskInfo : public TaskInfo { uint32_t dump_flag_; uint32_t kernel_buf_size_; DavinciModel *davinci_model_; + OpDescPtr op_desc_; void *kernel_buf_; void *input_output_addr_; void *ext_info_addr_; diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_task_info.cc index 07ad63ca..63f4257c 100755 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.cc @@ -440,9 +440,10 @@ Status KernelTaskInfo::Distribute() { } GELOGI("distribute task info kernel_type %d, flag %d", kernel_type_, dump_flag_); // blockDim is reserved parameter, set to 1 - rt_ret = rtCpuKernelLaunchWithFlag(reinterpret_cast(so_name_.c_str()), - reinterpret_cast(kernel_name_.c_str()), 1, args_, args_size_, - nullptr, stream_, dump_flag_); + std::string op_name = op_desc_->GetName(); + rtKernelLaunchNames_t launch_name = {so_name_.c_str(), kernel_name_.c_str(), op_name.c_str()}; + rt_ret = rtAicpuKernelLaunchWithFlag(&launch_name, 1, args_, args_size_, + nullptr, stream_, dump_flag_); call_save_dump_ = true; } else { /* default: not skt launch */ diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc index 820c9b56..cf20303c 100755 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc @@ -477,7 +477,7 @@ Status AicpuTfNodeTask::CopyDataToHbm(TaskContext &context, GE_CHK_STATUS_RET_NOLOG(PrepareCopyInputs(context, out_shape_hbm)); RECORD_CALLBACK_EVENT(context.GetExecutionContext(), node_name_.c_str(), "[LaunchCopy] Start"); - GE_CHK_RT_RET(rtKernelLaunchEx(copy_task_args_buf_->GetData(), sizeof(STR_FWK_OP_KERNEL), + GE_CHK_RT_RET(rtKernelLaunchFwk(node_name_.c_str(), copy_task_args_buf_->GetData(), sizeof(STR_FWK_OP_KERNEL), RT_KERNEL_DEFAULT, context.GetStream())); RECORD_CALLBACK_EVENT(context.GetExecutionContext(), node_name_.c_str(), "[LaunchCopy] End"); @@ -638,7 +638,8 @@ Status AicpuTfNodeTask::LaunchTask(TaskContext &context) { GELOGD("Node[%s] launch task start, unknown_type=%d.", node_name_.c_str(), unknown_type_); uint32_t flag = RT_KERNEL_DEFAULT; RECORD_EXECUTION_EVENT(context.GetExecutionContext(), node_name_.c_str(), "[AicpuTfNodertKernelLaunchEx] Start"); - GE_CHK_RT_RET(rtKernelLaunchEx(kernel_buf_->GetData(), kernel_buf_->GetSize(), flag, context.GetStream())); + GE_CHK_RT_RET(rtKernelLaunchFwk(node_name_.c_str(), kernel_buf_->GetData(), + kernel_buf_->GetSize(), flag, context.GetStream())); RECORD_EXECUTION_EVENT(context.GetExecutionContext(), node_name_.c_str(), "[AicpuTfNodertKernelLaunchEx] End"); GELOGD("Node[%s] launch end.", node_name_.c_str()); if (need_sync_) { @@ -819,11 +820,11 @@ Status AicpuNodeTask::LaunchTask(TaskContext &context) { if (kernel_type == ccKernelType::CUST_AI_CPU) { flag |= static_cast(RT_KERNEL_CUSTOM_AICPU); } - auto rt_ret = rtCpuKernelLaunchWithFlag(reinterpret_cast(so_name.c_str()), - reinterpret_cast(kernel_name.c_str()), - 1, // default core dim is 1 - args_.get(), args_size_, - nullptr, context.GetStream(), flag); + rtKernelLaunchNames_t launch_name = {so_name.c_str(), kernel_name.c_str(), node_name_.c_str()}; + auto rt_ret = rtAicpuKernelLaunchWithFlag(&launch_name, + 1, // default core dim is 1 + args_.get(), args_size_, + nullptr, context.GetStream(), flag); GE_CHK_RT_RET(rt_ret); GELOGD("Node[%s] launch task end.", node_name_.c_str()); return SUCCESS; diff --git a/inc/external/OWNERS b/inc/external/OWNERS new file mode 100644 index 00000000..934272a6 --- /dev/null +++ b/inc/external/OWNERS @@ -0,0 +1,10 @@ +approvers: +- gegenhua +reviewers: +- wqtshg +- ji_chen +- xchu42 +- sheng-nan +- wangxiaotian22 +- zhangxiaokun9 +- tangqunzhang diff --git a/tests/depends/runtime/src/runtime_stub.cc b/tests/depends/runtime/src/runtime_stub.cc index 0c9e2c27..510eb1ad 100644 --- a/tests/depends/runtime/src/runtime_stub.cc +++ b/tests/depends/runtime/src/runtime_stub.cc @@ -460,6 +460,21 @@ rtError_t rtDebugUnRegisterForStream(rtStream_t stream) { rtError_t rtFftsTaskLaunch(rtFftsTaskInfo_t *fftsTaskInfo, rtStream_t stream) { return RT_ERROR_NONE; } + +rtError_t rtKernelLaunchFwk(const char *opName, void *args, uint32_t argSize, uint32_t flags, rtStream_t rtStream) { + return RT_ERROR_NONE; +} + +rtError_t rtAicpuKernelLaunchWithFlag(const rtKernelLaunchNames_t *launchNames, uint32_t blockDim, const void *args, + uint32_t argSize, rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags) { + return RT_ERROR_NONE; +} + +rtError_t rtAicpuKernelLaunch(const rtKernelLaunchNames_t *launchNames, uint32_t blockDim, const void *args, + uint32_t argSize, rtSmDesc_t *smDesc, rtStream_t stream) { + return RT_ERROR_NONE; +} + #ifdef __cplusplus } #endif diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 42fa6128..ebaee921 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -735,6 +735,7 @@ set(HYBRID_TEST_FILES "hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc" "hybrid/node_executor/ge_local/ge_local_node_executor_unittest.cc" "hybrid/node_executor/hccl/hccl_node_executor_unittest.cc" + "hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc" "hybrid/executor/hybrid_model_async_executor_unittest.cc" "hybrid/executor/hybrid_model_pipeline_executor_unittest.cc" "hybrid/node_executor/aicore/aicore_task_compiler_unittest.cc" diff --git a/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc new file mode 100644 index 00000000..b225949b --- /dev/null +++ b/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc @@ -0,0 +1,168 @@ +/** + * 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 + +#define private public +#define protected public +#include "graph/runtime_inference_context.h" +#include "aicpu/common/aicpu_task_struct.h" +#include "hybrid/executor/subgraph_context.h" +#include "hybrid/node_executor/aicpu/aicpu_node_executor.h" +#undef protected +#undef private + +using namespace std; +using namespace testing; + +namespace { +struct AicpuTaskStruct { + aicpu::AicpuParamHead head; + uint64_t io_addrp[6]; +}__attribute__((packed)); +} // namespace + +namespace ge { +using namespace hybrid; + +class UtestAicpuNodeExecutor : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +static NodePtr CreateNode(ComputeGraphPtr graph, const string &name, const string &type, int in_num, int out_num) { + OpDescPtr op_desc = std::make_shared(name, type); + op_desc->SetStreamId(0); + static int32_t index = 0; + op_desc->SetId(index++); + + GeTensorDesc tensor(GeShape(), FORMAT_ND, DT_INT64); + TensorUtils::SetSize(tensor, 64); + vector input_offset; + for (int i = 0; i < in_num; i++) { + op_desc->AddInputDesc(tensor); + input_offset.emplace_back(i * 64); + } + op_desc->SetInputOffset(input_offset); + + vector output_offset; + for (int i = 0; i < out_num; i++) { + op_desc->AddOutputDesc(tensor); + output_offset.emplace_back(in_num * 64 + i * 64); + } + op_desc->SetOutputOffset(output_offset); + + return graph->AddNode(op_desc); +} + +TEST_F(UtestAicpuNodeExecutor, aicpu_tf_node_task) { + ComputeGraphPtr graph = std::make_shared("test"); + GeModelPtr ge_sub_model = std::make_shared(); + GeRootModelPtr ge_root_model = std::make_shared(graph); + ge_root_model->SetModelName("test_name"); + ge_root_model->SetSubgraphInstanceNameToModel("sub", ge_sub_model); + HybridModel hybrid_model(ge_root_model); + + NodePtr node = CreateNode(graph, "frameworkop", FRAMEWORK_OP_TYPE, 4, 2); + + std::unique_ptr new_node; + ASSERT_EQ(NodeItem::Create(node, new_node), SUCCESS); + NodeItem *node_item = new_node.get(); + hybrid_model.node_items_[node] = std::move(new_node); + node_item->input_start = 0; + node_item->output_start = 0; + node_item->is_dynamic = true; + node_item->shape_inference_type = DEPEND_COMPUTE; + + GraphItem graph_item; + graph_item.node_items_.emplace_back(node_item); + graph_item.total_inputs_ = 4; + graph_item.total_outputs_ = 2; + + GraphExecutionContext graph_context; + SubgraphContext subgraph_context(&graph_item, &graph_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); + graph_context.callback_manager = std::unique_ptr(new CallbackManager()); + + auto node_state = subgraph_context.GetOrCreateNodeState(node_item); + ASSERT_NE(node_state, nullptr); + + for (int i=0; i<4; ++i) { + uint64_t value_0 = 512; + TensorValue in_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetInput(*node_item, 0, in_tensor0); + } + + uint64_t value_0 = 512; + TensorValue out_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetOutput(*node_item, 0, out_tensor0); + + uint64_t value_1 = 512; + TensorValue out_tensor1(&value_1, sizeof(value_1)); + subgraph_context.SetOutput(*node_item, 1, out_tensor1); + + // task + domi::TaskDef task_def; + domi::KernelExDef *kernel_ex_def = task_def.mutable_kernel_ex(); + kernel_ex_def->set_kernel_ext_info_size(12); + + AicpuExtInfo aicpu_ext_info; + aicpu_ext_info.infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_SHAPE_TYPE; + aicpu_ext_info.infoLen = sizeof(int32_t); + int32_t type = node_item->shape_inference_type; + memcpy_s(aicpu_ext_info.infoMsg, sizeof(int32_t), &type, sizeof(int32_t)); + char *ext_mem = (char*)malloc(sizeof(AicpuExtInfo) + sizeof(int32_t)); + memcpy_s(ext_mem, sizeof(AicpuExtInfo) + sizeof(int32_t), &aicpu_ext_info, sizeof(AicpuExtInfo) + sizeof(int32_t)); + std::string ext_info(ext_mem, sizeof(AicpuExtInfo) + sizeof(int32_t)); + + std::string *mutable_ext_info = kernel_ex_def->mutable_kernel_ext_info(); + (*mutable_ext_info) = ext_info; + + hybrid_model.task_defs_[node] = std::vector({task_def, task_def}); + + AicpuTfNodeTask aicpu_tf_node_task(node_item, task_def); + + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), SUCCESS); + ASSERT_EQ(aicpu_tf_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); + + AicpuTaskStruct args; + args.head.length = sizeof(args); + args.head.ioAddrNum = 6; + + domi::TaskDef task_def2; + task_def2.set_type(RT_MODEL_TASK_ALL_KERNEL); + task_def2.mutable_kernel()->set_args(reinterpret_cast(&args), args.head.length); + task_def2.mutable_kernel()->set_args_size(args.head.length); + + hybrid_model.task_defs_[node] = std::vector({task_def2}); + + AicpuNodeTask aicpu_node_task(node_item, task_def); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), FAILED); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); + + + //kernel_ex_def->set_allocated_kernel_ext_info(nullptr); + + free(ext_mem); + +} + +} // namespace ge + From 45be54175221c42c1bcb7e46b230fc79c8aa2d02 Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 14 Jul 2021 19:59:55 +0800 Subject: [PATCH 202/226] assign graph memory max size and variable memory max size adaptively --- ge/graph/manager/graph_var_manager.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ge/graph/manager/graph_var_manager.cc b/ge/graph/manager/graph_var_manager.cc index 5138a0f5..d0669254 100755 --- a/ge/graph/manager/graph_var_manager.cc +++ b/ge/graph/manager/graph_var_manager.cc @@ -795,18 +795,15 @@ Status VarManager::GetTotalMemorySize(size_t &total_mem_size) { Status VarManager::SetMemoryMallocSize(const map &options) { size_t total_mem_size = 0; - Status ret = VarManager::GetTotalMemorySize(total_mem_size); - if (ret != SUCCESS) { - return ret; - } + GE_CHK_STATUS_RET_NOLOG(VarManager::GetTotalMemorySize(total_mem_size)); GEEVENT("Total memory size is %zu", total_mem_size); graph_mem_max_size_ = floor(total_mem_size * kGraphMemoryManagerMallocRatio); var_mem_max_size_ = floor(total_mem_size * kVarMemoryManagerMallocRatio); - auto it = options.find(GRAPH_MEMORY_MAX_SIZE); - if (it != options.end()) { - string graph_memory_manager_malloc_max_size = it->second; + auto it1 = options.find(GRAPH_MEMORY_MAX_SIZE); + if (it1 != options.end()) { + string graph_memory_manager_malloc_max_size = it1->second; ge::Status ret = ParseMemoryMallocSize(graph_memory_manager_malloc_max_size, graph_mem_max_size_); if (ret != SUCCESS) { GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "[Call][ParseMemoryMallocSize] failed, session id:%lu.", session_id_); @@ -814,9 +811,9 @@ Status VarManager::SetMemoryMallocSize(const map &options) { } } - it = options.find(VARIABLE_MEMORY_MAX_SIZE); - if (it != options.end()) { - string memory_var_manager_malloc_size = it->second; + auto it2 = options.find(VARIABLE_MEMORY_MAX_SIZE); + if (it2 != options.end()) { + string memory_var_manager_malloc_size = it2->second; ge::Status ret = ParseMemoryMallocSize(memory_var_manager_malloc_size, var_mem_max_size_); if (ret != SUCCESS) { GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "[Call][ParseMemoryMallocSize] failed, session id:%lu.", session_id_); From f6755b5681a5ed5a3618b3aa79d77b1e8c1680c2 Mon Sep 17 00:00:00 2001 From: chenyemeng Date: Thu, 15 Jul 2021 18:51:46 +0800 Subject: [PATCH 203/226] revert --- ge/CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index f83d2607..d1a0da0f 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -109,9 +109,15 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST + "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" + "common/formats/format_transfers/format_transfer_transpose.cc" + "common/formats/utils/formats_trans_utils.cc" + "common/fp16_t.cc" + "common/ge/op_tiling_manager.cc" + "common/ge/plugin_manager.cc" "common/profiling/ge_profiling.cc" "common/profiling/profiling_manager.cc" "executor/ge_executor.cc" @@ -258,6 +264,29 @@ set(EXECUTOR_SRC_LIST set(COMPILER_SRC_LIST "analyzer/analyzer.cc" "common/dump/dump_op.cc" + "common/dump/dump_properties.cc" + "common/formats/format_transfers/datatype_transfer.cc" + "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" + "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" + "common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" + "common/formats/format_transfers/format_transfer_fractal_nz.cc" + "common/formats/format_transfers/format_transfer_fractal_z.cc" + "common/formats/format_transfers/format_transfer_fractal_zz.cc" + "common/formats/format_transfers/format_transfer_fracz_hwcn.cc" + "common/formats/format_transfers/format_transfer_fracz_nchw.cc" + "common/formats/format_transfers/format_transfer_fracz_nhwc.cc" + "common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" + "common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" + "common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" + "common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" + "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" + "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" + "common/formats/format_transfers/format_transfer_transpose.cc" + "common/formats/formats.cc" + "common/formats/utils/formats_trans_utils.cc" + "common/fp16_t.cc" + "common/ge/op_tiling_manager.cc" + "common/ge/plugin_manager.cc" "common/helper/model_cache_helper.cc" "common/profiling/profiling_manager.cc" "engine_manager/dnnengine_manager.cc" From 4be882056625080d270df9e9eecebb428da3bed6 Mon Sep 17 00:00:00 2001 From: wqtshg Date: Thu, 15 Jul 2021 19:05:14 +0800 Subject: [PATCH 204/226] delete compiling macros --- CMakeLists.txt | 8 ++------ cmake/external_libs/gflags.cmake | 15 ++++++++++----- ge/CMakeLists.txt | 4 +--- ge/offline/CMakeLists.txt | 6 ++---- metadef | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac0240d9..60509838 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,11 +88,9 @@ else () find_module(hccl libhccl.so ${GE_LIB_PATH}) find_module(adump_server libadump_server.a ${GE_LIB_PATH}) find_module(runtime libruntime.so ${GE_LIB_PATH}) - find_module(runtime_compile libruntime_compile.so ${GE_LIB_PATH}) find_module(resource libresource.so ${GE_LIB_PATH}) find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH}) find_module(msprofiler_fwk_ext libmsprofiler_fwk.a ${GE_LIB_PATH}) - #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() find_module(slog libalog.so ${ASCEND_ATC_DIR}) find_module(opt_feature libopt_feature.so ${ASCEND_ATC_DIR}) @@ -108,7 +106,6 @@ else () elseif(PLATFORM STREQUAL "inference") find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR}) find_module(runtime libruntime.so ${ASCEND_ACL_DIR}) - find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) find_module(msprofiler_ext libmsprofiler.a ${ASCEND_ACL_DIR}) if(PRODUCT STREQUAL "flr3") elseif(PRODUCT STREQUAL "flr1") @@ -120,10 +117,9 @@ else () endif() elseif(PLATFORM STREQUAL "all") find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR}) - find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR}) + find_module(runtime libruntime.so ${ASCEND_ATC_DIR}) find_module(msprofiler_fwk_ext libmsprofiler_fwk.a ${ASCEND_RUNTIME_DIR}) - find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) - find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) + find_module(ascend_hal_stub libascend_hal.so ${ASCEND_ATC_DIR}/stub) find_module(msprofiler_ext libmsprofiler.a ${ASCEND_ACL_DIR}) else() message(STATUS "PLATFORM param is invalid, should be train or inference, you choose nothing!") diff --git a/cmake/external_libs/gflags.cmake b/cmake/external_libs/gflags.cmake index 50cfb2bc..b4b57dd7 100755 --- a/cmake/external_libs/gflags.cmake +++ b/cmake/external_libs/gflags.cmake @@ -10,12 +10,17 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.") endif() -if (ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/gflags/repository/archive/v2.2.2.tar.gz") - set(MD5 "") +if (GE_PB_PKG) + set(REQ_URL "${GE_PB_PKG}/libs/gflags/v2.2.2.tar.gz") + set(MD5 "1a865b93bacfa963201af3f75b7bd64c") else() - set(REQ_URL "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz") - set(MD5 "") + if (ENABLE_GITEE) + set(REQ_URL "https://gitee.com/mirrors/gflags/repository/archive/v2.2.2.tar.gz") + set(MD5 "") + else() + set(REQ_URL "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz") + set(MD5 "1a865b93bacfa963201af3f75b7bd64c") + endif () endif () set (gflags_CXXFLAGS "-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=ascend_private") diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index f83d2607..cd255c79 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -593,7 +593,6 @@ target_compile_definitions(ge_compiler PRIVATE REUSE_MEMORY=1 FMK_SUPPORT_DUMP FMK_HOST_INFER - COMPILE_OMG_PACKAGE google=ascend_private FUNC_VISIBILITY $<$:ONLY_COMPILE_OPEN_SRC> @@ -655,8 +654,7 @@ target_link_libraries(ge_compiler PRIVATE c_sec error_manager slog - $<$>:$> - $<$:$> + runtime opt_feature -Wl,--as-needed json diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index e11e4a03..935d8a30 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -22,7 +22,6 @@ target_compile_options(atc_atc.bin PRIVATE target_compile_definitions(atc_atc.bin PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 - COMPILE_OMG_PACKAGE google=ascend_private LOG_CPP FUNC_VISIBILITY @@ -48,6 +47,7 @@ target_include_directories(atc_atc.bin PRIVATE target_link_options(atc_atc.bin PRIVATE -Wl,-Bsymbolic + -Wl,-rpath-link,${ASCEND_ATC_DIR}/stub ) target_link_libraries(atc_atc.bin PRIVATE @@ -62,8 +62,7 @@ target_link_libraries(atc_atc.bin PRIVATE parser_common gflags json - $<$>:$> - $<$:$> + runtime slog static_mmpa -lrt @@ -92,7 +91,6 @@ target_compile_options(fwk_atc.bin PRIVATE target_compile_definitions(fwk_atc.bin PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 - COMPILE_OMG_PACKAGE google=ascend_private LOG_CPP FUNC_VISIBILITY diff --git a/metadef b/metadef index 5a9605f6..a725349b 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 5a9605f6cb1204a729a51fe36bc614cf1d94a496 +Subproject commit a725349b65aef2940555af2ddb7b9461fbe0d5fd From 207bf69c20a5953ae01499434922244161e67206 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Thu, 15 Jul 2021 20:01:58 +0800 Subject: [PATCH 205/226] bugfix for taskdef's random variation in offline case --- ge/graph/build/task_generator.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 7bb2e2f6..1adcd0aa 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -50,6 +50,7 @@ const char *const kIsInputVar = "INPUT_IS_VAR"; const char *const kIsOutputVar = "OUTPUT_IS_VAR"; const char *const kProfilingMode = "PROFILING_MODE"; const char *const kIteratorV2 = "IteratorV2"; +const char *const kKernelInfoNameHccl = "ops_kernel_info_hccl"; const uint32_t kProfilingArStep = 2; const uint64_t kProfilingFpStartLogid = 1; const uint64_t kProfilingBpEndLogid = 2; @@ -437,14 +438,15 @@ Status TaskGenerator::GenerateTask(RunContext &run_context, ComputeGraphPtr &gra } // Reset stream id to ge stream id, as graph load must use ge stream to reassign stream - void *ops_kernel_info_store_ptr = kernel_info_store.get(); for (size_t idx = task_list_size_before; idx < task_list_size_after; ++idx) { task_def_list[idx].set_stream_id(static_cast(stream_id)); op_name_map[idx] = name; - // Set opsKernelInfoStorePtr and op_index, the two fields be use in DistributeTask and InitTaskInfo TaskDef *task_def_ptr = &task_def_list[idx]; GE_CHECK_NOTNULL(task_def_ptr); - task_def_ptr->set_ops_kernel_store_ptr(reinterpret_cast(ops_kernel_info_store_ptr)); + // Set opsKernelInfoStorePtr for hccl which will be use in DistributeTask and InitTaskInfo + if (op_kernel_lib_name == kKernelInfoNameHccl) { + task_def_ptr->set_ops_kernel_store_ptr(reinterpret_cast(kernel_info_store.get())); + } } GELOGD("Call %s to generate node[name:%s(%s), id:%ld, stream_id:%ld] task finished, generate %zu task(s).", op_kernel_lib_name.c_str(), name.c_str(), type.c_str(), op_id, stream_id, From 4132d6dcd22bad7c9c73a5f3e12a62051478a528 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 15 Jul 2021 20:19:28 +0800 Subject: [PATCH 206/226] Delete common format_transfers files --- ge/CMakeLists.txt | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index d9ef5eef..0236e8bd 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -109,13 +109,9 @@ endif () ################################################################## set(EXECUTOR_SRC_LIST - "common/dump/dump_manager.cc" "common/dump/dump_op.cc" "common/dump/exception_dumper.cc" "common/dump/opdebug_register.cc" - "common/formats/format_transfers/format_transfer_transpose.cc" - "common/formats/utils/formats_trans_utils.cc" - "common/fp16_t.cc" "common/ge/op_tiling_manager.cc" "common/ge/plugin_manager.cc" "common/profiling/ge_profiling.cc" @@ -264,27 +260,6 @@ set(EXECUTOR_SRC_LIST set(COMPILER_SRC_LIST "analyzer/analyzer.cc" "common/dump/dump_op.cc" - "common/dump/dump_properties.cc" - "common/formats/format_transfers/datatype_transfer.cc" - "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" - "common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" - "common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" - "common/formats/format_transfers/format_transfer_fractal_nz.cc" - "common/formats/format_transfers/format_transfer_fractal_z.cc" - "common/formats/format_transfers/format_transfer_fractal_zz.cc" - "common/formats/format_transfers/format_transfer_fracz_hwcn.cc" - "common/formats/format_transfers/format_transfer_fracz_nchw.cc" - "common/formats/format_transfers/format_transfer_fracz_nhwc.cc" - "common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" - "common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" - "common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" - "common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" - "common/formats/format_transfers/format_transfer_transpose.cc" - "common/formats/formats.cc" - "common/formats/utils/formats_trans_utils.cc" - "common/fp16_t.cc" "common/ge/op_tiling_manager.cc" "common/ge/plugin_manager.cc" "common/helper/model_cache_helper.cc" From 051d0e9fab55a2530b364ecea1e98c1705e308de Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Thu, 15 Jul 2021 20:43:09 +0800 Subject: [PATCH 207/226] Fix bug of single_op. --- ge/single_op/single_op.cc | 4 +++- ge/single_op/task/op_task.cc | 25 ++++++++++++++++++++---- ge/single_op/task/op_task.h | 5 +++-- ge/single_op/task/tbe_task_builder.cc | 2 +- tests/ut/ge/single_op/single_op_task_unittest.cc | 20 +++++++++++++++++++ 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/ge/single_op/single_op.cc b/ge/single_op/single_op.cc index a82c30ba..23f4cfad 100755 --- a/ge/single_op/single_op.cc +++ b/ge/single_op/single_op.cc @@ -433,11 +433,13 @@ Status DynamicSingleOp::ExecuteAsync(const vector &input_desc, if (!inputs_size.empty()) { StreamResource *stream_resource = SingleOpManager::GetInstance().GetResource(resource_id_, stream_); GE_CHK_STATUS_RET_NOLOG(UpdateInputsBufferAddr(stream_resource, stream_, inputs_size, update_buffers)); - GE_CHK_STATUS_RET_NOLOG(SetHostTensorValue(input_desc, input_buffers)); } if (hybrid_model_executor_ != nullptr) { GELOGD("Execute multi-task dynamic single op by hybrid model executor"); + if (!inputs_size.empty()) { + GE_CHK_STATUS_RET_NOLOG(SetHostTensorValue(input_desc, input_buffers)); + } hybrid::HybridModelExecutor::ExecuteArgs args; GE_CHK_STATUS_RET_NOLOG(InitHybridModelArgs(update_buffers, output_buffers, input_desc, args)); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index dbc90ac5..fd6639a5 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -294,16 +294,15 @@ Status TbeOpTask::UpdateNodeByShape(const vector &input_desc, cons Status TbeOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { if (tiling_buffer != nullptr) { - uintptr_t *arg_base = nullptr; - size_t arg_num = 0; - GetIoAddr(arg_base, arg_num); + uintptr_t *arg_base = reinterpret_cast(args_.get()); + size_t arg_num = arg_size_ / sizeof(void *); GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); uint32_t inputs_num = node->GetOpDesc()->GetInputsSize(); uint32_t outputs_num = node->GetOpDesc()->GetOutputsSize(); uint32_t workspace_nums = node->GetOpDesc()->GetWorkspace().size(); uint32_t tiling_index = inputs_num + outputs_num + workspace_nums; - if (arg_num == 0 || arg_num < tiling_index) { + if (arg_num == 0 || arg_num <= tiling_index) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Size]Tiling index %u, arg number %zu is invalid.", tiling_index, arg_num); return ACL_ERROR_GE_INTERNAL_ERROR; @@ -481,6 +480,24 @@ void TbeOpTask::GetIoAddr(uintptr_t *&arg_base, size_t &arg_count) { } } +Status AtomicAddrCleanOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { + if (tiling_buffer != nullptr) { + uintptr_t *arg_base = reinterpret_cast(args_.get()); + size_t arg_num = arg_size_ / sizeof(void *); + uint32_t tiling_index = atomic_output_indices_.size(); + if (arg_num == 0 || arg_num <= tiling_index) { + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Size]Tiling index %u, arg number %zu is invalid.", + tiling_index, arg_num); + return ACL_ERROR_GE_INTERNAL_ERROR; + } + arg_base[tiling_index] = reinterpret_cast(tiling_buffer); + } + node_ = node; + tiling_buffer_ = tiling_buffer; + max_tiling_size_ = max_tiling_size; + return SUCCESS; +} + Status AtomicAddrCleanOpTask::UpdateNodeByShape(const vector &input_desc, const vector &output_desc) { return SUCCESS; diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 132672b0..4a839389 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -97,7 +97,7 @@ class TbeOpTask : public OpTask { const void *GetArgs() const; size_t GetArgSize() const; const std::string &GetStubName() const; - Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size); + virtual Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size); const std::string &GetTaskType() const override; void SetHandle(void *handle); @@ -149,6 +149,7 @@ class TbeOpTask : public OpTask { class AtomicAddrCleanOpTask : public TbeOpTask { public: Status InitAtomicAddrCleanIndices(); + Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) override; private: Status UpdateNodeByShape(const vector &input_desc, @@ -156,8 +157,8 @@ class AtomicAddrCleanOpTask : public TbeOpTask { Status UpdateIoAddr(const vector &inputs, const vector &outputs) override; Status UpdateTilingArgs(rtStream_t stream) override; Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info) override; - std::vector atomic_output_indices_; + std::vector atomic_output_indices_; }; class AiCpuBaseTask : public OpTask { diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index 017dac25..f947ca57 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -425,7 +425,7 @@ Status TbeTaskBuilder::InitTilingInfo(TbeOpTask &task) { GELOGD("[%s] Done allocating tiling buffer, size=%ld.", op_desc_->GetName().c_str(), max_size); } - task.EnableDynamicSupport(node_, tiling_buffer, static_cast(max_size)); + GE_CHK_STATUS_RET_NOLOG(task.EnableDynamicSupport(node_, tiling_buffer, static_cast(max_size))); return SUCCESS; } diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 8964df74..5960fbbc 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -237,3 +237,23 @@ TEST_F(UtestSingleOpTask, test_aicpu_task_update_io_addr) { ASSERT_EQ(ret, PARAM_INVALID); } } + +TEST_F(UtestSingleOpTask, test_dynamic_support) { + auto graph = make_shared("graph"); + auto op_desc = make_shared("Add", "Add"); + auto node = graph->AddNode(op_desc); + AtomicAddrCleanOpTask atomic_task; + TbeOpTask tbe_task; + + ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); + ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); + + tbe_task.arg_size_ = sizeof(void *); + tbe_task.args_.reset(new (std::nothrow) uint8_t[tbe_task.arg_size_]); + atomic_task.arg_size_ = sizeof(void *); + atomic_task.args_.reset(new (std::nothrow) uint8_t[atomic_task.arg_size_]); + ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); + ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); + tbe_task.tiling_buffer_ = nullptr; + atomic_task.tiling_buffer_ = nullptr; +} From 927439cb92722d36401af139899288d824f333c2 Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 11:14:50 +0800 Subject: [PATCH 208/226] fix error code and add complex128 support --- ge/generator/ge_generator.cc | 1 - ge/graph/build/memory/graph_mem_assigner.cc | 2 +- ge/graph/build/memory/memory_assigner.cc | 5 +++-- ge/graph/manager/graph_manager.cc | 4 ++-- ge/offline/single_op_parser.cc | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 45eaed59..d35d7d6e 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -1157,7 +1157,6 @@ Status GeGenerator::Impl::BuildModel(const Graph &graph, const vector if (ret != SUCCESS) { REPORT_CALL_ERROR("E19999", "build graph failed, graph id:%u, ret:%d", graph_id, ret); GELOGE(GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED, "[Build][Graph] fail, graph id: %u", graph_id); - ret = GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED; } RtContextUtil::GetInstance().DestroyRtContexts(session_id); diff --git a/ge/graph/build/memory/graph_mem_assigner.cc b/ge/graph/build/memory/graph_mem_assigner.cc index f8878383..542b6215 100755 --- a/ge/graph/build/memory/graph_mem_assigner.cc +++ b/ge/graph/build/memory/graph_mem_assigner.cc @@ -275,7 +275,7 @@ Status GraphMemoryAssigner::ReAssignMemory(bool is_loop_graph, map({"size", "item", "maxsize"}), std::vector({std::to_string(total_mem_offset), "featuremap", std::to_string(VarManager::Instance(session_id)->GetGraphMemoryMaxSize())})); - return ge::FAILED; + return ACL_ERROR_GE_MEMORY_ALLOCATION; } return SUCCESS; } diff --git a/ge/graph/build/memory/memory_assigner.cc b/ge/graph/build/memory/memory_assigner.cc index 6e49827f..5846e922 100755 --- a/ge/graph/build/memory/memory_assigner.cc +++ b/ge/graph/build/memory/memory_assigner.cc @@ -29,9 +29,10 @@ Status MemoryAssigner::AssignMemory(bool is_loop_graph, map &m } // Reassign memory for special nodes - if (graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset) != ge::SUCCESS) { + Status ret = graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset) + if (ret != ge::SUCCESS) { GELOGE(ge::FAILED, "[ReAssign][Memory] failed, graph:%s", compute_graph_->GetName().c_str()); - return ge::FAILED; + return ret; } // Assign memory (block and offset) for zero copy nodes diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 7d72d85b..9749010a 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -1482,8 +1482,8 @@ Status GraphManager::BuildGraph(const GraphId &graph_id, const std::vectorSetRunFlag(false); if (ret != SUCCESS) { - GELOGE(GE_GRAPH_PRERUN_FAILED, "[Call][StartForRunGraph] failed! graph_id:%u.", graph_id); - return GE_GRAPH_PRERUN_FAILED; + GELOGE(ret, "[Call][StartForRunGraph] failed! graph_id:%u.", graph_id); + return ret; } GELOGI("[BuildGraph] build graph success, graph_id=%u.", graph_id); diff --git a/ge/offline/single_op_parser.cc b/ge/offline/single_op_parser.cc index 6bc5cb3d..aeb73116 100644 --- a/ge/offline/single_op_parser.cc +++ b/ge/offline/single_op_parser.cc @@ -89,7 +89,8 @@ map kDataTypeDict = { {"float", DT_FLOAT}, {"float32", DT_FLOAT}, {"double", DT_DOUBLE}, - {"complex64", DT_COMPLEX64} + {"complex64", DT_COMPLEX64}, + {"complex128", DT_COMPLEX128} }; map kFormatDict = { From a5137fb87f65cb8bd6c940f4d153f430692b767f Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 11:23:15 +0800 Subject: [PATCH 209/226] fix error code and add complex128 support --- ge/graph/build/memory/memory_assigner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/build/memory/memory_assigner.cc b/ge/graph/build/memory/memory_assigner.cc index 5846e922..41171164 100755 --- a/ge/graph/build/memory/memory_assigner.cc +++ b/ge/graph/build/memory/memory_assigner.cc @@ -29,7 +29,7 @@ Status MemoryAssigner::AssignMemory(bool is_loop_graph, map &m } // Reassign memory for special nodes - Status ret = graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset) + Status ret = graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset); if (ret != ge::SUCCESS) { GELOGE(ge::FAILED, "[ReAssign][Memory] failed, graph:%s", compute_graph_->GetName().c_str()); return ret; From 21886e608e12983bbe3aecf74e053ed1707ce121 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Fri, 16 Jul 2021 12:00:31 +0800 Subject: [PATCH 210/226] Fix review advice. --- ge/single_op/task/op_task.cc | 26 +++++++++++++----------- tests/ut/ge/single_op/single_op_task_unittest.cc | 8 ++++++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index fd6639a5..ee752022 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -293,25 +293,26 @@ Status TbeOpTask::UpdateNodeByShape(const vector &input_desc, cons } Status TbeOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { + node_ = node; + tiling_buffer_ = tiling_buffer; + max_tiling_size_ = max_tiling_size; if (tiling_buffer != nullptr) { - uintptr_t *arg_base = reinterpret_cast(args_.get()); - size_t arg_num = arg_size_ / sizeof(void *); + uintptr_t *arg_base = nullptr; + size_t arg_num = 0; + GetIoAddr(arg_base, arg_num); GE_CHECK_NOTNULL(node); GE_CHECK_NOTNULL(node->GetOpDesc()); uint32_t inputs_num = node->GetOpDesc()->GetInputsSize(); uint32_t outputs_num = node->GetOpDesc()->GetOutputsSize(); uint32_t workspace_nums = node->GetOpDesc()->GetWorkspace().size(); uint32_t tiling_index = inputs_num + outputs_num + workspace_nums; - if (arg_num == 0 || arg_num <= tiling_index) { + if (arg_num == 0 || arg_num < tiling_index) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Size]Tiling index %u, arg number %zu is invalid.", tiling_index, arg_num); return ACL_ERROR_GE_INTERNAL_ERROR; } arg_base[tiling_index] = reinterpret_cast(tiling_buffer); } - node_ = node; - tiling_buffer_ = tiling_buffer; - max_tiling_size_ = max_tiling_size; return SUCCESS; } @@ -481,20 +482,21 @@ void TbeOpTask::GetIoAddr(uintptr_t *&arg_base, size_t &arg_count) { } Status AtomicAddrCleanOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { + node_ = node; + tiling_buffer_ = tiling_buffer; + max_tiling_size_ = max_tiling_size; if (tiling_buffer != nullptr) { - uintptr_t *arg_base = reinterpret_cast(args_.get()); - size_t arg_num = arg_size_ / sizeof(void *); + uintptr_t *arg_base = nullptr; + size_t arg_num = 0; + GetIoAddr(arg_base, arg_num); uint32_t tiling_index = atomic_output_indices_.size(); - if (arg_num == 0 || arg_num <= tiling_index) { + if (arg_num == 0 || arg_num < tiling_index) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Size]Tiling index %u, arg number %zu is invalid.", tiling_index, arg_num); return ACL_ERROR_GE_INTERNAL_ERROR; } arg_base[tiling_index] = reinterpret_cast(tiling_buffer); } - node_ = node; - tiling_buffer_ = tiling_buffer; - max_tiling_size_ = max_tiling_size; return SUCCESS; } diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 5960fbbc..9a0381cd 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -245,12 +245,16 @@ TEST_F(UtestSingleOpTask, test_dynamic_support) { AtomicAddrCleanOpTask atomic_task; TbeOpTask tbe_task; + tbe_task.arg_size_ = sizeof(void *) * 1; + tbe_task.args_.reset(new (std::nothrow) uint8_t[tbe_task.arg_size_]); + atomic_task.arg_size_ = sizeof(void *) * 1; + atomic_task.args_.reset(new (std::nothrow) uint8_t[atomic_task.arg_size_]); ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); - tbe_task.arg_size_ = sizeof(void *); + tbe_task.arg_size_ = sizeof(void *) * 2; tbe_task.args_.reset(new (std::nothrow) uint8_t[tbe_task.arg_size_]); - atomic_task.arg_size_ = sizeof(void *); + atomic_task.arg_size_ = sizeof(void *) * 2; atomic_task.args_.reset(new (std::nothrow) uint8_t[atomic_task.arg_size_]); ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); From a029050b65f62ee5f52643babc092ec99efc7e6d Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Tue, 13 Jul 2021 21:10:15 +0800 Subject: [PATCH 211/226] support v1 infershape modified: ge/graph/passes/base_pass.cc modified: ge/graph/passes/base_pass.h modified: ge/graph/passes/infer_base_pass.cc modified: ge/graph/passes/infershape_pass.cc modified: ge/graph/passes/infershape_pass.h modified: ge/graph/preprocess/graph_preprocess.cc modified: tests/ut/ge/graph/passes/addn_pass_unittest.cc modified: tests/ut/ge/graph/passes/base_pass_unittest.cc modified: tests/ut/ge/graph/passes/infershape_pass_unittest.cc modified: ge/graph/passes/base_pass.cc modified: ge/graph/passes/base_pass.h modified: ge/graph/passes/infer_base_pass.cc modified: ge/graph/passes/infershape_pass.cc modified: ge/graph/passes/infershape_pass.h modified: ge/graph/preprocess/graph_preprocess.cc modified: tests/ut/ge/graph/passes/addn_pass_unittest.cc modified: tests/ut/ge/graph/passes/base_pass_unittest.cc modified: tests/ut/ge/graph/passes/infershape_pass_unittest.cc --- ge/graph/passes/base_pass.cc | 849 +++++++----- ge/graph/passes/base_pass.h | 121 +- ge/graph/passes/infer_base_pass.cc | 3 + ge/graph/passes/infershape_pass.cc | 545 +++++--- ge/graph/passes/infershape_pass.h | 94 +- ge/graph/preprocess/graph_preprocess.cc | 16 + tests/ut/ge/graph/passes/addn_pass_unittest.cc | 2 +- tests/ut/ge/graph/passes/base_pass_unittest.cc | 1426 +++++++++++++------- .../ut/ge/graph/passes/infershape_pass_unittest.cc | 423 +++--- 9 files changed, 2187 insertions(+), 1292 deletions(-) diff --git a/ge/graph/passes/base_pass.cc b/ge/graph/passes/base_pass.cc index a1551eb2..8b4a8b88 100755 --- a/ge/graph/passes/base_pass.cc +++ b/ge/graph/passes/base_pass.cc @@ -1,374 +1,475 @@ -/** - * Copyright 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 "graph/passes/base_pass.h" - -#include -#include - -#include "framework/common/debug/log.h" -#include "framework/common/debug/ge_log.h" -#include "graph/compute_graph.h" -#include "graph/utils/graph_utils.h" - -namespace ge { -namespace { -constexpr int kMaxRePassTimes = 10000; -constexpr size_t kMaxOneInNodes = 1000; -// Each iteration, we take about 0.3k memory on the stack, we should change the recursion to loop later -constexpr int kMaxRecursiveDepth = 20; -struct DuringPassNodeSets { - std::unordered_set nodes_seen; - std::unordered_set nodes_deleted; - std::unordered_set nodes_re_pass; - std::unordered_set nodes_re_pass_immediately; - std::unordered_set nodes_last; - std::unordered_set nodes_suspend; - std::unordered_set nodes_resume; -}; - -void GetAllNodesNoInputEdge(const ComputeGraphPtr &graph, std::deque &input_edge_nodes, - std::unordered_set &nodes_seen, std::unordered_set &nodes_last) { - nodes_last.clear(); - for (auto &node : graph->GetDirectNode()) { - if (node == nullptr) { - continue; - } - size_t in_nums = node->GetInNodes().size(); - if (in_nums == 0) { - input_edge_nodes.push_back(node); - nodes_seen.insert(node.get()); - } else if (in_nums > kMaxOneInNodes) { - nodes_last.insert(node); - } - } -} - -bool IsAllInNodesAlive(const Node::Vistor &nodes, const std::unordered_set &nodes_suspend) { - return !std::any_of(nodes.begin(), nodes.end(), [&](const NodePtr &n) { return nodes_suspend.count(n) > 0; }); -} - -void AddNextIterNodes(const Node::Vistor &nodes, std::deque &nodes_to_pass, - DuringPassNodeSets &during_pass_node_set) { - auto &nodes_seen = during_pass_node_set.nodes_seen; - const auto &nodes_last = during_pass_node_set.nodes_last; - const auto &nodes_suspend = during_pass_node_set.nodes_suspend; - for (auto &node : nodes) { - if (node == nullptr) { - continue; - } - if (nodes_last.count(node) != 0) { - continue; - } - if (nodes_suspend.count(node) > 0) { - GELOGD("The node %s has suspend by pass, skip it.", node->GetName().c_str()); - continue; - } - - bool all_in_nodes_alive = IsAllInNodesAlive(node->GetInAllNodes(), nodes_suspend); - bool all_in_nodes_seen = node->IsAllInNodesSeen(nodes_seen); - if (all_in_nodes_seen && all_in_nodes_alive && nodes_seen.insert(node.get()).second) { - nodes_to_pass.push_back(node); - } - } -} - -void AddRepassNodes(DuringPassNodeSets &during_pass_node_set, std::deque &nodes) { - for (const auto &node : during_pass_node_set.nodes_re_pass_immediately) { - GELOGD("The node %s will be re-pass immediately.", node->GetName().c_str()); - nodes.push_front(node); - } - during_pass_node_set.nodes_re_pass_immediately.clear(); -} - -void AddResumeNodes(DuringPassNodeSets &during_pass_node_set, std::deque &nodes) { - for (auto &node : during_pass_node_set.nodes_resume) { - const auto &it = during_pass_node_set.nodes_suspend.find(node); - if (it != during_pass_node_set.nodes_suspend.end()) { - during_pass_node_set.nodes_suspend.erase(node); - GELOGD("The node %s resumed by pass.", node->GetName().c_str()); - nodes.push_back(node); - } else { - GELOGW("The node %s not suspend, drop from resumed", node->GetName().c_str()); - } - } - during_pass_node_set.nodes_resume.clear(); -} - -void PushToSuspendNodes(DuringPassNodeSets &during_pass_node_set, const std::string &pass_name, - const std::unordered_set &nodes_suspend, - const std::unordered_set &nodes_resume) { - for (const auto &node : nodes_suspend) { - GELOGD("The iteration suspend of node %s has been set by pass %s", node->GetName().c_str(), pass_name.c_str()); - during_pass_node_set.nodes_suspend.emplace(node); - } - - for (const auto &node : nodes_resume) { - GELOGD("The iteration suspend of node %s has been resumed by pass %s", node->GetName().c_str(), pass_name.c_str()); - during_pass_node_set.nodes_resume.emplace(node); - } -} - -void PushToRePassIfSeen(NodePtr &node, const std::pair &name_to_pass, - std::unordered_set &nodes_seen, const std::unordered_set &nodes_to_re_pass, - std::unordered_set &nodes_re_pass) { - for (const auto &node_to_re_pass : nodes_to_re_pass) { - if (node_to_re_pass == nullptr) { - GELOGW("Found null re-pass node when executing %s on node %s type %s", name_to_pass.first.c_str(), - node->GetName().c_str(), node->GetType().c_str()); - continue; - } - if (nodes_seen.count(node_to_re_pass.get()) > 0 || node_to_re_pass->IsAllInNodesSeen(nodes_seen)) { - GELOGD("The node %s will be re-pass.", node_to_re_pass->GetName().c_str()); - nodes_re_pass.insert(node_to_re_pass); - } else { - GELOGD("The node %s are not all seen, don't set repass this time", node_to_re_pass->GetName().c_str()); - } - } -} - -Status RunPasses(NodePtr &node, const NamesToPass &names_to_passes, DuringPassNodeSets &during_pass_node_set) { - if (node == nullptr) { - REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); - GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); - return FAILED; - } - GELOGD("Begin to run pass for node %s", node->GetName().c_str()); - for (const auto &name_to_pass : names_to_passes) { - if (name_to_pass.second == nullptr) { - GELOGE(INTERNAL_ERROR, "[Check][Param] There is null pointer in passes(%s), skip it", name_to_pass.first.c_str()); - continue; - } - - GELOGD("Begin to run pass %s for node %s", name_to_pass.first.c_str(), node->GetName().c_str()); - name_to_pass.second->init(); - auto result = name_to_pass.second->Run(node); - if (result != SUCCESS) { - REPORT_CALL_ERROR("E19999", "process pass %s on node:%s failed, ret:%u", - name_to_pass.first.c_str(), node->GetName().c_str(), result); - GELOGE(INTERNAL_ERROR, "[Process][Pass] %s on node %s failed, result " - "%u, the passes will be terminated immediately.", - name_to_pass.first.c_str(), node->GetName().c_str(), result); - return result; - } - - const auto &nodes_to_re_pass = name_to_pass.second->GetNodesNeedRePass(); - PushToRePassIfSeen(node, name_to_pass, during_pass_node_set.nodes_seen, nodes_to_re_pass, - during_pass_node_set.nodes_re_pass); - - const auto &nodes_to_re_pass_immediately = name_to_pass.second->GetNodesNeedRePassImmediately(); - PushToRePassIfSeen(node, name_to_pass, during_pass_node_set.nodes_seen, nodes_to_re_pass_immediately, - during_pass_node_set.nodes_re_pass_immediately); - - PushToSuspendNodes(during_pass_node_set, name_to_pass.first, - name_to_pass.second->GetNodesSuspend(), name_to_pass.second->GetNodesResume()); - - const auto &nodes_deleted_by_pass = name_to_pass.second->GetNodesDeleted(); - during_pass_node_set.nodes_deleted.insert(nodes_deleted_by_pass.begin(), nodes_deleted_by_pass.end()); - if (nodes_deleted_by_pass.count(node) > 0) { - GELOGD("The node %s was deleted by pass %s, stop the remain passes", node->GetName().c_str(), - name_to_pass.first.c_str()); - break; - } - } - - return SUCCESS; -} - -void SetFlagOption(NodePassOption option, NamesToPass names_to_pass) { - for (auto &name_to_pass : names_to_pass) { - name_to_pass.second->SetOption(option, ""); - } -} - -void ClearOption(NamesToPass names_to_pass) { - for (auto &name_to_pass : names_to_pass) { - name_to_pass.second->ClearOptions(); - } -} - -bool CheckNode(const NodePtr &node, const DuringPassNodeSets &during_pass_node_set) { - if (node == nullptr) { - GELOGW("node is null"); - return false; - } - if (during_pass_node_set.nodes_deleted.count(node) > 0) { - GELOGD("The node %s was deleted before, skip it.", node->GetName().c_str()); - return false; - } - if (during_pass_node_set.nodes_suspend.count(node) > 0) { - GELOGD("The node %s has been added to suspend-iteration nodes list, the iteration of it will be suspend.", - node->GetName().c_str()); - return false; - } - - return true; -} -} // namespace - -Status BaseNodePass::IsolateAndDeleteNode(NodePtr &node, const std::vector &io_map) { - if (node == nullptr) { - REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); - GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); - return FAILED; - } - GELOGI("Prepare to isolate and delete node, name:%s, type:%s.", node->GetName().c_str(), - node->GetType().c_str()); - ComputeGraphPtr graph = node->GetOwnerComputeGraph(); - if (graph == nullptr) { - REPORT_INNER_ERROR("E19999", "The owner graph of node:%s must not be null.", node->GetName().c_str()); - GELOGE(FAILED, "[Get][OwnerComputeGraph] failed, The owner graph of node:%s must not be null.", - node->GetName().c_str()); - return FAILED; - } - - AddRePassNodesWithInOut(node); - - if (GraphUtils::IsolateNode(node, io_map) != GRAPH_SUCCESS) { - REPORT_CALL_ERROR("E19999", "Isolate Node:%s failed", node->GetName().c_str()); - GELOGE(FAILED, "[Isolate][Node] %s failed.", node->GetName().c_str()); - return FAILED; - } - - if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { - REPORT_CALL_ERROR("E19999", "call RemoveNodeWithoutRelink for node:%s failed.", node->GetName().c_str()); - GELOGE(FAILED, "[Call][RemoveNodeWithoutRelink] for node:%s failed.", node->GetName().c_str()); - return FAILED; - } - - AddNodeDeleted(node); - return SUCCESS; -} - -Status GEPass::Run(const NamesToPass &names_to_passes) { - if (graph_ == nullptr) { - REPORT_INNER_ERROR("E19999", "graph_ is nullptr, check invalid."); - GELOGE(INTERNAL_ERROR, "[Check][Param] The graph is nullptr"); - return INTERNAL_ERROR; - } - if (names_to_passes.empty()) { - GELOGW("No passes input, the GEPass will do nothing"); - return INTERNAL_ERROR; - } - - if (depth_ > kMaxRecursiveDepth) { - GELOGE(PARAM_INVALID, - "[Check][Param] The pass for root graph %s will be terminated because too many nesting" - " levels(%d) of subgraphs, last subgraph is %s", - root_graph_->GetName().c_str(), depth_, graph_->GetName().c_str()); - return PARAM_INVALID; - } - - return RunPassesOneGraph(names_to_passes); -} - -Status GEPass::RunPassesOneGraph(const NamesToPass &names_to_passes) { - GELOGD("Begin to run pass on graph, passes count %zu", names_to_passes.size()); - std::deque nodes; - DuringPassNodeSets during_pass_node_set; - GetAllNodesNoInputEdge(graph_, nodes, during_pass_node_set.nodes_seen, during_pass_node_set.nodes_last); - GELOGD("Start points count %zu", nodes.size()); - int re_pass_times = 0; - - do { - for (auto &node : during_pass_node_set.nodes_re_pass) { - nodes.push_back(node); - during_pass_node_set.nodes_seen.insert(node.get()); - } - during_pass_node_set.nodes_re_pass.clear(); - - while (!nodes.empty()) { - NodePtr node = nodes.front(); - nodes.pop_front(); - - (void)during_pass_node_set.nodes_re_pass.erase(node); - if (!CheckNode(node, during_pass_node_set)) { - continue; - } - AddNextIterNodes(node->GetOutNodes(), nodes, during_pass_node_set); - - auto ret = RunPasses(node, names_to_passes, during_pass_node_set); - if (ret != SUCCESS) { - GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code:%u", - node->GetName().c_str(), node->GetType().c_str(), ret); - return ret; - } - - bool has_sub_graph = false; - ret = RunPassesOnSubGraph(node, names_to_passes, has_sub_graph); - if (ret != SUCCESS) { - GELOGE(ret, "[Run][Passes] on the sub graph of node %s failed", node->GetName().c_str()); - return ret; - } - - if (has_sub_graph) { - GELOGD("There are subgraphs on node %s, run passes for for the second time", node->GetName().c_str()); - SetFlagOption(kOptimizeAfterSubGraph, names_to_passes); - ret = RunPasses(node, names_to_passes, during_pass_node_set); - if (ret != SUCCESS) { - GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code: %u", - node->GetName().c_str(), node->GetType().c_str(), ret); - return ret; - } - - // There is only one option scene, so set and clear options around the `RunPasses` func. - // if there are more than one scene to set options, the `ClearOption` function - // should be called each time at the begin of the iteration - ClearOption(names_to_passes); - } - - AddRepassNodes(during_pass_node_set, nodes); - AddResumeNodes(during_pass_node_set, nodes); - } - - for (auto &node : during_pass_node_set.nodes_last) { - bool all_in_nodes_seen = node->IsAllInNodesSeen(during_pass_node_set.nodes_seen); - if (all_in_nodes_seen && during_pass_node_set.nodes_seen.insert(node.get()).second) { - nodes.push_back(node); - } - } - during_pass_node_set.nodes_last.clear(); - } while ((!during_pass_node_set.nodes_re_pass.empty() || !nodes.empty()) && ++re_pass_times < kMaxRePassTimes); - - if (re_pass_times == kMaxRePassTimes) { - GELOGW("re_pass_times should not come to %d", kMaxRePassTimes); - } - GELOGD("All passes runs end"); - - return SUCCESS; -} -Status GEPass::RunPassesOnSubGraph(const NodePtr &node, const NamesToPass &names_to_passes, bool &has_sub_graph) { - auto sub_graph_names = node->GetOpDesc()->GetSubgraphInstanceNames(); - has_sub_graph = false; - for (const auto &name : sub_graph_names) { - auto graph = root_graph_->GetSubgraph(name); - if (graph == nullptr) { - GELOGW("Can not find the sub graph %s from node %s, the pass-process will skip it", - name.c_str(), node->GetName().c_str()); - continue; - } - has_sub_graph = true; - GELOGI("Begin to run passes on the sub graph %s of node %s", name.c_str(), node->GetName().c_str()); - GEPass pass(graph, root_graph_, depth_ + 1); - auto ret = pass.Run(names_to_passes); - if (ret != SUCCESS) { - GELOGE(ret, "[Run][Passes] for sub graph:%s from node:%s failed", name.c_str(), node->GetName().c_str()); - return ret; - } - } - return SUCCESS; -} -} // namespace ge +/** + * Copyright 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 "graph/passes/base_pass.h" + +#include +#include + +#include "common/debug/log.h" +#include "graph/utils/graph_utils.h" + +namespace ge { +namespace { +constexpr int kMaxRePassTimes = 10000; +constexpr size_t kMaxOneInNodes = 1000; +// Each iteration, we take about 0.3k memory on the stack, we should change the recursion to loop later +constexpr int kMaxRecursiveDepth = 20; + +void GetAllNodesNoInputEdge(const ComputeGraphPtr &graph, + GEPass::GraphLevelState &g_state) { + for (auto &node : graph->GetDirectNode()) { + if (node == nullptr) { + continue; + } + size_t in_nums = node->GetInNodes().size(); + if (in_nums == 0) { + g_state.AddNodeToQueueIfNotSeen(node); + } else if (in_nums > kMaxOneInNodes) { + g_state.nodes_last.insert(node); + } + } +} + +bool AnyNodesIn(const Node::Vistor &nodes, const std::unordered_set &nodes_set) { + return std::any_of(nodes.begin(), nodes.end(), [&](const NodePtr &n) { + return nodes_set.count(n) > 0; + }); +} + + +bool IsNodeReadyToQueue(const NodePtr &node, GEPass::GraphLevelState &g_state) { + if (node == nullptr) { + GELOGW("node is null"); + return false; + } + if (g_state.nodes_deleted.count(node) > 0) { + GELOGD("The node %s was deleted before, skip it.", node->GetName().c_str()); + return false; + } + + if (g_state.nodes_last.count(node) != 0) { + return false; + } + + // all in_node seen && all in_node not suspend + if (!node->IsAllInNodesSeen(g_state.nodes_seen)) { + return false; + } + + if (g_state.nodes_suspend.count(node) > 0) { + GELOGD("The node %s has been added to suspend-iteration nodes list, the iteration of it will be suspend.", + node->GetName().c_str()); + return false; + } + + if (AnyNodesIn(node->GetInAllNodes(), g_state.nodes_suspend)) { + GELOGD("The node %s has been added to suspend-iteration nodes list, the iteration of it will be suspend.", + node->GetName().c_str()); + return false; + } + return true; +} + +void AddNextIterNodes(const NodePtr &cur_node, + std::unordered_set &out_nodes_before_pass, + GEPass::GraphLevelState &g_state) { + for (auto &node : cur_node->GetOutNodes()) { + if (node == nullptr) { + continue; + } + if(out_nodes_before_pass.erase(node) == 0) { + // after pass node, new output node come up + GELOGI("New output node %s come up after pass %s.", + node->GetName().c_str(), cur_node->GetName().c_str()); + } + + // all in_node seen && all in_node not suspend + if (IsNodeReadyToQueue(node, g_state)) { + g_state.AddNodeToQueueIfNotSeen(node); + } + } + + // + for (const auto &node : out_nodes_before_pass) { + // A-->B-->C if B was + // unlink edge may happend, add these node to queue if needed + if (node->GetInAllNodes().empty() && IsNodeReadyToQueue(node, g_state)) { + GELOGI("Node %s may lost from cur node, add to queue if not seen.", + node->GetName().c_str(), cur_node->GetName().c_str()); + g_state.AddNodeToQueueIfNotSeen(node); + } + } +} + +void AddImmediateRepassNodesToQueue(NodePtr &cur_node, + std::unordered_map re_pass_imm_nodes_to_pass_names, + GEPass::GraphLevelState &g_state) { + for (const auto &node_2_pass_names : re_pass_imm_nodes_to_pass_names) { + auto imme_repass_node = node_2_pass_names.first; + if (imme_repass_node == nullptr) { + GELOGW("Found null immediately re-pass node when executing pass %s on node %s type %s", + node_2_pass_names.second.c_str(), + cur_node->GetName().c_str(), cur_node->GetType().c_str()); + continue; + } + if (g_state.nodes_passed.count(imme_repass_node) > 0) { + GELOGD("The node %s specified by pass %s has been passed, it will repass immediately", + imme_repass_node->GetName().c_str(), node_2_pass_names.second.c_str()); + g_state.AddNodeToQueueFront(imme_repass_node); + continue; + } + GELOGW("The node %s specified by pass %s has un-passed, it will not repass immediately", + node_2_pass_names.first->GetName().c_str(), node_2_pass_names.second.c_str()); + } +} + +void AddLastNodesToQueue(GEPass::GraphLevelState &g_state) { + for (auto &node : g_state.nodes_last) { + if (node->IsAllInNodesSeen(g_state.nodes_seen)) { + g_state.AddNodeToQueueIfNotSeen(node); + } + } + g_state.nodes_last.clear(); +} + +void AddResumeNodesToQueue(const std::unordered_map resume_node_2_pass_names, + GEPass::GraphLevelState &g_state) { + // Now base pass doesnt record the order of suspend & resume, so we dont know which one come first in a node pass. + // Here if one node pass suspend and resume a node ,consider it resume that node. + // Better way to record the order, and here suspend or resume in order. + for (const auto &node_2_pass_names : resume_node_2_pass_names) { + auto node = node_2_pass_names.first; + if (g_state.nodes_suspend.erase(node) > 0) { + if (g_state.nodes_seen.count(node.get()) > 0 || node->IsAllInNodesSeen(g_state.nodes_seen)) { + g_state.nodes.push_back(node); + GELOGD("Node %s has been resumed by pass %s, and add to pass queue", + node->GetName().c_str(), node_2_pass_names.second.c_str()); + } + } + } +} + +void PushToRePassIfSeen(NodePtr &node, const std::pair &name_to_pass, + std::unordered_set &nodes_seen, const std::vector &nodes_to_re_pass, + GEPass::RepassLevelState &rp_state) { + for (const auto &node_to_re_pass : nodes_to_re_pass) { + if (node_to_re_pass == nullptr) { + GELOGW("Found null re-pass node when executing %s on node %s type %s", name_to_pass.first.c_str(), + node->GetName().c_str(), node->GetType().c_str()); + continue; + } + if (nodes_seen.count(node_to_re_pass.get()) > 0 || node_to_re_pass->IsAllInNodesSeen(nodes_seen)) { + if (rp_state.AddNodeToRepass(node_to_re_pass)) { + GELOGD("The node %s will be re-pass.", node_to_re_pass->GetName().c_str()); + continue; + } + GELOGD("Node %s has been added to repass queue, no need to add again.", node_to_re_pass->GetName().c_str()); + } else { + GELOGD("The node %s are not all seen, don't set repass this time", node_to_re_pass->GetName().c_str()); + } + } +} + +void SetFlagOption(NodePassOption option, NamesToPass names_to_pass) { + for (auto &name_to_pass : names_to_pass) { + name_to_pass.second->SetOption(option, ""); + } +} + +void ClearOption(NamesToPass names_to_pass) { + for (auto &name_to_pass : names_to_pass) { + name_to_pass.second->ClearOptions(); + } +} +} // namespace + +Status BaseNodePass::IsolateAndDeleteNode(NodePtr &node, const std::vector &io_map, + bool is_repass_io_immediately) { + if (node == nullptr) { + REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); + GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); + return FAILED; + } + GELOGI("Prepare to isolate and delete node, name:%s, type:%s.", node->GetName().c_str(), + node->GetType().c_str()); + ComputeGraphPtr graph = node->GetOwnerComputeGraph(); + if (graph == nullptr) { + REPORT_INNER_ERROR("E19999", "The owner graph of node:%s must not be null.", node->GetName().c_str()); + GELOGE(FAILED, "[Get][OwnerComputeGraph] failed, The owner graph of node:%s must not be null.", + node->GetName().c_str()); + return FAILED; + } + + is_repass_io_immediately ? AddImmediateRePassNodesWithInOut(node) : AddRePassNodesWithInOut(node); + + if (GraphUtils::IsolateNode(node, io_map) != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Isolate Node:%s failed", node->GetName().c_str()); + GELOGE(FAILED, "[Isolate][Node] %s failed.", node->GetName().c_str()); + return FAILED; + } + + if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { + REPORT_CALL_ERROR("E19999", "call RemoveNodeWithoutRelink for node:%s failed.", node->GetName().c_str()); + GELOGE(FAILED, "[Call][RemoveNodeWithoutRelink] for node:%s failed.", node->GetName().c_str()); + return FAILED; + } + + AddNodeDeleted(node); + return SUCCESS; +} + +Status GEPass::Run(const NamesToPass &names_to_passes) { + if (graph_ == nullptr) { + REPORT_INNER_ERROR("E19999", "graph_ is nullptr, check invalid."); + GELOGE(INTERNAL_ERROR, "[Check][Param] The graph is nullptr"); + return INTERNAL_ERROR; + } + if (names_to_passes.empty()) { + GELOGW("No passes input, the GEPass will do nothing"); + return INTERNAL_ERROR; + } + for (const auto &name_to_pass : names_to_passes) { + if (name_to_pass.second == nullptr) { + GELOGE(INTERNAL_ERROR, "[Check][Param] There is null pointer in passes(%s)", name_to_pass.first.c_str()); + return INTERNAL_ERROR; + } + } + + if (depth_ > kMaxRecursiveDepth) { + GELOGE(PARAM_INVALID, + "[Check][Param] The pass for root graph %s will be terminated because too many nesting" + " levels(%d) of subgraphs, last subgraph is %s", + root_graph_->GetName().c_str(), depth_, graph_->GetName().c_str()); + return PARAM_INVALID; + } + + return RunPassesOneGraph(names_to_passes); + // todo debug mode is on, find first node in topo order which is not passed. and give a warning +} + +void NotifyPassGraphStart(const ComputeGraphPtr &graph, const NamesToPass &names_to_pass) { + for (auto &name_to_pass : names_to_pass) { + name_to_pass.second->OnStartPassGraph(graph); + } +} + +Status GEPass::HandleLeakedSuspendNodes(const NamesToPass &names_to_passes, GraphLevelState &g_state) { + std::unordered_map resume_nodes_to_pass_names; + for (auto &name_to_pass : names_to_passes) { + name_to_pass.second->init(); + auto ret = name_to_pass.second->OnSuspendNodesLeaked(); + if (ret != SUCCESS) { + GELOGE(ret, "Internal error with OnSuspendNodesLeaked on pass %s.", name_to_pass.first.c_str()); + return ret; + } + for (const auto &resume_node : name_to_pass.second->GetNodesResume()){ + resume_nodes_to_pass_names[resume_node].append(name_to_pass.first + ","); + } + } + AddResumeNodesToQueue(resume_nodes_to_pass_names, g_state); + return SUCCESS; +} + +Status GEPass::RunPassesOneGraph(const NamesToPass &names_to_passes) { + GELOGD("Begin to run pass on graph, passes count %zu", names_to_passes.size()); + NotifyPassGraphStart(graph_, names_to_passes); + GraphLevelState g_state; + g_state.re_pass_times = 0; + GetAllNodesNoInputEdge(graph_, g_state); + GELOGD("Start points count %zu", g_state.nodes.size()); + + do { + if (!g_state.nodes_suspend.empty()) { + auto ret = HandleLeakedSuspendNodes(names_to_passes, g_state); + if (ret != SUCCESS) { + // log inside upper function + return ret; + } + if (g_state.nodes.empty()) { + GELOGE(INTERNAL_ERROR, "There are some suspended nodes leaked and no pass resume them."); + return INTERNAL_ERROR; + } + } + auto ret = RunPassesGraphRepass(names_to_passes, g_state); + if (ret != SUCCESS) { + return ret; + } + } while (!g_state.nodes_suspend.empty()); + + return SUCCESS; +} + + +Status GEPass::RunPassesGraphRepass(const NamesToPass &names_to_passes, GraphLevelState &g_state) { + RepassLevelState rp_state; + do { + for (auto &node : rp_state.nodes_re_pass) { + if (rp_state.nodes_re_pass_set.count(node) > 0) { + GELOGD("Add node %s to queue for re-pass", node->GetName().c_str()); + g_state.AddNodeToQueue(node); + } + } + rp_state.ClearRepass(); + + while (!g_state.nodes.empty()) { + auto node = g_state.PopFront(); + if (g_state.nodes_deleted.count(node) > 0) { + GELOGD("The node %s was deleted before, skip it.", node->GetName().c_str()); + continue; + } + rp_state.EraseNodeFromRepass(node); + g_state.nodes_seen.insert(node.get()); + + // collect out nodes before pass + std::unordered_set out_nodes_before_pass; + for (const auto &out_node : node->GetOutNodes()) { + out_nodes_before_pass.insert(out_node); + } + auto ret = RunPassesNodeOnce(node, names_to_passes, g_state, rp_state); + if (ret != SUCCESS) { + GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code:%u", node->GetName().c_str(), + node->GetType().c_str(), ret); + return ret; + } + AddNextIterNodes(node, out_nodes_before_pass, g_state); + + } + AddLastNodesToQueue(g_state); + } while ((!rp_state.nodes_re_pass.empty() || !g_state.nodes.empty()) && ++g_state.re_pass_times < kMaxRePassTimes); + + if (g_state.re_pass_times == kMaxRePassTimes) { + GELOGW("re_pass_times should not come to %d", kMaxRePassTimes); + } + GELOGD("All passes runs end"); + return SUCCESS; +} + +Status GEPass::RunPassesOnSubGraph(const NodePtr &node, const NamesToPass &names_to_passes, bool &has_sub_graph) { + auto sub_graph_names = node->GetOpDesc()->GetSubgraphInstanceNames(); + has_sub_graph = false; + for (const auto &name : sub_graph_names) { + auto graph = root_graph_->GetSubgraph(name); + if (graph == nullptr) { + GELOGW("Can not find the sub graph %s from node %s, the pass-process will skip it", + name.c_str(), node->GetName().c_str()); + continue; + } + has_sub_graph = true; + GELOGI("Begin to run passes on the sub graph %s of node %s", name.c_str(), node->GetName().c_str()); + GEPass pass(graph, root_graph_, depth_ + 1); + auto ret = pass.Run(names_to_passes); + if (ret != SUCCESS) { + GELOGE(ret, "[Run][Passes] for sub graph:%s from node:%s failed", name.c_str(), node->GetName().c_str()); + return ret; + } + } + return SUCCESS; +} + +Status GEPass::RunPassesNodeOnce(NodePtr &node, const NamesToPass &names_to_passes, + GraphLevelState &g_state, RepassLevelState &rp_state) { + auto ret = RunPassesOnNode(node, names_to_passes, g_state, rp_state); + if (ret != SUCCESS) { + GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code:%u", node->GetName().c_str(), + node->GetType().c_str(), ret); + return ret; + } + + bool has_sub_graph = false; + ret = RunPassesOnSubGraph(node, names_to_passes, has_sub_graph); + if (ret != SUCCESS) { + GELOGE(ret, "[Run][Passes] on the sub graph of node %s failed", node->GetName().c_str()); + return ret; + } + + if (has_sub_graph) { + GELOGD("There are subgraphs on node %s, run passes for for the second time", node->GetName().c_str()); + SetFlagOption(kOptimizeAfterSubGraph, names_to_passes); + ret = RunPassesOnNode(node, names_to_passes, g_state, rp_state); + if (ret != SUCCESS) { + GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code: %u", node->GetName().c_str(), + node->GetType().c_str(), ret); + return ret; + } + + // There is only one option scene, so set and clear options around the `RunPasses` func. + // if there are more than one scene to set options, the `ClearOption` function + // should be called each time at the begin of the iteration + ClearOption(names_to_passes); + } + return SUCCESS; +} + +Status GEPass::RunPassesOnNode(NodePtr &node, const NamesToPass &names_to_passes, GraphLevelState &g_state, + RepassLevelState &rp_state) { + if (node == nullptr) { + REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); + GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); + return FAILED; + } + GELOGD("Begin to run pass for node %s", node->GetName().c_str()); + for (const auto &name_to_pass : names_to_passes) { + GELOGD("Begin to run pass %s for node %s", name_to_pass.first.c_str(), node->GetName().c_str()); + name_to_pass.second->init(); + auto result = name_to_pass.second->Run(node); + if (result != SUCCESS) { + REPORT_CALL_ERROR("E19999", "process pass %s on node:%s failed, ret:%u", + name_to_pass.first.c_str(), node->GetName().c_str(), result); + GELOGE(INTERNAL_ERROR, "[Process][Pass] %s on node %s failed, result " + "%u, the passes will be terminated immediately.", + name_to_pass.first.c_str(), node->GetName().c_str(), result); + return result; + } + if (name_to_pass.second->GetNodesDeleted().count(node) > 0) { + GELOGD("The node %s was deleted by pass %s, stop the remain passes", node->GetName().c_str(), + name_to_pass.first.c_str()); + break; + } + } + + g_state.nodes_passed.insert(node); + + std::unordered_map re_pass_imm_nodes_to_pass_names; + std::unordered_map resume_nodes_to_pass_names; + // if muti psss repass one same node, it will add to queue many times, so collect and duplicate + for (const auto &name_to_pass : names_to_passes) { + PushToRePassIfSeen(node, name_to_pass, g_state.nodes_seen, + name_to_pass.second->GetNodesNeedRePass(), + rp_state); + // collect imm_node && resume_node among these passes + for (const auto &imm_node : name_to_pass.second->GetNodesNeedRePassImmediately()){ + re_pass_imm_nodes_to_pass_names[imm_node].append(name_to_pass.first + ","); + } + for (const auto &resume_node : name_to_pass.second->GetNodesResume()){ + resume_nodes_to_pass_names[resume_node].append(name_to_pass.first + ","); + } + + for (const auto &suspend_node : name_to_pass.second->GetNodesSuspend()) { + GELOGD("The iteration suspend of node %s has been set by pass %s", suspend_node->GetName().c_str(), + name_to_pass.first.c_str()); + g_state.nodes_suspend.insert(suspend_node); + } + const auto &nodes_deleted_by_pass = name_to_pass.second->GetNodesDeleted(); + g_state.nodes_deleted.insert(nodes_deleted_by_pass.begin(), nodes_deleted_by_pass.end()); + } + + AddImmediateRepassNodesToQueue(node, re_pass_imm_nodes_to_pass_names, g_state); + AddResumeNodesToQueue(resume_nodes_to_pass_names, g_state); + + return SUCCESS; +} +} // namespace ge diff --git a/ge/graph/passes/base_pass.h b/ge/graph/passes/base_pass.h index d0f125b2..093e2dce 100644 --- a/ge/graph/passes/base_pass.h +++ b/ge/graph/passes/base_pass.h @@ -22,7 +22,6 @@ #include #include #include - #include "framework/common/ge_inner_error_codes.h" #include "framework/common/types.h" #include "graph/compute_graph.h" @@ -40,6 +39,7 @@ enum NodePassOption { }; class BaseNodePass { + // todo comments public: /// /// Optimize on one node. the function can add nodes to the graph, change @@ -51,7 +51,7 @@ class BaseNodePass { virtual ~BaseNodePass() = default; - const std::unordered_set &GetNodesNeedRePass() { return nodes_need_re_pass_; } + const std::vector &GetNodesNeedRePass() { return nodes_need_re_pass_; } const std::unordered_set &GetNodesNeedRePassImmediately() { return nodes_need_re_pass_immediately_; } @@ -61,23 +61,32 @@ class BaseNodePass { const std::unordered_set &GetNodesResume() { return nodes_resume_; } + virtual Status OnSuspendNodesLeaked() { return SUCCESS; } + void SetOption(NodePassOption option, const std::string &value) { options_[option] = value; } void ClearOptions() { options_.clear(); } void init() { nodes_need_re_pass_.clear(); - nodes_deleted_.clear(); nodes_need_re_pass_immediately_.clear(); + nodes_deleted_.clear(); nodes_suspend_.clear(); nodes_resume_.clear(); } + virtual void OnStartPassGraph(const ComputeGraphPtr &graph) { + current_graph_name_ = graph->GetName(); + } + protected: - Status IsolateAndDeleteNode(NodePtr &node, const std::vector &io_map); + const string &GetCurrentGraphName() const { + return current_graph_name_; + } + Status IsolateAndDeleteNode(NodePtr &node, const std::vector &io_map, bool is_repass_io_immediately = false); - Status IsolateAndDeleteNode(NodePtr &node, const std::initializer_list &io_map) { - return IsolateAndDeleteNode(node, std::vector(io_map)); + Status IsolateAndDeleteNode(NodePtr &node, const std::initializer_list &io_map, bool is_repass_io_immediately = false) { + return IsolateAndDeleteNode(node, std::vector(io_map), is_repass_io_immediately); } /// @@ -86,7 +95,7 @@ class BaseNodePass { /// optimized by other passes, call this function. /// @param node /// - void AddRePassNode(const NodePtr &node) { nodes_need_re_pass_.insert(node); } + void AddRePassNode(const NodePtr &node) { nodes_need_re_pass_.emplace_back(node); } /// /// Add a node to be optimized immediately again. If you add a new node to the graph, or @@ -101,14 +110,30 @@ class BaseNodePass { /// @param node /// void AddRePassNodesWithInOut(const NodePtr &node) { + auto in_nodes = node->GetInNodes(); + for (auto &in_node : in_nodes) { + AddRePassNode(in_node); + } AddRePassNode(node); auto out_nodes = node->GetOutNodes(); for (auto &out_node : out_nodes) { AddRePassNode(out_node); } + } + + /// + /// Add a node and it's input/output data nodes to be optimized immediately again. + /// @param node + /// + void AddImmediateRePassNodesWithInOut(const NodePtr &node) { auto in_nodes = node->GetInNodes(); for (auto &in_node : in_nodes) { - AddRePassNode(in_node); + AddImmediateRePassNode(in_node); + } + AddImmediateRePassNode(node); + auto out_nodes = node->GetOutNodes(); + for (auto &out_node : out_nodes) { + AddImmediateRePassNode(out_node); } } @@ -123,34 +148,27 @@ class BaseNodePass { void AddNodeDeleted(const NodePtr &node) { nodes_deleted_.insert(node); } /// - /// If you suspend a node from the graph, especially following node. The remain - /// iterate passes will stop process on the suspend node(if it can be + /// If you postpone a node from the graph, especially following node. The remain + /// iterate passes will stop process on the postpone node(if it can be /// reached by edge connections) till the last one. Obviously it is a waste of - /// time. You can add the suspend nodes by calling this function, to stop the + /// time. You can add the postpone nodes by calling this function, to stop the /// next iterations. /// @param node /// void AddNodeSuspend(const NodePtr &node) { nodes_suspend_.insert(node); } - /// - /// If you resume a node from the graph, especially following node. The remain - /// iterate passes will continue process on the resume node(if it can be - /// reached by edge connections) till the last one. - /// You can add the resume nodes by calling this function, to resume the - /// next iterations. - /// @param node - /// void AddNodeResume(const NodePtr &node) { nodes_resume_.insert(node); } bool OptionExists(NodePassOption option) { return options_.count(option) > 0; } private: - std::unordered_set nodes_need_re_pass_; + std::vector nodes_need_re_pass_; std::unordered_set nodes_need_re_pass_immediately_; std::unordered_set nodes_deleted_; std::unordered_set nodes_suspend_; std::unordered_set nodes_resume_; std::map options_; + std::string current_graph_name_; }; using NamesToPass = std::vector>; @@ -160,12 +178,75 @@ class GEPass { explicit GEPass(ComputeGraphPtr &graph) : graph_(graph), root_graph_(graph), depth_(1) {} virtual ~GEPass() = default; Status Run(const NamesToPass &names_to_passes); + /* +* todo +* OneGraph: nodes_deleted, nodes_seen, nodes_passed, nodes_suspended +* RePass: nodes_re_pass +* GraphOneTime: nodes_last +* NodeOneTime: nodes_re_pass_immediately, nodes_resume +*/ + struct GraphLevelState { + std::unordered_set nodes_deleted; + std::unordered_set nodes_seen; + std::unordered_set nodes_passed; + std::unordered_set nodes_suspend; + std::unordered_set nodes_last; + std::deque nodes; + int re_pass_times; + + void AddNodeToQueueFront(NodePtr node) { + nodes_seen.insert(node.get()); + nodes.emplace_front(std::move(node)); + } + + void AddNodeToQueue(NodePtr node) { + nodes_seen.insert(node.get()); + nodes.emplace_back(std::move(node)); + } + void AddNodeToQueueIfNotSeen(NodePtr node) { + if (nodes_seen.insert(node.get()).second) { + nodes.emplace_back(std::move(node)); + } + } + NodePtr PopFront() { + NodePtr node = nodes.front(); + nodes.pop_front(); + return node; + } + }; + struct RepassLevelState { + std::vector nodes_re_pass; + std::unordered_set nodes_re_pass_set; + bool AddNodeToRepass(NodePtr node) { + if (!nodes_re_pass_set.insert(node).second) { + return false; + } + nodes_re_pass.emplace_back(node); + return true; + } + void EraseNodeFromRepass(NodePtr node) { + nodes_re_pass_set.erase(node); + } + void ClearRepass() { + nodes_re_pass_set.clear(); + nodes_re_pass.clear(); + } + }; + struct GraphOneTimeLevelState { + std::unordered_set nodes_last; + }; private: GEPass(ComputeGraphPtr &graph, ComputeGraphPtr &root_graph, int depth) : graph_(graph), root_graph_(root_graph), depth_(depth) {} + Status RunPassesNodeOnce(NodePtr &node, const NamesToPass &names_to_passes, + GraphLevelState &g_state, RepassLevelState &rp_state); + Status RunPassesGraphRepass(const NamesToPass &names_to_passes, GraphLevelState &g_state); Status RunPassesOneGraph(const NamesToPass &names_to_passes); Status RunPassesOnSubGraph(const NodePtr &node, const NamesToPass &names_to_passes, bool &has_sub_graph); + Status RunPassesOnNode(NodePtr &node, const NamesToPass &names_to_passes, GraphLevelState &g_state, + RepassLevelState &rp_state); + Status HandleLeakedSuspendNodes(const NamesToPass &names_to_passes, GraphLevelState &g_state); ComputeGraphPtr graph_; ComputeGraphPtr root_graph_; int depth_; diff --git a/ge/graph/passes/infer_base_pass.cc b/ge/graph/passes/infer_base_pass.cc index 25c45677..636cf2ab 100644 --- a/ge/graph/passes/infer_base_pass.cc +++ b/ge/graph/passes/infer_base_pass.cc @@ -86,6 +86,9 @@ bool InferBasePass::NeedInfer(const NodePtr &node) const { return true; } void InferBasePass::AddChangedNodesImmediateRepass(const std::set &changed_nodes) { // need passed_nodes set to solve the problem that multi-input operators do repass in advance. // when there is passed_nodes set, wo should call AddImmediateRePassNode for all nodes in changed_nodes. + for (const auto &node_ele : changed_nodes) { + AddImmediateRePassNode(node_ele); + } } graphStatus InferBasePass::InferAndUpdate(NodePtr &node, bool before_subgraph, std::set &changed_nodes) { diff --git a/ge/graph/passes/infershape_pass.cc b/ge/graph/passes/infershape_pass.cc index a5e64519..deaebf4f 100755 --- a/ge/graph/passes/infershape_pass.cc +++ b/ge/graph/passes/infershape_pass.cc @@ -1,175 +1,370 @@ -/** - * Copyright 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 "graph/passes/infershape_pass.h" -#include "common/util/error_manager/error_manager.h" -#include "framework/common/debug/ge_log.h" -#include "analyzer/analyzer.h" -#include "framework/common/util.h" -#include "graph/shape_refiner.h" -#include "graph/utils/graph_utils.h" -#include "graph/utils/node_utils.h" -#include "common/omg_util.h" -#include "graph/debug/ge_attr_define.h" -#include "graph/utils/tensor_utils.h" -#include "graph/utils/type_utils.h" - -namespace ge { - -void SerialShapeRange(const GeTensorDescPtr &desc, std::string &desc_str) { - desc_str += "["; - std::vector> shape_range; - (void)desc->GetShapeRange(shape_range); - for (const auto &pair : shape_range) { - desc_str += "{"; - desc_str += std::to_string(pair.first) + "," + std::to_string(pair.second); - desc_str += "},"; - } - desc_str += "]"; - shape_range.clear(); - (void)desc->GetOriginShapeRange(shape_range); - for (const auto &pair : shape_range) { - desc_str += ",{"; - desc_str += std::to_string(pair.first) + "," + std::to_string(pair.second); - desc_str += "},"; - } -} - -std::string GetInTensorInfoWithString(const ge::NodePtr &node) { - ge::OpDescPtr op_desc = node->GetOpDesc(); - std::stringstream ss; - ss << "{"; - int32_t in_idx = 0; - for (const auto &input_desc : op_desc->GetAllInputsDescPtr()) { - if (input_desc == nullptr) { - in_idx++; - continue; - } - if (in_idx > 0) { - ss << " "; - } - ss << "input_" << in_idx << " " << "tensor: ["; - ss << "(shape:[" << input_desc->MutableShape().ToString() << "]),"; - ss << "(format:" << TypeUtils::FormatToSerialString(input_desc->GetFormat()) << "),"; - ss << "(dtype:" << TypeUtils::DataTypeToSerialString(input_desc->GetDataType()) << "),"; - ss << "(origin_shape:" << input_desc->GetOriginShape().ToString() << "),"; - ss << "(origin_format:" << TypeUtils::FormatToSerialString(input_desc->GetOriginFormat()) << "),"; - ss << "(origin_dtype:" << TypeUtils::DataTypeToSerialString(input_desc->GetOriginDataType()) << "),"; - string range_str; - SerialShapeRange(input_desc, range_str); - ss << "(shape_range:" << range_str << ")]"; - in_idx++; - } - return ss.str(); -} - -Status InferShapePass::Run(NodePtr &node) { - // kOptimizeAfterSubGraph exist means after subgraph - auto ret = ShapeRefiner::InferShapeAndType(node, !OptionExists(kOptimizeAfterSubGraph)); - if (ret != GRAPH_SUCCESS) { - // select INFERSHAPE failed info - auto graph = node->GetOwnerComputeGraph(); - GE_CHECK_NOTNULL(graph); - auto root_graph = ge::GraphUtils::FindRootGraph(graph); - GE_CHECK_NOTNULL(root_graph); - analyzer::DataInfo analyze_info{root_graph->GetSessionID(), root_graph->GetGraphID(), - analyzer::INFER_SHAPE, node, "InferShapeFailed!"}; - (void)Analyzer::GetInstance()->DoAnalyze(analyze_info); - (void)Analyzer::GetInstance()->SaveAnalyzerDataToFile(root_graph->GetSessionID(), - root_graph->GetGraphID()); - - REPORT_CALL_ERROR("E19999", "Call InferShapeAndType for node:%s(%s) failed, input_tensor:%s", - node->GetName().c_str(), node->GetType().c_str(), GetInTensorInfoWithString(node).c_str()); - GELOGE(GE_GRAPH_INFERSHAPE_FAILED, "[Call][InferShapeAndType] for node:%s(%s) failed, input_tensor:%s", - node->GetName().c_str(), node->GetType().c_str(), GetInTensorInfoWithString(node).c_str()); - return GE_GRAPH_INFERSHAPE_FAILED; - } - - GE_CHK_STATUS_RET_NOLOG(RePassLoopNode(node)); - bool need_repass = false; - auto has_attr = AttrUtils::GetBool(node->GetOpDesc(), ATTR_NAME_NEED_INFER_AGAIN, need_repass); - if (has_attr) { - if (!OptionExists(kOptimizeAfterSubGraph)) { - return SUCCESS; - } - if (need_repass) { - AddImmediateRePassNode(node); - GELOGD("Node %s need repass immediately.", node->GetName().c_str()); - } else { - // clear attr on while - node->GetOpDesc()->DelAttr(ATTR_NAME_NEED_INFER_AGAIN); - } - } - return SUCCESS; -} - -Status InferShapePass::RePassLoopNode(const NodePtr &node) { - const auto RePassNode = [&](const std::set &re_pass_types) { - for (auto &n : node->GetOutDataNodes()) { - GE_CHECK_NOTNULL(n); - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(n, node_type), "[Get][OriginalType] of node:%s failed.", n->GetName().c_str()); - if (re_pass_types.count(node_type) > 0) { - AddImmediateRePassNode(n); - (void)AttrUtils::SetBool(n->GetOpDesc(), ATTR_NAME_NEED_INFER_AGAIN, false); - GELOGD("Node %s need repass immediately after %s.", n->GetName().c_str(), node->GetName().c_str()); - } - } - return SUCCESS; - }; - - const auto ExProcNode = [&](const std::set &proc_types, - const std::function &proc_func, - const std::string &info) { - for (auto &n : node->GetOutDataNodes()) { - GE_CHECK_NOTNULL(n); - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(n, node_type), "[Get][OriginalType] of node:%s failed.", n->GetName().c_str()); - if (proc_types.count(node_type) > 0) { - proc_func(this, n); - GELOGD("Node %s %s after %s.", n->GetName().c_str(), info.c_str(), node->GetName().c_str()); - } - } - return SUCCESS; - }; - - std::string node_type; - GE_CHK_STATUS_RET(GetOriginalType(node, node_type), - "[Get][OriginalType] of node:%s failed.", node->GetName().c_str()); - if (kNextIterationOpTypes.count(node_type) > 0) { - return RePassNode(kMergeOpTypes); // Re-Pass Merge - } - - if (kMergeOpTypes.count(node_type) > 0) { - if (node->GetOpDesc()->HasAttr(ATTR_NAME_NEED_INFER_AGAIN)) { - node->GetOpDesc()->DelAttr(ATTR_NAME_NEED_INFER_AGAIN); - return RePassNode(kSwitchOpTypes); // Re-Pass Switch - } - return SUCCESS; - } - - if (kSwitchOpTypes.count(node_type) > 0) { - if (node->GetOpDesc()->HasAttr(ATTR_NAME_NEED_INFER_AGAIN)) { - node->GetOpDesc()->DelAttr(ATTR_NAME_NEED_INFER_AGAIN); - return ExProcNode(kExitOpTypes, &InferShapePass::AddNodeResume, "need resume"); // Resume Exit - } else { - return ExProcNode(kExitOpTypes, &InferShapePass::AddNodeSuspend, "need suspend"); // Suspend Exit - } - } - - return SUCCESS; -} -} // namespace ge +/** + * Copyright 2020-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 "graph/passes/infershape_pass.h" +#include "common/util/error_manager/error_manager.h" +#include "framework/common/debug/ge_log.h" +#include "analyzer/analyzer.h" +#include "framework/common/util.h" +#include "graph/shape_refiner.h" +#include "graph/utils/graph_utils.h" +#include "graph/utils/node_utils.h" +#include "common/omg_util.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/tensor_utils.h" +#include "graph/utils/type_utils.h" + +#include "external/graph/operator_factory.h" + +namespace ge { +namespace { +constexpr int kSwitchExitAnchorIndex = 0; +constexpr int kSwitchPredAnchorIndex = 1; +void SerialShapeRange(const GeTensorDescPtr &desc, std::string &desc_str) { + desc_str += "["; + std::vector> shape_range; + (void)desc->GetShapeRange(shape_range); + for (const auto &pair : shape_range) { + desc_str += "{"; + desc_str += std::to_string(pair.first) + "," + std::to_string(pair.second); + desc_str += "},"; + } + desc_str += "]"; + shape_range.clear(); + (void)desc->GetOriginShapeRange(shape_range); + for (const auto &pair : shape_range) { + desc_str += ",{"; + desc_str += std::to_string(pair.first) + "," + std::to_string(pair.second); + desc_str += "},"; + } +} +void UpdateShapeAndDType(const GeTensorDescPtr &src, GeTensorDescPtr &dst) { + dst->SetOriginShape(src->GetOriginShape()); + dst->SetShape(src->GetShape()); + dst->SetDataType(src->GetDataType()); + dst->SetOriginDataType(src->GetOriginDataType()); + vector> src_shape_range; + src->GetShapeRange(src_shape_range); + dst->SetShapeRange(src_shape_range); + dst->SetOriginShapeRange(src_shape_range); + ge::TensorUtils::SetRealDimCnt(*dst, static_cast(src->GetShape().GetDims().size())); +} +} // namespace + +std::string InferShapePass::SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const { + std::stringstream ss; + ss << "(shape:[" << tensor_desc->MutableShape().ToString() << "]),"; + ss << "(format:" << TypeUtils::FormatToSerialString(tensor_desc->GetFormat()) << "),"; + ss << "(dtype:" << TypeUtils::DataTypeToSerialString(tensor_desc->GetDataType()) << "),"; + ss << "(origin_shape:" << tensor_desc->GetOriginShape().ToString() << "),"; + ss << "(origin_format:" << TypeUtils::FormatToSerialString(tensor_desc->GetOriginFormat()) << "),"; + ss << "(origin_dtype:" << TypeUtils::DataTypeToSerialString(tensor_desc->GetOriginDataType()) << "),"; + string range_str; + SerialShapeRange(tensor_desc, range_str); + ss << "(shape_range:" << range_str << ")"; + return ss.str(); +} +Status InferShapePass::SuspendV1LoopExitNodes(const NodePtr &node) { + if (node->GetType() != SWITCH) { + return SUCCESS; + } + auto pred_node = NodeUtils::GetInDataNodeByIndex(*node, kSwitchPredAnchorIndex); + GE_CHECK_NOTNULL(pred_node); + if (pred_node->GetType() != LOOPCOND) { + return SUCCESS; + } + + for (const auto &anchor_2_node : NodeUtils::GetOutDataNodesWithAnchorByIndex(*node, kSwitchExitAnchorIndex)) { + GELOGI("Found v1 loop when infershape, suspend Exit node %s, type %s.", anchor_2_node.second->GetName().c_str(), + anchor_2_node.second->GetType().c_str()); + auto &suspend_nodes = graphs_2_suspend_nodes_[GetCurrentGraphName()]; + if (suspend_nodes.nodes_set.insert(anchor_2_node.second).second) { + suspend_nodes.nodes.push(anchor_2_node.second); + AddNodeSuspend(anchor_2_node.second); + } + } + return SUCCESS; +} + +Status InferShapePass::Infer(NodePtr &node) { + auto ret = InferShapeAndType(node); + if (ret != GRAPH_SUCCESS) { + auto graph = node->GetOwnerComputeGraph(); + GE_CHECK_NOTNULL(graph); + auto root_graph = ge::GraphUtils::FindRootGraph(graph); + GE_CHECK_NOTNULL(root_graph); + analyzer::DataInfo analyze_info{root_graph->GetSessionID(), root_graph->GetGraphID(), + analyzer::INFER_SHAPE, node, "InferShapeFailed!"}; + (void)Analyzer::GetInstance()->DoAnalyze(analyze_info); + (void)Analyzer::GetInstance()->SaveAnalyzerDataToFile(root_graph->GetSessionID(), + root_graph->GetGraphID()); + REPORT_CALL_ERROR("E19999", "Call InferShapeAndType for node:%s(%s) failed", node->GetName().c_str(), + node->GetType().c_str()); + GELOGE(GE_GRAPH_INFERSHAPE_FAILED, "[Call][InferShapeAndType] for node:%s(%s) failed", node->GetName().c_str(), + node->GetType().c_str()); + return GE_GRAPH_INFERSHAPE_FAILED; + } + return SUCCESS; +} + +graphStatus InferShapePass::InferShapeAndType(NodePtr &node) { + auto ret = SuspendV1LoopExitNodes(node); + if (ret != SUCCESS) { + GELOGE(ret, "Suspend V1 loop exit nodes failed."); + return ret; + } + bool is_unknown_graph = node->GetOwnerComputeGraph()->GetGraphUnknownFlag(); + auto opdesc = node->GetOpDesc(); + if (node->Verify() != GRAPH_SUCCESS) { + REPORT_CALL_ERROR("E19999", "Verifying %s failed.", node->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Call][Verify] Verifying %s failed.", node->GetName().c_str()); + return GRAPH_FAILED; + } + Operator op = OpDescUtils::CreateOperatorFromNode(node); + + if (!is_unknown_graph) { + auto inference_context = ShapeRefiner::CreateInferenceContext(node); + GE_CHECK_NOTNULL(inference_context); + GELOGD("create context for node:%s, marks %zu", node->GetName().c_str(), inference_context->GetMarks().size()); + op.SetInferenceContext(inference_context); + } + + graphStatus status = CallInferShapeFunc(node, op); + if (status != GRAPH_NODE_NEED_REPASS && status != GRAPH_PARAM_INVALID && status != GRAPH_SUCCESS) { + // node like netoutput return param_invalid, but valid ? + return GE_GRAPH_INFERSHAPE_FAILED; + } + UpdateCurNodeOutputDesc(node); + if (!is_unknown_graph) { + auto ctx_after_infer = op.GetInferenceContext(); + if (ctx_after_infer != nullptr) { + GELOGD("[%s] after infershape. mark:%zu", node->GetName().c_str(), ctx_after_infer->GetMarks().size()); + if (!ctx_after_infer->GetOutputHandleShapesAndTypes().empty() || !ctx_after_infer->GetMarks().empty()) { + GELOGD("[%s] set inference context after. mark:%zu", node->GetName().c_str(), + ctx_after_infer->GetMarks().size()); + ShapeRefiner::PushToContextMap(node, ctx_after_infer); + } + } + } + + return (status == GRAPH_NODE_NEED_REPASS) ? GRAPH_NODE_NEED_REPASS : GRAPH_SUCCESS; +} + +void InferShapePass::UpdateCurNodeOutputDesc(NodePtr &node) { + auto op_desc = node->GetOpDesc(); + for (const auto &out_anchor : node->GetAllOutDataAnchors()) { + auto output_tensor = op_desc->MutableOutputDesc(out_anchor->GetIdx()); + GE_IF_BOOL_EXEC(output_tensor == nullptr, continue); + GE_IF_BOOL_EXEC(output_tensor->MutableShape().GetDims().empty(), + output_tensor->SetOriginShape(output_tensor->GetShape())); + + ge::TensorUtils::SetRealDimCnt(*output_tensor, static_cast(output_tensor->GetOriginShape().GetDims() + .size())); + output_tensor->SetOriginDataType(output_tensor->GetDataType()); + // set output origin shape range + std::vector> range; + (void)output_tensor->GetShapeRange(range); + output_tensor->SetOriginShapeRange(range); + GELOGD("node name is %s, origin shape is %ld, origin format is %s, origin data type is %s", + node->GetName().c_str(), output_tensor->GetOriginShape().GetShapeSize(), + TypeUtils::FormatToSerialString(output_tensor->GetOriginFormat()).c_str(), + TypeUtils::DataTypeToSerialString(output_tensor->GetOriginDataType()).c_str()); + } +} + +bool InferShapePass::SameTensorDesc(const GeTensorDescPtr &src, const GeTensorDescPtr &dst) { + // check shape range + vector> src_shape_range; + vector> dst_shape_range; + src->GetShapeRange(src_shape_range); + dst->GetShapeRange(dst_shape_range); + if (src_shape_range.size() != dst_shape_range.size()) { + GELOGI("Src shape range size is %zu, dst shape range size is %zu, not same.", src_shape_range.size(), + dst_shape_range.size()); + return false; + } + for (size_t i = 0; i < src_shape_range.size(); ++i) { + if (src_shape_range[i].first != dst_shape_range[i].first || + src_shape_range[i].second != dst_shape_range[i].second) { + GELOGI("Current dim %zu. Src shape range is [%lu-%lu], dst shape range is [%lu-%lu], not same.", + i, src_shape_range[i].first, src_shape_range[i].second, dst_shape_range[i].first, dst_shape_range[i].second); + return false; + } + } + + // check shape + auto src_shape = src->GetShape(); + auto dst_shape = dst->GetShape(); + if (src_shape.GetDims() != dst_shape.GetDims() || src->GetOriginShape().GetDims() != dst->GetOriginShape().GetDims() || + src->GetDataType() != dst->GetDataType() || src->GetOriginDataType() != dst->GetOriginDataType()) { + GELOGD( + "Src shape is %s, origin_shape is %s, data_type is %s, origin data_type is %s; " + "Dst shape is %s, origin_shape is %s, data_type is %s, original data_type is %s, not same.", + src_shape.ToString().c_str(), src->GetOriginShape().ToString().c_str(), + TypeUtils::DataTypeToSerialString(src->GetDataType()).c_str(), + TypeUtils::DataTypeToSerialString(src->GetOriginDataType()).c_str(), dst_shape.ToString().c_str(), + dst->GetOriginShape().ToString().c_str(), TypeUtils::DataTypeToSerialString(dst->GetDataType()).c_str(), + TypeUtils::DataTypeToSerialString(dst->GetOriginDataType()).c_str()); + return false; + } + return true; +} + +graphStatus InferShapePass::UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) { + changed = !SameTensorDesc(src, dst); + // refresh src itself + src->SetOriginShape(src->GetShape()); + src->SetOriginDataType(src->GetDataType()); + TensorUtils::SetRealDimCnt(*src, static_cast(src->GetOriginShape().GetDims().size())); + vector> src_shape_range; + src->GetShapeRange(src_shape_range); + src->SetOriginShapeRange(src_shape_range); + + if (!changed) { + GELOGD("Peer dst tensor_desc is same as src tensor_desc. No need update."); + return SUCCESS; + } + UpdateShapeAndDType(src, dst); + GELOGD( + "UpdatePeerInputDesc from src Node: shape: [%s], datatype: %s, original datatype is %s." + "To dst Node: shape: [%s], datatype: %s, original datatype is %s.", + src->GetShape().ToString().c_str(), TypeUtils::DataTypeToSerialString(src->GetDataType()).c_str(), + TypeUtils::DataTypeToSerialString(src->GetOriginDataType()).c_str(), dst->GetShape().ToString().c_str(), + TypeUtils::DataTypeToSerialString(dst->GetDataType()).c_str(), + TypeUtils::DataTypeToSerialString(dst->GetOriginDataType()).c_str()); + return SUCCESS; +} + +graphStatus InferShapePass::CallInferShapeFunc(NodePtr &node, Operator &op) { + auto op_desc = node->GetOpDesc(); + const auto &op_type = op_desc->GetType(); + auto ret = op_desc->CallInferFunc(op); + if (ret == GRAPH_PARAM_INVALID) { + // Op ir no infer func, try to get infer func from operator factory + auto node_op = ge::OperatorFactory::CreateOperator("node_op", op_desc->GetType()); + if (node_op.IsEmpty()) { + GELOGW("get op from OperatorFactory fail. opType: %s", op_type.c_str()); + return ret; + } + + GELOGD("get op from OperatorFactory success. opType: %s", op_type.c_str()); + auto temp_op_desc = ge::OpDescUtils::GetOpDescFromOperator(node_op); + node_op.BreakConnect(); + if (temp_op_desc == nullptr) { + REPORT_CALL_ERROR("E19999", "GetOpDescFromOperator failed, return nullptr."); + GELOGE(GRAPH_FAILED, "[Get][OpDesc] temp op desc is null"); + return GRAPH_FAILED; + } + if (!op_desc->UpdateInputName(temp_op_desc->GetAllInputName())) { + GELOGW("InferShapeAndType UpdateInputName failed"); + for (const auto &out_desc : op_desc->GetAllOutputsDescPtr()) { + if (out_desc != nullptr && out_desc->GetShape().GetDims().empty()) { + break; + } + return GRAPH_SUCCESS; + } + } + if (!op_desc->UpdateOutputName(temp_op_desc->GetAllOutputName())) { + GELOGW("InferShapeAndType UpdateOutputName failed"); + } + op_desc->AddInferFunc(temp_op_desc->GetInferFunc()); + ret = op_desc->CallInferFunc(op); + GELOGI("op CallInferFunc second. ret: %u", ret); + } + return ret; +} + +graphStatus InferShapePass::UpdateOutputFromSubgraphs(const std::vector &src, GeTensorDescPtr &dst) { + GELOGD("Enter update parent node shape for class branch op process"); + // check sub_graph shape.If not same ,do unknown shape process + auto ref_out_tensor = src.at(0); + ge::GeShape &ref_out_tensor_shape = ref_out_tensor->MutableShape(); + for (auto &tensor : src) { + if (ref_out_tensor->GetDataType() != tensor->GetDataType()) { + REPORT_INNER_ERROR("E19999", "Does not support diff dtype among all ref output, shape:%s", + ref_out_tensor_shape.ToString().c_str()); + GELOGE(GRAPH_FAILED, "[Check][Param] node does not support diff dtype output"); + return GRAPH_FAILED; + } + auto shape = tensor->MutableShape(); + if (shape.GetDims().size() != ref_out_tensor_shape.GetDims().size()) { + GELOGD("Shape from subgraph size: %lu, ref_out_tensor_shape size: %lu", shape.GetShapeSize(), + ref_out_tensor_shape.GetShapeSize()); + ref_out_tensor_shape = GeShape(UNKNOWN_RANK); + break; + } + for (size_t j = 0; j < ref_out_tensor_shape.GetDims().size(); j++) { + if (ref_out_tensor_shape.GetDim(j) == shape.GetDim(j)) { + continue; + } + GELOGD("j: %zu ,shape from subgraph size: %lu, ref_out_tensor_shape size: %lu", j, shape.GetShapeSize(), + ref_out_tensor_shape.GetShapeSize()); + (void)ref_out_tensor_shape.SetDim(j, UNKNOWN_DIM); + } + } + UpdateShapeAndDType(ref_out_tensor, dst); + return GRAPH_SUCCESS; +} +graphStatus InferShapePass::UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) { + // check sub_graph shape. Get max for update. + if (src.empty()) { + GELOGI("Src subgraph shape is empty."); + return SUCCESS; + } + + int64_t max_size = 0; + size_t max_shape_index = 0; + auto &ref_out_tensor = src.at(0); + for (size_t j = 0; j < src.size(); ++j) { + auto &tensor = src.at(j); + if (ref_out_tensor->GetDataType() != tensor->GetDataType()) { + REPORT_INNER_ERROR("E19999", "node does not support diff dtype among all ref output"); + GELOGE(GRAPH_FAILED, "[Check][Param] node does not support diff dtype among all ref output"); + return GRAPH_FAILED; + } + + auto shape = tensor->MutableShape(); + int64_t size = 1; + for (auto dim : shape.GetDims()) { + if (dim != 0 && INT64_MAX / dim < size) { + REPORT_INNER_ERROR("E19999", "The shape:%s size overflow", shape.ToString().c_str()); + GELOGE(PARAM_INVALID, "[Check][Overflow] The shape size overflow"); + return PARAM_INVALID; + } + size *= dim; + } + + if (size > max_size) { + max_size = size; + max_shape_index = j; + } + } + UpdateShapeAndDType(src.at(max_shape_index), dst); + return GRAPH_SUCCESS; +} +Status InferShapePass::OnSuspendNodesLeaked() { + auto iter = graphs_2_suspend_nodes_.find(GetCurrentGraphName()); + if (iter == graphs_2_suspend_nodes_.end()) { + GELOGI("Current graph %s no suspend node.", GetCurrentGraphName().c_str()); + return SUCCESS; + } + if (!iter->second.nodes.empty()) { + AddNodeResume(iter->second.PopSuspendedNode()); + } + return SUCCESS; +} +} // namespace ge diff --git a/ge/graph/passes/infershape_pass.h b/ge/graph/passes/infershape_pass.h index 9c5d432d..00d90775 100644 --- a/ge/graph/passes/infershape_pass.h +++ b/ge/graph/passes/infershape_pass.h @@ -1,38 +1,56 @@ -/** - * Copyright 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_GRAPH_PASSES_INFERSHAPE_PASS_H_ -#define GE_GRAPH_PASSES_INFERSHAPE_PASS_H_ - -#include "graph/passes/base_pass.h" - -namespace ge { -class InferShapePass : public BaseNodePass { - public: - /// - /// Entry of the InferShapePass optimizer - /// @param [in] graph: Input ComputeGraph - /// @return SUCCESS: Execution succeed - /// @return OTHERS: Execution failed - /// @author - /// - Status Run(ge::NodePtr &node) override; - - private: - Status RePassLoopNode(const NodePtr &node); -}; -} // namespace ge -#endif // GE_GRAPH_PASSES_INFERSHAPE_PASS_H_ +/** + * Copyright 2020-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. + */ + +#ifndef GE_GRAPH_PASSES_INFERSHAPE_PASS_H_ +#define GE_GRAPH_PASSES_INFERSHAPE_PASS_H_ + +#include "graph/passes/infer_base_pass.h" +#include + +namespace ge { +class InferShapePass : public InferBasePass { + public: + std::string SerialTensorInfo(const GeTensorDescPtr &tensor_desc) const override; + graphStatus Infer(NodePtr &node) override; + + graphStatus UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) override; + graphStatus UpdateOutputFromSubgraphs(const std::vector &src, GeTensorDescPtr &dst) override; + graphStatus UpdateOutputFromSubgraphsForMultiDims(const std::vector &src, + GeTensorDescPtr &dst) override; + + Status OnSuspendNodesLeaked() override; + + private: + graphStatus InferShapeAndType(NodePtr &node); + graphStatus CallInferShapeFunc(NodePtr &node, Operator &op); + bool SameTensorDesc(const GeTensorDescPtr &src, const GeTensorDescPtr &dst); + void UpdateCurNodeOutputDesc(NodePtr &node); + Status SuspendV1LoopExitNodes(const NodePtr &node); + struct SuspendNodes { + std::stack nodes; + std::unordered_set nodes_set; + + NodePtr PopSuspendedNode() { + auto top_node = nodes.top(); + nodes.pop(); + nodes_set.erase(top_node); + return top_node; + } + }; + std::map graphs_2_suspend_nodes_; +}; +} // namespace ge +#endif // GE_GRAPH_PASSES_INFERSHAPE_PASS_H_ diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 2efe623e..446af9bf 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1999,6 +1999,22 @@ Status GraphPrepare::CheckUserInput(const std::vector &user_input) { Status GraphPrepare::InferShapeForPreprocess() { GELOGI("Start infershape for preprocess."); + // Prepare dummy_shape for v1 control_flow op before infershape + for (const auto &node : compute_graph_->GetAllNodes()) { + string type; + GetOriginalType(node, type); + if (type == MERGE || type == REFMERGE) { + for (size_t i = 0; i < node->GetAllInDataAnchorsSize(); ++i) { + GELOGD("Prepare for infershape: update %s input_shape as dummy.", node->GetName().c_str()); + NodeUtils::UpdateInputShape(*node, i, GeShape(DUMMY_SHAPE)); + } + } else if (type == WHILE) { + for (size_t i = 0; i < node->GetAllInDataAnchorsSize(); ++i) { + GELOGD("Prepare for infershape: update %s output_shape as dummy.", node->GetName().c_str()); + NodeUtils::UpdateOutputShape(*node, i, GeShape(DUMMY_SHAPE)); + } + } + } GEPass ge_passes(compute_graph_); NamesToPass names_to_passes; AssertPass assert_pass; diff --git a/tests/ut/ge/graph/passes/addn_pass_unittest.cc b/tests/ut/ge/graph/passes/addn_pass_unittest.cc index 6107a7d8..39029e8c 100644 --- a/tests/ut/ge/graph/passes/addn_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/addn_pass_unittest.cc @@ -72,7 +72,7 @@ TEST(UtestGraphPassesAddnPass, null_pass) { AddNPass *addn_pass = nullptr; NamesToPass names_to_pass; names_to_pass.emplace_back("Test", addn_pass); - EXPECT_EQ(pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(pass.Run(names_to_pass), INTERNAL_ERROR); } TEST(UtestGraphPassesAddnPass, null_graph) { diff --git a/tests/ut/ge/graph/passes/base_pass_unittest.cc b/tests/ut/ge/graph/passes/base_pass_unittest.cc index c687e07f..3b0235f5 100644 --- a/tests/ut/ge/graph/passes/base_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/base_pass_unittest.cc @@ -1,523 +1,903 @@ -/** - * 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 -#include -#include -#include - -#include "gtest/gtest.h" - -#define protected public -#include "graph/passes/base_pass.h" -#undef protected - -#include "external/graph/ge_error_codes.h" -#include "framework/common/ge_inner_error_codes.h" -#include "framework/common/types.h" -#include "graph/node.h" -#include "graph/utils/graph_utils.h" -#include "graph_builder_utils.h" - -template class std::unordered_set; - -namespace ge { -class UtestTestPass : public BaseNodePass { - public: - UtestTestPass() = default; - UtestTestPass(bool dead_loop) : dead_loop_(dead_loop), run_times_(0) {} - - Status Run(NodePtr &node) override { - ++run_times_; - iter_nodes_.push_back(node); - auto iter = names_to_add_del_.find(node->GetName()); - if (iter != names_to_add_del_.end()) { - for (const auto &node_name : iter->second) { - auto del_node = node->GetOwnerComputeGraph()->FindNode(node_name); - GraphUtils::IsolateNode(del_node, {0}); - AddNodeDeleted(del_node); - } - } - iter = names_to_add_repass_.find(node->GetName()); - if (iter != names_to_add_repass_.end()) { - auto all_nodes = node->GetOwnerComputeGraph()->GetAllNodes(); - for (const auto &node_name : iter->second) { - for (auto &node_re_pass : all_nodes) { - if (node_re_pass->GetName() == node_name) { - AddRePassNode(node_re_pass); - break; - } - } - } - if (!dead_loop_) { - names_to_add_repass_.erase(iter); - } - } - // simulate infershape pass - if(node->GetType() == WHILE){ - bool need_repass = false; - AttrUtils::GetBool(node->GetOpDesc(),"_need_infer_again", need_repass); - if(!OptionExists(kOptimizeAfterSubGraph)){ - return SUCCESS; - } - if(need_repass){ - AttrUtils::SetBool(node->GetOpDesc(),"_need_infer_again", false); - AddImmediateRePassNode(node); - } - else{ - // clear attr on while - node->GetOpDesc()->DelAttr("_need_infer_again"); - } - } - return SUCCESS; - } - void clear() { iter_nodes_.clear(); } - std::vector GetIterNodes() { return iter_nodes_; } - - void AddRePassNodeName(const std::string &iter_node, const std::string &re_pass_node) { - names_to_add_repass_[iter_node].insert(re_pass_node); - } - void AddDelNodeName(const std::string &iter_node, const std::string &del_node) { - names_to_add_del_[iter_node].insert(del_node); - } - unsigned int GetRunTimes() { return run_times_; } - - private: - std::vector iter_nodes_; - std::map> names_to_add_del_; - std::map> names_to_add_repass_; - bool dead_loop_; - unsigned int run_times_; -}; - -class TestDelPass : public BaseNodePass { - public: - Status Run(NodePtr &node) override { return SUCCESS; } -}; - -class UTESTGraphPassesBasePass : public testing::Test { - protected: - UTESTGraphPassesBasePass() { - auto p1 = new UtestTestPass; - names_to_pass_.push_back(std::make_pair("test1", p1)); - } - void SetUp() override { - for (auto &name_to_pass : names_to_pass_) { - dynamic_cast(name_to_pass.second)->clear(); - } - } - ~UTESTGraphPassesBasePass() override { - for (auto &name_to_pass : names_to_pass_) { - delete name_to_pass.second; - } - } - NamesToPass names_to_pass_; -}; -/// reshape1 -/// | -/// add1 -/// / \. -/// | | -/// data1 const1 -ComputeGraphPtr BuildGraph1() { - auto builder = ut::GraphBuilder("g1"); - auto data = builder.AddNode("data1", DATA, 0, 1); - auto a1 = builder.AddNode("add1", ADD, 2, 1); - auto c1 = builder.AddNode("const1", CONSTANT, 0, 1); - auto r1 = builder.AddNode("reshape1", RESHAPE, 1, 1); - - builder.AddDataEdge(data, 0, a1, 0); - builder.AddDataEdge(c1, 0, a1, 1); - builder.AddDataEdge(a1, 0, r1, 0); - - return builder.GetGraph(); -} - -/// sum1 -/// / \. -/// / \. -/// / \. -/// reshape1 addn1 -/// | c | -/// add1 <--- shape1 -/// / \ | -/// | | | -/// data1 const1 const2 -ComputeGraphPtr BuildGraph2() { - auto builder = ut::GraphBuilder("g1"); - auto data1 = builder.AddNode("data1", DATA, 0, 1); - auto const1 = builder.AddNode("const1", CONSTANT, 0, 1); - auto const2 = builder.AddNode("const2", CONSTANT, 0, 1); - auto add1 = builder.AddNode("add1", ADD, 2, 1); - auto shape1 = builder.AddNode("shape1", SHAPE, 1, 1); - auto reshape1 = builder.AddNode("reshape1", RESHAPE, 1, 1); - auto addn1 = builder.AddNode("addn1", ADDN, 1, 1); - auto sum1 = builder.AddNode("sum1", SUM, 2, 1); - - builder.AddDataEdge(data1, 0, add1, 0); - builder.AddDataEdge(const1, 0, add1, 1); - builder.AddDataEdge(const2, 0, shape1, 0); - builder.AddControlEdge(shape1, add1); - builder.AddDataEdge(add1, 0, reshape1, 0); - builder.AddDataEdge(shape1, 0, addn1, 0); - builder.AddDataEdge(reshape1, 0, sum1, 0); - builder.AddDataEdge(addn1, 0, sum1, 1); - - return builder.GetGraph(); -} - -/// rnextiteration -/// | | -/// merge -/// | -/// data1 -ComputeGraphPtr BuildGraph3() { - auto builder = ut::GraphBuilder("g1"); - auto data1 = builder.AddNode("data1", DATA, 0, 1); - auto merge1 = builder.AddNode("merge1", MERGE, 2, 1); - auto next1 = builder.AddNode("next1", NEXTITERATION, 1, 1); - - builder.AddDataEdge(data1, 0, merge1, 0); - builder.AddDataEdge(merge1, 0, next1, 0); - builder.AddDataEdge(next1, 0, merge1, 1); - builder.AddControlEdge(merge1, next1); - builder.AddControlEdge(next1, merge1); - - return builder.GetGraph(); -} - -void CheckIterOrder(UtestTestPass *pass, std::vector> &nodes_layers) { - std::unordered_set layer_nodes; - size_t layer_index = 0; - for (const auto &node : pass->GetIterNodes()) { - layer_nodes.insert(node->GetName()); - EXPECT_LT(layer_index, nodes_layers.size()); - if (layer_nodes == nodes_layers[layer_index]) { - layer_index++; - layer_nodes.clear(); - } - } - EXPECT_EQ(layer_index, nodes_layers.size()); -} - -/// Op1 -/// | -/// Merge -/// / \. -/// Op2 Op3 -TEST_F(UTESTGraphPassesBasePass, del_isolate_fail) { - auto builder = ut::GraphBuilder("g1"); - auto merge_node = builder.AddNode("Merge", MERGE, 1, 1); - auto node1 = builder.AddNode("Op1", RELU, 1, 1); - auto node2 = builder.AddNode("Op2", CONVOLUTION, 1, 1); - auto node3 = builder.AddNode("Op3", CONVOLUTION, 1, 1); - - GraphUtils::AddEdge(node1->GetOutDataAnchor(0), merge_node->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node2->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node3->GetInDataAnchor(0)); - - EXPECT_EQ(node1->GetOutDataNodes().size(), 1); - - TestDelPass del_pass; - auto ret = del_pass.IsolateAndDeleteNode(merge_node, {0, -1}); - EXPECT_EQ(ret, FAILED); - - OpDescPtr op_desc = std::make_shared("merge", MERGE); - NodePtr node = shared_ptr(new (std::nothrow) Node(op_desc, nullptr)); - ret = del_pass.IsolateAndDeleteNode(node, {0, -1}); - EXPECT_EQ(ret, FAILED); -} - -/// Op1 -/// | -/// Merge -/// / \. -/// Op2 Op3 -TEST_F(UTESTGraphPassesBasePass, del_isolate_success) { - auto builder = ut::GraphBuilder("g1"); - auto merge_node = builder.AddNode("Merge", MERGE, 1, 2); - auto node1 = builder.AddNode("Op1", RELU, 1, 1); - auto node2 = builder.AddNode("Op2", CONVOLUTION, 1, 1); - auto node3 = builder.AddNode("Op3", CONVOLUTION, 1, 1); - - GraphUtils::AddEdge(node1->GetOutDataAnchor(0), merge_node->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node2->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node3->GetInDataAnchor(0)); - - EXPECT_EQ(node1->GetOutDataNodes().size(), 1); - - TestDelPass del_pass; - auto ret = del_pass.IsolateAndDeleteNode(merge_node, {0, -1}); - EXPECT_EQ(ret, SUCCESS); -} - -TEST_F(UTESTGraphPassesBasePass, data_graph) { - auto graph = BuildGraph1(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); - auto *pass = dynamic_cast(names_to_pass_[0].second); - - EXPECT_EQ(pass->GetIterNodes().size(), 4); - std::vector> layers; - layers.push_back({"data1", "const1"}); - layers.push_back({"add1"}); - layers.push_back({"reshape1"}); - CheckIterOrder(pass, layers); -} - -TEST_F(UTESTGraphPassesBasePass, graph_with_control_link) { - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); - auto *pass = dynamic_cast(names_to_pass_[0].second); - - EXPECT_EQ(pass->GetIterNodes().size(), 8); - EXPECT_EQ(pass->GetIterNodes().at(3)->GetName(), "shape1"); - - std::vector> layers; - layers.push_back({"data1", "const1", "const2"}); - layers.push_back({"shape1"}); - layers.push_back({"add1", "addn1", "reshape1"}); - layers.push_back({"sum1"}); - CheckIterOrder(pass, layers); -} - -TEST_F(UTESTGraphPassesBasePass, re_pass_after) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddRePassNodeName("add1", "sum1"); - test_pass.AddRePassNodeName("shape1", "sum1"); - test_pass.AddRePassNodeName("shape1", "add1"); - test_pass.AddRePassNodeName("data1", "add1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 8); -} - -TEST_F(UTESTGraphPassesBasePass, re_pass_before) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddRePassNodeName("add1", "data1"); - - auto graph = BuildGraph1(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 5); - EXPECT_EQ(test_pass.GetIterNodes().at(2)->GetName(), "add1"); - EXPECT_EQ(test_pass.GetIterNodes().at(3)->GetName(), "reshape1"); - EXPECT_EQ(test_pass.GetIterNodes().at(4)->GetName(), "data1"); -} - -TEST_F(UTESTGraphPassesBasePass, re_pass_before_multi_times) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddRePassNodeName("add1", "data1"); - test_pass.AddRePassNodeName("add1", "const1"); - test_pass.AddRePassNodeName("reshape1", "data1"); - - auto graph = BuildGraph1(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 6); - EXPECT_EQ(test_pass.GetIterNodes().at(2)->GetName(), "add1"); - EXPECT_EQ(test_pass.GetIterNodes().at(3)->GetName(), "reshape1"); -} - -TEST_F(UTESTGraphPassesBasePass, del_after) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddDelNodeName("add1", "sum1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 7); -} - -TEST_F(UTESTGraphPassesBasePass, del_after_multiple) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddDelNodeName("add1", "sum1"); - test_pass.AddDelNodeName("add1", "reshape1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 6); -} - -TEST_F(UTESTGraphPassesBasePass, del_after_break_link) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddDelNodeName("shape1", "add1"); - test_pass.AddDelNodeName("shape1", "addn1"); - test_pass.AddRePassNodeName("shape1", "shape1"); - test_pass.AddRePassNodeName("shape1", "reshape1"); - test_pass.AddRePassNodeName("shape1", "sum1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 7); -} - -TEST_F(UTESTGraphPassesBasePass, del_self_and_after) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddDelNodeName("shape1", "add1"); - test_pass.AddDelNodeName("shape1", "addn1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 4); -} - -TEST_F(UTESTGraphPassesBasePass, del_before) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddDelNodeName("reshape1", "add1"); - test_pass.AddDelNodeName("sum1", "addn1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 8); -} - -TEST_F(UTESTGraphPassesBasePass, re_pass_and_del) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddRePassNodeName("add1", "sum1"); - test_pass.AddDelNodeName("reshape1", "sum1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetIterNodes().size(), 7); -} -/* -TEST_F(UTESTGraphPassesBasePass, dead_loop) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(true); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - test_pass.AddRePassNodeName("add1", "sum1"); - test_pass.AddRePassNodeName("sum1", "add1"); - - auto graph = BuildGraph2(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); - EXPECT_EQ(test_pass.GetRunTimes(), 1007); -} -*/ - -TEST_F(UTESTGraphPassesBasePass, while_loop) { - NamesToPass names_to_pass; - auto test_pass = UtestTestPass(true); - names_to_pass.push_back(std::make_pair("test", &test_pass)); - - auto graph = BuildGraph3(); - auto ge_pass = GEPass(graph); - EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); -} - -/// data1 const -/// \ / -/// while -/// / \. -/// | | -/// cast1 cast2 -ComputeGraphPtr BuildWhileGraph1() { - // build sub graph - auto builder_sub = ut::GraphBuilder("sub"); - auto data_1 = builder_sub.AddNode("data_1", DATA, 0, 1); - auto data_2 = builder_sub.AddNode("data_2", DATA, 0, 1); - auto add = builder_sub.AddNode("add", ADD, 2, 1); - - builder_sub.AddDataEdge(data_1, 0, add, 0); - builder_sub.AddDataEdge(data_2, 0, add, 1); - auto sub_graph = builder_sub.GetGraph(); - sub_graph->SetName("while_sub"); - // build root graph - auto builder = ut::GraphBuilder("g1"); - auto data = builder.AddNode("data1", DATA, 0, 1); - auto const_op = builder.AddNode("const_op", CONSTANT, 0, 1); - auto c1 = builder.AddNode("cast1", CAST, 1, 1); - auto c2 = builder.AddNode("cast2", CAST, 1, 1); - // add while op - auto tensor_desc = std::make_shared(); - tensor_desc->SetShape(GeShape({1,1,1,1})); - tensor_desc->SetFormat(FORMAT_ND); - tensor_desc->SetDataType(DT_INT32); - - auto op_desc = std::make_shared("while", WHILE); - for (int i = 0; i < 2; ++i) { - op_desc->AddInputDesc(tensor_desc->Clone()); - } - for (int i = 0; i < 2; ++i) { - op_desc->AddOutputDesc(tensor_desc->Clone()); - } - AttrUtils::SetBool(op_desc,"_need_infer_again", true); - op_desc->AddSubgraphName(sub_graph->GetName()); - op_desc->SetSubgraphInstanceName(0,sub_graph->GetName()); - auto root_graph = builder.GetGraph(); - auto while_op = root_graph->AddNode(op_desc); - - builder.AddDataEdge(data, 0, while_op, 0); - builder.AddDataEdge(const_op, 0, while_op, 1); - builder.AddDataEdge(while_op, 0, c1, 0); - builder.AddDataEdge(while_op, 1, c2, 0); - sub_graph->SetParentGraph(root_graph); - sub_graph->SetParentNode(while_op); - root_graph->AddSubgraph(sub_graph); - return root_graph; -} - -TEST_F(UTESTGraphPassesBasePass, while_infershape) { -NamesToPass names_to_pass; -auto test_pass = UtestTestPass(); -names_to_pass.push_back(std::make_pair("test", &test_pass)); - -auto graph = BuildWhileGraph1(); -auto ge_pass = GEPass(graph); -auto while_node = graph->FindNode("while"); -EXPECT_EQ(while_node->GetOpDesc()->GetSubgraphInstanceNames().size(),1); -EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); -} - -} // namespace ge +/** + * 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 +#include +#include + +#include "gtest/gtest.h" + +#define protected public +#include "graph/passes/base_pass.h" +#undef protected + +#include "framework/common/types.h" +#include "graph/node.h" +#include "graph/utils/graph_utils.h" +#include "graph_builder_utils.h" + +template class std::unordered_set; + +namespace ge { +class UtestTestPass : public BaseNodePass { + public: + UtestTestPass() = default; + UtestTestPass(bool dead_loop) : dead_loop_(dead_loop), run_times_(0) {} + + Status Run(NodePtr &node) override { + ++run_times_; + iter_nodes_.push_back(node); + auto iter = names_to_add_del_.find(node->GetName()); + if (iter != names_to_add_del_.end()) { + for (const auto &node_name : iter->second) { + auto del_node = node->GetOwnerComputeGraph()->FindNode(node_name); + GraphUtils::IsolateNode(del_node, {0}); + AddNodeDeleted(del_node); + } + } + iter = names_to_add_repass_.find(node->GetName()); + if (iter != names_to_add_repass_.end()) { + auto all_nodes = node->GetOwnerComputeGraph()->GetAllNodes(); + for (const auto &node_name : iter->second) { + for (auto &node_re_pass : all_nodes) { + if (node_re_pass->GetName() == node_name) { + AddRePassNode(node_re_pass); + break; + } + } + } + if (!dead_loop_) { + names_to_add_repass_.erase(iter); + } + } + + iter = names_to_add_repass_immediate_.find(node->GetName()); + if (iter != names_to_add_repass_immediate_.end()) { + auto all_nodes = node->GetOwnerComputeGraph()->GetAllNodes(); + for (const auto &node_name : iter->second) { + for (auto &node_re_pass : all_nodes) { + if (node_re_pass->GetName() == node_name) { + AddImmediateRePassNode(node_re_pass); + break; + } + } + } + if (!dead_loop_) { + names_to_add_repass_immediate_.erase(iter); + } + } + + iter = names_to_add_suspend_.find(node->GetName()); + if (iter != names_to_add_suspend_.end()) { + auto all_nodes = node->GetOwnerComputeGraph()->GetAllNodes(); + for (const auto &node_name : iter->second) { + for (auto &node_re_pass : all_nodes) { + if (node_re_pass->GetName() == node_name) { + AddNodeSuspend(node_re_pass); + break; + } + } + } + if (!dead_loop_) { + names_to_add_suspend_.erase(iter); + } + } + + iter = names_to_add_resume_.find(node->GetName()); + if (iter != names_to_add_resume_.end()) { + auto all_nodes = node->GetOwnerComputeGraph()->GetAllNodes(); + for (const auto &node_name : iter->second) { + for (auto &node_re_pass : all_nodes) { + if (node_re_pass->GetName() == node_name) { + AddNodeResume(node_re_pass); + break; + } + } + } + if (!dead_loop_) { + names_to_add_resume_.erase(iter); + } + } + // simulate infershape pass + if(node->GetType() == WHILE){ + bool need_repass = false; + AttrUtils::GetBool(node->GetOpDesc(),"_need_infer_again", need_repass); + if(!OptionExists(kOptimizeAfterSubGraph)){ + return SUCCESS; + } + if(need_repass){ + AttrUtils::SetBool(node->GetOpDesc(),"_need_infer_again", false); + AddImmediateRePassNode(node); + } + else{ + // clear attr on while + node->GetOpDesc()->DelAttr("_need_infer_again"); + } + } + return SUCCESS; + } + + Status OnSuspendNodesLeaked() override { + // resume all node remain in suspend_nodes when leaked + auto compute_graph = (iter_nodes_.size() > 0) ? iter_nodes_[0]->GetOwnerComputeGraph() : nullptr; + if (compute_graph == nullptr) { + return SUCCESS; + } + + for (const auto &node_name : names_to_add_resume_onleaked_) { + auto node_to_resume = compute_graph->FindNode(node_name); + AddNodeResume(node_to_resume); + } + return SUCCESS; + } + void clear() { iter_nodes_.clear(); } + std::vector GetIterNodes() { return iter_nodes_; } + + void AddRePassNodeName(const std::string &iter_node, const std::string &re_pass_node) { + names_to_add_repass_[iter_node].insert(re_pass_node); + } + void AddDelNodeName(const std::string &iter_node, const std::string &del_node) { + names_to_add_del_[iter_node].insert(del_node); + } + void AddRePassImmediateNodeName(const std::string &iter_node, const std::string &re_pass_node) { + names_to_add_repass_immediate_[iter_node].insert(re_pass_node); + } + + void AddSuspendNodeName(const std::string &iter_node, const std::string &suspend_node) { + names_to_add_suspend_[iter_node].insert(suspend_node); + } + void AddResumeNodeName(const std::string &iter_node, const std::string &resume_node) { + names_to_add_resume_[iter_node].insert(resume_node); + } + void AddResumeNodeNameOnLeaked(const std::string &resume_node) { + names_to_add_resume_onleaked_.insert(resume_node); + } + + unsigned int GetRunTimes() { return run_times_; } + + private: + std::vector iter_nodes_; + std::map> names_to_add_del_; + std::map> names_to_add_repass_; + std::map> names_to_add_repass_immediate_; + std::map> names_to_add_suspend_; + std::map> names_to_add_resume_; + std::unordered_set names_to_add_resume_onleaked_; + + bool dead_loop_; + unsigned int run_times_; +}; + +class TestDelPass : public BaseNodePass { + public: + Status Run(NodePtr &node) override { return SUCCESS; } +}; + +class UTESTGraphPassesBasePass : public testing::Test { + protected: + UTESTGraphPassesBasePass() { + auto p1 = new UtestTestPass; + names_to_pass_.push_back(std::make_pair("test1", p1)); + } + void SetUp() override { + for (auto &name_to_pass : names_to_pass_) { + dynamic_cast(name_to_pass.second)->clear(); + } + } + ~UTESTGraphPassesBasePass() override { + for (auto &name_to_pass : names_to_pass_) { + delete name_to_pass.second; + } + } + NamesToPass names_to_pass_; +}; +/// reshape1 +/// | +/// add1 +/// / \. +/// | | +/// data1 const1 +ComputeGraphPtr BuildGraph1() { + auto builder = ut::GraphBuilder("g1"); + auto data = builder.AddNode("data1", DATA, 0, 1); + auto a1 = builder.AddNode("add1", ADD, 2, 1); + auto c1 = builder.AddNode("const1", CONSTANT, 0, 1); + auto r1 = builder.AddNode("reshape1", RESHAPE, 1, 1); + + builder.AddDataEdge(data, 0, a1, 0); + builder.AddDataEdge(c1, 0, a1, 1); + builder.AddDataEdge(a1, 0, r1, 0); + + return builder.GetGraph(); +} + +/// sum1 +/// / \. +/// / \. +/// / \. +/// reshape1 addn1 +/// | c | +/// add1 <--- shape1 +/// / \ | +/// | | | +/// data1 const1 const2 +ComputeGraphPtr BuildGraph2() { + auto builder = ut::GraphBuilder("g1"); + auto data1 = builder.AddNode("data1", DATA, 0, 1); + auto const1 = builder.AddNode("const1", CONSTANT, 0, 1); + auto const2 = builder.AddNode("const2", CONSTANT, 0, 1); + auto add1 = builder.AddNode("add1", ADD, 2, 1); + auto shape1 = builder.AddNode("shape1", SHAPE, 1, 1); + auto reshape1 = builder.AddNode("reshape1", RESHAPE, 1, 1); + auto addn1 = builder.AddNode("addn1", ADDN, 1, 1); + auto sum1 = builder.AddNode("sum1", SUM, 2, 1); + + builder.AddDataEdge(data1, 0, add1, 0); + builder.AddDataEdge(const1, 0, add1, 1); + builder.AddDataEdge(const2, 0, shape1, 0); + builder.AddControlEdge(shape1, add1); + builder.AddDataEdge(add1, 0, reshape1, 0); + builder.AddDataEdge(shape1, 0, addn1, 0); + builder.AddDataEdge(reshape1, 0, sum1, 0); + builder.AddDataEdge(addn1, 0, sum1, 1); + + return builder.GetGraph(); +} + +/// rnextiteration +/// | | +/// merge +/// | +/// data1 +ComputeGraphPtr BuildGraph3() { + auto builder = ut::GraphBuilder("g1"); + auto data1 = builder.AddNode("data1", DATA, 0, 1); + auto merge1 = builder.AddNode("merge1", MERGE, 2, 1); + auto next1 = builder.AddNode("next1", NEXTITERATION, 1, 1); + + builder.AddDataEdge(data1, 0, merge1, 0); + builder.AddDataEdge(merge1, 0, next1, 0); + builder.AddDataEdge(next1, 0, merge1, 1); + builder.AddControlEdge(merge1, next1); + builder.AddControlEdge(next1, merge1); + + return builder.GetGraph(); +} + +/// cast1--shape1 +/// / +/// data1 +/// \ +/// transdata1--shape2 +ComputeGraphPtr BuildGraph4() { + auto builder = ut::GraphBuilder("g1"); + auto data1 = builder.AddNode("data1", DATA, 0, 1); + auto cast1 = builder.AddNode("cast1", CAST, 1, 1); + auto shape1 = builder.AddNode("shape1", SHAPE, 1, 1); + auto transdata1 = builder.AddNode("transdata1", TRANSDATA, 1, 1); + auto shape2 = builder.AddNode("shape2", SHAPE, 1, 1); + + builder.AddDataEdge(data1, 0, cast1, 0); + builder.AddDataEdge(data1, 0, transdata1, 0); + builder.AddDataEdge(cast1, 0, shape1, 0); + builder.AddDataEdge(transdata1, 0, shape2, 0); + return builder.GetGraph(); +} + +void CheckIterOrder(UtestTestPass *pass, std::vector> &nodes_layers) { + std::unordered_set layer_nodes; + size_t layer_index = 0; + for (const auto &node : pass->GetIterNodes()) { + layer_nodes.insert(node->GetName()); + EXPECT_LT(layer_index, nodes_layers.size()); + if (layer_nodes == nodes_layers[layer_index]) { + layer_index++; + layer_nodes.clear(); + } + } + EXPECT_EQ(layer_index, nodes_layers.size()); +} + +/// Op1 +/// | +/// Merge +/// / \. +/// Op2 Op3 +TEST_F(UTESTGraphPassesBasePass, del_isolate_fail) { + auto builder = ut::GraphBuilder("g1"); + auto merge_node = builder.AddNode("Merge", MERGE, 1, 1); + auto node1 = builder.AddNode("Op1", RELU, 1, 1); + auto node2 = builder.AddNode("Op2", CONVOLUTION, 1, 1); + auto node3 = builder.AddNode("Op3", CONVOLUTION, 1, 1); + + GraphUtils::AddEdge(node1->GetOutDataAnchor(0), merge_node->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node2->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node3->GetInDataAnchor(0)); + + EXPECT_EQ(node1->GetOutDataNodes().size(), 1); + + TestDelPass del_pass; + auto ret = del_pass.IsolateAndDeleteNode(merge_node, {0, -1}); + EXPECT_EQ(ret, FAILED); + + OpDescPtr op_desc = std::make_shared("merge", MERGE); + NodePtr node = shared_ptr(new (std::nothrow) Node(op_desc, nullptr)); + ret = del_pass.IsolateAndDeleteNode(node, {0, -1}); + EXPECT_EQ(ret, FAILED); +} + +/// Op1 +/// | +/// Merge +/// / \. +/// Op2 Op3 +TEST_F(UTESTGraphPassesBasePass, del_isolate_success) { + auto builder = ut::GraphBuilder("g1"); + auto merge_node = builder.AddNode("Merge", MERGE, 1, 2); + auto node1 = builder.AddNode("Op1", RELU, 1, 1); + auto node2 = builder.AddNode("Op2", CONVOLUTION, 1, 1); + auto node3 = builder.AddNode("Op3", CONVOLUTION, 1, 1); + + GraphUtils::AddEdge(node1->GetOutDataAnchor(0), merge_node->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node2->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge_node->GetOutDataAnchor(0), node3->GetInDataAnchor(0)); + + EXPECT_EQ(node1->GetOutDataNodes().size(), 1); + + TestDelPass del_pass; + auto ret = del_pass.IsolateAndDeleteNode(merge_node, {0, -1}); + EXPECT_EQ(ret, SUCCESS); +} + +TEST_F(UTESTGraphPassesBasePass, data_graph) { + auto graph = BuildGraph1(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + auto *pass = dynamic_cast(names_to_pass_[0].second); + + EXPECT_EQ(pass->GetIterNodes().size(), 4); + std::vector> layers; + layers.push_back({"data1", "const1"}); + layers.push_back({"add1"}); + layers.push_back({"reshape1"}); + CheckIterOrder(pass, layers); +} + +TEST_F(UTESTGraphPassesBasePass, graph_with_control_link) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + auto *pass = dynamic_cast(names_to_pass_[0].second); + + EXPECT_EQ(pass->GetIterNodes().size(), 8); + EXPECT_EQ(pass->GetIterNodes().at(3)->GetName(), "shape1"); + + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1", "reshape1"}); + layers.push_back({"sum1"}); + CheckIterOrder(pass, layers); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_after) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddRePassNodeName("add1", "sum1"); + test_pass.AddRePassNodeName("shape1", "sum1"); + test_pass.AddRePassNodeName("shape1", "add1"); + test_pass.AddRePassNodeName("data1", "add1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 8); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_before) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddRePassNodeName("add1", "data1"); + + auto graph = BuildGraph1(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 5); + EXPECT_EQ(test_pass.GetIterNodes().at(2)->GetName(), "add1"); + EXPECT_EQ(test_pass.GetIterNodes().at(3)->GetName(), "reshape1"); + EXPECT_EQ(test_pass.GetIterNodes().at(4)->GetName(), "data1"); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_before_multi_times) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddRePassNodeName("add1", "data1"); + test_pass.AddRePassNodeName("add1", "const1"); + test_pass.AddRePassNodeName("reshape1", "data1"); + + auto graph = BuildGraph1(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 6); + EXPECT_EQ(test_pass.GetIterNodes().at(2)->GetName(), "add1"); + EXPECT_EQ(test_pass.GetIterNodes().at(3)->GetName(), "reshape1"); +} + +TEST_F(UTESTGraphPassesBasePass, del_after) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddDelNodeName("add1", "sum1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 7); +} + +TEST_F(UTESTGraphPassesBasePass, del_after_multiple) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddDelNodeName("add1", "sum1"); + test_pass.AddDelNodeName("add1", "reshape1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 6); +} + +TEST_F(UTESTGraphPassesBasePass, del_after_break_link) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddDelNodeName("shape1", "add1"); + test_pass.AddDelNodeName("shape1", "addn1"); + test_pass.AddRePassNodeName("shape1", "shape1"); + test_pass.AddRePassNodeName("shape1", "reshape1"); + test_pass.AddRePassNodeName("shape1", "sum1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 7); +} + +TEST_F(UTESTGraphPassesBasePass, del_self_and_after) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddDelNodeName("shape1", "add1"); + test_pass.AddDelNodeName("shape1", "addn1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 6); +} + +TEST_F(UTESTGraphPassesBasePass, del_before) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddDelNodeName("reshape1", "add1"); + test_pass.AddDelNodeName("sum1", "addn1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 8); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_and_del) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddRePassNodeName("add1", "sum1"); + test_pass.AddDelNodeName("reshape1", "sum1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 7); +} +/* +TEST_F(UTESTGraphPassesBasePass, dead_loop) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(true); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + test_pass.AddRePassNodeName("add1", "sum1"); + test_pass.AddRePassNodeName("sum1", "add1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetRunTimes(), 1007); +} +*/ + +TEST_F(UTESTGraphPassesBasePass, while_loop) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(true); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + auto graph = BuildGraph3(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); +} + +/// data1 const +/// \ / +/// while +/// / \. +/// | | +/// cast1 cast2 +ComputeGraphPtr BuildWhileGraph1() { + // build sub graph + auto builder_sub = ut::GraphBuilder("sub"); + auto data_1 = builder_sub.AddNode("data_1", DATA, 0, 1); + auto data_2 = builder_sub.AddNode("data_2", DATA, 0, 1); + auto add = builder_sub.AddNode("add", ADD, 2, 1); + + builder_sub.AddDataEdge(data_1, 0, add, 0); + builder_sub.AddDataEdge(data_2, 0, add, 1); + auto sub_graph = builder_sub.GetGraph(); + sub_graph->SetName("while_sub"); + // build root graph + auto builder = ut::GraphBuilder("g1"); + auto data = builder.AddNode("data1", DATA, 0, 1); + auto const_op = builder.AddNode("const_op", CONSTANT, 0, 1); + auto c1 = builder.AddNode("cast1", CAST, 1, 1); + auto c2 = builder.AddNode("cast2", CAST, 1, 1); + // add while op + auto tensor_desc = std::make_shared(); + tensor_desc->SetShape(GeShape({1,1,1,1})); + tensor_desc->SetFormat(FORMAT_ND); + tensor_desc->SetDataType(DT_INT32); + + auto op_desc = std::make_shared("while", WHILE); + for (int i = 0; i < 2; ++i) { + op_desc->AddInputDesc(tensor_desc->Clone()); + } + for (int i = 0; i < 2; ++i) { + op_desc->AddOutputDesc(tensor_desc->Clone()); + } + AttrUtils::SetBool(op_desc,"_need_infer_again", true); + op_desc->AddSubgraphName(sub_graph->GetName()); + op_desc->SetSubgraphInstanceName(0,sub_graph->GetName()); + auto root_graph = builder.GetGraph(); + auto while_op = root_graph->AddNode(op_desc); + + builder.AddDataEdge(data, 0, while_op, 0); + builder.AddDataEdge(const_op, 0, while_op, 1); + builder.AddDataEdge(while_op, 0, c1, 0); + builder.AddDataEdge(while_op, 1, c2, 0); + sub_graph->SetParentGraph(root_graph); + sub_graph->SetParentNode(while_op); + root_graph->AddSubgraph(sub_graph); + return root_graph; +} + +TEST_F(UTESTGraphPassesBasePass, while_infershape) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + auto graph = BuildWhileGraph1(); + auto ge_pass = GEPass(graph); + auto while_node = graph->FindNode("while"); + EXPECT_EQ(while_node->GetOpDesc()->GetSubgraphInstanceNames().size(),1); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_pre_node_immediately) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // repass pre_node immediately + test_pass->AddRePassImmediateNodeName("reshape1", "add1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + + EXPECT_EQ(test_pass->GetIterNodes().size(), 9);// todo + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "add1", "sum1"}); + CheckIterOrder(test_pass, layers); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_cur_node_immediately) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // repass cur_node immediately + test_pass->AddRePassImmediateNodeName("reshape1", "reshape1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + + EXPECT_EQ(test_pass->GetIterNodes().size(), 9); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1"}); + layers.push_back({"reshape1", "sum1"}); + CheckIterOrder(test_pass, layers); +} + +TEST_F(UTESTGraphPassesBasePass, re_pass_next_node_immediately) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // repass next_node immediately + test_pass->AddRePassImmediateNodeName("reshape1", "sum1"); + // repass node after next_node immediately + test_pass->AddRePassImmediateNodeName("add1", "sum1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + + EXPECT_EQ(test_pass->GetIterNodes().size(), 8); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1"}); + CheckIterOrder(test_pass, layers); +} +/** + * A->B->C + * if node B suspend its pre_node A, and C resume A, it is a useless operation, so iter_order should follow normal order + * when C resuem A, A will pass again. + */ +TEST_F(UTESTGraphPassesBasePass, B_suspend_pre_node_A_then_C_resume_A) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // add1->reshape1->sum1 + test_pass->AddSuspendNodeName("reshape1", "add1"); + test_pass->AddResumeNodeName("sum1", "add1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 9); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1"}); + layers.push_back({"add1"}); + CheckIterOrder(test_pass, layers); +} + +/** + * A->B->C + * if node B suspend its pre_node A, and B resume A, it is a useless operation, so iter_order should follow normal order + * when B resuem A, A will pass again. + */ +TEST_F(UTESTGraphPassesBasePass, B_suspend_pre_node_A_then_B_resume_A) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // add1->reshape1->sum1 + test_pass->AddSuspendNodeName("reshape1", "add1"); + test_pass->AddResumeNodeName("reshape1", "add1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 9); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1", "add1"}); + CheckIterOrder(test_pass, layers); +} + +/** + * A->B->C + * if node B resume C(which is not suspended), it is a useless operation, C will not pass. + */ +TEST_F(UTESTGraphPassesBasePass, B_resume_node_not_suspended) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // add1->reshape1->sum1 + test_pass->AddResumeNodeName("reshape1", "sum1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 8); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1"}); + CheckIterOrder(test_pass, layers); +} + +/** + * A->B->C + * if node B suspend its pre_node A, it is a useless operation, so iter_order should follow normal order + * because nobody resume it ,which means A is a leaked node, so return fail + */ +TEST_F(UTESTGraphPassesBasePass, suspend_pre_node_nobody_resume_it_return_failed) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + // suspend pre_node immediately + test_pass.AddSuspendNodeName("reshape1", "add1"); + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), INTERNAL_ERROR); +} + +/** + * A->B->C + * if node B suspend its pre_node A, it is a useless operation, + * so iter_order should follow normal order + * resume A on leaked, which means A will pass again + */ +TEST_F(UTESTGraphPassesBasePass, suspend_pre_node_resume_it_onleaked) { + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("reshape1", "add1"); + test_pass->AddResumeNodeNameOnLeaked("add1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1"}); + layers.push_back({"add1"}); + CheckIterOrder(test_pass, layers); +} + + +/// cast1--shape1 +/// / +/// data1 +/// \ +/// transdata1--shape2 +/** + * suspend cur node + * cast1 suspend itself, shape2 resume cast1 + * iter order follows : data1; cast1,transdata1; shape2; cast1 ; shape1 + */ +TEST_F(UTESTGraphPassesBasePass, cast1_suspend_cur_node_shape2_resume_cast1) { + auto graph = BuildGraph4(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("cast1", "cast1"); + test_pass->AddResumeNodeName("shape2", "cast1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 6); + std::vector> layers; + layers.push_back({"data1"}); + layers.push_back({"cast1","transdata1"}); + layers.push_back({"shape2"}); + layers.push_back({"cast1", "shape1"}); + CheckIterOrder(test_pass, layers); +} +/** + * suspend cur node + * cast1 suspend itself, then resume cast1 + * iter order follows : data1; cast1,cast1,transdata1; shape2; shape1. + */ +TEST_F(UTESTGraphPassesBasePass, cast1_suspend_itslef_then_resume_itself) { + auto graph = BuildGraph4(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("cast1", "cast1"); + test_pass->AddResumeNodeName("cast1", "cast1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 6); + std::vector> layers; + layers.push_back({"data1"}); + layers.push_back({"cast1","transdata1","cast1","shape1", "shape2"}); + CheckIterOrder(test_pass, layers); +} +/** + * suspend cur node + * cast1 suspend itself, then resume cast1 on leaked + * iter order follows : data1; cast1,cast1,transdata1; shape2; shape1. + */ +TEST_F(UTESTGraphPassesBasePass, cast1_suspend_itslef_then_resume_onleaked) { + auto graph = BuildGraph4(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("cast1", "cast1"); + test_pass->AddResumeNodeNameOnLeaked("cast1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 6); + std::vector> layers; + layers.push_back({"data1"}); + layers.push_back({"cast1","transdata1", "shape2"}); + layers.push_back({"cast1","shape1"}); + CheckIterOrder(test_pass, layers); +} +/** + * suspend next node + * data1 suspend cast1, then resume cast1 on leaked + * iter order follows : data1; transdata1, shape2; cast1, shape1. + */ +TEST_F(UTESTGraphPassesBasePass, data1_suspend_cast1_resume_cast1_onleaked) { + auto graph = BuildGraph4(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("data1", "cast1"); + test_pass->AddResumeNodeNameOnLeaked("cast1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), SUCCESS); + EXPECT_EQ(test_pass->GetIterNodes().size(), 5); + std::vector> layers; + layers.push_back({"data1"}); + layers.push_back({"transdata1", "shape2"}); + layers.push_back({"cast1","shape1"}); + CheckIterOrder(test_pass, layers); +} + +/** + * suspend next node + * data1 suspend cast1, nobody resume it + * iter order follows : data1; transdata1, shape2; + * run ret is failed ,because node leaked + */ +TEST_F(UTESTGraphPassesBasePass, data1_suspend_cast1_nobody_resume) { + auto graph = BuildGraph4(); + auto ge_pass = GEPass(graph); + auto *test_pass = dynamic_cast(names_to_pass_[0].second); + // suspend pre_node immediately + test_pass->AddSuspendNodeName("data1", "cast1"); + EXPECT_EQ(ge_pass.Run(names_to_pass_), INTERNAL_ERROR); + EXPECT_EQ(test_pass->GetIterNodes().size(), 3); +} + +/* +TEST_F(UTESTGraphPassesBasePass, suspend_pre_node) { + NamesToPass names_to_pass; + auto test_pass = UtestTestPass(); + names_to_pass.push_back(std::make_pair("test", &test_pass)); + + // repass next_node immediately + test_pass.AddRePassNodeName("reshape1", "sum1"); + // repass node after next_node immediately + test_pass.AddRePassNodeName("add1", "sum1"); + + auto graph = BuildGraph2(); + auto ge_pass = GEPass(graph); + EXPECT_EQ(ge_pass.Run(names_to_pass), SUCCESS); + EXPECT_EQ(test_pass.GetIterNodes().size(), 8);// todo + std::vector> layers; + layers.push_back({"data1", "const1", "const2"}); + layers.push_back({"shape1"}); + layers.push_back({"add1", "addn1"}); + layers.push_back({"reshape1", "sum1"}); + CheckIterOrder(&test_pass, layers); +}*/ +} // namespace ge diff --git a/tests/ut/ge/graph/passes/infershape_pass_unittest.cc b/tests/ut/ge/graph/passes/infershape_pass_unittest.cc index 13e66c50..d84aff50 100644 --- a/tests/ut/ge/graph/passes/infershape_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/infershape_pass_unittest.cc @@ -1,161 +1,262 @@ -/** - * 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 - -#define protected public -#define private public -#include "graph/passes/infershape_pass.h" - -#include "graph/utils/tensor_utils.h" -#include "graph/utils/graph_utils.h" -#include "graph/operator_factory.h" -#include "graph/operator_reg.h" -#include "graph_builder_utils.h" - -using namespace std; -using namespace testing; -namespace ge { -class UtestGraphInfershapePass : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -static NodePtr CreateNode(ComputeGraph &graph, const string &name, const string &type, int in_num, int out_num) { - OpDescPtr op_desc = std::make_shared(name, type); - op_desc->SetStreamId(0); - static int32_t index = 0; - op_desc->SetId(index++); - - GeTensorDesc tensor(GeShape(), FORMAT_NCHW, DT_FLOAT); - TensorUtils::SetSize(tensor, 512); - vector input_offset; - for (int i = 0; i < in_num; i++) { - op_desc->AddInputDesc(tensor); - input_offset.emplace_back(1024); - } - op_desc->SetInputOffset(input_offset); - - vector output_offset; - for (int i = 0; i < out_num; i++) { - op_desc->AddOutputDesc(tensor); - output_offset.emplace_back(1024); - } - op_desc->SetOutputOffset(output_offset); - - op_desc->SetWorkspace({}); - op_desc->SetWorkspaceBytes({}); - op_desc->SetOpKernelLibName("DNN_VM_RTS_OP_STORE"); - - const auto stub_func = [](Operator &op) { return GRAPH_SUCCESS; }; - op_desc->AddInferFunc(stub_func); - op_desc->AddInferFormatFunc(stub_func); - op_desc->AddVerifierFunc(stub_func); - - return graph.AddNode(op_desc); -} - -TEST_F(UtestGraphInfershapePass, infershape_pass_failed) { - GeTensorDesc ge_tensor_desc(GeShape({-2, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); - string type = "AddN"; - auto addn_op_desc = std::make_shared("AddN", type); - addn_op_desc->AddInputDesc(ge_tensor_desc); - addn_op_desc->AddOutputDesc(ge_tensor_desc); - auto graph = std::make_shared("test"); - auto addn_node = std::make_shared(addn_op_desc, graph); - addn_node->Init(); - - InferShapePass infershape_pass; - EXPECT_EQ(infershape_pass.Run(addn_node), GE_GRAPH_INFERSHAPE_FAILED); -} - -TEST_F(UtestGraphInfershapePass, delete_need_infer_again) { - auto graph = std::make_shared("test"); - - auto no_op_desc = std::make_shared("No", "NoOp"); - auto no_op_node = graph->AddNode(no_op_desc); - AttrUtils::SetBool(no_op_desc, "_need_infer_again", false); - - InferShapePass infershape_pass; - infershape_pass.options_[kOptimizeAfterSubGraph] = "yes"; - EXPECT_EQ(infershape_pass.Run(no_op_node), SUCCESS); -} - -TEST_F(UtestGraphInfershapePass, stop_node_for_while_loop) { -/******************************************************************************* - * Exit Identify - * \ / \. - * \ / \. - * Switch Add - * / | | - * / | | - * / | | - * LoopCond | | - * \ | | - * \ | | - * \ | | - * Less | | - * \ | NextIteration - * \ | | - * \ | | - * Merge <---------| - * | - * | - * Enter - ******************************************************************************/ - auto graph = std::make_shared("test_infer_shape"); - auto data1 = CreateNode(*graph, "data", DATA, 1, 1); - auto enter1 = CreateNode(*graph, "enter", ENTER, 1, 1); - auto merge1 = CreateNode(*graph, "merge", MERGE, 2, 2); - auto less1 = CreateNode(*graph, "less", LESS, 2, 1); - auto loop1 = CreateNode(*graph, "loopcond", LOOPCOND, 1, 1); - auto switch1 = CreateNode(*graph, "switch", SWITCH, 2, 2); - auto ident1 = CreateNode(*graph, "identity", IDENTITY, 1, 1); - auto add1 = CreateNode(*graph, "add", ADD, 2, 1); - auto next1 = CreateNode(*graph, "next", NEXTITERATION, 1, 1); - auto exit1 = CreateNode(*graph, "exit", EXIT, 1, 1); - auto value0 = CreateNode(*graph, "const", CONSTANT, 0, 1); - auto value1 = CreateNode(*graph, "const", CONSTANT, 0, 1); - auto output1 = CreateNode(*graph, "net_output", NETOUTPUT, 1, 1); - - GraphUtils::AddEdge(data1->GetOutDataAnchor(0), enter1->GetInDataAnchor(0)); - GraphUtils::AddEdge(enter1->GetOutDataAnchor(0), merge1->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), less1->GetInDataAnchor(0)); - GraphUtils::AddEdge(value1->GetOutDataAnchor(0), less1->GetInDataAnchor(1)); - GraphUtils::AddEdge(less1->GetOutDataAnchor(0), loop1->GetInDataAnchor(0)); - - GraphUtils::AddEdge(loop1->GetOutDataAnchor(0), switch1->GetInDataAnchor(0)); - GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), switch1->GetInDataAnchor(1)); - - GraphUtils::AddEdge(switch1->GetOutDataAnchor(0), exit1->GetInDataAnchor(0)); - GraphUtils::AddEdge(switch1->GetOutDataAnchor(1), ident1->GetInDataAnchor(0)); - - GraphUtils::AddEdge(ident1->GetOutDataAnchor(0), add1->GetInDataAnchor(0)); - GraphUtils::AddEdge(value1->GetOutDataAnchor(0), add1->GetInDataAnchor(1)); - GraphUtils::AddEdge(add1->GetOutDataAnchor(0), next1->GetInDataAnchor(0)); - - GraphUtils::AddEdge(next1->GetOutDataAnchor(0), merge1->GetInDataAnchor(1)); - GraphUtils::AddEdge(exit1->GetOutDataAnchor(0), output1->GetInDataAnchor(0)); - - GEPass ge_passes(graph); - NamesToPass names_to_passes; - InferShapePass infer_shape_pass; - names_to_passes.emplace_back("InferShapePass", &infer_shape_pass); - - EXPECT_EQ(ge_passes.Run(names_to_passes), SUCCESS); -} -} // namespace ge +/** + * 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 + +#define protected public +#define private public +#include "graph/passes/infershape_pass.h" + +#include "graph/utils/tensor_utils.h" +#include "graph/utils/graph_utils.h" +#include "graph/operator_factory.h" +#include "graph/operator_reg.h" +#include "graph_builder_utils.h" + +using namespace std; +using namespace testing; +namespace ge { +class UtestGraphInfershapePass : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +static NodePtr CreateNode(ComputeGraph &graph, const string &name, const string &type, int in_num, int out_num) { + OpDescPtr op_desc = std::make_shared(name, type); + op_desc->SetStreamId(0); + static int32_t index = 0; + op_desc->SetId(index++); + + GeTensorDesc tensor(GeShape(), FORMAT_NCHW, DT_FLOAT); + TensorUtils::SetSize(tensor, 512); + vector input_offset; + for (int i = 0; i < in_num; i++) { + op_desc->AddInputDesc(tensor); + input_offset.emplace_back(1024); + } + op_desc->SetInputOffset(input_offset); + + vector output_offset; + for (int i = 0; i < out_num; i++) { + op_desc->AddOutputDesc(tensor); + output_offset.emplace_back(1024); + } + op_desc->SetOutputOffset(output_offset); + + op_desc->SetWorkspace({}); + op_desc->SetWorkspaceBytes({}); + op_desc->SetOpKernelLibName("DNN_VM_RTS_OP_STORE"); + + const auto stub_func = [](Operator &op) { return GRAPH_SUCCESS; }; + op_desc->AddInferFunc(stub_func); + op_desc->AddInferFormatFunc(stub_func); + op_desc->AddVerifierFunc(stub_func); + + return graph.AddNode(op_desc); +} + +TEST_F(UtestGraphInfershapePass, infershape_pass_failed) { + GeTensorDesc ge_tensor_desc(GeShape({-2, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + string type = "AddN"; + auto addn_op_desc = std::make_shared("AddN", type); + addn_op_desc->AddInputDesc(ge_tensor_desc); + addn_op_desc->AddOutputDesc(ge_tensor_desc); + auto graph = std::make_shared("test"); + auto addn_node = std::make_shared(addn_op_desc, graph); + addn_node->Init(); + + InferShapePass infershape_pass; + EXPECT_EQ(infershape_pass.Run(addn_node), GRAPH_FAILED); +} + +TEST_F(UtestGraphInfershapePass, stop_node_for_while_loop) { +/******************************************************************************* + * Exit Identify + * \ / \. + * \ / \. + * Switch Add + * / | | + * / | | + * / | | + * LoopCond | | + * \ | | + * \ | | + * \ | | + * Less | | + * \ | NextIteration + * \ | | + * \ | | + * Merge <---------| + * | + * | + * Enter + ******************************************************************************/ + auto graph = std::make_shared("test_infer_shape"); + auto data1 = CreateNode(*graph, "data", DATA, 1, 1); + auto enter1 = CreateNode(*graph, "enter", ENTER, 1, 1); + auto merge1 = CreateNode(*graph, "merge", MERGE, 2, 2); + auto less1 = CreateNode(*graph, "less", LESS, 2, 1); + auto loop1 = CreateNode(*graph, "loopcond", LOOPCOND, 1, 1); + auto switch1 = CreateNode(*graph, "switch", SWITCH, 2, 2); + auto ident1 = CreateNode(*graph, "identity", IDENTITY, 1, 1); + auto add1 = CreateNode(*graph, "add", ADD, 2, 1); + auto next1 = CreateNode(*graph, "next", NEXTITERATION, 1, 1); + auto exit1 = CreateNode(*graph, "exit", EXIT, 1, 1); + auto value0 = CreateNode(*graph, "const", CONSTANT, 0, 1); + auto value1 = CreateNode(*graph, "const", CONSTANT, 0, 1); + auto output1 = CreateNode(*graph, "net_output", NETOUTPUT, 1, 1); + + GraphUtils::AddEdge(data1->GetOutDataAnchor(0), enter1->GetInDataAnchor(0)); + GraphUtils::AddEdge(enter1->GetOutDataAnchor(0), merge1->GetInDataAnchor(0)); + GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), less1->GetInDataAnchor(0)); + GraphUtils::AddEdge(value1->GetOutDataAnchor(0), less1->GetInDataAnchor(1)); + GraphUtils::AddEdge(less1->GetOutDataAnchor(0), loop1->GetInDataAnchor(0)); + + GraphUtils::AddEdge(loop1->GetOutDataAnchor(0), switch1->GetInDataAnchor(1)); + GraphUtils::AddEdge(merge1->GetOutDataAnchor(0), switch1->GetInDataAnchor(0)); + + GraphUtils::AddEdge(switch1->GetOutDataAnchor(0), exit1->GetInDataAnchor(0)); + GraphUtils::AddEdge(switch1->GetOutDataAnchor(1), ident1->GetInDataAnchor(0)); + + GraphUtils::AddEdge(ident1->GetOutDataAnchor(0), add1->GetInDataAnchor(0)); + GraphUtils::AddEdge(value1->GetOutDataAnchor(0), add1->GetInDataAnchor(1)); + GraphUtils::AddEdge(add1->GetOutDataAnchor(0), next1->GetInDataAnchor(0)); + + GraphUtils::AddEdge(next1->GetOutDataAnchor(0), merge1->GetInDataAnchor(1)); + GraphUtils::AddEdge(exit1->GetOutDataAnchor(0), output1->GetInDataAnchor(0)); + + GEPass ge_passes(graph); + NamesToPass names_to_passes; + InferShapePass infer_shape_pass; + names_to_passes.emplace_back("InferShapePass", &infer_shape_pass); + + EXPECT_EQ(infer_shape_pass.Run(switch1), SUCCESS); + auto suspend_nodes = infer_shape_pass.GetNodesSuspend(); + auto exit_node = graph->FindNode("exit"); + EXPECT_EQ(suspend_nodes.count(exit_node), 1); + infer_shape_pass.OnSuspendNodesLeaked(); + auto resume_nodes = infer_shape_pass.GetNodesResume(); + EXPECT_EQ(resume_nodes.count(exit_node), 1); +} +TEST_F(UtestGraphInfershapePass, update_tensordesc_when_changed) { + GeTensorDesc src_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDesc dst_ge_tensor_desc(GeShape({2, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDescPtr src_tensor_desc_ptr = std::make_shared(src_ge_tensor_desc); + GeTensorDescPtr dst_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + bool changed = false; + infershape_pass.UpdateTensorDesc(src_tensor_desc_ptr, dst_tensor_desc_ptr, changed); + EXPECT_EQ(changed, true); + EXPECT_EQ(dst_tensor_desc_ptr->GetShape().GetDims(), std::vector({1, 2, 3, 4})); +} + +TEST_F(UtestGraphInfershapePass, update_tensordesc_when_not_changed) { + GeTensorDesc src_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDescPtr src_tensor_desc_ptr = std::make_shared(src_ge_tensor_desc); + GeTensorDescPtr dst_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + bool changed = false; + infershape_pass.UpdateTensorDesc(src_tensor_desc_ptr, dst_tensor_desc_ptr, changed); + EXPECT_EQ(changed, false); +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_failed) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDesc ge_tensor_desc2(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphs({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, GRAPH_FAILED); +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_get_unknown_rank) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc ge_tensor_desc2(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphs({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(dst_ge_tensor_desc_ptr->GetShape().GetDims(), UNKNOWN_RANK); +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_get_unknown_shape) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc ge_tensor_desc2(GeShape({2, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphs({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(dst_ge_tensor_desc_ptr->GetShape().GetDims(), std::vector({-1,2,3,4})); + // todo shape range? +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_for_multiDims_failed) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT16); + GeTensorDesc ge_tensor_desc2(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphsForMultiDims({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, + dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, GRAPH_FAILED); +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_for_multiDims_failed_shape_size_overflow) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc ge_tensor_desc2(GeShape({INT64_MAX, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphsForMultiDims({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, + dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, PARAM_INVALID); +} + +TEST_F(UtestGraphInfershapePass, update_output_from_subgraphs_for_multiDims_success) { + // ref output has different dtype + GeTensorDesc ge_tensor_desc1(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc ge_tensor_desc2(GeShape({2, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDesc dst_ge_tensor_desc(GeShape({1, 2, 3, 4}), ge::FORMAT_NCHW, DT_FLOAT); + GeTensorDescPtr ge_tensor_desc1_ptr = std::make_shared(ge_tensor_desc1); + GeTensorDescPtr ge_tensor_desc2_ptr = std::make_shared(ge_tensor_desc2); + GeTensorDescPtr dst_ge_tensor_desc_ptr = std::make_shared(dst_ge_tensor_desc); + InferShapePass infershape_pass; + auto ret = infershape_pass.UpdateOutputFromSubgraphsForMultiDims({ge_tensor_desc1_ptr, ge_tensor_desc2_ptr}, + dst_ge_tensor_desc_ptr); + EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(dst_ge_tensor_desc_ptr->GetShape().GetDims(), std::vector({2,2,3,4})); +} +} // namespace ge From eee6bc92d1b2bcd150b18621274222ba511ee5bd Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 16:13:45 +0800 Subject: [PATCH 212/226] fix error code and add complex128 support --- tests/ut/ge/graph_ir/ge_ir_build_unittest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 60f33ed3..500dbc2a 100644 --- a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc +++ b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc @@ -367,7 +367,7 @@ TEST(UtestIrBuild, check_data_op_attr_index_valid) { }; ModelBufferData model; graphStatus ret = aclgrphBuildModel(graph, build_options, model); - EXPECT_EQ(ret, GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED); + EXPECT_EQ(ret, ge::FAILED); } // set attr index invalid, when not set input shape range @@ -377,7 +377,7 @@ TEST(UtestIrBuild, check_data_attr_index_succ_no_input_range) { const map build_options; ModelBufferData model; graphStatus ret = aclgrphBuildModel(graph, build_options, model); - EXPECT_EQ(ret, GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED); + EXPECT_EQ(ret, ge::FAILED); } TEST(UtestIrBuild, check_modify_mixlist_param) { From 4cb9aff399e1a8564cc12827bffda9a3a540749d Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 17:21:22 +0800 Subject: [PATCH 213/226] fix error code and add complex128 support --- .../ge/graph/build/graph_mem_assigner_unittest.cc | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc diff --git a/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc new file mode 100644 index 00000000..983f1763 --- /dev/null +++ b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc @@ -0,0 +1,85 @@ +/** + * 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 + +#include "graph/anchor.h" +#include "graph/attr_value.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/graph_utils.h" +#include "graph/utils/node_utils.h" +#include "graph/utils/op_desc_utils.h" +#include "graph/utils/tensor_utils.h" +#include "omg/omg_inner_types.h" +#include "../passes/graph_builder_utils.h" + +#define protected public +#define private public +#include "graph/build/memory/binary_block_mem_assigner.h" +#include "graph/build/memory/graph_mem_assigner_unittest.h" +#include "graph/build/memory/hybrid_mem_assigner.h" +#include "graph/build/memory/max_block_mem_assigner.h" +#include "graph/manager/graph_var_manager.h" +#undef protected +#undef private + +using namespace std; +using namespace testing; +using namespace ge; +using domi::GetContext; + +class UtestTaskGeneratorTest : public testing::Test { + public: + ge::ComputeGraphPtr BuildGraphWithVar(int64_t session_id) { + // init + MemManager::Instance().Initialize(std::vector({RT_MEMORY_HBM})); + VarManager::Instance(session_id)->Init(0, 0, 0, 0); + ge::ut::GraphBuilder builder("graph"); + auto var_input = builder.AddNode("var", "Variable", 1, 1); + auto const_input = builder.AddNode("const", "Const", 1, 1); + auto assign = builder.AddNode("assgin", "Assign", 2, 1); + // add link + builder.AddDataEdge(var_input, 0, assign, 0); + builder.AddDataEdge(const_input, 0, assign, 1); + // set offset + var_input->GetOpDesc()->SetOutputOffset({10000}); + const_input->GetOpDesc()->SetOutputOffset({1000}); + assign->GetOpDesc()->SetInputOffset({10100, 1000}); + assign->GetOpDesc()->SetOutputOffset({10100}); + // set inner offset + int64_t inner_offset = 100; + ge::AttrUtils::SetInt(assign->GetOpDesc()->MutableInputDesc(0), ATTR_NAME_INNER_OFFSET, inner_offset); + ge::AttrUtils::SetInt(assign->GetOpDesc()->MutableOutputDesc(0), ATTR_NAME_INNER_OFFSET, inner_offset); + // add var addr + VarManager::Instance(session_id)->var_resource_->var_offset_map_.emplace(10000, RT_MEMORY_HBM); + + return builder.GetGraph(); + } + +protected: + void SetUp() {} + void TearDown() {} +}; + +TEST_F(UtestMemoryAssignerTest, graph_memory_assign_continuous_input) { + ge::ComputeGraphPtr compute_graph = make_shared(""); + GraphMemoryAssigner graph_mem_assigner(compute_graph); + map mem_type_to_offset = {}; + Status ret = ReAssignMemory(false, mem_type_to_offset); + EXPECT_EQ(ret, ge::FAILED); +} + From 7e6461f7f17fcc824f1b91c98ceb54a01cc2df15 Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 17:32:17 +0800 Subject: [PATCH 214/226] fix error code and add complex128 support --- tests/ut/ge/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 773a2686..a5b3942d 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -677,6 +677,7 @@ set(MULTI_PARTS_TEST_FILES "graph/build/stream_allocator_unittest.cc" "graph/build/model_builder_unittest.cc" "graph/build/mem_assigner_unittest.cc" + "graph/build/graph_mem_assigner_unittest.cc" "graph/build/task_generator_unittest.cc" "graph/build/buffer_pool_mem_assigner_unittest.cc" "graph/execute/graph_execute_unittest.cc" From 8b7ae630863eac1d2aef3b20cf0496139554c420 Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 17:35:08 +0800 Subject: [PATCH 215/226] fix error code and add complex128 support --- tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc index 983f1763..4bff9b38 100644 --- a/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc +++ b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc @@ -30,7 +30,7 @@ #define protected public #define private public #include "graph/build/memory/binary_block_mem_assigner.h" -#include "graph/build/memory/graph_mem_assigner_unittest.h" +#include "graph/build/memory/graph_mem_assigner.h" #include "graph/build/memory/hybrid_mem_assigner.h" #include "graph/build/memory/max_block_mem_assigner.h" #include "graph/manager/graph_var_manager.h" From a928df8eaaaaf0c8bea944d674e5eb58700854bd Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Fri, 16 Jul 2021 18:17:25 +0800 Subject: [PATCH 216/226] fix sc problem --- ge/graph/passes/infershape_pass.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ge/graph/passes/infershape_pass.cc b/ge/graph/passes/infershape_pass.cc index deaebf4f..05b1b5fc 100755 --- a/ge/graph/passes/infershape_pass.cc +++ b/ge/graph/passes/infershape_pass.cc @@ -138,7 +138,9 @@ graphStatus InferShapePass::InferShapeAndType(NodePtr &node) { if (!is_unknown_graph) { auto inference_context = ShapeRefiner::CreateInferenceContext(node); GE_CHECK_NOTNULL(inference_context); - GELOGD("create context for node:%s, marks %zu", node->GetName().c_str(), inference_context->GetMarks().size()); + std::vector marks; + inference_context->GetMarks(marks); + GELOGD("create context for node:%s, marks %zu", node->GetName().c_str(), marks.size()); op.SetInferenceContext(inference_context); } @@ -151,10 +153,12 @@ graphStatus InferShapePass::InferShapeAndType(NodePtr &node) { if (!is_unknown_graph) { auto ctx_after_infer = op.GetInferenceContext(); if (ctx_after_infer != nullptr) { - GELOGD("[%s] after infershape. mark:%zu", node->GetName().c_str(), ctx_after_infer->GetMarks().size()); - if (!ctx_after_infer->GetOutputHandleShapesAndTypes().empty() || !ctx_after_infer->GetMarks().empty()) { + std::vector marks; + ctx_after_infer->GetMarks(marks); + GELOGD("[%s] after infershape. mark:%zu", node->GetName().c_str(), marks.size()); + if (!ctx_after_infer->GetOutputHandleShapesAndTypes().empty() || !marks.empty()) { GELOGD("[%s] set inference context after. mark:%zu", node->GetName().c_str(), - ctx_after_infer->GetMarks().size()); + marks.size()); ShapeRefiner::PushToContextMap(node, ctx_after_infer); } } @@ -254,7 +258,8 @@ graphStatus InferShapePass::CallInferShapeFunc(NodePtr &node, Operator &op) { auto ret = op_desc->CallInferFunc(op); if (ret == GRAPH_PARAM_INVALID) { // Op ir no infer func, try to get infer func from operator factory - auto node_op = ge::OperatorFactory::CreateOperator("node_op", op_desc->GetType()); + + auto node_op = ge::OperatorFactory::CreateOperator("node_op", op_desc->GetType().c_str()); if (node_op.IsEmpty()) { GELOGW("get op from OperatorFactory fail. opType: %s", op_type.c_str()); return ret; From f98a41081af2d7f23434cc1c63be84d0bef9d49c Mon Sep 17 00:00:00 2001 From: lichun Date: Fri, 16 Jul 2021 18:25:05 +0800 Subject: [PATCH 217/226] fix error code and add complex128 support --- tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc index 4bff9b38..703ac3b4 100644 --- a/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc +++ b/tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc @@ -34,6 +34,7 @@ #include "graph/build/memory/hybrid_mem_assigner.h" #include "graph/build/memory/max_block_mem_assigner.h" #include "graph/manager/graph_var_manager.h" +#include "graph/manager/graph_mem_manager.h" #undef protected #undef private @@ -42,7 +43,7 @@ using namespace testing; using namespace ge; using domi::GetContext; -class UtestTaskGeneratorTest : public testing::Test { +class UtestGraphMemAssigner : public testing::Test { public: ge::ComputeGraphPtr BuildGraphWithVar(int64_t session_id) { // init @@ -75,11 +76,15 @@ protected: void TearDown() {} }; -TEST_F(UtestMemoryAssignerTest, graph_memory_assign_continuous_input) { +TEST_F(UtestGraphMemAssigner, graph_memory_assign_fail_case) { ge::ComputeGraphPtr compute_graph = make_shared(""); GraphMemoryAssigner graph_mem_assigner(compute_graph); + MemoryOffset mem_offset(2, 10000); + graph_mem_assigner.memory_offset_.insert({2, mem_offset}); + VarManager::Instance(0)->graph_mem_max_size_ = 0; + map mem_type_to_offset = {}; - Status ret = ReAssignMemory(false, mem_type_to_offset); - EXPECT_EQ(ret, ge::FAILED); + Status ret = graph_mem_assigner.ReAssignMemory(false, mem_type_to_offset); + EXPECT_EQ(ret, ACL_ERROR_GE_MEMORY_ALLOCATION); } From 02c3500ceff3bcc491d536b944a0821635de0770 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Fri, 16 Jul 2021 19:28:02 +0800 Subject: [PATCH 218/226] delete model_cache_helper.cc --- ge/CMakeLists.txt | 2 - ge/common/helper/model_cache_helper.cc | 1721 -------------------- ge/common/helper/model_cache_helper.h | 123 -- ge/executor/ge_executor.cc | 1 + ge/generator/ge_generator.cc | 1 + ge/graph/manager/graph_manager.cc | 209 +-- ge/graph/manager/graph_manager.h | 10 - ge/graph/manager/graph_manager_utils.cc | 38 +- ge/graph/manager/graph_manager_utils.h | 2 - ge/graph/manager/graph_var_manager.cc | 44 - ge/graph/manager/graph_var_manager.h | 6 - ge/graph/manager/model_manager/event_manager.cc | 83 - ge/graph/manager/model_manager/event_manager.h | 98 -- ge/graph/manager/trans_var_data_utils.h | 1 - ge/graph/passes/global_step_insert_pass.cc | 1 - ge/init/gelib.h | 11 +- tests/ut/ge/CMakeLists.txt | 7 - .../ut/ge/graph/execute/model_executor_unittest.cc | 1 + tests/ut/ge/graph/graph_load_unittest.cc | 93 -- .../new_model_manager_data_inputer_unittest.cc | 64 - .../new_model_manager_davinci_model_unittest.cc | 1433 ---------------- .../new_model_manager_event_manager_unittest.cc | 117 -- .../load/new_model_manager_task_build_unittest.cc | 115 -- .../ut/ge/graph/load/output_net_output_unittest.cc | 300 ---- .../ut/ge/graph/manager/graph_manager_unittest.cc | 3 - 25 files changed, 23 insertions(+), 4461 deletions(-) delete mode 100755 ge/common/helper/model_cache_helper.cc delete mode 100755 ge/common/helper/model_cache_helper.h delete mode 100644 ge/graph/manager/model_manager/event_manager.cc delete mode 100644 ge/graph/manager/model_manager/event_manager.h delete mode 100644 tests/ut/ge/graph/graph_load_unittest.cc delete mode 100644 tests/ut/ge/graph/load/new_model_manager_data_inputer_unittest.cc delete mode 100644 tests/ut/ge/graph/load/new_model_manager_davinci_model_unittest.cc delete mode 100644 tests/ut/ge/graph/load/new_model_manager_event_manager_unittest.cc delete mode 100644 tests/ut/ge/graph/load/new_model_manager_task_build_unittest.cc delete mode 100644 tests/ut/ge/graph/load/output_net_output_unittest.cc diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 0236e8bd..f98297d8 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -262,7 +262,6 @@ set(COMPILER_SRC_LIST "common/dump/dump_op.cc" "common/ge/op_tiling_manager.cc" "common/ge/plugin_manager.cc" - "common/helper/model_cache_helper.cc" "common/profiling/profiling_manager.cc" "engine_manager/dnnengine_manager.cc" "ge_local_engine/engine/host_cpu_engine.cc" @@ -300,7 +299,6 @@ set(COMPILER_SRC_LIST "graph/manager/graph_var_manager.cc" "graph/manager/host_mem_allocator.cc" "graph/manager/host_mem_manager.cc" - "graph/manager/model_manager/event_manager.cc" "graph/manager/rdma_pool_allocator.cc" "graph/manager/session_scope_mem_allocator.cc" "graph/manager/trans_var_data_utils.cc" diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc deleted file mode 100755 index 0e6c6329..00000000 --- a/ge/common/helper/model_cache_helper.cc +++ /dev/null @@ -1,1721 +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 "common/helper/model_cache_helper.h" - -#include -#include -#include - -#include "common/model_parser/model_parser.h" -#include "framework/common/helper/model_helper.h" -#include "graph/detail/model_serialize_imp.h" -#include "graph/utils/graph_utils.h" -#include "graph/utils/tensor_utils.h" -#include "init/gelib.h" -#include "proto/ge_ir.pb.h" - -using namespace std; - -namespace { -const char *const kTbeKernelInfoStoreName = "AIcoreEngine"; -const char *const kGraphName = "temp_name"; -// Keys of json -const char *const kNodeNum = "nodeNum"; -const char *const kEdgeNum = "edgeNum"; -const char *const kGraphHash = "graphHash"; -const char *const kNodeHash = "nodeHash"; -const char *const kHash = "hash"; -const char *const kSessionId = "sessionId"; -const char *const kDeviceId = "deviceId"; -const char *const kJobId = "jobId"; -const char *const kGraphMemMaxSize = "graphMemMaxSize"; -const char *const kVarMemMaxSize = "varMemMaxSize"; -const char *const kVarMemLogicBase = "varMemLogicBase"; -const char *const kUseMaxMemSize = "useMaxMemSize"; -const char *const kMemResourceMap = "memResourceMap"; -const char *const kMemType = "memType"; -const char *const kTotalSize = "totalSize"; -const char *const kVarMemSize = "varMemSize"; -const char *const kVarResource = "varResource"; -const char *const kVarAddrMgrMap = "varAddrMgrMap"; -const char *const kName = "name"; -const char *const kAddress = "address"; -const char *const kOffset = "offset"; -const char *const kMemoryType = "memoryType"; -const char *const kTensorDesc = "tensorDesc"; -const char *const kDataType = "dataType"; -const char *const kShape = "shape"; -const char *const kLayout = "layout"; -const char *const kOriginDataType = "originDataType"; -const char *const kOriginShape = "originShape"; -const char *const kOriginLayout = "originLayout"; -const char *const kRealDimCnt = "realDimCnt"; -const char *const kCurVarTensorDescMap = "curVarTensorDescMap"; -const char *const kTransRoads = "transRoads"; -const char *const kTransRoad = "transRoad"; -const char *const kNodeType = "nodeType"; -const char *const kInputTensorDesc = "inputTensorDesc"; -const char *const kOutputTensorDesc = "outputTensorDesc"; -const char *const kChangedGraphId = "changedGraphId"; -const char *const kAllocatedGraphId = "allocatedGraphId"; -const char *const kGraphId = "graphId"; -const char *const kVarBroadcastInfo = "varBroadcastInfo"; -const char *const kBroadcastName = "broadcastName"; -const char *const kIdx = "idx"; -const char *const kInputOffset = "inputOffset"; -const char *const kInputSize = "inputSize"; -const char *const kOutputOffset = "outputOffset"; -const char *const kOutputSize = "outputSize"; -// Suffix of cache files -const char *const kBeforeVarManagerSuffix = "_before_build_var_manager.json"; -const char *const kAfterVarManagerSuffix = "_after_build_var_manager.json"; -const char *const kManifestSuffix = ".manifest"; -const char *const kOmSuffix = ".om"; -} // namespace - -namespace ge { -map ModelCacheHelper::graph_id_run_times_; -ModelCacheHelper::ModelCacheHelper(uint64_t session_id, uint32_t graph_id, ComputeGraphPtr &compute_graph) - : session_id_(session_id), - graph_id_(graph_id), - compute_graph_(compute_graph), - is_cache_path_valid_for_output(false) { - if (graph_id_run_times_.count(graph_id) == 0) { - graph_id_run_times_[graph_id] = 1; - } else { - graph_id_run_times_[graph_id] = graph_id_run_times_[graph_id] + 1; - } - for (const auto &node : compute_graph_->GetDirectNode()) { - bool is_variable = (node->GetType() == VARIABLE) || (node->GetType() == VARIABLEV2) || - (node->GetType() == VARHANDLEOP) || (node->GetType() == CONSTANTOP); - if (!is_variable) { - continue; - } - var_names_.insert(node->GetName()); - } - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr != nullptr && instance_ptr->IsIncreBuild()) { - std::string cache_path = instance_ptr->GetIncreBuildCachePath(); - GELOGD("Incre build path conf: %s", cache_path.c_str()); - string fake_file_path = cache_path + to_string(graph_id_) + kManifestSuffix; - if (CheckOutputPathValid(fake_file_path)) { - is_cache_path_valid_for_output = true; - } else { - GELOGW("Invalid cache path for output."); - } - std::string real_cache_path = RealPath(cache_path.c_str()); - if (real_cache_path.empty()) { - GELOGW("Invalid incre build cache path conf: %s", cache_path.c_str()); - return; - } - cache_path_ = real_cache_path + '/'; - GELOGD("Try to use incre build cache path: %s", cache_path_.c_str()); - } -} - -ModelCacheHelper::~ModelCacheHelper() { var_names_.clear(); } - -bool ModelCacheHelper::IsModelCacheHit() const { - CacheInfo cache_info; - if (GetCacheInfo(cache_info) != SUCCESS) { - GELOGI("Get cache info of graph id[%u] failed.", graph_id_); - return false; - } - // Check number of nodes and edges first. - if (cache_info.node_num != compute_graph_->GetDirectNodesSize()) { - GELOGI("Graph id[%u] cache miss: the node number of the graph does not match the cache info.", graph_id_); - return false; - } - size_t edge_num = 0; - for (const auto &node : compute_graph_->GetDirectNode()) { - for (const auto &anchor : node->GetAllInAnchors()) { - edge_num += anchor->GetPeerAnchors().size(); - } - } - if (cache_info.edge_num != edge_num) { - GELOGI("Graph id[%u] cache miss: the edge number of the graph does not match the cache info.", graph_id_); - return false; - } - size_t compute_graph_hash; - auto ret = GetComputeGraphHash(compute_graph_hash); - if (ret != SUCCESS || cache_info.graph_hash != compute_graph_hash) { - GELOGI("Graph id[%u] cache miss: the hash code of the graph does not match the cache info.", graph_id_); - return false; - } - if (!IsNodeHashSameAsCache(cache_info.nodes_hash)) { - GELOGI("Graph id[%u] cache miss: the hash code of node does not match the cache info.", graph_id_); - return false; - } - - string var_manager_cache = - to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kBeforeVarManagerSuffix; - Json var_manager_json; - if (LoadJsonFromFile(var_manager_cache, var_manager_json) != SUCCESS) { - GELOGW("Fail to load json from cache file: %s", var_manager_cache.c_str()); - return false; - } - if (!IsVarManagerSameAsCache(var_manager_json)) { - GELOGI("Graph id[%u] cache miss: the VarManager does not match the cache info.", graph_id_); - return false; - } - GELOGI("Graph id[%u] cache hit.", graph_id_); - return true; -} - -Status ModelCacheHelper::RefreshComputeGraph(const ComputeGraphPtr &compute_graph) { - if (compute_graph->IsValid()) { - compute_graph_ = compute_graph; - var_names_.clear(); - for (const auto &node : compute_graph_->GetDirectNode()) { - bool is_variable = (node->GetType() == VARIABLE) || (node->GetType() == VARIABLEV2) || - (node->GetType() == VARHANDLEOP) || (node->GetType() == CONSTANTOP); - if (!is_variable) { - continue; - } - var_names_.insert(node->GetName()); - } - return SUCCESS; - } else { - GELOGW("Invalid compute graph."); - return FAILED; - } -} - -Status ModelCacheHelper::ClearCache(uint32_t graph_id) const { - if (!is_cache_path_valid_for_output) { - GELOGW("Invalid cache path."); - return SUCCESS; - } - string manifest_file = cache_path_ + to_string(graph_id) + kManifestSuffix; - string manifest_file_path = RealPath(manifest_file.c_str()); - int ret; - if (!manifest_file_path.empty()) { - ret = remove(manifest_file_path.c_str()); - // If remove file failed, print the warning log - if (ret != 0) { - GELOGW("Clear cache [%s] failed.", manifest_file_path.c_str()); - } - } - string before_var_manager_file = cache_path_ + to_string(graph_id) + kManifestSuffix; - string before_var_manager_file_path = RealPath(before_var_manager_file.c_str()); - if (!before_var_manager_file_path.empty()) { - ret = remove(before_var_manager_file_path.c_str()); - if (ret != 0) { - GELOGW("Clear cache [%s] failed.", before_var_manager_file_path.c_str()); - } - } - string after_var_manager_file = cache_path_ + to_string(graph_id) + kManifestSuffix; - string after_var_manager_file_path = RealPath(after_var_manager_file.c_str()); - if (!after_var_manager_file_path.empty()) { - ret = remove(after_var_manager_file_path.c_str()); - if (ret != 0) { - GELOGW("Clear cache [%s] failed.", after_var_manager_file_path.c_str()); - } - } - string om_file = cache_path_ + to_string(graph_id) + kManifestSuffix; - string om_file_path = RealPath(om_file.c_str()); - if (!om_file_path.empty()) { - ret = remove(om_file_path.c_str()); - if (ret != 0) { - GELOGW("Clear cache [%s] failed.", om_file_path.c_str()); - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverVarManagerFromCache() const { - string var_manager_cache = - to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kAfterVarManagerSuffix; - Json var_manager_json; - if (LoadJsonFromFile(var_manager_cache, var_manager_json) != SUCCESS) { - GELOGW("Fail to load json from cache file: %s", var_manager_cache.c_str()); - return FAILED; - } - - Json mem_resource_json = move(var_manager_json[kMemResourceMap]); - auto ret = RecoverMemResource(mem_resource_json); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[MemResource]"); - return FAILED; - } - Json var_resource_json = move(var_manager_json[kVarResource]); - ret = RecoverAllocatedGraphId(var_resource_json[kAllocatedGraphId]); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[AllocatedGraphId]"); - return FAILED; - } - ret = RecoverChangedGraphId(var_resource_json[kChangedGraphId]); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[ChangedGraphId]"); - return FAILED; - } - ret = RecoverBroadcastInfo(var_resource_json[kVarBroadcastInfo]); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[VarBroadcastInfo]"); - return FAILED; - } - ret = RecoverVarAddrAndTensorDesc(var_resource_json[kVarAddrMgrMap]); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[VarAddrMgrMap & CurVarTensorDesc]"); - return FAILED; - } - ret = RecoverTransRoads(var_resource_json[kTransRoads]); - if (ret != SUCCESS) { - GELOGW("Recover VarManager from cache failed.[TransRoads]"); - return FAILED; - } - GELOGI("Recover VarManager from cache[%s] success.", cache_path_.c_str()); - return SUCCESS; -} - -Status ModelCacheHelper::GetNodesNeedRecompile(ComputeGraphPtr &graph, vector &nodes) { - std::shared_ptr instance = ge::GELib::GetInstance(); - if (instance == nullptr || !instance->InitFlag()) { - GELOGW("RecompileNodes failed."); - return ge::GE_CLI_GE_NOT_INITIALIZED; - } - // Collect aicore ops for recompile - for (auto &node : graph->GetDirectNode()) { - if (node == nullptr) { - continue; - } - auto op_desc = node->GetOpDesc(); - if (op_desc == nullptr) { - continue; - } - // Get op kernel lib name - string kernel_lib_name = op_desc->GetOpKernelLibName(); - if (kernel_lib_name.empty()) { - // reset op kernel lib - (void)instance->DNNEngineManagerObj().GetDNNEngineName(node); - kernel_lib_name = op_desc->GetOpKernelLibName(); - if (kernel_lib_name.empty()) { - GELOGW("Get node:%s, type:%s kernel lib failed.", node->GetName().c_str(), op_desc->GetType().c_str()); - continue; - } - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecompileNodes(GeModelPtr &ge_model) { - std::shared_ptr instance = ge::GELib::GetInstance(); - if (instance == nullptr || !instance->InitFlag()) { - GELOGW("RecompileNodes failed."); - return ge::GE_CLI_GE_NOT_INITIALIZED; - } - // Get aicore ops kernel info store. - OpsKernelInfoStorePtr kernel_info = instance->OpsKernelManagerObj().GetOpsKernelInfoStore(kTbeKernelInfoStoreName); - if (kernel_info == nullptr) { - GELOGW("Get %s ops kernel info store failed", kTbeKernelInfoStoreName); - return INTERNAL_ERROR; - } - - auto compute_graph = GraphUtils::GetComputeGraph(ge_model->GetGraph()); - vector node_vec; - auto ret = GetNodesNeedRecompile(compute_graph, node_vec); - GE_CHK_BOOL_EXEC_WARN(ret == ge::SUCCESS, return ret, "Get nodes need recompiling failed"); - // Recompile aicore ops - ret = kernel_info->CompileOp(node_vec); - GE_CHK_BOOL_EXEC_WARN(ret == ge::SUCCESS, return ret, "Recompile op failed"); - const TBEKernelStore &tbekernel_store = ge_model->GetTBEKernelStore(); - TBEKernelStore tbe_kernel_store; - for (const ge::NodePtr &n : compute_graph->GetDirectNode()) { - auto node_op_desc = n->GetOpDesc(); - GE_IF_BOOL_EXEC(node_op_desc == nullptr, continue); - TBEKernelPtr tbe_kernel = node_op_desc->TryGetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, TBEKernelPtr()); - if (tbe_kernel == nullptr) { - // Load tbe kernel from tbe_kernel_store to op if op was not recompiled - auto op_desc = n->GetOpDesc(); - tbekernel_store.LoadTBEKernelBinToOpDesc(op_desc); - GELOGD("LoadOmModelFromCache: Load tbe kernel bin to op desc[%s].", op_desc->GetName().c_str()); - } - tbe_kernel = node_op_desc->TryGetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, TBEKernelPtr()); - GE_IF_BOOL_EXEC(tbe_kernel == nullptr, continue); - // Refresh tbe kernel in tbe_kernel_store - tbe_kernel_store.AddTBEKernel(tbe_kernel); - GELOGD("Add tbe kernel bin %s", tbe_kernel->GetName().c_str()); - } - GE_CHK_BOOL_EXEC_WARN(tbe_kernel_store.Build(), return FAILED, "TBE Kernels store build failed!"); - ge_model->SetTBEKernelStore(tbe_kernel_store); - return SUCCESS; -} - -Status ModelCacheHelper::GetNodesHash(map &hash_map) const { - vector nodes; - GraphUtils::TopologicalSortingByName(compute_graph_, nodes); - ModelSerializeImp model_serialize_imp; - std::hash node_hash; - for (const auto &node : nodes) { - if (node == nullptr) { - continue; - } - proto::OpDef op_def; - bool is_framework_op = (node->GetType() == FRAMEWORKOP); - int32_t framework_type = 0; - if (is_framework_op) { - AttrUtils::GetInt(node->GetOpDesc(), ge::ATTR_NAME_FRAMEWORK_FWK_TYPE, framework_type); - AttrUtils::SetInt(node->GetOpDesc(), ge::ATTR_NAME_FRAMEWORK_FWK_TYPE, 0); - } - bool ret = model_serialize_imp.SerializeNode(node, &op_def, is_framework_op); - op_def.set_id(0); // Id of op is not stable because of parallel parsing - // Clear weights attr in constant. - auto attr = op_def.mutable_attr(); - if (op_def.type() == CONSTANT || op_def.type() == CONSTANTOP) { - attr->erase(ATTR_NAME_WEIGHTS); - } - if (is_framework_op) { - AttrUtils::SetInt(node->GetOpDesc(), ge::ATTR_NAME_FRAMEWORK_FWK_TYPE, framework_type); - } - if (!ret) { - GELOGW("Fail to serialize node[%s].", node->GetName().c_str()); - return INTERNAL_ERROR; - } - string prototxt; - ret = google::protobuf::TextFormat::PrintToString(op_def, &prototxt); - if (!ret) { - GELOGW("Print OpDef to string failed."); - hash_map.clear(); - return INTERNAL_ERROR; - } - size_t hash_code = node_hash(prototxt); - hash_map[node->GetName()] = hash_code; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetComputeGraphHash(size_t &hash) const { - proto::GraphDef graph_proto; - ModelSerializeImp model_serialize_imp; - // The name of compute graph may be generated randomly, so replace it temporarily. - const string origin_name = compute_graph_->GetName(); - compute_graph_->SetName(kGraphName); - bool serialize_ret = model_serialize_imp.SerializeGraph(compute_graph_, &graph_proto); - graph_proto.clear_op(); - if (!serialize_ret) { - GELOGW("Serialize graph failed."); - hash = 0; - return INTERNAL_ERROR; - } - compute_graph_->SetName(origin_name); - // Generate proto text of GraphDef - string prototxt; - bool print_ret = google::protobuf::TextFormat::PrintToString(graph_proto, &prototxt); - if (!print_ret) { - GELOGW("Print GraphDef to string failed."); - hash = 0; - return INTERNAL_ERROR; - } - // Get the hash code of proto text - std::hash graph_hash; - hash = graph_hash(prototxt); - return SUCCESS; -} - -Status ModelCacheHelper::SaveJsonToFile(const string &file_name, const Json &json) const { - if (!is_cache_path_valid_for_output) { - GELOGW("Invalid cache path."); - return PARAM_INVALID; - } - // Check whether the manifest exists, if not, create it. - string real_path = RealPath(cache_path_.c_str()); - if (real_path.empty()) { - GELOGW("File path is invalid. please check cache path: %s", cache_path_.c_str()); - return FAILED; - } - const string path = cache_path_ + file_name; - 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. errmsg:%s", path.c_str(), strerror(errno)); - return INTERNAL_ERROR; - } - if (mmClose(fd) != 0) { - GELOGW("Fail to close the file:%s. errmsg:%s", path.c_str(), strerror(errno)); - return INTERNAL_ERROR; - } - - // Write json into cache file - ofstream ofs; - ofs.open(path); - if (!ofs.is_open()) { - GELOGW("Fail to open the file: %s.", path.c_str()); - return INTERNAL_ERROR; - } - ofs << json << std::endl; - ofs.close(); - return SUCCESS; -} - -Status ModelCacheHelper::LoadJsonFromFile(const string &file_name, Json &json) const { - if (!json.is_null()) { - GELOGW("Input param json type should be null."); - return PARAM_INVALID; - } - string real_path = RealPath(cache_path_.c_str()); - if (real_path.empty()) { - GELOGW("File path is invalid. please check cache path: %s", cache_path_.c_str()); - return FAILED; - } - const string path = cache_path_ + file_name; - if (!CheckInputPathValid(path)) { - GELOGW("Invalid cache path for input:%s.", path.c_str()); - return FAILED; - } - string cache_real_path = RealPath(path.c_str()); - if (cache_real_path.empty()) { - GELOGI("File[%s] is not found.", path.c_str()); - return FAILED; - } - // Read json from cache file - ifstream ifs; - ifs.open(path); - if (!ifs.is_open()) { - GELOGW("Fail to open the file: %s.", path.c_str()); - return INTERNAL_ERROR; - } - try { - ifs >> json; - } catch (nlohmann::detail::parse_error e) { - GELOGW("Fail to load json from file, json throw an error:%s.", e.what()); - return INTERNAL_ERROR; - } catch (nlohmann::detail::invalid_iterator e) { - GELOGW("Fail to load json from file, json throw an error:%s.", e.what()); - return INTERNAL_ERROR; - } catch (nlohmann::detail::type_error e) { - GELOGW("Fail to load json from file, json throw an error:%s.", e.what()); - return INTERNAL_ERROR; - } catch (nlohmann::detail::out_of_range e) { - GELOGW("Fail to load json from file, json throw an error:%s.", e.what()); - return INTERNAL_ERROR; - } catch (nlohmann::detail::other_error e) { - GELOGW("Fail to load json from file, json throw an error:%s.", e.what()); - return INTERNAL_ERROR; - } - - if (!json.is_object()) { - GELOGW("Fail to load the json file: %s.", path.c_str()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::SaveCacheInfoToCache() const { - // Generate cache json - // example: {"edgeNum":6,"nodeNum":7,"graphCache":134714827475991356} - Json cache_json; - try { - cache_json[kNodeNum] = compute_graph_->GetDirectNodesSize(); - size_t edge_num = 0; - for (const auto &node : compute_graph_->GetDirectNode()) { - for (const auto &anchor : node->GetAllInAnchors()) { - edge_num += anchor->GetPeerAnchors().size(); - } - } - cache_json[kEdgeNum] = edge_num; - size_t hash = 0; - auto ret = GetComputeGraphHash(hash); - if (ret != SUCCESS) { - GELOGW("Error occur when generate graph hash code."); - return ret; - } - cache_json[kGraphHash] = hash; - Json nodes_hash_json; - ret = GetNodesHashMapJson(nodes_hash_json); - if (ret != SUCCESS) { - GELOGW("Error occur when generate nodes hash code."); - return ret; - } - cache_json[kNodeHash] = nodes_hash_json; - } catch (const std::exception &e) { - GELOGW("Fail to generate cache info json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - string cache_manifest = to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kManifestSuffix; - - auto ret = SaveJsonToFile(cache_manifest, cache_json); - if (ret != SUCCESS) { - GELOGW("Fail to save cache info to json file, path: %s.", cache_path_.c_str()); - return ret; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetCacheInfo(CacheInfo &cache_info) const { - string cache_manifest = to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kManifestSuffix; - Json cache_json; - if (LoadJsonFromFile(cache_manifest, cache_json) != SUCCESS) { - GELOGW("Fail to load json from cache file: %s", cache_manifest.c_str()); - return INTERNAL_ERROR; - } - if (!cache_json.is_object()) { - GELOGW("Manifest should be a json object"); - return INTERNAL_ERROR; - } - try { - cache_info.node_num = cache_json[kNodeNum]; - cache_info.edge_num = cache_json[kEdgeNum]; - cache_info.graph_hash = cache_json[kGraphHash]; - Json nodes_hash_json = cache_json[kNodeHash]; - if (!(nodes_hash_json.is_null() || nodes_hash_json.is_array())) { - GELOGW("Nodes hash in cache should be null or array."); - return FAILED; - } - for (const auto &iter : nodes_hash_json) { - cache_info.nodes_hash[iter[kName].get()] = iter[kHash].get(); - } - } catch (const std::exception &e) { - GELOGW("Fail to get info from json file. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -bool ModelCacheHelper::IsAllocatedGraphIdSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare allocated graph id info between json and VarManager - std::map allocated_graph_id; - auto ret = ParseAllocatedGraphIdFromJson(json, allocated_graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to parse AllocatedGraphId from Json."); - return false; - } - for (const auto &iter : allocated_graph_id) { - uint32_t graph_id = 0; - ret = VarManager::Instance(session_id_)->GetAllocatedGraphId(iter.first, graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to find allocated graph id of var[%s].", iter.first.c_str()); - return false; - } - if (graph_id != iter.second) { - GELOGW("The allocated graph id of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsNodeHashSameAsCache(const map &hash_map) const { - map cur_hash_map; - GetNodesHash(cur_hash_map); - if (hash_map.size() != cur_hash_map.size()) { - GELOGI("The number of hash code is different from cache info."); - return false; - } - for (const auto &iter : cur_hash_map) { - if (hash_map.count(iter.first) == 0) { - GELOGI("Node[%s] is not found in cache info.", iter.first.c_str()); - return false; - } - if (hash_map.at(iter.first) != iter.second) { - GELOGI("The hash code of node[%s] is different from cache info.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsMemResourceSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare var mem size info between json and VarManager - std::map var_mem_size; - auto ret = ParseMemResourceFromJson(json, var_mem_size); - if (ret != SUCCESS) { - GELOGW("Fail to parse MemResource from Json."); - return false; - } - for (const auto &iter : var_mem_size) { - int64_t mem_size = VarManager::Instance(session_id_)->GetVarMemSize(iter.first); - if (mem_size != iter.second) { - GELOGW("The var mem size of memory_type[%u] in cache is different from VarManager.", iter.first); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsChangedGraphIdSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare variable changed graph id info between json and VarManager - std::map changed_graph_id; - auto ret = ParseChangedGraphIdFromJson(json, changed_graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to parse ChangedGraphId from Json."); - return false; - } - for (const auto &iter : changed_graph_id) { - uint32_t graph_id = 0; - ret = VarManager::Instance(session_id_)->GetChangedGraphId(iter.first, graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to find changed graph id of var[%s].", iter.first.c_str()); - return false; - } - if (graph_id != iter.second) { - GELOGW("The changed graph id of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsCurVarTensorDescSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare variable tensor desc info between json and VarManager - std::unordered_map cur_var_tensor_desc; - auto ret = ParseCurVarTensorDescMapFromJson(json, cur_var_tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to parse CurVarTensorDesc from Json."); - return false; - } - for (const auto &iter : cur_var_tensor_desc) { - GeTensorDesc tensor_desc; - ret = VarManager::Instance(session_id_)->GetCurVarDesc(iter.first, tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to find tensor desc of var[%s].", iter.first.c_str()); - return false; - } - uint32_t l_real_dim_cnt = 0; - uint32_t r_real_dim_cnt = 0; - TensorUtils::GetRealDimCnt(tensor_desc, l_real_dim_cnt); - TensorUtils::GetRealDimCnt(iter.second, r_real_dim_cnt); - if ((tensor_desc.GetDataType() != iter.second.GetDataType()) || - (tensor_desc.GetOriginDataType() != iter.second.GetOriginDataType()) || - (tensor_desc.GetFormat() != iter.second.GetFormat()) || - (tensor_desc.GetOriginFormat() != iter.second.GetOriginFormat()) || - (tensor_desc.GetShape().ToString() != iter.second.GetShape().ToString()) || - (tensor_desc.GetOriginShape().ToString() != iter.second.GetOriginShape().ToString()) || - (l_real_dim_cnt != r_real_dim_cnt)) { - GELOGW("The var tensor desc of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsVarAddrMgrMapSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare variable address info between json and VarManager - std::vector> var_addr_mgr_vector; - std::set var_offset_set; - auto ret = ParseVarAddrMgrMapFromJson(json, var_addr_mgr_vector, var_offset_set); - if (ret != SUCCESS) { - GELOGW("Fail to parse VarAddrMgrMap from Json."); - return false; - } - for (const auto &iter : var_addr_mgr_vector) { - uint8_t *dev_ptr = nullptr; - rtMemType_t memory_type; - ret = VarManager::Instance(session_id_)->GetVarAddr(iter.first, iter.second.tensor_desc, &dev_ptr, memory_type); - if (ret != SUCCESS) { - GELOGW("Fail to find tensor desc of var[%s].", iter.first.c_str()); - return false; - } - // Compare memory type and logic address - if (iter.second.memory_type != memory_type || iter.second.address != dev_ptr) { - GELOGW("The VarAddrMgr of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsBroadcastInfoSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare broadcast info between json and VarManager - std::unordered_map var_broadcast_info; - auto ret = ParseBroadcastInfoFromJson(json, var_broadcast_info); - if (ret != SUCCESS) { - GELOGW("Fail to parse BroadcastInfo from Json."); - return false; - } - for (const auto &iter : var_broadcast_info) { - VarBroadCastInfo broadcast_info; - if (VarManager::Instance(session_id_)->GetBroadCastInfo(graph_id_, iter.first, broadcast_info) != SUCCESS) { - GELOGW("Fail to find broadcast info of var[%s].", iter.first.c_str()); - return false; - } - if (iter.second.var_name != broadcast_info.var_name || iter.second.idx != broadcast_info.idx || - iter.second.input_size != broadcast_info.input_size || - iter.second.input_offset != broadcast_info.input_offset || - iter.second.output_size != broadcast_info.output_size || - iter.second.output_offset != broadcast_info.output_offset) { - GELOGW("The BroadcastInfo of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - return true; -} - -bool ModelCacheHelper::IsTransRoadsSameAsCache(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return false; - } - // Compare trans road between json and VarManager - std::unordered_map> trans_roads; - auto ret = ParseTransRoadsFromJson(json, trans_roads); - if (ret != SUCCESS) { - GELOGW("Fail to parse TransRoads from Json."); - return false; - } - for (const auto &iter : trans_roads) { - VarTransRoad *trans_road; - trans_road = VarManager::Instance(session_id_)->GetTransRoad(iter.first); - if (trans_road == nullptr) { - GELOGW("Fail to find trans road of var[%s].", iter.first.c_str()); - return false; - } - if (trans_road->size() != iter.second.size()) { - GELOGW("The TransRoad of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - // Compare every trans node in trans road. - for (size_t idx = 0; idx < trans_road->size(); idx += 1) { - if (!(trans_road->at(idx).node_type == iter.second.at(idx).node_type && - trans_road->at(idx).input == iter.second.at(idx).input && - trans_road->at(idx).output == iter.second.at(idx).output)) { - GELOGW("The TransRoad of variable[%s] in cache is different from VarManager.", iter.first.c_str()); - return false; - } - } - } - return true; -} - -bool ModelCacheHelper::IsVarManagerParamSameAsCache(Json &json) const { - if (!json.is_object()) { - GELOGW("Input param json type should be object."); - return false; - } - try { - if (json[kSessionId].get() != session_id_) { - GELOGW("Check VarManager cache failed.[sessionId]"); - return false; - } - if (json[kDeviceId].get() != VarManager::Instance(session_id_)->DeviceId()) { - GELOGW("Check VarManager cache failed.[deviceId]"); - return false; - } - if (json[kJobId].get() != VarManager::Instance(session_id_)->JobId()) { - GELOGW("Check VarManager cache failed.[jobId]"); - return false; - } - if (json[kGraphMemMaxSize].get() != VarManager::Instance(session_id_)->GetGraphMemoryMaxSize()) { - GELOGW("Check VarManager cache failed.[graphMemMaxSize]"); - return false; - } - if (json[kVarMemMaxSize].get() != VarManager::Instance(session_id_)->GetVarMemMaxSize()) { - GELOGW("Check VarManager cache failed.[varMemMaxSize]"); - return false; - } - if (json[kVarMemLogicBase].get() != VarManager::Instance(session_id_)->GetVarMemLogicBase()) { - GELOGW("Check VarManager cache failed.[varMemLogicBase]"); - return false; - } - if (json[kUseMaxMemSize].get() != VarManager::Instance(session_id_)->GetUseMaxMemorySize()) { - GELOGW("Check VarManager cache failed.[useMaxMemSize]"); - return false; - } - } catch (const std::exception &e) { - GELOGW("Fail to check VarManager json. Error message: %s", e.what()); - return false; - } - return true; -} - -bool ModelCacheHelper::IsVarManagerSameAsCache(Json &json) const { - if (!json.is_object()) { - GELOGW("Input param json type should be object."); - return false; - } - try { - if (!IsVarManagerParamSameAsCache(json)) { - GELOGW("Check VarManager cache failed.[Param]"); - return false; - } - Json mem_resource_json = move(json[kMemResourceMap]); - auto ret = IsMemResourceSameAsCache(mem_resource_json); - if (!ret) { - GELOGW("Check VarManager cache failed.[MemResource]"); - return false; - } - Json var_resource_json = move(json[kVarResource]); - ret = IsAllocatedGraphIdSameAsCache(var_resource_json[kAllocatedGraphId]); - if (!ret) { - GELOGW("Check VarManager cache failed.[AllocatedGraphId]"); - return false; - } - ret = IsChangedGraphIdSameAsCache(var_resource_json[kChangedGraphId]); - if (!ret) { - GELOGW("Check VarManager cache failed.[ChangedGraphId]"); - return false; - } - ret = IsBroadcastInfoSameAsCache(var_resource_json[kVarBroadcastInfo]); - if (!ret) { - GELOGW("Check VarManager cache failed.[VarBroadcastInfo]"); - return false; - } - ret = IsCurVarTensorDescSameAsCache(var_resource_json[kCurVarTensorDescMap]); - if (!ret) { - GELOGW("Check VarManager cache failed.[CurVarTensorDesc]"); - return false; - } - ret = IsVarAddrMgrMapSameAsCache(var_resource_json[kVarAddrMgrMap]); - if (!ret) { - GELOGW("Check VarManager cache failed.[VarAddrMgrMap]"); - return false; - } - ret = IsTransRoadsSameAsCache(var_resource_json[kTransRoads]); - if (!ret) { - GELOGW("Check VarManager cache failed.[TransRoads]"); - return false; - } - } catch (const std::exception &e) { - GELOGW("Fail to check VarManager json. Error message: %s", e.what()); - return false; - } - return true; -} - -Status ModelCacheHelper::RecoverMemResource(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::map var_mem_size; - auto ret = ParseMemResourceFromJson(json, var_mem_size); - if (ret != SUCCESS) { - GELOGW("Fail to parse MemResource from Json."); - return ret; - } - for (const auto &iter : var_mem_size) { - ret = VarManager::Instance(session_id_)->UpdateVarMemSize(iter.first, iter.second); - if (ret != SUCCESS) { - GELOGW("Fail to recover var mem size."); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverAllocatedGraphId(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::map allocated_graph_id; - auto ret = ParseAllocatedGraphIdFromJson(json, allocated_graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to parse AllocatedGraphId from Json."); - return ret; - } - for (const auto &iter : allocated_graph_id) { - ret = VarManager::Instance(session_id_)->SetAllocatedGraphId(iter.first, iter.second); - if (ret != SUCCESS) { - GELOGW("Fail to recover allocated graph id."); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverChangedGraphId(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::map changed_graph_id; - auto ret = ParseChangedGraphIdFromJson(json, changed_graph_id); - if (ret != SUCCESS) { - GELOGW("Fail to parse AllocatedGraphId from Json."); - return ret; - } - for (const auto &iter : changed_graph_id) { - ret = VarManager::Instance(session_id_)->SetChangedGraphId(iter.first, iter.second); - if (ret != SUCCESS) { - GELOGW("Fail to recover changed graph id."); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverVarAddrAndTensorDesc(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::vector> var_addr_mgr_vector; - std::set var_offset_set; - auto ret = ParseVarAddrMgrMapFromJson(json, var_addr_mgr_vector, var_offset_set); - if (ret != SUCCESS) { - GELOGW("Fail to parse VarAddrMgrMap from Json."); - return ret; - } - for (const auto &iter : var_addr_mgr_vector) { - const VarAddrMgr &tensor_addr_mgr = iter.second; - const bool var_exist = VarManager::Instance(session_id_)->IsVarExist(iter.first, tensor_addr_mgr.tensor_desc); - // SaveVarVddr if var does not exist, the logic address will be recorded by VarManager - if (!var_exist) { - auto logic_address = reinterpret_cast(reinterpret_cast(tensor_addr_mgr.address)); - auto offset = (tensor_addr_mgr.offset); - // Check logic address and offset - if (logic_address - offset != VarManager::Instance(session_id_)->GetVarMemLogicBase()) { - GELOGW("Check logic_address[%lu] and offset [%lu] of %s failed, var mem logic base is %lu, abandon", - logic_address, offset, iter.first.c_str(), VarManager::Instance(session_id_)->GetVarMemLogicBase()); - return PARAM_INVALID; - } - // Offset is needed by SaveVarVddr instead of logic address - ret = VarManager::Instance(session_id_)->SaveVarAddr(iter.first, tensor_addr_mgr.tensor_desc, - reinterpret_cast(reinterpret_cast(offset)), - tensor_addr_mgr.memory_type); - if (ret != SUCCESS) { - GELOGW("Fail to recover VarAddr or TensorDesc of var[%s].", iter.first.c_str()); - return ret; - } - } - // SetVarAddr to update cur_var_tensor_desc_map_ - ret = VarManager::Instance(session_id_) - ->SetVarAddr(iter.first, tensor_addr_mgr.tensor_desc, tensor_addr_mgr.address, tensor_addr_mgr.memory_type); - if (ret != SUCCESS) { - GELOGW("Fail to recover VarAddr or TensorDesc desc of var[%s].", iter.first.c_str()); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverBroadcastInfo(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::unordered_map var_broadcast_info; - auto ret = ParseBroadcastInfoFromJson(json, var_broadcast_info); - if (ret != SUCCESS) { - GELOGW("Fail to parse BroadcastInfo from Json."); - return ret; - } - for (const auto &iter : var_broadcast_info) { - VarBroadCastInfo broadcast_info; - ret = VarManager::Instance(session_id_)->SaveBroadCastInfo(graph_id_, iter.second); - if (ret != SUCCESS) { - GELOGW("Fail to recover broadcast info of var[%s].", iter.first.c_str()); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::RecoverTransRoads(const Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::unordered_map> trans_roads; - auto ret = ParseTransRoadsFromJson(json, trans_roads); - if (ret != SUCCESS) { - GELOGW("Fail to parse TransRoads from Json."); - return ret; - } - for (const auto &iter : trans_roads) { - ret = VarManager::Instance(session_id_)->SetTransRoad(iter.first, iter.second); - if (ret != SUCCESS) { - GELOGW("Fail to find trans road of var[%s].", iter.first.c_str()); - return ret; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::TensorDescToJson(const GeTensorDesc &ge_tensor_desc, Json &json) { - if (!(json.is_null() || json.is_object())) { - GELOGW("Input param json type should be null or object."); - return PARAM_INVALID; - } - try { - json[kDataType] = static_cast(ge_tensor_desc.GetDataType()); - json[kOriginDataType] = static_cast(ge_tensor_desc.GetOriginDataType()); - json[kLayout] = static_cast(ge_tensor_desc.GetFormat()); - json[kOriginLayout] = static_cast(ge_tensor_desc.GetOriginFormat()); - json[kShape] = ge_tensor_desc.GetShape().GetDims(); - json[kOriginShape] = ge_tensor_desc.GetOriginShape().GetDims(); - uint32_t real_dim_cnt = 0; - (void)TensorUtils::GetRealDimCnt(ge_tensor_desc, real_dim_cnt); // [No need to check value] - json[kRealDimCnt] = real_dim_cnt; - } catch (const std::exception &e) { - GELOGW("Fail to trans GeTensorDesc to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::JsonToTensorDesc(const Json &json, ge::GeTensorDesc &ge_tensor_desc) { - if (!json.is_object()) { - GELOGW("Input param json type should be object."); - return PARAM_INVALID; - } - try { - ge_tensor_desc.SetDataType(static_cast(json[kDataType].get())); - ge_tensor_desc.SetOriginDataType(static_cast(json[kOriginDataType].get())); - ge_tensor_desc.SetFormat(static_cast(json[kLayout].get())); - ge_tensor_desc.SetOriginFormat(static_cast(json[kOriginLayout].get())); - GeShape shape(json[kShape].get>()); - ge_tensor_desc.SetShape(shape); - GeShape origin_shape(json[kOriginShape].get>()); - ge_tensor_desc.SetOriginShape(origin_shape); - auto real_dim_cnt = json[kRealDimCnt].get(); - (void)TensorUtils::SetRealDimCnt(ge_tensor_desc, real_dim_cnt); // [No need to check value] - } catch (const std::exception &e) { - GELOGW("Fail to trans Json to GeTensorDesc. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetNodesHashMapJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - map hash_map; - GetNodesHash(hash_map); - for (const auto &iter : hash_map) { - Json node_hash_json; - try { - node_hash_json[kName] = iter.first; - node_hash_json[kHash] = iter.second; - json.emplace_back(move(node_hash_json)); - } catch (const std::exception &e) { - GELOGW("Fail to trans node cache to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::GetMemResourceMap(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - const auto total_size = VarManager::Instance(session_id_)->GetVarMemMaxSize(); - const auto var_mem_size = VarManager::Instance(session_id_)->GetVarMemSize(RT_MEMORY_HBM); - Json mem_resource_json; - try { - mem_resource_json[kMemType] = RT_MEMORY_HBM; - mem_resource_json[kTotalSize] = total_size; - mem_resource_json[kVarMemSize] = var_mem_size; - json.emplace_back(move(mem_resource_json)); - } catch (const std::exception &e) { - GELOGW("Fail to trans MemResourceMap to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetVarAddrMgrMapJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - std::unordered_map var_addr_mgr_map; - VarManager::Instance(session_id_)->GetAllVarAddrMgr(var_addr_mgr_map); - try { - for (const auto &iter : var_addr_mgr_map) { - Json var_addr_json; - string name; - GetVarNameFromVarKey(iter.first, iter.second.tensor_desc, name); - var_addr_json[kName] = name; - var_addr_json[kAddress] = static_cast(reinterpret_cast(iter.second.address)); - var_addr_json[kMemoryType] = iter.second.memory_type; - var_addr_json[kOffset] = iter.second.offset; - - // Copy tensor desc to json. - Json tensor_desc_json; - auto ret = TensorDescToJson(iter.second.tensor_desc, tensor_desc_json); - if (ret != SUCCESS) { - GELOGW("Fail to trans tensor desc to json."); - return INTERNAL_ERROR; - } - var_addr_json[kTensorDesc] = move(tensor_desc_json); - - json.emplace_back(move(var_addr_json)); - } - } catch (const std::exception &e) { - GELOGW("Fail to trans VarAddrMgrMap to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetCurVarTensorDescMapJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - try { - for (const auto &name : var_names_) { - Json cur_tensor_desc_json; - GeTensorDesc tensor_desc; - auto ret = VarManager::Instance(session_id_)->GetCurVarDesc(name, tensor_desc); - if (ret != SUCCESS) { - GELOGI("Get variable[%s] current tensor desc failed. It will be skipped.", name.c_str()); - continue; - } - cur_tensor_desc_json[kName] = name; - - Json tensor_desc_json; - ret = TensorDescToJson(tensor_desc, tensor_desc_json); - if (ret != SUCCESS) { - GELOGW("Fail to trans tensor desc to json."); - return INTERNAL_ERROR; - } - cur_tensor_desc_json[kTensorDesc] = move(tensor_desc_json); - json.emplace_back(move(cur_tensor_desc_json)); - } - } catch (const std::exception &e) { - GELOGW("Fail to trans CurVarTensorDescMap to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetTransRoadsJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - try { - for (const auto &name : var_names_) { - auto trans_road = VarManager::Instance(session_id_)->GetTransRoad(name); - if (trans_road == nullptr) { - continue; - } - // Json object, variable name and trans road - Json trans_road_map_json; - trans_road_map_json[kName] = name; - - Json trans_road_json; - Status ret; - // Add nodes' info to json - for (const auto &trans_node_info : *trans_road) { - Json trans_node_info_json; - trans_node_info_json[kNodeType] = trans_node_info.node_type; - Json input_tensor_desc_json; - ret = TensorDescToJson(trans_node_info.input, input_tensor_desc_json); - if (ret != SUCCESS) { - GELOGW("Fail to trans tensor desc to json."); - return INTERNAL_ERROR; - } - trans_node_info_json[kInputTensorDesc] = move(input_tensor_desc_json); - Json output_tensor_desc_json; - ret = TensorDescToJson(trans_node_info.output, output_tensor_desc_json); - if (ret != SUCCESS) { - GELOGW("Fail to trans tensor desc to json."); - return INTERNAL_ERROR; - } - trans_node_info_json[kOutputTensorDesc] = move(output_tensor_desc_json); - trans_road_json.emplace_back(move(trans_node_info_json)); - } - trans_road_map_json[kTransRoad] = move(trans_road_json); - json.emplace_back(move(trans_road_map_json)); - } - } catch (const std::exception &e) { - GELOGW("Fail to trans VarToTransRoad to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetChangedGraphIdJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - for (const auto &name : var_names_) { - uint32_t changed_graph_id = 0; - Status ret = VarManager::Instance(session_id_)->GetChangedGraphId(name, changed_graph_id); - if (ret != SUCCESS) { - continue; - } - Json name_and_changed_graph_id; - try { - name_and_changed_graph_id[kName] = name; - name_and_changed_graph_id[kGraphId] = changed_graph_id; - json.emplace_back(move(name_and_changed_graph_id)); - } catch (const std::exception &e) { - GELOGW("Fail to trans ChangedGraphId to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::GetAllocatedGraphIdJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - for (const auto &name : var_names_) { - uint32_t allocated_graph_id = 0; - Status ret = VarManager::Instance(session_id_)->GetAllocatedGraphId(name, allocated_graph_id); - if (ret != SUCCESS) { - continue; - } - Json name_and_allocated_graph_id; - try { - name_and_allocated_graph_id[kName] = name; - name_and_allocated_graph_id[kGraphId] = allocated_graph_id; - json.emplace_back(move(name_and_allocated_graph_id)); - } catch (const std::exception &e) { - GELOGW("Fail to trans AllocatedGraphId to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::GetBroadcastInfoJson(Json &json) const { - if (!(json.is_null() || json.is_array())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - for (const auto &name : var_names_) { - VarBroadCastInfo var_broadcast_info; - Status ret = VarManager::Instance(session_id_)->GetBroadCastInfo(graph_id_, name, var_broadcast_info); - if (ret != SUCCESS) { - continue; - } - Json var_broadcast_info_json; - try { - var_broadcast_info_json[kName] = name; - var_broadcast_info_json[kBroadcastName] = var_broadcast_info.broadcast_name; - var_broadcast_info_json[kIdx] = var_broadcast_info.idx; - var_broadcast_info_json[kInputOffset] = var_broadcast_info.input_offset; - var_broadcast_info_json[kInputSize] = var_broadcast_info.input_size; - var_broadcast_info_json[kOutputOffset] = var_broadcast_info.output_offset; - var_broadcast_info_json[kOutputSize] = var_broadcast_info.output_size; - json.emplace_back(move(var_broadcast_info_json)); - } catch (const std::exception &e) { - GELOGW("Fail to trans VarBroadcastInfo to json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::GetVarResourceJson(Json &json) const { - if (!(json.is_null() || json.is_object())) { - GELOGW("Input param json type should be null or object."); - return PARAM_INVALID; - } - Json var_addr_mgr_map_json; - Status ret = GetVarAddrMgrMapJson(var_addr_mgr_map_json); - if (ret != SUCCESS) { - GELOGW("GetVarAddrMgrMapJson failed."); - return INTERNAL_ERROR; - } - - Json cur_var_tensor_desc_map_json; - ret = GetCurVarTensorDescMapJson(cur_var_tensor_desc_map_json); - if (ret != SUCCESS) { - GELOGW("GetCurVarTensorDescMapJson failed."); - return INTERNAL_ERROR; - } - - Json trans_roads_json; - ret = GetTransRoadsJson(trans_roads_json); - if (ret != SUCCESS) { - GELOGW("GetTransRoadsJson failed."); - return INTERNAL_ERROR; - } - - Json changed_graph_id_json; - ret = GetChangedGraphIdJson(changed_graph_id_json); - if (ret != SUCCESS) { - GELOGW("GetChangedGraphIdJson failed."); - return INTERNAL_ERROR; - } - - Json allocated_graph_id_json; - ret = GetAllocatedGraphIdJson(allocated_graph_id_json); - if (ret != SUCCESS) { - GELOGW("GetAllocatedGraphIdJson failed."); - return INTERNAL_ERROR; - } - - Json var_broadcast_info_json; - ret = GetBroadcastInfoJson(var_broadcast_info_json); - if (ret != SUCCESS) { - GELOGW("GetBroadcastInfoJson failed."); - return INTERNAL_ERROR; - } - - try { - json[kVarAddrMgrMap] = move(var_addr_mgr_map_json); - json[kCurVarTensorDescMap] = move(cur_var_tensor_desc_map_json); - json[kTransRoads] = move(trans_roads_json); - json[kChangedGraphId] = move(changed_graph_id_json); - json[kAllocatedGraphId] = move(allocated_graph_id_json); - json[kVarBroadcastInfo] = move(var_broadcast_info_json); - } catch (const exception &e) { - GELOGW("Fail to generate VarResource json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetVarManagerJson(Json &json) const { - if (!(json.is_null() || json.is_object())) { - GELOGW("Input param json type should be null or object."); - return PARAM_INVALID; - } - - Json mem_resource_map_json; - auto ret = GetMemResourceMap(mem_resource_map_json); - if (ret != SUCCESS) { - GELOGW("GetMemResourceMap failed."); - return INTERNAL_ERROR; - } - - Json var_resource_json; - ret = GetVarResourceJson(var_resource_json); - if (ret != SUCCESS) { - GELOGW("GetVarResourceJson failed."); - return INTERNAL_ERROR; - } - - try { - json[kSessionId] = session_id_; - json[kDeviceId] = VarManager::Instance(session_id_)->DeviceId(); - json[kJobId] = VarManager::Instance(session_id_)->JobId(); - json[kGraphMemMaxSize] = VarManager::Instance(session_id_)->GetGraphMemoryMaxSize(); - json[kVarMemMaxSize] = VarManager::Instance(session_id_)->GetVarMemMaxSize(); - json[kVarMemLogicBase] = VarManager::Instance(session_id_)->GetVarMemLogicBase(); - json[kUseMaxMemSize] = VarManager::Instance(session_id_)->GetUseMaxMemorySize(); - json[kMemResourceMap] = move(mem_resource_map_json); - json[kVarResource] = move(var_resource_json); - } catch (const exception &e) { - GELOGW("Fail to generate VarManager json. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::SaveVarManagerToCache(bool before_build) const { - if (!is_cache_path_valid_for_output) { - GELOGW("Invalid cache path."); - return FAILED; - } - Json var_manager_json; - auto ret = GetVarManagerJson(var_manager_json); - if (ret != SUCCESS) { - GELOGW("Fail to generate VarManager json."); - return FAILED; - } - string var_manager_path = to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + - (before_build ? kBeforeVarManagerSuffix : kAfterVarManagerSuffix); - ret = SaveJsonToFile(var_manager_path, var_manager_json); - if (ret != SUCCESS) { - GELOGW("Fail to save VarManager info to json file, path: %s.", cache_path_.c_str()); - return ret; - } - return SUCCESS; -} - -Status ModelCacheHelper::SaveOmModelToCache(const GeModelPtr &ge_model) const { - if (!is_cache_path_valid_for_output) { - GELOGW("Invalid cache path."); - return FAILED; - } - string om_path = RealPath(cache_path_.c_str()); - if (om_path.empty()) { - GELOGW("file path is invalid. please check path om: %s", cache_path_.c_str()); - return FAILED; - } - string cache_om_path = cache_path_; - cache_om_path += (to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kOmSuffix); - GELOGI("SaveOmModelToCache: start to save om model : %s", cache_om_path.c_str()); - ModelHelper model_helper; - SaveParam save_param; - ModelBufferData model; - Status ret = model_helper.SaveToOmModel(ge_model, save_param, cache_om_path, model); - if (ret != SUCCESS) { - GELOGW("SaveOmModelToCache: save mode failed. ret = %u", ret); - return ret; - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseMemResourceFromJson(const Json &json, map &mem_resource) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - mem_resource.clear(); - for (const Json &mem_resource_json : json) { - try { - rtMemType_t mem_type = mem_resource_json[kMemType].get(); - uint64_t var_mem_size = mem_resource_json[kVarMemSize].get(); - mem_resource[mem_type] = var_mem_size; - } catch (const exception &e) { - GELOGW("Fail to trans Json to MemResource. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseVarAddrMgrMapFromJson( - const Json &json, std::vector> &var_addr_mgr_vector, - std::set &var_offset_set) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - var_addr_mgr_vector.clear(); - var_offset_set.clear(); - for (const Json &var_addr_json : json) { - VarAddrMgr var_addr_mgr; - try { - auto logic_address = var_addr_json[kAddress].get(); - auto address = reinterpret_cast(reinterpret_cast(logic_address)); - var_addr_mgr.address = address; - var_addr_mgr.offset = var_addr_json[kOffset].get(); - var_addr_mgr.memory_type = var_addr_json[kMemoryType].get(); - auto ret = JsonToTensorDesc(var_addr_json[kTensorDesc], var_addr_mgr.tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to trans json to tensor desc."); - return ret; - } - var_addr_mgr_vector.emplace_back(var_addr_json[kName].get(), move(var_addr_mgr)); - var_offset_set.insert(logic_address); - } catch (const exception &e) { - GELOGW("Fail to trans Json to VarAddrMgr. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseCurVarTensorDescMapFromJson( - const Json &json, std::unordered_map &cur_var_tensor_desc_map) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - cur_var_tensor_desc_map.clear(); - for (const Json &tensor_desc_json : json) { - GeTensorDesc tensor_desc; - try { - auto ret = JsonToTensorDesc(tensor_desc_json[kTensorDesc], tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to trans json to tensor desc."); - return ret; - } - cur_var_tensor_desc_map[tensor_desc_json[kName].get()] = move(tensor_desc); - } catch (const exception &e) { - GELOGW("Fail to trans Json to VarAddrMgr. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseTransRoadsFromJson( - const Json &json, std::unordered_map> &trans_roads) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - trans_roads.clear(); - try { - for (const Json &name_trans_road_json : json) { - const Json &trans_road_json = name_trans_road_json[kTransRoad]; - if (!(trans_road_json.is_array() || trans_road_json.is_null())) { - GELOGW("%s json type should be null or object.", kTransRoad); - return PARAM_INVALID; - } - vector trans_road; - for (const Json &trans_node_json : trans_road_json) { - TransNodeInfo trans_node_info; - trans_node_info.node_type = trans_node_json[kNodeType]; - GeTensorDesc input_tensor_desc; - auto ret = JsonToTensorDesc(trans_node_json[kInputTensorDesc], input_tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to trans json to tensor desc."); - return ret; - } - trans_node_info.input = move(input_tensor_desc); - GeTensorDesc output_tensor_desc; - ret = JsonToTensorDesc(trans_node_json[kOutputTensorDesc], output_tensor_desc); - if (ret != SUCCESS) { - GELOGW("Fail to trans json to tensor desc."); - return ret; - } - trans_node_info.output = move(output_tensor_desc); - trans_road.emplace_back(move(trans_node_info)); - } - trans_roads[name_trans_road_json[kName].get()] = move(trans_road); - } - } catch (const exception &e) { - GELOGW("Fail to trans Json to TransRoads. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseChangedGraphIdFromJson(const Json &json, - std::map &changed_graph_id) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - changed_graph_id.clear(); - for (const Json &name_graph_id_json : json) { - try { - changed_graph_id[name_graph_id_json[kName].get()] = name_graph_id_json[kGraphId].get(); - } catch (const exception &e) { - GELOGW("Fail to trans Json to changed graph id. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseAllocatedGraphIdFromJson(const Json &json, - std::map &allocated_graph_id) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - allocated_graph_id.clear(); - for (const Json &name_graph_id_json : json) { - try { - allocated_graph_id[name_graph_id_json[kName].get()] = name_graph_id_json[kGraphId].get(); - } catch (const exception &e) { - GELOGW("Fail to trans Json to allocated graph id. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - } - return SUCCESS; -} - -Status ModelCacheHelper::ParseBroadcastInfoFromJson( - const Json &json, std::unordered_map &var_broadcast_info) { - if (!(json.is_array() || json.is_null())) { - GELOGW("Input param json type should be null or array."); - return PARAM_INVALID; - } - for (const Json &broadcast_info_json : json) { - VarBroadCastInfo broadcast_info; - try { - broadcast_info.var_name = broadcast_info_json[kName].get(); - broadcast_info.broadcast_name = broadcast_info_json[kBroadcastName].get(); - broadcast_info.idx = broadcast_info_json[kIdx].get(); - broadcast_info.input_offset = broadcast_info_json[kInputOffset].get(); - broadcast_info.input_size = broadcast_info_json[kInputSize].get(); - broadcast_info.output_offset = broadcast_info_json[kOutputOffset].get(); - broadcast_info.output_size = broadcast_info_json[kOutputSize].get(); - } catch (const exception &e) { - GELOGW("Fail to trans Json to VarBroadCastInfo. Error message: %s", e.what()); - return INTERNAL_ERROR; - } - var_broadcast_info[broadcast_info.var_name] = broadcast_info; - } - return SUCCESS; -} - -Status ModelCacheHelper::LoadOmModelFromCache(GeModelPtr &ge_model) const { - string cache_om = cache_path_ + to_string(graph_id_) + "_" + to_string(graph_id_run_times_[graph_id_]) + kOmSuffix; - if (!CheckInputPathValid(cache_om)) { - GELOGW("Invalid cache path for input:%s.", cache_om.c_str()); - return FAILED; - } - string om_path = RealPath(cache_om.c_str()); - if (om_path.empty()) { - GELOGW("file path is invalid. please check file om: %s", om_path.c_str()); - return FAILED; - } - GELOGI("load model data from file: %s", om_path.c_str()); - Status ret; - int32_t priority = 0; - ModelData model_data; - ret = ModelParserBase::LoadFromFile(om_path.c_str(), priority, model_data); - if (ret != SUCCESS) { - GELOGW("LoadOmModelFromCache: Load model from file failed. ret = %u", ret); - return ret; - } - std::function callback = [&]() { - if (model_data.model_data != nullptr) { - delete[] reinterpret_cast(model_data.model_data); - model_data.model_data = nullptr; - } - }; - GE_MAKE_GUARD(release, callback); - - ModelHelper model_helper; - ret = model_helper.LoadModel(model_data); - if (ret != SUCCESS) { - GELOGW("LoadOmModelFromCache: Load model from data failed. ret = %u", ret); - return ret; - } - ge_model = model_helper.GetGeModel(); - ret = RecompileNodes(ge_model); - if (ret != SUCCESS) { - GELOGW("LoadOmModelFromCache: recompile nodes failed. ret = %u", ret); - return ret; - } - return SUCCESS; -} - -Status ModelCacheHelper::GetVarNameFromVarKey(const string &var_key, const GeTensorDesc &tensor_desc, - string &var_name) { - std::string::size_type underline_idx = var_key.rfind('_'); - if (underline_idx == std::string::npos) { - GELOGW("Invalid var key: underline not found"); - return FAILED; - } - std::string::size_type format_idx = - var_key.rfind(std::to_string(static_cast(tensor_desc.GetFormat())), underline_idx); - if (format_idx == std::string::npos) { - GELOGW("Invalid var key: format not found"); - return FAILED; - } - var_name = var_key.substr(0, format_idx); - return SUCCESS; -} -} // namespace ge diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h deleted file mode 100755 index f0831075..00000000 --- a/ge/common/helper/model_cache_helper.h +++ /dev/null @@ -1,123 +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_COMMON_HELPER_MODEL_CACHE_HELPER_H_ -#define GE_COMMON_HELPER_MODEL_CACHE_HELPER_H_ - -#include -#include -#include - -#include "external/ge/ge_api_error_codes.h" -#include "graph/compute_graph.h" -#include "graph/manager/graph_var_manager.h" -#include "common/model/ge_model.h" - -namespace ge { -using Json = nlohmann::json; - -struct CacheInfo { - size_t node_num; - size_t edge_num; - size_t graph_hash; - map nodes_hash; - CacheInfo() : node_num(0), edge_num(0), graph_hash(0) {} -}; - -class ModelCacheHelper { - public: - ModelCacheHelper(uint64_t session_id, uint32_t graph_id, ComputeGraphPtr &compute_graph); - ~ModelCacheHelper(); - - Status SaveCacheInfoToCache () const; - Status SaveVarManagerToCache(bool before_build) const; - Status SaveOmModelToCache(const GeModelPtr &ge_model) const; - bool IsModelCacheHit() const; - Status RecoverVarManagerFromCache() const; - Status LoadOmModelFromCache(GeModelPtr &ge_model) const; - Status RefreshComputeGraph(const ComputeGraphPtr &compute_graph); - Status ClearCache(uint32_t graph_id) const; - - private: - Status GetComputeGraphHash(size_t &hash) const; - Status GetNodesHash(map &hash_map) const; - Status GetCacheInfo(CacheInfo &cache_info) const; - - Status RecoverMemResource(const Json &json) const; - Status RecoverAllocatedGraphId(const Json &json) const; - Status RecoverChangedGraphId(const Json &json) const; - Status RecoverVarAddrAndTensorDesc(const Json &json) const; - Status RecoverBroadcastInfo(const Json &json) const; - Status RecoverTransRoads(const Json &json) const; - static Status GetNodesNeedRecompile(ComputeGraphPtr &graph, vector &nodes); - static Status RecompileNodes(GeModelPtr &ge_model); - - bool IsNodeHashSameAsCache(const map &hash_map) const; - bool IsMemResourceSameAsCache(Json &json) const; - bool IsChangedGraphIdSameAsCache(Json &json) const; - bool IsAllocatedGraphIdSameAsCache(Json &json) const; - bool IsCurVarTensorDescSameAsCache(Json &json) const; - bool IsVarAddrMgrMapSameAsCache(Json &json) const; - bool IsBroadcastInfoSameAsCache(Json &json) const; - bool IsTransRoadsSameAsCache(Json &json) const; - bool IsVarManagerSameAsCache(Json &json) const; - bool IsVarManagerParamSameAsCache(Json &json) const; - - Status SaveJsonToFile(const string &file_name, const Json &json) const; - Status LoadJsonFromFile(const string &file_name, Json &json) const; - - Status GetNodesHashMapJson(Json &json) const; - Status GetMemResourceMap(Json &json) const; - Status GetVarAddrMgrMapJson(Json &json) const; - Status GetCurVarTensorDescMapJson(Json &json) const; - Status GetTransRoadsJson(Json &json) const; - Status GetChangedGraphIdJson(Json &json) const; - Status GetAllocatedGraphIdJson(Json &json) const; - Status GetBroadcastInfoJson(Json &json) const; - Status GetVarResourceJson(Json &json) const; - Status GetVarManagerJson(Json &json) const; - - static Status TensorDescToJson(const GeTensorDesc &ge_tensor_desc, Json &json); - static Status JsonToTensorDesc(const Json &json, GeTensorDesc &ge_tensor_desc); - static Status ParseMemResourceFromJson(const Json &json, map &mem_resource); - static Status ParseVarAddrMgrMapFromJson(const Json &json, - std::vector> &var_addr_mgr_vector, - std::set &var_offset_set); - static Status ParseCurVarTensorDescMapFromJson( - const Json &json, std::unordered_map &cur_var_tensor_desc_map); - static Status ParseTransRoadsFromJson(const Json &json, - std::unordered_map> &trans_roads); - static Status ParseChangedGraphIdFromJson(const Json &json, - std::map &changed_graph_id); - static Status ParseAllocatedGraphIdFromJson(const Json &json, - std::map &allocated_graph_id); - static Status ParseBroadcastInfoFromJson(const Json &json, - std::unordered_map &var_broadcast_info); - static Status GetVarNameFromVarKey(const string &var_key, const GeTensorDesc &tensor_desc, string &var_name); - - uint64_t session_id_; - uint32_t graph_id_; - string cache_path_; - ComputeGraphPtr compute_graph_; - std::set var_names_; - bool is_cache_path_valid_for_output; - static map graph_id_run_times_; -}; - -using ModelCacheHelperPtr = std::shared_ptr; -} // namespace ge - -#endif // GE_COMMON_HELPER_MODEL_CACHE_HELPER_H_ diff --git a/ge/executor/ge_executor.cc b/ge/executor/ge_executor.cc index 73cd7bb5..76cde2b9 100755 --- a/ge/executor/ge_executor.cc +++ b/ge/executor/ge_executor.cc @@ -27,6 +27,7 @@ #include "graph/load/graph_loader.h" #include "graph/load/model_manager/model_manager.h" #include "graph/manager/graph_mem_manager.h" +#include "graph/manager/graph_var_manager.h" #include "single_op/single_op_manager.h" #include "graph/load/model_manager/davinci_model.h" #include "opskernel_manager/ops_kernel_builder_manager.h" diff --git a/ge/generator/ge_generator.cc b/ge/generator/ge_generator.cc index 45eaed59..1a80a3e0 100644 --- a/ge/generator/ge_generator.cc +++ b/ge/generator/ge_generator.cc @@ -30,6 +30,7 @@ #include "graph/debug/ge_attr_define.h" #include "graph/ge_context.h" #include "graph/manager/graph_manager.h" +#include "graph/manager/graph_var_manager.h" #include "graph/manager/util/rt_context_util.h" #include "graph/operator_factory_impl.h" #include "graph/opsproto_manager.h" diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 7d72d85b..d1237f4e 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -248,7 +248,6 @@ Status GraphManager::Finalize() { Analyzer::GetInstance()->DestroyGraphJsonObject(session_id, graph_id); } graph_map_.clear(); - cache_helper_map_.clear(); graph_count_.clear(); // graph context @@ -1005,13 +1004,6 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vectorGetGraphId(), compute_graph, ge_model); - if (save_ret != SUCCESS) { - GELOGW("Fail to save cache."); - } GEEVENT("[GEPERFTRACE] GE PreRun End"); return SUCCESS; } @@ -1063,18 +1055,15 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: graph_node->GetGraphId()); return PARAM_INVALID; } - GeModelPtr ge_model = nullptr; - // check need incre build. - ret = IncreBuild(graph_node, ge_model); + + ret = PreRun(graph_node, inputs, ge_root_model, session_id); + // release rts generate context + RtContextUtil::GetInstance().DestroyRtContexts(session_id, graph_node->GetGraphId()); if (ret != SUCCESS) { - ret = PreRun(graph_node, inputs, ge_root_model, session_id); - // release rts generate context - RtContextUtil::GetInstance().DestroyRtContexts(session_id, graph_node->GetGraphId()); - if (ret != SUCCESS) { - GELOGE(ret, "[Call][PreRun] Failed, graph_id:%u, session_id:%lu.", graph_node->GetGraphId(), session_id); - return ret; - } + GELOGE(ret, "[Call][PreRun] Failed, graph_id:%u, session_id:%lu.", graph_node->GetGraphId(), session_id); + return ret; } + ret = LoadGraph(ge_root_model, graph_node); if (ret != SUCCESS) { GELOGE(ret, "[Load][Graph] Failed, graph_id:%u.", graph_node->GetGraphId()); @@ -1104,91 +1093,6 @@ Status GraphManager::LoadGraph(const GeRootModelPtr &ge_root_model, const GraphN return executor_->LoadGraph(ge_root_model, graph_node); } -Status GraphManager::LoadFromCache(const GraphNodePtr &graph_node, const ModelCacheHelperPtr &cache_helper, - GeModelPtr &ge_model) { - auto graph_id = graph_node->GetGraphId(); - auto ret = cache_helper->LoadOmModelFromCache(ge_model); - if (ret != SUCCESS) { - GELOGW("Fail to load om model from cache."); - if (cache_helper->ClearCache(graph_id) != SUCCESS) { - GELOGW("Fail to clear cache of graph %u.", graph_id); - } - return FAILED; - } - ret = cache_helper->RecoverVarManagerFromCache(); - if (ret != SUCCESS) { - GELOGW("Fail to recover VarManager from cache."); - if (cache_helper->ClearCache(graph_id) != SUCCESS) { - GELOGW("Fail to clear cache of graph %u.", graph_id); - } - return FAILED; - } - ComputeGraphPtr compute_graph_in_model = GraphUtils::GetComputeGraph(ge_model->GetGraph()); - if (compute_graph_in_model == nullptr) { - GELOGW("Error occurred when get compute graph from om, abandon."); - return FAILED; - } else { - graph_node->SetComputeGraph(compute_graph_in_model); - graph_node->SetGeModel(ge_model); - GELOGI("Load model and graph form cache om file."); - } - return SUCCESS; -} - -Status GraphManager::SaveCacheBeforeBuild(uint32_t graph_id, const ModelCacheHelperPtr &cache_helper) { - auto ret = cache_helper->SaveCacheInfoToCache(); - if (ret != SUCCESS) { - GELOGW("Fail to save cache info of graph[%d] to cache.", graph_id); - return FAILED; - } - ret = cache_helper->SaveVarManagerToCache(true); - if (ret != SUCCESS) { - GELOGW("Fail to save var manager to cache."); - cache_helper->ClearCache(graph_id); - return FAILED; - } - GELOGI("Cache files have been saved."); - return SUCCESS; -} - -Status GraphManager::SaveCacheAfterBuild(uint32_t graph_id, ge::ComputeGraphPtr graph, GeModelPtr &ge_model) { - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if ((instance_ptr == nullptr) || !instance_ptr->InitFlag()) { - GELOGW("GELib not initialized."); - return FAILED; - } - - if (instance_ptr->IsIncreBuild()) { - std::lock_guard lock(member_mutex_); - auto iter = cache_helper_map_.find(graph_id); - if (iter == cache_helper_map_.end()) { - GELOGW("Can not find ModelCacheHelper of graph[%u]", graph_id); - return FAILED; - } else { - ModelCacheHelperPtr cache_helper = iter->second; - auto ret = cache_helper->RefreshComputeGraph(graph); - if (ret != SUCCESS) { - cache_helper->ClearCache(graph_id); - GELOGW("Fail to refresh cache helper's compute graph"); - return FAILED; - } - ret = cache_helper->SaveVarManagerToCache(false); - if (ret != SUCCESS) { - cache_helper->ClearCache(graph_id); - GELOGW("Fail to save VarManager to cache"); - return FAILED; - } - ret = cache_helper->SaveOmModelToCache(ge_model); - if (ret != SUCCESS) { - cache_helper->ClearCache(graph_id); - GELOGW("Fail to save om model to cache"); - return FAILED; - } - } - } - return SUCCESS; -} - Status GraphManager::InnerRunGraph(GraphNodePtr &graph_node, const GraphId &graph_id, const std::vector &inputs, std::vector &outputs) { GE_CHECK_NOTNULL(executor_); @@ -1239,8 +1143,6 @@ Status GraphManager::RunGraphWithStreamAsync(const GraphId &graph_id, rtStream_t graph_node->SetIsSpecificStream(true); ComputeGraphPtr compute_graph_tmp = GraphUtils::GetComputeGraph(*(graph_node->GetGraph())); - // when set incre build, add cache helper map - AddModelCacheHelperToMap(graph_id, session_id, compute_graph_tmp); if (options_.local_fmk_op_flag) { GetCompilerStages(graph_id).optimizer.TranFrameOp(compute_graph_tmp); } @@ -1299,9 +1201,6 @@ Status GraphManager::RunGraph(const GraphId &graph_id, const std::vector lock(member_mutex_); - auto iter = cache_helper_map_.find(graph_id); - if (iter != cache_helper_map_.end()) { - cache_helper_map_.erase(iter); - } else { - GELOGW("[GraphManager] cache helper does not exist, graph_id = %u", graph_id); - } -} - bool GraphManager::CheckModelLoad(const GeRootModelPtr &ge_root_model, bool load_flag) { return ((ge_root_model != nullptr) && (ge_root_model->GetModelId() != INVALID_MODEL_ID) && load_flag); } @@ -1555,7 +1444,6 @@ Status GraphManager::RemoveGraph(const GraphId &graph_id) { var_acc_ctrl_.RemoveGraph(graph_id); RemoveGraphNode(graph_id); - RemoveModelCacheHelper(graph_id); auto ge_root_model = graph_node->GetGeRootModel(); if (CheckModelLoad(ge_root_model, graph_node->GetLoadFlag())) { @@ -2727,61 +2615,6 @@ Status GraphManager::RunGraphAsync(const GraphId &graph_id, const std::vector instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr != nullptr && instance_ptr->IsIncreBuild()) { - std::lock_guard lock(member_mutex_); - auto iter = cache_helper_map_.find(graph_id); - if (iter == cache_helper_map_.end()) { - ModelCacheHelperPtr cache_helper = MakeShared(session_id, graph_id, compute_graph); - if (cache_helper != nullptr) { - cache_helper_map_.emplace(std::make_pair(graph_id, cache_helper)); - } else { - GELOGW("Cache helper make shared failed, graph_id = %u.", graph_id); - } - } - } -} - -ModelCacheHelperPtr GraphManager::FindModelCacheHelper(GraphId graph_id) { - std::lock_guard lock(member_mutex_); - auto iter = cache_helper_map_.find(graph_id); - if (iter != cache_helper_map_.end()) { - return iter->second; - } - - return nullptr; -} - -Status GraphManager::IncreBuild(const GraphNodePtr &graph_node, GeModelPtr &ge_model) { - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->IsIncreBuild()) { - return FAILED; - } - const uint32_t graph_id = graph_node->GetGraphId(); - ModelCacheHelperPtr cache_helper = FindModelCacheHelper(graph_id); - if (cache_helper == nullptr) { - GELOGW("Can not find ModelCacheHelper of graph[%u]", graph_id); - return FAILED; - } - if (cache_helper->IsModelCacheHit()) { - GEEVENT("Model cache hit."); - Status ret = LoadFromCache(graph_node, cache_helper, ge_model); - if (ret == SUCCESS) { - return SUCCESS; - } else { - GELOGW("Error occurred when load from cache, abandon."); - } - } else { - GEEVENT("Model cache miss."); - } - if (SaveCacheBeforeBuild(graph_node->GetGraphId(), cache_helper) != SUCCESS) { - GELOGW("Error occurred when save cache."); - } - return FAILED; -} - Status GraphManager::CheckIncreBuildAndPreRun(const PreRunArgs &args, GraphNodePtr &graph_node, GeRootModelPtr &ge_root_model) { if (!IsGraphNeedBuild(graph_node)) { @@ -2796,20 +2629,18 @@ Status GraphManager::CheckIncreBuildAndPreRun(const PreRunArgs &args, return PARAM_INVALID; } // check need incre build. - GeModelPtr ge_model = nullptr; - if (IncreBuild(graph_node, ge_model) != SUCCESS) { - std::vector ge_inputs; - for (const auto &item: args.input_tensor) { - ge_inputs.emplace_back(TensorAdapter::AsGeTensor(item)); - } - Status ret = PreRun(graph_node, ge_inputs, ge_root_model, args.session_id); - // release rts generate context - RtContextUtil::GetInstance().DestroyRtContexts(args.session_id, graph_node->GetGraphId()); - if (ret != SUCCESS) { - ReturnError(args.callback, ret, "PreRun Failed."); - return ret; - } + std::vector ge_inputs; + for (const auto &item: args.input_tensor) { + ge_inputs.emplace_back(TensorAdapter::AsGeTensor(item)); } + Status ret = PreRun(graph_node, ge_inputs, ge_root_model, args.session_id); + // release rts generate context + RtContextUtil::GetInstance().DestroyRtContexts(args.session_id, graph_node->GetGraphId()); + if (ret != SUCCESS) { + ReturnError(args.callback, ret, "PreRun Failed."); + return ret; + } + graph_node->SetBuildFlag(true); var_acc_ctrl_.SetGraphBuildEnd(graph_node->GetGraphId()); return SUCCESS; @@ -2878,10 +2709,6 @@ void GraphManager::PreRunThread() { graph_node->Unlock(); return; } - // when set incre build, save cache helper. - AddModelCacheHelperToMap(args.graph_id, args.session_id, compute_graph_tmp); - - std::vector ge_models; if (options_.local_fmk_op_flag) { GetCompilerStages(graph_node->GetGraphId()).optimizer.TranFrameOp(compute_graph_tmp); diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 84d2b11e..e7cd88a9 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -27,7 +27,6 @@ #include "common/blocking_queue.h" #include "framework/common/ge_inner_error_codes.h" -#include "common/helper/model_cache_helper.h" #include "external/graph/types.h" #include "external/ge/ge_api_types.h" #include "graph/build/graph_builder.h" @@ -339,14 +338,6 @@ class GraphManager { bool IsGraphNeedBuild(const GraphNodePtr &graph_node); - Status LoadFromCache(const GraphNodePtr &graph_node, const ModelCacheHelperPtr &cache_helper, GeModelPtr &ge_model); - Status SaveCacheBeforeBuild(uint32_t graph_id, const ModelCacheHelperPtr &cache_helper); - Status SaveCacheAfterBuild(uint32_t graph_id, ComputeGraphPtr graph, GeModelPtr &ge_model); - void AddModelCacheHelperToMap(const GraphId &graph_id, uint64_t session_id, ComputeGraphPtr &compute_graph); - Status IncreBuild(const GraphNodePtr &graph_node, GeModelPtr &ge_model); - void RemoveModelCacheHelper(const GraphId &graph_id); - ModelCacheHelperPtr FindModelCacheHelper(GraphId graph_id); - void SetRunContext(const GraphNodePtr &graph_node); void PushGraph(const RunArgs &args); @@ -411,7 +402,6 @@ class GraphManager { std::thread prerun_thread_; ComputeGraphPtr compute_graph_; std::map graph_map_; - std::map cache_helper_map_; // summary and checkpoint callback function list for ME, key is summary or checkpoint std::map &)>> me_callback_map_; diff --git a/ge/graph/manager/graph_manager_utils.cc b/ge/graph/manager/graph_manager_utils.cc index 42251b10..225a748a 100644 --- a/ge/graph/manager/graph_manager_utils.cc +++ b/ge/graph/manager/graph_manager_utils.cc @@ -70,45 +70,9 @@ void GraphNode::IncreaseLoadCount() { ++load_count_; } -SubGraphInfo::SubGraphInfo() : subgraph_ptr_(nullptr), ge_model_ptr_(nullptr), malloc_flag_(false) {} +SubGraphInfo::SubGraphInfo() : subgraph_ptr_(nullptr), ge_model_ptr_(nullptr) {} SubGraphInfo::~SubGraphInfo() { - if (malloc_flag_) { - for (auto &buffer_addr : buffer_addr_) { - if (buffer_addr == nullptr) { - continue; - } - rtError_t rt_ret; - rt_ret = rtFreeHost(buffer_addr); - buffer_addr = nullptr; - if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "[Call][RtFreeHost] subgraph free buffer failed, modelId = %u", - model_id_info_.model_id); - } - } - } -} - -Status SubGraphInfo::FreeInOutBuffer() { - if (malloc_flag_) { - for (auto iter = buffer_addr_.begin(); iter != buffer_addr_.end(); ++iter) { - rtError_t rt_ret; - rt_ret = rtFreeHost(*iter); - if (rt_ret != RT_ERROR_NONE) { - REPORT_CALL_ERROR("E19999", "Call rtFreeHost fail, ret:%d", rt_ret); - GELOGE(rt_ret, "[Call][RtFreeHost] subgraph free buffer failed, modelId = %u", model_id_info_.model_id); - buffer_addr_.erase(buffer_addr_.begin(), iter); - return GE_GRAPH_FREE_FAILED; - } - } - buffer_addr_.clear(); - - malloc_flag_ = false; - return SUCCESS; - } else { - GELOGI("[GraphManager] not malloc buffer, modelId = %u", model_id_info_.model_id); - return SUCCESS; - } } GraphModelListener::GraphModelListener(std::mutex &mutex, std::condition_variable &cond) diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index 14eb67f2..efdbecf8 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -86,8 +86,6 @@ class SubGraphInfo { void SetGeModelPtr(const GeModelPtr &ge_model_ptr) { ge_model_ptr_ = ge_model_ptr; } bool GeModelIsValid() const { return ge_model_ptr_ != nullptr; } - Status FreeInOutBuffer(); - void SetOutputContext(const std::string &output) { output_names_ = output; } std::string GetOutputContext() const { return output_names_; } diff --git a/ge/graph/manager/graph_var_manager.cc b/ge/graph/manager/graph_var_manager.cc index d0669254..ce5b335e 100755 --- a/ge/graph/manager/graph_var_manager.cc +++ b/ge/graph/manager/graph_var_manager.cc @@ -429,10 +429,6 @@ ge::Status VarManager::GetVarAddr(const std::string &var_name, const ge::GeTenso return GetVarAddr(var_name, tensor_desc, dev_ptr, memory_type); } -void VarManager::GetAllVarAddrMgr(std::unordered_map &var_addr_mgr_map) { - var_resource_->GetAllVarAddrMgr(var_addr_mgr_map); -} - int64_t VarManager::GetVarMemSize(rtMemType_t memory_type) { std::lock_guard lock(mutex_); MemResource *mem_resource = nullptr; @@ -453,36 +449,6 @@ int64_t VarManager::GetVarMemSize(rtMemType_t memory_type) { return mem_resource->GetVarMemSize(); } -Status VarManager::UpdateVarMemSize(rtMemType_t memory_type, int64_t mem_size) { - std::lock_guard lock(mutex_); - MemResource *mem_resource = nullptr; - auto iter = mem_resource_map_.find(memory_type); - if (iter == mem_resource_map_.end()) { - mem_resource = MemResource::BuildMemResourceFromType(memory_type); - if (mem_resource == nullptr) { - REPORT_CALL_ERROR("E19999", "memory_type:%d invalid or New MemResource fail, session_id:%lu", - memory_type, session_id_); - GELOGE(ge::INTERNAL_ERROR, "[Alloc][MemResource] failed, memory_type:%u, session_id:%lu", - memory_type, session_id_); - return ge::INTERNAL_ERROR; - } else { - mem_resource_map_[memory_type] = mem_resource; - } - } else { - mem_resource = iter->second; - } - - if (mem_resource == nullptr) { - REPORT_INNER_ERROR("E19999", "MemResource is invalid, memory_type:%d, session_id:%lu", - memory_type, session_id_); - GELOGE(ge::INTERNAL_ERROR, "[Check][Param] MemResource is invalid, memory_type:%u, session_id:%lu", - memory_type, session_id_); - return FAILED; - } - mem_resource->UpdateVarMemSize(mem_size); - return SUCCESS; -} - ge::Status VarManager::AssignVarMem(const std::string &var_name, const ge::GeTensorDesc &tensor_desc, rtMemType_t memory_type) { std::lock_guard lock(mutex_); @@ -638,16 +604,6 @@ ge::Status VarManager::SaveBroadCastInfo(uint32_t graph_id, const VarBroadCastIn return SUCCESS; } -ge::Status VarManager::GetBroadCastInfo(uint32_t graph_id, const string &var_name, VarBroadCastInfo &broad_cast_info) { - std::lock_guard lock(mutex_); - - if (var_resource_ == nullptr) { - GELOGW("VarManager has not been init."); - return ge::INTERNAL_ERROR; - } - return var_resource_->GetBroadCastInfo(graph_id, var_name, broad_cast_info); -} - ge::Status VarManager::RenewCurVarDesc(const std::string &var_name, ge::OpDescPtr op_desc) { std::lock_guard lock(mutex_); GELOGD("VarManager::RenewCurVarDesc var_name = %s.", var_name.c_str()); diff --git a/ge/graph/manager/graph_var_manager.h b/ge/graph/manager/graph_var_manager.h index a1b45959..f0e3b89b 100755 --- a/ge/graph/manager/graph_var_manager.h +++ b/ge/graph/manager/graph_var_manager.h @@ -223,14 +223,10 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY VarManager { ge::Status GetVarAddr(const std::string &var_name, const ge::GeTensorDesc &tensor_desc, uint8_t **dev_ptr, rtMemType_t &memory_type); - void GetAllVarAddrMgr(std::unordered_map &var_addr_mgr_map); - ge::Status GetVarAddr(const std::string &var_name, const ge::GeTensorDesc &tensor_desc, uint8_t **dev_ptr); ge::Status SaveBroadCastInfo(uint32_t graph_id, const VarBroadCastInfo &broad_cast_info); - ge::Status GetBroadCastInfo(uint32_t graph_id, const string &var_name, VarBroadCastInfo &broad_cast_info); - ge::Status GetCurVarDesc(const std::string &var_name, ge::GeTensorDesc &tensor_desc); ge::Status RenewCurVarDesc(const std::string &var_name, ge::OpDescPtr op_desc); @@ -273,8 +269,6 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY VarManager { int64_t GetVarMemSize(rtMemType_t memory_type); - Status UpdateVarMemSize(rtMemType_t memory_type, int64_t mem_size); - bool IsVarExist(const std::string &var_name, const ge::GeTensorDesc &tensor_desc); bool IsVarExist(const std::string &var_name); diff --git a/ge/graph/manager/model_manager/event_manager.cc b/ge/graph/manager/model_manager/event_manager.cc deleted file mode 100644 index 339e9894..00000000 --- a/ge/graph/manager/model_manager/event_manager.cc +++ /dev/null @@ -1,83 +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 "graph/manager/model_manager/event_manager.h" - -#define RETURN_IF_COND_NOT_MET(condition, ...) \ - do { \ - if (!(condition)) { \ - GELOGE(FAILED, __VA_ARGS__); \ - return; \ - } \ - } while (0); - -namespace ge { -Status EventManager::Init(size_t event_num) { - if (this->inited_) { - return SUCCESS; - } - - rtEvent_t event = nullptr; - current_idx_ = 0; - for (size_t i = 0; i < event_num; ++i) { - GE_CHK_RT_RET(rtEventCreate(&event)); - this->event_list_.push_back(event); - } - - this->inited_ = true; - - return SUCCESS; -} - -void EventManager::Release() noexcept { - for (size_t i = 0; i < this->event_list_.size(); ++i) { - rtError_t rt_ret = rtEventDestroy(this->event_list_[i]); - RETURN_IF_COND_NOT_MET(rt_ret == RT_ERROR_NONE, "[Destroy][Event] failed, idx is %zu, ret is 0x%x.", i, rt_ret); - } - this->event_list_.clear(); - - this->inited_ = false; -} - -Status EventManager::EventRecord(size_t event_idx, rtStream_t stream) { - GE_CHK_BOOL_RET_STATUS_NOLOG(this->inited_, INTERNAL_ERROR); - - GE_CHK_BOOL_RET_STATUS_NOLOG(event_idx < this->event_list_.size(), PARAM_INVALID); - - GE_CHK_RT_RET(rtEventRecord(this->event_list_[event_idx], stream)); - - current_idx_ = static_cast(event_idx); - return SUCCESS; -} - -Status EventManager::EventElapsedTime(size_t start_event_idx, size_t stop_event_idx, float &time) { - GE_CHK_BOOL_RET_STATUS_NOLOG(this->inited_, INTERNAL_ERROR); - - GE_CHK_BOOL_RET_STATUS_NOLOG(start_event_idx < this->event_list_.size() && - stop_event_idx < this->event_list_.size() && start_event_idx <= stop_event_idx, - PARAM_INVALID); - - GE_CHK_RT_RET(rtEventElapsedTime(&time, this->event_list_[start_event_idx], this->event_list_[stop_event_idx])); - - return SUCCESS; -} - -Status EventManager::GetEvent(uint32_t index, rtEvent_t &event) { - GE_CHK_BOOL_RET_STATUS_NOLOG(index < this->event_list_.size(), PARAM_INVALID); - event = this->event_list_[index]; - return SUCCESS; -} -} // namespace ge diff --git a/ge/graph/manager/model_manager/event_manager.h b/ge/graph/manager/model_manager/event_manager.h deleted file mode 100644 index 2cb1c3f6..00000000 --- a/ge/graph/manager/model_manager/event_manager.h +++ /dev/null @@ -1,98 +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_GRAPH_MANAGER_MODEL_MANAGER_EVENT_MANAGER_H_ -#define GE_GRAPH_MANAGER_MODEL_MANAGER_EVENT_MANAGER_H_ - - -#include - -#include "framework/common/fmk_error_codes.h" -#include "framework/common/fmk_types.h" -#include "framework/common/util.h" -#include "runtime/event.h" - -namespace ge { -class EventManager { - public: - /// - /// @ingroup domi_ome - /// @brief constructor - /// - EventManager() : inited_(false), current_idx_(0) {} - /// - /// @ingroup domi_ome - /// @brief destructor - /// - ~EventManager() { this->Release(); } - - /// - /// @ingroup domi_ome - /// @brief init and create event list - /// @param [in] event_num event number created - /// @return exec result - /// - Status Init(size_t event_num); - - /// - /// @ingroup domi_ome - /// @brief event record - /// @param [in] event_idx event index - /// @param [in] stream related stream - /// @return exec result - /// - Status EventRecord(size_t event_idx, rtStream_t stream); - - /// - /// @ingroup domi_ome - /// @brief time between start and end in ms - /// @param [in] start_event_idx start event index - /// @param [in] stop_event_idx stop event index - /// @param [out] time - /// @return exec result - /// - Status EventElapsedTime(size_t start_event_idx, size_t stop_event_idx, float &time); - - /// - /// @ingroup domi_ome - /// @brief current event index - /// @return - /// - uint32_t CurrentIdx() const { return current_idx_; } - - /// - /// @ingroup domi_ome - /// @brief get event at specific loc - /// @param [in] index event index - /// @return - /// - Status GetEvent(uint32_t index, rtEvent_t &event); - - /// - /// @ingroup domi_ome - /// @brief release event list - /// @param [in] - /// @return - /// - void Release() noexcept; - - private: - std::vector event_list_; - bool inited_; - uint32_t current_idx_; -}; // EventManager -} // namespace ge -#endif // GE_GRAPH_MANAGER_MODEL_MANAGER_EVENT_MANAGER_H_ diff --git a/ge/graph/manager/trans_var_data_utils.h b/ge/graph/manager/trans_var_data_utils.h index 174efbb3..f5a89a50 100755 --- a/ge/graph/manager/trans_var_data_utils.h +++ b/ge/graph/manager/trans_var_data_utils.h @@ -24,7 +24,6 @@ #include "graph/utils/tensor_utils.h" #include "graph/node.h" #include "runtime/context.h" -#include "graph/manager/graph_var_manager.h" namespace ge { class TransVarDataUtils { diff --git a/ge/graph/passes/global_step_insert_pass.cc b/ge/graph/passes/global_step_insert_pass.cc index 297e4ee2..ada4e12a 100755 --- a/ge/graph/passes/global_step_insert_pass.cc +++ b/ge/graph/passes/global_step_insert_pass.cc @@ -24,7 +24,6 @@ #include "framework/common/util.h" #include "graph/debug/ge_attr_define.h" #include "common/ge/ge_util.h" -#include "graph/manager/graph_var_manager.h" #include "graph/passes/pass_utils.h" #include "graph/ge_context.h" diff --git a/ge/init/gelib.h b/ge/init/gelib.h index 5e66be51..226dd4c8 100644 --- a/ge/init/gelib.h +++ b/ge/init/gelib.h @@ -28,7 +28,6 @@ #include "graph/debug/ge_attr_define.h" #include "graph/utils/graph_utils.h" #include "graph/utils/anchor_utils.h" -#include "graph/manager/graph_var_manager.h" #include "framework/common/ge_inner_error_codes.h" #include "framework/common/ge_types.h" @@ -63,13 +62,7 @@ class GE_FUNC_VISIBILITY GELib { bool InitFlag() const { return init_flag_; } // get TrainMode flag - bool isTrainMode() { return is_train_mode_; } - - // get incre build flag - bool IsIncreBuild() const { return is_incre_build_; } - - // get incre build cache path - const std::string &GetIncreBuildCachePath() const { return incre_build_cache_path_; } + bool IsTrainMode() { return is_train_mode_; } void InitProfiling(Options &options); void ShutDownProfiling(); @@ -100,8 +93,6 @@ class GE_FUNC_VISIBILITY GELib { bool is_system_inited = false; bool is_shutdown = false; bool is_use_hcom = false; - bool is_incre_build_ = false; - std::string incre_build_cache_path_; }; } // namespace ge diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 49c9161d..a0790cf2 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -140,7 +140,6 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/optimize/graph_optimize.cc" "${GE_CODE_DIR}/ge/graph/build/graph_builder.cc" "${GE_CODE_DIR}/ge/graph/partition/graph_partition.cc" - "${GE_CODE_DIR}/ge/common/helper/model_cache_helper.cc" "${GE_CODE_DIR}/ge/ir_build/ge_ir_build.cc" "${GE_CODE_DIR}/ge/ir_build/attr_options/utils.cc" "${GE_CODE_DIR}/ge/ir_build/attr_options/keep_dtype_option.cc" @@ -248,7 +247,6 @@ set(GRAPH_DAVINCI_MODEL_SRC_FILES "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc" "${GE_CODE_DIR}/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc" - "${GE_CODE_DIR}/ge/graph/manager/model_manager/event_manager.cc" ) set(GRAPH_EXECUTE_COMMON_SRC_FILES @@ -520,13 +518,9 @@ set(COMMON_TEST_FILES set(DISTINCT_GRAPH_LOAD_TEST_FILES "graph/load/data_dumper_unittest.cc" - #"graph/load/new_model_manager_data_inputer_unittest.cc" - #"graph/load/new_model_manager_davinci_model_unittest.cc" "graph/load/model_manager_unittest.cc" "graph/load/new_model_manager_model_manager_aicpu_unittest.cc" "graph/load/end_graph_task_unittest.cc" - "graph/load/new_model_manager_event_manager_unittest.cc" - #"graph/load/output_net_output_unittest.cc" "graph/load/davinci_model_unittest.cc" "graph/load/tbe_handle_store_unittest.cc" "graph/load/hccl_task_info_unittest.cc" @@ -536,7 +530,6 @@ set(DISTINCT_GRAPH_LOAD_TEST_FILES "graph/load/memcpy_addr_async_task_info_unittest.cc" "graph/load/memcpy_async_task_info_unittest.cc" "graph/load/cpu_queue_schedule_unittest.cc" - #"graph/graph_load_unittest.cc" "graph/ge_executor_unittest.cc" "graph/load/model_helper_unittest.cc" "graph/load/model_utils_unittest.cc" diff --git a/tests/ut/ge/graph/execute/model_executor_unittest.cc b/tests/ut/ge/graph/execute/model_executor_unittest.cc index d4e0e3a4..cd907e99 100644 --- a/tests/ut/ge/graph/execute/model_executor_unittest.cc +++ b/tests/ut/ge/graph/execute/model_executor_unittest.cc @@ -20,6 +20,7 @@ #define private public #include "graph/execute/model_executor.h" #include "graph/manager/graph_manager.h" +#include "graph/manager/graph_var_manager.h" #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/davinci_model.h" diff --git a/tests/ut/ge/graph/graph_load_unittest.cc b/tests/ut/ge/graph/graph_load_unittest.cc deleted file mode 100644 index 93282a5e..00000000 --- a/tests/ut/ge/graph/graph_load_unittest.cc +++ /dev/null @@ -1,93 +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 -#include -#include -#include -#include - -#include "common/debug/log.h" -#include "common/helper/model_helper.h" -#include "common/op/ge_op_utils.h" -#include "common/types.h" -#include "graph/op_desc.h" -#include "graph/types.h" -#include "graph/utils/attr_utils.h" -#include "graph/utils/op_desc_utils.h" - -#define protected public -#define private public -#include "graph/load/graph_loader.h" - -#include "framework/common/ge_inner_error_codes.h" -#include "graph/load/model_manager/model_manager.h" -#include "graph/manager/graph_manager_utils.h" -#include "common/model/ge_model.h" -#undef private -#undef protected - -using namespace testing; -namespace ge { - -class UtestGraphGraphLoad : public testing::Test { - protected: - void SetUp() {} - - void TearDown() {} -}; - -TEST_F(UtestGraphGraphLoad, load_graph_param_invalid1) { - std::shared_ptr graph_run_listener = nullptr; - SubGraphInfo sub_graph1; - ge::SubGraphInfoPtr sub_graph_ptr1 = std::make_shared(sub_graph1); - ModelIdInfo model_Id_info; - model_Id_info.model_id = 1; - - GeModelPtr ge_model_ptr = std::make_shared(); - sub_graph_ptr1->SetGeModelPtr(ge_model_ptr); - - std::vector input_flag; - input_flag.push_back(false); - sub_graph_ptr1->SetInputFlag(input_flag); - - ge::GraphLoader graph_load; - EXPECT_EQ(GE_GRAPH_PARAM_NULLPTR, graph_load.LoadGraph(sub_graph_ptr1->ge_model_ptr_, graph_run_listener, model_Id_info)); - sub_graph_ptr1->SetModelIdInfo(model_Id_info); -} - -TEST_F(UtestGraphGraphLoad, load_graph_param_invalid2) { - std::mutex sync_run_mutex; - std::condition_variable condition; - std::shared_ptr listener = std::make_shared(sync_run_mutex, condition); - - SubGraphInfo sub_graph1; - ge::SubGraphInfoPtr sub_graph_ptr1 = std::make_shared(sub_graph1); - ModelIdInfo model_Id_info; - model_Id_info.model_id = 1; - - GeModelPtr ge_model_ptr = std::make_shared(); - sub_graph_ptr1->SetGeModelPtr(ge_model_ptr); - - std::vector input_flag; - input_flag.push_back(false); - sub_graph_ptr1->SetInputFlag(input_flag); - - ge::GraphLoader graph_load; - EXPECT_EQ(GE_GRAPH_PARAM_NULLPTR, graph_load.LoadGraph(sub_graph_ptr1->ge_model_ptr_, listener, model_Id_info)); - sub_graph_ptr1->SetModelIdInfo(model_Id_info); -} -} // namespace ge diff --git a/tests/ut/ge/graph/load/new_model_manager_data_inputer_unittest.cc b/tests/ut/ge/graph/load/new_model_manager_data_inputer_unittest.cc deleted file mode 100644 index 43c2ad15..00000000 --- a/tests/ut/ge/graph/load/new_model_manager_data_inputer_unittest.cc +++ /dev/null @@ -1,64 +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 - -#include "graph/load/model_manager/data_inputer.h" - -#include "common/debug/log.h" -#include "common/debug/memory_dumper.h" -#include "common/types.h" -#include "new_op_test_utils.h" - -using namespace std; -using namespace testing; - -namespace ge { - -class UtestModelManagerDataInputer : public testing::Test { - protected: - void SetUp() {} - - void TearDown() {} -}; - -/// InputDataWrapper -/// constructor -/// GetInput -TEST_F(UtestModelManagerDataInputer, inputdatawrapper_construct) { - InputDataWrapper *input_data_wrapper = new InputDataWrapper(); - - input_data_wrapper->GetInput(); - - delete input_data_wrapper; -} - -/// InputDataWrapper -/// Init func with correct input -TEST_F(UtestModelManagerDataInputer, success_inputdatawrapper_init) { - InputDataWrapper *input_data_wrapper = new InputDataWrapper(); - ge::InputData input_data; - ge::OutputData output_data; - Status ret = input_data_wrapper->Init(input_data, output_data); - - EXPECT_EQ(ret, SUCCESS); - - delete input_data_wrapper; - input_data_wrapper = NULL; -} - -} // namespace ge diff --git a/tests/ut/ge/graph/load/new_model_manager_davinci_model_unittest.cc b/tests/ut/ge/graph/load/new_model_manager_davinci_model_unittest.cc deleted file mode 100644 index 38a250ad..00000000 --- a/tests/ut/ge/graph/load/new_model_manager_davinci_model_unittest.cc +++ /dev/null @@ -1,1433 +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 -#include "common/debug/log.h" -#include "common/debug/memory_dumper.h" -#include "common/types.h" - -#define private public -#define protected public -#include "graph/compute_graph.h" -#include "graph/utils/graph_utils.h" -#include "graph/model_serialize.h" -#include "graph/load/model_manager/davinci_model.h" -#include "common/properties_manager.h" -#include "common/op/ge_op_utils.h" -#include -#include "runtime/dev.h" -#include "runtime/kernel.h" -#include "cce/fwk_adpt_struct.h" -#include "graph/load/model_manager/task_info/task_info_factory.h" -#include "graph/load/model_manager/task_info/task_info.h" -#include "graph/load/model_manager/task_info/stream_active_task_info.h" -#include "graph/load/model_manager/task_info/stream_switch_task_info.h" -#include "graph/load/model_manager/task_info/profiler_trace_task_info.h" -#include "graph/load/model_manager/task_info/memcpy_async_task_info.h" -#include "graph/load/model_manager/task_info/label_set_task_info.h" -#include "graph/load/model_manager/task_info/kernel_ex_task_info.h" -#include "graph/load/model_manager/task_info/kernel_task_info.h" -#include "graph/load/model_manager/task_info/hccl_task_info.h" -#include "graph/load/model_manager/task_info/fusion_start_task_info.h" -#include "graph/load/model_manager/task_info/fusion_stop_task_info.h" -#include "graph/load/model_manager/task_info/event_record_task_info.h" -#include "graph/load/model_manager/task_info/event_wait_task_info.h" -#include "graph/manager/graph_var_manager.h" -#include "graph/load/model_manager/model_manager.h" -#undef private -#undef protected - -#include "new_op_test_utils.h" -#include "graph/debug/ge_attr_define.h" -using namespace std; -using namespace testing; -using domi::EventExDef; -using domi::KernelContext; -using domi::KernelDef; -using domi::LogTimeStampDef; -using domi::ModelTaskDef; -using domi::StreamActiveDef; -using domi::TaskDef; - -namespace ge { -class UtestModelManagerDavinciModel : public testing::Test { - protected: - void SetUp() {} - - void TearDown() {} -}; - -class DModelListener : public ge::ModelListener { - public: - DModelListener(){}; - uint32_t OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t resultCode) { - GELOGI("In Call back. OnComputeDone"); - return 0; - } -}; - -shared_ptr g_label_call_back(new DModelListener()); - -static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { - auto op_desc = std::make_shared(name, type); - op_desc->SetStreamId(0); - op_desc->SetId(0); - - ge::AttrUtils::SetFloat(op_desc, ge::ATTR_NAME_ALPHA, 0); - ge::AttrUtils::SetFloat(op_desc, ge::ATTR_NAME_BETA, 0); - - op_desc->SetWorkspace({}); - ; - op_desc->SetWorkspaceBytes({}); - op_desc->SetInputOffset({}); - op_desc->SetOutputOffset({}); - - ge::AttrUtils::SetListStr(op_desc, ge::ATTR_NAME_WEIGHT_NAME, {}); - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_MODE, 0); - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_PAD_MODE, 0); - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_DATA_MODE, 0); - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_CEIL_MODE, 0); - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_NAN_OPT, 0); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_WINDOW, {}); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_PAD, {}); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_STRIDE, {}); - ge::AttrUtils::SetListInt(op_desc, ge::ATTR_NAME_ACTIVE_STREAM_LIST, {1, 1}); - ge::AttrUtils::SetInt(op_desc, ge::ATTR_NAME_STREAM_SWITCH_COND, 0); - ge::AttrUtils::SetInt(op_desc, ge::ATTR_NAME_FRAMEWORK_FWK_TYPE, FMK_TYPE_T); - return op_desc; -} - -// tset failed_rt_free_host -TEST_F(UtestModelManagerDavinciModel, failed_rt_free_host) { - DavinciModel model(0, g_label_call_back); - - OutputData output_data; - - auto op_desc = CreateOpDesc("Pooling", "Pooling"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 1, 1})); - ge::TensorUtils::SetSize(in_desc, 16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 1, 1})); - ge::TensorUtils::SetSize(out_desc, 16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_PAD_MODE, cce::CC_PADDING_DIRECTASSIGN); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_PAD, vector({1, 1, 1, 1})); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_WINDOW, vector({1, 1})); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_STRIDE, vector({1, 1})); - - auto compute_graph = make_shared("g"); - auto node = compute_graph->AddNode(op_desc); - - OmeTestOpUtils::InitModel(model); - - model.data_op_list_.push_back(op_desc); - - EXPECT_EQ(ge::INTERNAL_ERROR, model.ReturnResult(1, false, false, &output_data)); -} - -// test modeldef_fail -TEST_F(UtestModelManagerDavinciModel, contruct_modeldef_createfail) { - DavinciModel model(0, g_label_call_back); - - OmeTestOpUtils::InitModel(model); - - auto op_desc = CreateOpDesc("Pooling", "Pooling"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 1, 1})); - ge::TensorUtils::SetSize(in_desc, 16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 1, 1})); - ge::TensorUtils::SetSize(out_desc, 16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - ge::AttrUtils::SetInt(op_desc, ge::POOLING_ATTR_PAD_MODE, cce::CC_PADDING_DIRECTASSIGN); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_PAD, vector({1, 1, 1, 1})); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_WINDOW, vector({1, 1})); - ge::AttrUtils::SetListInt(op_desc, ge::POOLING_ATTR_STRIDE, vector({1, 1})); - - model.GetEventList(); -} - -// test CopyInputDataToModel -TEST_F(UtestModelManagerDavinciModel, copy_input_data_to_model_fail) { - DavinciModel model(0, g_label_call_back); - - ge::InputData input_data; - ge::DataBuffer data_buffer; - data_buffer.data = new char[16]; - data_buffer.length = 16; - input_data.index = 0; - input_data.model_id = 1; - input_data.blobs.push_back(data_buffer); - - model.op_list_.clear(); - - delete[](char *) data_buffer.data; -} - -// test StreamNum -TEST_F(UtestModelManagerDavinciModel, streamnum_success) { - DavinciModel *model = new DavinciModel(0, g_label_call_back); - - OmeTestOpUtils::InitModel(*model); - - EXPECT_EQ(0, model->StreamNum()); - EXPECT_EQ(ge::INTERNAL_ERROR, model->ModelRunStart()); - - EXPECT_EQ(ge::SUCCESS, model->ModelRunStop()); - - delete model; -} - -// test EventNum -TEST_F(UtestModelManagerDavinciModel, eventnum_success) { - DavinciModel *model = new DavinciModel(0, g_label_call_back); - - OmeTestOpUtils::InitModel(*model); - - EXPECT_EQ(0, model->EventNum()); - EXPECT_EQ(ge::INTERNAL_ERROR, model->ModelRunStart()); - - EXPECT_EQ(ge::SUCCESS, model->ModelRunStop()); - - delete model; -} - -TEST_F(UtestModelManagerDavinciModel, handlelist_success) { - DavinciModel *model = new DavinciModel(0, g_label_call_back); - - OmeTestOpUtils::InitModel(*model); - - EXPECT_EQ(ge::INTERNAL_ERROR, model->ModelRunStart()); - - EXPECT_EQ(ge::SUCCESS, model->ModelRunStop()); - - delete model; -} - -// test GetEventList -TEST_F(UtestModelManagerDavinciModel, eventlist_success) { - DavinciModel *model = new DavinciModel(0, g_label_call_back); - - OmeTestOpUtils::InitModel(*model); - - EXPECT_EQ(true, model->GetEventList().empty()); - EXPECT_EQ(ge::INTERNAL_ERROR, model->ModelRunStart()); - - EXPECT_EQ(ge::SUCCESS, model->ModelRunStop()); - - delete model; -} - -// test Shrink -TEST_F(UtestModelManagerDavinciModel, shrink_success) { - DavinciModel model(0, g_label_call_back); - OpDescPtr op_desc_ptr = make_shared("Cast", "Cast"); - void *addr = nullptr; - rtMalloc(&addr, 128, RT_MEMORY_HBM); - model.saved_task_addrs_.emplace(op_desc_ptr, addr); - model.Shrink(); - EXPECT_EQ(model.saved_task_addrs_.isEmpty(), true); -} - -// test rtMalloc -TEST_F(UtestModelManagerDavinciModel, failed_reset_device) { - DavinciModel model(0, g_label_call_back); - ge::OutputData output_data; - ge::DataBuffer buf_data; - rtMalloc(&buf_data.data, 128, RT_MEMORY_HBM); - buf_data.length = 128; - output_data.blobs.push_back(buf_data); - EXPECT_EQ(ge::INTERNAL_ERROR, model.ReturnResult(1, true, false, &output_data)); - rtFree(buf_data.data); -} - -// test priority -TEST_F(UtestModelManagerDavinciModel, init_not_support_priority) { - int32_t priority = 8; - DavinciModel model(priority, g_label_call_back); -} - -// test GetInputOutputDescInfo -TEST_F(UtestModelManagerDavinciModel, success_GetInputOutputDescInfo_without_netoutput) { - DavinciModel model(0, g_label_call_back); - - auto op_desc = CreateOpDesc("Data", "Data"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - op_desc->SetStreamId(0); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - - op_desc->SetSrcName({"Pooling1", "Pooling0"}); - op_desc->SetSrcIndex({0, 1}); - - auto compute_graph = make_shared("g"); - auto node = compute_graph->AddNode(op_desc); - - model.data_op_list_.push_back(op_desc); - model.output_size_list_.push_back(32); - - model.op_list_[0] = op_desc; - - model.output_op_list_.push_back(op_desc); - - vector input_shapes; - vector output_shapes; - EXPECT_EQ(ge::SUCCESS, model.GetInputOutputDescInfo(input_shapes, output_shapes)); -} - -TEST_F(UtestModelManagerDavinciModel, CopyTensorFromSrcVarNode_input_is_nullptr) { - NodePtr src_node = nullptr; - NodePtr dst_node = nullptr; - DavinciModel model(0, g_label_call_back); - Status ret = model.CopyTensorFromSrcVarNode(src_node, dst_node); - EXPECT_EQ(FAILED, ret); -} - -TEST_F(UtestModelManagerDavinciModel, CopyTensorFromSrcVarNode_success) { - ge::ComputeGraphPtr graph = std::make_shared("default"); - OpDescPtr op_desc_ptr = make_shared("Cast", "Cast"); - GeTensorDesc dims_tensor_desc(GeShape({1, 1, 1, 1}), FORMAT_NCHW, DT_FLOAT16); - GeTensorDesc dims_tensor_desc_in(GeShape({1, 1, 1, 1}), FORMAT_NCHW, DT_FLOAT); - op_desc_ptr->AddInputDesc(dims_tensor_desc_in); - op_desc_ptr->AddOutputDesc(dims_tensor_desc); - - NodePtr src_node = graph->AddNode(op_desc_ptr); - NodePtr dst_node = graph->AddNode(op_desc_ptr); - DavinciModel model(0, g_label_call_back); - Status ret = model.CopyTensorFromSrcVarNode(src_node, dst_node); -} - -TEST_F(UtestModelManagerDavinciModel, CopyVarData_graph_is_nullptr) { - ge::ComputeGraphPtr graph = nullptr; - DavinciModel model(0, g_label_call_back); - Status ret = model.CopyVarData(graph); - EXPECT_EQ(FAILED, ret); -} - -TEST_F(UtestModelManagerDavinciModel, copy_var_data_success) { - ge::ComputeGraphPtr graph = std::make_shared("default"); - OpDescPtr op_desc_ptr = make_shared("Variable", "Variable"); - GeTensorDesc dims_tensor_desc(GeShape({1, 1, 1, 1}), FORMAT_NCHW, DT_FLOAT16); - GeTensorDesc dims_tensor_desc_in(GeShape({1, 1, 1, 1}), FORMAT_NCHW, DT_FLOAT16); - op_desc_ptr->AddInputDesc(dims_tensor_desc_in); - op_desc_ptr->AddOutputDesc(dims_tensor_desc); - - NodePtr src_node = graph->AddNode(op_desc_ptr); - (void)ge::AttrUtils::SetStr(src_node->GetOpDesc(), "_copy_from_var_node", "abc"); - (void)ge::AttrUtils::SetBool(src_node->GetOpDesc(), "_copy_value", false); - - DavinciModel model(0, g_label_call_back); - Status ret = model.CopyVarData(graph); -} - -TEST_F(UtestModelManagerDavinciModel, get_input_output_desc_info_without_data_op_list) { - DavinciModel model(0, g_label_call_back); - vector input_list; - vector output_list; - Status ret = model.GetInputOutputDescInfo(input_list, output_list); - EXPECT_EQ(SUCCESS, ret); -} - -// test GetInputOutputDescInfo -TEST_F(UtestModelManagerDavinciModel, success_get_input_output_descInfo_with_net_output) { - DavinciModel model(0, g_label_call_back); - - auto op_desc = CreateOpDesc("Data", "Data"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - op_desc->SetStreamId(0); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - op_desc->SetSrcName({"Pooling1", "Pooling0"}); - op_desc->SetSrcIndex({0, 1}); - - auto compute_graph = make_shared("g"); - auto data_node = compute_graph->AddNode(op_desc); - - model.data_op_list_.push_back(op_desc); - - op_desc->SetType("NetOutput"); - - auto no_node = compute_graph->AddNode(op_desc); - - model.op_list_[0] = op_desc; - - model.output_op_list_.push_back(op_desc); - model.output_size_list_.push_back(32); - - vector input_shapes; - vector output_shapes; - EXPECT_EQ(ge::SUCCESS, model.GetInputOutputDescInfo(input_shapes, output_shapes)); -} - -TEST_F(UtestModelManagerDavinciModel, success_get_input_output_desc_info_for_zero_copy_with_net_output) { - DavinciModel model(0, g_label_call_back); - - auto op_desc = CreateOpDesc("Data", "Data"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - op_desc->SetStreamId(0); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - - op_desc->SetSrcName({"Pooling1", "Pooling0"}); - op_desc->SetSrcIndex({0, 1}); - - auto compute_graph = make_shared("g"); - auto data_node = compute_graph->AddNode(op_desc); - - model.data_op_list_.push_back(op_desc); - - op_desc->SetType("NetOutput"); - - auto net_out_node = compute_graph->AddNode(op_desc); - model.op_list_[0] = op_desc; - - model.output_op_list_.push_back(op_desc); - model.output_size_list_.push_back(32); - model.output_memory_size_list_.push_back(64); - - vector input_shapes; - vector output_shapes; - EXPECT_EQ(ge::SUCCESS, model.GetInputOutputDescInfoForZeroCopy(input_shapes, output_shapes)); -} - -TEST_F(UtestModelManagerDavinciModel, success_get_input_output_desc_info_dim_size_not4) { - DavinciModel model(0, g_label_call_back); - - auto op_desc = CreateOpDesc("Data", "Data"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - op_desc->SetStreamId(0); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - - op_desc->SetSrcName({"Pooling1", "Pooling0"}); - op_desc->SetSrcIndex({0, 1}); - - auto compute_graph = make_shared("g"); - auto data_node = compute_graph->AddNode(op_desc); - - model.data_op_list_.push_back(op_desc); - - op_desc->SetType("NetOutput"); - - auto net_out_node = compute_graph->AddNode(op_desc); - model.op_list_[0] = op_desc; - - model.output_op_list_.push_back(op_desc); - model.output_size_list_.push_back(32); - - vector input_shapes; - vector output_shapes; - EXPECT_EQ(ge::SUCCESS, model.GetInputOutputDescInfo(input_shapes, output_shapes)); -} - -// test GetLabelList -TEST_F(UtestModelManagerDavinciModel, get_label_list_success) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - vector label_list; - model.label_list_ = label_list; - EXPECT_EQ(label_list, model.GetLabelList()); -} - -// test GetInputListSize -TEST_F(UtestModelManagerDavinciModel, get_label_list_size_success) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - vector data_op_list; - data_op_list.push_back(std::make_shared()); - model.data_op_list_ = data_op_list; -} - -// test GetFlowctrlOpList -TEST_F(UtestModelManagerDavinciModel, get_flow_ctrl_op_list_success) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - std::map flowctrl_op_index_internal_map; - flowctrl_op_index_internal_map.insert(pair(1, 1)); - model.flowctrl_op_index_internal_map_ = flowctrl_op_index_internal_map; -} - -// test SetFlowctrlOpList -TEST_F(UtestModelManagerDavinciModel, get_flow_ctrl_index_success) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - EXPECT_EQ(0, model.GetFlowctrlIndex(0)); - EXPECT_EQ(1, model.GetFlowctrlIndex(0)); - EXPECT_EQ(0, model.GetFlowctrlIndex(1)); - EXPECT_EQ(1, model.GetFlowctrlIndex(1)); - EXPECT_EQ(2, model.GetFlowctrlIndex(0)); -} - -// test GetRegisterStub -TEST_F(UtestModelManagerDavinciModel, success_get_register_stub) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - std::string binfile = "tvmbin"; - string ret = model.GetRegisterStub(binfile); - EXPECT_EQ("tvmbin", ret); - model.tvm_bin_kernel_.insert("tvmbin"); - ret = model.GetRegisterStub(binfile); - EXPECT_EQ("tvmbin", ret); -} - -// test InitTbeHandle -TEST_F(UtestModelManagerDavinciModel, success_init_tbe_handle) { - DavinciModel model(0, g_label_call_back); - OmeTestOpUtils::InitModel(model); - std::shared_ptr op_desc = std::make_shared(); - Status ret = model.InitTbeHandle(op_desc); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); -} - -// test InitTVMTask failed -TEST_F(UtestModelManagerDavinciModel, init_tvm_task_failed1) { - DavinciModel model(0, g_label_call_back); - uint16_t offset = 0; - TaskDef *task_def = new TaskDef(); - KernelDef *kernel_def = task_def->mutable_kernel(); - map op_list; - model.op_list_ = op_list; - - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - Status ret = kernel_task_info->InitTVMTask(&model, offset, kernel_def[0]); - EXPECT_EQ(INTERNAL_ERROR, ret); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -TEST_F(UtestModelManagerDavinciModel, kernel_taskInfo_init_cce_task_failed1) { - DavinciModel model(0, g_label_call_back); - - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - KernelDef *kernel_def = task_def->mutable_kernel(); - Status ret = kernel_task_info->InitCceTask(&model, kernel_def[0]); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -// test SetContext success -TEST_F(UtestModelManagerDavinciModel, success_kernel_taskInfo_init_set_context) { - DavinciModel model(0, g_label_call_back); - - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - KernelDef *kernel_def = task_def->mutable_kernel(); - KernelContext *context = kernel_def->mutable_context(); - context->set_op_id(1); - context->set_kernel_func_id(1); - context->set_is_flowtable(true); - context->set_args_count(1); - context->set_args_offset("args111111", 10); - - Status ret = kernel_task_info->SetContext(kernel_def[0]); - EXPECT_EQ(ge::SUCCESS, ret); - - ret = kernel_task_info->Release(); - EXPECT_EQ(ge::SUCCESS, ret); - kernel_def->clear_context(); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -// test SetContext failed -TEST_F(UtestModelManagerDavinciModel, kernel_taskInfo_init_set_context_failed1) { - DavinciModel model(0, g_label_call_back); - - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - KernelDef *kernel_def = task_def->mutable_kernel(); - KernelContext *context = kernel_def->mutable_context(); - context->set_op_id(1); - context->set_kernel_func_id(1); - context->set_is_flowtable(true); - context->set_args_count(0); - Status ret = kernel_task_info->SetContext(kernel_def[0]); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); - - kernel_def->clear_context(); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -TEST_F(UtestModelManagerDavinciModel, kernel_taskInfo_init_set_context_failed2) { - DavinciModel model(0, g_label_call_back); - - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - KernelDef *kernel_def = task_def->mutable_kernel(); - KernelContext *context = kernel_def->mutable_context(); - context->set_op_id(1); - context->set_kernel_func_id(1); - context->set_is_flowtable(true); - context->set_args_count(5); - context->set_args_offset("\0\0"); // args_offset = 0 - - Status ret = kernel_task_info->SetContext(kernel_def[0]); - EXPECT_EQ(ge::PARAM_INVALID, ret); - - kernel_def->clear_context(); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -// test success DistributeDumpTask -TEST_F(UtestModelManagerDavinciModel, success_distribute_dump_task) { - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - KernelDef *kernel_def = task_def->mutable_kernel(); - - kernel_def->set_stub_func("kerneltaskinfo"); - kernel_def->set_block_dim(10); - kernel_def->set_args("args111111", 10); - kernel_def->set_args_size(10); - rtSmDesc_t l2CtrlInfo; - l2CtrlInfo.data[0].L2_mirror_addr = 1024; - kernel_def->set_sm_desc((void *)&l2CtrlInfo, sizeof(rtSmDesc_t)); - - // for SetStream - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - std::vector stream_list; - stream_list.push_back(stream); - Status ret = kernel_task_info->SetStream(0, stream_list); - EXPECT_EQ(SUCCESS, ret); - - ret = kernel_task_info->Release(); - EXPECT_EQ(SUCCESS, ret); - rtStreamDestroy(stream); - task_def->clear_kernel(); - delete kernel_task_info; - delete task_def; -} - -// test success GetTaskID -TEST_F(UtestModelManagerDavinciModel, success_get_task_id) { - ModelTaskDef *model_task_def = new ModelTaskDef(); - TaskDef *task = model_task_def->add_task(); - task->set_type(RT_MODEL_TASK_KERNEL); - TaskInfoPtr task_info = TaskInfoFactory::Instance().Create(static_cast(task->type())); - - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - uint32_t ret = task_info->GetTaskID(); - EXPECT_EQ(0, ret); - ret = kernel_task_info->GetTaskID(); - EXPECT_EQ(0, ret); - HcclTaskInfo *hccl_task_info = new HcclTaskInfo(); - ret = hccl_task_info->GetTaskID(); - EXPECT_EQ(0, ret); - - delete hccl_task_info; - delete kernel_task_info; - delete model_task_def; -} - -// test StoreInputOutputTensor success -TEST_F(UtestModelManagerDavinciModel, success_store_input_output_tensor) { - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - KernelTaskInfo *kernel_task_info = new KernelTaskInfo(); - - std::vector input_data_addrs; - std::vector output_data_addrs; - std::vector<::tagCcAICPUTensor> input_descs; - std::vector<::tagCcAICPUTensor> output_descs; - - int test = 1; - int *addr = &test; - void *input; - void *output; - input = addr; - output = addr; - input_data_addrs.push_back(&input); - output_data_addrs.push_back(output); - - tagCcAICPUTensor input_desc; - tagCcAICPUTensor output_desc; - input_descs.push_back(input_desc); - output_descs.push_back(output_desc); - - Status ret = kernel_task_info->StoreInputOutputTensor(input_data_addrs, output_data_addrs, input_descs, output_descs); - EXPECT_EQ(SUCCESS, ret); - ret = kernel_task_info->Release(); - EXPECT_EQ(SUCCESS, ret); - delete kernel_task_info; - delete task_def; -} - -// test init EventRecordTaskInfo -TEST_F(UtestModelManagerDavinciModel, success_event_record_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - EventRecordTaskInfo *eventRecordTaskInfo1 = new EventRecordTaskInfo(); - Status ret1 = eventRecordTaskInfo1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - - delete eventRecordTaskInfo1; - delete task_def1; - delete model1; - DavinciModel model(0, g_label_call_back); - - ModelTaskDef *model_task_info = new ModelTaskDef(); - TaskDef *task = model_task_info->add_task(); - task->set_type(RT_MODEL_TASK_EVENT_RECORD); - TaskInfoPtr task_info = TaskInfoFactory::Instance().Create(static_cast(task->type())); - - task->stream_id_ = 0; - rtStream_t rt_stream; - rtStreamCreate(&rt_stream, 1); - vector stream_list; - stream_list.push_back(rt_stream); - model.stream_list_ = stream_list; - - task->set_event_id(1); - model.runtime_param_.event_num = 1; - Status ret = task_info->Init(task[0], &model); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); - - model.runtime_param_.event_num = 2; - rtEvent_t event1; - rtEvent_t event2; - rtEventCreate(&event1); - rtEventCreate(&event2); - model.event_list_.push_back(event1); - model.event_list_.push_back(event2); - - EventExDef *event_ex_def = task->mutable_event_ex(); - event_ex_def->set_event_type(1); - - ret = task_info->Init(task[0], &model); - EXPECT_EQ(SUCCESS, ret); - - task->clear_event_ex(); - task_info->Release(); - delete model_task_info; -} - -// test init EventWaitTaskInfo -TEST_F(UtestModelManagerDavinciModel, success_event_wait_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - EventWaitTaskInfo *event_wait_task_info1 = new EventWaitTaskInfo(); - Status ret1 = event_wait_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - - delete event_wait_task_info1; - delete task_def1; - delete model1; - DavinciModel model(0, g_label_call_back); - - ModelTaskDef *model_task_info = new ModelTaskDef(); - TaskDef *task = model_task_info->add_task(); - task->set_type(RT_MODEL_TASK_EVENT_WAIT); - TaskInfoPtr task_info = TaskInfoFactory::Instance().Create(static_cast(task->type())); - - task->stream_id_ = 0; - rtStream_t rt_stream; - rtStreamCreate(&rt_stream, 1); - vector stream_list; - stream_list.push_back(rt_stream); - model.stream_list_ = stream_list; - - task->set_event_id(1); - model.runtime_param_.event_num = 1; - Status ret = task_info->Init(task[0], &model); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); - - model.runtime_param_.event_num = 2; - rtEvent_t event1; - rtEvent_t event2; - rtEventCreate(&event1); - rtEventCreate(&event2); - model.event_list_.push_back(event1); - model.event_list_.push_back(event2); - - EventExDef *event_ex_def = task->mutable_event_ex(); - event_ex_def->set_event_type(1); - - ret = task_info->Init(task[0], &model); - EXPECT_EQ(SUCCESS, ret); - - task->clear_event_ex(); - task_info->Release(); - delete model_task_info; -} - -// test fusion_start_task Init -TEST_F(UtestModelManagerDavinciModel, success_fusion_start_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - FusionStartTaskInfo *fusion_start_task_info1 = new FusionStartTaskInfo(); - Status ret1 = fusion_start_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - - delete fusion_start_task_info1; - delete task_def1; - delete model1; - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - FusionStartTaskInfo *fusion_start_task_info = new FusionStartTaskInfo(); - task_def->set_stream_id(0); - rtStream_t stream; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - - Status ret = fusion_start_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - delete fusion_start_task_info; - delete task_def; -} - -// test fusion_end_task Init -TEST_F(UtestModelManagerDavinciModel, success_fusion_end_task_rinit) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - FusionStopTaskInfo *fusion_stop_task_info1 = new FusionStopTaskInfo(); - Status ret1 = fusion_stop_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - - delete fusion_stop_task_info1; - delete task_def1; - delete model1; - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - FusionStopTaskInfo *fusion_stop_task_info = new FusionStopTaskInfo(); - task_def->set_stream_id(0); - rtStream_t stream; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - - Status ret = fusion_stop_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - delete fusion_stop_task_info; - delete task_def; -} - -// test kernel_ex_task_Release -TEST_F(UtestModelManagerDavinciModel, success_kernel_ex_task_release) { - KernelExTaskInfo *kernel_ex_task_info = new KernelExTaskInfo(); - Status ret = kernel_ex_task_info->Release(); - EXPECT_EQ(SUCCESS, ret); - - delete kernel_ex_task_info; -} - -// test hccl_Distribute -TEST_F(UtestModelManagerDavinciModel, success_Distribute7) { - DavinciModel model(0, g_label_call_back); - - ModelTaskDef *model_task_def = new ModelTaskDef(); - TaskDef *task7 = model_task_def->add_task(); - task7->set_type(RT_MODEL_TASK_HCCL); - TaskInfoPtr task_info7 = TaskInfoFactory::Instance().Create(static_cast(task7->type())); - Status ret = task_info7->Init(task7[0], &model); - EXPECT_EQ(FAILED, ret); - - std::vector task_list; - task_list.push_back(task_info7); - model.task_list_ = task_list; - - task_info7->Release(); - delete model_task_def; -} - -// test hccl_GetPrivateDefByTaskDef -TEST_F(UtestModelManagerDavinciModel, success_hccl_get_private_def_by_task_def) { - DavinciModel model(0, g_label_call_back); - - ModelTaskDef *model_task_def = new ModelTaskDef(); - TaskDef *task7 = model_task_def->add_task(); - task7->set_type(RT_MODEL_TASK_HCCL); - // for SetStream - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - // for GetPrivateDefByTaskDef - task7->set_ops_kernel_store_ptr(10); - std::string value = "hccl_task"; - task7->set_private_def(value); - - TaskInfoPtr task_info7 = TaskInfoFactory::Instance().Create(static_cast(task7->type())); - // for Distribute - Status ret = task_info7->Init(task7[0], &model); - EXPECT_EQ(ge::PARAM_INVALID, ret); - - task_info7->Release(); - delete model_task_def; -} - -// test hccl_task_TransToGETaskInfo -TEST_F(UtestModelManagerDavinciModel, success_hccl_trans_to_ge_task_info) { - DavinciModel model(0, g_label_call_back); - - ModelTaskDef *model_task_def = new ModelTaskDef(); - TaskDef *task7 = model_task_def->add_task(); - // for type - task7->set_type(RT_MODEL_TASK_HCCL); - TaskInfoPtr task_info7 = TaskInfoFactory::Instance().Create(static_cast(task7->type())); - - GETaskInfo ge_task; - HcclTaskInfo *hccl_task_info = new HcclTaskInfo(); - hccl_task_info->TransToGETaskInfo(ge_task); - - delete hccl_task_info; - delete model_task_def; -} - -// test stream_active_task Init -TEST_F(UtestModelManagerDavinciModel, success_stream_active_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - StreamActiveTaskInfo *stream_active_task_info1 = new StreamActiveTaskInfo(); - Status ret1 = stream_active_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - delete stream_active_task_info1; - delete task_def1; - delete model1; - - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - task_def->set_stream_id(0); - rtStream_t stream1, stream2; - rtStreamCreate(&stream1, 0); - rtStreamCreate(&stream2, 0); - model.stream_list_.push_back(stream1); - - StreamActiveTaskInfo *stream_active_task_info = new StreamActiveTaskInfo(); - - StreamActiveDef *stream_active_def = task_def->mutable_stream_active(); - stream_active_def->set_op_index(0); - stream_active_def->set_active_stream_id(0); - - std::map flowctrl; - flowctrl.insert(pair(1, 1)); - model.flowctrl_op_index_internal_map_ = flowctrl; - - auto opDef = CreateOpDesc("", ""); - model.op_list_[0] = opDef; - - Status ret = stream_active_task_info->Init(task_def[0], &model); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); // line 51 - - model.stream_list_.push_back(stream2); - ret = stream_active_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - - task_def->clear_stream_active(); - delete stream_active_task_info; - delete task_def; -} - -// test label_set_task Init -TEST_F(UtestModelManagerDavinciModel, success_label_set_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - LabelSetTaskInfo *label_set_task_info1 = new LabelSetTaskInfo(); - Status ret1 = label_set_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - delete label_set_task_info1; - delete task_def1; - delete model1; - - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - LabelSetTaskInfo *label_set_task_info = new LabelSetTaskInfo(); - task_def->set_stream_id(0); - rtStream_t stream; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - - task_def->set_label_id(1); - model.runtime_param_.batch_num = 0; - Status ret = label_set_task_info->Init(task_def[0], &model); - EXPECT_EQ(PARAM_INVALID, ret); - - task_def->clear_label_id(); - task_def->set_label_id(0); - model.runtime_param_.batch_num = 1; - rtLabel_t label; - rtLabelCreate(&label); - model.label_list_.push_back(label); - - ret = label_set_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - delete label_set_task_info; - delete task_def; -} - -// test label_goto_task init -TEST_F(UtestModelManagerDavinciModel, success_label_goto_task_init) { - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - LabelGotoTaskInfo *label_goto_task_info = new LabelGotoTaskInfo(); - task_def->set_stream_id(0); - - rtStream_t stream; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - - rtLabel_t label; - rtLabelCreate(&label); - model.label_list_.push_back(label); - - Status ret = label_goto_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - - delete label_goto_task_info; - delete task_def; -} - -// test profiler_trace_task init -TEST_F(UtestModelManagerDavinciModel, success_profiler_trace_task_init) { - DavinciModel *model1 = nullptr; - TaskDef *task_def1 = new TaskDef(); - ProfilerTraceTaskInfo *profiler_trace_task_info1 = new ProfilerTraceTaskInfo(); - Status ret1 = profiler_trace_task_info1->Init(task_def1[0], model1); - EXPECT_EQ(PARAM_INVALID, ret1); - - delete profiler_trace_task_info1; - delete task_def1; - delete model1; - DavinciModel model(0, g_label_call_back); - TaskDef *task_def = new TaskDef(); - task_def->set_stream_id(0); - rtStream_t stream; - rtStreamCreate(&stream, 0); - model.stream_list_.push_back(stream); - LogTimeStampDef *logTimeStampDef = task_def->mutable_log_timestamp(); - logTimeStampDef->set_logid(1); - logTimeStampDef->set_notify(1); - logTimeStampDef->set_flat(1); - ProfilerTraceTaskInfo *profiler_trace_task_info = new ProfilerTraceTaskInfo(); - Status ret = profiler_trace_task_info->Init(task_def[0], &model); - EXPECT_EQ(SUCCESS, ret); - - task_def->clear_log_timestamp(); - delete profiler_trace_task_info; - delete task_def; -} - -TEST_F(UtestModelManagerDavinciModel, profiling_model_success) { - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - - DavinciModel model(0, g_label_call_back); - model.model_id_ = 1; - model.name_ = "test"; - model.version_ = 0x01; - - model.stream_list_.push_back(stream); - - ge::ModelData data; - rtMallocHost(&data.model_data, 128); - data.model_len = 128; - - ModelDef *model_def = new ModelDef(); - auto op_def = CreateOpDesc("", "Data"); - op_def->SetInputOffset({1}); - op_def->SetOutputOffset({100}); - - ge::GeTensorDesc descin(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetSize(descin, 4); - op_def->AddInputDesc(descin); - ge::GeTensorDesc desc_out(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetSize(desc_out, 32); - op_def->AddInputDesc(desc_out); - op_def->SetId(0); - - model.data_op_list_.push_back(op_def); - model.op_list_[0] = op_def; - - auto opdef1 = CreateOpDesc("", "Relu"); - opdef1->SetInputOffset({1}); - opdef1->SetOutputOffset({100}); - - ge::GeTensorDesc desc_in1(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetSize(desc_in1, 4); - opdef1->AddInputDesc(desc_in1); - ge::GeTensorDesc desc_out1(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetSize(desc_out1, 32); - opdef1->AddInputDesc(desc_out1); - op_def->SetId(1); - - model.op_list_[1] = opdef1; - - auto opdef2 = CreateOpDesc("", "Relu"); - opdef2->SetInputOffset({1}); - opdef2->SetOutputOffset({100}); - - ge::GeTensorDesc desc_in2(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetSize(desc_in2, 4); - opdef2->AddInputDesc(desc_in2); - ge::GeTensorDesc desc_out2(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetSize(desc_out2, 32); - opdef2->AddInputDesc(desc_out2); - op_def->SetId(2); - - model.op_list_[2] = opdef2; - - auto opdef3 = CreateOpDesc("", "Relu"); - opdef3->SetInputOffset({1}); - opdef3->SetOutputOffset({100}); - - ge::GeTensorDesc desc_in3(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetSize(desc_in3, 4); - opdef3->AddInputDesc(desc_in3); - ge::GeTensorDesc desc_out3(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetSize(desc_out3, 32); - opdef3->AddInputDesc(desc_out3); - op_def->SetId(3); - - model.op_list_[3] = opdef3; - - auto opdef4 = CreateOpDesc("", "Relu"); - opdef4->SetInputOffset({1}); - opdef4->SetOutputOffset({100}); - - ge::GeTensorDesc desc_in4(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetSize(desc_in4, 4); - opdef4->AddInputDesc(desc_in4); - ge::GeTensorDesc desc_out4(ge::GeShape({1, 1, 1, 1}), ge::FORMAT_NCHW, ge::DT_FLOAT16); - ge::TensorUtils::SetSize(desc_out4, 32); - opdef4->AddInputDesc(desc_out4); - op_def->SetId(4); - - model.op_list_[4] = opdef4; - - ge::InputData input_data; - ge::DataBuffer data_buffer; - data_buffer.data = new char[4]; - data_buffer.length = 4; - input_data.index = 0; - input_data.model_id = 1; - input_data.blobs.push_back(data_buffer); - - rtFreeHost(data.model_data); - delete[](char *) data_buffer.data; - delete model_def; -} - -TEST_F(UtestModelManagerDavinciModel, success_output_list_0) { - DavinciModel model(0, g_label_call_back); - - uint32_t version = 0; - uint64_t session_id = 0; - uint32_t device_id = 0; - uint64_t job_id = 0; - Status ret = VarManager::Instance(session_id)->Init(version, session_id, device_id, job_id); - EXPECT_EQ(ret, ge::SUCCESS); - - ret = model.ReturnNoOutput(1); - EXPECT_EQ(ret, ge::SUCCESS); - - VarManagerPool::Instance().Destroy(); -} - -// test dyncbatch_distributeTask_SUCCESS -TEST_F(UtestModelManagerDavinciModel, dyncbatch_distribute_task_success) { - DavinciModel model(0, g_label_call_back); - - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - - rtLabel_t label = nullptr; - rtLabelCreate(&label); - model.label_list_.push_back(label); - rtLabelCreate(&label); - model.label_list_.push_back(label); - rtLabelCreate(&label); - model.label_list_.push_back(label); - - rtLabelDestroy(label); - rtStreamDestroy(stream); -} - -// test GetOutputDescInfo -TEST_F(UtestModelManagerDavinciModel, success_get_output_desc_info_with_netoutput) { - setenv("GE_TRAIN", "1", true); - DavinciModel model(0, g_label_call_back); - - auto op_desc = CreateOpDesc("Data", "Data"); - op_desc->SetOutputOffset({1}); - op_desc->SetInputOffset({1}); - op_desc->SetStreamId(0); - - { - ge::GeTensorDesc in_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_FRACTAL_Z, ge::DT_FLOAT16); - ge::TensorUtils::SetOutputTensor(in_desc, false); - ge::TensorUtils::SetInputTensor(in_desc, true); - op_desc->AddInputDesc(in_desc); - } - - { - ge::GeTensorDesc out_desc(ge::GeShape({1, 1, 10, 10}), ge::FORMAT_NCHW, ge::DT_FLOAT); - ge::TensorUtils::SetOutputTensor(out_desc, true); - ge::TensorUtils::SetInputTensor(out_desc, false); - op_desc->AddOutputDesc(out_desc); - } - - op_desc->SetSrcName({"Pooling1", "Pooling0"}); - op_desc->SetSrcIndex({0, 1}); - - auto compute_graph = make_shared("g"); - - op_desc->SetType("NetOutput"); - - auto net_out_node = compute_graph->AddNode(op_desc); - model.op_list_[0] = op_desc; - - model.output_op_list_.push_back(op_desc); - model.output_size_list_.push_back(32); - model.output_memory_size_list_.push_back(64); - - vector output_shapes; - vector formats; - EXPECT_EQ(ge::SUCCESS, model.GetOutputDescInfo(output_shapes, formats)); - - setenv("GE_TRAIN", "0", true); -} - -TEST_F(UtestModelManagerDavinciModel, device_runtime_success_Run) { - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - - DavinciModel model(0, g_label_call_back); - - model.stream_list_.push_back(stream); - auto model_def = make_shared(); - - auto op_def = CreateOpDesc("", "Data"); - - auto compute_graph = make_shared("g"); - compute_graph->AddNode(op_def); - - model_def->SetGraph(ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph)); - - model.data_op_list_.push_back(op_def); - - model.data_inputer_ = new DataInputer(); - - model.ModelRunStart(); - - OutputData output_data; - ge::InputData input_data; - - ge::DataBuffer data_buffer; - data_buffer.data = new char[16]; - data_buffer.length = 16; - - input_data.index = 0; - input_data.model_id = 1; - input_data.blobs.push_back(data_buffer); - - model.ModelRunStop(); - - delete[](char *) data_buffer.data; -} - -TEST_F(UtestModelManagerDavinciModel, run_failed) { - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - - DavinciModel model(0, g_label_call_back); - - model.stream_list_.push_back(stream); - auto model_def = make_shared(); - - auto op_def = CreateOpDesc("", "Data"); - - auto compute_graph = make_shared("g"); - compute_graph->AddNode(op_def); - - model_def->SetGraph(ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph)); - - model.data_op_list_.push_back(op_def); - - model.data_inputer_ = new DataInputer(); - - model.ModelRunStart(); - - OutputData output_data; - ge::InputData input_data; - - ge::DataBuffer data_buffer; - data_buffer.data = new char[16]; - data_buffer.length = 16; - - input_data.index = 0; - input_data.model_id = 1; - input_data.blobs.push_back(data_buffer); - - model.ModelRunStop(); - delete[](char *) data_buffer.data; -} - -TEST_F(UtestModelManagerDavinciModel, run_failed01) { - rtStream_t stream = nullptr; - rtStreamCreate(&stream, 0); - - DavinciModel model(0, g_label_call_back); - - model.stream_list_.push_back(stream); - auto model_def = make_shared(); - - auto op_def = CreateOpDesc("", "Data"); - - auto compute_graph = make_shared("g"); - compute_graph->AddNode(op_def); - - model_def->SetGraph(ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph)); - - model.data_op_list_.push_back(op_def); - - model.data_inputer_ = nullptr; - model.ModelRunStart(); - - model.ModelRunStop(); -} - -TEST_F(UtestModelManagerDavinciModel, init_tbe_handle_fe_registered) { - DavinciModel::tvm_bin_kernel_.clear(); - DavinciModel model(0, g_label_call_back); - OpDescPtr op_desc = CreateOpDesc("MatMul", "MatMul"); - - std::vector kernelBin; - TBEKernelPtr tbe_kernel = std::make_shared("name/MatMul", std::move(kernelBin)); - op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); - - std::string kernel_name("kernel/MatMul"); - AttrUtils::SetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name); - - EXPECT_EQ(model.InitTbeHandle(op_desc), SUCCESS); - EXPECT_EQ(model.InitTbeHandle(op_desc), SUCCESS); - - EXPECT_EQ(model.used_tbe_handle_map_.size(), 0); - DavinciModel::tvm_bin_kernel_.clear(); -} - -TEST_F(UtestModelManagerDavinciModel, init_tbe_handle_ge_registered) { - DavinciModel::tvm_bin_kernel_.clear(); - DavinciModel model(0, g_label_call_back); - OpDescPtr op_desc = CreateOpDesc("MatMul", "MatMul"); - - std::vector kernelBin; - TBEKernelPtr tbe_kernel = std::make_shared("name/MatMul", std::move(kernelBin)); - op_desc->SetExtAttr(ge::OP_EXTATTR_NAME_TBE_KERNEL, tbe_kernel); - - std::string kernel_name("kernel/MatMul"); - AttrUtils::SetStr(op_desc, op_desc->GetName() + "_kernelname", kernel_name); - - string session_graph_id; - AttrUtils::GetStr(op_desc, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id); - const char *bin_file_key = DavinciModel::GetRegisterStub(op_desc->GetName(), session_graph_id); - model.used_tbe_handle_map_[bin_file_key] = 1; // test first register. - - EXPECT_EQ(model.InitTbeHandle(op_desc), SUCCESS); - EXPECT_EQ(model.InitTbeHandle(op_desc), SUCCESS); - - EXPECT_EQ(model.used_tbe_handle_map_.size(), 1); - - auto it = model.used_tbe_handle_map_.find(bin_file_key); - EXPECT_NE(it, model.used_tbe_handle_map_.end()); - EXPECT_EQ(it->second, 3); - DavinciModel::tvm_bin_kernel_.clear(); -} -} // namespace ge diff --git a/tests/ut/ge/graph/load/new_model_manager_event_manager_unittest.cc b/tests/ut/ge/graph/load/new_model_manager_event_manager_unittest.cc deleted file mode 100644 index ee708501..00000000 --- a/tests/ut/ge/graph/load/new_model_manager_event_manager_unittest.cc +++ /dev/null @@ -1,117 +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 - -#include "common/debug/log.h" -#include "common/debug/memory_dumper.h" -#include "common/types.h" - -#define private public -#include "graph/manager/model_manager/event_manager.h" -#undef private - -using namespace ge; -using namespace std; -using namespace testing; - -class UtestModelManagerEventManager : public testing::Test { - protected: - void SetUp() {} - - void TearDown() {} -}; - -// test repeat initialize -TEST_F(UtestModelManagerEventManager, repeat_initialization) { - ge::EventManager event_manager; - size_t event_num = 1; - event_manager.Init(event_num); - Status ret = event_manager.Init(event_num); - EXPECT_EQ(ret, SUCCESS); -} - -TEST_F(UtestModelManagerEventManager, call_event_record_normal) { - ge::EventManager event_manager; - size_t event_num = 1; - Status ret = event_manager.Init(event_num); - EXPECT_EQ(SUCCESS, ret); - EXPECT_NE(event_manager.event_list_.size(), 0); - - ret = event_manager.EventRecord(0, NULL); - EXPECT_EQ(SUCCESS, ret); -} - -// test load EventRecore when uninited -TEST_F(UtestModelManagerEventManager, call_event_record_while_uninited) { - ge::EventManager event_manager; - Status ret = event_manager.EventRecord(1, NULL); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); -} - -// test with invalid param when load EventRecord -TEST_F(UtestModelManagerEventManager, call_event_record_with_invalid_param) { - ge::EventManager event_manager; - Status ret = event_manager.Init(1); - EXPECT_EQ(SUCCESS, ret); - ret = event_manager.EventRecord(1, NULL); - EXPECT_EQ(ge::PARAM_INVALID, ret); -} - -// test load EventElapsedTime when uninited -TEST_F(UtestModelManagerEventManager, call_event_elapsed_time_while_uninited) { - ge::EventManager event_manager; - float time = .0f; - Status ret = event_manager.EventElapsedTime(1, 2, time); - EXPECT_EQ(ge::INTERNAL_ERROR, ret); -} - -// test with invalid param when load EventElapsedTime -TEST_F(UtestModelManagerEventManager, call_event_elapsed_time_with_invalid_param) { - ge::EventManager *event_manager = new ge::EventManager; - size_t event_num = 2; - Status ret = event_manager->Init(event_num); - EXPECT_EQ(SUCCESS, ret); - float time = .0f; - - // normal load - ret = event_manager->EventElapsedTime(0, 1, time); - EXPECT_EQ(SUCCESS, ret); - - // startevent_idx overstep boundary - ret = event_manager->EventElapsedTime(2, 1, time); - EXPECT_EQ(ge::PARAM_INVALID, ret); - - // stopevent_idx overstep boundary - ret = event_manager->EventElapsedTime(1, 2, time); - EXPECT_EQ(ge::PARAM_INVALID, ret); - - // startevent_idx > stopevent_idx - ret = event_manager->EventElapsedTime(1, 0, time); - EXPECT_EQ(ge::PARAM_INVALID, ret); - - delete event_manager; -} -TEST_F(UtestModelManagerEventManager, call_get_event) { - ge::EventManager event_manager; - size_t event_num = 1; - event_manager.Init(event_num); - rtEvent_t event = nullptr; - Status ret = event_manager.GetEvent(2, event); - EXPECT_EQ(ge::PARAM_INVALID, ret); - ret = event_manager.GetEvent(0, event); - EXPECT_EQ(SUCCESS, ret); -} diff --git a/tests/ut/ge/graph/load/new_model_manager_task_build_unittest.cc b/tests/ut/ge/graph/load/new_model_manager_task_build_unittest.cc deleted file mode 100644 index f10ccd7f..00000000 --- a/tests/ut/ge/graph/load/new_model_manager_task_build_unittest.cc +++ /dev/null @@ -1,115 +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 - -#include "common/debug/log.h" -#include "common/debug/memory_dumper.h" -#include "common/types.h" -#include "new_op_test_utils.h" -#include "graph/debug/ge_attr_define.h" -#include "graph/utils/attr_utils.h" -#include "graph/detail/model_serialize_imp.h" -#include "proto/ge_ir.pb.h" - -#define private public -#define protected public -#include "graph/compute_graph.h" -#include "graph/utils/graph_utils.h" -#include "graph/model_serialize.h" -#include "graph/load/model_manager/davinci_model.h" -#include "common/properties_manager.h" -#include "common/op/ge_op_utils.h" -#include -#include "runtime/dev.h" -#include "runtime/kernel.h" -#include "cce/fwk_adpt_struct.h" -#undef private -#undef protected - -using namespace std; -using namespace testing; - -namespace ge { -class UtestModelManagerTaskBuilder : public testing::Test { - protected: - void SetUp() {} - - void TearDown() {} - - /// data weight - /// | | | | - /// |-conv-| | | - /// | | | - /// conv2d | - /// | | - /// |-resApply - - void BuildGraph(ComputeGraphPtr graph) { - OpDescPtr data = std::make_shared("DATA1", "data"); - OpDescPtr weight = std::make_shared("WEIGHT", "weight"); - OpDescPtr conv_op = std::make_shared("conv", "conv"); - OpDescPtr conv_2D = std::make_shared("conv_2D", "conv2d"); - OpDescPtr res_apply_op = std::make_shared("res_apply_op", "resapply"); - // add descriptor - vector dim(4, 4); - GeShape shape(dim); - GeTensorDesc out_desc(shape); - int32_t blockSize = 4096; - - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 1); - data->AddOutputDesc(out_desc); - - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 2); - weight->AddOutputDesc(out_desc); - - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 1); - conv_op->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 2); - conv_op->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 3); - conv_op->AddOutputDesc(out_desc); - - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 3); - conv_2D->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 2); - conv_2D->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 4); - conv_2D->AddOutputDesc(out_desc); - - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 4); - res_apply_op->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 1); - res_apply_op->AddInputDesc(out_desc); - ge::TensorUtils::SetDataOffset(out_desc, blockSize * 5); - res_apply_op->AddOutputDesc(out_desc); - - NodePtr data_node = graph->AddNode(data); - NodePtr weigth_node = graph->AddNode(weight); - NodePtr conv_node = graph->AddNode(conv_op); - NodePtr conv_2D_node = graph->AddNode(conv_2D); - NodePtr res_node = graph->AddNode(res_apply_op); - - GraphUtils::AddEdge(data_node->GetOutDataAnchor(0), conv_node->GetInDataAnchor(0)); - GraphUtils::AddEdge(weigth_node->GetOutDataAnchor(0), conv_node->GetInDataAnchor(1)); - GraphUtils::AddEdge(conv_node->GetOutDataAnchor(0), conv_2D_node->GetInDataAnchor(0)); - GraphUtils::AddEdge(weigth_node->GetOutDataAnchor(0), conv_2D_node->GetInDataAnchor(1)); - GraphUtils::AddEdge(conv_2D_node->GetOutDataAnchor(0), res_node->GetInDataAnchor(0)); - GraphUtils::AddEdge(weigth_node->GetOutDataAnchor(0), res_node->GetInDataAnchor(1)); - return; - } -}; -} // namespace ge diff --git a/tests/ut/ge/graph/load/output_net_output_unittest.cc b/tests/ut/ge/graph/load/output_net_output_unittest.cc deleted file mode 100644 index 97246dad..00000000 --- a/tests/ut/ge/graph/load/output_net_output_unittest.cc +++ /dev/null @@ -1,300 +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 -#include - -#include "securec.h" - -#define protected public -#define private public -#include "common/debug/memory_dumper.h" -#include "common/op/ge_op_utils.h" -#include "graph/load/model_manager/davinci_model.h" -#include "graph/load/model_manager/model_utils.h" -#include "graph/manager/graph_var_manager.h" -#include "new_op_test_utils.h" -#include "proto/om.pb.h" - -using namespace std; - -namespace ge { -class UtestNetOutput : public testing::Test { - protected: - void TearDown() {} - shared_ptr GenOpdef(OpDescPtr &op_desc, int flag) { - shared_ptr builder = make_shared(op_desc); - builder->SetStreamId(0); - builder->AddInput(1); - builder->SetType("NetOutput"); - - if (flag == 1) { - auto input_desc_1 = builder->AddInputDesc({1, 1, 10, 10}, FORMAT_NCHW, DT_FLOAT16); - } - auto input_desc_1 = builder->AddInputDesc({1, 1, 10, 10}, FORMAT_NCHW, DT_FLOAT16); - - if (flag == 2) { - auto input_desc_2 = builder->AddInputDesc({1, 1, 10, 10}, FORMAT_NCHW, DT_FLOAT16); - } - if (flag == 3) { - builder->AddInput(10); - } - - return builder; - } - shared_ptr GenOpdef2(OpDescPtr &op_desc) { - shared_ptr builder = make_shared(op_desc); - builder->SetStreamId(0); - builder->SetType("NetOutput"); - builder->AddInput(10); - - auto input_desc_1 = builder->AddInputDesc({64, 32, 5, 5}, FORMAT_FRACTAL_Z, DT_FLOAT); - - builder->AddInput(1000000); - auto input_desc_2 = builder->AddInputDesc({1, 10, 10, 1}, FORMAT_NHWC, DT_FLOAT); - - builder->AddOutput(2000000); - auto output_desc_1 = builder->AddOutputDesc({64, 32, 5, 5}, FORMAT_NCHW, DT_FLOAT); - - builder->AddOutput(2100000); - output_desc_1 = builder->AddOutputDesc({1, 10, 10, 1}, FORMAT_NHWC, DT_FLOAT); - - return builder; - } - - public: - shared_ptr dav_model_; -}; - -TEST_F(UtestNetOutput, test_get_input_size) { - shared_ptr custom_op_desc = make_shared(); - OmeTestOpDescBuilder builder(custom_op_desc); - builder.SetName("netoutput"); - builder.SetStreamId(0); - builder.SetType("NetOutput"); - - auto input_desc_1 = builder.AddInputDesc({1, 1, 1, 1}, FORMAT_FRACTAL_Z, DT_FLOAT); - builder.AddInput(1); - auto output_desc = builder.AddOutputDesc({1, 1, 1, 1}, FORMAT_NCHW, DT_FLOAT); - builder.AddOutput(1); - builder.Finish(); - - vector v_output_size = ModelUtils::GetInputSize(custom_op_desc); - EXPECT_EQ(v_output_size.size(), 1); -} - -// test ModelUtils::IsOutput -TEST_F(UtestNetOutput, success_is_output) { - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - OmeTestOpDescBuilder builder(op_desc); - builder.SetType("NetOutput"); - vector outputs_desc; - std::shared_ptr desc = std::make_shared(); - outputs_desc.push_back(desc); - op_desc->outputs_desc_ = outputs_desc; - bool ret = model_utils->IsOutput(op_desc); - EXPECT_EQ(false, ret); - - delete model_utils; -} - -// test ModelUtils::IsOutput -TEST_F(UtestNetOutput, true_is_output) { - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - OmeTestOpDescBuilder builder(op_desc); - builder.SetType("NetOutput"); - vector outputs_desc; - std::shared_ptr desc = std::make_shared(); - outputs_desc.push_back(desc); - op_desc->outputs_desc_ = outputs_desc; - ge::TensorUtils::SetOutputTensor(*(outputs_desc[0].get()), true); - bool ret = model_utils->IsOutput(op_desc); - EXPECT_EQ(true, ret); - - delete model_utils; -} - -// test ModelUtils::IsInputTensorNeedTrans -TEST_F(UtestNetOutput, success_is_output_tensor_need_trans) { - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - OmeTestOpDescBuilder builder(op_desc); - builder.SetType("NetOutput"); - size_t tensor_index = 1; - vector outputs_desc; - std::shared_ptr desc = std::make_shared(); - outputs_desc.push_back(desc); - op_desc->outputs_desc_ = outputs_desc; - op_desc->inputs_desc_ = outputs_desc; - - bool ret = model_utils->IsInputTensorNeedTrans(op_desc, tensor_index); - EXPECT_EQ(false, ret); - - delete model_utils; -} - -// test ModelUtils::GetOutputSize -TEST_F(UtestNetOutput, success_get_output_size) { - vector v_output_size; - - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - vector outputs_desc; - std::shared_ptr desc = std::make_shared(); - outputs_desc.push_back(desc); - op_desc->outputs_desc_ = outputs_desc; - EXPECT_EQ(v_output_size, model_utils->GetOutputSize(op_desc)); - - vector output = {1}; - op_desc->SetOutputOffset(output); - uint32_t tensor_size = 0; - v_output_size.push_back(tensor_size); - EXPECT_EQ(v_output_size, model_utils->GetOutputSize(op_desc)); - delete model_utils; -} - -// test ModelUtils::GetWorkspaceSize -TEST_F(UtestNetOutput, success_get_workspace_size) { - vector v_workspace_size; - - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - vector workspace = {1}; - op_desc->SetWorkspace(workspace); - EXPECT_EQ(v_workspace_size, model_utils->GetWorkspaceSize(op_desc)); - - op_desc->SetWorkspaceBytes(workspace); - v_workspace_size.push_back(1); - EXPECT_EQ(v_workspace_size, model_utils->GetWorkspaceSize(op_desc)); - delete model_utils; -} - -// test ModelUtils::GetWeightSize -TEST_F(UtestNetOutput, success_get_weight_size) { - vector v_weight_size; - - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - op_desc->SetType("Const"); - EXPECT_EQ(v_weight_size, model_utils->GetWeightSize(op_desc)); - - op_desc->SetType("NetOutput"); - vector inputs_desc; - std::shared_ptr desc = std::make_shared(); - inputs_desc.push_back(desc); - op_desc->inputs_desc_ = inputs_desc; - - vector is_input_const = {true}; - op_desc->SetIsInputConst(is_input_const); - v_weight_size.push_back(0); - EXPECT_EQ(v_weight_size, model_utils->GetWeightSize(op_desc)); - - delete model_utils; -} - -// test ModelUtils::GetWeights -TEST_F(UtestNetOutput, success_get_weights) { - vector v_weights; - - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - op_desc->SetType("Const"); - EXPECT_EQ(v_weights, model_utils->GetWeights(op_desc)); - - op_desc->SetType("NetOutput"); - vector inputs_desc; - std::shared_ptr desc = std::make_shared(); - inputs_desc.push_back(desc); - op_desc->inputs_desc_ = inputs_desc; - - vector is_input_const = {true}; - op_desc->SetIsInputConst(is_input_const); - GeTensorDesc tensor_desc; - EXPECT_EQ(v_weights, model_utils->GetWeights(op_desc)); - - delete model_utils; -} - -// test ModelUtils::GetInputDescs -TEST_F(UtestNetOutput, success_get_input_descs) { - vector<::opTensor_t> v_input_descs; - vector<::tagCcAICPUTensor> ret; - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - ret = model_utils->GetInputDescs(op_desc); - EXPECT_EQ(v_input_descs.size(), ret.size()); - - vector inputs_desc; - std::shared_ptr desc = std::make_shared(); - inputs_desc.push_back(desc); - op_desc->inputs_desc_ = inputs_desc; - vector is_input_const = {false}; - op_desc->SetIsInputConst(is_input_const); - - opTensor_t tmp; - tmp.format = OP_TENSOR_FORMAT_NC1HWC0; - tmp.dim_cnt = 0; - tmp.data_type = OP_DATA_FLOAT; - v_input_descs.push_back(tmp); - ret = model_utils->GetInputDescs(op_desc); - EXPECT_EQ(v_input_descs.size(), ret.size()); - - delete model_utils; -} - -// test ModelUtils::GetOutputDescs -TEST_F(UtestNetOutput, success_get_output_descs) { - vector<::opTensor_t> v_output_descs; - vector<::tagCcAICPUTensor> ret; - ModelUtils *model_utils = new ModelUtils(); - std::shared_ptr op_desc = std::make_shared(); - ret = model_utils->GetOutputDescs(op_desc); - EXPECT_EQ(v_output_descs.size(), ret.size()); - - vector outputs_desc; - std::shared_ptr desc = std::make_shared(); - outputs_desc.push_back(desc); - op_desc->outputs_desc_ = outputs_desc; - - opTensor_t tmp; - tmp.format = OP_TENSOR_FORMAT_NC1HWC0; - tmp.dim_cnt = 0; - tmp.data_type = OP_DATA_FLOAT; - v_output_descs.push_back(tmp); - ret = model_utils->GetOutputDescs(op_desc); - EXPECT_EQ(v_output_descs.size(), ret.size()); - - delete model_utils; -} - -// test Output::GetOutputData -TEST_F(UtestNetOutput, success_get_output_data) { - Output *output = new Output(nullptr, nullptr); - output->v_input_data_addr_.push_back((void *)1); - output->v_input_size_.push_back(1); - output->input_num_ = 1; - - vector v_data_addr; - vector v_data_size; - output->GetOutputData(v_data_addr, v_data_size); - - EXPECT_EQ(output->v_input_data_addr_, v_data_addr); - EXPECT_EQ(output->v_input_size_, v_data_size); - delete output; -} -} // 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 518cfdcd..b40690e2 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -30,9 +30,6 @@ #define protected public #define private public #include "graph/manager/graph_manager.h" -#define const -#include "common/helper/model_cache_helper.h" -#undef const #include "init/gelib.h" #include "common/math/math_util.h" From 67974b31362c13d8fa986abc7ecdee3f9e50b2f4 Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Sat, 17 Jul 2021 14:41:15 +0800 Subject: [PATCH 219/226] fix pytorch infershape origin shape --- ge/graph/passes/infershape_pass.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ge/graph/passes/infershape_pass.cc b/ge/graph/passes/infershape_pass.cc index 05b1b5fc..0555929d 100755 --- a/ge/graph/passes/infershape_pass.cc +++ b/ge/graph/passes/infershape_pass.cc @@ -228,19 +228,13 @@ bool InferShapePass::SameTensorDesc(const GeTensorDescPtr &src, const GeTensorDe } graphStatus InferShapePass::UpdateTensorDesc(const GeTensorDescPtr &src, GeTensorDescPtr &dst, bool &changed) { - changed = !SameTensorDesc(src, dst); - // refresh src itself - src->SetOriginShape(src->GetShape()); - src->SetOriginDataType(src->GetDataType()); - TensorUtils::SetRealDimCnt(*src, static_cast(src->GetOriginShape().GetDims().size())); - vector> src_shape_range; - src->GetShapeRange(src_shape_range); - src->SetOriginShapeRange(src_shape_range); - - if (!changed) { + changed = false; + if (SameTensorDesc(src, dst)) { GELOGD("Peer dst tensor_desc is same as src tensor_desc. No need update."); return SUCCESS; } + + changed = true; UpdateShapeAndDType(src, dst); GELOGD( "UpdatePeerInputDesc from src Node: shape: [%s], datatype: %s, original datatype is %s." From 3dc9881cd65bef96a7583b9db4be0c9e138ddee9 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Sat, 17 Jul 2021 19:22:59 +0800 Subject: [PATCH 220/226] bugfix for taskdef's random variation in offline case --- tests/ut/ge/graph/build/task_generator_unittest.cc | 77 +++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/tests/ut/ge/graph/build/task_generator_unittest.cc b/tests/ut/ge/graph/build/task_generator_unittest.cc index 1e865050..7be20fa1 100644 --- a/tests/ut/ge/graph/build/task_generator_unittest.cc +++ b/tests/ut/ge/graph/build/task_generator_unittest.cc @@ -29,6 +29,8 @@ #define protected public #define private public +#include "init/gelib.h" +#include "ge/opskernel_manager/ops_kernel_builder_manager.h" #include "graph/build/task_generator.h" #include "graph/manager/graph_mem_manager.h" #include "graph/manager/graph_var_manager.h" @@ -41,9 +43,46 @@ using namespace ge; namespace { const char *const kIsInputVar = "INPUT_IS_VAR"; const char *const kIsOutputVar = "OUTPUT_IS_VAR"; -} +const char *const kKernelInfoNameHccl = "ops_kernel_info_hccl"; +} // namespace class UtestTaskGeneratorTest : public testing::Test { public: + struct FakeOpsKernelBuilder : OpsKernelBuilder { + FakeOpsKernelBuilder(){}; + + private: + Status Initialize(const map &options) override { + return SUCCESS; + }; + Status Finalize() override { + return SUCCESS; + }; + Status CalcOpRunningParam(Node &node) override { + return SUCCESS; + }; + Status GenerateTask(const Node &node, RunContext &context, std::vector &tasks) override { + domi::TaskDef task_def; + tasks.push_back(task_def); + return SUCCESS; + }; + }; + + struct FakeOpsKernelInfoStore : OpsKernelInfoStore { + FakeOpsKernelInfoStore() = default; + + private: + Status Initialize(const std::map &options) override { + return SUCCESS; + }; + Status Finalize() override { + return SUCCESS; + }; + bool CheckSupported(const OpDescPtr &op_desc, std::string &reason) const override { + return true; + }; + void GetAllOpsKernelInfo(std::map &infos) const override{}; + }; + ge::ComputeGraphPtr BuildGraphFpProfiling() { ge::ut::GraphBuilder builder("graph"); auto data = builder.AddNode("data", "phony", 1, 1); @@ -95,6 +134,14 @@ class UtestTaskGeneratorTest : public testing::Test { return builder.GetGraph(); } + ge::ComputeGraphPtr BuildHcclGraph() { + ge::ut::GraphBuilder builder("graph"); + auto hccl_node = builder.AddNode("hccl_phony_node", "HCCL_PHONY", 0, 0); + auto op_desc = hccl_node->GetOpDesc(); + op_desc->SetOpKernelLibName(kKernelInfoNameHccl); + op_desc->SetStreamId(0); + return builder.GetGraph(); + } protected: void SetUp() {} @@ -156,3 +203,31 @@ TEST_F(UtestTaskGeneratorTest, AutoFindBpOpIndex) { output_desc->SetName("hcom"); EXPECT_EQ(task_generator.AutoFindBpOpIndex(graph, profiling_point, all_reduce_nodes), SUCCESS); } + +TEST_F(UtestTaskGeneratorTest, GenerateTask) { + map options; + Status ret = ge::GELib::Initialize(options); + EXPECT_EQ(ret, SUCCESS); + + shared_ptr instance_ptr = ge::GELib::GetInstance(); + EXPECT_NE(instance_ptr, nullptr); + + OpsKernelInfoStorePtr ops_kernel_info_store_ptr = MakeShared(); + instance_ptr->opsManager_.ops_kernel_store_.insert(make_pair(kKernelInfoNameHccl, ops_kernel_info_store_ptr)); + + OpsKernelBuilderManager &builder_manager_instance_ptr = ge::OpsKernelBuilderManager::Instance(); + OpsKernelBuilderPtr fake_builder = MakeShared(); + builder_manager_instance_ptr.ops_kernel_builders_[kKernelInfoNameHccl] = fake_builder; + + auto graph = BuildHcclGraph(); + TaskGenerator task_generator(nullptr, 0); + RunContext run_context; + run_context.graphStreamList.push_back(static_cast(ops_kernel_info_store_ptr.get())); + vector all_reduce_nodes; + vector task_def_list; + map op_name_map; + + EXPECT_EQ(task_generator.GenerateTask(run_context, graph, task_def_list, op_name_map), SUCCESS); + EXPECT_EQ(task_def_list.size(), 1); + EXPECT_EQ(task_def_list[0].ops_kernel_store_ptr(), reinterpret_cast(ops_kernel_info_store_ptr.get())); +} \ No newline at end of file From d715f462b1723dc56cd61d31a565da2c8abc8d35 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Mon, 19 Jul 2021 09:06:53 +0800 Subject: [PATCH 221/226] Delete unused from SubGraphInfo --- ge/graph/manager/graph_manager_utils.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index efdbecf8..e17d9046 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -105,10 +105,7 @@ class SubGraphInfo { std::vector output_flag_; ModelIdInfo model_id_info_; GeModelPtr ge_model_ptr_; - bool malloc_flag_; - std::vector buffer_addr_; std::string output_names_; - std::vector buffer_size_; std::string stream_label_; std::unordered_map end_to_pld_; std::unordered_map pld_to_end_; From 84928b083e3b160bc01fc3bc201e4167fb6873c4 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Mon, 19 Jul 2021 19:19:28 +0800 Subject: [PATCH 222/226] fos code check --- ge/graph/build/task_generator.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ge/graph/build/task_generator.cc b/ge/graph/build/task_generator.cc index 1adcd0aa..abb409c4 100755 --- a/ge/graph/build/task_generator.cc +++ b/ge/graph/build/task_generator.cc @@ -387,13 +387,7 @@ Status TaskGenerator::GenerateTask(RunContext &run_context, ComputeGraphPtr &gra GE_CHK_BOOL_EXEC_INFO(!op_kernel_lib_name.empty(), continue, "Node[name:%s, type:%s] does not need to generate task.", name.c_str(), type.c_str()); auto kernel_info_store = ops_kernel_manager.GetOpsKernelInfoStore(op_kernel_lib_name); - if (kernel_info_store == nullptr) { - REPORT_INNER_ERROR("E19999", "Get ops kernel info store failed for op:%s(%s), op_kernel_name:%s", - node->GetName().c_str(), node->GetType().c_str(), op_kernel_lib_name.c_str()); - GELOGE(INTERNAL_ERROR, "[Call][GetOpsKernelInfoStore] No ops kernel store or ops kernel builder found. " - "node:%s(%s), op_kernel_lib_name=%s.", name.c_str(), type.c_str(), op_kernel_lib_name.c_str()); - return INTERNAL_ERROR; - } + GE_CHECK_NOTNULL(kernel_info_store); GE_CHK_STATUS_RET(UpdateAnchorStatus(node), "[Call][UpdateAnchorStatus] node:%s(%s) failed", name.c_str(), type.c_str()); if (node->GetOpDesc()->HasAttr(ATTR_NAME_FFTS_SUB_GRAPH)) { From 4f5a7fcefd3cebfc788cdbce74a7583b22a76a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Mon, 19 Jul 2021 19:58:54 +0800 Subject: [PATCH 223/226] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20?= =?UTF-8?q?!2028=20:=20Fix=20bug=20of=20single=5Fop.'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/single_op/single_op.cc | 4 +--- ge/single_op/task/op_task.cc | 25 +++--------------------- ge/single_op/task/op_task.h | 5 ++--- ge/single_op/task/tbe_task_builder.cc | 2 +- tests/ut/ge/single_op/single_op_task_unittest.cc | 24 ----------------------- 5 files changed, 7 insertions(+), 53 deletions(-) diff --git a/ge/single_op/single_op.cc b/ge/single_op/single_op.cc index 23f4cfad..a82c30ba 100755 --- a/ge/single_op/single_op.cc +++ b/ge/single_op/single_op.cc @@ -433,13 +433,11 @@ Status DynamicSingleOp::ExecuteAsync(const vector &input_desc, if (!inputs_size.empty()) { StreamResource *stream_resource = SingleOpManager::GetInstance().GetResource(resource_id_, stream_); GE_CHK_STATUS_RET_NOLOG(UpdateInputsBufferAddr(stream_resource, stream_, inputs_size, update_buffers)); + GE_CHK_STATUS_RET_NOLOG(SetHostTensorValue(input_desc, input_buffers)); } if (hybrid_model_executor_ != nullptr) { GELOGD("Execute multi-task dynamic single op by hybrid model executor"); - if (!inputs_size.empty()) { - GE_CHK_STATUS_RET_NOLOG(SetHostTensorValue(input_desc, input_buffers)); - } hybrid::HybridModelExecutor::ExecuteArgs args; GE_CHK_STATUS_RET_NOLOG(InitHybridModelArgs(update_buffers, output_buffers, input_desc, args)); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index ee752022..dbc90ac5 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -293,9 +293,6 @@ Status TbeOpTask::UpdateNodeByShape(const vector &input_desc, cons } Status TbeOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { - node_ = node; - tiling_buffer_ = tiling_buffer; - max_tiling_size_ = max_tiling_size; if (tiling_buffer != nullptr) { uintptr_t *arg_base = nullptr; size_t arg_num = 0; @@ -313,6 +310,9 @@ Status TbeOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, } arg_base[tiling_index] = reinterpret_cast(tiling_buffer); } + node_ = node; + tiling_buffer_ = tiling_buffer; + max_tiling_size_ = max_tiling_size; return SUCCESS; } @@ -481,25 +481,6 @@ void TbeOpTask::GetIoAddr(uintptr_t *&arg_base, size_t &arg_count) { } } -Status AtomicAddrCleanOpTask::EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) { - node_ = node; - tiling_buffer_ = tiling_buffer; - max_tiling_size_ = max_tiling_size; - if (tiling_buffer != nullptr) { - uintptr_t *arg_base = nullptr; - size_t arg_num = 0; - GetIoAddr(arg_base, arg_num); - uint32_t tiling_index = atomic_output_indices_.size(); - if (arg_num == 0 || arg_num < tiling_index) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Size]Tiling index %u, arg number %zu is invalid.", - tiling_index, arg_num); - return ACL_ERROR_GE_INTERNAL_ERROR; - } - arg_base[tiling_index] = reinterpret_cast(tiling_buffer); - } - return SUCCESS; -} - Status AtomicAddrCleanOpTask::UpdateNodeByShape(const vector &input_desc, const vector &output_desc) { return SUCCESS; diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 4a839389..132672b0 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -97,7 +97,7 @@ class TbeOpTask : public OpTask { const void *GetArgs() const; size_t GetArgSize() const; const std::string &GetStubName() const; - virtual Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size); + Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size); const std::string &GetTaskType() const override; void SetHandle(void *handle); @@ -149,7 +149,6 @@ class TbeOpTask : public OpTask { class AtomicAddrCleanOpTask : public TbeOpTask { public: Status InitAtomicAddrCleanIndices(); - Status EnableDynamicSupport(const NodePtr &node, void *tiling_buffer, uint32_t max_tiling_size) override; private: Status UpdateNodeByShape(const vector &input_desc, @@ -157,8 +156,8 @@ class AtomicAddrCleanOpTask : public TbeOpTask { Status UpdateIoAddr(const vector &inputs, const vector &outputs) override; Status UpdateTilingArgs(rtStream_t stream) override; Status CalcTilingInfo(optiling::utils::OpRunInfo &run_info) override; - std::vector atomic_output_indices_; + }; class AiCpuBaseTask : public OpTask { diff --git a/ge/single_op/task/tbe_task_builder.cc b/ge/single_op/task/tbe_task_builder.cc index f947ca57..017dac25 100644 --- a/ge/single_op/task/tbe_task_builder.cc +++ b/ge/single_op/task/tbe_task_builder.cc @@ -425,7 +425,7 @@ Status TbeTaskBuilder::InitTilingInfo(TbeOpTask &task) { GELOGD("[%s] Done allocating tiling buffer, size=%ld.", op_desc_->GetName().c_str(), max_size); } - GE_CHK_STATUS_RET_NOLOG(task.EnableDynamicSupport(node_, tiling_buffer, static_cast(max_size))); + task.EnableDynamicSupport(node_, tiling_buffer, static_cast(max_size)); return SUCCESS; } diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 9a0381cd..8964df74 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -237,27 +237,3 @@ TEST_F(UtestSingleOpTask, test_aicpu_task_update_io_addr) { ASSERT_EQ(ret, PARAM_INVALID); } } - -TEST_F(UtestSingleOpTask, test_dynamic_support) { - auto graph = make_shared("graph"); - auto op_desc = make_shared("Add", "Add"); - auto node = graph->AddNode(op_desc); - AtomicAddrCleanOpTask atomic_task; - TbeOpTask tbe_task; - - tbe_task.arg_size_ = sizeof(void *) * 1; - tbe_task.args_.reset(new (std::nothrow) uint8_t[tbe_task.arg_size_]); - atomic_task.arg_size_ = sizeof(void *) * 1; - atomic_task.args_.reset(new (std::nothrow) uint8_t[atomic_task.arg_size_]); - ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); - ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), ACL_ERROR_GE_INTERNAL_ERROR); - - tbe_task.arg_size_ = sizeof(void *) * 2; - tbe_task.args_.reset(new (std::nothrow) uint8_t[tbe_task.arg_size_]); - atomic_task.arg_size_ = sizeof(void *) * 2; - atomic_task.args_.reset(new (std::nothrow) uint8_t[atomic_task.arg_size_]); - ASSERT_EQ(tbe_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); - ASSERT_EQ(atomic_task.EnableDynamicSupport(node, (void *)0x0001, 1), SUCCESS); - tbe_task.tiling_buffer_ = nullptr; - atomic_task.tiling_buffer_ = nullptr; -} From a1dd84cc5354dd71fc494da33cc21c90505936ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=8E?= Date: Mon, 19 Jul 2021 22:32:54 +0800 Subject: [PATCH 224/226] aicpu op --- ge/engine_manager/dnnengine_manager.cc | 4 + ge/graph/load/model_manager/davinci_model.cc | 52 +++++ ge/graph/load/model_manager/davinci_model.h | 6 + .../model_manager/task_info/kernel_ex_task_info.cc | 109 +++++++++- .../model_manager/task_info/kernel_ex_task_info.h | 8 + .../model_manager/task_info/kernel_task_info.cc | 106 +++++++++- .../model_manager/task_info/kernel_task_info.h | 8 + ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc | 30 +++ ge/hybrid/node_executor/aicpu/aicpu_ext_info.h | 5 + .../node_executor/aicpu/aicpu_node_executor.cc | 121 +++++++++++ .../node_executor/aicpu/aicpu_node_executor.h | 10 +- ge/single_op/task/op_task.cc | 117 +++++++++++ ge/single_op/task/op_task.h | 7 + tests/depends/runtime/src/runtime_stub.cc | 93 ++++++++- tests/depends/runtime/src/runtime_stub.h | 70 +++++++ tests/ut/ge/CMakeLists.txt | 1 + .../ge/graph/load/kernel_ex_task_info_unittest.cc | 141 ++++++++++++- .../ut/ge/graph/load/kernel_task_info_unittest.cc | 140 ++++++++++++- .../aicpu/aicpu_node_executor_unittest.cc | 227 ++++++++++++++++++++- tests/ut/ge/single_op/single_op_task_unittest.cc | 131 +++++++++++- third_party/fwkacllib/inc/cce/fwk_adpt_struct.h | 16 ++ third_party/fwkacllib/inc/runtime/config.h | 8 + third_party/fwkacllib/inc/runtime/dev.h | 12 ++ 23 files changed, 1396 insertions(+), 26 deletions(-) create mode 100644 tests/depends/runtime/src/runtime_stub.h diff --git a/ge/engine_manager/dnnengine_manager.cc b/ge/engine_manager/dnnengine_manager.cc index 0fadd993..36f11828 100644 --- a/ge/engine_manager/dnnengine_manager.cc +++ b/ge/engine_manager/dnnengine_manager.cc @@ -239,6 +239,10 @@ std::string DNNEngineManager::GetDNNEngineName(const ge::NodePtr &node_ptr) { op_desc->SetOpEngineName(it.engine); op_desc->SetOpKernelLibName(kernel_name); // set attrs for taking information when load txt to graph object + if (it.flagAsync) { + GELOGD("Set aicpu blocking op:%s attribute(is_blocking_op):true", op_desc->GetName().c_str()); + (void)AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + } (void) AttrUtils::SetStr(op_desc, ATTR_NAME_ENGINE_NAME_FOR_LX, it.engine); (void) AttrUtils::SetStr(op_desc, ATTR_NAME_KKERNEL_LIB_NAME_FOR_LX, kernel_name); GELOGD("DNNEngineManager:Set OpKernelLibName %s and engine name %s to op_desc %s", kernel_name.c_str(), diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index aba06173..495ec28e 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -238,6 +238,12 @@ DavinciModel::~DavinciModel() { GE_LOGW_IF(rtEventDestroy(event_list_[i]) != RT_ERROR_NONE, "Destroy event failed, index: %zu", i); } + for (const auto &it : stream_2_event_) { + if (rtEventDestroy(it.second) != RT_ERROR_NONE) { + GELOGW("Destroy event failed"); + } + } + FreeWeightsMem(); FreeFeatureMapMem(); @@ -4648,4 +4654,50 @@ Status DavinciModel::GetTotalMemSizeExcludeZeroCopy(int64_t &total_useful_size) total_useful_size = runtime_param_.mem_size - runtime_param_.zero_copy_size; return SUCCESS; } + +Status DavinciModel::GetEventIdForBlockingAicpuOp(const OpDescPtr &op_desc, rtStream_t stream, uint32_t &event_id) { + GELOGI("Get event id for aicpu blocking op:%s", op_desc->GetName().c_str()); + auto it = stream_2_event_.find(stream); + if (it != stream_2_event_.end()) { + auto rt_ret = rtGetEventID(it->second, &event_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetEventID failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetEventID] failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + } else { + rtEvent_t rt_event = nullptr; + auto rt_ret = rtEventCreateWithFlag(&rt_event, RT_EVENT_WITH_FLAG); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtEventCreateWithFlag failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + GELOGE(RT_FAILED, "[Call][rtEventCreateWithFlag] failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + rt_ret = rtGetEventID(rt_event, &event_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetEventID failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetEventID] failed for op:%s(%s), ret:0x%X", + op_desc->GetName().c_str(), op_desc->GetType().c_str(), rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + stream_2_event_.emplace(stream, rt_event); + } + return SUCCESS; +} + +Status DavinciModel::GetEventByStream(const rtStream_t &stream, rtEvent_t &rt_event) { + auto it = stream_2_event_.find(stream); + if (it == stream_2_event_.end()) { + REPORT_INNER_ERROR("E19999", "Get event failed"); + GELOGE(FAILED, "[Get][Event] Get event failed"); + return FAILED; + } + rt_event = it->second; + return SUCCESS; +} } // namespace ge diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index fe89f66f..76b0beef 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -582,6 +582,10 @@ class DavinciModel { void SetRunningFlag(bool flag) { running_flg_ = flag; } Status SetRunAsyncListenerCallback(const RunAsyncCallback &callback); + // for blocking aicpu op + Status GetEventByStream(const rtStream_t &stream, rtEvent_t &rt_event); + Status GetEventIdForBlockingAicpuOp(const OpDescPtr &op_desc, rtStream_t stream, uint32_t &event_id); + private: // memory address of weights uint8_t *weights_mem_base_; @@ -1107,6 +1111,8 @@ class DavinciModel { // op name to attrs mapping std::map>> op_name_to_attrs_; + + std::map stream_2_event_; }; } // namespace ge #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_DAVINCI_MODEL_H_ diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc index 1a6ab542..fe9cd0cc 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.cc @@ -26,8 +26,8 @@ #include "external/graph/attr_value.h" #include "graph/load/model_manager/davinci_model.h" #include "graph/load/model_manager/model_manager.h" -#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" #include "framework/common/debug/log.h" +#include "runtime/rt.h" namespace { const char *const kAicpuAllshape = "_AllShape"; @@ -43,7 +43,7 @@ Status KernelExTaskInfo::InitTaskExtInfo(const std::string &ext_info, const OpDe UnknowShapeOpType unknown_type = static_cast(unknown_shape_type_val); uint32_t num_inputs = op_desc->GetInputsSize(); uint32_t num_outputs = op_desc->GetOutputsSize(); - std::unique_ptr ext_handle( + std::shared_ptr ext_handle( new(std::nothrow) ::ge::hybrid::AicpuExtInfoHandler(op_desc->GetName(), num_inputs, num_outputs, @@ -76,6 +76,16 @@ Status KernelExTaskInfo::InitTaskExtInfo(const std::string &ext_info, const OpDe } } } + + AttrUtils::GetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, is_blocking_aicpu_op_); + GELOGD("Get op:%s attribute(is_blocking_op), value:%d", op_desc->GetName().c_str(), is_blocking_aicpu_op_); + + if (UpdateEventIdForAicpuBlockingOp(op_desc, ext_handle) != SUCCESS) { + GELOGE(FAILED, "[Call][UpdateEventIdForAicpuBlockingOp] failed for op:%s(%s)", + op_desc->GetName().c_str(), op_desc->GetType().c_str()); + return FAILED; + } + auto rt_ret = rtMalloc(&ext_info_addr_, ext_handle->GetExtInfoLen(), RT_MEMORY_HBM); GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%zu, ret:0x%X", ext_info.size(), rt_ret); @@ -448,6 +458,101 @@ Status KernelExTaskInfo::Distribute() { stream_id_ = stream_id; GELOGI("KernelExTaskInfo Distribute Success. task id: %u, stream id: %u", task_id_, stream_id_); + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp() != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } + return SUCCESS; +} + +Status KernelExTaskInfo::CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support) { + int32_t device_id = 0; + auto rt_ret = rtGetDevice(&device_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDevice failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDevice] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + int32_t value = 0; + rt_ret = rtGetDeviceCapability(device_id, FEATURE_TYPE_BLOCKING_OPERATOR, RT_MODULE_TYPE_AICPU, &value); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDeviceCapability failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDeviceCapability] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + if (value != RT_AICPU_BLOCKING_OP_NOT_SUPPORT && value != RT_AICPU_BLOCKING_OP_SUPPORT) { + REPORT_INNER_ERROR("E19999", "Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + GELOGE(FAILED, "[Check][Value] Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + return FAILED; + } + is_support = (value == RT_AICPU_BLOCKING_OP_SUPPORT ? true : false); + return SUCCESS; +} + +Status KernelExTaskInfo::UpdateEventIdForAicpuBlockingOp(const OpDescPtr &op_desc, + std::shared_ptr &ext_handle) { + if (is_blocking_aicpu_op_) { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("Device not support blocking aicpu op process"); + return SUCCESS; + } + uint32_t event_id = 0; + if (davinci_model_->GetEventIdForBlockingAicpuOp(op_desc, stream_, event_id) != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Get event id failed for op:%s(%s).", op_desc->GetName().c_str(), + op_desc->GetType().c_str()); + GELOGE(FAILED, "[Get][EventId] Get event id failed for op:%s(%s)", op_desc->GetName().c_str(), + op_desc->GetType().c_str()); + return FAILED; + } + if (ext_handle->UpdateEventId(event_id) != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update event id failed for op:%s(%s).", op_desc->GetName().c_str(), + op_desc->GetType().c_str()); + GELOGE(FAILED, "[Update][EventId] Update event id failed for op:%s(%s)", op_desc->GetName().c_str(), + op_desc->GetType().c_str()); + return FAILED; + } + GELOGI("Update event_id=%u success", event_id); + } + return SUCCESS; +} + +Status KernelExTaskInfo::DistributeWaitTaskForAicpuBlockingOp() { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("Device not support blocking aicpu op process."); + return SUCCESS; + } + GELOGD("Distribute wait task begin"); + rtEvent_t rt_event = nullptr; + if (davinci_model_->GetEventByStream(stream_, rt_event) != SUCCESS) { + GELOGE(FAILED, "[Call][GetEventByStream] Call GetEventByStream failed"); + return FAILED; + } + auto rt_ret = rtStreamWaitEvent(stream_, rt_event); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtStreamWaitEvent failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + rt_ret = rtEventReset(rt_event, stream_); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtEventReset failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } return SUCCESS; } diff --git a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h index 7d07eb7f..eb411576 100644 --- a/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h +++ b/ge/graph/load/model_manager/task_info/kernel_ex_task_info.h @@ -19,6 +19,7 @@ #include "graph/load/model_manager/task_info/task_info.h" #include "graph/op_desc.h" +#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" namespace ge { class KernelExTaskInfo : public TaskInfo { @@ -65,6 +66,12 @@ class KernelExTaskInfo : public TaskInfo { void InitDumpArgs(void *addr, const OpDescPtr &op_desc); Status InitTaskExtInfo(const std::string &ext_info, const OpDescPtr &op_desc); + // for blocking aicpu op + Status DistributeWaitTaskForAicpuBlockingOp(); + Status CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support); + Status UpdateEventIdForAicpuBlockingOp(const OpDescPtr &op_desc, + std::shared_ptr &ext_handle); + uint32_t task_id_; uint32_t stream_id_; uint32_t dump_flag_; @@ -79,6 +86,7 @@ class KernelExTaskInfo : public TaskInfo { uint32_t args_offset_ = 0; int64_t fixed_addr_offset_ = 0; int32_t topic_type_flag_ = -1; + bool is_blocking_aicpu_op_ = false; }; } // namespace ge #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_KERNEL_EX_TASK_INFO_H_ diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.cc b/ge/graph/load/model_manager/task_info/kernel_task_info.cc index 019a0a8b..6bbfe58e 100755 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.cc @@ -28,11 +28,10 @@ #include "graph/load/model_manager/davinci_model.h" #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/model_utils.h" -#include "runtime/kernel.h" +#include "runtime/rt.h" #include "graph/load/model_manager/task_info/super_kernel/super_kernel.h" #include "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.h" #include "cce/aicpu_engine_struct.h" -#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" #include "framework/common/debug/log.h" namespace { @@ -474,6 +473,12 @@ Status KernelTaskInfo::Distribute() { } // set for task_id_ UpdateTaskId(); + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp() != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } GELOGD( "KernelTaskInfo Distribute Success. sktenable:%d taskid:%d sktid:%d stubfunc_name:%s stubfunc:%p " "blockdim:%d stream:%p", @@ -482,6 +487,91 @@ Status KernelTaskInfo::Distribute() { return SUCCESS; } +Status KernelTaskInfo::CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support) { + int32_t device_id = 0; + auto rt_ret = rtGetDevice(&device_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDevice failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDevice] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + int32_t value = 0; + rt_ret = rtGetDeviceCapability(device_id, FEATURE_TYPE_BLOCKING_OPERATOR, RT_MODULE_TYPE_AICPU, &value); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDeviceCapability failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDeviceCapability] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + if (value != RT_AICPU_BLOCKING_OP_NOT_SUPPORT && value != RT_AICPU_BLOCKING_OP_SUPPORT) { + REPORT_INNER_ERROR("E19999", "Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + GELOGE(FAILED, "[Check][Value] Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + return FAILED; + } + is_support = (value == RT_AICPU_BLOCKING_OP_SUPPORT ? true : false); + return SUCCESS; +} + +Status KernelTaskInfo::UpdateEventIdForAicpuBlockingOp(std::shared_ptr &ext_handle) { + if (is_blocking_aicpu_op_) { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("Device not support blocking aicpu op process"); + return SUCCESS; + } + uint32_t event_id = 0; + if (davinci_model_->GetEventIdForBlockingAicpuOp(op_desc_, stream_, event_id) != SUCCESS) { + GELOGE(FAILED, "[Get][EventId] Get event id failed for op:%s(%s)", op_desc_->GetName().c_str(), + op_desc_->GetType().c_str()); + return FAILED; + } + if (ext_handle->UpdateEventId(event_id) != SUCCESS) { + GELOGE(FAILED, "[Update][EventId] Update event id failed for op:%s(%s)", op_desc_->GetName().c_str(), + op_desc_->GetType().c_str()); + return FAILED; + } + GELOGI("Update event_id=%u success", event_id); + } + return SUCCESS; +} + +Status KernelTaskInfo::DistributeWaitTaskForAicpuBlockingOp() { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("device not support blocking aicpu op process."); + return SUCCESS; + } + GELOGD("Distribute wait task begin"); + rtEvent_t rt_event = nullptr; + if (davinci_model_->GetEventByStream(stream_, rt_event) != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Call GetEventByStream failed"); + GELOGE(FAILED, "[Call][GetEventByStream] Call GetEventByStream failed"); + return FAILED; + } + auto rt_ret = rtStreamWaitEvent(stream_, rt_event); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtStreamWaitEvent failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + rt_ret = rtEventReset(rt_event, stream_); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtEventReset failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + return SUCCESS; +} + void KernelTaskInfo::SetIoAddrs(const OpDescPtr &op_desc) { const RuntimeParam &rts_param = davinci_model_->GetRuntimeParam(); vector input_data_addrs = ModelUtils::GetInputDataAddrs(rts_param, op_desc); @@ -1109,7 +1199,7 @@ Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { UnknowShapeOpType unknown_type = static_cast(unknown_shape_type_val); uint32_t num_inputs = op_desc_->GetInputsSize(); uint32_t num_outputs = op_desc_->GetOutputsSize(); - std::unique_ptr ext_handle( + std::shared_ptr ext_handle( new(std::nothrow) ::ge::hybrid::AicpuExtInfoHandler(op_desc_->GetName(), num_inputs, num_outputs, @@ -1145,6 +1235,16 @@ Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { j, op_desc_->GetName().c_str()); } } + + AttrUtils::GetBool(op_desc_, ATTR_NAME_IS_BLOCKING_OP, is_blocking_aicpu_op_); + GELOGD("Get op:%s attribute(is_blocking_op), value:%d", op_desc_->GetName().c_str(), is_blocking_aicpu_op_); + + if (UpdateEventIdForAicpuBlockingOp(ext_handle) != SUCCESS) { + GELOGE(FAILED, "[Call][UpdateEventIdForAicpuBlockingOp] failed for op:%s(%s)", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + return FAILED; + } + auto rt_ret = rtMalloc(&aicpu_ext_info_addr_, ext_handle->GetExtInfoLen(), RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { REPORT_CALL_ERROR("E19999", "Call rtMalloc failed for op:%s(%s), size:%zu, ret:0x%X", diff --git a/ge/graph/load/model_manager/task_info/kernel_task_info.h b/ge/graph/load/model_manager/task_info/kernel_task_info.h index d9dd30bb..59a91aee 100644 --- a/ge/graph/load/model_manager/task_info/kernel_task_info.h +++ b/ge/graph/load/model_manager/task_info/kernel_task_info.h @@ -24,6 +24,8 @@ #include "graph/load/model_manager/task_info/task_info.h" #include "graph/op_desc.h" +#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" + namespace ge { class KernelTaskInfo : public TaskInfo { public: @@ -148,6 +150,11 @@ class KernelTaskInfo : public TaskInfo { bool DoubleCallSKTSaveCheck(); void SetArgs(); + // for blocking aicpu op + Status DistributeWaitTaskForAicpuBlockingOp(); + Status CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support); + Status UpdateEventIdForAicpuBlockingOp(std::shared_ptr &ext_handle); + void *stub_func_; void *args_; void *sm_desc_; @@ -187,6 +194,7 @@ class KernelTaskInfo : public TaskInfo { uint32_t skt_dump_flag_ = RT_KERNEL_DEFAULT; void *superkernel_device_args_addr_ = nullptr; void *superkernel_dev_nav_table_ = nullptr; + bool is_blocking_aicpu_op_ = false; struct AICPUCustomInfo { void *input_descs = nullptr; diff --git a/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc b/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc index c607a43e..6e8841b9 100644 --- a/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc +++ b/ge/hybrid/node_executor/aicpu/aicpu_ext_info.cc @@ -81,6 +81,9 @@ Status AicpuExtInfoHandler::Parse(const std::string &ext_info) { case aicpu::FWKAdapter::FWK_ADPT_EXT_TOPIC_TYPE: GE_CHK_STATUS_RET(ParseExtTopicType(aicpu_ext_info), "[Parse][ExtTopicType] failed."); break; + case aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT: + GE_CHK_STATUS_RET(ParseExtAsyncWait(aicpu_ext_info), "[Parse][ExtAsyncWait] failed."); + break; default: GELOGD("Node[%s] ignore infoType=%d, infoLen=%u.", node_name_.c_str(), aicpu_ext_info->infoType, aicpu_ext_info->infoLen); @@ -101,6 +104,22 @@ Status AicpuExtInfoHandler::Parse(const std::string &ext_info) { return SUCCESS; } +Status AicpuExtInfoHandler::ParseExtAsyncWait(AicpuExtInfo *aicpu_ext_info) { + if (aicpu_ext_info->infoLen != sizeof(AsyncWaitInfo)) { + REPORT_INNER_ERROR("E19999", + "Node[%s] parse ext async wait info failed as infoLen must be %zu but %u.", + node_name_.c_str(), sizeof(AsyncWaitInfo), aicpu_ext_info->infoLen); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, + "[Check][DataLen]Node[%s] parse ext async wait info failed as infoLen must be %zu but %u.", + node_name_.c_str(), sizeof(AsyncWaitInfo), aicpu_ext_info->infoLen); + return ACL_ERROR_GE_PARAM_INVALID; + } + + async_wait_ = reinterpret_cast(aicpu_ext_info->infoMsg); + GELOGI("Node[%s] parse async wait info success infoLen=%u.", node_name_.c_str(), aicpu_ext_info->infoLen); + return SUCCESS; +} + Status AicpuExtInfoHandler::ParseExtShapeType(AicpuExtInfo *aicpu_ext_info) { GE_IF_BOOL_EXEC(aicpu_ext_info->infoLen != sizeof(int32_t), REPORT_INNER_ERROR("E19999", "Node[%s] parse ext shape type failed as infoLen must be %zu but %u.", @@ -280,6 +299,17 @@ Status AicpuExtInfoHandler::UpdateSessionInfo(uint64_t session_id, uint64_t kern return SUCCESS; } +Status AicpuExtInfoHandler::UpdateEventId(uint32_t event_id) { + if (async_wait_ == nullptr) { + REPORT_INNER_ERROR("E19999", "async_wait_ is nullptr."); + GELOGE(FAILED, "[Check][async_wait_] async_wait_ is nullptr."); + return FAILED; + } + async_wait_->waitType = 1; + async_wait_->waitId = event_id; + return SUCCESS; +} + Status AicpuExtInfoHandler::UpdateSessionInfoSessionId(uint64_t session_id) { if (session_info_ == nullptr) { GELOGD("There is no session info in ext_info, no need update."); diff --git a/ge/hybrid/node_executor/aicpu/aicpu_ext_info.h b/ge/hybrid/node_executor/aicpu/aicpu_ext_info.h index 46fb7c05..80e3bb92 100644 --- a/ge/hybrid/node_executor/aicpu/aicpu_ext_info.h +++ b/ge/hybrid/node_executor/aicpu/aicpu_ext_info.h @@ -27,6 +27,7 @@ namespace ge { namespace hybrid { using AicpuShapeAndType = aicpu::FWKAdapter::ShapeAndType; using AicpuExtInfo = aicpu::FWKAdapter::ExtInfo; +using AsyncWaitInfo = aicpu::FWKAdapter::AsyncWait; using AicpuSessionInfo = SessionInfo; class AicpuExtInfoHandler { @@ -59,6 +60,8 @@ class AicpuExtInfoHandler { Status UpdateExecuteMode(bool flag); + Status UpdateEventId(uint32_t event_id); + Status GetOutputShapeAndType(uint32_t output_index, GeShape &shape, DataType &data_type); bool IsNeedRefreshIOAddr(); @@ -73,6 +76,7 @@ class AicpuExtInfoHandler { Status ParseExtBitMap(AicpuExtInfo *aicpu_ext_info); Status ParseExtUpdateAddr(AicpuExtInfo *aicpu_ext_info); Status ParseExtTopicType(AicpuExtInfo *aicpu_ext_info); + Status ParseExtAsyncWait(AicpuExtInfo *aicpu_ext_info); static Status UpdateShapeAndType(const GeShape &shape, DataType data_type, @@ -90,6 +94,7 @@ class AicpuExtInfoHandler { const uint32_t output_num_; UnknowShapeOpType unknown_type_; AicpuSessionInfo *session_info_ = nullptr; + AsyncWaitInfo *async_wait_ = nullptr; uint64_t *bit_map_ = nullptr; uint32_t *update_addr_ = nullptr; int32_t topic_type_flag_ = -1; diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc index cf20303c..f309ebd0 100755 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.cc @@ -22,6 +22,7 @@ #include "graph/utils/node_utils.h" #include "hybrid/executor/hybrid_execution_context.h" #include "hybrid/model/hybrid_model.h" +#include "runtime/rt.h" namespace ge { namespace hybrid { @@ -33,6 +34,12 @@ const char *const kAicpuAllshape = "_AllShape"; REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICPU_TF, AiCpuNodeExecutor); REGISTER_NODE_EXECUTOR_BUILDER(NodeExecutorManager::ExecutorType::AICPU_CUSTOM, AiCpuNodeExecutor); +AicpuNodeTaskBase::~AicpuNodeTaskBase() { + if (rt_event_ != nullptr) { + (void)rtEventDestroy(rt_event_); + } +} + Status AicpuNodeTaskBase::AllocTensorBuffer(size_t size, std::unique_ptr &tensor_buffer) { auto allocator = NpuMemoryAllocator::GetAllocator(); GE_CHECK_NOTNULL(allocator); @@ -64,6 +71,13 @@ Status AicpuNodeTaskBase::InitExtInfo(const std::string &kernel_ext_info, int64_ GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateSessionInfoSessionId(session_id), "[Update][SessionInfoSessionId] failed, session_id:%ld.", session_id); + if (is_blocking_aicpu_op_) { + if (UpdateEventIdForBlockingAicpuOp() != SUCCESS) { + GELOGE(FAILED, "[Call][UpdateEventIdForBlockingAicpuOp] Call UpdateEventIdForBlockingAicpuOp failed"); + return FAILED; + } + } + // copy task args buf GE_CHK_STATUS_RET(AllocTensorBuffer(aicpu_ext_handle_.GetExtInfoLen(), ext_info_addr_dev_), "[Invoke][AllocTensorBuffer]Node[%s] alloc kernel_ext_info buf failed, size=%zu", @@ -230,6 +244,96 @@ Status AicpuNodeTaskBase::ExecuteAsync(TaskContext &context, std::functionnum_outputs == 0)) { GELOGD("Node[%s] type[%s] unknown_type is %d, output num is %d.", @@ -325,6 +429,9 @@ Status AicpuTfNodeTask::Init(const HybridModel &model) { // init ext info uint64_t ext_session_id = model.GetSessionId(); + const OpDescPtr op_desc = node_item_->GetOpDesc(); + AttrUtils::GetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, is_blocking_aicpu_op_); + GELOGD("Get op:%s attribute(is_blocking_op), value:%d", op_desc->GetName().c_str(), is_blocking_aicpu_op_); GE_CHK_STATUS_RET(InitExtInfo(kernel_ext_info, ext_session_id), "[Init][ExtInfo] failed for Node[%s].", node_name_.c_str()); GE_CHK_STATUS_RET(InitForDependComputeTask(), "[Init][DependComputeTask] failed for Node[%s].", node_name_.c_str()); @@ -642,6 +749,12 @@ Status AicpuTfNodeTask::LaunchTask(TaskContext &context) { kernel_buf_->GetSize(), flag, context.GetStream())); RECORD_EXECUTION_EVENT(context.GetExecutionContext(), node_name_.c_str(), "[AicpuTfNodertKernelLaunchEx] End"); GELOGD("Node[%s] launch end.", node_name_.c_str()); + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp(context.GetStream()) != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } if (need_sync_) { GELOGD("[%s] Task needs sync", node_name_.c_str()); GE_CHK_STATUS_RET_NOLOG(context.Synchronize()); @@ -760,6 +873,8 @@ Status AicpuNodeTask::Init(const HybridModel &model) { return FAILED;); uint64_t ext_session_id = model.GetSessionId(); + AttrUtils::GetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, is_blocking_aicpu_op_); + GELOGD("Get op:%s attribute(is_blocking_op), value:%d", op_desc->GetName().c_str(), is_blocking_aicpu_op_); GE_CHK_STATUS_RET(InitExtInfo(kernel_ext_info, ext_session_id), "[Init][ExtInfo] failed for Node[%s].", node_name.c_str()); @@ -826,6 +941,12 @@ Status AicpuNodeTask::LaunchTask(TaskContext &context) { args_.get(), args_size_, nullptr, context.GetStream(), flag); GE_CHK_RT_RET(rt_ret); + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp(context.GetStream()) != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } GELOGD("Node[%s] launch task end.", node_name_.c_str()); return SUCCESS; } diff --git a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h index 14bc8fcc..3911e090 100644 --- a/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h +++ b/ge/hybrid/node_executor/aicpu/aicpu_node_executor.h @@ -35,7 +35,7 @@ class AicpuNodeTaskBase : public NodeTask { node_item->num_outputs, node_item->shape_inference_type) {} - ~AicpuNodeTaskBase() override = default; + ~AicpuNodeTaskBase() override; using NodeTask::Init; @@ -61,6 +61,10 @@ class AicpuNodeTaskBase : public NodeTask { static Status AllocTensorBuffer(size_t size, std::unique_ptr &tensor_buffer); + Status DistributeWaitTaskForAicpuBlockingOp(rtStream_t stream); + Status CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support); + Status UpdateEventIdForBlockingAicpuOp(); + protected: const NodeItem *node_item_; // just reference. @@ -78,6 +82,10 @@ class AicpuNodeTaskBase : public NodeTask { // ext info addr, device mem std::unique_ptr ext_info_addr_dev_; + + // for blocking aicpu op + bool is_blocking_aicpu_op_ = false; + rtEvent_t rt_event_ = nullptr; }; class AicpuTfNodeTask : public AicpuNodeTaskBase { diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index dbc90ac5..83cb0529 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -564,6 +564,41 @@ AiCpuBaseTask::~AiCpuBaseTask() { if (ext_info_addr_dev_ != nullptr) { (void)rtFree(ext_info_addr_dev_); } + if (rt_event_ != nullptr) { + (void)rtEventDestroy(rt_event_); + } +} + +Status AiCpuBaseTask::UpdateEventIdForBlockingAicpuOp() { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("Device not support blocking aicpu op process"); + return SUCCESS; + } + uint32_t event_id = 0; + auto rt_ret = rtEventCreateWithFlag(&rt_event_, RT_EVENT_WITH_FLAG); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtEventCreateWithFlag failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtEventCreateWithFlag] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + rt_ret = rtGetEventID(rt_event_, &event_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetEventID failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetEventID] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + if (aicpu_ext_handle_->UpdateEventId(event_id) != SUCCESS) { + REPORT_CALL_ERROR("E19999", "Update event id=%u failed.", event_id); + GELOGE(FAILED, "[Update][EventId] Update event id failed", event_id); + return FAILED; + } + GELOGI("Update event_id=%u success", event_id); + return SUCCESS; } Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint64_t kernel_id) { @@ -577,6 +612,9 @@ Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint GELOGD("Get unknown_type is %d.", unknown_shape_type_val); unknown_type_ = static_cast(unknown_shape_type_val); + AttrUtils::GetBool(op_desc_, ATTR_NAME_IS_BLOCKING_OP, is_blocking_aicpu_op_); + GELOGD("Get op:%s attribute(is_blocking_op), value:%d", op_desc_->GetName().c_str(), is_blocking_aicpu_op_); + aicpu_ext_handle_.reset(new(std::nothrow) ::ge::hybrid::AicpuExtInfoHandler(op_desc_->GetName(), num_inputs_, num_outputs_, @@ -595,6 +633,13 @@ Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(ULLONG_MAX, kernel_id, false), "[Update][SessionInfo] failed."); + if (is_blocking_aicpu_op_) { + if (UpdateEventIdForBlockingAicpuOp() != SUCCESS) { + GELOGE(FAILED, "[Call][UpdateEventIdForBlockingAicpuOp] Call UpdateEventIdForBlockingAicpuOp failed"); + return FAILED; + } + } + GE_CHK_RT_RET(rtMalloc(&ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), RT_MEMORY_HBM)); GE_CHK_RT_RET(rtMemcpy(ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), aicpu_ext_handle_->GetExtInfo(), aicpu_ext_handle_->GetExtInfoLen(), @@ -770,6 +815,63 @@ Status AiCpuBaseTask::UpdateIoAddr(const vector &inputs, const vecto return SUCCESS; } +Status AiCpuBaseTask::CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support) { + int32_t device_id = 0; + auto rt_ret = rtGetDevice(&device_id); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDevice failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDevice] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + int32_t value = 0; + rt_ret = rtGetDeviceCapability(device_id, FEATURE_TYPE_BLOCKING_OPERATOR, RT_MODULE_TYPE_AICPU, &value); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtGetDeviceCapability failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtGetDeviceCapability] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + if (value != RT_AICPU_BLOCKING_OP_NOT_SUPPORT && value != RT_AICPU_BLOCKING_OP_SUPPORT) { + REPORT_INNER_ERROR("E19999", "Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + GELOGE(FAILED, "[Check][Value] Value should be %d or %d but %d", + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, RT_AICPU_BLOCKING_OP_SUPPORT, value); + return FAILED; + } + is_support = (value == RT_AICPU_BLOCKING_OP_SUPPORT ? true : false); + return SUCCESS; +} + +Status AiCpuBaseTask::DistributeWaitTaskForAicpuBlockingOp(rtStream_t stream) { + bool is_support = false; + if (CheckDeviceSupportBlockingAicpuOpProcess(is_support) != SUCCESS) { + GELOGE(FAILED, "[Call][CheckDeviceSupportBlockingAicpuOpProcess] Call CheckDeviceSupportBlockingAicpuOpProcess failed"); + return FAILED; + } + if (!is_support) { + GELOGD("Device not support blocking aicpu op process."); + return SUCCESS; + } + GELOGI("Distribute queue task begin"); + if (rt_event_ == nullptr) { + REPORT_INNER_ERROR("E19999", "rt_event_ is nullptr"); + GELOGE(FAILED, "[Check][rt_event_] rt_event_ is nullptr"); + return FAILED; + } + auto rt_ret = rtStreamWaitEvent(stream, rt_event_); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtStreamWaitEvent failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + rt_ret = rtEventReset(rt_event_, stream); + if (rt_ret != RT_ERROR_NONE) { + REPORT_CALL_ERROR("E19999", "Call rtEventReset failed, ret:0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][RtApi] failed, ret:0x%X", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + return SUCCESS; +} + AiCpuTask::~AiCpuTask() { FreeHbm(args_); FreeHbm(io_addr_); @@ -813,6 +915,14 @@ Status AiCpuTask::LaunchKernel(rtStream_t stream) { GELOGI("[TASK_INFO] %lu/%s", kernel_id_, op_type_.c_str()); GELOGD("Done launch kernel successfully. task = %s", this->op_type_.c_str()); + + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp(stream) != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } + return SUCCESS; } @@ -1089,6 +1199,13 @@ Status AiCpuCCTask::LaunchKernel(rtStream_t stream) { } GELOGI("[TASK_INFO] %lu/%s", kernel_id_, op_type_.c_str()); GELOGD("Invoke rtCpuKernelLaunch succeeded"); + + if (is_blocking_aicpu_op_) { + if (DistributeWaitTaskForAicpuBlockingOp(stream) != SUCCESS) { + GELOGE(FAILED, "[Call][DistributeWaitTaskForAicpuBlockingOp] Call DistributeWaitTaskForAicpuBlockingOp failed"); + return FAILED; + } + } return SUCCESS; } diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 132672b0..adf51dba 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -178,6 +178,10 @@ class AiCpuBaseTask : public OpTask { rtStream_t stream); Status UpdateOutputShape(vector &output_desc); Status UpdateShapeToOutputDesc(const GeShape &shape_new, GeTensorDesc &output_desc); + // for blocking aicpu op + Status DistributeWaitTaskForAicpuBlockingOp(rtStream_t stream); + Status UpdateEventIdForBlockingAicpuOp(); + Status CheckDeviceSupportBlockingAicpuOpProcess(bool &is_support); protected: size_t num_inputs_ = 0; @@ -186,6 +190,9 @@ class AiCpuBaseTask : public OpTask { std::unique_ptr aicpu_ext_handle_; void *ext_info_addr_dev_ = nullptr; vector input_is_const_; + // for blocking aicpu op + bool is_blocking_aicpu_op_ = false; + rtEvent_t rt_event_ = nullptr; }; class AiCpuTask : public AiCpuBaseTask { diff --git a/tests/depends/runtime/src/runtime_stub.cc b/tests/depends/runtime/src/runtime_stub.cc index 25d6c2d3..32df7552 100644 --- a/tests/depends/runtime/src/runtime_stub.cc +++ b/tests/depends/runtime/src/runtime_stub.cc @@ -16,12 +16,94 @@ #include #include +#include "runtime_stub.h" +#include "runtime/rt.h" + +#define ADD_STUB_RETURN_VALUE(FUNC, TYPE) std::vector g_Stub_##FUNC##_RETURN + +#define GET_STUB_RETURN_VALUE(FUNC, TYPE, DEFAULT) ({ \ + TYPE result = DEFAULT; \ + if (!g_Stub_##FUNC##_RETURN.empty()) { \ + result = g_Stub_##FUNC##_RETURN.back(); \ + g_Stub_##FUNC##_RETURN.pop_back(); \ + } \ + result; \ +}) + +#define DEL_STUB_RETURN_VALUE(FUNC, TYPE) \ +do { \ + extern std::vector g_Stub_##FUNC##_RETURN; \ + g_Stub_##FUNC##_RETURN.clear(); \ +} while (0) + + +#define ADD_STUB_OUTBOUND_VALUE(FUNC, TYPE, NAME) std::vector g_Stub_##FUNC##_OUT_##NAME + +#define GET_STUB_OUTBOUND_VALUE(FUNC, TYPE, NAME, DEFAULT) ({ \ + TYPE value; \ + if (!g_Stub_##FUNC##_OUT_##NAME.empty()) { \ + value = g_Stub_##FUNC##_OUT_##NAME.back(); \ + g_Stub_##FUNC##_OUT_##NAME.pop_back(); \ + } else { \ + value = DEFAULT; \ + } \ + value; \ +}) + +#define DEL_STUB_OUTBOUND_VALUE(FUNC, TYPE, NAME) \ +do { \ + extern std::vector g_Stub_##FUNC##_OUT_##NAME; \ + g_Stub_##FUNC##_OUT_##NAME.clear(); \ +} while (0) #ifdef __cplusplus extern "C" { #endif #define EVENT_LENTH 10 +void rtStubTearDown() { + DEL_STUB_RETURN_VALUE(rtGetDevice, rtError_t); + DEL_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t); + DEL_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t); + DEL_STUB_RETURN_VALUE(rtEventReset, rtError_t); + DEL_STUB_RETURN_VALUE(rtEventCreate, rtError_t); + DEL_STUB_RETURN_VALUE(rtGetEventID, rtError_t); +} + +ADD_STUB_RETURN_VALUE(rtGetDevice, rtError_t); +rtError_t rtGetDevice(int32_t *device) { + return GET_STUB_RETURN_VALUE(rtGetDevice, rtError_t, RT_ERROR_NONE); +} + +ADD_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t); +ADD_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value); +rtError_t rtGetDeviceCapability(int32_t device, int32_t moduleType, int32_t featureType, int32_t *value) { + *value = GET_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT); + return GET_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); +} + +ADD_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t); +rtError_t rtStreamWaitEvent(rtStream_t stream, rtEvent_t event) { + return GET_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, RT_ERROR_NONE); +} + +ADD_STUB_RETURN_VALUE(rtEventReset, rtError_t); +rtError_t rtEventReset(rtEvent_t event, rtStream_t stream) { + return GET_STUB_RETURN_VALUE(rtEventReset, rtError_t, RT_ERROR_NONE); +} + +ADD_STUB_RETURN_VALUE(rtEventCreate, rtError_t); +rtError_t rtEventCreate(rtEvent_t *event) { + *event = new int[EVENT_LENTH]; + return GET_STUB_RETURN_VALUE(rtEventCreate, rtError_t, RT_ERROR_NONE); +} + +ADD_STUB_RETURN_VALUE(rtGetEventID, rtError_t); +rtError_t rtGetEventID(rtEvent_t event, uint32_t *event_id) { + *event_id = 0; + return GET_STUB_RETURN_VALUE(rtEventCreate, rtError_t, RT_ERROR_NONE); +} + rtError_t rtCtxSetCurrent(rtContext_t ctx) { return RT_ERROR_NONE; } rtError_t rtGetStreamId(rtStream_t stream, int32_t *stream_id) { @@ -42,11 +124,6 @@ rtError_t rtEventGetTimeStamp(uint64_t *time, rtEvent_t event) { return RT_ERROR_NONE; } -rtError_t rtEventCreate(rtEvent_t *event) { - *event = new int[EVENT_LENTH]; - return RT_ERROR_NONE; -} - rtError_t rtEventCreateWithFlag(rtEvent_t *event, uint32_t flag) { return rtEventCreate(event); } @@ -112,8 +189,6 @@ rtError_t rtMemcpyAsync(void *dst, uint64_t dest_max, const void *src, uint64_t return RT_ERROR_NONE; } -rtError_t rtStreamWaitEvent(rtStream_t stream, rtEvent_t event) { return RT_ERROR_NONE; } - rtError_t rtSetTSDevice(uint32_t tsId) { return RT_ERROR_NONE; } @@ -347,10 +422,6 @@ rtError_t rtStreamSwitchEx(void *ptr, rtCondition_t condition, void *value_ptr, rtError_t rtStreamActive(rtStream_t active_stream, rtStream_t stream) { return RT_ERROR_NONE; } -rtError_t rtEventReset(rtEvent_t event, rtStream_t stream) { return RT_ERROR_NONE; } - -rtError_t rtGetDevice(int32_t *device) { return RT_ERROR_NONE; } - rtError_t rtDatadumpInfoLoad(const void *dump_info, uint32_t length) { return RT_ERROR_NONE; } rtError_t rtKernelLaunchWithFlag(const void *stub_func, uint32_t block_dim, void *args, uint32_t args_size, diff --git a/tests/depends/runtime/src/runtime_stub.h b/tests/depends/runtime/src/runtime_stub.h new file mode 100644 index 00000000..b693b9ea --- /dev/null +++ b/tests/depends/runtime/src/runtime_stub.h @@ -0,0 +1,70 @@ +/** + * 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. + */ + +#ifndef __INC_LLT_RUNTIME_STUB_H +#define __INC_LLT_RUNTIME_STUB_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif +void rtStubTearDown(); + +#define RTS_STUB_SETUP() \ +do { \ + rtStubTearDown(); \ +} while (0) + +#define RTS_STUB_TEARDOWN() \ +do { \ + rtStubTearDown(); \ +} while (0) + +#define RTS_STUB_RETURN_VALUE(FUNC, TYPE, VALUE) \ +do { \ + g_Stub_##FUNC##_RETURN.emplace(g_Stub_##FUNC##_RETURN.begin(), VALUE); \ +} while (0) + +#define RTS_STUB_OUTBOUND_VALUE(FUNC, TYPE, NAME, VALUE) \ +do { \ + g_Stub_##FUNC##_OUT_##NAME.emplace(g_Stub_##FUNC##_OUT_##NAME.begin(), VALUE); \ +} while (0) + + +#define RTS_STUB_RETURN_EXTERN(FUNC, TYPE) extern std::vector g_Stub_##FUNC##_RETURN; +#define RTS_STUB_OUTBOUND_EXTERN(FUNC, TYPE, NAME) extern std::vector g_Stub_##FUNC##_OUT_##NAME; + +RTS_STUB_RETURN_EXTERN(rtGetDevice, rtError_t); +RTS_STUB_OUTBOUND_EXTERN(rtGetDevice, int32_t, device) + +RTS_STUB_RETURN_EXTERN(rtGetDeviceCapability, rtError_t); +RTS_STUB_OUTBOUND_EXTERN(rtGetDeviceCapability, int32_t, value); + +RTS_STUB_RETURN_EXTERN(rtStreamWaitEvent, rtError_t); + +RTS_STUB_RETURN_EXTERN(rtEventReset, rtError_t); + +RTS_STUB_RETURN_EXTERN(rtEventCreate, rtError_t); +RTS_STUB_OUTBOUND_EXTERN(rtEventCreate, rtEvent_t, event); + +RTS_STUB_RETURN_EXTERN(rtGetEventID, rtError_t); +RTS_STUB_OUTBOUND_EXTERN(rtEventCreate, uint32_t, event_id); + +#ifdef __cplusplus +} +#endif +#endif // __INC_LLT_RUNTIME_STUB_H diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index a0790cf2..f9d9e857 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -935,6 +935,7 @@ target_link_libraries(ge_single_op PRIVATE ascend_protobuf json c_sec + runtime_stub ) # ut binary diff --git a/tests/ut/ge/graph/load/kernel_ex_task_info_unittest.cc b/tests/ut/ge/graph/load/kernel_ex_task_info_unittest.cc index 327dd248..86569789 100644 --- a/tests/ut/ge/graph/load/kernel_ex_task_info_unittest.cc +++ b/tests/ut/ge/graph/load/kernel_ex_task_info_unittest.cc @@ -23,15 +23,20 @@ #include "graph/load/model_manager/task_info/kernel_ex_task_info.h" #include "cce/aicpu_engine_struct.h" +#include "tests/depends/runtime/src/runtime_stub.h" namespace ge { extern OpDescPtr CreateOpDesc(string name, string type); class UtestKernelExTaskInfo : public testing::Test { protected: - void SetUp() {} + void SetUp() { + RTS_STUB_SETUP(); + } - void TearDown() {} + void TearDown() { + RTS_STUB_TEARDOWN(); + } }; // test kernel_ex_task_Release @@ -209,4 +214,136 @@ TEST_F(UtestKernelExTaskInfo, parse_topic_type_failed_2) { KernelExTaskInfo kernel_ex_task_info; EXPECT_NE(kernel_ex_task_info.InitTaskExtInfo(ext_info, op_desc), SUCCESS); } + +TEST_F(UtestKernelExTaskInfo, blocking_aicpu_op) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::TaskDef task_def; + domi::KernelExDef kernel_ex_def; + kernel_ex_def.set_kernel_ext_info(buf, len); + kernel_ex_def.set_kernel_ext_info_size(len); + domi::KernelExDef *kernel_ex_def_tmp = task_def.mutable_kernel_ex(); + *kernel_ex_def_tmp = kernel_ex_def; + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + + KernelExTaskInfo kernel_ex_task_info; + kernel_ex_task_info.op_desc_ = op_desc; + DavinciModel davinci_model(0, nullptr); + kernel_ex_task_info.davinci_model_ = &davinci_model; + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + EXPECT_EQ(kernel_ex_task_info.Distribute(), SUCCESS); + kernel_ex_task_info.op_desc_ = op_desc; + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + EXPECT_EQ(kernel_ex_task_info.Distribute(), SUCCESS); +} + +TEST_F(UtestKernelExTaskInfo, blocking_aicpu_op_fail_01) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::TaskDef task_def; + domi::KernelExDef kernel_ex_def; + kernel_ex_def.set_kernel_ext_info(buf, len); + kernel_ex_def.set_kernel_ext_info_size(len); + domi::KernelExDef *kernel_ex_def_tmp = task_def.mutable_kernel_ex(); + *kernel_ex_def_tmp = kernel_ex_def; + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + + KernelExTaskInfo kernel_ex_task_info; + kernel_ex_task_info.op_desc_ = op_desc; + DavinciModel davinci_model(0, nullptr); + kernel_ex_task_info.davinci_model_ = &davinci_model; + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + + kernel_ex_task_info.is_blocking_aicpu_op_ = true; + EXPECT_EQ(kernel_ex_task_info.Distribute(), FAILED); +} + +TEST_F(UtestKernelExTaskInfo, blocking_aicpu_op_fail_02) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::TaskDef task_def; + domi::KernelExDef kernel_ex_def; + kernel_ex_def.set_kernel_ext_info(buf, len); + kernel_ex_def.set_kernel_ext_info_size(len); + domi::KernelExDef *kernel_ex_def_tmp = task_def.mutable_kernel_ex(); + *kernel_ex_def_tmp = kernel_ex_def; + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + KernelExTaskInfo kernel_ex_task_info; + kernel_ex_task_info.op_desc_ = op_desc; + DavinciModel davinci_model(0, nullptr); + kernel_ex_task_info.davinci_model_ = &davinci_model; + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT + 1); + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.Distribute(), FAILED); + + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + RTS_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.Distribute(), FAILED); + + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + RTS_STUB_RETURN_VALUE(rtEventReset, rtError_t, 0x78000001); + EXPECT_EQ(kernel_ex_task_info.Distribute(), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(kernel_ex_task_info.InitTaskExtInfo(kernel_ex_def.kernel_ext_info(), op_desc), SUCCESS); + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(kernel_ex_task_info.Distribute(), SUCCESS); +} + } // namespace ge diff --git a/tests/ut/ge/graph/load/kernel_task_info_unittest.cc b/tests/ut/ge/graph/load/kernel_task_info_unittest.cc index 0c8da4b5..45ae7853 100644 --- a/tests/ut/ge/graph/load/kernel_task_info_unittest.cc +++ b/tests/ut/ge/graph/load/kernel_task_info_unittest.cc @@ -22,15 +22,20 @@ #include "graph/load/model_manager/davinci_model.h" #include "graph/load/model_manager/task_info/kernel_task_info.h" #include "graph/load/model_manager/task_info/hccl_task_info.h" +#include "tests/depends/runtime/src/runtime_stub.h" namespace ge { extern OpDescPtr CreateOpDesc(string name, string type); class UtestKernelTaskInfo : public testing::Test { protected: - void SetUp() {} + void SetUp() { + RTS_STUB_SETUP(); + } - void TearDown() {} + void TearDown() { + RTS_STUB_TEARDOWN(); + } }; // test KernelTaskInfo Init. @@ -1240,4 +1245,135 @@ TEST_F(UtestKernelTaskInfo, kernel_task_info_super_kernel_info) { EXPECT_EQ(kernel_task_info.SKTFinalize(), SUCCESS); } +TEST_F(UtestKernelTaskInfo, blocking_aicpu_op) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::TaskDef task_def; + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + op_desc->SetId(0); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + DavinciModel davinci_model(0, nullptr); + davinci_model.op_list_.emplace(0, op_desc); + + KernelTaskInfo kernel_task_info; + kernel_task_info.op_desc_ = op_desc; + kernel_task_info.davinci_model_ = &davinci_model; + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + EXPECT_EQ(kernel_task_info.Distribute(), SUCCESS); + kernel_task_info.op_desc_ = op_desc; + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + EXPECT_EQ(kernel_task_info.Distribute(), SUCCESS); +} + +TEST_F(UtestKernelTaskInfo, blocking_aicpu_op_fail_01) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + op_desc->SetId(0); + DavinciModel davinci_model(0, nullptr); + davinci_model.op_list_.emplace(0, op_desc); + + KernelTaskInfo kernel_task_info; + kernel_task_info.davinci_model_ = &davinci_model; + kernel_task_info.op_desc_ = op_desc; + + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + + kernel_task_info.is_blocking_aicpu_op_ = true; + EXPECT_EQ(kernel_task_info.Distribute(), FAILED); +} + +TEST_F(UtestKernelTaskInfo, blocking_aicpu_op_fail_02) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + const OpDescPtr op_desc = CreateOpDesc("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + op_desc->SetId(0); + DavinciModel davinci_model(0, nullptr); + davinci_model.op_list_.emplace(0, op_desc); + + KernelTaskInfo kernel_task_info; + kernel_task_info.davinci_model_ = &davinci_model; + kernel_task_info.op_desc_ = op_desc; + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT + 1); + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.Distribute(), FAILED); + + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + RTS_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.Distribute(), FAILED); + + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + RTS_STUB_RETURN_VALUE(rtEventReset, rtError_t, 0x78000001); + EXPECT_EQ(kernel_task_info.Distribute(), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(kernel_task_info.InitAicpuTaskExtInfo(kernel_def.kernel_ext_info()), SUCCESS); + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(kernel_task_info.Distribute(), SUCCESS); +} + } // namespace ge diff --git a/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc b/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc index b225949b..034b3f47 100644 --- a/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/aicpu/aicpu_node_executor_unittest.cc @@ -27,7 +27,7 @@ #include "hybrid/node_executor/aicpu/aicpu_node_executor.h" #undef protected #undef private - +#include "tests/depends/runtime/src/runtime_stub.h" using namespace std; using namespace testing; @@ -43,8 +43,12 @@ using namespace hybrid; class UtestAicpuNodeExecutor : public testing::Test { protected: - void SetUp() {} - void TearDown() {} + void SetUp() { + RTS_STUB_SETUP(); + } + void TearDown() { + RTS_STUB_TEARDOWN(); + } }; static NodePtr CreateNode(ComputeGraphPtr graph, const string &name, const string &type, int in_num, int out_num) { @@ -164,5 +168,222 @@ TEST_F(UtestAicpuNodeExecutor, aicpu_tf_node_task) { } +TEST_F(UtestAicpuNodeExecutor, aicpu_blocking_node_task) { + ComputeGraphPtr graph = std::make_shared("test"); + GeRootModelPtr ge_root_model = std::make_shared(graph); + ge_root_model->SetModelName("test_name"); + HybridModel hybrid_model(ge_root_model); + + NodePtr node = CreateNode(graph, "deque", FRAMEWORK_OP_TYPE, 1, 1); + ge::AttrUtils::SetBool(node->GetOpDesc(), ATTR_NAME_IS_BLOCKING_OP, true); + std::unique_ptr new_node; + ASSERT_EQ(NodeItem::Create(node, new_node), SUCCESS); + NodeItem *node_item = new_node.get(); + node_item->input_start = 0; + node_item->output_start = 0; + node_item->is_dynamic = true; + node_item->shape_inference_type = DEPEND_SHAPE_RANGE; + + GraphItem graph_item; + graph_item.node_items_.emplace_back(node_item); + graph_item.total_inputs_ = 1; + graph_item.total_outputs_ = 1; + + GraphExecutionContext graph_execution_context; + SubgraphContext subgraph_context(&graph_item, &graph_execution_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); + graph_execution_context.callback_manager = std::unique_ptr(new CallbackManager()); + + auto node_state = subgraph_context.GetOrCreateNodeState(node_item); + ASSERT_NE(node_state, nullptr); + + uint64_t value_0 = 512; + TensorValue in_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetInput(*node_item, 0, in_tensor0); + + TensorValue out_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetOutput(*node_item, 0, out_tensor0); + + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + domi::TaskDef task_def; + + AicpuTaskStruct args; + args.head.length = sizeof(args); + args.head.ioAddrNum = 2; + + kernel_def.set_args(reinterpret_cast(&args), args.head.length); + kernel_def.set_args_size(args.head.length); + domi::KernelDef *kernel_def_tmp = task_def.mutable_kernel(); + *kernel_def_tmp = kernel_def; + + AicpuNodeTask aicpu_node_task(node_item, task_def); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), SUCCESS); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); + + node_item->shape_inference_type = DEPEND_COMPUTE; + domi::KernelExDef kernel_ex_def; + kernel_ex_def.set_kernel_ext_info(buf, len); + kernel_ex_def.set_kernel_ext_info_size(len); + kernel_ex_def.set_args(reinterpret_cast(&args), args.head.length); + kernel_ex_def.set_args_size(args.head.length); + domi::KernelExDef *kernel_ex_def_tmp = task_def.mutable_kernel_ex(); + *kernel_ex_def_tmp = kernel_ex_def; + hybrid_model.task_defs_[node] = std::vector({task_def, task_def}); + + AicpuTfNodeTask aicpu_tf_node_task(node_item, task_def); + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), SUCCESS); + ASSERT_EQ(aicpu_tf_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); +} + +TEST_F(UtestAicpuNodeExecutor, aicpu_blocking_node_task_fail) { + ComputeGraphPtr graph = std::make_shared("test"); + GeRootModelPtr ge_root_model = std::make_shared(graph); + ge_root_model->SetModelName("test_name"); + HybridModel hybrid_model(ge_root_model); + + NodePtr node = CreateNode(graph, "deque", FRAMEWORK_OP_TYPE, 1, 1); + ge::AttrUtils::SetBool(node->GetOpDesc(), ATTR_NAME_IS_BLOCKING_OP, true); + std::unique_ptr new_node; + ASSERT_EQ(NodeItem::Create(node, new_node), SUCCESS); + NodeItem *node_item = new_node.get(); + node_item->input_start = 0; + node_item->output_start = 0; + node_item->is_dynamic = true; + node_item->shape_inference_type = DEPEND_SHAPE_RANGE; + + GraphItem graph_item; + graph_item.node_items_.emplace_back(node_item); + graph_item.total_inputs_ = 1; + graph_item.total_outputs_ = 1; + + GraphExecutionContext graph_execution_context; + SubgraphContext subgraph_context(&graph_item, &graph_execution_context); + ASSERT_EQ(subgraph_context.Init(), SUCCESS); + graph_execution_context.callback_manager = std::unique_ptr(new CallbackManager()); + + auto node_state = subgraph_context.GetOrCreateNodeState(node_item); + ASSERT_NE(node_state, nullptr); + + uint64_t value_0 = 512; + TensorValue in_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetInput(*node_item, 0, in_tensor0); + + TensorValue out_tensor0(&value_0, sizeof(value_0)); + subgraph_context.SetOutput(*node_item, 0, out_tensor0); + + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + domi::TaskDef task_def; + + AicpuTaskStruct args; + args.head.length = sizeof(args); + args.head.ioAddrNum = 2; + + kernel_def.set_args(reinterpret_cast(&args), args.head.length); + kernel_def.set_args_size(args.head.length); + domi::KernelDef *kernel_def_tmp = task_def.mutable_kernel(); + *kernel_def_tmp = kernel_def; + + AicpuNodeTask aicpu_node_task(node_item, task_def); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT + 1); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), FAILED); + + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), FAILED); + + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtEventReset, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + ASSERT_EQ(aicpu_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + ASSERT_EQ(aicpu_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); + + node_item->shape_inference_type = DEPEND_COMPUTE; + domi::KernelExDef kernel_ex_def; + kernel_ex_def.set_kernel_ext_info(buf, len); + kernel_ex_def.set_kernel_ext_info_size(len); + kernel_ex_def.set_args(reinterpret_cast(&args), args.head.length); + kernel_ex_def.set_args_size(args.head.length); + domi::KernelExDef *kernel_ex_def_tmp = task_def.mutable_kernel_ex(); + *kernel_ex_def_tmp = kernel_ex_def; + hybrid_model.task_defs_[node] = std::vector({task_def, task_def}); + + AicpuTfNodeTask aicpu_tf_node_task(node_item, task_def); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT + 1); + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), FAILED); + + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_tf_node_task.LaunchTask(*node_state->GetTaskContext()), FAILED); + + ASSERT_EQ(aicpu_tf_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtEventReset, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_tf_node_task.LaunchTask(*node_state->GetTaskContext()), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(aicpu_tf_node_task.Init(hybrid_model), SUCCESS); + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(aicpu_tf_node_task.LaunchTask(*node_state->GetTaskContext()), SUCCESS); +} } // namespace ge diff --git a/tests/ut/ge/single_op/single_op_task_unittest.cc b/tests/ut/ge/single_op/single_op_task_unittest.cc index 8964df74..52091856 100644 --- a/tests/ut/ge/single_op/single_op_task_unittest.cc +++ b/tests/ut/ge/single_op/single_op_task_unittest.cc @@ -19,6 +19,7 @@ #include "graph/load/model_manager/model_utils.h" #include "graph/utils/graph_utils.h" +#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" #include "runtime/rt.h" #define protected public @@ -30,6 +31,7 @@ #include "external/register/op_tiling_registry.h" #undef private #undef protected +#include "tests/depends/runtime/src/runtime_stub.h" using namespace std; using namespace testing; @@ -38,9 +40,13 @@ using namespace optiling; class UtestSingleOpTask : public testing::Test { protected: - void SetUp() {} + void SetUp() { + RTS_STUB_SETUP(); + } - void TearDown() {} + void TearDown() { + RTS_STUB_TEARDOWN(); + } }; TEST_F(UtestSingleOpTask, test_build_kernel_task) { @@ -237,3 +243,124 @@ TEST_F(UtestSingleOpTask, test_aicpu_task_update_io_addr) { ASSERT_EQ(ret, PARAM_INVALID); } } + +TEST_F(UtestSingleOpTask, test_blocking_aicpu_op_01) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + auto op_desc = make_shared("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + AiCpuCCTask aicpu_task; + aicpu_task.SetOpDesc(op_desc); + rtStream_t stream; + ASSERT_EQ(rtStreamCreate(&stream, 0), RT_ERROR_NONE); + + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), SUCCESS); +} + +TEST_F(UtestSingleOpTask, test_blocking_aicpu_op_02) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + auto op_desc = make_shared("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + AiCpuTask aicpu_task; + aicpu_task.SetOpDesc(op_desc); + rtStream_t stream; + ASSERT_EQ(rtStreamCreate(&stream, 0), RT_ERROR_NONE); + + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), SUCCESS); +} + +TEST_F(UtestSingleOpTask, test_blocking_aicpu_op_fail) { + int len = sizeof(hybrid::AicpuExtInfo) + sizeof(hybrid::AsyncWaitInfo); + vector aicpu_ext_info(len, 0); + char *buf = aicpu_ext_info.data(); + int offset = 0; + hybrid::AicpuExtInfo *ext_info = reinterpret_cast(buf + offset); + ext_info->infoType = aicpu::FWKAdapter::FWK_ADPT_EXT_ASYNCWAIT; + ext_info->infoLen = sizeof(hybrid::AsyncWaitInfo); + offset += sizeof(hybrid::AicpuExtInfo); + hybrid::AsyncWaitInfo *async_wait_info = reinterpret_cast(buf + offset); + async_wait_info->waitType = 0; + async_wait_info->waitId = 0; + async_wait_info->timeOut = 0; + async_wait_info->reserved = 0; + + domi::KernelDef kernel_def; + kernel_def.set_kernel_ext_info(buf, len); + kernel_def.set_kernel_ext_info_size(len); + + auto op_desc = make_shared("deque", "Deque"); + ge::AttrUtils::SetBool(op_desc, ATTR_NAME_IS_BLOCKING_OP, true); + AiCpuTask aicpu_task; + aicpu_task.SetOpDesc(op_desc); + rtStream_t stream; + ASSERT_EQ(rtStreamCreate(&stream, 0), RT_ERROR_NONE); + + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), SUCCESS); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_SUPPORT + 1); + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDevice, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), FAILED); + + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + RTS_STUB_RETURN_VALUE(rtStreamWaitEvent, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), FAILED); + + ASSERT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + RTS_STUB_RETURN_VALUE(rtEventReset, rtError_t, 0x78000001); + ASSERT_EQ(aicpu_task.LaunchKernel(stream), FAILED); + + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(aicpu_task.SetExtInfoAndType(kernel_def.kernel_ext_info(), 0), SUCCESS); + RTS_STUB_RETURN_VALUE(rtGetDeviceCapability, rtError_t, RT_ERROR_NONE); + RTS_STUB_OUTBOUND_VALUE(rtGetDeviceCapability, int32_t, value, RT_AICPU_BLOCKING_OP_NOT_SUPPORT); + EXPECT_EQ(aicpu_task.LaunchKernel(stream), SUCCESS); +} diff --git a/third_party/fwkacllib/inc/cce/fwk_adpt_struct.h b/third_party/fwkacllib/inc/cce/fwk_adpt_struct.h index df57c82e..5733d68f 100644 --- a/third_party/fwkacllib/inc/cce/fwk_adpt_struct.h +++ b/third_party/fwkacllib/inc/cce/fwk_adpt_struct.h @@ -62,6 +62,7 @@ enum FWKTaskExtInfoType { FWK_ADPT_EXT_SESSION_INFO, FWK_ADPT_EXT_BITMAP, FWK_ADPT_EXT_TOPIC_TYPE, + FWK_ADPT_EXT_ASYNCWAIT, FWK_ADPT_EXT_INVALID }; @@ -80,6 +81,12 @@ enum FWKExtUpdateAddrType { FWK_ADPT_UPDATE_INPUT_OUTPUT }; +enum FWKExtWaitType { + FWK_ADPT_WAIT_TYPE_NULL = 0, + FWK_ADPT_WAIT_TYPE_EVENT, + FWK_ADPT_WAIT_TYPE_INVALID +}; + #pragma pack(push, 1) // API Parameter Structure struct StrFWKKernel { @@ -133,6 +140,15 @@ struct ResultSummary { uint64_t raw_data_size; // size of raw data }; #pragma pack(pop) + +#pragma pack(push, 1) +struct AsyncWait { + uint8_t waitType; // wait type, FWK_ADPT_WAIT_TYPE_EVENT: event wait + uint32_t waitId; // wait id, GE refresh + uint32_t timeOut; // reserved + uint64_t reserved; +}; +#pragma pack(pop) } // end namespace FWKAdapter } // namespace aicpu diff --git a/third_party/fwkacllib/inc/runtime/config.h b/third_party/fwkacllib/inc/runtime/config.h index c1327c45..a244c793 100644 --- a/third_party/fwkacllib/inc/runtime/config.h +++ b/third_party/fwkacllib/inc/runtime/config.h @@ -52,6 +52,14 @@ typedef enum tagRtAicpuScheType { SCHEDULE_HARDWARE, /* HWTS Schedule */ } rtAicpuScheType; +typedef enum tagRtDeviceCapabilityType { + RT_SCHEDULE_SOFTWARE = 0, // SoftWare Schedule + RT_SCHEDULE_SOFTWARE_OPT, + RT_SCHEDULE_HARDWARE, // HWTS Schedule + RT_AICPU_BLOCKING_OP_NOT_SUPPORT, + RT_AICPU_BLOCKING_OP_SUPPORT, // 1910/1980/1951 ts support AICPU blocking operation +} rtDeviceCapabilityType; + typedef enum tagRtVersion { VER_BEGIN = 0, VER_NA = VER_BEGIN, diff --git a/third_party/fwkacllib/inc/runtime/dev.h b/third_party/fwkacllib/inc/runtime/dev.h index 2cf6712f..18d837eb 100644 --- a/third_party/fwkacllib/inc/runtime/dev.h +++ b/third_party/fwkacllib/inc/runtime/dev.h @@ -65,6 +65,7 @@ typedef enum tagRtFeatureType { typedef enum tagRtDeviceFeatureType { FEATURE_TYPE_SCHE, + FEATURE_TYPE_BLOCKING_OPERATOR, FEATURE_TYPE_END, } rtDeviceFeatureType_t; @@ -78,6 +79,17 @@ typedef enum tagMemoryInfo { MEMORY_INFO_RSV } rtMemoryInfo_t; +typedef enum tagRtDeviceModuleType { + RT_MODULE_TYPE_SYSTEM = 0, + RT_MODULE_TYPE_AICPU, + RT_MODULE_TYPE_CCPU, + RT_MODULE_TYPE_DCPU, + RT_MODULE_TYPE_AICORE, + RT_MODULE_TYPE_TSCPU, + RT_MODULE_TYPE_PCIE, + RT_MODULE_TYPE_VECTOR_CORE +} tagRtDeviceModuleType_t; + /** * @ingroup dvrt_dev * @brief get total device number. From 3dfd2119c1317dcd08483d9b91310092c306b5fb Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Wed, 28 Jul 2021 16:04:35 +0800 Subject: [PATCH 225/226] sync code 0728 --- CMakeLists.txt | 3 +- cmake/external_libs/json.cmake | 4 - ge/ge_runtime/CMakeLists.txt | 1 + ge/ge_runtime/task/hccl_task.cc | 16 +- ge/ge_runtime/task/label_goto_task.cc | 56 +- ge/ge_runtime/task/label_goto_task.h | 16 +- ge/ge_runtime/task/label_manager.cc | 119 + ge/ge_runtime/task/label_manager.h | 54 + ge/ge_runtime/task/label_switch_task.cc | 25 +- ge/ge_runtime/task/label_switch_task.h | 6 +- inc/external/acl/acl.h | 82 + inc/external/acl/acl_base.h | 638 +++++ inc/external/acl/acl_mdl.h | 1225 ++++++++++ inc/external/acl/acl_op.h | 504 ++++ inc/external/acl/acl_op_compiler.h | 121 + inc/external/acl/acl_prof.h | 329 +++ inc/external/acl/acl_rt.h | 958 ++++++++ inc/external/acl/acl_tdt.h | 276 +++ inc/external/acl/error_codes/ge_error_codes.h | 75 + inc/external/acl/error_codes/rt_error_codes.h | 109 + inc/external/acl/ops/acl_cblas.h | 334 +++ inc/external/acl/ops/acl_dvpp.h | 2568 ++++++++++++++++++++ inc/external/acl/ops/acl_fv.h | 348 +++ inc/external/hccl/hccl.h | 159 ++ inc/external/hccl/hccl_types.h | 101 + inc/external/runtime/rt_error_codes.h | 109 + inc/framework/ge_runtime/task_info.h | 5 +- metadef | 2 +- scripts/format_source_code.sh | 107 + third_party/fwkacllib/inc/cce/taskdown_common.hpp | 19 +- .../inc/external/runtime/rt_error_codes.h | 0 third_party/fwkacllib/inc/hccl/base.h | 36 +- third_party/fwkacllib/inc/hccl/hccl_types.h | 101 - third_party/fwkacllib/inc/hccl/hcom.h | 14 + third_party/fwkacllib/inc/mmpa/mmpa_api.h | 1 + .../fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h | 4 + third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h | 4 + third_party/fwkacllib/inc/ops/aipp.h | 4 +- third_party/fwkacllib/inc/ops/all_ops.h | 3 +- third_party/fwkacllib/inc/ops/array_ops.h | 104 +- third_party/fwkacllib/inc/ops/audio_ops.h | 2 +- third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h | 58 + third_party/fwkacllib/inc/ops/batch_ops.h | 21 +- third_party/fwkacllib/inc/ops/bitwise_ops.h | 31 +- third_party/fwkacllib/inc/ops/boosted_trees_ops.h | 2 +- .../fwkacllib/inc/ops/candidate_sampling_ops.h | 2 +- third_party/fwkacllib/inc/ops/condtake_ops.h | 2 +- third_party/fwkacllib/inc/ops/control_flow_ops.h | 12 +- third_party/fwkacllib/inc/ops/correlation.h | 52 + third_party/fwkacllib/inc/ops/ctc_ops.h | 83 +- third_party/fwkacllib/inc/ops/data_flow_ops.h | 89 +- .../fwkacllib/inc/ops/elewise_calculation_ops.h | 527 +++- third_party/fwkacllib/inc/ops/functional_ops.h | 2 +- third_party/fwkacllib/inc/ops/get_data_ops.h | 2 +- third_party/fwkacllib/inc/ops/globalavgpool.h | 49 + third_party/fwkacllib/inc/ops/hcom_ops.h | 135 +- third_party/fwkacllib/inc/ops/hvd_ops.h | 2 +- third_party/fwkacllib/inc/ops/image_ops.h | 653 ++++- third_party/fwkacllib/inc/ops/internal_ops.h | 2 +- third_party/fwkacllib/inc/ops/linalg_ops.h | 138 +- third_party/fwkacllib/inc/ops/list_ops.h | 504 ++++ third_party/fwkacllib/inc/ops/logging_ops.h | 2 +- third_party/fwkacllib/inc/ops/lookup_ops.h | 2 +- third_party/fwkacllib/inc/ops/math_ops.h | 283 ++- .../fwkacllib/inc/ops/matrix_calculation_ops.h | 336 ++- third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h | 134 +- third_party/fwkacllib/inc/ops/nn_calculation_ops.h | 448 +++- third_party/fwkacllib/inc/ops/nn_detect_ops.h | 602 +++-- third_party/fwkacllib/inc/ops/nn_norm_ops.h | 777 +++++- third_party/fwkacllib/inc/ops/nn_ops.h | 141 +- third_party/fwkacllib/inc/ops/nn_pooling_ops.h | 488 +++- third_party/fwkacllib/inc/ops/nn_training_ops.h | 51 +- third_party/fwkacllib/inc/ops/no_op.h | 2 +- third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h | 408 +++- third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h | 2 +- third_party/fwkacllib/inc/ops/outfeed_ops.h | 2 +- third_party/fwkacllib/inc/ops/pad_ops.h | 160 +- third_party/fwkacllib/inc/ops/parsing_ops.h | 242 +- third_party/fwkacllib/inc/ops/quantize_ops.h | 31 +- third_party/fwkacllib/inc/ops/ragged_array_ops.h | 2 +- .../fwkacllib/inc/ops/ragged_conversion_ops.h | 2 +- third_party/fwkacllib/inc/ops/ragged_math_ops.h | 2 +- third_party/fwkacllib/inc/ops/random_ops.h | 91 +- third_party/fwkacllib/inc/ops/reduce_ops.h | 279 ++- .../fwkacllib/inc/ops/resource_variable_ops.h | 2 +- third_party/fwkacllib/inc/ops/rnn.h | 595 ++++- third_party/fwkacllib/inc/ops/rpn_ops.h | 2 +- third_party/fwkacllib/inc/ops/save_ops.h | 2 +- third_party/fwkacllib/inc/ops/sdca_ops.h | 2 +- third_party/fwkacllib/inc/ops/selection_ops.h | 426 +++- third_party/fwkacllib/inc/ops/set_ops.h | 2 +- third_party/fwkacllib/inc/ops/sparse_ops.h | 8 +- third_party/fwkacllib/inc/ops/spectral_ops.h | 98 +- .../fwkacllib/inc/ops/split_combination_ops.h | 26 +- third_party/fwkacllib/inc/ops/state_ops.h | 2 +- .../fwkacllib/inc/ops/stateful_random_ops.h | 2 +- .../fwkacllib/inc/ops/stateless_random_ops.h | 2 +- third_party/fwkacllib/inc/ops/string_ops.h | 382 ++- third_party/fwkacllib/inc/ops/swap_co_ops.h | 2 +- .../fwkacllib/inc/ops/target_crop_and_resize.h | 2 +- third_party/fwkacllib/inc/ops/transformation_ops.h | 271 ++- .../fwkacllib/inc/ops/warp_perspective_ops.h | 2 +- third_party/fwkacllib/inc/runtime/event.h | 5 + third_party/fwkacllib/inc/runtime/rt.h | 1 + third_party/fwkacllib/inc/runtime/rt_stars.h | 85 + third_party/fwkacllib/inc/tdt/tsd_client.h | 82 - .../fwkacllib/inc/toolchain/adx_datadump_server.h | 22 +- third_party/fwkacllib/inc/toolchain/prof_acl_api.h | 208 +- .../fwkacllib/inc/toolchain/prof_mgr_core.h | 9 + .../fwkacllib/inc/toolchain/prof_reporter.h | 70 +- third_party/prebuild/aarch64/libalog.so | Bin 223920 -> 225280 bytes third_party/prebuild/aarch64/liberror_manager.so | Bin 888880 -> 1159216 bytes third_party/prebuild/aarch64/libmmpa.a | Bin 63182 -> 62550 bytes third_party/prebuild/x86_64/libalog.so | Bin 164208 -> 173984 bytes third_party/prebuild/x86_64/liberror_manager.so | Bin 852544 -> 1168920 bytes third_party/prebuild/x86_64/libmmpa.a | Bin 57270 -> 56998 bytes 116 files changed, 16672 insertions(+), 1133 deletions(-) create mode 100644 ge/ge_runtime/task/label_manager.cc create mode 100644 ge/ge_runtime/task/label_manager.h create mode 100644 inc/external/acl/acl.h create mode 100644 inc/external/acl/acl_base.h create mode 100644 inc/external/acl/acl_mdl.h create mode 100644 inc/external/acl/acl_op.h create mode 100644 inc/external/acl/acl_op_compiler.h create mode 100644 inc/external/acl/acl_prof.h create mode 100644 inc/external/acl/acl_rt.h create mode 100644 inc/external/acl/acl_tdt.h create mode 100644 inc/external/acl/error_codes/ge_error_codes.h create mode 100644 inc/external/acl/error_codes/rt_error_codes.h create mode 100644 inc/external/acl/ops/acl_cblas.h create mode 100644 inc/external/acl/ops/acl_dvpp.h create mode 100644 inc/external/acl/ops/acl_fv.h create mode 100644 inc/external/hccl/hccl.h create mode 100644 inc/external/hccl/hccl_types.h create mode 100644 inc/external/runtime/rt_error_codes.h create mode 100755 scripts/format_source_code.sh mode change 100755 => 100644 third_party/fwkacllib/inc/external/runtime/rt_error_codes.h delete mode 100644 third_party/fwkacllib/inc/hccl/hccl_types.h create mode 100644 third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h create mode 100644 third_party/fwkacllib/inc/ops/correlation.h create mode 100644 third_party/fwkacllib/inc/ops/globalavgpool.h create mode 100644 third_party/fwkacllib/inc/ops/list_ops.h create mode 100644 third_party/fwkacllib/inc/runtime/rt_stars.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 60509838..5e58eeba 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,6 @@ else () message(STATUS "PLATFORM param is invalid, should be train or inference, you choose nothing!") endif() endif() - set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef) set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/parser) set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..) @@ -158,6 +157,7 @@ else () elseif(ENABLE_MS_TESTCASES) include(cmake/external_libs/protobuf_static.cmake) include(cmake/external_libs/protoc.cmake) + include(cmake/external_libs/json.cmake) include(cmake/external_libs/securec.cmake) include(cmake/FindModule.cmake) include(cmake/intf_pub_linux.cmake) @@ -175,5 +175,4 @@ else () endif() add_subdirectory(ge) - endif () diff --git a/cmake/external_libs/json.cmake b/cmake/external_libs/json.cmake index 3c1cd012..04659ebc 100755 --- a/cmake/external_libs/json.cmake +++ b/cmake/external_libs/json.cmake @@ -9,10 +9,6 @@ if (GE_PB_PKG) set(REQ_URL "${GE_PB_PKG}/libs/ge_nlohmann_json/include.zip") set(MD5 "0dc903888211db3a0f170304cd9f3a89") set(JSON_INCLUDE_DIR ${JSON_SRC_DIR}) -#elseif (ENABLE_GITEE) -# set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.6.1.zip") -# set(MD5 "5bda78ce308e6cfcf614dcf1d5ff27a7") -#set(JSON_INCLUDE_DIR "${JSON_SRC_DIR}/include") else() set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip") set(MD5 "0dc903888211db3a0f170304cd9f3a89") diff --git a/ge/ge_runtime/CMakeLists.txt b/ge/ge_runtime/CMakeLists.txt index 3243766f..ffea784b 100644 --- a/ge/ge_runtime/CMakeLists.txt +++ b/ge/ge_runtime/CMakeLists.txt @@ -16,6 +16,7 @@ set(GE_SRC_LIST "task/label_goto_task.cc" "task/label_set_task.cc" "task/label_switch_task.cc" + "task/label_manager.cc" ) add_library(ge_runtime SHARED ${GE_SRC_LIST}) diff --git a/ge/ge_runtime/task/hccl_task.cc b/ge/ge_runtime/task/hccl_task.cc index b1c7158c..bfe0d0f3 100644 --- a/ge/ge_runtime/task/hccl_task.cc +++ b/ge/ge_runtime/task/hccl_task.cc @@ -53,15 +53,7 @@ HcclTask::HcclTask(const ModelContext &model_context, const std::shared_ptrworkspace_size() > 0) { - rtError_t rt_ret = rtMalloc(&workspace_mem_, task_info_->workspace_size(), RT_MEMORYINFO_HBM); - if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); - return false; - } + workspace_mem_ = task_info_->workspace_addr(); } GELOGI("HcclTaskInfo Distribute Start. begin to call function LoadTask in hccl."); diff --git a/ge/ge_runtime/task/label_goto_task.cc b/ge/ge_runtime/task/label_goto_task.cc index 7cb6d556..a3b70971 100644 --- a/ge/ge_runtime/task/label_goto_task.cc +++ b/ge/ge_runtime/task/label_goto_task.cc @@ -16,33 +16,46 @@ #include "ge_runtime/task/label_goto_task.h" #include "ge_runtime/task/task_factory.h" -#include "framework/common/util.h" namespace ge { namespace model_runner { LabelGotoTask::LabelGotoTask(const ModelContext &model_context, const std::shared_ptr &task_info) - : TaskRepeater(model_context, task_info), task_info_(task_info) { + : TaskRepeater(model_context, task_info), + task_info_(task_info), + stream_(nullptr), + index_value_(nullptr) { if (task_info_ == nullptr) { GELOGW("task_info_ is null!"); return; } auto stream_list = model_context.stream_list(); auto label_list = model_context.label_list(); + rt_model_handle_ = model_context.rt_model_handle(); uint32_t stream_id = task_info->stream_id(); - uint32_t label_id = task_info->label_id(); + label_id_ = task_info->label_id(); GELOGI("Stream list size:%zu, stream id:%u.", stream_list.size(), stream_id); - GELOGI("Label list size:%zu, label id:%u.", label_list.size(), label_id); - if (stream_id >= stream_list.size() || label_id >= label_list.size()) { + GELOGI("Label list size:%zu, label id:%u.", label_list.size(), label_id_); + if (stream_id >= stream_list.size() || label_id_ >= label_list.size()) { GELOGW("Stream/Label id invalid."); return; } stream_ = stream_list[stream_id]; - label_ = label_list[label_id]; + label_manager_ = LabelManager::GetInstance(); + if (label_manager_ == nullptr) { + GELOGW("Get label manager instance failed."); + return; + } + label_info_ = label_manager_->GetLabelInfo(rt_model_handle_, {label_id_}, label_list); } LabelGotoTask::~LabelGotoTask() { - GE_FREE_RT_LOG(label_info_); - GE_FREE_RT_LOG(index_value_); + if (index_value_ != nullptr) { + rtError_t rt_ret = rtFree(index_value_); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "rtFree index_value_ failed! ret: 0x%X.", rt_ret); + } + index_value_ = nullptr; + } } bool LabelGotoTask::Distribute() { @@ -94,21 +107,34 @@ bool LabelGotoTask::CheckParamValid() { return false; } - if (label_ == nullptr) { - GELOGE(PARAM_INVALID, "label is null!"); + if (label_info_ == nullptr) { + GELOGE(PARAM_INVALID, "label info is null!"); return false; } - if (label_info_ != nullptr) { - GELOGE(PARAM_INVALID, "label_info_ has dirty data."); - return false; + if (index_value_ == nullptr) { + rtError_t rt_ret = rtMalloc(&index_value_, sizeof(uint64_t), RT_MEMORY_HBM); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); + return false; + } + + uint64_t index = 0; + rt_ret = rtMemcpy(index_value_, sizeof(uint64_t), &index, sizeof(index), RT_MEMCPY_HOST_TO_DEVICE); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); + return false; + } } - if (index_value_ != nullptr) { - GELOGE(PARAM_INVALID, "index_value_ has dirty data."); + void *label_info = label_info_->GetLabelInfo(); + rtError_t rt_ret = rtLabelSwitchByIndex(index_value_, 1, label_info, stream_); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); return false; } + GELOGI("DistributeTask end."); return true; } diff --git a/ge/ge_runtime/task/label_goto_task.h b/ge/ge_runtime/task/label_goto_task.h index addbb700..e579c683 100644 --- a/ge/ge_runtime/task/label_goto_task.h +++ b/ge/ge_runtime/task/label_goto_task.h @@ -18,7 +18,11 @@ #define GE_GE_RUNTIME_TASK_LABEL_GOTO_TASK_H_ #include +#include +#include +#include #include "ge_runtime/task/task.h" +#include "ge_runtime/task/label_manager.h" namespace ge { namespace model_runner { @@ -31,13 +35,13 @@ class LabelGotoTask : public TaskRepeater { bool Distribute() override; private: - bool CheckParamValid(); - std::shared_ptr task_info_; - void *stream_{nullptr}; - void *label_{nullptr}; - void *label_info_{nullptr}; - void *index_value_{nullptr}; + void *stream_; + std::shared_ptr label_info_; + void *index_value_; + uint32_t label_id_; + rtModel_t rt_model_handle_; + std::shared_ptr label_manager_; }; } // namespace model_runner } // namespace ge diff --git a/ge/ge_runtime/task/label_manager.cc b/ge/ge_runtime/task/label_manager.cc new file mode 100644 index 00000000..a2b0c3aa --- /dev/null +++ b/ge/ge_runtime/task/label_manager.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 "ge_runtime/task/label_manager.h" +#include +#include +#include "runtime/mem.h" +#include "runtime/rt_model.h" +#include "common/ge_inner_error_codes.h" +#include "framework/common/debug/ge_log.h" + +namespace ge { +namespace model_runner { +std::weak_ptr LabelManager::instance_; +std::mutex LabelManager::instance_mutex_; + +template +static std::string GetVectorString(const std::vector &vec) { + std::string ret; + for (size_t i = 0; i < vec.size(); ++i) { + if (i != 0) { + ret.push_back(','); + } + ret += std::to_string(vec[i]); + } + return ret; +} + +LabelGuard::~LabelGuard() { + void *label_info = GetLabelInfo(); + if (label_info != nullptr) { + rtError_t rt_ret = rtFree(label_info); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "rtFree label_info failed! ret: 0x%X.", rt_ret); + } + } +} + +std::shared_ptr LabelManager::GetInstance() { + std::lock_guard lock(instance_mutex_); + auto instance = instance_.lock(); + if (instance != nullptr) { + return instance; + } + + instance = std::make_shared(); + instance_ = instance; + return instance; +} + +std::shared_ptr LabelManager::GetLabelInfo(rtModel_t model, const std::vector &label_ids, + const std::vector &all_label) { + std::lock_guard lock(model_info_mapping_mutex_); + rtError_t rt_ret; + auto model_iter = model_info_mapping_.find(model); + if (model_iter == model_info_mapping_.end()) { + model_info_mapping_.emplace(model, std::map>()); + model_iter = model_info_mapping_.find(model); + } + + std::string label_id_str = GetVectorString(label_ids); + auto &label_map = model_iter->second; + auto label_iter = label_map.find(label_id_str); + if (label_iter != label_map.end()) { + auto label_guard = label_iter->second.lock(); + if (label_guard != nullptr) { + GELOGI("model %p find same label id %s.", model, label_id_str.c_str()); + return label_guard; + } + } + + GELOGI("Alloc label id %s for model %p.", label_id_str.c_str(), model); + void *label_info; + std::vector label_list; + bool status = true; + std::transform(label_ids.begin(), label_ids.end(), std::back_inserter(label_list), + [&all_label, &status](uint32_t idx) -> void * { + if (idx >= all_label.size()) { + GELOGE(PARAM_INVALID, "Invalid label id %u, all label list size %zu.", idx, all_label.size()); + status = false; + return nullptr; + } + return all_label[idx]; + }); + if (!status) { + GELOGE(PARAM_INVALID, "Get label info failed."); + return nullptr; + } + uint32_t label_info_size = sizeof(rtLabelDevInfo) * label_list.size(); + rt_ret = rtMalloc(&label_info, label_info_size, RT_MEMORY_HBM); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); + return nullptr; + } + + rt_ret = rtLabelListCpy(label_list.data(), label_list.size(), label_info, label_info_size); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); + return nullptr; + } + + auto label_guard = std::make_shared(label_info); + label_map.emplace(label_id_str, label_guard); + return label_guard; +} +} // namespace model_runner +} // namespace ge diff --git a/ge/ge_runtime/task/label_manager.h b/ge/ge_runtime/task/label_manager.h new file mode 100644 index 00000000..f2c42c29 --- /dev/null +++ b/ge/ge_runtime/task/label_manager.h @@ -0,0 +1,54 @@ +/** + * 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. + */ +#ifndef GE_GE_RUNTIME_TASK_LABEL_MANAGER_H_ +#define GE_GE_RUNTIME_TASK_LABEL_MANAGER_H_ + +#include +#include +#include +#include +#include + +namespace ge { +namespace model_runner { +class LabelGuard { + public: + explicit LabelGuard(void *label_info) : label_info_(reinterpret_cast(label_info)) {} + ~LabelGuard(); + void *GetLabelInfo() { return reinterpret_cast(label_info_); } + + private: + uintptr_t label_info_; +}; + +class LabelManager { + public: + static std::shared_ptr GetInstance(); + std::shared_ptr GetLabelInfo(rtModel_t model, const std::vector &label_ids, + const std::vector &all_label); + + private: + std::mutex model_info_mapping_mutex_; + std::map>> model_info_mapping_; + + static std::weak_ptr instance_; + static std::mutex instance_mutex_; +}; + + +} // namespace model_runner +} // namespace ge +#endif // GE_GE_RUNTIME_TASK_LABEL_MANAGER_H_ \ No newline at end of file diff --git a/ge/ge_runtime/task/label_switch_task.cc b/ge/ge_runtime/task/label_switch_task.cc index 8c795da9..cde278d9 100644 --- a/ge/ge_runtime/task/label_switch_task.cc +++ b/ge/ge_runtime/task/label_switch_task.cc @@ -24,14 +24,14 @@ LabelSwitchTask::LabelSwitchTask(const ModelContext &model_context, : TaskRepeater(model_context, task_info), task_info_(task_info), stream_(nullptr), - all_label_resource_(), label_info_(nullptr) { if (task_info_ == nullptr) { GELOGW("task_info_ is null!"); return; } - all_label_resource_ = model_context.label_list(); + rt_model_handle_ = model_context.rt_model_handle(); + auto all_label_resource = model_context.label_list(); auto stream_list = model_context.stream_list(); uint32_t stream_id = task_info->stream_id(); GELOGI("Stream list size:%zu, stream id:%u.", stream_list.size(), stream_id); @@ -40,18 +40,16 @@ LabelSwitchTask::LabelSwitchTask(const ModelContext &model_context, return; } stream_ = stream_list[stream_id]; -} - -LabelSwitchTask::~LabelSwitchTask() { - if (label_info_ != nullptr) { - rtError_t rt_ret = rtFree(label_info_); - if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtFree fwkOpBuf failed! ret: 0x%X.", rt_ret); - } - label_info_ = nullptr; + label_manager_ = LabelManager::GetInstance(); + if (label_manager_ == nullptr) { + GELOGW("Get label manager instance failed."); + return; } + label_info_ = label_manager_->GetLabelInfo(rt_model_handle_, task_info_->label_list(), all_label_resource); } +LabelSwitchTask::~LabelSwitchTask() {} + bool LabelSwitchTask::Distribute() { GELOGI("LabelSwitchTask Distribute start."); if (!CheckParamValid()) { @@ -117,8 +115,8 @@ bool LabelSwitchTask::CheckParamValid() { return false; } - if (label_info_ != nullptr) { - GELOGE(PARAM_INVALID, "label_info_ has dirty data."); + if (label_info_ == nullptr) { + GELOGE(PARAM_INVALID, "CopyLabelList failed, label info is null."); return false; } @@ -126,6 +124,5 @@ bool LabelSwitchTask::CheckParamValid() { } REGISTER_TASK(TaskInfoType::LABEL_SWITCH, LabelSwitchTask, LabelSwitchTaskInfo); - } // namespace model_runner } // namespace ge diff --git a/ge/ge_runtime/task/label_switch_task.h b/ge/ge_runtime/task/label_switch_task.h index 463faa31..cfa6877c 100644 --- a/ge/ge_runtime/task/label_switch_task.h +++ b/ge/ge_runtime/task/label_switch_task.h @@ -19,6 +19,7 @@ #include #include "ge_runtime/task/task.h" +#include "ge_runtime/task/label_manager.h" namespace ge { namespace model_runner { @@ -35,8 +36,9 @@ class LabelSwitchTask : public TaskRepeater { std::shared_ptr task_info_; void *stream_; - std::vector all_label_resource_; - void *label_info_; + rtModel_t rt_model_handle_; + std::shared_ptr label_info_; + std::shared_ptr label_manager_; }; } // namespace model_runner } // namespace ge diff --git a/inc/external/acl/acl.h b/inc/external/acl/acl.h new file mode 100644 index 00000000..8d261201 --- /dev/null +++ b/inc/external/acl/acl.h @@ -0,0 +1,82 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_H_ +#define INC_EXTERNAL_ACL_ACL_H_ + +#include "acl_rt.h" +#include "acl_op.h" +#include "acl_mdl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Current version is 1.0.0 +#define ACL_MAJOR_VERSION 1 +#define ACL_MINOR_VERSION 0 +#define ACL_PATCH_VERSION 0 + +/** + * @ingroup AscendCL + * @brief acl initialize + * + * @par Restriction + * The aclInit interface can be called only once in a process + * @param configPath [IN] the config path,it can be NULL + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath); + +/** + * @ingroup AscendCL + * @brief acl finalize + * + * @par Restriction + * Need to call aclFinalize before the process exits. + * After calling aclFinalize,the services cannot continue to be used normally. + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclFinalize(); + +/** + * @ingroup AscendCL + * @brief query ACL interface version + * + * @param majorVersion[OUT] ACL interface major version + * @param minorVersion[OUT] ACL interface minor version + * @param patchVersion[OUT] ACL interface patch version + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *minorVersion, int32_t *patchVersion); + +/** + * @ingroup AscendCL + * @brief get recent error message + * + * @retval null for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY const char *aclGetRecentErrMsg(); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_H_ diff --git a/inc/external/acl/acl_base.h b/inc/external/acl/acl_base.h new file mode 100644 index 00000000..64d4bd81 --- /dev/null +++ b/inc/external/acl/acl_base.h @@ -0,0 +1,638 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_BASE_H_ +#define INC_EXTERNAL_ACL_ACL_BASE_H_ + +#include +#include +#include "error_codes/rt_error_codes.h" +#include "error_codes/ge_error_codes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define ACL_FUNC_VISIBILITY _declspec(dllexport) +#else +#define ACL_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define ACL_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define ACL_FUNC_VISIBILITY +#endif +#endif + +#ifdef __GNUC__ +#define ACL_DEPRECATED __attribute__((deprecated)) +#define ACL_DEPRECATED_MESSAGE(message) __attribute__((deprecated(message))) +#elif defined(_MSC_VER) +#define ACL_DEPRECATED __declspec(deprecated) +#define ACL_DEPRECATED_MESSAGE(message) __declspec(deprecated(message)) +#else +#define ACL_DEPRECATED +#define ACL_DEPRECATED_MESSAGE(message) +#endif + +typedef void *aclrtStream; +typedef void *aclrtEvent; +typedef void *aclrtContext; +typedef int aclError; +typedef uint16_t aclFloat16; +typedef struct aclDataBuffer aclDataBuffer; +typedef struct aclTensorDesc aclTensorDesc; + +static const int ACL_ERROR_NONE = 0; +static const int ACL_SUCCESS = 0; + +static const int ACL_ERROR_INVALID_PARAM = 100000; +static const int ACL_ERROR_UNINITIALIZE = 100001; +static const int ACL_ERROR_REPEAT_INITIALIZE = 100002; +static const int ACL_ERROR_INVALID_FILE = 100003; +static const int ACL_ERROR_WRITE_FILE = 100004; +static const int ACL_ERROR_INVALID_FILE_SIZE = 100005; +static const int ACL_ERROR_PARSE_FILE = 100006; +static const int ACL_ERROR_FILE_MISSING_ATTR = 100007; +static const int ACL_ERROR_FILE_ATTR_INVALID = 100008; +static const int ACL_ERROR_INVALID_DUMP_CONFIG = 100009; +static const int ACL_ERROR_INVALID_PROFILING_CONFIG = 100010; +static const int ACL_ERROR_INVALID_MODEL_ID = 100011; +static const int ACL_ERROR_DESERIALIZE_MODEL = 100012; +static const int ACL_ERROR_PARSE_MODEL = 100013; +static const int ACL_ERROR_READ_MODEL_FAILURE = 100014; +static const int ACL_ERROR_MODEL_SIZE_INVALID = 100015; +static const int ACL_ERROR_MODEL_MISSING_ATTR = 100016; +static const int ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017; +static const int ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018; +static const int ACL_ERROR_MODEL_NOT_DYNAMIC = 100019; +static const int ACL_ERROR_OP_TYPE_NOT_MATCH = 100020; +static const int ACL_ERROR_OP_INPUT_NOT_MATCH = 100021; +static const int ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022; +static const int ACL_ERROR_OP_ATTR_NOT_MATCH = 100023; +static const int ACL_ERROR_OP_NOT_FOUND = 100024; +static const int ACL_ERROR_OP_LOAD_FAILED = 100025; +static const int ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026; +static const int ACL_ERROR_FORMAT_NOT_MATCH = 100027; +static const int ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028; +static const int ACL_ERROR_KERNEL_NOT_FOUND = 100029; +static const int ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030; +static const int ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031; +static const int ACL_ERROR_INVALID_QUEUE_ID = 100032; +static const int ACL_ERROR_REPEAT_SUBSCRIBE = 100033; +static const int ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034; +static const int ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035; +static const int ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036; +static const int ACL_ERROR_REPEAT_FINALIZE = 100037; +static const int ACL_ERROR_NOT_STATIC_AIPP = 100038; +static const int ACL_ERROR_COMPILING_STUB_MODE = 100039; +static const int ACL_ERROR_GROUP_NOT_SET = 100040; +static const int ACL_ERROR_GROUP_NOT_CREATE = 100041; +static const int ACL_ERROR_PROF_ALREADY_RUN = 100042; +static const int ACL_ERROR_PROF_NOT_RUN = 100043; +static const int ACL_ERROR_DUMP_ALREADY_RUN = 100044; +static const int ACL_ERROR_DUMP_NOT_RUN = 100045; +static const int ACL_ERROR_PROF_REPEAT_SUBSCRIBE = 148046; +static const int ACL_ERROR_PROF_API_CONFLICT = 148047; +static const int ACL_ERROR_INVALID_MAX_OPQUEUE_NUM_CONFIG = 148048; +static const int ACL_ERROR_INVALID_OPP_PATH = 148049; +static const int ACL_ERROR_OP_UNSUPPORTED_DYNAMIC = 148050; + +static const int ACL_ERROR_BAD_ALLOC = 200000; +static const int ACL_ERROR_API_NOT_SUPPORT = 200001; +static const int ACL_ERROR_INVALID_DEVICE = 200002; +static const int ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003; +static const int ACL_ERROR_RESOURCE_NOT_MATCH = 200004; +static const int ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005; +static const int ACL_ERROR_FEATURE_UNSUPPORTED = 200006; +static const int ACL_ERROR_PROF_MODULES_UNSUPPORTED = 200007; + +static const int ACL_ERROR_STORAGE_OVER_LIMIT = 300000; + +static const int ACL_ERROR_INTERNAL_ERROR = 500000; +static const int ACL_ERROR_FAILURE = 500001; +static const int ACL_ERROR_GE_FAILURE = 500002; +static const int ACL_ERROR_RT_FAILURE = 500003; +static const int ACL_ERROR_DRV_FAILURE = 500004; +static const int ACL_ERROR_PROFILING_FAILURE = 500005; + +#define ACL_TENSOR_SHAPE_RANGE_NUM 2 +#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, +} 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 +} aclFormat; + +typedef enum { + ACL_DEBUG = 0, + ACL_INFO = 1, + ACL_WARNING = 2, + ACL_ERROR = 3, +} aclLogLevel; + +typedef enum { + ACL_MEMTYPE_DEVICE = 0, + ACL_MEMTYPE_HOST = 1, +} aclMemType; + +/** + * @ingroup AscendCL + * @brief Converts data of type aclFloat16 to data of type float + * + * @param value [IN] Data to be converted + * + * @retval Transformed data + */ +ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); + +/** + * @ingroup AscendCL + * @brief Converts data of type float to data of type aclFloat16 + * + * @param value [IN] Data to be converted + * + * @retval Transformed data + */ +ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); + +/** + * @ingroup AscendCL + * @brief create data of aclDataBuffer + * + * @param data [IN] pointer to data + * @li Need to be managed by the user, + * call aclrtMalloc interface to apply for memory, + * call aclrtFree interface to release memory + * + * @param size [IN] size of data in bytes + * + * @retval pointer to created instance. nullptr if run out of memory + * + * @see aclrtMalloc | aclrtFree + */ +ACL_FUNC_VISIBILITY aclDataBuffer *aclCreateDataBuffer(void *data, size_t size); + +/** + * @ingroup AscendCL + * @brief destroy data of aclDataBuffer + * + * @par Function + * Only the aclDataBuffer type data is destroyed here. + * The memory of the data passed in when the aclDataDataBuffer interface + * is called to create aclDataBuffer type data must be released by the user + * + * @param dataBuffer [IN] pointer to the aclDataBuffer + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclCreateDataBuffer + */ +ACL_FUNC_VISIBILITY aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffer); + +/** + * @ingroup AscendCL + * @brief update new data of aclDataBuffer + * + * @param dataBuffer [OUT] pointer to aclDataBuffer + * @li The old data need to be released by the user, otherwise it may occur memory leak leakage + * call aclGetDataBufferAddr interface to get old data address + * call aclrtFree interface to release memory + * + * @param data [IN] pointer to new data + * @li Need to be managed by the user, + * call aclrtMalloc interface to apply for memory, + * call aclrtFree interface to release memory + * + * @param size [IN] size of data in bytes + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtMalloc | aclrtFree | aclGetDataBufferAddr + */ +ACL_FUNC_VISIBILITY aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size); + +/** + * @ingroup AscendCL + * @brief get data address from aclDataBuffer + * + * @param dataBuffer [IN] pointer to the data of aclDataBuffer + * + * @retval data address + */ +ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); + +/** + * @ingroup AscendCL + * @brief get data size of aclDataBuffer + * + * @param dataBuffer [IN] pointer to the data of aclDataBuffer + * + * @retval data size + */ +ACL_DEPRECATED_MESSAGE("aclGetDataBufferSize is deprecated, use aclGetDataBufferSizeV2 instead") +ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer); + +/** + * @ingroup AscendCL + * @brief get data size of aclDataBuffer to replace aclGetDataBufferSize + * + * @param dataBuffer [IN] pointer to the data of aclDataBuffer + * + * @retval data size + */ +ACL_FUNC_VISIBILITY size_t aclGetDataBufferSizeV2(const aclDataBuffer *dataBuffer); + +/** + * @ingroup AscendCL + * @brief get size of aclDataType + * + * @param dataType [IN] aclDataType data the size to get + * + * @retval size of the aclDataType + */ +ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); + +// interfaces of tensor desc +/** + * @ingroup AscendCL + * @brief create data aclTensorDesc + * + * @param dataType [IN] Data types described by tensor + * @param numDims [IN] the number of dimensions of the shape + * @param dims [IN] the size of the specified dimension + * @param format [IN] tensor format + * + * @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, + aclFormat format); + +/** + * @ingroup AscendCL + * @brief destroy data aclTensorDesc + * + * @param desc [IN] pointer to the data of aclTensorDesc to destroy + */ +ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief set tensor shape range for aclTensorDesc + * + * @param desc [OUT] pointer to the data of aclTensorDesc + * @param dimsCount [IN] the number of dimensions of the shape + * @param dimsRange [IN] the range of dimensions of the shape + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc *desc, size_t dimsCount, + int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM]); + +/** + * @ingroup AscendCL + * @brief get data type specified by the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval data type specified by the tensor description. + * @retval ACL_DT_UNDEFINED if description is null + */ +ACL_FUNC_VISIBILITY aclDataType aclGetTensorDescType(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief get data format specified by the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval data format specified by the tensor description. + * @retval ACL_FORMAT_UNDEFINED if description is null + */ +ACL_FUNC_VISIBILITY aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief get tensor size specified by the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval data size specified by the tensor description. + * @retval 0 if description is null + */ +ACL_FUNC_VISIBILITY size_t aclGetTensorDescSize(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief get element count specified by the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval element count specified by the tensor description. + * @retval 0 if description is null + */ +ACL_FUNC_VISIBILITY size_t aclGetTensorDescElementCount(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief get number of dims specified by the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval number of dims specified by the tensor description. + * @retval 0 if description is null + * @retval ACL_UNKNOWN_RANK if the tensor dim is -2 + */ +ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief Get the size of the specified dim in the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * @param index [IN] index of dims, start from 0. + * + * @retval dim specified by the tensor description and index. + * @retval -1 if description or index is invalid + */ +ACL_DEPRECATED_MESSAGE("aclGetTensorDescDim is deprecated, use aclGetTensorDescDimV2 instead") +ACL_FUNC_VISIBILITY int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index); + +/** + * @ingroup AscendCL + * @brief Get the size of the specified dim in the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * @param index [IN] index of dims, start from 0. + * @param dimSize [OUT] size of the specified dim. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimV2(const aclTensorDesc *desc, size_t index, int64_t *dimSize); + +/** + * @ingroup AscendCL + * @brief Get the range of the specified dim in the tensor description + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * @param index [IN] index of dims, start from 0. + * @param dimRangeNum [IN] number of dimRange. + * @param dimRange [OUT] range of the specified dim. + * + * @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, + int64_t *dimRange); + +/** + * @ingroup AscendCL + * @brief set tensor description name + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param name [IN] tensor description name + */ +ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name); + +/** + * @ingroup AscendCL + * @brief get tensor description name + * + * @param desc [IN] pointer to the instance of aclTensorDesc + * + * @retval tensor description name. + * @retval empty string if description is null + */ +ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief Convert the format in the source aclTensorDesc according to + * the specified dstFormat to generate a new target aclTensorDesc. + * The format in the source aclTensorDesc remains unchanged. + * + * @param srcDesc [IN] pointer to the source tensor desc + * @param dstFormat [IN] destination format + * @param dstDesc [OUT] pointer to the pointer to the destination tensor desc + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, + aclTensorDesc **dstDesc); + +/** + * @ingroup AscendCL + * @brief Set the storage format specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param format [IN] the storage format + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_DEPRECATED_MESSAGE("aclSetTensorStorageFormat is deprecated, use aclSetTensorFormat instead") +ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format); + +/** + * @ingroup AscendCL + * @brief Set the storage shape specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param numDims [IN] the number of dimensions of the shape + * @param dims [IN] the size of the specified dimension + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_DEPRECATED_MESSAGE("aclSetTensorStorageShape is deprecated, use aclSetTensorShape instead") +ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims); + +/** + * @ingroup AscendCL + * @brief Set the format specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param format [IN] the storage format + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorFormat(aclTensorDesc *desc, aclFormat format); + +/** + * @ingroup AscendCL + * @brief Set the shape specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param numDims [IN] the number of dimensions of the shape + * @param dims [IN] the size of the specified dimension + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorShape(aclTensorDesc *desc, int numDims, const int64_t *dims); + +/** + * @ingroup AscendCL + * @brief Set the original format specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param format [IN] the storage format + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorOriginFormat(aclTensorDesc *desc, aclFormat format); + +/** + * @ingroup AscendCL + * @brief Set the original shape specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param numDims [IN] the number of dimensions of the shape + * @param dims [IN] the size of the specified dimension + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorOriginShape(aclTensorDesc *desc, int numDims, const int64_t *dims); + +/** + * @ingroup AscendCL + * @brief get op description info + * + * @param desc [IN] pointer to tensor description + * @param index [IN] index of tensor + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index); + +/** + * @ingroup AscendCL + * @brief get address of tensor + * + * @param desc [IN] pointer to tensor description + * + * @retval null for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY void *aclGetTensorDescAddress(const aclTensorDesc *desc); + +/** + * @ingroup AscendCL + * @brief Set the dynamic input name specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param dynamicInputName [IN] pointer to the dynamic input name + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorDynamicInput(aclTensorDesc *desc, const char *dynamicInputName); + +/** + * @ingroup AscendCL + * @brief Set const data specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param dataBuffer [IN] pointer to the const databuffer + * @param length [IN] the length of const databuffer + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length); + +/** + * @ingroup AscendCL + * @brief Set tensor memory type specified by the tensor description + * + * @param desc [OUT] pointer to the instance of aclTensorDesc + * @param memType [IN] ACL_MEMTYPE_DEVICE means device, ACL_MEMTYPE_HOST means host + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemType memType); + +/** + * @ingroup AscendCL + * @brief an interface for users to output APP logs + * + * @param logLevel [IN] the level of current log + * @param func [IN] the function where the log is located + * @param file [IN] the file where the log is located + * @param line [IN] Number of source lines where the log is located + * @param fmt [IN] the format of current log + * @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, ...); + +/** + * @ingroup AscendCL + * @brief get soc name + * + * @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__) + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_BASE_H_ diff --git a/inc/external/acl/acl_mdl.h b/inc/external/acl/acl_mdl.h new file mode 100644 index 00000000..2bf85e29 --- /dev/null +++ b/inc/external/acl/acl_mdl.h @@ -0,0 +1,1225 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_MODEL_H_ +#define INC_EXTERNAL_ACL_ACL_MODEL_H_ + +#include +#include + +#include "acl_base.h" +#include "acl_rt.h" + +#ifdef __cplusplus +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_DYNAMIC_TENSOR_NAME "ascend_mbatch_shape_data" +#define ACL_DYNAMIC_AIPP_NAME "ascend_dynamic_aipp_data" +#define ACL_ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES "_datadump_original_op_names" + +typedef struct aclmdlDataset aclmdlDataset; +typedef struct aclmdlDesc aclmdlDesc; +typedef struct aclmdlAIPP aclmdlAIPP; +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, +} 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 */ +} aclmdlConfigAttr; + +typedef enum { + 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 */ +} 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 */ +} aclAippDims; + +typedef struct aclmdlBatch { + 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 */ +} 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 */ +} aclAippInfo; + +/** + * @ingroup AscendCL + * @brief Create data of type aclmdlDesc + * + * @retval the aclmdlDesc pointer + */ +ACL_FUNC_VISIBILITY aclmdlDesc *aclmdlCreateDesc(); + +/** + * @ingroup AscendCL + * @brief destroy data of type aclmdlDesc + * + * @param modelDesc [IN] Pointer to almdldlDesc to be destroyed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlDestroyDesc(aclmdlDesc *modelDesc); + +/** + * @ingroup AscendCL + * @brief Get aclmdlDesc data of the model according to the model ID + * + * @param modelDesc [OUT] aclmdlDesc pointer + * @param modelId [IN] model id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetDesc(aclmdlDesc *modelDesc, uint32_t modelId); + +/** + * @ingroup AscendCL + * @brief Get the number of the inputs of + * the model according to data of aclmdlDesc + * + * @param modelDesc [IN] aclmdlDesc pointer + * + * @retval input size with aclmdlDesc + */ +ACL_FUNC_VISIBILITY size_t aclmdlGetNumInputs(aclmdlDesc *modelDesc); + +/** + * @ingroup AscendCL + * @brief Get the number of the output of + * the model according to data of aclmdlDesc + * + * @param modelDesc [IN] aclmdlDesc pointer + * + * @retval output size with aclmdlDesc + */ +ACL_FUNC_VISIBILITY size_t aclmdlGetNumOutputs(aclmdlDesc *modelDesc); + +/** + * @ingroup AscendCL + * @brief Get the size of the specified input according to + * the data of type aclmdlDesc + * + * @param modelDesc [IN] aclmdlDesc pointer + * @param index [IN] the size of the number of inputs to be obtained, + * the index value starts from 0 + * + * @retval Specify the size of the input + */ +ACL_FUNC_VISIBILITY size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief Get the size of the specified output according to + * the data of type aclmdlDesc + * + * @param modelDesc [IN] aclmdlDesc pointer + * @param index [IN] the size of the number of outputs to be obtained, + * the index value starts from 0 + * + * @retval Specify the size of the output + */ +ACL_FUNC_VISIBILITY size_t aclmdlGetOutputSizeByIndex(aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief Create data of type aclmdlDataset + * + * @retval the aclmdlDataset pointer + */ +ACL_FUNC_VISIBILITY aclmdlDataset *aclmdlCreateDataset(); + +/** + * @ingroup AscendCL + * @brief destroy data of type aclmdlDataset + * + * @param dataset [IN] Pointer to aclmdlDataset to be destroyed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlDestroyDataset(const aclmdlDataset *dataset); + +/** + * @ingroup AscendCL + * @brief Add aclDataBuffer to aclmdlDataset + * + * @param dataset [OUT] aclmdlDataset address of aclDataBuffer to be added + * @param dataBuffer [IN] aclDataBuffer address to be added + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlAddDatasetBuffer(aclmdlDataset *dataset, aclDataBuffer *dataBuffer); + +/** + * @ingroup AscendCL + * @brief Set aclTensorDesc to aclmdlDataset + * + * @param dataset [OUT] aclmdlDataset address of aclDataBuffer to be added + * @param tensorDesc [IN] aclTensorDesc address to be added + * @param index [IN] index of tensorDesc which to be added + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetDatasetTensorDesc(aclmdlDataset *dataset, aclTensorDesc *tensorDesc, + size_t index); + +/** + * @ingroup AscendCL + * @brief Get the number of aclDataBuffer in aclmdlDataset + * + * @param dataset [IN] aclmdlDataset poiter + * + * @retval the number of aclDataBuffer + */ +ACL_FUNC_VISIBILITY size_t aclmdlGetDatasetNumBuffers(const aclmdlDataset *dataset); + +/** + * @ingroup AscendCL + * @brief Get the aclDataBuffer in aclmdlDataset by index + * + * @param dataset [IN] aclmdlDataset poiter + * @param index [IN] the index of aclDataBuffer + * + * @retval Get successfully, return the address of aclDataBuffer + * @retval Failure return NULL + */ +ACL_FUNC_VISIBILITY aclDataBuffer *aclmdlGetDatasetBuffer(const aclmdlDataset *dataset, size_t index); + +/** + * @ingroup AscendCL + * @brief Load offline model data from files + * and manage memory internally by the system + * + * @par Function + * After the system finishes loading the model, + * the model ID returned is used as a mark to identify the model + * during subsequent operations + * + * @param modelPath [IN] Storage path for offline model files + * @param modelId [OUT] Model ID generated after + * the system finishes loading the model + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFile(const char *modelPath, uint32_t *modelId); + +/** + * @ingroup AscendCL + * @brief Load offline model data from memory and manage the memory of + * model running internally by the system + * + * @par Function + * After the system finishes loading the model, + * the model ID returned is used as a mark to identify the model + * during subsequent operations + * + * @param model [IN] Model data stored in memory + * @param modelSize [IN] model data size + * @param modelId [OUT] Model ID generated after + * the system finishes loading the model + * + * @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); + +/** + * @ingroup AscendCL + * @brief Load offline model data from a file, + * and the user manages the memory of the model run by itself + * + * @par Function + * After the system finishes loading the model, + * the model ID returned is used as a mark to identify the model + * during subsequent operations. + * @param modelPath [IN] Storage path for offline model files + * @param modelId [OUT] Model ID generated after finishes loading the model + * @param workPtr [IN] A pointer to the working memory + * required by the model on the Device,can be null + * @param workSize [IN] The amount of working memory required by the model + * @param weightPtr [IN] Pointer to model weight memory on Device + * @param weightSize [IN] The amount of weight memory required by the model + * + * @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); + +/** + * @ingroup AscendCL + * @brief Load offline model data from memory, + * and the user can manage the memory of model running + * + * @par Function + * After the system finishes loading the model, + * the model ID returned is used as a mark to identify the model + * during subsequent operations + * @param model [IN] Model data stored in memory + * @param modelSize [IN] model data size + * @param modelId [OUT] Model ID generated after finishes loading the model + * @param workPtr [IN] A pointer to the working memory + * required by the model on the Device,can be null + * @param workSize [IN] work memory size + * @param weightPtr [IN] Pointer to model weight memory on Device,can be null + * @param weightSize [IN] The amount of weight memory required by the model + * + * @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); + +/** + * @ingroup AscendCL + * @brief load model from file with async queue + * + * @param modelPath [IN] model path + * @param modelId [OUT] return model id if load success + * @param inputQ [IN] input queue pointer + * @param inputQNum [IN] input queue num + * @param outputQ [IN] output queue pointer + * @param outputQNum [IN] output queue num + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithQ(const char *modelPath, uint32_t *modelId, const uint32_t *inputQ, + size_t inputQNum, const uint32_t *outputQ, size_t outputQNum); + +/** + * @ingroup AscendCL + * @brief load model from memory with async queue + * + * @param model [IN] model memory which user manages + * @param modelSize [IN] model size + * @param modelId [OUT] return model id if load success + * @param inputQ [IN] input queue pointer + * @param inputQNum [IN] input queue num + * @param outputQ [IN] output queue pointer + * @param outputQNum [IN] output queue num + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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); + +/** + * @ingroup AscendCL + * @brief Execute model synchronous inference until the inference result is returned + * + * @param modelId [IN] ID of the model to perform inference + * @param input [IN] Input data for model inference + * @param output [OUT] Output data for model inference + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlExecute(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output); + +/** + * @ingroup AscendCL + * @brief Execute model asynchronous inference until the inference result is returned + * + * @param modelId [IN] ID of the model to perform inference + * @param input [IN] Input data for model inference + * @param output [OUT] Output data for model inference + * @param stream [IN] stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem + */ +ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief unload model with model id + * + * @param modelId [IN] model id to be unloaded + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlUnload(uint32_t modelId); + +/** + * @ingroup AscendCL + * @brief Get the weight memory size and working memory size + * required for model execution according to the model file + * + * @param fileName [IN] Model path to get memory information + * @param workSize [OUT] The amount of working memory for model executed + * @param weightSize [OUT] The amount of weight memory for model executed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlQuerySize(const char *fileName, size_t *workSize, size_t *weightSize); + +/** + * @ingroup AscendCL + * @brief Obtain the weights required for + * model execution according to the model data in memory + * + * @par Restriction + * The execution and weight memory is Device memory, + * and requires user application and release. + * @param model [IN] model memory which user manages + * @param modelSize [IN] model data size + * @param workSize [OUT] The amount of working memory for model executed + * @param weightSize [OUT] The amount of weight memory for model executed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize, + size_t *weightSize); + +/** + * @ingroup AscendCL + * @brief In dynamic batch scenarios, + * it is used to set the number of images processed + * at one time during model inference + * + * @param modelId [IN] model id + * @param dataset [IN|OUT] data for model inference + * @param index [IN] index of dynamic tensor + * @param batchSize [IN] Number of images processed at a time during model + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicBatchSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, + uint64_t batchSize); + +/** + * @ingroup AscendCL + * @brief Sets the H and W of the specified input of the model + * + * @param modelId [IN] model id + * @param dataset [IN|OUT] data for model inference + * @param index [IN] index of dynamic tensor + * @param height [IN] model height + * @param width [IN] model width + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicHWSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, + uint64_t height, uint64_t width); + +/** + * @ingroup AscendCL + * @brief Sets the dynamic dims of the specified input of the model + * + * @param modelId [IN] model id + * @param dataset [IN|OUT] data for model inference + * @param index [IN] index of dynamic dims + * @param dims [IN] value of dynamic dims + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetInputDynamicDims(uint32_t modelId, aclmdlDataset *dataset, size_t index, + const aclmdlIODims *dims); + +/** + * @ingroup AscendCL + * @brief get input dims info + * + * @param modelDesc [IN] model description + * @param index [IN] input tensor index + * @param dims [OUT] dims info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlGetInputDimsV2 + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetInputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); + +/** + * @ingroup AscendCL + * @brief get input dims info(version 2), especially for static aipp + * it is the same with aclmdlGetInputDims while model without static aipp + * + * @param modelDesc [IN] model description + * @param index [IN] input tensor index + * @param dims [OUT] dims info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlGetInputDims + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetInputDimsV2(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); + +/** + * @ingroup AscendCL + * @brief get output dims info + * + * @param modelDesc [IN] model description + * @param index [IN] output tensor index + * @param dims [OUT] dims info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); + +/** + * @ingroup AscendCL + * @brief get current output dims info + * + * @par Function + * The following use cases are supported: + * @li Get current output shape when model is dynamic and + * dynamic shape info is set + * @li Get max output shape when model is dynamic and + * dynamic shape info is not set + * @li Get actual output shape when model is static + * + * @param modelDesc [IN] model description + * @param index [IN] output tensor index + * @param dims [OUT] dims info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); + +/** + * @ingroup AscendCL + * @brief get attr value by op name + * + * @param modelDesc [IN] model description + * @param opName [IN] op name + * @param attr [IN] attr name + * + * @retval the attr value + */ +ACL_FUNC_VISIBILITY const char *aclmdlGetOpAttr(aclmdlDesc *modelDesc, const char *opName, const char *attr); + +/** + * @ingroup AscendCL + * @brief get input name by index + * + * @param modelDesc [IN] model description + * @param index [IN] intput tensor index + * + * @retval input tensor name,the same life cycle with modelDesc + */ +ACL_FUNC_VISIBILITY const char *aclmdlGetInputNameByIndex(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get output name by index + * + * @param modelDesc [IN] model description + * @param index [IN] output tensor index + * + * @retval output tensor name,the same life cycle with modelDesc + */ +ACL_FUNC_VISIBILITY const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get input format by index + * + * @param modelDesc [IN] model description + * @param index [IN] intput tensor index + * + * @retval input tensor format + */ +ACL_FUNC_VISIBILITY aclFormat aclmdlGetInputFormat(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get output format by index + * + * @param modelDesc [IN] model description + * @param index [IN] output tensor index + * + * @retval output tensor format + */ +ACL_FUNC_VISIBILITY aclFormat aclmdlGetOutputFormat(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get input data type by index + * + * @param modelDesc [IN] model description + * @param index [IN] intput tensor index + * + * @retval input tensor data type + */ +ACL_FUNC_VISIBILITY aclDataType aclmdlGetInputDataType(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get output data type by index + * + * @param modelDesc [IN] model description + * @param index [IN] output tensor index + * + * @retval output tensor data type + */ +ACL_FUNC_VISIBILITY aclDataType aclmdlGetOutputDataType(const aclmdlDesc *modelDesc, size_t index); + +/** + * @ingroup AscendCL + * @brief get input tensor index by name + * + * @param modelDesc [IN] model description + * @param name [IN] intput tensor name + * @param index [OUT] intput tensor index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetInputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index); + +/** + * @ingroup AscendCL + * @brief get output tensor index by name + * + * @param modelDesc [IN] model description + * @param name [IN] output tensor name + * @param index [OUT] output tensor index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetOutputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index); + +/** + * @ingroup AscendCL + * @brief get dynamic batch info + * + * @param modelDesc [IN] model description + * @param batch [OUT] dynamic batch info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicBatch(const aclmdlDesc *modelDesc, aclmdlBatch *batch); + +/** + * @ingroup AscendCL + * @brief get dynamic height&width info + * + * @param modelDesc [IN] model description + * @param index [IN] input tensor index + * @param hw [OUT] dynamic height&width info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicHW(const aclmdlDesc *modelDesc, size_t index, aclmdlHW *hw); + +/** + * @ingroup AscendCL + * @brief get dynamic gear count + * + * @param modelDesc [IN] model description + * @param index [IN] unused, must be -1 + * @param gearCount [OUT] dynamic gear count + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicGearCount(const aclmdlDesc *modelDesc, size_t index, + size_t *gearCount); + +/** + * @ingroup AscendCL + * @brief get dynamic dims info + * + * @param modelDesc [IN] model description + * @param index [IN] unused, must be -1 + * @param dims [OUT] value of dynamic dims + * @param gearCount [IN] dynamic gear count + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims, + size_t gearCount); + +/** + * @ingroup AscendCL + * @brief Create data of type aclmdlAIPP + * + * @param batchSize [IN] batchsizes of model + * + * @retval the aclmdlAIPP pointer + */ +ACL_FUNC_VISIBILITY aclmdlAIPP *aclmdlCreateAIPP(uint64_t batchSize); + +/** + * @ingroup AscendCL + * @brief destroy data of type aclmdlAIPP + * + * @param aippParmsSet [IN] Pointer for aclmdlAIPP to be destroyed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlDestroyAIPP(const aclmdlAIPP *aippParmsSet); + +/** + * @ingroup AscendCL + * @brief set InputFormat of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param inputFormat [IN] The inputFormat of aipp + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPInputFormat(aclmdlAIPP *aippParmsSet, aclAippInputFormat inputFormat); + +/** + * @ingroup AscendCL + * @brief set cscParms of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param csc_switch [IN] Csc switch + * @param cscMatrixR0C0 [IN] Csc_matrix_r0_c0 + * @param cscMatrixR0C1 [IN] Csc_matrix_r0_c1 + * @param cscMatrixR0C2 [IN] Csc_matrix_r0_c2 + * @param cscMatrixR1C0 [IN] Csc_matrix_r1_c0 + * @param cscMatrixR1C1 [IN] Csc_matrix_r1_c1 + * @param cscMatrixR1C2 [IN] Csc_matrix_r1_c2 + * @param cscMatrixR2C0 [IN] Csc_matrix_r2_c0 + * @param cscMatrixR2C1 [IN] Csc_matrix_r2_c1 + * @param cscMatrixR2C2 [IN] Csc_matrix_r2_c2 + * @param cscOutputBiasR0 [IN] Output Bias for RGB to YUV, element of row 0, unsigned number + * @param cscOutputBiasR1 [IN] Output Bias for RGB to YUV, element of row 1, unsigned number + * @param cscOutputBiasR2 [IN] Output Bias for RGB to YUV, element of row 2, unsigned number + * @param cscInputBiasR0 [IN] Input Bias for YUV to RGB, element of row 0, unsigned number + * @param cscInputBiasR1 [IN] Input Bias for YUV to RGB, element of row 1, unsigned number + * @param cscInputBiasR2 [IN] Input Bias for YUV to RGB, element of row 2, unsigned number + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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, + uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1, + uint8_t cscOutputBiasR2, uint8_t cscInputBiasR0, + uint8_t cscInputBiasR1, uint8_t cscInputBiasR2); + +/** + * @ingroup AscendCL + * @brief set rb/ub swap switch of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param rbuvSwapSwitch [IN] rb/ub swap switch + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t rbuvSwapSwitch); + +/** + * @ingroup AscendCL + * @brief set RGBA->ARGB, YUVA->AYUV swap switch of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param axSwapSwitch [IN] RGBA->ARGB, YUVA->AYUV swap switch + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t axSwapSwitch); + +/** + * @ingroup AscendCL + * @brief set source image of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param srcImageSizeW [IN] Source image width + * @param srcImageSizeH [IN] Source image height + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, int32_t srcImageSizeW, + int32_t srcImageSizeH); + +/** + * @ingroup AscendCL + * @brief set resize switch of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param scfSwitch [IN] Resize switch + * @param scfInputSizeW [IN] Input width of scf + * @param scfInputSizeH [IN] Input height of scf + * @param scfOutputSizeW [IN] Output width of scf + * @param scfOutputSizeH [IN] Output height of scf + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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); + +/** + * @ingroup AscendCL + * @brief set cropParams of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param cropSwitch [IN] Crop switch + * @param cropStartPosW [IN] The start horizontal position of cropping + * @param cropStartPosH [IN] The start vertical position of cropping + * @param cropSizeW [IN] Crop width + * @param cropSizeH [IN] Crop height + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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, + uint64_t batchIndex); + +/** + * @ingroup AscendCL + * @brief set paddingParams of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param paddingSwitch [IN] Padding switch + * @param paddingSizeTop [IN] Top padding size + * @param paddingSizeBottom [IN] Bottom padding size + * @param paddingSizeLeft [IN] Left padding size + * @param paddingSizeRight [IN] Right padding size + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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, + uint64_t batchIndex); + +/** + * @ingroup AscendCL + * @brief set DtcPixelMean of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param dtcPixelMeanChn0 [IN] Mean value of channel 0 + * @param dtcPixelMeanChn1 [IN] Mean value of channel 1 + * @param dtcPixelMeanChn2 [IN] Mean value of channel 2 + * @param dtcPixelMeanChn3 [IN] Mean value of channel 3 + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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); + +/** + * @ingroup AscendCL + * @brief set DtcPixelMin of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param dtcPixelMinChn0 [IN] Min value of channel 0 + * @param dtcPixelMinChn1 [IN] Min value of channel 1 + * @param dtcPixelMinChn2 [IN] Min value of channel 2 + * @param dtcPixelMinChn3 [IN] Min value of channel 3 + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, float dtcPixelMinChn0, + float dtcPixelMinChn1, float dtcPixelMinChn2, + float dtcPixelMinChn3, uint64_t batchIndex); + +/** + * @ingroup AscendCL + * @brief set PixelVarReci of type aclmdlAIPP + * + * @param aippParmsSet [OUT] Pointer for aclmdlAIPP + * @param dtcPixelVarReciChn0 [IN] sfr_dtc_pixel_variance_reci_ch0 + * @param dtcPixelVarReciChn1 [IN] sfr_dtc_pixel_variance_reci_ch1 + * @param dtcPixelVarReciChn2 [IN] sfr_dtc_pixel_variance_reci_ch2 + * @param dtcPixelVarReciChn3 [IN] sfr_dtc_pixel_variance_reci_ch3 + * @param batchIndex [IN] Batch parameter index + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, float dtcPixelVarReciChn0, + float dtcPixelVarReciChn1, float dtcPixelVarReciChn2, + float dtcPixelVarReciChn3, uint64_t batchIndex); + +/** + * @ingroup AscendCL + * @brief set aipp parameters to model + * + * @param modelId [IN] model id + * @param dataset [IN] Pointer of dataset + * @param index [IN] index of input for aipp data(ACL_DYNAMIC_AIPP_NODE) + * @param aippParmsSet [IN] Pointer for aclmdlAIPP + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId, aclmdlDataset *dataset, size_t index, + const aclmdlAIPP *aippParmsSet); + +/** + * @ingroup AscendCL + * @brief set aipp parameters to model + * + * @param modelId [IN] model id + * @param dataset [IN] Pointer of dataset + * @param index [IN] index of input for data which linked dynamic aipp(ACL_DATA_WITH_DYNAMIC_AIPP) + * @param aippParmsSet [IN] Pointer for aclmdlAIPP + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId, aclmdlDataset *dataset, size_t index, + const aclmdlAIPP *aippParmsSet); + +/** + * @ingroup AscendCL + * @brief get input aipp type + * + * @param modelId [IN] model id + * @param index [IN] index of input + * @param type [OUT] aipp type for input.refrer to aclmdlInputAippType(enum) + * @param dynamicAttachedDataIndex [OUT] index for dynamic attached data(ACL_DYNAMIC_AIPP_NODE) + * valid when type is ACL_DATA_WITH_DYNAMIC_AIPP, invalid value is ACL_INVALID_NODE_INDEX + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId, size_t index, aclmdlInputAippType *type, + size_t *dynamicAttachedDataIndex); + +/** + * @ingroup AscendCL + * @brief get static aipp parameters from model + * + * @param modelId [IN] model id + * @param index [IN] index of tensor + * @param aippinfo [OUT] Pointer for static aipp info + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval ACL_ERROR_MODEL_AIPP_NOT_EXIST The tensor of index is not configured with aipp + * @retval OtherValues Failure + * + * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | + * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t index, aclAippInfo *aippinfo); + +/** + * @ingroup AscendCL + * @brief get op description info + * + * @param deviceId [IN] device id + * @param streamId [IN] stream id + * @param taskId [IN] task id + * @param opName [OUT] pointer to op name + * @param opNameLen [IN] the length of op name + * @param inputDesc [OUT] pointer to input description + * @param numInputs [OUT] the number of input tensor + * @param outputDesc [OUT] pointer to output description + * @param numOutputs [OUT] the number of output tensor + * + * @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); + +/** + * @ingroup AscendCL + * @brief init dump + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlInitDump(); + +/** + * @ingroup AscendCL + * @brief set param of dump + * + * @param dumpCfgPath [IN] the path of dump config + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetDump(const char *dumpCfgPath); + +/** + * @ingroup AscendCL + * @brief finalize dump. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlFinalizeDump(); + +/** + * @ingroup AscendCL + * @brief load model with config + * + * @param handle [IN] pointer to model config handle + * @param modelId [OUT] pointer to model id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId); + +/** + * @ingroup AscendCL + * @brief create model config handle of type aclmdlConfigHandle + * + * @retval the aclmdlConfigHandle pointer + * + * @see aclmdlDestroyConfigHandle + */ +ACL_FUNC_VISIBILITY aclmdlConfigHandle *aclmdlCreateConfigHandle(); + +/** + * @ingroup AscendCL + * @brief destroy data of type aclmdlConfigHandle + * + * @param handle [IN] pointer to model config handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclmdlCreateConfigHandle + */ +ACL_FUNC_VISIBILITY aclError aclmdlDestroyConfigHandle(aclmdlConfigHandle *handle); + +/** + * @ingroup AscendCL + * @brief set config for model load + * + * @param handle [OUT] pointer to model config handle + * @param attr [IN] config attr in model config handle to be set + * @param attrValue [IN] pointer to model config value + * @param valueSize [IN] memory size of attrValue + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetConfigOpt(aclmdlConfigHandle *handle, aclmdlConfigAttr attr, + const void *attrValue, size_t valueSize); + +/** + * @ingroup AscendCL + * @brief get real tensor name from modelDesc + * + * @param modelDesc [IN] pointer to modelDesc + * @param name [IN] tensor name + * + * @retval the pointer of real tensor name + * @retval Failure return NULL + */ +ACL_FUNC_VISIBILITY const char *aclmdlGetTensorRealName(const aclmdlDesc *modelDesc, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_MODEL_H_ diff --git a/inc/external/acl/acl_op.h b/inc/external/acl/acl_op.h new file mode 100644 index 00000000..d2e59bfb --- /dev/null +++ b/inc/external/acl/acl_op.h @@ -0,0 +1,504 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_OP_H_ +#define INC_EXTERNAL_ACL_ACL_OP_H_ + +#include "acl_base.h" +#include "acl_rt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct aclopHandle aclopHandle; +typedef struct aclopAttr aclopAttr; +typedef struct aclopKernelDesc aclopKernelDesc; + +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, +} aclopEngineType; + +/** + * @ingroup AscendCL + * @brief Set base directory that contains single op models + * + * @par Restriction + * The aclopSetModelDir interface can be called only once in a process. + * @param modelDir [IN] path of the directory + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); + +/** + * @ingroup AscendCL + * @brief load single op models from memory + * + * @par Restriction + * The aclopLoad interface can be called more than one times in a process. + * @param model [IN] address of single op models + * @param modelSize [IN] size of single op models + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize); + +/** + * @ingroup AscendCL + * @brief create data of type aclopAttr + * + * @retval pointer to created instance. + * @retval nullptr if run out of memory + */ +ACL_FUNC_VISIBILITY aclopAttr *aclopCreateAttr(); + +/** + * @ingroup AscendCL + * @brief destroy data of typ aclopAttr + * + * @param attr [IN] pointer to the instance of aclopAttr + */ +ACL_FUNC_VISIBILITY void aclopDestroyAttr(const aclopAttr *attr); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is bool + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param attrValue [IN] attribute value + * false if attrValue is 0, true otherwise. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is int64_t + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param attrValue [IN] attribute value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is float + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param attrValue [IN] attribute value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is string + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param attrValue [IN] attribute value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is list of bools + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param numValues [IN] number of values. false if attrValue is 0, true otherwise. + * @param values [IN] pointer to values + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, + const uint8_t *values); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is list of ints + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param numValues [IN] number of values + * @param values [IN] pointer to values + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, + const int64_t *values); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is list of floats + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param numValues [IN] number of values + * @param values [IN] pointer to values + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, + const float *values); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is list of strings + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param numValues [IN] number of values + * @param values [IN] pointer to values + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, + const char **values); + +/** + * @ingroup AscendCL + * @brief set an attribute. the type of the attribute is list of list of ints + * + * @param attr [OUT] pointer to the instance of aclopAttr + * @param attrName [IN] attribute name + * @param numLists [IN] number of lists + * @param numValues [IN] pointer to number of values of each list + * @param values [IN] pointer to values + * + * @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[]); + +/** + * @ingroup AscendCL + * @brief Load and execute the specified operator asynchronously + * + * @par Restriction + * @li The input and output organization of each operator is different, + * and the application needs to organize the operator strictly + * according to the operator input and output parameters when calling. + * @li When the user calls aclopExecute, + * the ACL finds the corresponding task according to the optype, + * the description of the input tesnsor, + * the description of the output tesnsor, and attr, and issues the execution. + * + * @param opType [IN] type of op + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param inputs [IN] pointer to array of input buffers + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param outputs [OUT] pointer to array of output buffers + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * @param stream [IN] stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @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); + +/** + * @ingroup AscendCL + * @brief Load and execute the specified operator + * The difference with aclopExecute is that aclopExecuteV2 will refresh outputDesc + * + * @par Restriction + * @li The input and output organization of each operator is different, + * and the application needs to organize the operator strictly + * according to the operator input and output parameters when calling. + * @li When the user calls aclopExecuteV2, + * the ACL finds the corresponding task according to the optype, + * the description of the input tesnsor, + * the description of the output tesnsor, and attr, and issues the execution. + * + * @param opType [IN] type of op + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param inputs [IN] pointer to array of input buffers + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions + * @param outputs [OUT] pointer to array of output buffers + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a instance of aclopHandle. + * + * @param opType [IN] type of op + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param opAttr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * @param handle [OUT] pointer to the pointer to the handle + * + * @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, + aclopHandle **handle); + +/** + * @ingroup AscendCL + * @brief destroy aclopHandle instance + * + * @param handle [IN] pointer to the instance of aclopHandle + */ +ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle); + +/** + * @ingroup AscendCL + * @brief execute an op with the handle. + * can save op model matching cost compared with aclopExecute + * + * @param handle [IN] pointer to the instance of aclopHandle. + * The aclopCreateHandle interface has been called + * in advance to create aclopHandle type data. + * @param numInputs [IN] number of inputs + * @param inputs [IN] pointer to array of input buffers. + * The aclCreateDataBuffer interface has been called + * in advance to create aclDataBuffer type data. + * @param numOutputs [IN] number of outputs + * @param outputs [OUT] pointer to array of output buffers + * @param stream [IN] stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclopCreateHandle | aclCreateDataBuffer + */ +ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, int numInputs, + const aclDataBuffer *const inputs[], int numOutputs, + aclDataBuffer *const outputs[], aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief cast data type + * + * @param srcDesc [IN] source tensor desc + * @param srcBuffer [IN] source tensor buffer + * @param dstDesc [IN] destination tensor desc + * @param dstBuffer [OUT] destination tensor buffer + * @param truncate [IN] do not truncate if value is 0, truncate otherwise + * @param stream [IN] stream + * + * @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, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief create a handle for casting datatype + * + * @param srcDesc [IN] source tensor desc + * @param dstDesc [IN] destination tensor desc + * @param truncate [IN] do not truncate if value is 0, truncate otherwise + * @param handle [OUT] pointer to the pointer to the handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, aclTensorDesc *dstDesc, uint8_t truncate, + aclopHandle **handle); + +/** + * @ingroup AscendCL + * @brief create kernel + * + * @param opType [IN] op type + * @param kernelId [IN] kernel id + * @param kernelName [IN] kernel name + * @param binData [IN] kernel bin data + * @param binSize [IN] kernel bin size + * @param enginetype [IN] enigne type + * @param deallocator [IN] callback function for deallocating bin data, + * null if bin data to be deallocated by caller + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclopCompile + */ +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 + * + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param opAttr [IN] pointer to instance of aclopAttr + * @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc + * + * @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, + aclopKernelDesc *aclopKernelDesc); + +/** + * @ingroup AscendCL + * @brief register compile function + * + * @param opType [IN] op type + * @param func [IN] compile function + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclopUnregisterCompileFunc + */ +ACL_FUNC_VISIBILITY aclError aclopRegisterCompileFunc(const char *opType, aclopCompileFunc func); + +/** + * @ingroup AscendCL + * @brief unregister compile function + * + * @param opType [IN] op type + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); + +/** + * @ingroup AscendCL + * @brief set kernel args + * + * @param kernelDesc [IN] pointer to instance of aclopKernelDesc + * @param kernelId [IN] kernel id + * @param blockDim [IN] block dim + * @param args [IN] args + * @param argSize [IN] size in bytes of args + * + * @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); + +/** + * @ingroup AscendCL + * @brief set workspace sizes + * + * @param kernelDesc [IN] pointer to instance of aclopKernelDesc + * @param numWorkspaces [IN] number of workspaces + * @param workspaceSizes [IN] pointer to array of sizes of workspaces + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces, + size_t *workspaceSizes); + +/** + * @ingroup AscendCL + * @brief compile op with dynamic shape + * + * @param opType [IN] op type + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * + * @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); + +/** + * @ingroup AscendCL + * @brief inferShape the specified operator synchronously + * + * @param opType [IN] type of op + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param inputs [IN] pointer to array of input buffers + * @param numOutputs [IN] number of outputs + * @param outputDesc [OUT] pointer to array of output tensor descriptions + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * + * @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[], + aclopAttr *attr); + +#ifdef __cplusplus +} +#endif + +#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 new file mode 100644 index 00000000..d9d1b3da --- /dev/null +++ b/inc/external/acl/acl_op_compiler.h @@ -0,0 +1,121 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ +#define INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ + +#include "acl_base.h" +#include "acl_op.h" + +#ifdef __cplusplus +extern "C" { +#endif + +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 +} aclCompileOpt; + +typedef enum aclCompileFlag { ACL_OP_COMPILE_DEFAULT, ACL_OP_COMPILE_FUZZ } aclOpCompileFlag; + +/** + * @ingroup AscendCL + * @brief compile op + * + * @param opType [IN] op type + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * @param engineType [IN] engine type + * @param compileFlag [IN] compile flag + * @param opPath [IN] path of op + * + * @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); + +/** + * @ingroup AscendCL + * @brief compile and execute op + * + * @param opType [IN] op type + * @param numInputs [IN] number of inputs + * @param inputDesc [IN] pointer to array of input tensor descriptions + * @param inputs [IN] pointer to array of input buffers + * @param numOutputs [IN] number of outputs + * @param outputDesc [IN] pointer to array of output tensor descriptions + * @param outputs [IN] pointer to array of outputs buffers + * @param attr [IN] pointer to instance of aclopAttr. + * may pass nullptr if the op has no attribute + * @param engineType [IN] engine type + * @param compileFlag [IN] compile flag + * @param opPath [IN] path of op + * @param stream [IN] stream handle + * + * @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); + +/** + * @ingroup AscendCL + * @brief set compile option + * + * @param aclCompileOpt [IN] compile option + * @param value [IN] pointer for the option value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclSetCompileopt(aclCompileOpt opt, const char *value); + +/** + * @ingroup AscendCL + * @brief set compile flag + * + * @param flag [IN] compile flag, ACL_OP_COMPILE_DEFAULT means compile with default mode + * ACL_OP_COMPILE_FUZZ means compile with fuzz mode + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclopSetCompileFlag(aclOpCompileFlag flag); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ diff --git a/inc/external/acl/acl_prof.h b/inc/external/acl/acl_prof.h new file mode 100644 index 00000000..3784d8c6 --- /dev/null +++ b/inc/external/acl/acl_prof.h @@ -0,0 +1,329 @@ +/** + * 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 INC_EXTERNAL_ACL_PROF_H_ +#define INC_EXTERNAL_ACL_PROF_H_ + +#include "acl_base.h" + +#ifdef __cplusplus +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 + +/** + * @deprecated please use aclprofGetOpTypeLen and aclprofGetOpTNameLen instead + */ +#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 +} aclprofAicoreMetrics; + +typedef struct aclprofConfig aclprofConfig; +typedef struct aclprofStopConfig aclprofStopConfig; +typedef struct aclprofAicoreEvents aclprofAicoreEvents; +typedef struct aclprofSubscribeConfig aclprofSubscribeConfig; + +/** + * @ingroup AscendCL + * @brief profiling initialize + * + * @param profilerResultPath [IN] path of profiling result + * @param length [IN] length of profilerResultPath + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofFinalize + */ +ACL_FUNC_VISIBILITY aclError aclprofInit(const char *profilerResultPath, size_t length); + +/** + * @ingroup AscendCL + * @brief profiling finalize + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofInit + */ +ACL_FUNC_VISIBILITY aclError aclprofFinalize(); + +/** + * @ingroup AscendCL + * @brief Start profiling modules by profilerConfig + * + * @param profilerConfig [IN] config of profiling + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofStop + */ +ACL_FUNC_VISIBILITY aclError aclprofStart(const aclprofConfig *profilerConfig); + +/** + * @ingroup AscendCL + * @brief Create data of type aclprofConfig + * + * @param deviceIdList [IN] list of device id + * @param deviceNums [IN] number of devices + * @param aicoreMetrics [IN] type of aicore metrics + * @param aicoreEvents [IN] pointer to aicore events, only support NULL now + * @param dataTypeConfig [IN] config modules need profiling + * + * @retval the aclprofConfig pointer + * + * @see aclprofDestroyConfig + */ +ACL_FUNC_VISIBILITY aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdList, uint32_t deviceNums, + aclprofAicoreMetrics aicoreMetrics, + aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig); + +/** + * @ingroup AscendCL + * @brief Destroy data of type aclprofConfig + * + * @param profilerConfig [IN] config of profiling + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofCreateConfig + */ +ACL_FUNC_VISIBILITY aclError aclprofDestroyConfig(const aclprofConfig *profilerConfig); + +/** + * @ingroup AscendCL + * @brief stop profiling modules by stopProfilingConfig + * + * @param profilerConfig [IN] pointer to stop config of profiling + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofStart + */ +ACL_FUNC_VISIBILITY aclError aclprofStop(const aclprofConfig *profilerConfig); + +/** + * @ingroup AscendCL + * @brief subscribe profiling data of model + * + * @param modelId [IN] the model id subscribed + * @param profSubscribeConfig [IN] pointer to config of model subscribe + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofModelUnSubscribe + */ +ACL_FUNC_VISIBILITY aclError aclprofModelSubscribe(uint32_t modelId, const aclprofSubscribeConfig *profSubscribeConfig); + +/** + * @ingroup AscendCL + * @brief unsubscribe profiling data of model + * + * @param modelId [IN] the model id unsubscribed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofModelSubscribe + */ +ACL_FUNC_VISIBILITY aclError aclprofModelUnSubscribe(uint32_t modelId); + +/** + * @ingroup AscendCL + * @brief create subscribe config + * + * @param timeInfoSwitch [IN] switch whether get time info from model + * @param aicoreMetrics [IN] aicore metrics + * @param fd [IN] pointer to write pipe + * + * @retval the aclprofSubscribeConfig pointer + * + * @see aclprofDestroySubscribeConfig + */ +ACL_FUNC_VISIBILITY aclprofSubscribeConfig *aclprofCreateSubscribeConfig(int8_t timeInfoSwitch, + aclprofAicoreMetrics aicoreMetrics, void *fd); + +/** + * @ingroup AscendCL + * @brief destroy subscribe config + * + * @param profSubscribeConfig [IN] subscribe config + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclprofCreateSubscribeConfig + */ +ACL_FUNC_VISIBILITY aclError aclprofDestroySubscribeConfig(const aclprofSubscribeConfig *profSubscribeConfig); + +/** + * @ingroup AscendCL + * @brief create subscribe config + * + * @param opDescSize [OUT] size of op desc + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclprofGetOpDescSize(size_t *opDescSize); + +/** + * @ingroup AscendCL + * @brief get op number from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param opNumber [OUT] op number of subscription data + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLen, uint32_t *opNumber); + +/** + * @ingroup AscendCL + * @brief get length op type from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * @param opTypeLen [OUT] actual length of op type string + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclprofGetOpTypeLen(const void *opInfo, size_t opInfoLen, uint32_t index, + size_t *opTypeLen); + +/** + * @ingroup AscendCL + * @brief get op type from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * @param opType [OUT] obtained op type string + * @param opTypeLen [IN] obtained length of op type string + * + * @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); + +/** + * @ingroup AscendCL + * @brief get length op name from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * @param opNameLen [OUT] actual length of op name string + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclprofGetOpNameLen(const void *opInfo, size_t opInfoLen, uint32_t index, + size_t *opNameLen); + +/** + * @ingroup AscendCL + * @brief get op type from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * @param opName [OUT] obtained op name string + * @param opNameLen [IN] obtained length of op name string + * + * @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); + +/** + * @ingroup AscendCL + * @brief get start time of specified op from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * + * @retval start time(us) of specified op with timestamp + * @retval 0 for failed + */ +ACL_FUNC_VISIBILITY uint64_t aclprofGetOpStart(const void *opInfo, size_t opInfoLen, uint32_t index); + +/** + * @ingroup AscendCL + * @brief get end time of specified op from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * + * @retval end time(us) of specified op with timestamp + * @retval 0 for failed + */ +ACL_FUNC_VISIBILITY uint64_t aclprofGetOpEnd(const void *opInfo, size_t opInfoLen, uint32_t index); + +/** + * @ingroup AscendCL + * @brief get excution time of specified op from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * @param index [IN] index of op array in opInfo + * + * @retval execution time(us) of specified op with timestamp + * @retval 0 for failed + */ +ACL_FUNC_VISIBILITY uint64_t aclprofGetOpDuration(const void *opInfo, size_t opInfoLen, uint32_t index); + +/** + * @ingroup AscendCL + * @brief get model id from subscription data + * + * @param opInfo [IN] pointer to subscription data + * @param opInfoLen [IN] memory size of subscription data + * + * @retval model id of subscription data + * @retval 0 for failed + */ +ACL_FUNC_VISIBILITY size_t aclprofGetModelId(const void *opInfo, size_t opInfoLen, uint32_t index); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_PROF_H_ diff --git a/inc/external/acl/acl_rt.h b/inc/external/acl/acl_rt.h new file mode 100644 index 00000000..5ee70724 --- /dev/null +++ b/inc/external/acl/acl_rt.h @@ -0,0 +1,958 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_RT_H_ +#define INC_EXTERNAL_ACL_ACL_RT_H_ + +#include +#include +#include "acl_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ACL_EVENT_TIME_LINE 0x00000008u + +typedef enum aclrtRunMode { + ACL_DEVICE, + ACL_HOST, +} aclrtRunMode; + +typedef enum aclrtTsId { + 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, +} aclrtEventStatus; + +typedef enum aclrtCallbackBlockType { + 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, +} 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, +} 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, +} 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 +} aclrtGroupAttr; + +typedef struct tagRtGroupInfo aclrtGroupInfo; + +typedef struct rtExceptionInfo aclrtExceptionInfo; + +typedef void (*aclrtCallback)(void *userData); + +typedef void (*aclrtExceptionInfoCallback)(aclrtExceptionInfo *exceptionInfo); + +/** + * @ingroup AscendCL + * @brief Set a callback function to handle exception information + * + * @param callback [IN] callback function to handle exception information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback); + +/** + * @ingroup AscendCL + * @brief Get task id from exception information + * + * @param info [IN] pointer of exception information + * + * @retval The task id from exception information + * @retval 0xFFFFFFFF if info is null + */ +ACL_FUNC_VISIBILITY uint32_t aclrtGetTaskIdFromExceptionInfo(const aclrtExceptionInfo *info); + +/** + * @ingroup AscendCL + * @brief Get stream id from exception information + * + * @param info [IN] pointer of exception information + * + * @retval The stream id from exception information + * @retval 0xFFFFFFFF if info is null + */ +ACL_FUNC_VISIBILITY uint32_t aclrtGetStreamIdFromExceptionInfo(const aclrtExceptionInfo *info); + +/** + * @ingroup AscendCL + * @brief Get thread id from exception information + * + * @param info [IN] pointer of exception information + * + * @retval The thread id of fail task + * @retval 0xFFFFFFFF if info is null + */ +ACL_FUNC_VISIBILITY uint32_t aclrtGetThreadIdFromExceptionInfo(const aclrtExceptionInfo *info); + +/** + * @ingroup AscendCL + * @brief Get device id from exception information + * + * @param info [IN] pointer of exception information + * + * @retval The thread id of fail task + * @retval 0xFFFFFFFF if info is null + */ +ACL_FUNC_VISIBILITY uint32_t aclrtGetDeviceIdFromExceptionInfo(const aclrtExceptionInfo *info); + +/** + * @ingroup AscendCL + * @brief The thread that handles the callback function on the Stream + * + * @param threadId [IN] thread ID + * @param stream [IN] stream handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Add a callback function to be executed on the host + * to the task queue of the Stream + * + * @param fn [IN] Specify the callback function to be added + * The function prototype of the callback function is: + * typedef void (*aclrtCallback)(void *userData); + * @param userData [IN] User data to be passed to the callback function + * @param blockType [IN] callback block type + * @param stream [IN] stream handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userData, aclrtCallbackBlockType blockType, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief After waiting for a specified time, trigger callback processing + * + * @par Function + * The thread processing callback specified by + * the aclrtSubscribeReport interface + * + * @param timeout [IN] timeout value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtSubscribeReport + */ +ACL_FUNC_VISIBILITY aclError aclrtProcessReport(int32_t timeout); + +/** + * @ingroup AscendCL + * @brief Cancel thread registration, + * the callback function on the specified Stream + * is no longer processed by the specified thread + * + * @param threadId [IN] thread ID + * @param stream [IN] stream handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief create context and associates it with the calling thread + * + * @par Function + * The following use cases are supported: + * @li If you don't call the aclrtCreateContext interface + * to explicitly create the context, + * the system will use the default context, which is implicitly created + * when the aclrtSetDevice interface is called. + * @li If multiple contexts are created in a process + * (there is no limit on the number of contexts), + * the current thread can only use one of them at the same time. + * It is recommended to explicitly specify the context of the current thread + * through the aclrtSetCurrentContext interface to increase. + * the maintainability of the program. + * + * @param context [OUT] point to the created context + * @param deviceId [IN] device to create context on + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtSetDevice | aclrtSetCurrentContext + */ +ACL_FUNC_VISIBILITY aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId); + +/** + * @ingroup AscendCL + * @brief destroy context instance + * + * @par Function + * Can only destroy context created through aclrtCreateContext interface + * + * @param context [IN] the context to destroy + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateContext + */ +ACL_FUNC_VISIBILITY aclError aclrtDestroyContext(aclrtContext context); + +/** + * @ingroup AscendCL + * @brief set the context of the thread + * + * @par Function + * The following scenarios are supported: + * @li If the aclrtCreateContext interface is called in a thread to explicitly + * create a Context (for example: ctx1), the thread's Context can be specified + * without calling the aclrtSetCurrentContext interface. + * The system uses ctx1 as the context of thread1 by default. + * @li If the aclrtCreateContext interface is not explicitly created, + * the system uses the default context as the context of the thread. + * At this time, the aclrtDestroyContext interface cannot be used to release + * the default context. + * @li If the aclrtSetCurrentContext interface is called multiple times to + * set the thread's Context, the last one prevails. + * + * @par Restriction + * @li If the cevice corresponding to the context set for the thread + * has been reset, you cannot set the context as the context of the thread, + * otherwise a business exception will result. + * @li It is recommended to use the context created in a thread. + * If the aclrtCreateContext interface is called in thread A to create a context, + * and the context is used in thread B, + * the user must guarantee the execution order of tasks in the same stream + * under the same context in two threads. + * + * @param context [IN] the current context of the thread + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateContext | aclrtDestroyContext + */ +ACL_FUNC_VISIBILITY aclError aclrtSetCurrentContext(aclrtContext context); + +/** + * @ingroup AscendCL + * @brief get the context of the thread + * + * @par Function + * If the user calls the aclrtSetCurrentContext interface + * multiple times to set the context of the current thread, + * then the last set context is obtained + * + * @param context [OUT] the current context of the thread + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtSetCurrentContext + */ +ACL_FUNC_VISIBILITY aclError aclrtGetCurrentContext(aclrtContext *context); + +/** + * @ingroup AscendCL + * @brief Specify the device to use for the operation + * implicitly create the default context and the default stream + * + * @par Function + * The following use cases are supported: + * @li Device can be specified in the process or thread. + * If you call the aclrtSetDevice interface multiple + * times to specify the same device, + * you only need to call the aclrtResetDevice interface to reset the device. + * @li The same device can be specified for operation + * in different processes or threads. + * @li Device is specified in a process, + * and multiple threads in the process can share this device to explicitly + * create a Context (aclrtCreateContext interface). + * @li In multi-device scenarios, you can switch to other devices + * through the aclrtSetDevice interface in the process. + * + * @param deviceId [IN] the device id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtResetDevice |aclrtCreateContext + */ +ACL_FUNC_VISIBILITY aclError aclrtSetDevice(int32_t deviceId); + +/** + * @ingroup AscendCL + * @brief Reset the current operating Device and free resources on the device, + * including the default context, the default stream, + * and all streams created under the default context, + * and synchronizes the interface. + * If the task under the default context or stream has not been completed, + * the system will wait for the task to complete before releasing it. + * + * @par Restriction + * @li The Context, Stream, and Event that are explicitly created + * on the device to be reset. Before resetting, + * it is recommended to follow the following interface calling sequence, + * otherwise business abnormalities may be caused. + * @li Interface calling sequence: + * call aclrtDestroyEvent interface to release Event or + * call aclrtDestroyStream interface to release explicitly created Stream-> + * call aclrtDestroyContext to release explicitly created Context-> + * call aclrtResetDevice interface + * + * @param deviceId [IN] the device id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId); + +/** + * @ingroup AscendCL + * @brief get target device of current thread + * + * @param deviceId [OUT] the device id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId); + +/** + * @ingroup AscendCL + * @brief get target side + * + * @param runMode [OUT] the run mode + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode); + +/** + * @ingroup AscendCL + * @brief Wait for compute device to finish + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void); + +/** + * @ingroup AscendCL + * @brief Set Scheduling TS + * + * @param tsId [IN] the ts id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId); + +/** + * @ingroup AscendCL + * @brief get total device number. + * + * @param count [OUT] the device number + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); + +/** + * @ingroup AscendCL + * @brief create event instance + * + * @param event [OUT] created event + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); + +/** + * @ingroup AscendCL + * @brief create event instance with flag + * + * @param event [OUT] created event + * @param flag [IN] event flag + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag); + +/** + * @ingroup AscendCL + * @brief destroy event instance + * + * @par Function + * Only events created through the aclrtCreateEvent interface can be + * destroyed, synchronous interfaces. When destroying an event, + * the user must ensure that the tasks involved in the aclrtSynchronizeEvent + * interface or the aclrtStreamWaitEvent interface are completed before + * they are destroyed. + * + * @param event [IN] event to destroy + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateEvent | aclrtSynchronizeEvent | aclrtStreamWaitEvent + */ +ACL_FUNC_VISIBILITY aclError aclrtDestroyEvent(aclrtEvent event); + +/** + * @ingroup AscendCL + * @brief Record an Event in the Stream + * + * @param event [IN] event to record + * @param stream [IN] stream handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Reset an event + * + * @par Function + * Users need to make sure to wait for the tasks in the Stream + * to complete before resetting the Event + * + * @param event [IN] event to reset + * @param stream [IN] stream handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Queries an event's status + * + * @param event [IN] event to query + * @param status [OUT] event status + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status); + +/** + * @ingroup AscendCL + * @brief Block Host Running, wait event to be complete + * + * @param event [IN] event to wait + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event); + +/** + * @ingroup AscendCL + * @brief computes the elapsed time between events. + * + * @param ms [OUT] time between start and end in ms + * @param start [IN] starting event + * @param end [IN] ending event + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateEvent | aclrtRecordEvent | aclrtSynchronizeStream + */ +ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent start, aclrtEvent end); + +/** + * @ingroup AscendCL + * @brief alloc memory on device + * + * @par Function + * alloc for size linear memory on device + * and return a pointer to allocated memory by *devPtr + * + * @par Restriction + * @li The memory requested by the aclrtMalloc interface needs to be released + * through the aclrtFree interface. + * @li Before calling the media data processing interface, + * if you need to apply memory on the device to store input or output data, + * you need to call acldvppMalloc to apply for memory. + * + * @param devPtr [OUT] pointer to pointer to allocated memory on device + * @param size [IN] alloc memory size + * @param policy [IN] memory alloc policy + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtFree | acldvppMalloc | aclrtMallocCached + */ +ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy); + +/** + * @ingroup AscendCL + * @brief allocate memory on device with cache + * + * @par Function + * alloc for size linear memory on device + * and return a pointer to allocated memory by *devPtr + * + * @par Restriction + * @li The memory requested by the aclrtMallocCached interface needs to be released + * through the aclrtFree interface. + * + * @param devPtr [OUT] pointer to pointer to allocated memory on device + * @param size [IN] alloc memory size + * @param policy [IN] memory alloc policy + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtFree | aclrtMalloc + */ +ACL_FUNC_VISIBILITY aclError aclrtMallocCached(void **devPtr, size_t size, aclrtMemMallocPolicy policy); + +/** + * @ingroup AscendCL + * @brief flush cache data to ddr + * + * @param devPtr [IN] the pointer that flush data to ddr + * @param size [IN] flush size + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtMemFlush(void *devPtr, size_t size); + +/** + * @ingroup AscendCL + * @brief invalidate cache data + * + * @param devPtr [IN] pointer to invalidate cache data + * @param size [IN] invalidate size + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtMemInvalidate(void *devPtr, size_t size); + +/** + * @ingroup AscendCL + * @brief free device memory + * + * @par Function + * can only free memory allocated through the aclrtMalloc interface + * + * @param devPtr [IN] Pointer to memory to be freed + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtMalloc + */ +ACL_FUNC_VISIBILITY aclError aclrtFree(void *devPtr); + +/** + * @ingroup AscendCL + * @brief alloc memory on host + * + * @par Restriction + * @li The requested memory cannot be used in the Device + * and needs to be explicitly copied to the Device. + * @li The memory requested by the aclrtMallocHost interface + * needs to be released through the aclrtFreeHost interface. + * + * @param hostPtr [OUT] pointer to pointer to allocated memory on the host + * @param size [IN] alloc memory size + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtFreeHost + */ +ACL_FUNC_VISIBILITY aclError aclrtMallocHost(void **hostPtr, size_t size); + +/** + * @ingroup AscendCL + * @brief free host memory + * + * @par Function + * can only free memory allocated through the aclrtMallocHost interface + * + * @param hostPtr [IN] free memory pointer + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtMallocHost + */ +ACL_FUNC_VISIBILITY aclError aclrtFreeHost(void *hostPtr); + +/** + * @ingroup AscendCL + * @brief synchronous memory replication between host and device + * + * @param dst [IN] destination address pointer + * @param destMax [IN] Max length of the destination address memory + * @param src [IN] source address pointer + * @param count [IN] the length of byte to copy + * @param kind [IN] memcpy type + * + * @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, + aclrtMemcpyKind kind); + +/** + * @ingroup AscendCL + * @brief Initialize memory and set contents of memory to specified value + * + * @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] Starting address of memory + * @param maxCount [IN] Max length of destination address memory + * @param value [IN] Set value + * @param count [IN] The length of memory + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count); + +/** + * @ingroup AscendCL + * @brief Asynchronous memory replication between Host and Device + * + * @par Function + * After calling this interface, + * be sure to call the aclrtSynchronizeStream interface to ensure that + * the task of memory replication has been completed + * + * @par Restriction + * @li For on-chip Device-to-Device memory copy, + * both the source and destination addresses must be 64-byte aligned + * + * @param dst [IN] destination address pointer + * @param destMax [IN] Max length of destination address memory + * @param src [IN] source address pointer + * @param count [IN] the number of byte to copy + * @param kind [IN] memcpy type + * @param stream [IN] asynchronized task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtSynchronizeStream + */ +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 + * 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, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief create stream instance + * + * @param stream [OUT] the created stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream); + +/** + * @ingroup AscendCL + * @brief destroy stream instance + * + * @par Function + * Can only destroy streams created through the aclrtCreateStream interface + * + * @par Restriction + * Before calling the aclrtDestroyStream interface to destroy + * the specified Stream, you need to call the aclrtSynchronizeStream interface + * to ensure that the tasks in the Stream have been completed. + * + * @param stream [IN] the stream to destroy + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateStream | aclrtSynchronizeStream + */ +ACL_FUNC_VISIBILITY aclError aclrtDestroyStream(aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief block the host until all tasks + * in the specified stream have completed + * + * @param stream [IN] the stream to wait + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Blocks the operation of the specified Stream until + * the specified Event is completed. + * Support for multiple streams waiting for the same event. + * + * @param stream [IN] the wait stream If using thedefault Stream, set NULL + * @param event [IN] the event to wait + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event); + +/** + * @ingroup AscendCL + * @brief set group + * + * @par Function + * set the task to the corresponding group + * + * @param groupId [IN] group id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtGetGroupCount | aclrtGetAllGroupInfo | aclrtGetGroupInfoDetail + */ +ACL_FUNC_VISIBILITY aclError aclrtSetGroup(int32_t groupId); + +/** + * @ingroup AscendCL + * @brief get the number of group + * + * @par Function + * get the number of group. if the number of group is zero, + * it means that group is not supported or group is not created. + * + * @param count [OUT] the number of group + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + */ +ACL_FUNC_VISIBILITY aclError aclrtGetGroupCount(uint32_t *count); + +/** + * @ingroup AscendCL + * @brief create group information + * + * @retval null for failed. + * @retval OtherValues success. + * + * @see aclrtDestroyGroupInfo + */ +ACL_FUNC_VISIBILITY aclrtGroupInfo *aclrtCreateGroupInfo(); + +/** + * @ingroup AscendCL + * @brief destroy group information + * + * @param groupInfo [IN] pointer to group information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtCreateGroupInfo + */ +ACL_FUNC_VISIBILITY aclError aclrtDestroyGroupInfo(aclrtGroupInfo *groupInfo); + +/** + * @ingroup AscendCL + * @brief get all group information + * + * @param groupInfo [OUT] pointer to group information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtGetGroupCount + */ +ACL_FUNC_VISIBILITY aclError aclrtGetAllGroupInfo(aclrtGroupInfo *groupInfo); + +/** + * @ingroup AscendCL + * @brief get detail information of group + * + * @param groupInfo [IN] pointer to group information + * @param groupIndex [IN] group index value + * @param attr [IN] group attribute + * @param attrValue [OUT] pointer to attribute value + * @param valueLen [IN] length of attribute value + * @param paramRetSize [OUT] pointer to real length of attribute value + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtGetGroupCount | aclrtGetAllGroupInfo + */ +ACL_FUNC_VISIBILITY aclError aclrtGetGroupInfoDetail(const aclrtGroupInfo *groupInfo, int32_t groupIndex, + aclrtGroupAttr attr, void *attrValue, size_t valueLen, + size_t *paramRetSize); + +/** + * @ingroup AscendCL + * @brief checking whether current device and peer device support the p2p feature + * + * @param canAccessPeer [OUT] pointer to save the checking result + * @param deviceId [IN] current device id + * @param peerDeviceId [IN] peer device id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtDeviceEnablePeerAccess | aclrtDeviceDisablePeerAccess + */ +ACL_FUNC_VISIBILITY aclError aclrtDeviceCanAccessPeer(int32_t *canAccessPeer, int32_t deviceId, int32_t peerDeviceId); + +/** + * @ingroup AscendCL + * @brief enable the peer device to support the p2p feature + * + * @param peerDeviceId [IN] the peer device id + * @param flags [IN] reserved field, now it must be zero + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtDeviceCanAccessPeer | aclrtDeviceDisablePeerAccess + */ +ACL_FUNC_VISIBILITY aclError aclrtDeviceEnablePeerAccess(int32_t peerDeviceId, uint32_t flags); + +/** + * @ingroup AscendCL + * @brief disable the peer device to support the p2p function + * + * @param peerDeviceId [IN] the peer device id + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtDeviceCanAccessPeer | aclrtDeviceEnablePeerAccess + */ +ACL_FUNC_VISIBILITY aclError aclrtDeviceDisablePeerAccess(int32_t peerDeviceId); + +/** + * @ingroup AscendCL + * @brief Obtain the free memory and total memory of specified attribute. + * the specified memory include normal memory and huge memory. + * + * @param attr [IN] the memory attribute of specified device + * @param free [OUT] the free memory of specified device + * @param total [OUT] the total memory of specified device. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total); + +/** + * @ingroup AscendCL + * @brief Set the timeout interval for waitting of op + * + * @param timeout [IN] op wait timeout + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclrtSetOpWaitTimeout(uint32_t timeout); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_RT_H_ diff --git a/inc/external/acl/acl_tdt.h b/inc/external/acl/acl_tdt.h new file mode 100644 index 00000000..c357518d --- /dev/null +++ b/inc/external/acl/acl_tdt.h @@ -0,0 +1,276 @@ +/** + * 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 INC_EXTERNAL_ACL_ACL_TDT_H_ +#define INC_EXTERNAL_ACL_ACL_TDT_H_ + +#include "acl/acl_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum acltdtTensorType { + ACL_TENSOR_DATA_UNDEFINED = -1, + ACL_TENSOR_DATA_TENSOR, + ACL_TENSOR_DATA_END_OF_SEQUENCE, + ACL_TENSOR_DATA_ABNORMAL +}; + +typedef struct acltdtDataItem acltdtDataItem; +typedef struct acltdtDataset acltdtDataset; +typedef struct acltdtChannelHandle acltdtChannelHandle; + +/** + * @ingroup AscendCL + * @brief Get tensor type from item + * + * @param dataItem [IN] pointer to the data item + * + * @retval Tensor type. + * @retval ACL_DT_UNDEFINED if dataItem is null + */ +ACL_FUNC_VISIBILITY acltdtTensorType acltdtGetTensorTypeFromItem(const acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get data type from item + * + * @param dataItem [IN] pointer to the data item + * + * @retval Data type. + * @retval ACL_DT_UNDEFINED if dataItem is null + */ +ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get data address from item + * + * @param dataItem [IN] pointer to data item + * + * @retval null for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get data size from item + * + * @param dataItem [IN] pointer to data item + * + * @retval 0 for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get dim's number from item + * + * @param dataItem [IN] pointer to data item + * + * @retval 0 for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get dims from item + * + * @param dataItem [IN] the struct of data item + * @param dims [IN|OUT] pointer to the dims of dataTtem + * @param dimNum [IN] the size of the dims + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataItem, int64_t *dims, size_t dimNum); + +/** + * @ingroup AscendCL + * @brief Create the struct of data item + * + * @param tdtType [IN] Tdt tensor type + * @param dims [IN] pointer of tdtDataItem's dims + * @param dimNum [IN] Dim number + * @param dataType [IN] Data type + * @param data [IN] Data pointer + * @param size [IN] Data size + * + * @retval null for failed + * @retval OtherValues success + * + * @see acltdtDestroyDataItem + */ +ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, const int64_t *dims, size_t dimNum, + aclDataType dataType, void *data, size_t size); + +/** + * @ingroup AscendCL + * @brief Destroy the struct of data item + * + * @param dataItem [IN] pointer to the data item + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtCreateDataItem + */ +ACL_FUNC_VISIBILITY aclError acltdtDestroyDataItem(acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Create the tdt dataset + * + * @retval null for failed + * @retval OtherValues success + * + * @see acltdtDestroyDataset + */ +ACL_FUNC_VISIBILITY acltdtDataset *acltdtCreateDataset(); + +/** + * @ingroup AscendCL + * @brief Destroy the tdt dataset + * + * @param dataset [IN] pointer to the dataset + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtCreateDataset + */ +ACL_FUNC_VISIBILITY aclError acltdtDestroyDataset(acltdtDataset *dataset); + +/** + * @ingroup AscendCL + * @brief Get the data item + * + * @param dataset [IN] pointer to the dataset + * @param index [IN] index of the dataset + * + * @retval null for failed + * @retval OtherValues success + * + * @see acltdtAddDataItem + */ +ACL_FUNC_VISIBILITY acltdtDataItem *acltdtGetDataItem(const acltdtDataset *dataset, size_t index); + +/** + * @ingroup AscendCL + * @brief Get the data item + * + * @param dataset [OUT] pointer to the dataset + * @param dataItem [IN] pointer to the data item + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtGetDataItem + */ +ACL_FUNC_VISIBILITY aclError acltdtAddDataItem(acltdtDataset *dataset, acltdtDataItem *dataItem); + +/** + * @ingroup AscendCL + * @brief Get the size of dataset + * + * @param dataset [IN] pointer to the dataset + * + * @retval 0 for failed + * @retval OtherValues success + */ +ACL_FUNC_VISIBILITY size_t acltdtGetDatasetSize(const acltdtDataset *dataset); + +/** + * @ingroup AscendCL + * @brief Stop the channel + * + * @param handle [IN] pointer to the channel handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtCreateChannel | acltdtDestroyChannel + */ +ACL_FUNC_VISIBILITY aclError acltdtStopChannel(acltdtChannelHandle *handle); + +/** + * @ingroup AscendCL + * @brief Create the channel + * + * @param deviceId [IN] the device id + * @param name [IN] the channel's name + * + * @retval null for failed + * @retval OtherValues success + * + * @see acltdtStopChannel | acltdtDestroyChannel + */ +ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannel(uint32_t deviceId, const char *name); + +/** + * @ingroup AscendCL + * @brief Destroy the channel + * + * @param handle [IN] pointer to the channel handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtCreateChannel | acltdtStopChannel + */ +ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle); + +/** + * @ingroup AscendCL + * @brief Send tensor to device + * + * @param handle [IN] pointer to the channel handle + * @param dataset [IN] pointer to the dataset + * @param timeout [IN] to be reserved, now it must be -1 + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtReceiveTensor + */ +ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, const acltdtDataset *dataset, + int32_t timeout); + +/** + * @ingroup AscendCL + * @brief Receive tensor from device + * + * @param handle [IN] pointer to the channel handle + * @param dataset [OUT] pointer to the dataset + * @param timeout [IN] to be reserved, now it must be -1 + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acltdtSendTensor + */ +ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, acltdtDataset *dataset, + int32_t timeout); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_ACL_TDT_H_ diff --git a/inc/external/acl/error_codes/ge_error_codes.h b/inc/external/acl/error_codes/ge_error_codes.h new file mode 100644 index 00000000..cafc5a64 --- /dev/null +++ b/inc/external/acl/error_codes/ge_error_codes.h @@ -0,0 +1,75 @@ +/** + * 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 INC_EXTERNAL_GE_GE_ERROR_CODES_H_ +#define INC_EXTERNAL_GE_GE_ERROR_CODES_H_ + +#if defined(_MSC_VER) +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY _declspec(dllexport) +#else +#define GE_FUNC_VISIBILITY +#endif +#else +#ifdef FUNC_VISIBILITY +#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define GE_FUNC_VISIBILITY +#endif +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif +static const uint32_t ACL_ERROR_GE_PARAM_INVALID = 145000; +static const uint32_t ACL_ERROR_GE_EXEC_NOT_INIT = 145001; +static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID = 145002; +static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ID_INVALID = 145003; +static const uint32_t ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID = 145006; +static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID = 145007; +static const uint32_t ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID = 145008; +static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED = 145009; +static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID = 145011; +static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID = 145012; +static const uint32_t ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID = 145013; +static const uint32_t ACL_ERROR_GE_AIPP_BATCH_EMPTY = 145014; +static const uint32_t ACL_ERROR_GE_AIPP_NOT_EXIST = 145015; +static const uint32_t ACL_ERROR_GE_AIPP_MODE_INVALID = 145016; +static const uint32_t ACL_ERROR_GE_OP_TASK_TYPE_INVALID = 145017; +static const uint32_t ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID = 145018; +static const uint32_t ACL_ERROR_GE_PLGMGR_PATH_INVALID = 145019; +static const uint32_t ACL_ERROR_GE_FORMAT_INVALID = 145020; +static const uint32_t ACL_ERROR_GE_SHAPE_INVALID = 145021; +static const uint32_t ACL_ERROR_GE_DATATYPE_INVALID = 145022; +static const uint32_t ACL_ERROR_GE_MEMORY_ALLOCATION = 245000; +static const uint32_t ACL_ERROR_GE_MEMORY_OPERATE_FAILED = 245001; +static const uint32_t ACL_ERROR_GE_INTERNAL_ERROR = 545000; +static const uint32_t ACL_ERROR_GE_LOAD_MODEL = 545001; +static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED = 545002; +static const uint32_t ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED = 545003; +static const uint32_t ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED = 545004; +static const uint32_t ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED = 545005; +static const uint32_t ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA = 545006; +static const uint32_t ACL_ERROR_GE_COMMAND_HANDLE = 545007; +static const uint32_t ACL_ERROR_GE_GET_TENSOR_INFO = 545008; +static const uint32_t ACL_ERROR_GE_UNLOAD_MODEL = 545009; + +#ifdef __cplusplus +} // namespace ge +#endif +#endif // INC_EXTERNAL_GE_GE_ERROR_CODES_H_ diff --git a/inc/external/acl/error_codes/rt_error_codes.h b/inc/external/acl/error_codes/rt_error_codes.h new file mode 100644 index 00000000..a1392cc6 --- /dev/null +++ b/inc/external/acl/error_codes/rt_error_codes.h @@ -0,0 +1,109 @@ +/** + * 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 __INC_EXTERNEL_RT_ERROR_CODES_H__ +#define __INC_EXTERNEL_RT_ERROR_CODES_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +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_WAIT_TIMEOUT = 107019; // wait timeout + +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_NO_CDQ_RESOURCE = 207011; // no cdq 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_VECTOR_CORE_TIMEOUT = 507034; // vector core timeout +static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception +static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception +static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal + +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__ diff --git a/inc/external/acl/ops/acl_cblas.h b/inc/external/acl/ops/acl_cblas.h new file mode 100644 index 00000000..3d81eb2b --- /dev/null +++ b/inc/external/acl/ops/acl_cblas.h @@ -0,0 +1,334 @@ +/** + * 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 INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ +#define INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ + +#include "acl/acl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +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; + +/** + * @ingroup AscendCL + * @brief perform the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param alpha [IN] pointer to scalar used for multiplication. + * of same type as dataTypeC + * @param a [IN] pointer to matrix A + * @param lda [IN] leading dimension used to store the matrix A + * @param dataTypeA [IN] datatype of matrix A + * @param x [IN] pointer to vector x + * @param incx [IN] stride between consecutive elements of vector x + * @param dataTypeX [IN] datatype of vector x + * @param beta [IN] pointer to scalar used for multiplication. + * of same type as dataTypeC If beta == 0, + * then y does not have to be a valid input + * @param y [IN|OUT] pointer to vector y + * @param incy [IN] stride between consecutive elements of vector y + * @param dataTypeY [IN] datatype of vector y + * @param type [IN] computation type + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param dataTypeA [IN] datatype of matrix A + * @param dataTypeX [IN] datatype of vector x + * @param dataTypeY [IN] datatype of vector y + * @param type [IN] computation type + * @param handle [OUT] pointer to the pointer to the handle + * + * @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); + +/** + * @ingroup AscendCL + * @brief perform the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param alpha [IN] pointer to scalar used for multiplication + * @param a [IN] pointer to matrix A + * @param lda [IN] leading dimension used to store the matrix A + * @param x [IN] pointer to vector x + * @param incx [IN] stride between consecutive elements of vector x + * @param beta [IN] pointer to scalar used for multiplication. + * If beta value == 0, + * then y does not have to be a valid input + * @param y [IN|OUT] pointer to vector y + * @param incy [IN] stride between consecutive elements of vector y + * @param type [IN] computation type + * @param stream [IN] stream + * @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, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param type [IN] computation type + * @param handle [OUT] pointer to the pointer to the handle + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, int m, int n, aclComputeType type, + aclopHandle **handle); + +/** + * @ingroup AscendCL + * @brief perform the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param alpha [IN] pointer to scalar used for multiplication + * @param a [IN] pointer to matrix A + * @param lda [IN] leading dimension used to store the matrix A + * @param x [IN] pointer to vector x + * @param incx [IN] stride between consecutive elements of vector x + * @param beta [IN] pointer to scalar used for multiplication. + * If beta value == 0, + * then y does not have to be a valid input + * @param y [IN|OUT] pointer to vector y + * @param incy [IN] stride between consecutive elements of vector y + * @param type [IN] computation type + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-vector multiplication + * + * @param transA [IN] transpose type of matrix A + * @param m [IN] number of rows of matrix A + * @param n [IN] number of columns of matrix A + * @param handle [OUT] pointer to the pointer to the handle + * @param type [IN] computation type + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, int m, int n, aclComputeType type, + aclopHandle **handle); + +/** + * @ingroup AscendCL + * @brief perform the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param alpha [IN] pointer to scalar used for multiplication. of same type as dataTypeC + * @param matrixA [IN] pointer to matrix A + * @param lda [IN] leading dimension array used to store matrix A + * @param dataTypeA [IN] datatype of matrix A + * @param matrixB [IN] pointer to matrix B + * @param ldb [IN] leading dimension array used to store matrix B + * @param dataTypeB [IN] datatype of matrix B + * @param beta [IN] pointer to scalar used for multiplication. + * of same type as dataTypeC If beta == 0, + * then matrixC does not have to be a valid input + * @param matrixC [IN|OUT] pointer to matrix C + * @param ldc [IN] leading dimension array used to store matrix C + * @param dataTypeC [IN] datatype of matrix C + * @param type [IN] computation type + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param dataTypeA [IN] datatype of matrix A + * @param dataTypeB [IN] datatype of matrix B + * @param dataTypeC [IN] datatype of matrix C + * @param type [IN] computation type + * @param handle [OUT] pointer to the pointer to the handle + * @param type [IN] computation type + * + * @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); + +/** + * @ingroup AscendCL + * @brief perform the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param alpha [IN] pointer to scalar used for multiplication + * @param matrixA [IN] pointer to matrix A + * @param lda [IN] leading dimension used to store the matrix A + * @param matrixB [IN] pointer to matrix B + * @param ldb [IN] leading dimension used to store the matrix B + * @param beta [IN] pointer to scalar used for multiplication. + * If beta value == 0, + * then matrixC does not have to be a valid input + * @param matrixC [IN|OUT] pointer to matrix C + * @param ldc [IN] leading dimension used to store the matrix C + * @param type [IN] computation type + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param type [IN] computation type + * @param handle [OUT] pointer to the pointer to the handle + * + * @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, + aclopHandle **handle); + +/** + * @ingroup AscendCL + * @brief perform the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param alpha [IN] pointer to scalar used for multiplication + * @param matrixA [IN] pointer to matrix A + * @param lda [IN] leading dimension used to store the matrix A + * @param matrixB [IN] pointer to matrix B + * @param ldb [IN] leading dimension used to store the matrix B + * @param beta [IN] pointer to scalar used for multiplication. + * If beta value == 0, + * then matrixC does not have to be a valid input + * @param matrixC [IN|OUT] pointer to matrix C + * @param ldc [IN] leading dimension used to store the matrix C + * @param type [IN] computation type + * @param stream [IN] stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief create a handle for performing the matrix-matrix multiplication + * + * @param transA [IN] transpose type of matrix A + * @param transB [IN] transpose type of matrix B + * @param transC [IN] transpose type of matrix C + * @param m [IN] number of rows of matrix A and matrix C + * @param n [IN] number of columns of matrix B and matrix C + * @param k [IN] number of columns of matrix A and rows of matrix B + * @param type [IN] computation type + * @param handle [OUT] pointer to the pointer to the handle + * + * @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, + aclopHandle **handle); + +#ifdef __cplusplus +} +#endif + +#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 new file mode 100644 index 00000000..dcaa3936 --- /dev/null +++ b/inc/external/acl/ops/acl_dvpp.h @@ -0,0 +1,2568 @@ +/** + * 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. + */ + +#if !defined(ENABLE_DVPP_INTERFACE) +#if defined(_MSC_VER) +#error message("if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE).") +#else +#error "if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE)." +#endif +#endif + +#ifndef INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ +#define INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ + +#include +#include +#include "acl/acl.h" +#include "acl/acl_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct acldvppPicDesc acldvppPicDesc; +typedef struct acldvppBatchPicDesc acldvppBatchPicDesc; +typedef struct acldvppRoiConfig acldvppRoiConfig; +typedef struct acldvppResizeConfig acldvppResizeConfig; +typedef struct acldvppBorderConfig acldvppBorderConfig; +typedef struct acldvppLutMap acldvppLutMap; +typedef struct acldvppChannelDesc acldvppChannelDesc; +typedef struct acldvppJpegeConfig acldvppJpegeConfig; +typedef struct aclvdecChannelDesc aclvdecChannelDesc; +typedef struct acldvppStreamDesc acldvppStreamDesc; +typedef struct aclvdecFrameConfig aclvdecFrameConfig; +typedef struct aclvencChannelDesc aclvencChannelDesc; +typedef struct aclvencFrameConfig aclvencFrameConfig; +typedef struct acldvppHist acldvppHist; +typedef void (*aclvdecCallback)(acldvppStreamDesc *input, acldvppPicDesc *output, void *userData); +typedef void (*aclvencCallback)(acldvppPicDesc *input, acldvppStreamDesc *output, void *userdata); + +// 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 +}; + +// Stream Format +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 }; + +// Supported Border Type +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 +}; + +// 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 +}; + +/** + * @ingroup AscendCL + * @brief alloc device memory for dvpp. + * + * @par Function + * @li It's mainly used for allocating memory to device media data processing. + * The requested memory meets the data processing requirements. + * After calling this interface to request memory, + * you must release the memory using the acldvppFree interface. + * @li When calling the acldvppMalloc interface to apply for memory, + * the size entered by the user is aligned upwards to 32 integer multiples, + * and an additional 32 bytes are applied. + * + * @par Restriction + * If the user uses the acldvppMalloc interface to apply for a large block of + * memory and divide and manage the memory by himself, + * when applying for memory, the user needs to align up to 32 integer + * times + 32 bytes (ALIGN_UP [len] +32 words) according to + * the actual data size of each picture Section) to manage memory. + * + * @param devPtr [OUT] memory pointer. + * @param size [IN] memory size. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppFree + */ +ACL_FUNC_VISIBILITY aclError acldvppMalloc(void **devPtr, size_t size); + +/** + * @ingroup AscendCL + * @brief free device memory for dvpp. + * + * @par Function + * Free the memory requested through the acldvppMalloc interface + * @param devPtr [IN] memory pointer to free. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppMalloc + */ +ACL_FUNC_VISIBILITY aclError acldvppFree(void *devPtr); + +/** + * @ingroup AscendCL + * @brief create DvppChannelDesc. + * + * @par Function + * Create a channel for image data processing. + * The same channel can be reused + * and is no longer available after destruction + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppChannelDesc *acldvppCreateChannelDesc(); + +/** + * @ingroup AscendCL + * @brief destroy dvppChannelDesc. + * + * @par Function + * Can only destroy channels created by the acldvppCreateChannel interface + * @param channelDesc [IN] the channel description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannelDesc | acldvppDestroyChannel + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyChannelDesc(acldvppChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp channel Id. + * + * @par Restriction + * Interface calling sequence: + * acldvppCreateChannelDesc --> acldvppCreateChannel --> + * acldvppGetChannelDescChannelId + * + * @param channelDesc [IN] the channel description. + * + * @retval channel id. + * + * @see acldvppCreateChannelDesc | acldvppCreateChannel + */ +ACL_FUNC_VISIBILITY uint64_t acldvppGetChannelDescChannelId(const acldvppChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Create dvpp picture description. + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppCreatePicDesc(); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp picture description. + * + * @par Function + * Can only destroy picture description information created + * through acldvppCreatePicDesc interface. + * @param picDesc [IN] dvpp picture description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyPicDesc(acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's data. + * + * @param picDesc [OUT] dvpp picture description. + * @param dataDev [IN] dvpp picture dataDev.Must be the memory + * requested using the acldvppMalloc interface. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppMalloc + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescData(acldvppPicDesc *picDesc, void *dataDev); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's size. + * + * @param picDesc [OUT] dvpp picture description. + * @param size dvpp [IN] picture size. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescSize(acldvppPicDesc *picDesc, uint32_t size); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's format. + * + * @param picDesc [OUT] dvpp picture description. + * @param format [IN] dvpp picture format. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescFormat(acldvppPicDesc *picDesc, acldvppPixelFormat format); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's width. + * + * @param picDesc [OUT] dvpp picture description. + * @param width [IN] dvpp picture width. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidth(acldvppPicDesc *picDesc, uint32_t width); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's height. + * + * @param picDesc [OUT] dvpp picture description. + * @param height [IN] dvpp picture height. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeight(acldvppPicDesc *picDesc, uint32_t height); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's widthStride. + * + * @par Restriction + * Width alignment requirements: + * @li The minimum stride is 32 and the maximum is 4096 * 4 + * (that is, an image in argb format with a width of 4096); + * @li For 8K scaling, widthStride is required to be aligned to 2; + * @li For non 8K scaling, the calculation formula for widthStride + * is different for different image formats: + * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 + * @li yuv422packed: input image width * 2 and then align to 16 + * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 + * @li xrgb8888: input image width * 4, align to 16 + * @li HFBC:input image width + * + * @param picDesc [OUT] dvpp picture description. + * @param widthStride [IN] dvpp picture widthStride. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidthStride(acldvppPicDesc *picDesc, uint32_t widthStride); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's heightStride. + * + * @par Restriction + * Height alignment requirements: + * @li The height of the input image is aligned to 2. + * High stride minimum 6 and maximum 4096. + * + * @param picDesc [OUT] dvpp picture description. + * @param heightStride [IN] dvpp picture heightStride. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeightStride(acldvppPicDesc *picDesc, uint32_t heightStride); + +/** + * @ingroup AscendCL + * @brief Set dvpp picture description's retcode. + * + * @param picDesc [OUT] dvpp picture description. + * @param retCode [IN] dvpp picture retcode. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetPicDescRetCode(acldvppPicDesc *picDesc, uint32_t retCode); + +/** + * @ingroup AscendCL + * @brief Get picture data. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval picture data addr. + * @retval default nullptr. + */ +ACL_FUNC_VISIBILITY void *acldvppGetPicDescData(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get picture data size. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval picture data size. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescSize(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's format. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval format + * @retval default PIXEL_FORMAT_YUV_400. + */ +ACL_FUNC_VISIBILITY acldvppPixelFormat acldvppGetPicDescFormat(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's width. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval width. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidth(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's height. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval height. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeight(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's widthStride. + * + * @par Restriction + * Width alignment requirements: + * @li The minimum stride is 32 and the maximum is 4096 * 4 + * (that is, an image in argb format with a width of 4096); + * @li For 8K scaling, widthStride is required to be aligned to 2; + * @li For non 8K scaling, the calculation formula for widthStride + * is different for different image formats: + * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 + * @li yuv422packed: input image width * 2 and then align to 16 + * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 + * @li xrgb8888: input image width * 4, align to 16 + * @li HFBC:input image width + * + * @param picDesc [IN] dvpp picture description. + * + * @retval stride width. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidthStride(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's heightStride. + * + * @par Restriction + * Height alignment requirements: + * @li The height of the input image is aligned to 2. + * High stride minimum 6 and maximum 4096. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval stride height. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeightStride(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture desc's retcode. + * + * @param picDesc [IN] dvpp picture description. + * + * @retval ret code. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescRetCode(const acldvppPicDesc *picDesc); + +/** + * @ingroup AscendCL + * @brief Create dvpp roi config. + * + * @param left [IN] the left offset, must be even + * @param right [IN] the right offset, must be odd + * @param top [IN] the top offset, must be even + * @param bottom [IN] the bottom offset, must be odd + * + * @retval null for failed. + * @retval other success + */ +ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, uint32_t right, uint32_t top, + uint32_t bottom); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp roi config. + * + * @par Function + * Destroys data created through the acldvppCreateRoiConfig interface + * @param roiConfig [IN] dvpp roi config. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateRoiConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyRoiConfig(acldvppRoiConfig *roiConfig); + +/** + * @ingroup AscendCL + * @brief Set left of RoiConfig. + * + * @param config [OUT] RoiConfig + * @param left [IN] left offset + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigLeft(acldvppRoiConfig *config, uint32_t left); + +/** + * @ingroup AscendCL + * @brief Set right of RoiConfig. + * + * @param config [OUT] RoiConfig + * @param right [IN] right offset + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigRight(acldvppRoiConfig *config, uint32_t right); + +/** + * @ingroup AscendCL + * @brief Set top of RoiConfig. + * + * @param config [OUT] RoiConfig + * @param top [IN] top offset + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigTop(acldvppRoiConfig *config, uint32_t top); + +/** + * @ingroup AscendCL + * @brief Set bottom of RoiConfig. + * + * @param config [OUT] RoiConfig + * @param bottom [IN] bottom offset + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigBottom(acldvppRoiConfig *config, uint32_t bottom); + +/** + * @ingroup AscendCL + * @brief Set RoiConfig. + * + * @param config [OUT] RoiConfig + * @param left [IN] left offset + * @param right [IN] right offset + * @param top [IN] top offset + * @param bottom [IN] bottom offset + * + * @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, + uint32_t bottom); + +/** + * @ingroup AscendCL + * @brief Create dvpp resize config. + * The specified scaling algorithm is not supported. + * The default scaling algorithm is "nearest neighbor interpolation". + * + * @retval null for failed. + * @retval other success. + */ +ACL_FUNC_VISIBILITY acldvppResizeConfig *acldvppCreateResizeConfig(); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp resize config. + * + * @par Function + * Destroys the scaling configuration data created by + * the acldvppCreateResizeConfig interface + * + * @param resizeConfig [IN] resize config. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateResizeConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyResizeConfig(acldvppResizeConfig *resizeConfig); + +/** + * @ingroup AscendCL + * @brief Create jpege config. + * + * @retval null for failed. + * @retval other success. + */ +ACL_FUNC_VISIBILITY acldvppJpegeConfig *acldvppCreateJpegeConfig(); + +/** + * @ingroup AscendCL + * @brief Destroy jpege config. + * + * @par Function + * Destroys the encoding configuration data created by + * the acldvppCreateJpegeConfig interface + * @param jpegeConfig [IN] config pointer to destroy. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateJpegeConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyJpegeConfig(acldvppJpegeConfig *jpegeConfig); + +/** + * @ingroup AscendCL + * @brief Set jpege config's level. + * + * @param jpegeConfig [OUT] Call the acldvppCreateJpegeConfig + * interface to create acldvppJpegeConfig data + * @param level [IN] Encoding quality range [0, 100], + * where level 0 encoding quality is similar to level 100, + * and the smaller the value in [1, 100], + * the worse the quality of the output picture. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetJpegeConfigLevel(acldvppJpegeConfig *jpegeConfig, uint32_t level); + +/** + * @ingroup AscendCL + * @brief Get jpege config's level. + * + * @param jpegeConfig [IN] jpege config. + * + * @retval compression level. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetJpegeConfigLevel(const acldvppJpegeConfig *jpegeConfig); + +/** + * @ingroup AscendCL + * @brief create vdecChannelDesc.Channel description information + * when creating a video data processing channel. + * + * @retval null for failed. + * @retval other success + */ +ACL_FUNC_VISIBILITY aclvdecChannelDesc *aclvdecCreateChannelDesc(); + +/** + * @ingroup AscendCL + * @brief destroy vdecChannelDesc. + * + * @par Function + * Can only destroy aclvdecChannelDesc type created + * through aclvdecCreateChannelDesc interface + * @param channelDesc [IN] channel description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + + * @see aclvdecCreateChannelDesc + */ +ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannelDesc(aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's channel id. + * + * @param channelDesc [OUT] vdec channel description. + * @param channelId [IN] decoding channel id: 0~15. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescChannelId(aclvdecChannelDesc *channelDesc, uint32_t channelId); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's thread id. + * + * @param channelDesc [OUT] vdec channel description. + * @param threadId [IN] thread id. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescThreadId(aclvdecChannelDesc *channelDesc, uint64_t threadId); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's callback function. + * + * @param channelDesc [OUT] vdec channel description. + * @param callback [IN] function callback.Function prototype: + * void (* aclvdecCallback) + * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata) + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCallback + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescCallback(aclvdecChannelDesc *channelDesc, aclvdecCallback callback); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's video encoding type. + * + * @param channelDesc [OUT] vdec channel description. + * @param enType [IN] video encoding type. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescEnType(aclvdecChannelDesc *channelDesc, acldvppStreamFormat enType); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's out picture format. + * + * @param channelDesc [OUT] vdec channel description. + * @param outPicFormat [IN] out picture format (acldvppPixelFormat). + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicFormat(aclvdecChannelDesc *channelDesc, + acldvppPixelFormat outPicFormat); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's out picture width. + * + * @param channelDesc [OUT] vdec channel description. + * @param outPicWidth [IN] out picture width. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicWidth(aclvdecChannelDesc *channelDesc, uint32_t outPicWidth); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's out picture height. + * + * @param channelDesc [OUT] vdec channel description. + * @param outPicHeight [IN] out picture height. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicHeight(aclvdecChannelDesc *channelDesc, uint32_t outPicHeight); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's reference frame num. + * + * @param channelDesc [OUT] vdec channel description. + * @param refFrameNum [IN] reference frame num. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescRefFrameNum(aclvdecChannelDesc *channelDesc, uint32_t refFrameNum); + +/** + * @ingroup AscendCL + * @brief Set vdec channel description's bit depth. + * + * @param channelDesc [OUT] vdec channel description. + * @param bitDepth [IN] bit depth. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescBitDepth(aclvdecChannelDesc *channelDesc, uint32_t bitDepth); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's channel id. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval decoding channel id: 0~15. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescChannelId(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's thread id. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval thread id. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint64_t aclvdecGetChannelDescThreadId(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's callback function. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval function callback.Function prototype: + * void (* aclvdecCallback) + * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata) + * @retval default null. + * + * @see aclvdecCallback + */ +ACL_FUNC_VISIBILITY aclvdecCallback aclvdecGetChannelDescCallback(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's video encoding type. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval video encoding type. + * @retval default H265_MAIN_LEVEL. + */ +ACL_FUNC_VISIBILITY acldvppStreamFormat aclvdecGetChannelDescEnType(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's out picture format. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval out picture format. + * @retval default DVPP_OUTPUT_YUV420SP_UV. + */ +ACL_FUNC_VISIBILITY acldvppPixelFormat aclvdecGetChannelDescOutPicFormat(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's out picture width. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval out picture width. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicWidth(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's out picture height. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval out picture height (for vdec malloc memory). + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicHeight(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's bit depth. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval bit depth. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescBitDepth(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get vdec channel description's reference frame num. + * + * @param channelDesc [IN] vdec channel description. + * + * @retval reference frame num. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescRefFrameNum(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief create vencChannelDesc. + * + * @retval null for failed, other success + */ +ACL_FUNC_VISIBILITY aclvencChannelDesc *aclvencCreateChannelDesc(); + +/** + * @ingroup AscendCL + * @brief destroy vencChannelDesc. + * + * @param channelDesc [IN] channel desc. + * + * @retval ACL_SUCCESS:success, other:failed + */ +ACL_FUNC_VISIBILITY aclError aclvencDestroyChannelDesc(aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Set decoding thread id for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param threadId [IN] thread id + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescThreadId(aclvencChannelDesc *channelDesc, uint64_t threadId); + +/** + * @ingroup AscendCL + * @brief Set func callback for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param callback [IN] func callback + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescCallback(aclvencChannelDesc *channelDesc, aclvencCallback callback); + +/** + * @ingroup AscendCL + * @brief Set video encoding type for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param enType [IN] video encoding type + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescEnType(aclvencChannelDesc *channelDesc, acldvppStreamFormat enType); + +/** + * @ingroup AscendCL + * @brief Set pic format for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param picFormat [IN] pic format + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicFormat(aclvencChannelDesc *channelDesc, + acldvppPixelFormat picFormat); + +/** + * @ingroup AscendCL + * @brief Set out pic width for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param picWidth [IN] pic width + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicWidth(aclvencChannelDesc *channelDesc, uint32_t picWidth); + +/** + * @ingroup AscendCL + * @brief Set pic height for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param picHeight [IN] pic height + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicHeight(aclvencChannelDesc *channelDesc, uint32_t picHeight); + +/** + * @ingroup AscendCL + * @brief Set key frame interval for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param keyFrameInterval [IN] Interval of key frame + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescKeyFrameInterval(aclvencChannelDesc *channelDesc, + uint32_t keyFrameInterval); + +/** + * @ingroup AscendCL + * @brief Set output buffer address for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param bufAddr [IN] output buffer address + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufAddr(aclvencChannelDesc *channelDesc, void *bufAddr); + +/** + * @ingroup AscendCL + * @brief Set output buffer size for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param bufSize [IN] output buffer size + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufSize(aclvencChannelDesc *channelDesc, uint32_t bufSize); + +/** + * @ingroup AscendCL + * @brief Set rc model for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param rcMode [IN] venc rc mode(VBR=1, CBR=2) + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescRcMode(aclvencChannelDesc *channelDesc, uint32_t rcMode); + +/** + * @ingroup AscendCL + * @brief Set source rate for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param srcRate [IN] source rate + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescSrcRate(aclvencChannelDesc *channelDesc, uint32_t srcRate); + +/** + * @ingroup AscendCL + * @brief Set max bit rate for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param maxBitRate [IN] max bit rate + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc *channelDesc, uint32_t maxBitRate); + +/** + * @ingroup AscendCL + * @brief Set venc parameter for venc channel desc. + * + * @param channelDesc [OUT] venc channel desc + * @param paramType [IN] parameter type + * @param length [IN] parameter length + * @param param [IN] pointer to parameter value + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescParam(aclvencChannelDesc *channelDesc, + aclvencChannelDescParamType paramType, size_t length, + const void *param); + +/** + * @ingroup AscendCL + * @brief Get output buffer address for venc channel desc. + * + * @param channelDesc[IN] venc channel desc + * + * @retval output buffer address + */ +ACL_FUNC_VISIBILITY void *aclvencGetChannelDescBufAddr(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get output buffer size for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval output buffer size + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescBufSize(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get decoding channel id for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval decoding channel id: 0~15, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescChannelId(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get decoding thread id for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval thread id, default 0 + */ +ACL_FUNC_VISIBILITY uint64_t aclvencGetChannelDescThreadId(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get func callback for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval func callback, default null + */ +ACL_FUNC_VISIBILITY aclvencCallback aclvencGetChannelDescCallback(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get video encoding type for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval video encoding type, default H265_MAIN_LEVEL + */ +ACL_FUNC_VISIBILITY acldvppStreamFormat aclvencGetChannelDescEnType(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get pic format for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval pic format + */ +ACL_FUNC_VISIBILITY acldvppPixelFormat aclvencGetChannelDescPicFormat(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get pic width for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval pic width, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicWidth(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get pic height for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval pic height, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicHeight(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Get interval of key frame for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval interval of key frame, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescKeyFrameInterval(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * + * @brief Get rc mode for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval rc mode, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescRcMode(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * + * @brief Get source rate for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval source rate, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescSrcRate(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * + * @brief Get max bit rate for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * + * @retval max bit rate, default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescMaxBitRate(const aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * + * @brief Get venc parameter for venc channel desc. + * + * @param channelDesc [IN] venc channel desc + * @param paramType [IN] parameter type + * @param length [IN] parameter length + * @param paramRetSize [OUT] pointer to parameter real length + * @param param [OUT] pointer to parameter value + * + * @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); + +/** + * @ingroup AscendCL + * @brief get forced restart of I-frame interval from config + * + * @param config [IN] venc frame config + * + * @retval 0: Not forced; 1: Forced restart of I-frame -1: error + */ +ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigForceIFrame(const aclvencFrameConfig *config); + +/** + * @ingroup AscendCL + * @brief get forced restart of I-frame interval from config + * + * @param config [IN] venc frame config + * + * @retval Whether it is the end frame: 0: no; 1: end frame + */ +ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigEos(const aclvencFrameConfig *config); + +/** + * @ingroup AscendCL + * @brief set single frame encoding configuration parameters + * + * @param config [OUT] venc frame config + * @param forceFrame [IN] forced restart of I-frame interval: 0: Not forced; 1: Forced restart of I-frame + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigForceIFrame(aclvencFrameConfig *config, uint8_t forceIFrame); + +/** + * @ingroup AscendCL + * @brief set single frame encoding configuration parameters + * + * @param config [OUT] venc frame config + * @param eos [IN] Whether it is the end frame: 0: no; 1: end frame + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigEos(aclvencFrameConfig *config, uint8_t eos); + +/** + * @ingroup AscendCL + * @brief dvpp venc destroy frame config + * + * @param config [IN] venc frame config + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencDestroyFrameConfig(aclvencFrameConfig *config); + +/** + * @ingroup AscendCL + * @brief Create dvpp venc frame config. + * + * @retval null for failed, other aclvencFrameConfig ptr + */ +ACL_FUNC_VISIBILITY aclvencFrameConfig *aclvencCreateFrameConfig(); + +/** + * @ingroup AscendCL + * @brief Create dvpp venc channel. + * + * @param channelDesc [IN|OUT] venc channel desc + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencCreateChannel(aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp venc channel. + * + * @param channelDesc [IN] venc channel desc + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencDestroyChannel(aclvencChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief dvpp venc launch send frame task. + * + * @param channelDesc [IN] venc channel desc + * @param input [IN] input picture desc + * @param reserve [IN] reserve parameter + * @param config [IN] dvpp frame config + * @param userdata [IN] user callback function + * + * @retval ACL_SUCCESS for ok, others for fail + */ +ACL_FUNC_VISIBILITY aclError aclvencSendFrame(aclvencChannelDesc *channelDesc, acldvppPicDesc *input, void *reserve, + aclvencFrameConfig *config, void *userdata); + +/** + * @ingroup AscendCL + * @brief Create dvpp stream description. + * + * @retval null for failed. + * @retval other success. + */ +ACL_FUNC_VISIBILITY acldvppStreamDesc *acldvppCreateStreamDesc(); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp stream description. + * + * @par Function + * Can only destroy acldvppStreamDesc type created through + * acldvppCreateStreamDesc interface. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateStreamDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyStreamDesc(acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Set stream description's data addr. + * + * @param streamDesc [OUT] dvpp stream description. + * @param dataDev [IN] data addr. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescData(acldvppStreamDesc *streamDesc, void *dataDev); + +/** + * @ingroup AscendCL + * @brief Set stream description's data size. + * + * @param streamDesc [OUT] dvpp stream description. + * @param size [IN] data size. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescSize(acldvppStreamDesc *streamDesc, uint32_t size); + +/** + * @ingroup AscendCL + * @brief Set stream description's format. + * + * @param streamDesc [OUT] dvpp stream description. + * @param format [IN] stream format. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescFormat(acldvppStreamDesc *streamDesc, acldvppStreamFormat format); + +/** + * @ingroup AscendCL + * @brief Set stream description's timestamp. + * + * @param streamDesc [OUT] dvpp stream description. + * @param timestamp [IN] current timestamp. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescTimestamp(acldvppStreamDesc *streamDesc, uint64_t timestamp); + +/** + * @ingroup AscendCL + * @brief Set stream description's ret code. + * + * @param streamDesc [OUT] dvpp stream description. + * @param retCode [IN] result code. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescRetCode(acldvppStreamDesc *streamDesc, uint32_t retCode); + +/** + * @ingroup AscendCL + * @brief Set stream description's eos. + * + * @param streamDesc [OUT] dvpp stream description. + * @param eos [IN] end flag of sequence. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescEos(acldvppStreamDesc *streamDesc, uint8_t eos); + +/** + * @ingroup AscendCL + * @brief Get stream description's data addr. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval data addr. + * @retval deault nullptr. + */ +ACL_FUNC_VISIBILITY void *acldvppGetStreamDescData(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Get stream description's data size. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval data size. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescSize(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Get stream description's format. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval stream format. + * @retval default ACL_DVPP_STREAM_H264. + */ +ACL_FUNC_VISIBILITY acldvppStreamFormat acldvppGetStreamDescFormat(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Get stream description's timestamp. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval current timestamp. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint64_t acldvppGetStreamDescTimestamp(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Get stream description's retCode. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval result code. + * @retval default 0. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescRetCode(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Get stream description's eos. + * + * @param streamDesc [IN] dvpp stream description. + * + * @retval end flag of sequence. + * @retval default 0(false). + */ +ACL_FUNC_VISIBILITY uint8_t acldvppGetStreamDescEos(const acldvppStreamDesc *streamDesc); + +/** + * @ingroup AscendCL + * @brief Create vdec frame config. + * + * @retval null for failed. + * @retval other success. + */ +ACL_FUNC_VISIBILITY aclvdecFrameConfig *aclvdecCreateFrameConfig(); + +/** + * @ingroup AscendCL + * @brief Destroy vdec frame config. + * + * @par Function + * Can only destroy aclvdecFrameConfig type created through + * aclvdecCreateFrameConfig interface + * + * @param vdecFrameConfig [IN] vdec frame config. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCreateFrameConfig + */ +ACL_FUNC_VISIBILITY aclError aclvdecDestroyFrameConfig(aclvdecFrameConfig *vdecFrameConfig); + +/** + * @ingroup AscendCL + * @brief Get image width and height of jpeg. + * + * @param data [IN] image data in host memory + * @param size [IN] the size of image data + * @param width [OUT] the width of image from image header + * @param height [OUT] the height of image from image header + * @param components [OUT] the components of image from image header + * + * @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, + int32_t *components); + +/** + * @ingroup AscendCL + * @brief Get image width and height of jpeg. + * + * @param data [IN] image data in host memory + * @param size [IN] the size of image data + * @param width [OUT] the width of image from image header + * @param height [OUT] the height of image from image header + * @param components [OUT] the components of image from image header + * @param format [OUT] the format of image from image header + * + * @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, + acldvppJpegFormat *format); + +/** + * @ingroup AscendCL + * @brief Predict encode size of jpeg image. + * + * @param inputDesc [IN] dvpp image desc + * @param config [IN] jpeg encode config + * @param size [OUT] the size predicted of image + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inputDesc, + const acldvppJpegeConfig *config, uint32_t *size); + +/** + * @ingroup AscendCL + * @brief Predict decode size of jpeg image. + * + * @param data [IN] origin image data in host memory + * @param dataSize [IN] the size of origin image data + * @param outputPixelFormat [IN] the pixel format jpeg decode + * @param decSize [OUT] the size predicted for decode image + * + * @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); + +/** + * @ingroup AscendCL + * @brief Get image width and height of png. + * + * @param data [IN] image data in host memory + * @param size [IN] the size of image data + * @param width [OUT] the width of image from image header + * @param height [OUT] the height of image from image header + * @param components [OUT] the components of image from image header + * + * @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); + +/** + * @ingroup AscendCL + * @brief Predict decode size of png image. + * + * @param data [IN] origin image data in host memory + * @param dataSize [IN] the size of origin image data + * @param outputPixelFormat [IN] the pixel format jpeg decode + * @param decSize [OUT] the size predicted for decode image + * + * @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); + +/** + * @ingroup AscendCL + * @brief Create dvpp channel, the same channel can be reused + * and is no longer available after destruction. + * + * @param channelDesc [IN|OUT] the channel destruction + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannelDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppCreateChannel(acldvppChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp channel. + * + * @par Restriction + * Can only destroy channel created through the acldvppCreateChannel interface + * + * @param channelDesc [IN] the channel destruction + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyChannel(acldvppChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief dvpp vpc resize. + * + * @par Restriction + * Width alignment requirements: + * @li The minimum stride is 32 and the maximum is 4096 * 4 + * (that is, an image in argb format with a width of 4096); + * @li For 8K scaling, widthStride is required to be aligned to 2; + * @li For non 8K scaling, the calculation formula for widthStride + * is different for different image formats: + * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 + * @li yuv422packed: input image width * 2 and then align to 16 + * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 + * @li xrgb8888: input image width * 4, align to 16 + * @li HFBC:input image width + * Height alignment requirements: + * @li The height of the input image is aligned to 2. + * High stride minimum 6 and maximum 4096. + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] resize input picture destruction + * @param outputDesc [IN|OUT] resize output picture destruction + * @param resizeConfig [IN] resize config + * @param stream [IN] resize task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc + * | acldvppCreateResizeConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppResizeConfig *resizeConfig, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc crop. + * + * @par Function + * crop the input picture according to the specified area, + * and then store the picture in the output memory as the output picture + * + * @par Restriction + * Width alignment requirements: + * @li The minimum stride is 32 and the maximum is 4096 * 4 + * (that is, an image in argb format with a width of 4096); + * @li For 8K scaling, widthStride is required to be aligned to 2; + * @li For non 8K scaling, the calculation formula for widthStride + * is different for different image formats: + * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 + * @li yuv422packed: input image width * 2 and then align to 16 + * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 + * @li xrgb8888: input image width * 4, align to 16 + * @li HFBC:input image width + * Height alignment requirements: + * @li The height of the input image is aligned to 2. + * High stride minimum 6 and maximum 4096. + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] crop input picture destruction + * @param outputDesc [IN|OUT] crop output picture destruction + * @param cropArea [IN] crop area config + * @param stream [IN] crop task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc crop and resize config. + * + * @par Function + * crop the input picture with resize config according to the specified area, + * and then store the picture in the output memory as the output picture + * + * @par Restriction + * Width alignment requirements: + * @li The minimum stride is 32 and the maximum is 4096 * 4 + * (that is, an image in argb format with a width of 4096); + * @li For 8K scaling, widthStride is required to be aligned to 2; + * @li For non 8K scaling, the calculation formula for widthStride + * is different for different image formats: + * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 + * @li yuv422packed: input image width * 2 and then align to 16 + * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 + * @li xrgb8888: input image width * 4, align to 16 + * @li HFBC:input image width + * Height alignment requirements: + * @li The height of the input image is aligned to 2. + * High stride minimum 6 and maximum 4096. + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] crop input picture destruction + * @param outputDesc [IN|OUT] crop output picture destruction + * @param cropArea [IN] crop area config + * @param resizeConfig [IN] resize config + * @param stream [IN] crop and resize config task stream + * + * @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); + +/** + * @ingroup AscendCL + * @brief dvpp vpc batch crop. + * + * @par Function + * crop the input batch picture according to the specified area + * as the output batch pictures + * + * @param channelDesc [IN] the channel destruction + * @param srcBatchPicDescs [IN] crop input batch picture destruction + * @param roiNums [IN] roi config numbers + * @param size [IN] roiNum size + * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction + * @param cropAreas [IN] crop area configs + * @param stream [IN] crop batch task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @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); + +/** + * @ingroup AscendCL + * @brief dvpp vpc batch crop and resize config. + * + * @par Function + * crop the input batch picture with resize config according to the specified area + * as the output batch pictures + * + * @param channelDesc [IN] the channel destruction + * @param srcBatchPicDescs [IN] crop input batch picture destruction + * @param roiNums [IN] roi config numbers + * @param size [IN] roiNum size + * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction + * @param cropAreas [IN] crop area configs + * @param resizeConfig [IN] resize config + * @param stream [IN] crop batch and resize config task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateDvppConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc *channelDesc, + acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, + uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, + acldvppRoiConfig *cropAreas[], + acldvppResizeConfig *resizeConfig, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc crop and paste. + * + * @par Function + * crop the input picture according to the specified area, + * and paste the picture to the specified position of the target picture + * as the output picture + * + * @param channelDesc [IN] thechannel destruction + * @param inputDesc [IN] crop and paste input picture destruction + * @param outputDesc [IN|OUT] crop and paste output picture destruction + * @param cropArea [IN] crop area config + * @param pasteArea [IN] paste area config + * @param stream [IN] crop and paste task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, + acldvppRoiConfig *pasteArea, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc crop, resize config and paste. + * + * @par Function + * crop the input picture with resize config according to the specified area, + * and paste the picture to the specified position of the target picture + * as the output picture + * + * @param channelDesc [IN] thechannel destruction + * @param inputDesc [IN] crop and paste input picture destruction + * @param outputDesc [IN|OUT] crop and paste output picture destruction + * @param cropArea [IN] crop area config + * @param pasteArea [IN] paste area config + * @param resizeConfig [IN] resize config + * @param stream [IN] crop, paste and resize task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, + acldvppRoiConfig *pasteArea, + acldvppResizeConfig *resizeConfig, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc batch crop and paste. + * + * @par Function + * crop the input batch picture according to the specified area, + * and paste the pictures to the specified position of the target pictures + * as the output batch pictures + * + * @param channelDesc [IN] the channel destruction + * @param srcBatchPicDescs [IN] crop input batch picture destruction + * @param roiNums [IN] roi config numbers + * @param size [IN] roiNum size + * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction + * @param cropAreas [IN] crop area configs + * @param pasteAreas [IN] paste area configs + * @param stream [IN] crop batch task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @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); + +/** + * @ingroup AscendCL + * @brief dvpp vpc batch crop, resize config and paste. + * + * @par Function + * crop the input batch picture with resize config according to the specified area, + * and paste the pictures to the specified position of the target pictures + * as the output batch pictures + * + * @param channelDesc [IN] the channel destruction + * @param srcBatchPicDescs [IN] crop input batch picture destruction + * @param roiNums [IN] roi config numbers + * @param size [IN] roiNum size + * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction + * @param cropAreas [IN] crop area configs + * @param pasteAreas [IN] paste area configs + * @param resizeConfig [IN] resize config + * @param stream [IN] crop batch and resize config task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @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); + +/** + * @ingroup AscendCL + * @brief dvpp vpc jpeg decode. + * + * @par Function + * For different source picture formats, after decoding, + * output pictures in the following format: + * @li jpeg(444) -> YUV444SP:V is front U is back, + * YUV420 SP V is front U is back, YUV420SP U is front V is back; + * @li jpeg(422) -> YUV422SP:V is in front U is behind, + * YUV420SP V is in front U is behind, YUV420SP U is in front V is behind; + * @li jpeg(420) -> YUV420SP: + * V is front U is back, YUV420SP U is front V is back; + * @li jpeg(400) -> YUV420SP:UV data is filled with 0 x 80. + * + * @param channelDesc [IN] the channel destruction + * @param data [IN] decode input picture destruction's data + * @param size [IN] decode input picture destruction's size + * @param outputDesc [IN|OUT] decode output picture destruction + * @param stream [IN] decode task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, + acldvppPicDesc *outputDesc, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc jpeg encode. + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] encode input picture destruction + * @param data [OUT] encode output picture destruction's data + * @param size [IN|OUT] encode output picture destruction's size + * @param config [IN] jpeg encode config + * @param stream [IN] encode task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreateJpegeConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + const void *data, uint32_t *size, acldvppJpegeConfig *config, + aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc png decode. + * + * @param channelDesc [IN] the channel destruction + * @param data [IN] decode input picture destruction's data + * @param size [IN] decode input picture destruction's size + * @param outputDesc [IN|OUT] decode output picture destruction + * @param stream [IN] decode task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, + acldvppPicDesc *outputDesc, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Create vdec channel. + * + * @par Function + * Create a channel for video data processing, + * the same channel can be reused, + * and is no longer available after destruction + * + * @param channelDesc [IN|OUT] the channel destruction + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCreateChannelDesc + */ +ACL_FUNC_VISIBILITY aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Destroy vdec channel. + * + * @par Function + * Can only destroy channels created by the aclvdecCreateChannel interface + * + * @param channelDesc [IN] the channel destruction + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCreateChannel + */ +ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief dvpp vdec send frame. + * + * @par Function + * Pass the input memory to be decoded + * and the decoded output memory to the decoder for decoding + * + * @param channelDesc [IN] vdec channel destruction + * @param input [IN] input stream destruction + * @param output [IN|OUT] output picture destruction + * @param config [IN] vdec frame config + * @param userData [IN] user data for callback function + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, + acldvppPicDesc *output, aclvdecFrameConfig *config, void *userData); + +/** + * @ingroup AscendCL + * @brief dvpp vdec send skipped frame. + * + * @par Function + * Pass video frame to decoder + * + * @param channelDesc [IN] vdec channel destruction + * @param input [IN] input stream destruction + * @param config [IN] vdec frame config + * @param userData [IN] user data for callback function + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame + */ +ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, + aclvdecFrameConfig *config, void *userData); + +/** + * @ingroup AscendCL + * @brief dvpp vpc convert color. + * + * @par Restriction + * @li outputDesc:Width height stride, No changes are allowed. Just configure 0 + * @par Function + * Convert color gamut + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] convert color input picture destruction + * @param outputDesc [IN|OUT] convert color output picture destruction + * @param stream [IN] convert color task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief dvpp vpc pyramid down. + * + * @par Restriction + * @li outputDesc:format only supported YUV400 + * @par Function + * Image pyramid down + * + * @param channelDesc [IN] the channel destruction + * @param inputDesc [IN] pyr down input picture destruction + * @param outputDesc [IN|OUT] pyr down output picture destruction + * @param reserve [IN] reserved param , must be nullptr + * @param stream [IN] pyr down task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, void *reserve, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Set dvpp channel mode. + * + * @param channelDesc [OUT] the channel destruction + * @param mode [IN] channel mode + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode); + +/** + * @ingroup AscendCL + * @brief Set resize config interpolation. + * + * @param resizeConfig [OUT] the resize config + * @param interpolation [IN] interpolation + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *resizeConfig, + uint32_t interpolation); + +/** + * @ingroup AscendCL + * @brief Get resize config interpolation. + * + * @param resizeConfig [IN] the resize config + * + * @retval Interpolation of resize config. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppResizeConfig *resizeConfig); + +/** + * @ingroup AscendCL + * @brief Set vdec channel out mode. + * + * @param channelDesc [OUT] the channel destruction + * @param outMode [IN] channel out mode + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode); + +/** + * @ingroup AscendCL + * @brief Get vdec channel out mode. + * + * @param channelDesc [IN] the channel destruction + * + * @retval Out mode of channel destruction + * @retval default 0 + */ +ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutMode(const aclvdecChannelDesc *channelDesc); + +/** + * @ingroup AscendCL + * @brief Create dvpp batch picture description. + * + * @param batchSize [IN] batch size + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppBatchPicDesc *acldvppCreateBatchPicDesc(uint32_t batchSize); + +/** + * @ingroup AscendCL + * @brief Get dvpp picture description. + * + * @param batchPicDesc [IN] dvpp batch picture description. + * @param index [IN] index of batch + * + * @retval null for failed. + * @retval OtherValues Failure + * + * @see acldvppCreateBatchPicDesc + */ +ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppGetPicDesc(acldvppBatchPicDesc *batchPicDesc, uint32_t index); + +/** + * @ingroup AscendCL + * @brief Destroy dvpp batch picture description. + * + * @par Function + * Can only destroy batch picture description information created + * through acldvppCreateBatchPicDesc interface. + * + * @param batchPicDesc [IN] dvpp batch picture description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateBatchPicDesc + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyBatchPicDesc(acldvppBatchPicDesc *batchPicDesc); + +/** + * @ingroup AscendCL + * @brief Create dvpp lut map. + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppLutMap *acldvppCreateLutMap(); + +/** + * @ingroup AscendCL + * @brief Destroy lut map. + * + * @param lutMap [IN] lut map + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyLutMap(acldvppLutMap *lutMap); + +/** + * @ingroup AscendCL + * @brief Get lut map dims. + * + * @param lutMap [IN] lut map + * + * @retval 0 for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap); + +/** + * @ingroup AscendCL + * @brief Get lut map data. + * + * @param lutMap [IN] lut map + * @param dim [IN] input dim of map + * @param data [OUT] the dim of lut map's data + * @param len [OUT] the dim of lut map's length + * + * @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, + uint32_t *len); +/** + * @ingroup AscendCL + * @brief Vpc equalize hist. + * + * @param channelDesc [IN] channel desc + * @param inputDesc [IN] input desc + * @param outputDesc [IN|OUT] output desc + * @param lutMap [IN] lut map param + * @param stream [IN] runtime stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc, + const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, + const acldvppLutMap *lutMap, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Create dvpp border config. + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig(); + +/** + * @ingroup AscendCL + * @brief Set value of border config. + * + * @param borderConfig [OUT] border config + * @param index [IN] index of value array + * @param value [IN] value + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, uint32_t index, + double value); + +/** + * @ingroup AscendCL + * @brief Set border type of border config. + * + * @param borderConfig [OUT] border config + * @param borderType [IN] border type + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBorderType(acldvppBorderConfig *borderConfig, + acldvppBorderType borderType); + +/** + * @ingroup AscendCL + * @brief Set top of border config. + * + * @param borderConfig [OUT] border config + * @param top [IN] top of border + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigTop(acldvppBorderConfig *borderConfig, uint32_t top); + +/** + * @ingroup AscendCL + * @brief Set bottom of border config. + * + * @param borderConfig [OUT] border config + * @param bottom [IN] bottom of border + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBottom(acldvppBorderConfig *borderConfig, uint32_t bottom); + +/** + * @ingroup AscendCL + * @brief Set left of border config. + * + * @param borderConfig [OUT] border config + * @param left [IN] left of border + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigLeft(acldvppBorderConfig *borderConfig, uint32_t left); + +/** + * @ingroup AscendCL + * @brief Set right of border config. + * + * @param borderConfig [OUT] border config + * @param right [IN] right of border + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigRight(acldvppBorderConfig *borderConfig, uint32_t right); + +/** + * @ingroup AscendCL + * @brief Get value of border config. + * + * @param borderConfig [IN] border config + * @param index[IN] index of value array + * + * @retval invalid value is < 0, normal Value is >= 0 + */ +ACL_FUNC_VISIBILITY double acldvppGetBorderConfigValue(const acldvppBorderConfig *borderConfig, uint32_t index); + +/** + * @ingroup AscendCL + * @brief Get border type of border config. + * + * @param borderConfig [IN] border config + * @retval border type of border config + */ +ACL_FUNC_VISIBILITY acldvppBorderType acldvppGetBorderConfigBorderType(const acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Get right of border config. + * + * @param borderConfig [IN] border config + * + * @retval default 0, top value of border config + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigTop(const acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Get Bottom of border config. + * + * @param borderConfig [IN] border config + * + * @retval default 0, top value of border config + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigBottom(const acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Get left of border config. + * + * @param borderConfig [IN] border config + * + * @retval default 0, top value of border config + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigLeft(const acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Get right of border config. + * + * @param borderConfig [IN] border config + * + * @retval default 0, right value of border config + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigRight(const acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Destroy border config. + * + * @param borderConfig [IN] border config + * + * @retval ACL_SUCCESS for success, other for failure + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *borderConfig); + +/** + * @ingroup AscendCL + * @brief Vpc make border. + * + * @param channelDesc [IN] channel desc + * @param inputDesc [IN] input desc + * @param outputDesc [IN|OUT] output desc + * @param borderConfig [IN] border config param + * @param stream [IN] runtime stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc, + const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, + const acldvppBorderConfig *borderConfig, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Dvpp vpc calc hist. + * + * @param channelDesc [IN] the channel destruction + * @param srcPicDesc [IN] pyr down input picture destruction + * @param hist [IN|OUT] pyr down output picture destruction + * @param reserve [IN] reserved param, must be nullptr + * @param stream [IN] task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist + */ +ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *srcPicDesc, + acldvppHist *hist, void *reserve, aclrtStream stream); + +/** + * @ingroup AscendCL + * @brief Create vpc hist description. + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY acldvppHist *acldvppCreateHist(); + +/** + * @ingroup AscendCL + * @brief Destroy vpc hist description. + * + * @par Function + * Can only destroy hist description information created + * through acldvppCreateHist interface. + * + * @param hist [IN] vpc hist description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateHist + */ +ACL_FUNC_VISIBILITY aclError acldvppDestroyHist(acldvppHist *hist); + +/** + * @ingroup AscendCL + * @brief Get dims of vpc hist description. + * + * @param hist [IN] vpc hist description. + * + * @retval dims of vpc hist description. + * + * @see acldvppCreateHist | acldvppVpcCalcHistAsync + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetHistDims(acldvppHist *hist); + +/** + * @ingroup AscendCL + * @brief Get data from vpc hist description by dim. + * + * @param hist [IN] vpc hist description. + * @param dim [IN] which dim to get data. + * @param data [OUT] address of output hist data. + * @param len [OUT] len of output hist data. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateHist | acldvppVpcCalcHistAsync + */ +ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, uint32_t **data, uint16_t *len); + +/** + * @ingroup AscendCL + * @brief Get dvpp calc hist process return code. + * + * @param hist [IN] vpc hist description. + * + * @retval Dvpp calc hist process return code. + * + * @see acldvppCreateHist | acldvppVpcCalcHistAsync + */ +ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist *hist); + +/** + * @ingroup AscendCL + * @brief Set vpc hist description to 0. + * + * @par Function + * Can only clear hist description information created + * through acldvppCreateHist interface. + * + * @param hist [IN] vpc hist description. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see acldvppCreateHist + */ +ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist); + +/** + * @ingroup AscendCL + * @brief dvpp vpc batch crop, resize config and make border. + * + * @par Function + * crop the input batch picture with resize config and border configs according to the specified area + * as the output batch pictures + * + * @param channelDesc [IN] the channel destruction + * @param srcBatchPicDescs [IN] crop input batch picture destruction + * @param roiNums [IN] roi config numbers + * @param size [IN] roiNum size + * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction + * @param cropAreas [IN] crop area configs + * @param borderCfgs [IN] border configs + * @param resizeConfig [IN] resize config + * @param stream [IN] crop batch, resize config and make border task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @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); + +#ifdef __cplusplus +} +#endif + +#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 new file mode 100644 index 00000000..4bd392c9 --- /dev/null +++ b/inc/external/acl/ops/acl_fv.h @@ -0,0 +1,348 @@ +/** + * 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 INC_EXTERNAL_ACL_OPS_ACL_RETR_H_ +#define INC_EXTERNAL_ACL_OPS_ACL_RETR_H_ + +#include "acl/acl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct aclfvInitPara aclfvInitPara; +typedef struct aclfvFeatureInfo aclfvFeatureInfo; +typedef struct aclfvRepoRange aclfvRepoRange; +typedef struct aclfvQueryTable aclfvQueryTable; +typedef struct aclfvSearchInput aclfvSearchInput; +typedef struct aclfvSearchResult aclfvSearchResult; + +// search operation type +enum aclfvSearchType { + SEARCH_1_N, // 1:N operation type + SEARCH_N_M // N:M operation type +}; + +/** + * @ingroup AscendCL + * @brief Create fv init param. + * + * @param fsNum [IN] The feature num + * + * @retval null for failed. + * @retval OtherValues success. + */ +ACL_FUNC_VISIBILITY aclfvInitPara *aclfvCreateInitPara(uint64_t fsNum); + +/** + * @ingroup AscendCL + * @brief Destroy fv init param. + * + * @par Function + * Can only destroy fv init param information created + * through aclfvCreateInitPara interface. + * + * @param initPara [IN] fv init param. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateInitPara + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroyInitPara(aclfvInitPara *initPara); + +/** + * @ingroup AscendCL + * @brief set value for maxTopNumFor1N which in fv init param. + * + * @param initPara [IN|OUT] fv init param. + * @param maxTopNumFor1N [IN] maxTopNumFor1N value for init param. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclfvSet1NTopNum(aclfvInitPara *initPara, uint32_t maxTopNumFor1N); + +/** + * @ingroup AscendCL + * @brief set value for maxTopNumForNM which in fv init param. + * + * @param initPara [IN|OUT] fv init param. + * @param maxTopNumForNM [IN] maxTopNumForNM value for init param. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + */ +ACL_FUNC_VISIBILITY aclError aclfvSetNMTopNum(aclfvInitPara *initPara, uint32_t maxTopNumForNM); + +/** + * @ingroup AscendCL + * @brief Create fv feature info. + * + * @param id0 [IN] The first level library id0 + * @param id1 [IN] Secondary library id1 + * @param offset [IN] The offset of the first feature in the library + * @param featureLen [IN] Single feature length + * @param featureCount [IN] Single feature count + * @param featureData [IN] Feature value list + * @param featureDataLen [IN] Feature value list length + * + * @retval null for failed. + * @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); + +/** + * @ingroup AscendCL + * @brief Destroy fv feature info. + * + * @par Function + * Can only destroy fv feature info information created + * through aclfvCreateFeatureInfo interface. + * + * @param featureInfo [IN] fv feature info. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateFeatureInfo + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroyFeatureInfo(aclfvFeatureInfo *featureInfo); + +/** + * @ingroup AscendCL + * @brief Create fv repo range. + * + * @param id0Min [IN] id0 start value + * @param id0Min [IN] id0 max + * @param id1Min [IN] id0 start value + * @param id1Max [IN] id1 max + * + * @retval null for failed. OtherValues success + */ +ACL_FUNC_VISIBILITY aclfvRepoRange *aclfvCreateRepoRange(uint32_t id0Min, uint32_t id0Max, uint32_t id1Min, + uint32_t id1Max); + +/** + * @ingroup AscendCL + * @brief Destroy fv repo range. + * + * @par Function + * Can only destroy fv repo range information created + * through aclfvCreateRepoRange interface. + * + * @param repoRange [IN] fv repo range. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateRepoRange + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroyRepoRange(aclfvRepoRange *repoRange); + +/** + * @ingroup AscendCL + * @brief Create query table. + * + * @param queryCnt [IN] Number of tables, the maximum number is 6 + * @param tableLen [IN] Single table length, table length is 32KB + * @param tableData [IN] Feature value list + * @param tableDataLen [IN] The length of memory requested by the featureData pointer + * + * @retval null for failed. OtherValues success + */ +ACL_FUNC_VISIBILITY aclfvQueryTable *aclfvCreateQueryTable(uint32_t queryCnt, uint32_t tableLen, uint8_t *tableData, + uint32_t tableDataLen); + +/** + * @ingroup AscendCL + * @brief Destroy query table. + * + * @par Function + * Can only destroy query table information created + * through aclfvCreateQueryTable interface. + * + * @param queryTable [IN] query table. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateQueryTable + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroyQueryTable(aclfvQueryTable *queryTable); + +/** + * @ingroup AscendCL + * @brief Create search input. + * + * @param queryTable [IN] query table + * @param repoRange [IN] query repo range + * @param topk [IN] query topk + * + * @retval null for failed. OtherValues success + */ +ACL_FUNC_VISIBILITY aclfvSearchInput *aclfvCreateSearchInput(aclfvQueryTable *queryTable, aclfvRepoRange *repoRange, + uint32_t topk); + +/** + * @ingroup AscendCL + * @brief Destroy search input. + * + * @par Function + * Can only destroy search input information created + * through aclfvCreateSearchInput interface. + * + * @param searchInput [IN] search input. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateSearchInput + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroySearchInput(aclfvSearchInput *searchInput); + +/** + * @ingroup AscendCL + * @brief Create search result. + * + * @param queryCnt [IN] Retrieve the number of features + * @param resultNum [IN] The number of search results for each feature, the number is queryCnt + * @param resultNumDataLen [IN] resultNum memory length + * @param id0 [IN] Level 1 library id0 + * @param id1 [IN] Secondary library id1 + * @param resultOffset [IN] The offset of the bottom library corresponding + * to each feature retrieval result, total length topK * queryCnt + * @param resultDistance [IN] Distance, total length topK * queryCnt + * @param dataLen [IN] The memory size requested by + * id0\id1\reslutOffset\resultDistance + * + * @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); + +/** + * @ingroup AscendCL + * @brief Destroy search result. + * + * @par Function + * Can only destroy search result information created + * through aclfvCreateSearchResult interface. + * + * @param searchResult [IN] search result. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclfvCreateSearchResult + */ +ACL_FUNC_VISIBILITY aclError aclfvDestroySearchResult(aclfvSearchResult *searchResult); + +/** + * @ingroup AscendCL + * @brief fv IP initialize. + * + * @param initPara [IN] fv init param. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvInit(aclfvInitPara *initPara); + +/** + * @ingroup AscendCL + * @brief release fv resources. + * + * @par Function + * Can only release fv resources created + * through aclfvInit interface. + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + * + * @see aclfvInit + */ +ACL_FUNC_VISIBILITY aclError aclfvRelease(); + +/** + * @ingroup AscendCL + * @brief fv repo add. + * + * @param type [IN] repo add type + * @param featureInfo [IN] add feature information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvRepoAdd(aclfvSearchType type, aclfvFeatureInfo *featureInfo); + +/** + * @ingroup AscendCL + * @brief fv repo del. + * + * @param type [IN] repo delete type + * @param repoRange [IN] repo range information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvRepoDel(aclfvSearchType type, aclfvRepoRange *repoRange); + +/** + * @ingroup AscendCL + * @brief fv accurate del. + * + * @param featureInfo [IN] accurate delete feature information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvDel(aclfvFeatureInfo *featureInfo); + +/** + * @ingroup AscendCL + * @brief fv accurate modify. + * + * @param featureInfo [IN] accurate modify feature information + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvModify(aclfvFeatureInfo *featureInfo); + +/** + * @ingroup AscendCL + * @brief fv search. + * + * @param type [IN] search type + * @param searchInput [IN] search input + * @param searchRst [OUT] search result + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure. + */ +ACL_FUNC_VISIBILITY aclError aclfvSearch(aclfvSearchType type, aclfvSearchInput *searchInput, + aclfvSearchResult *searchRst); + +#ifdef __cplusplus +} +#endif + +#endif // INC_EXTERNAL_ACL_OPS_ACL_RETR_H_ diff --git a/inc/external/hccl/hccl.h b/inc/external/hccl/hccl.h new file mode 100644 index 00000000..8261adc4 --- /dev/null +++ b/inc/external/hccl/hccl.h @@ -0,0 +1,159 @@ +/** + * 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. + */ + +/** + * @file hccl.h + * @brief HCCL API + */ + +#ifndef HCCL_H_ +#define HCCL_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * @brief Initialize HCCL. + * + * @param clusterInfo A string identifying the cluster info file path, include file name. + * @param rank A integer identifying the identify for the rank. + * @param comm A pointer identifying the initialized communication resource. + * @return HcclResult + * @see HcclCommDestroy() + */ +extern HcclResult HcclCommInitClusterInfo(const char *clusterInfo, uint32_t rank, HcclComm *comm); + +/** + * @brief Get hccl root info. + * + * @param rootInfo A pointer identifying the hccl root info. + * @return HcclResult + */ +extern HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo); + +/** + * @brief Initialize HCCL with root info. + * + * @param nRanks A integer identifying the rank size of the cluster. + * @param rootInfo A struct identifying the hccl root info. + * @param rank A integer identifying the identify for the rank. + * @param comm A pointer identifying the initialized communication resource. + * @return HcclResult + * @see HcclCommDestroy() + */ +extern HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *rootInfo, uint32_t rank, HcclComm *comm); + +/** + * @brief AllReduce operator. + * + * @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 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 + */ +extern HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op, + HcclComm comm, aclrtStream stream); + +/** + * @brief Broadcast operator. + * + * @param buf A pointer identifying the data address of the operator. + * @param count An integer(u64) identifying the number of the data. + * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. + * @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 + */ +extern HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm, + aclrtStream stream); + +/** + * @brief ReduceScatter operator. + * + * @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 recvCount 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, 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 + */ +extern HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType, + HcclReduceOp op, HcclComm comm, aclrtStream stream); + +/** + * @brief AllGather operator. + * + * @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 sendCount An integer(u64) identifying the number of the input data. + * @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 + */ +extern HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm, + aclrtStream stream); +/** + * @brief Get the rank size of this comm. + * + * @param comm A pointer identifying the communication resource based on. + * @param rankSize A pointer identifying the rank size. + * @return HcclResult + */ +extern HcclResult HcclGetRankSize(HcclComm comm, uint32_t *rankSize); + +/** + * @brief Get the rank id of this comm. + * + * @param comm A pointer identifying the communication resource based on. + * @param rankSize A pointer identifying the rank id. + * @return HcclResult + */ +extern HcclResult HcclGetRankId(HcclComm comm, uint32_t *rank); +/** + * @brief Barrier operator. + * + * @param comm A pointer identifying the communication resource based on. + * @param stream A pointer identifying the stream information. + * @return HcclResult + */ +extern HcclResult HcclBarrier(HcclComm comm, aclrtStream stream); + +/** + * @brief Destroy HCCL comm + * + * @param comm A pointer identifying the communication resource targetting + * @return HcclResult + * @see HcclCommInitClusterInfo() + */ +extern HcclResult HcclCommDestroy(HcclComm comm); + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // HCCL_H_ diff --git a/inc/external/hccl/hccl_types.h b/inc/external/hccl/hccl_types.h new file mode 100644 index 00000000..0e832396 --- /dev/null +++ b/inc/external/hccl/hccl_types.h @@ -0,0 +1,101 @@ +/** + * 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. + */ + +/** + * @file hccl_types.h + * @brief HCCL data type definition + * + */ + +#ifndef HCCL_TYPES_H_ +#define HCCL_TYPES_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#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 */ +} HcclResult; + +/** + * @brief handle to HCCL communicator + */ +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 */ +} 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 */ +} HcclDataType; + +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]; +} HcclRootInfo; + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // HCCL_TYPES_H_ diff --git a/inc/external/runtime/rt_error_codes.h b/inc/external/runtime/rt_error_codes.h new file mode 100644 index 00000000..a1392cc6 --- /dev/null +++ b/inc/external/runtime/rt_error_codes.h @@ -0,0 +1,109 @@ +/** + * 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 __INC_EXTERNEL_RT_ERROR_CODES_H__ +#define __INC_EXTERNEL_RT_ERROR_CODES_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +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_WAIT_TIMEOUT = 107019; // wait timeout + +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_NO_CDQ_RESOURCE = 207011; // no cdq 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_VECTOR_CORE_TIMEOUT = 507034; // vector core timeout +static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception +static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception +static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal + +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__ diff --git a/inc/framework/ge_runtime/task_info.h b/inc/framework/ge_runtime/task_info.h index f59c6454..4530bff7 100644 --- a/inc/framework/ge_runtime/task_info.h +++ b/inc/framework/ge_runtime/task_info.h @@ -271,13 +271,14 @@ class FusionEndTaskInfo : public TaskInfo { class HcclTaskInfo : public TaskInfo { public: HcclTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string hccl_type, void *input_data_addr, - void *output_data_addr, int64_t workspace_size, int64_t hccl_stream_num, + void *output_data_addr, void *workspace_addr, int64_t workspace_size, int64_t hccl_stream_num, const std::vector &private_def, void *ops_kernel_store, int32_t count, int64_t root_id, int64_t op_type, int64_t data_type, const std::string &group, bool dump_flag) : TaskInfo(op_name, stream_id, TaskInfoType::HCCL, dump_flag), hccl_type_(hccl_type), input_data_addr_(input_data_addr), output_data_addr_(output_data_addr), + workspace_addr_(workspace_addr), workspace_size_(workspace_size), hccl_stream_num_(hccl_stream_num), private_def_(private_def), @@ -292,6 +293,7 @@ class HcclTaskInfo : public TaskInfo { const std::string &hccl_type() const { return hccl_type_; } void *input_data_addr() const { return input_data_addr_; } void *output_data_addr() const { return output_data_addr_; } + void *workspace_addr() const { return workspace_addr_; } int64_t workspace_size() const { return workspace_size_; } int64_t hccl_stream_num() const { return hccl_stream_num_; } const std::vector &private_def() const { return private_def_; } @@ -306,6 +308,7 @@ class HcclTaskInfo : public TaskInfo { std::string hccl_type_; void *input_data_addr_; void *output_data_addr_; + void *workspace_addr_; int64_t workspace_size_; int64_t hccl_stream_num_; std::vector private_def_; diff --git a/metadef b/metadef index a725349b..21178899 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit a725349b65aef2940555af2ddb7b9461fbe0d5fd +Subproject commit 211788997dcc9aa63527541a44d511388c06bce5 diff --git a/scripts/format_source_code.sh b/scripts/format_source_code.sh new file mode 100755 index 00000000..1fd0b4f6 --- /dev/null +++ b/scripts/format_source_code.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# 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. +# ============================================================================ + +set -e + +CLANG_FORMAT=$(which clang-format) || (echo "Please install 'clang-format' tool first"; exit 1) + +version=$("${CLANG_FORMAT}" --version | sed -n "s/.*\ \([0-9]*\)\.[0-9]*\.[0-9]*.*/\1/p") +if [[ "${version}" -lt "8" ]]; then + echo "clang-format's version must be at least 8.0.0" + exit 1 +fi + +CURRENT_PATH=$(pwd) +SCRIPTS_PATH=$(dirname "$0") + +echo "CURRENT_PATH=${CURRENT_PATH}" +echo "SCRIPTS_PATH=${SCRIPTS_PATH}" + +# print usage message +function usage() +{ + echo "Format the specified source files to conform the code style." + echo "Usage:" + echo "bash $0 [-a] [-c] [-l] [-h]" + echo "e.g. $0 -c" + echo "" + echo "Options:" + echo " -a format of all files" + echo " -c format of the files changed compared to last commit, default case" + echo " -l format of the files changed in last commit" + echo " -h Print usage" +} + +# check and set options +function checkopts() +{ + # init variable + mode="changed" # default format changed files + + # Process the options + while getopts 'aclh' opt + do + case "${opt}" in + a) + mode="all" + ;; + c) + mode="changed" + ;; + l) + mode="lastcommit" + ;; + h) + usage + exit 0 + ;; + *) + echo "Unknown option ${opt}!" + usage + exit 1 + esac + done +} + +# init variable +# check options +checkopts "$@" + +# switch to project root path, which contains clang-format config file '.clang-format' +cd "${SCRIPTS_PATH}/.." || exit 1 + +FMT_FILE_LIST='__format_files_list__' + +if [[ "X${mode}" == "Xall" ]]; then + find src -type f -name "*" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true + find inc -type f -name "*" | grep "\.h$\|\.cc$" >> "${FMT_FILE_LIST}" || true +elif [[ "X${mode}" == "Xchanged" ]]; then + # --diff-filter=ACMRTUXB will ignore deleted files in commit + git diff --diff-filter=ACMRTUXB --name-only | grep "^inc\|^src" | grep "\.h$\|\.cc$" >> "${FMT_FILE_LIST}" || true +else # "X${mode}" == "Xlastcommit" + git diff --diff-filter=ACMRTUXB --name-only HEAD~ HEAD | grep "^inc\|^src" | grep "\.h$\|\.cc$" > "${FMT_FILE_LIST}" || true +fi + +while read line; do + if [ -f "${line}" ]; then + ${CLANG_FORMAT} -i "${line}" + fi +done < "${FMT_FILE_LIST}" + +rm "${FMT_FILE_LIST}" +cd "${CURRENT_PATH}" || exit 1 + +echo "Specified cpp source files have been format successfully." diff --git a/third_party/fwkacllib/inc/cce/taskdown_common.hpp b/third_party/fwkacllib/inc/cce/taskdown_common.hpp index 3ecea523..7954162e 100644 --- a/third_party/fwkacllib/inc/cce/taskdown_common.hpp +++ b/third_party/fwkacllib/inc/cce/taskdown_common.hpp @@ -27,15 +27,16 @@ namespace cce { #define CC_FUSION_OP_MAX 32 typedef enum tagccKernelType { - CCE_AI_CORE = 0, /* cce aicore */ - CCE_AI_CPU = 1, /* cce aicpu */ - TE = 2, /* te operator*/ - CUSTOMIZED = 3, /* customized operator */ - TE_AI_CORE = 4, /* te aicore operator*/ - TE_AI_CPU = 5, /* te aicpu operator */ - AI_CPU = 6, /* aicpu */ - CUST_AI_CPU = 7, /* custom aicpu*/ - INVALID = 8, /* unknown kernel type */ + CCE_AI_CORE = 0, /* cce aicore */ + CCE_AI_CPU = 1, /* cce aicpu */ + TE = 2, /* te operator*/ + CUSTOMIZED = 3, /* customized operator */ + TE_AI_CORE = 4, /* te aicore operator*/ + TE_AI_CPU = 5, /* te aicpu operator */ + AI_CPU = 6, /* aicpu */ + CUST_AI_CPU = 7, /* custom aicpu*/ + HOST_CPU = 8, /* host cpu */ + INVALID = 10000 /* unknown kernel type */ } ccKernelType; typedef struct tagOpContext { diff --git a/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h b/third_party/fwkacllib/inc/external/runtime/rt_error_codes.h old mode 100755 new mode 100644 diff --git a/third_party/fwkacllib/inc/hccl/base.h b/third_party/fwkacllib/inc/hccl/base.h index e57563b3..ffbf552b 100644 --- a/third_party/fwkacllib/inc/hccl/base.h +++ b/third_party/fwkacllib/inc/hccl/base.h @@ -124,27 +124,27 @@ struct HcomRemoteAccessAddrInfo { }; struct HcomAllToAllVParams { - void *sendbuf; - void *sendcounts; - void *sdispls; - HcclDataType sendtype; - void *recvbuf; - void *recvcounts; - void *rdispls; - HcclDataType recvtype; - const char *group; + void *sendbuf; // device mem + void *sendcounts; // device mem; Type: uint_64 + void *sdispls; // device mem; Type: uint_64 + HcclDataType sendtype; + void *recvbuf; // device mem + void *recvcounts; // device mem; Type: uint_64 + void *rdispls; // device mem; Type: uint_64 + HcclDataType recvtype; + const char *group; // not used now }; struct HcomGatherAllToAllVParams { - void *addrInfo; - void *addrInfoCountPerRank; - void *recvbuf; - void *recvcounts; - void *rdispls; - void *gatheredbuf; - s32 addrLength; - HcclDataType recvtype; - const char *group; + void *addrInfo; // device mem; contains host VA[uint_64]: [addr, length, addr, length, addr, length, ...] + void *addrInfoCountPerRank; // device mem; length: ranksize; contains addrInfoCounts for every rank + void *recvbuf; // device mem + void *recvcounts; // device mem; Type: uint_64 + void *rdispls; // device mem; Type: uint_64 + void *gatheredbuf; // device mem + s32 addrLength; + HcclDataType recvtype; + const char *group; // not used now }; #ifdef __cplusplus diff --git a/third_party/fwkacllib/inc/hccl/hccl_types.h b/third_party/fwkacllib/inc/hccl/hccl_types.h deleted file mode 100644 index 50a64795..00000000 --- a/third_party/fwkacllib/inc/hccl/hccl_types.h +++ /dev/null @@ -1,101 +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. - */ - -/** - * @file hccl_types.h - * @brief HCCL data type definition - * - */ - -#ifndef HCCL_TYPES_H_ -#define HCCL_TYPES_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#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 */ -} HcclResult; - -/** - * @brief handle to HCCL communicator - */ -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 */ -} 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 */ -} HcclDataType; - -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]; -} HcclRootInfo; - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // HCCL_TYPES_H_ diff --git a/third_party/fwkacllib/inc/hccl/hcom.h b/third_party/fwkacllib/inc/hccl/hcom.h index 955764d6..bf1f395b 100644 --- a/third_party/fwkacllib/inc/hccl/hcom.h +++ b/third_party/fwkacllib/inc/hccl/hcom.h @@ -164,8 +164,22 @@ HcclResult HcomExecEnqueueRemoteAccess(const std::string& remoteAccessType, const std::vector& addrInfos, std::function callback); +/** + * @brief Put alltoallv communication operation into hcom executor. + * + * @param params information about alltoallv communication operation. + * @param callback callback after collective communication operation. + * @return HcclResult + */ HcclResult HcomExecEnqueueAllToAllV(HcomAllToAllVParams params, std::function callback); +/** + * @brief Put agther alltoallv communication operation into hcom executor. + * + * @param params information about agther alltoallv communication operation. + * @param callback callback after collective communication operation. + * @return HcclResult + */ HcclResult HcomExecEnqueueGatherAllToAllV(HcomGatherAllToAllVParams params, std::function callback); diff --git a/third_party/fwkacllib/inc/mmpa/mmpa_api.h b/third_party/fwkacllib/inc/mmpa/mmpa_api.h index 38a689ee..f8d5ccf3 100644 --- a/third_party/fwkacllib/inc/mmpa/mmpa_api.h +++ b/third_party/fwkacllib/inc/mmpa/mmpa_api.h @@ -56,6 +56,7 @@ #include #include #include +#include #include #include diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h index 993f36ba..3d196e41 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h @@ -550,6 +550,10 @@ MMPA_FUNC_VISIBILITY mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMod MMPA_FUNC_VISIBILITY INT32 mmShmUnlink(const CHAR *name); MMPA_FUNC_VISIBILITY VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); MMPA_FUNC_VISIBILITY INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); + +MMPA_FUNC_VISIBILITY mmSize mmGetPageSize(); +MMPA_FUNC_VISIBILITY VOID *mmAlignMalloc(mmSize mallocSize, mmSize alignSize); +MMPA_FUNC_VISIBILITY VOID mmAlignFree(VOID *addr); #define MMPA_DLL_API #ifdef __cplusplus diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h index 49e97a5d..e6b6f71e 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h @@ -557,6 +557,10 @@ MMPA_FUNC_VISIBILITY mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMod MMPA_FUNC_VISIBILITY INT32 mmShmUnlink(const CHAR *name); MMPA_FUNC_VISIBILITY VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); MMPA_FUNC_VISIBILITY INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); + +MMPA_FUNC_VISIBILITY mmSize mmGetPageSize(); +MMPA_FUNC_VISIBILITY VOID *mmAlignMalloc(mmSize mallocSize, mmSize alignSize); +MMPA_FUNC_VISIBILITY VOID mmAlignFree(VOID *addr); #ifdef __cplusplus #if __cplusplus } diff --git a/third_party/fwkacllib/inc/ops/aipp.h b/third_party/fwkacllib/inc/ops/aipp.h index bed984bd..86805f72 100644 --- a/third_party/fwkacllib/inc/ops/aipp.h +++ b/third_party/fwkacllib/inc/ops/aipp.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -65,6 +65,8 @@ in aipp config file, framework will auto add one input node to graph at last. \n *@par Third-party framework compatibility *Compatible with the TensorFlow operator AippData. +*@par Restrictions: +*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. */ REG_OP(AippData) .INPUT(data, TensorType::ALL()) diff --git a/third_party/fwkacllib/inc/ops/all_ops.h b/third_party/fwkacllib/inc/ops/all_ops.h index 1ac83783..cc11f5f9 100644 --- a/third_party/fwkacllib/inc/ops/all_ops.h +++ b/third_party/fwkacllib/inc/ops/all_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -39,6 +39,7 @@ #include "image_ops.h" #include "internal_ops.h" #include "linalg_ops.h" +#include "list_ops.h" #include "logging_ops.h" #include "lookup_ops.h" #include "math_ops.h" diff --git a/third_party/fwkacllib/inc/ops/array_ops.h b/third_party/fwkacllib/inc/ops/array_ops.h index e1f64421..fd35b546 100644 --- a/third_party/fwkacllib/inc/ops/array_ops.h +++ b/third_party/fwkacllib/inc/ops/array_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -626,7 +626,7 @@ REG_OP(StopGradient) *x: A tensor. \n *@par Outputs: -*y: A tensor. \n +*y: A tensor with the same shape and contents as input. \n *@par Third-party framework compatibility *Compatible with the TensorFlow operator Identity. @@ -666,7 +666,7 @@ REG_OP(IdentityN) *@li axis: The dimension index at which to expand. \n *@par Outputs: -*y: A tensor. \n +*y: A tensor with the same data as input, with an additional dimension inserted at the index specified by axis. \n *@par Third-party framework compatibility *Compatible with the TensorFlow operator ExpandDims. @@ -713,7 +713,7 @@ REG_OP(Unsqueeze) *@par Outputs: *y: A tensor. \n -*@par Attention: +*@attention Constraints: *This operator cannot be directly called by the acllopExecute API. \n *@par Third-party framework compatibility @@ -1153,6 +1153,102 @@ REG_OP(EditDistance) .OUTPUT(output, TensorType({DT_FLOAT})) .OP_END_FACTORY_REG(EditDistance) +/** +* @brief sort_v2. + +* @par Inputs: +* @li x: An ND tensor of type float16. + +* @par Attributes: + +* @li axis: An optional int. The dimension to sort along. This value defaults to -1. +* @li descending: An optional bool. Controls the sorting order (ascending or descending). This value defaults to False. + +* @par Outputs: +* @li y: An ND tensor of type float16. + +* @attention Constraints: +* @li Axis should select the last dim. +* @li When the sorting data is less than 150K, it is recommended to use this tbe ops, + and the descending performance is better than the ascending. +* @li The upper limit of data on Ascend910 is 2000K. +*/ +REG_OP(SortV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .ATTR(axis, Int, -1) + .ATTR(descending, Bool, false) + .OP_END_FACTORY_REG(SortV2) + +/** +* @brief Expand the input tensor to a compatible shape. \n + +* @par Inputs: +* One inputs, including: +* @li x: A Tensor. Must be one of the following types: +* float16, float32, int32, int8 ,uint8. \n +* @li shape: A Tensor to specify the shape that the input tensor expanded to. \n + +* @par Outputs: +* @li y: A Tensor. Has the same type as "x", and the shape specified by input and attr shape \n + +* @par Third-party framework compatibility +* Compatible with the ONNX operator Expand. +*/ + +REG_OP(Expand) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .INPUT(shape, TensorType({DT_INT16, DT_INT32, DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .OP_END_FACTORY_REG(Expand) + +/** +*@Returns a tensor containing the indices of all non-zero elements of input. \n + +*@par Inputs: +*@li x: A Tensor. Must be one of the following types: float16, float32, int32, int64. + +*@par Attributes: +* transpose: the output tensor will be transposed if true. \n + +*@par Outputs: +* y: A Tensor. Has the same type as "x" . \n + +*@par Third-party framework compatibility +*Compatible with the PyTorch operator NonZero. +*/ + +REG_OP(NonZero) + .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT16, \ + DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64, DT_BOOL})) + .OUTPUT(y, TensorType({DT_INT64})) + .ATTR(transpose, Bool, false) + .OP_END_FACTORY_REG(NonZero) + +/** +* @brief Expand the input tensor to a compatible shape. \n + +* @par Inputs: +* One inputs, including: +* @li x: A Tensor. Must be one of the following types: +* float16, float32, int32, int8 ,uint8. \n + +* @par Attributes: +* @li shape: A required listInt to specify the shape that the input tensor expanded to. \n + + +* @par Outputs: +* @li y: A Tensor. Has the same type as "x", and the shape specified by input and attr shape \n + +* @par Third-party framework compatibility +* Compatible with the ONNX operator Expand. +*/ + +REG_OP(ExpandD) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .REQUIRED_ATTR(shape, ListInt) + .OP_END_FACTORY_REG(ExpandD) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_ARRAY_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/audio_ops.h b/third_party/fwkacllib/inc/ops/audio_ops.h index d9883253..f05135d1 100644 --- a/third_party/fwkacllib/inc/ops/audio_ops.h +++ b/third_party/fwkacllib/inc/ops/audio_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h b/third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h new file mode 100644 index 00000000..d0800a08 --- /dev/null +++ b/third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h @@ -0,0 +1,58 @@ +/** + * Copyright 2019 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. + */ + +/*! + * \file avg_pool_1d_ops.h + * \brief + */ +#ifndef OPS_BUILT_IN_OP_PROTO_INC_AVGPOOL1DOPS_H_ +#define OPS_BUILT_IN_OP_PROTO_INC_AVGPOOL1DOPS_H_ +#include "graph/operator_reg.h" + +namespace ge { +/** +*@brief Generate an auxiliary matrix . \n + +*@par Inputs: +* @li x: A tensor. Must be one of the following types:uint8, int8,int16, int32, + int64, float16, float, double.The format must be NHWC NCHW NC1HWC0. + +*@par Attributes: +*@li ksize: Kernel size. Input type is int. +*@li strides: Input type is int. +*@li pads: Input type is listInt . +*@li ceil_mode: Bool, default value is false. +*@li count_include_pad: Bool, default value is false. \n + +*@par Outputs: +*y_tensor: A tensor with the same types as "x" . \n +*@par Third-party framework compatibility + +*Compatible with the TensorFlow operator Unbatch. +*/ +REG_OP(AvgPool1DAvgMatrix) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT16, DT_UINT8, + DT_INT32, DT_INT64, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT16, DT_UINT8, + DT_INT32, DT_INT64, DT_DOUBLE})) + .REQUIRED_ATTR(ksize, Int) + .REQUIRED_ATTR(strides, Int) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(ceil_mode, Bool, false) + .ATTR(count_include_pad, Bool, false) + .OP_END_FACTORY_REG(AvgPool1DAvgMatrix) +} +#endif \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/batch_ops.h b/third_party/fwkacllib/inc/ops/batch_ops.h index 8a1c5a7b..ca4fe1db 100644 --- a/third_party/fwkacllib/inc/ops/batch_ops.h +++ b/third_party/fwkacllib/inc/ops/batch_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -64,10 +64,10 @@ the same types as "x_tensors" . It's a dynamic output. \n REG_OP(Batch) .DYNAMIC_INPUT(x_tensors, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, \ DT_INT16, DT_UINT16, DT_UINT8, DT_INT32, DT_INT64, DT_BOOL, DT_DOUBLE})) - .OUTPUT(y_index, TensorType({ DT_INT64 })) - .OUTPUT(y_id, TensorType({ DT_INT64 })) .DYNAMIC_OUTPUT(y_tensors, TensorType({DT_INT8, DT_UINT8, DT_INT16, \ DT_UINT16, DT_INT32, DT_INT64, DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_BOOL})) + .OUTPUT(y_index, TensorType({ DT_INT64 })) + .OUTPUT(y_id, TensorType({ DT_INT64 })) .REQUIRED_ATTR(num_batch_threads, Int) .REQUIRED_ATTR(max_batch_size, Int) .ATTR(max_enqueued_batches, Int, 10) @@ -107,11 +107,13 @@ across multiple sessions . \n REG_OP(Unbatch) .INPUT(x_tensor, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \ - DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE})) + DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_FLOAT16, \ + DT_COMPLEX64, DT_COMPLEX128})) .INPUT(index, TensorType({DT_INT64})) .INPUT(id, TensorType({DT_INT64})) .OUTPUT(y_tensor, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \ - DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE})) + DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_FLOAT16, \ + DT_COMPLEX64, DT_COMPLEX128})) .REQUIRED_ATTR(timeout_micros, Int) .ATTR(container, String, "") .ATTR(shared_name, String, "") @@ -146,13 +148,16 @@ across multiple sessions . \n REG_OP(UnbatchGrad) .INPUT(x_input, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \ - DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE})) + DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_FLOAT16, \ + DT_COMPLEX64, DT_COMPLEX128})) .INPUT(index, TensorType({DT_INT64})) .INPUT(grad, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \ - DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE})) + DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_FLOAT16, \ + DT_COMPLEX64, DT_COMPLEX128})) .INPUT(id, TensorType({DT_INT64})) .OUTPUT(y_grad, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, \ - DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE})) + DT_INT32, DT_INT64, DT_BOOL, DT_FLOAT, DT_DOUBLE, DT_FLOAT16, \ + DT_COMPLEX64, DT_COMPLEX128})) .ATTR(container, String, "") .ATTR(shared_name, String, "") .OP_END_FACTORY_REG(UnbatchGrad) diff --git a/third_party/fwkacllib/inc/ops/bitwise_ops.h b/third_party/fwkacllib/inc/ops/bitwise_ops.h index 5c83e161..dac78118 100644 --- a/third_party/fwkacllib/inc/ops/bitwise_ops.h +++ b/third_party/fwkacllib/inc/ops/bitwise_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -26,6 +26,35 @@ namespace ge { /** +*@brief Element-wise computes the bitwise left-shift of x and y . \n + +*@par Inputs: +*Input "x" is a k-dimensional tensor. Inputs "num_lower" and "num_upper" +are 0D scalars. +* @li x: A Tensor. Must be one of the following types: int8, int16, int32, +int64, uint8, uint16, uint32, uint64. +* @li y: A Tensor. Has the same type as "x". \n + +*@par Outputs: +* z: A Tensor. Has the same type as "x". \n + +*@attention Constraints: +*Unique runs on the Ascend AI CPU, which delivers poor performance. \n + +*@par Third-party framework compatibility +*Compatible with the TensorFlow operator LeftShift. +*/ + +REG_OP(LeftShift) + .INPUT(x, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, \ + DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64})) + .INPUT(y, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, \ + DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64})) + .OUTPUT(z, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, \ + DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64})) + .OP_END_FACTORY_REG(LeftShift) + +/** *@brief Element-wise computes the bitwise right-shift of x and y . \n *@par Inputs: diff --git a/third_party/fwkacllib/inc/ops/boosted_trees_ops.h b/third_party/fwkacllib/inc/ops/boosted_trees_ops.h index 550e8b7d..08e54824 100644 --- a/third_party/fwkacllib/inc/ops/boosted_trees_ops.h +++ b/third_party/fwkacllib/inc/ops/boosted_trees_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h b/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h index e20607bf..890c52ae 100644 --- a/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h +++ b/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/condtake_ops.h b/third_party/fwkacllib/inc/ops/condtake_ops.h index 5e91eb07..029cffbf 100644 --- a/third_party/fwkacllib/inc/ops/condtake_ops.h +++ b/third_party/fwkacllib/inc/ops/condtake_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/control_flow_ops.h b/third_party/fwkacllib/inc/ops/control_flow_ops.h index 7196b14f..e5bd3534 100644 --- a/third_party/fwkacllib/inc/ops/control_flow_ops.h +++ b/third_party/fwkacllib/inc/ops/control_flow_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -96,7 +96,7 @@ REG_OP(RefMerge) * Otherwise, the data is forwarded to "output_false" . \n *@par Inputs: - *@li data: The tensor to be forwarded. \ n + *@li data: The tensor to be forwarded. \n * Must be one of the following types: float16, float32, float64, * int8, int16, int32, int64, uint8, uint16, uint32, uint64, bool. *@li pred: A boolean scalar. The output port that will receive data . \n @@ -387,12 +387,12 @@ REG_OP(ControlTrigger) *@par Inputs: * Three inputs, including: -*@li x: One dimensional tensore of type int32, specifying queried shape, max size is 8. -*@li data_seq: One dimensional tensore of type int32, specifying the mapped table is queried. -*@li level_index: One dimensional tensore of type int32, specifying secondary index. \n +*@li x: One dimensional tensor of type int32, specifying queried shape, max size is 128. +*@li data_seq: One dimensional tensor of type int32, specifying the mapped table is queried. +*@li level_index: One dimensional tensor of type int32, specifying secondary index. \n *@par Outputs: -*@li y: A Tensor with shape [batch, 8], of type int32, specifying index of shape in the map. +*@li y: A Tensor with shape [8], of type int32, specifying index of shape in the map. *@par Third-party framework compatibility * It is a custom operator. It has no corresponding operator in Caffe. */ diff --git a/third_party/fwkacllib/inc/ops/correlation.h b/third_party/fwkacllib/inc/ops/correlation.h new file mode 100644 index 00000000..caebba50 --- /dev/null +++ b/third_party/fwkacllib/inc/ops/correlation.h @@ -0,0 +1,52 @@ +/** + * Copyright 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. + */ + +/*! + * \file correlation.h + * \brief + */ +#ifndef GE_OP_CORRELATION_OPS_H +#define GE_OP_CORRELATION_OPS_H + +#include "graph/operator_reg.h" + +namespace ge { +/** +*@brief Computes a 2D Correlation given 4D "x" and "filter" tensors. +* +*@par Inputs: +* @li filter: A 4D tensor of filters. +* @li x: A 4D tensor of input images, batch number must equal to batch +* number of "filter", and channel must equal to channel of "filter". +* +*@par Attributes: +* @li groups: set correlation mode, must be 1 or channel. +* +*@par Outputs: +*y: A Tensor. Has the same type as "x". + +*@par Third-party framework compatibility +* Compatible with caffe correlation custom operator. +*/ +REG_OP(Correlation) + .INPUT(filter, TensorType({DT_FLOAT16, DT_INT8})) + .INPUT(x, TensorType({DT_FLOAT16, DT_INT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_INT32})) + .ATTR(groups, Int, 1) + .OP_END_FACTORY_REG(Correlation) +} // namespace ge + +#endif // GE_OP_NN_CALCULATION_OPS_H diff --git a/third_party/fwkacllib/inc/ops/ctc_ops.h b/third_party/fwkacllib/inc/ops/ctc_ops.h index 2c75fd09..e907b828 100644 --- a/third_party/fwkacllib/inc/ops/ctc_ops.h +++ b/third_party/fwkacllib/inc/ops/ctc_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -137,6 +137,87 @@ REG_OP(CTCBeamSearchDecoder) .OUTPUT(log_probability, TensorType({DT_FLOAT, DT_DOUBLE})) .OP_END_FACTORY_REG(CTCBeamSearchDecoder) +/** +*@brief The Connectionist Temporal Classification loss. + +*@par Inputs: +*@li log_probs: Tensor of size (T, N, C), where T =input length, N =batch size, + and C = number of classes (including blank). + It represent the logarithmized probabilities of the outputs. +*@li targets: Tensor of size (N, S), where S= max target length. + It represent the target sequences. +*@li input_lengths: Tuple or tensor of size (N). It represent the lengths of the inputs. +*@li target_lengths: Tuple or tensor of size (N). It represent lengths of the targets. + +*@par Outputs: +*@li neg_log_likelihood: A loss value which is differentiable with respect to each input node. +*@li log_alpha: The probability of possible trace of input to target. + +*@par Attributes: +*@li blank : Blank label. Default 0. +*@li reduction: Specifies the reduction to apply to the output. Default: 'mean'. +*@li zero_infinity : Whether to zero infinite losses and the associated gradients. + +*@par Third-party framework compatibility +* Compatible with Pytorch CTCLoss operator. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(CTCLossV2) + .INPUT(log_probs, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(targets, TensorType({DT_INT32, DT_INT64})) + .INPUT(input_lengths, TensorType({DT_INT32, DT_INT64})) + .INPUT(target_lengths, TensorType({DT_INT32, DT_INT64})) + .OUTPUT(neg_log_likelihood, TensorType({DT_FLOAT, DT_DOUBLE})) + .OUTPUT(log_alpha, TensorType({DT_FLOAT, DT_DOUBLE})) + .ATTR(blank, Int, 0) + .ATTR(reduction, String, "mean") + .ATTR(zero_infinity, Bool, false) + .OP_END_FACTORY_REG(CTCLossV2) + +/** +*@brief The Connectionist Temporal Classification loss grad. + +*@par Inputs: +*@li grad_out: Gradient renewal coefficient. Tensor of size (N), where N = batch size. +*@li log_probs: Tensor of size (T, N, C), where T =input length, N =batch size, + and C = number of classes (including blank). + It represent the logarithmized probabilities of the outputs. +*@li targets: Tensor of size (N, S), where S= max target length. + It represent the target sequences. +*@li input_lengths: Tuple or tensor of size (N). It represent the lengths of the inputs. +*@li target_lengths: Tuple or tensor of size (N). It represent lengths of the targets. +*@li neg_log_likelihood: A loss value which is differentiable with respect to each input node. +*@li log_alpha: The probability of possible trace of input to target. + +*@par Outputs: +*@li grad: Tensor of size (T, N, C), The grad of Connectionist Temporal Classification loss. + +*@par Attributes: +*@li blank : Blank label. Default 0. +*@li reduction: Specifies the reduction to apply to the output. Default: 'mean'. +*@li zero_infinity : Whether to zero infinite losses and the associated gradients. + +*@par Third-party framework compatibility +* Compatible with Pytorch CTCLoss operator. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(CTCLossV2Grad) + .INPUT(grad_out, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(log_probs, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(targets, TensorType({DT_INT32, DT_INT64})) + .INPUT(input_lengths, TensorType({DT_INT32, DT_INT64})) + .INPUT(target_lengths, TensorType({DT_INT32, DT_INT64})) + .INPUT(neg_log_likelihood, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(log_alpha, TensorType({DT_FLOAT, DT_DOUBLE})) + .OUTPUT(grad, TensorType({DT_FLOAT, DT_DOUBLE})) + .ATTR(blank, Int, 0) + .ATTR(reduction, String, "mean") + .ATTR(zero_infinity, Bool, false) + .OP_END_FACTORY_REG(CTCLossV2Grad) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_CTC_OPS_H_ \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/data_flow_ops.h b/third_party/fwkacllib/inc/ops/data_flow_ops.h index bb937a75..6021f4e3 100644 --- a/third_party/fwkacllib/inc/ops/data_flow_ops.h +++ b/third_party/fwkacllib/inc/ops/data_flow_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -908,7 +908,7 @@ REG_OP(TensorArray) .OUTPUT(handle, TensorType({DT_RESOURCE})) .OUTPUT(flow, TensorType({DT_FLOAT})) .REQUIRED_ATTR(dtype, Type) - .ATTR(element_shape, ListInt, ge::UNKNOWN_SHAPE) + .ATTR(element_shape, ListInt, ge::UNKNOWN_RANK) .ATTR(dynamic_size, Bool, false) .ATTR(clear_after_read, Bool, true) .ATTR(identical_element_shapes, Bool, false) @@ -963,7 +963,7 @@ REG_OP(TensorArrayConcat) DT_QUINT8, DT_QINT32})) .OUTPUT(lengths, TensorType({DT_INT64})) .REQUIRED_ATTR(dtype, Type) - .ATTR(element_shape_except0, ListInt, ge::UNKNOWN_SHAPE) + .ATTR(element_shape_except0, ListInt, ge::UNKNOWN_RANK) .OP_END_FACTORY_REG(TensorArrayConcat) /** @@ -999,7 +999,7 @@ REG_OP(TensorArrayGather) DT_STRING, DT_COMPLEX64, DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT32})) .REQUIRED_ATTR(dtype, Type) - .ATTR(element_shape, ListInt, ge::UNKNOWN_SHAPE) + .ATTR(element_shape, ListInt, ge::UNKNOWN_RANK) .OP_END_FACTORY_REG(TensorArrayGather) /** @@ -1431,6 +1431,24 @@ REG_OP(OrderedMapClear) .OP_END_FACTORY_REG(OrderedMapClear) /** +*@brief FakeQueue, support tf api FixedLengthRecordReader. \n + +*@par Inputs: +*Including: +* @li resource: A Tensor of type DT_RESOURCE. + +*@par Outputs: +*handle: A Tensor of type DT_STRING ref. \n + +*@par Third-party framework compatibility +*Compatible with the TensorFlow operator FakeQueue. +*/ +REG_OP(FakeQueue) + .INPUT(resource, TensorType({DT_RESOURCE})) + .OUTPUT(handle, TensorType({DT_STRING})) + .OP_END_FACTORY_REG(FakeQueue) + +/** *@brief Returns the number of incomplete elements in the underlying container. \n *@par Attributes: @@ -2258,6 +2276,7 @@ REG_OP(LruCache) .ATTR(shared_name, String, "LruCache") .ATTR(cache_size, Int, 100000) .ATTR(load_factor, Float, 1) + .REQUIRED_ATTR(dtype, Type) .OP_END_FACTORY_REG(LruCache) /** @@ -2277,9 +2296,9 @@ REG_OP(CacheAdd) .INPUT(cache, TensorType({DT_RESOURCE})) .INPUT(ids, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) .OUTPUT(swap_in_id, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) - .OUTPUT(swap_in_idx, TensorType({DT_INT64})) + .OUTPUT(swap_in_idx, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) .OUTPUT(swap_out_id, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) - .OUTPUT(swap_out_idx, TensorType({DT_INT64})) + .OUTPUT(swap_out_idx, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) .OP_END_FACTORY_REG(CacheAdd) /** @@ -2295,9 +2314,65 @@ REG_OP(CacheAdd) REG_OP(CacheRemoteIndexToLocal) .INPUT(cache, TensorType({DT_RESOURCE})) .INPUT(ids, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) - .OUTPUT(local_idx, TensorType({DT_INT64})) + .OUTPUT(local_idx, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) .OP_END_FACTORY_REG(CacheRemoteIndexToLocal) +/** +*@brief CacheAllToLocalIndex, get id in cache +*@par Inputs: +*cache: resource data +*local_idx: id in cache. +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(CacheAllIndexToLocal) + .INPUT(cache, TensorType({DT_RESOURCE})) + .OUTPUT(local_idx, TensorType({DT_INT64, DT_INT32, DT_UINT64, DT_UINT32})) + .REQUIRED_ATTR(dtype, Type) + .OP_END_FACTORY_REG(CacheAllIndexToLocal) + +/** +*@brief DynamicGetNext, dynamic get next data +*@par Inputs: +*x: the iterator, all types are available +*@par Outputs: +*y: the date in iterator, all types are available +*@par Attributes: +*output_types: types of all outputs +*output_shapes: shapes of all outputs +*_dynamic_graph_execute_mode: dynamic graph execution mode, +value is one of lazy_recompile and dynamic_execute +*_getnext_inputs_shape_range: shape ranges of outputs, +it works where _dynamic_graph_execute_mode is dynamic_execute +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DynamicGetNext) + .INPUT(x, TensorType::ALL()) + .DYNAMIC_OUTPUT(y, TensorType::ALL()) + .ATTR(output_types, ListType, {}) + .ATTR(output_shapes, ListListInt, {{}, {}}) + .ATTR(_dynamic_graph_execute_mode, String, "lazy_recompile") + .ATTR(_getnext_inputs_shape_range, String, "") + .OP_END_FACTORY_REG(DynamicGetNext) + +/** +*@brief AdpGetNext +*@par Outputs: +*y: the data in iterator, all types are available +*@par Attributes: +*output_types: types of all outputs +*output_shapes: shapes of all outputs +*queue_name: cdqm queue name +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(AdpGetNext) + .DYNAMIC_OUTPUT(y, TensorType::ALL()) + .ATTR(output_types, ListType, {}) + .ATTR(output_shapes, ListListInt, {{}, {}}) + .ATTR(queue_name, String, "") + .OP_END_FACTORY_REG(AdpGetNext) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_DATA_FLOW_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h b/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h index c64bc138..f61e2939 100644 --- a/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -28,10 +28,13 @@ namespace ge { *@par Inputs: *Dynamic inputs, including: -* @li x: A list of Tensor objects, each with same shape and type. The supported types are: +*x: A list of Tensor objects, each with same shape and type. The supported types are: * float16, float32, double, int32, uint8, int16, int8, complex64, int64, * qint8, quint8, qint32, uint16, complex128, uint32, uint64. It's a dynamic input. \n +*@par Attributes: +*N: An required attribute of type int32, means nums of inputs. \n + *@par Outputs: *y: A Tensor. Has the same shape and type as the elements of "x". \n @@ -122,7 +125,8 @@ REG_OP(MinimumGrad) *@par Inputs: *One input: *x:A Tensor. Must be one of the following types: bool, float16, float, int8, int32, uint32, uint8, - int64, uint64, int16, uint16, double, complex64, complex128, qint8, quint8, qint16, quint16, qint32. \n + int64, uint64, int16, uint16, double, complex64, complex128, qint8, quint8, qint16, quint16, qint32. + For float32 type, the actual calculation on the chip is based on float16. \n *@par Attributes: *dst_type: An required attribute of type int32, specifying the dst data type. \n @@ -142,6 +146,8 @@ REG_OP(Cast) /** *@brief Returns the truth value of (x1 >= x2) element-wise. \n +*when input is int32 and (x2 - x1) > 2**31 or < -2**31 +*aicore accuracy is not guaranteed \n *@par Inputs: *Two inputs, including: @@ -163,6 +169,8 @@ REG_OP(GreaterEqual) /** *@brief Returns the truth value of (x1 < x2) element-wise. \n +*when input is int32 and (x2 - x1) > 2**31 or < -2**31 +*aicore accuracy is not guaranteed \n *@par Inputs: *Two inputs, including: @@ -322,8 +330,8 @@ REG_OP(Sub) *@brief computes the absolute value of a tensor. \n *@par Inputs: -*One inputs, including: -* @li x: A Tensor. Must be one of the following types: float16, float32, double, int32, int64. \n +*One input, including: \n +*x: A Tensor. Must be one of the following types: float16, float32, double, int32, int64. \n *@par Outputs: *y: A Tensor. Has the same type as "x". \n @@ -563,6 +571,8 @@ REG_OP(InvGrad) /** *@brief: Returns the truth value of (x <= y) element-wise. \n +*when input is int32 and (x2 - x1) > 2**31 or < -2**31 +*aicore accuracy is not guaranteed \n *@par Inputs: * Two inputs, including: @@ -611,6 +621,15 @@ REG_OP(Log1p) *@par Outputs: *y: A Tensor. Has the same type as "x1". + +*@attention Constraints: +*@li x2: The input data does not support 0 +*@li When NUM exceeds 2048 , the accuracy of operator cannot guarantee the +*requirement of double thousandths in the mini form +*@li Due to different architectures, the calculation results of this operator +*on NPU and CPU may be inconsistent +*@li If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8 + *@par Third-party framework compatibility *Compatible with the TensorFlow operator Mod. */ @@ -1020,7 +1039,7 @@ REG_OP(BesselI1e) * y = log_base(shift + scale * x), with "base" > 0. \n * @par Inputs: -* @li x: A Tensor of type complex64, complex128, float16, float32 or double. \n +* x: A Tensor of type complex64, complex128, float16, float32 or double. \n * @par Attributes: * @li base: An optional float32, specifying the base "e". Defaults to "-1.0" @@ -1065,7 +1084,7 @@ REG_OP(Log) * uint8, int8, uint16, int16, int32, int64, complex64, complex128. \n * @attention Constraints: -* @li "x1" and "x2" have incompatible shapes or types. \n +* "x1" and "x2" have incompatible shapes or types. \n * @par Third-party framework compatibility * Compatible with the TensorFlow operator Multiply. @@ -1451,6 +1470,8 @@ REG_OP(ReciprocalGrad) /** *@brief Returns the truth value of (x1 > x2) element-wise. \n +*when input is int32 and (x2 - x1) > 2**31 or < -2**31 +*aicore accuracy is not guaranteed \n *@par Inputs: *@li x1: A Tensor of type float16, float32, double, int64, int32, int16, int8, @@ -2042,6 +2063,15 @@ REG_OP(FloorDiv) * *@par Outputs: *y: Result remainder. + +*@attention Constraints: +*@li x2: The input data does not support 0 +*@li When NUM exceeds 2048 , the accuracy of operator cannot guarantee the +*requirement of double thousandths in the mini form +*@li Due to different architectures, the calculation results of this operator +*on NPU and CPU may be inconsistent +*@li If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8 + *@par Third-party framework compatibility * Compatible with the TensorFlow operator FloorMod. */ @@ -2168,6 +2198,14 @@ REG_OP(Tan) *@par Outputs: *y: A Tensor. Has the same type as "x1". \n +*@attention Constraints: +*@li x2: The input data does not support 0 +*@li When NUM exceeds 2048 , the accuracy of operator cannot guarantee the +*requirement of double thousandths in the mini form +*@li Due to different architectures, the calculation results of this operator +*on NPU and CPU may be inconsistent +*@li If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8 + *@par Third-party framework compatibility *@li Compatible with the TensorFlow operator TruncateMod. */ @@ -2425,6 +2463,25 @@ REG_OP(Eltwise) .OP_END_FACTORY_REG(Eltwise) /** + *@brief Computes the inverse error function of each element of input. \n + + *@par Inputs: + *One inputs, including: + * @li input_x: A tensor. Must be one of the following types: + * float16, float32. \n + + *@par Outputs: + *y: A Tensor with the same type and shape of input_x's. \n + + *@par Third-party framework compatibility + *Compatible with the Pytorch operator Erfinv. \n + */ +REG_OP(Erfinv) + .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(output_y, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(Erfinv) + +/** *@brief Computes element-wise population count. \n *@par Inputs: @@ -2829,9 +2886,9 @@ REG_OP(AdamApplyOneAssign) *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(LambApplyOptimizerAssign) - .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(grad, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(inputv, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(inputm, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(mul1_x, TensorType({DT_FLOAT16,DT_FLOAT})) @@ -2842,6 +2899,8 @@ REG_OP(LambApplyOptimizerAssign) .INPUT(do_use_weight, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(weight_decay_rate, TensorType({DT_FLOAT16,DT_FLOAT})) .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(inputv, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(inputm, TensorType({DT_FLOAT16,DT_FLOAT})) .OP_END_FACTORY_REG(LambApplyOptimizerAssign) /** @@ -2873,7 +2932,8 @@ REG_OP(LambApplyWeightAssign) .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT})) .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(input4, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(input_param, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(input_param, TensorType({DT_FLOAT16,DT_FLOAT})) .OP_END_FACTORY_REG(LambApplyWeightAssign) /** @@ -3183,12 +3243,14 @@ REG_OP(Fills) *@brief Add tensor with scale. \n *@par Inputs: -*Five inputs, including: -* @li x1: A Tensor. Must be one of the following types:int32,int16, float16, float32. -* @li x2: A scale. Must be float. \n +*One input, including: \n +*x: A Tensor. Must be one of the following types:int32,int16, float16, float32. \n + +*@par Attributes: +*value: A scale. Must be float. \n *@par Outputs: -*@li y: A Tensor. Has the same type and shape as "x1". \n +*y: A Tensor. Has the same type and shape as "x1". \n *@par Third-party framework compatibility: * Compatible with the Pytorch operator adds. @@ -3329,8 +3391,441 @@ REG_OP(TensorRedirect) .OUTPUT(output_x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8, DT_INT64, DT_INT16, DT_UINT16, DT_UINT64, DT_UINT32})) .OP_END_FACTORY_REG(TensorRedirect) -} // namespace ge +/** +* @brief Performs the element-wise division of tensor x2 by tensor x3, +* multiply the result by the scalar value and add it to tensor x1 + +* @par Inputs: +* Three inputs, including: +* @li input_data: A mutable input Tensor. Must be one of the following types: +* float16, float32. +* @li x1: A mutable input Tensor of the same type as x1. +* @li x2: A mutable input Tensor of the same type as x1. +* @li value: A mutable input Tensor. Must be one of the following types: +* float16, float32, int32. \n + +* @par Outputs: +* @li y: A mutable Tensor. Has the same type as "x1". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Addcdiv. +*/ +REG_OP(Addcdiv) + .INPUT(input_data, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(value, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(Addcdiv) + +/** +* @brief Performs the element-wise multiplication of tensor x2 by tensor x3, +* multiply the result by the scalar value and add it to tensor input_data + + +* @par Inputs: +* Three inputs, including: +* @li input_data: A mutable input Tensor. Must be one of the following types: +* float16, float32, int8, int32, uint8. +* @li x1: A mutable input Tensor of the same type as x1. +* @li x2: A mutable input Tensor of the same type as x1. +* @li value: A tensor which includes only one element of the same type as x1. \n + +* @par Outputs: +* @li y: A mutable output Tensor. Has the same type as "x1". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Addcmul. +*/ +REG_OP(Addcmul) + .INPUT(input_data, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8 })) + .INPUT(x1, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8 })) + .INPUT(x2, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8 })) + .INPUT(value, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8 })) + .OUTPUT(y, TensorType({ DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8 })) + .OP_END_FACTORY_REG(Addcmul) +/** +* @brief Computes the result of x2 * alpha + x1. + +* @par Inputs: +* @li x1: An ND tensor of type float16, float32, int32. +* @li x2: An ND tensor of type float16, float32, int32. +* @li alpha: A scalar tensor of type float16, float32. \n + +* @par Outputs: +* @li y: An ND tensor tensor with the same shape and type as "x1". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Axpy. +*/ +REG_OP(AxpyV2) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(alpha, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OP_END_FACTORY_REG(AxpyV2) + +/** +* @brief Computes the result of x1 - x2. + +* @par Inputs: +* @li x1: An ND tensor of type float16, float, int32. +* @li x2: An ND tensor of type float16, float, int32. \n + +* @par Outputs: +* @li y: An ND tensor tensor with the same type as "x1". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Sub. +*/ +REG_OP(PtSub) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OP_END_FACTORY_REG(PtSub) + +/** +* @brief Add the partial values of two tensors in format NC1HWC0. + +* @par Inputs: +* @li x1: A Tensor in 5HD, and must be one of the following types: float16, +* float32. \n +* @li x2: A Tensor of the same type as "x1", and the same shape as "x1", +* except for the C1 value. \n + +* @par Attributes: +* @li x1_c1_offset: A required int. Offset value of C1 in "x1". \n +* @li x2_c1_offset: A required int. Offset value of C1 in "x2". \n +* @li c1_len: A required int. C1 len of "y". The value must be less than +* the difference between C1 and offset in "x1" and "x2". \n + +* @par Outputs: +* @li y: A Tensor of the same type as "x1", and the same shape as "x1", +* except for the C1 value. Record the result after adding. \n +*/ +REG_OP(StrideAdd) + .INPUT(x1, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(x2, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .OUTPUT(y, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .REQUIRED_ATTR(x1_c1_offset, Int) + .REQUIRED_ATTR(x2_c1_offset, Int) + .REQUIRED_ATTR(c1_len, Int) + .OP_END_FACTORY_REG(StrideAdd) + +/** +* @brief Compare two tensors are totally equal or not, only output a bool value" + +* @par Inputs: +* Two inputs, including: +* @li input_x: A Tensor. the first tensor. \n +* @li input_y: A Tensor. the second tensor. \n + +* @par Outputs: +* @li output_z: A Tensor. Bool type, compare result of the two inputs. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch equal operator. \n +*/ +REG_OP(TensorEqual) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .INPUT(input_y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .OUTPUT(output_z, TensorType({DT_BOOL})) + .OP_END_FACTORY_REG(TensorEqual) + +/** + * @brief Element-wise min of each of the input tensors (with Numpy-style broadcasting support). + * All inputs and outputs must have the same data type. This operator supports multidirectional + * (i.e., Numpy-style) broadcasting + * + * @par inputs + * one input including: + * @li x: dynamic input A Tensor. Must be one of the following types: float32, float16, double, int32, int64 + * + * @par output + * one output including: + * @li y:A Tensor of the same type as x + * + */ +REG_OP(MaxN) + .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_FLOAT64, DT_INT32, DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_FLOAT64, DT_INT32, DT_INT64})) + .OP_END_FACTORY_REG(MaxN) + + +/** + * @brief Calculates x * maske * value. + * + * @par Inputs: + * @li x: An tensor of type float16 or float32, specifying the input to the data layer. + * @li mask: An tensor of type int8 or float16 or float32, be same shape with x. \n + * + * @par Attributes: + * value: A optional float. \n + * + * @par Outputs: + * y: The output tensor of type float16 or float32. + @ li y:A Tensor of the same type and shape as x + * + */ +REG_OP(MaskedScale) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32})) + .INPUT(mask, TensorType({DT_INT8, DT_FLOAT16, DT_FLOAT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32})) + .REQUIRED_ATTR(value, Float) + .OP_END_FACTORY_REG(MaskedScale) + +/** + * @brief Calculate the lerp function. \n + + * @par Inputs: + * Three inputs, including: + * @li start: A tensor. Must be one of the following types: + * float16, float32. \n + * @li end: A tensor. Must be one of the following types: + * float16, float32. \n + * @li weight: A tensor. Must be one of the following types: + * float16, float32. \n + + * @par Outputs: + * y: A Tensor with the same type and shape of input_x's. \n + + * @par Third-party framework compatibility + * Compatible with the Pytorch operator Lerp. \n + */ +REG_OP(Lerp) + .INPUT(start, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(end, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(weight, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(Lerp) + +/** +*@brief Returns the num value of abs(x1-x2) > atol+rtol*abs(x2) element-wise. \n + +* +*@par Inputs: +*@li x1: A tensor. Must be one of the following types: float32, int32, uint8, int8, float16 +*@li x2: A tensor of the same type as "x1". +* +*@par Attributes: +* atol: Defaults to "1e-05". +* rtol: Defaults to "1e-03". +* +*@par Outputs: +* num: A tensor of type float32. +* +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +* +*/ +REG_OP(DataCompare) + .INPUT(x1, TensorType({ DT_FLOAT16, DT_FLOAT,DT_INT8, DT_UINT8, DT_INT32 })) + .INPUT(x2, TensorType({ DT_FLOAT16, DT_FLOAT,DT_INT8, DT_UINT8, DT_INT32 })) + .OUTPUT(num, TensorType({DT_FLOAT})) + .ATTR(atol, Float, 1e-5) + .ATTR(rtol, Float, 1e-3) + .OP_END_FACTORY_REG(DataCompare) + +/** +*@brief Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 +*otherwise The input does not need to explicitly be a 2D vector.The "axis" attribute indicates the dimension along +*which Hardmax will be performed.The output tensor has the same shape and contains the Hardmax values of the +*corresponding input. +* +*@par inputs +*one input including: +*@li x: input A Tensor.Must be one of the following types:float32,float16 +* +*@par Attributes: +*@li axis:A required int attribute that decides which dimension will be used to cal the hard_max +* +*@par output: +*one output including: +*@li y:A Tensor of the same type as x +* +*/ +REG_OP(HardMax) + .INPUT(x, TensorType({ DT_FLOAT16, DT_FLOAT })) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(axis, Int, -1) + .OP_END_FACTORY_REG(HardMax) + +/** +* @brief Computes the dot product (inner product) of two tensors. This function does not broadcast. + +* @par Inputs: +* Two inputs, including: +* @li input_x: A Tensor. the first tensor must be 1d. \n +* @li input_y: A Tensor. the second tensor must be 1d. \n + +* @par Outputs: +* @li output: A Tensor. Result of the two inputs, must be 1d. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch dot operator. \n +*/ +REG_OP(Dot) + .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16, DT_UINT8, DT_INT8, DT_INT32})) + .INPUT(input_y, TensorType({DT_FLOAT, DT_FLOAT16, DT_UINT8, DT_INT8, DT_INT32})) + .OUTPUT(output, TensorType({DT_FLOAT, DT_FLOAT16, DT_UINT8, DT_INT8, DT_INT32})) + .OP_END_FACTORY_REG(Dot) + +/** +*@brief Returns a new tensor with boolean elements representing \n +*if each element of input is “close” to the corresponding element of other \n + +*@par Inputs: +*Two inputs, including: +* @li x1: A tensor. Must be one of the following types: +* float16, float32, int32. \n +* @li x2: A tensor with the same type and shape of x1's. \n + +*@par Attributes: +*@li rtol: An optional float.Defaults to 1e-05. \n +*@li atol: An optional float.Defaults to 1e-08. \n +*@li equal_nan: An optional bool.Defaults to false. \n + +*@par Outputs: +*y: A Tensor bool with the same shape of x1's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator isclose. \n +*/ +REG_OP(IsClose) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_BOOL})) + .ATTR(rtol, Float, 1e-05) + .ATTR(atol, Float, 1e-08) + .ATTR(equal_nan, Bool, false) + .OP_END_FACTORY_REG(IsClose) + +/** +* @brief Returns the reverse tensor of the ArgMax operator of a tensor. \n + +* @par Inputs: +* three input, including: +* var: A Tensor of type float16, float32, int32 or int8. \n +* indices: A Tensor of type int32. \n +* updates: A Tensor of type float16, float32, int32 or int8. \n + +* @par Attributes: +* @li dimension: An integer of type int, specifying the axis information of the index with the maximum value.\n + +* @par Outputs: +* y: A Tensor of type float16, float32, int32 or int8. \n +* +*@attention Constraints: +*@li indices: only support int32,and shape same to "updates" +*@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the dimension length of "x". +*@li y:A Tensor, the type and shape is same to "var" \n + +*@par Third-party framework compatibility +* not support all scene like pytorch operator scatter +* exp: +* var.shape=[2,3,4,5], dim=2, the shape of indices and updates should be [2,3,5] +* not support the shape of indices and updates is [2,3,2,5] like pytorch operator scatter. \n +*/ +REG_OP(ArgMaxGrad) + .INPUT(var, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(updates, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .REQUIRED_ATTR(dimension, Int) + .OP_END_FACTORY_REG(ArgMaxGrad) + +/** +* @brief Returns the reverse tensor of the ArgMax operator of a tensor. \n + +* @par Inputs: +* three input, including: +* var: A Tensor of type float16, float32, int32 or int8. \n +* indices: A Tensor of type int32. \n +* updates: A Tensor of type float16, float32, int32 or int8. \n +* assist: A Tensor of int32,also a assist matrix and it's shape must match the shape of var \n + +* @par Attributes: +* @li dimension: An integer of type int, specifying the axis information of the index with the maximum value.\n + +* @par Outputs: +* y: A Tensor of type float16, float32, int32 or int8. \n + +*@attention Constraints: +*@li indices: only support int32,and shape same to "updates" +*@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the dimension length of "x". +*@li y:A Tensor, the type and shape is same to "var" \n + +*@par Third-party framework compatibility +* not support all scene like pytorch operator scatter +* exp: +* var.shape=[2,3,4,5], dim=2, the shape of indices and updates should be [2,3,5] +* not support the shape of indices and updates is [2,3,2,5] like pytorch operator scatter. \n +*/ +REG_OP(ArgMaxGradD) + .INPUT(var, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(updates, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .INPUT(assist, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .REQUIRED_ATTR(dimension, Int) + .OP_END_FACTORY_REG(ArgMaxGradD) + +/** +*@brief Calculates the reversed outputs of the function "AddMatMatElements" +* c = c * beta + alpha * a * b + +*@par Inputs: +*Three inputs, including: +* @li c: A mutable Tensor. Must be one of the following types: +* float16, float32. +* @li a: A mutable Tensor of the same type as "c". +* @li b: A mutable Tensor of the same type as "c". +* @li beta: A mutable scalar of the same type as "c". +* @li alpha: A mutable scalar of the same type as "c". \n + +*@par Outputs: +* @li c: A mutable Tensor. Has the same type as "c". \n + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator AddMatMatElements. +*/ +REG_OP(AddMatMatElements) + .INPUT(c, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(a, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(b, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(beta, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(alpha, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(c, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(AddMatMatElements) + +/** +*@brief Returns cosine similarity between x1 and x2,computed along dim. \n + +*@par Inputs: +*Two inputs, including: +* @li input_x1: A tensor. Must be the following types: +* float32. \n + +*@par Inputs: +*@li input_x2: A tensor. Must of the following types: +* float32. \n + +*@par Outputs: +*@li output_y: A Tensor with the same type of input_x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator CosineSimilarity. \n +*/ +REG_OP(CosineSimilarity) + .INPUT(input_x1, TensorType({DT_FLOAT})) /* "First operand." */ + .INPUT(input_x2, TensorType({DT_FLOAT})) /* "Second operand." */ + .OUTPUT(output_y, TensorType({DT_FLOAT})) /* "Result, has same element type as two inputs" */ + .ATTR(dim, Int, 1) + .ATTR(eps, Float, 1e-8) + .OP_END_FACTORY_REG(CosineSimilarity) + +} // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_ELEWISE_CALCULATION_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/functional_ops.h b/third_party/fwkacllib/inc/ops/functional_ops.h index 598d3ad3..b09ac058 100644 --- a/third_party/fwkacllib/inc/ops/functional_ops.h +++ b/third_party/fwkacllib/inc/ops/functional_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/get_data_ops.h b/third_party/fwkacllib/inc/ops/get_data_ops.h index 33dc4f14..e5518ef8 100644 --- a/third_party/fwkacllib/inc/ops/get_data_ops.h +++ b/third_party/fwkacllib/inc/ops/get_data_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/globalavgpool.h b/third_party/fwkacllib/inc/ops/globalavgpool.h new file mode 100644 index 00000000..06f03d30 --- /dev/null +++ b/third_party/fwkacllib/inc/ops/globalavgpool.h @@ -0,0 +1,49 @@ +/** + * Copyright 2019 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. + */ + +/*! + * \file globalavgpool.h + * \brief + */ +#ifndef OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ +#define OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ + +#include "graph/operator_reg.h" + +namespace ge { +/** +*@brief GlobalAveragePool consumes an input tensor X and applies average pooling across the values in the same channel. +This is equivalent to AveragePool with kernel size equal to the spatial dimension of input tensor \n + +*@par Inputs: +*@li x: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), +where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. +For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. + +*@par Outputs: +*y: Output data tensor from pooling across the input tensor. The output tensor has the same rank as the input. +The first two dimensions of output shape are the same as the input (N x C), while the other dimensions are all 1 + +*@par Restrictions: +*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. +*/ +REG_OP(GlobalAveragePool) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OP_END_FACTORY_REG(GlobalAveragePool) +} // namespace ge + +#endif // OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVGPOOL_H_ \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/hcom_ops.h b/third_party/fwkacllib/inc/ops/hcom_ops.h index b90b225e..497f6a68 100644 --- a/third_party/fwkacllib/inc/ops/hcom_ops.h +++ b/third_party/fwkacllib/inc/ops/hcom_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -45,8 +45,6 @@ REG_OP(HcomAllGather) .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16, DT_INT64, DT_UINT64})) .REQUIRED_ATTR(rank_size, Int) .REQUIRED_ATTR(group, String) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomAllGather) /** @@ -77,8 +75,6 @@ REG_OP(HcomAllReduce) .REQUIRED_ATTR(group, String) .ATTR(fusion, Int, 1) .ATTR(fusion_id, Int, -1) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomAllReduce) /** @@ -91,7 +87,7 @@ REG_OP(HcomAllReduce) input of this rank will be broadcast to other ranks. * @li fusion: A required integer identifying if the op need to fusion,the default value is none fusion - * @li fusion: A required integer identifying the fusion id if para fusion + * @li fusion_id: A required integer identifying the fusion id if para fusion is set. * @li group: A required string identifying the group name of ranks participating in the op. @@ -109,11 +105,40 @@ REG_OP(HcomBroadcast) .REQUIRED_ATTR(group, String) .ATTR(fusion, Int, 0) .ATTR(fusion_id, Int, -1) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomBroadcast) /** + * @brief preforms reduction from others rank to rootrank + * @par Inputs: +* @li root_rank: A required integer identifying the root rank in the op + the reduction result will be on this root rank + * x: A tensor. Must be one of the following types: int8, int16, int32, float16, + float32. + * @par Attributes: + * @li reduction: A required string identifying the reduction operation to + perform.The supported operation are: "sum", "max", "min", "prod". + * @li group: A required string identifying the group name of ranks + participating in the op. + * @li fusion: An optional integer identifying the fusion flag of the op. + 0: no fusion; 1 (default): fusion; 2: fusion the ops by fusion id. + * @li fusion_id: An optional integer identifying the fusion id of the op. + * The HcomReduce ops with the same fusion id will be fused. + * @par Outputs: + * y: A Tensor. Has the same type as "x". + * @attention Constraints: + *"group" is limited to 128 characters. Use "hccl_world_group" + as the name of a world group. + */ +REG_OP(HcomReduce) + .INPUT(x, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16})) + .REQUIRED_ATTR(root_rank, Int) + .REQUIRED_ATTR(reduction, String) + .REQUIRED_ATTR(group, String) + .ATTR(fusion, Int, 0) + .ATTR(fusion_id, Int, -1) + .OP_END_FACTORY_REG(HcomReduce) +/** * @brief Performs reduction across all input tensors, scattering in equal blocks among ranks, each rank getting a chunk of data based on its rank index. @@ -139,8 +164,6 @@ REG_OP(HcomReduceScatter) .REQUIRED_ATTR(reduction, String) .REQUIRED_ATTR(group, String) .REQUIRED_ATTR(rank_size, Int) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomReduceScatter) /** @@ -167,8 +190,6 @@ REG_OP(HcomSend) .REQUIRED_ATTR(group, String) .REQUIRED_ATTR(sr_tag, Int) .REQUIRED_ATTR(dest_rank, Int) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomSend) /** @@ -202,8 +223,6 @@ REG_OP(HcomReceive) .REQUIRED_ATTR(src_rank, Int) .REQUIRED_ATTR(shape, ListInt) .REQUIRED_ATTR(dtype, Type) - .ATTR(alpha, Float, 1.0) - .ATTR(beta, Float, 0.0) .OP_END_FACTORY_REG(HcomReceive) /** @@ -219,6 +238,15 @@ REG_OP(HcomRemoteRead) .REQUIRED_ATTR(dtype, Type) .OP_END_FACTORY_REG(HcomRemoteRead) +/** + * @brief Performs Remote Ref Read of input tensors + * @par Inputs: + * remote: A tensor. describing the remote memory address to read: u64 remoteId, u64 addrRemote, u64 length + * cache_var: The local base address + * local_offset: Skip step length + * @par Outputs: + * cache_var: The local base address + */ REG_OP(HcomRemoteRefRead) .INPUT(remote, TensorType({DT_UINT64})) .INPUT(cache_var, TensorType({DT_UINT64})) @@ -239,11 +267,90 @@ REG_OP(HcomRemoteWrite) .INPUT(local, TensorType::ALL()) .OP_END_FACTORY_REG(HcomRemoteWrite) +/** + * @brief Performs Remote Write of input tensors + * @par Inputs: + * remote: A tensor. describing the remote memory address to write: u64 remoteId, u64 addrRemote, u64 length + * @par Inputs: + * local: A Tensor. whose value is length / size_of(Type) + */ REG_OP(HcomRemoteScatterWrite) .INPUT(remote, TensorType({DT_INT64, DT_UINT64})) .INPUT(local, TensorType::ALL()) .OPTIONAL_INPUT(local_offset, TensorType({DT_UINT64})) .OP_END_FACTORY_REG(HcomRemoteScatterWrite) +/** + * @brief All ranks send different amount of data to, and receive different + amount of data from, all ranks. + * @par Inputs: + * Five inputs, including: + * @li send_data: A tensor. the memory to send. + * @li send_counts: A list, where entry i specifies the number of elements in + send_data to send to rank i. + * @li send_displacements: A list, where entry i specifies the displacement + (offset from sendbuf) from which to send data to rank i. + * @li recv_counts: A list, where entry i specifies the number of + elements to receive from rank i. + * @li recv_displacements: A list, , where entry i specifies the displacement + (offset from recv_data) to which data from rank i should be written. + * @par Outputs: + * recv_data: A Tensor has same element type as send_data. + * @par Attributes: + * @li group: A string identifying the group name of ranks participating in + the op. +* @attention all ranks participating in the op should be full-mesh networking + using the RDMA. + */ +REG_OP(HcomAllToAllV) + .INPUT(send_data, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16, DT_INT64, DT_UINT64})) + .INPUT(send_counts, TensorType({DT_INT64})) + .INPUT(send_displacements, TensorType({DT_INT64})) + .INPUT(recv_counts, TensorType({DT_INT64})) + .INPUT(recv_displacements, TensorType({DT_INT64})) + .OUTPUT(recv_data, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16, DT_INT64, DT_UINT64})) + .REQUIRED_ATTR(group, String) + .OP_END_FACTORY_REG(HcomAllToAllV) + +/** + * @brief All ranks send different amount of data to, and receive different + amount of data from, all ranks. And concat all data descripting by addrinfo + togather into output gathered. + * @par Inputs: + * Four inputs, including: + * @li addrinfo: A tensor, descripting the memory info(address, length) to send. + * @li addrinfo_count_per_rank: A list, where entry i specifies the number of + elements in send_data to send to rank i. + * @li recv_counts: A list, where entry i specifies the number of + elements to receive from rank i. + * @li recv_displacements: A list, , where entry i specifies the displacement + (offset from recv_data) to which data from rank i should be written. + * @par Outputs: + * Two outputs, including: + * @li recv_data: A Tensor has same element type as dtype. + * @li gathered: A Tensor has same element type as dtype. + * @par Attributes: + * @li group: A string identifying the group name of ranks participating in + the op. + * @li dtype: Datatype of send buffer elements. + * @li addr_length: descripting the element memory length in the addrinfo. + -2: all element memory length in the addrinfo is the same, but it is unknown. + -1: all element memory length is unknown. + >0: all element memory length in the addrinfo is the same. the attr value is the memory length. + * @attention all ranks participating in the op should be full-mesh networking + using the RDMA. + */ +REG_OP(HcomGatherAllToAllV) + .INPUT(addrinfo, TensorType({DT_UINT64})) + .INPUT(addrinfo_count_per_rank, TensorType({DT_INT64})) + .INPUT(recv_counts, TensorType({DT_INT64})) + .INPUT(recv_displacements, TensorType({DT_INT64})) + .OUTPUT(recv_data, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16, DT_INT64, DT_UINT64})) + .OUTPUT(gathered, TensorType({DT_FLOAT, DT_INT32, DT_INT8, DT_INT16, DT_FLOAT16, DT_INT64, DT_UINT64})) + .REQUIRED_ATTR(group, String) + .REQUIRED_ATTR(dtype, Type) + .REQUIRED_ATTR(addr_length, Int) + .OP_END_FACTORY_REG(HcomGatherAllToAllV) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_HCOM_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/hvd_ops.h b/third_party/fwkacllib/inc/ops/hvd_ops.h index a49ec5ed..00299ef7 100644 --- a/third_party/fwkacllib/inc/ops/hvd_ops.h +++ b/third_party/fwkacllib/inc/ops/hvd_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. diff --git a/third_party/fwkacllib/inc/ops/image_ops.h b/third_party/fwkacllib/inc/ops/image_ops.h index ce3262f9..6909345a 100644 --- a/third_party/fwkacllib/inc/ops/image_ops.h +++ b/third_party/fwkacllib/inc/ops/image_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -24,6 +24,22 @@ #include "graph/operator_reg.h" namespace ge { +/** +*@brief Decode the frame(s) of a GIF-encoded image to a uint8 tensor . \n + +*@par Inputs: +*@li contents:A Tensor of type string. 0-D. The GIF-encoded image. \n + +*@par Outputs: +*image:A Tensor of type uint8. \n + +*@par Third-party framework compatibility +*Compatible with tensorflow DecodeGif operator. +*/ +REG_OP(DecodeGif) + .INPUT(contents, TensorType({DT_STRING})) + .OUTPUT(image, TensorType({DT_UINT8})) + .OP_END_FACTORY_REG(DecodeGif) /** *@brief Adjust the hue of one or more images . \n @@ -31,11 +47,12 @@ namespace ge { *@par Inputs: *Input images is a tensor of at least 3 dimensions. The last dimension is interpretted as channels, and must be three. Inputs include: -*@li images:A Tensor of type float. Images to adjust. At least 3-D. +*@li images:A Tensor of type float. Images to adjust. At least 3-D. The format +must be NHWC. *@li delta:A Tensor of type float. A float delta to add to the hue . \n *@par Outputs: -*y:A Tensor of type float . \n +*y:A Tensor of type float. The format must be NHWC. \n *@attention Constraints: *Input images is a tensor of at least 3 dimensions. The last dimension is @@ -57,11 +74,12 @@ REG_OP(AdjustHue) *@par Inputs: *Input images is a tensor of at least 3 dimensions. The last dimension is interpretted as channels, and must be three. Inputs include: -*@li images:A Tensor of type float. Images to adjust. At least 3-D. +*@li images:A Tensor of type float. Images to adjust. At least 3-D. The format +must be NHWC. *@li scale:A Tensor of type float. A float scale to add to the saturation . \n *@par Outputs: -*y:A Tensor of type float . \n +*y:A Tensor of type float. The format must be NHWC. \n *@attention Constraints: *Input images is a tensor of at least 3 dimensions. The last dimension is @@ -83,11 +101,12 @@ REG_OP(AdjustSaturation) *@par Inputs: *Input images is a tensor of at least 3 dimensions. The last 3 dimensions are interpreted as '[height, width, channels]'. Inputs include: -*@li images:A Tensor of type float. Images to adjust. At least 3-D. +*@li images:A Tensor of type float. Images to adjust. At least 3-D. The format +must be NHWC. *@li scale:A Tensor of type float. A float multiplier for adjusting contrast . \n *@par Outputs: -*y:A Tensor of type float . \n +*y:A Tensor of type float. The format must be NHWC. \n *@attention Constraints: *Input images is a tensor of at least 3 dimensions. The last dimension is @@ -112,7 +131,7 @@ nearest neighbor sampling to a common output size specified by crop_size . \n *Input images must be a 4-D tensor. Inputs include: *@li images:A Tensor. Must be one of the following types:uint8, uint16, int8, int16, int32, int64, float16, float, double. A 4-D tensor of shape -[batch, image_height, image_width, depth]. +[batch, image_height, image_width, depth]. The format must be NHWC. *@li boxes: A Tensor of type float. A 2-D tensor of shape [num_boxes, 4]. *@li box_index: A Tensor of type int32. A 1-D tensor of shape [num_boxes] with int32 values in [0, batch). @@ -127,7 +146,7 @@ extrapolation, when applicable. NearestNeighbor . \n *@par Outputs: -*y:A Tensor of type float . \n +*y:A Tensor of type float. The format must be NHWC. \n *@attention Constraints: *Input images must be a 4-D tensor . \n @@ -193,7 +212,9 @@ boxes tensor . \n *@par Inputs: *Input images and grads must be a 4-D tensor. Inputs include: *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth]. +The format must be NHWC. *@li images: A 4-D tensor of shape [batch, image_height, image_width, depth]. +The format must be NHWC. Both image_height and image_width need to be positive. *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor specifies the coordinates of a box in the box_ind[i] image and is specified in @@ -233,6 +254,7 @@ images tensor . \n *@par Inputs: *Input grads must be a 4-D tensor. Inputs include: *@li grads: A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth]. +The format must be NHWC. *@li boxes: A 2-D tensor of shape [num_boxes, 4]. The i-th row of the tensor specifies the coordinates of a box in the box_ind[i] image and is specified in normalized coordinates [y1, x1, y2, x2]. @@ -248,7 +270,8 @@ method: A string specifying the interpolation method. Only 'bilinear' is supported for now . \n *@par Outputs: -*y:A 4-D tensor of shape [batch, image_height, image_width, depth] . \n +*y:A 4-D tensor of shape [batch, image_height, image_width, depth]. The format +must be NHWC. \n *@attention Constraints: *Input grads must be a 4-D tensor . \n @@ -273,6 +296,7 @@ REG_OP(CropAndResizeGradImage) *@par Inputs: *Input x must be a 4-D tensor. Inputs include: *@li x: A 4-D float tensor of shape [batch_size, height, width, channels]. +The format must be NHWC. *@li size: A 1-D tensor of 2 elements containing the size of the glimpses to extract. The glimpse height must be specified first, following by the glimpse width. @@ -293,7 +317,7 @@ uniform_noise . \n *@par Outputs: *y:A tensor representing the glimpses [batch_size, glimpse_height, -glimpse_width, channels] . \n +glimpse_width, channels]. The format must be NHWC. \n *@attention Constraints: *Input x must be a 4-D tensor . \n @@ -340,7 +364,8 @@ REG_OP(HSVToRGB) *@par Inputs: *Input images must be a 4-D tensor. Inputs include: -*@li images: 4-D with shape [batch, height, width, channels]. +*@li images: 4-D with shape [batch, height, width, channels]. The format must +be NHWC. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images. *@li min: A Tensor of type float. @@ -354,6 +379,7 @@ the values at the corner pixels. Defaults to false. *@par Outputs: *@li resized_images: 4-D with shape [batch, new_height, new_width, channels]. +The format must be NHWC. *@li y_min: A Tensor of type float. *@li y_max: A Tensor of type float . \n @@ -381,7 +407,8 @@ REG_OP(QuantizedResizeBilinear) *@par Inputs: *Input images must be a 4-D tensor. Inputs include: -*@li images: 4-D with shape [batch, height, width, channels]. +*@li images: 4-D with shape [batch, height, width, channels]. The format must +be NHWC. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images . \n @@ -391,7 +418,8 @@ output tensors are aligned, preserving the values at the corner pixels. Defaults to false . \n *@par Outputs: -*y: 4-D with shape [batch, new_height, new_width, channels] . \n +*y: 4-D with shape [batch, new_height, new_width, channels]. The format must +be NHWC. \n *@attention Constraints: *Input images can be of different types but output images are always float . \n @@ -414,10 +442,10 @@ REG_OP(ResizeArea) *@par Inputs: *Input grads must be a 4-D tensor. Inputs include: *@li grads: A Tensor of type float. 4-D with shape [batch, height, width, -channels]. +channels]. The format must be NHWC. *@li original_image: A Tensor. Must be one of the following types: float, double. 4-D with shape [batch, orig_height, orig_width, channels], The image -tensor that was resized . \n +tensor that was resized. The format must be NHWC. \n *@par Attributes: *@li align_corners: An optional bool. Defaults to False. If true, the centers @@ -426,10 +454,10 @@ false. *@li half_pixel_centers: An optional bool. Defaults to False . \n *@par Outputs: -*y: A Tensor. Has the same type as original_image . \n +*y: A Tensor. Has the same type as original_image. The format must be NHWC. \n *@attention Constraints: -*Input images can be of different types but output images are always float . \n +*Input images can be of different types but output images are always float . *@par Third-party framework compatibility *Compatible with tensorflow ResizeBicubicGrad operator. @@ -448,7 +476,8 @@ REG_OP(ResizeBicubicGrad) *@par Inputs: *Input images must be a 4-D tensor. Inputs include: -*@li images: 4-D with shape [batch, height, width, channels]. +*@li images: 4-D with shape [batch, height, width, channels]. The format +must be NHWC. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images . \n @@ -459,10 +488,11 @@ Defaults to false. *@li half_pixel_centers: An optional bool. Defaults to False . \n *@par Outputs: -*y: 4-D with shape [batch, new_height, new_width, channels] . \n +*y: 4-D with shape [batch, new_height, new_width, channels]. The format +must be NHWC. \n *@attention Constraints: -*Input images can be of different types but output images are always float . \n +*Input images can be of different types but output images are always float . *@par Third-party framework compatibility *Compatible with tensorflow ResizeBicubic operator. @@ -483,7 +513,7 @@ REG_OP(ResizeBicubic) *@par Inputs: *Input grads must be a 4-D tensor. Inputs include: *@li grads: A Tensor. Must be one of the following types: uint8, int8, int32, -float16, float, double. 4-D with shape [batch, height, width, channels]. +float16, float, double. Must set the format, supported format list ["NCHW, NHWC"] *@li size: A 1-D int32 Tensor of 2 elements: orig_height, orig_width. The original input size . \n @@ -550,9 +580,8 @@ REG_OP(ResizeNearestNeighborV2GradD) *@par Inputs: *Input grads must be a 4-D tensor. Inputs include: -*@li grads: A Tensor of type float32. 4-D with shape [batch, height, width, -channels]. -*@li original_image: A Tensor. 4-D with shape [batch, orig_height, orig_width, +*@li grads: A Tensor of type float32. Must set the format, supported format list ["NCHW, NHWC"] +*@li original_image: A Tensor. 4-D shape. Must set the format, supported format list ["NCHW, NHWC"] channels], The image tensor that was resized . \n *@par Attributes: @@ -583,7 +612,7 @@ REG_OP(ResizeBilinearV2Grad) *@par Inputs: *Input images must be a 4-D tensor. Inputs include: -*@li x: 4-D with shape [batch, height, width, channels]. +*@li x: 4-D tensor. Must set the format, supported format list ["NCHW, NHWC"] *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images . \n @@ -643,6 +672,62 @@ REG_OP(RGBToHSV) *Input images must be a 4-D tensor. Inputs include: *@li image_size: 1-D, containing [height, width, channels]. *@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding +boxes associated with the image. \n + +*@par Attributes: +*@li seed: If either seed or seed2 are set to non-zero, the random number +generator is seeded by the given seed. Otherwise, it is seeded by a random seed. +*@li seed2: A second seed to avoid seed collision. +*@li min_object_covered: The cropped area of the image must contain at least +this fraction of any bounding box supplied. The value of this parameter should +be non-negative. In the case of 0, the cropped area does not need to overlap +any of the bounding boxes supplied . +*@li aspect_ratio_range: The cropped area of the image must have an aspect +ratio = width / height within this range. +*@li max_attempts: Number of attempts at generating a cropped region of the +image of the specified constraints. After max_attempts failures, return the +entire image. +*@li use_image_if_no_bounding_boxes: Controls behavior if no bounding boxes +supplied. If true, assume an implicit bounding box covering the whole input. +If false, raise an error . \n + +*@par Outputs: +*@li begin: 1-D, containing [offset_height, offset_width, 0]. +*@li size: 1-D, containing [target_height, target_width, -1]. +*@li bboxes: 3-D with shape [1, 1, 4] containing the distorted bounding box . \n + +*@attention Constraints: +*Input images can be of different types but output images are always float . \n + +*@par Third-party framework compatibility +*Compatible with tensorflow SampleDistortedBoundingBox operator. +*/ + +REG_OP(SampleDistortedBoundingBox) + .INPUT(image_size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \ + DT_INT32, DT_INT64 })) + .INPUT(bounding_boxes, TensorType({ DT_FLOAT })) + .OUTPUT(begin, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \ + DT_INT32, DT_INT64 })) + .OUTPUT(size, TensorType({ DT_UINT8, DT_INT8, DT_INT16, \ + DT_INT32, DT_INT64 })) + .OUTPUT(bboxes, TensorType({ DT_FLOAT })) + .ATTR(seed, Int, 0) + .ATTR(seed2, Int, 0) + .ATTR(min_object_covered, Float, 0.1f) + .ATTR(aspect_ratio_range, ListFloat, { 0.75f, 1.33f }) + .ATTR(area_range, ListFloat, { 0.05f, 1.0f }) + .ATTR(max_attempts, Int, 100) + .ATTR(use_image_if_no_bounding_boxes, Bool, false) + .OP_END_FACTORY_REG(SampleDistortedBoundingBox) + +/** +*@brief Generate a single randomly distorted bounding box for an image . \n + +*@par Inputs: +*Input images must be a 4-D tensor. Inputs include: +*@li image_size: 1-D, containing [height, width, channels]. +*@li bounding_boxes: 3-D with shape [batch, N, 4] describing the N bounding boxes associated with the image. *@li min_object_covered: The cropped area of the image must contain at least this fraction of any bounding box supplied. The value of this parameter should @@ -697,7 +782,7 @@ REG_OP(SampleDistortedBoundingBoxExt2) *@par Inputs: *Input x must be a 4-D tensor. Inputs include: -*@li x: 4-D with shape [batch, height, width, channels]. +*@li x: 4-D tensor. Must set the format, supported format list ["NCHW, NHWC"]. *@li size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images . \n @@ -729,12 +814,12 @@ REG_OP(ResizeNearestNeighborV2) *@par Inputs: *Input images must be a 4-D tensor. Inputs include: *@li images: A Tensor. Must be one of the following types: float. 4-D with -shape [batch, height, width, depth]. A batch of images. +shape [batch, height, width, depth]. A batch of images. The format must be NHWC. *@li boxes: A Tensor of type float32. 3-D with shape [batch, num_bounding_boxes, 4] containing bounding boxes . \n *@par Outputs: -*A Tensor. Has the same type as images . \n +*A Tensor. Has the same type as images. The format must be NHWC. \n *@attention Constraints: *Input images must be a 4-D tensor . \n @@ -1002,6 +1087,88 @@ REG_OP(EncodePng) .ATTR(compression, Int, -1) .OP_END_FACTORY_REG(EncodePng) + +/** +*@brief PNG-decode an image. +*@par Inputs: +*contents: 0-D. PNG-decoded image . + +*@par Attributes: +*channels: graph channels \n +*dtype: type of image + +*@par Outputs: +*image: is a 3-D uint8 or uint16 Tensor of shape [height, width, channels] +where channels is: 1: for grayscale; 2: for grayscale + alpha; 3: for RGB; +4: for RGBA . \n + +*@par Third-party framework compatibility +*Compatible with tensorflow DecodePng operator. +*/ +REG_OP(DecodePng) + .INPUT(contents, TensorType({DT_STRING})) + .OUTPUT(image, TensorType({DT_UINT8, DT_UINT16})) + .ATTR(dtype, Type, DT_UINT8) + .ATTR(channels, Int, 0) + .OP_END_FACTORY_REG(DecodePng) + +/** +*@brief Bmp-decode an image. \n + +*@par Inputs: +*@li contents: A Tensor of type string. 0-D. The BMP-encoded image. \n + +*@par Attributes: +*@li channels: Decode the desired number of color channels of the image. \n + +*@par Outputs: +*image: A Tensor dtype of uint8. + +* @par Third-party framework compatibility +* Compatible with tensorflow DecodeBmp operator. +*/ + +REG_OP(DecodeBmp) + .INPUT(contents, TensorType({DT_STRING})) + .OUTPUT(image, TensorType({DT_UINT8})) + .ATTR(channels, Int, 0) + .OP_END_FACTORY_REG(DecodeBmp) + +/** +*@brief Function parse image from string to int. \n + +*@par Inputs: +*@li contents: A Tensor of type string. 0-D. The JPEG-encoded image. \n +*@li crop_window: 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width]. \n + +*@par Attributes: +*@li channels: An optional int. Defaults to 0. Number of color channels for the +*decoded image. +*@li ratio: An optional int. Defaults to 1. Downscaling ratio. +*@li fancy_upscaling: An optional bool. Defaults to True. If true use a slower +*but nicer upscaling of the chroma planes +*@li try_recover_truncated: An optional bool. Defaults to False. If true try to +*recover an image from truncated input. +*@li acceptable_fraction: An optional float. Defaults to 1. The minimum required +fraction of lines before a truncated input is accepted. +*@li dct_method: An optional string. Defaults to "". string specifying a hint +*about the algorithm used for decompression. \n + +*@par Outputs: +*image: A Tensor dtype of uint8. +*/ +REG_OP(DecodeAndCropJpeg) + .INPUT(contents, TensorType({DT_STRING})) + .INPUT(crop_window, TensorType({DT_INT32})) + .OUTPUT(image, TensorType({DT_UINT8})) + .ATTR(channels, Int, 0) + .ATTR(ratio, Int, 1) + .ATTR(fancy_upscaling, Bool, true) + .ATTR(try_recover_truncated, Bool, false) + .ATTR(acceptable_fraction, Float, 1.0) + .ATTR(dct_method, String, "") + .OP_END_FACTORY_REG(DecodeAndCropJpeg) + /** *@brief Resizes "images" to "size" using bilinear interpolation . \n @@ -1317,6 +1484,55 @@ REG_OP(CombinedNonMaxSuppression) .OP_END_FACTORY_REG(CombinedNonMaxSuppression) /** +*@brief Resizes "images" with "offset" using bilinear interpolation. \n + +*@par Inputs: +*@li img: input image, A 4-D tensor of shape `[n, h, w, c]`. +*@li warp_offset: the resize offset A 4-D float tensor of shape `[n, h, w, 2]`, 2 means (x, y) for offset point. + +*@par Outputs: +*warp_img: A Tensor after resize. \n +*/ +REG_OP(IMGWarp) + .INPUT(img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32})) + .INPUT(warp_offset, TensorType({DT_FLOAT32})) + .OUTPUT(warp_img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32})) + .OP_END_FACTORY_REG(IMGWarp) + +/** +*@brief Resizes "images" with "offset" using bilinear interpolation. \n + +*@par Inputs: +*@li img: input image, A 4-D tensor of shape `[n, h, w, c]`. +*@li map_offset: the resize offset A 4-D float tensor of shape `[n, h, w, 2]`, 2 means (x, y) for resize point. + +*@par Outputs: +*map_img: A Tensor after resize. \n +*/ +REG_OP(Remap) + .INPUT(img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32})) + .INPUT(map_offset, TensorType({DT_FLOAT32})) + .OUTPUT(map_img, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT32})) + .OP_END_FACTORY_REG(Remap) + +/** +*@brief Resizes "images" with "offset" using bilinear interpolation. \n + +*@par Inputs: +*@li img: input image, A 5-D tensor of shape `[n, 4, c, h, w]`, +and 4 mean input[(h_top, w_left), (h_top, w_right), (h_bottom, w_left), (h_bottom, w_right)]. +*@li warp_index: the resize offset A 4-D float tensor of shape `[n, 2, h, w]`, 2 means (x, y) for resize point. + +*@par Outputs: +*remap_img: A Tensor after ResizeBilinear, A 4-D tensor of shape `[n, c, h, w]`. \n +*/ +REG_OP(IMGWarpResize) + .INPUT(img, TensorType({DT_FLOAT32})) + .INPUT(warp_index, TensorType({DT_FLOAT32})) + .OUTPUT(warp_img, TensorType({DT_FLOAT32})) + .OP_END_FACTORY_REG(IMGWarpResize) + +/** *@brief Function spatial transformer . \n *@par Inputs: @@ -1342,6 +1558,383 @@ REG_OP(SpatialTransformerD) .ATTR(use_default_theta, ListBool, {}) .OP_END_FACTORY_REG(SpatialTransformerD) -} // namespace ge +/** +* @brief Resize the input tensor. \n +currently, only support resize image tensor using nearest neighbor and linear interpolation. + +* @par Inputs: +* Input x must be a 4-D tensor. Inputs include: \n +* @li x: A Tensor. Must be one of the following types: uint8, int8, int16, \n +int32, int64, float16, float, double. 4-D with shape [batch, height, width, channels] \n +or shape [batch, channels, height, width]. +* @li roi: A 1-D float Tensor. only takes effect when attr coordinate_transformation_mode \n +is "tf_crop_and_resize" +* @li scales: A 1-D float Tensor, the scale array along each dimension, Only one of \n +'scales' and 'sizes' can be specified. +* @li sizes: A 1-D int64 Tensor, The size of the output tensor. nly one of \n +'scales' and 'sizes' can be specified. If 'size' is specified, then set scales \n +to empty data (zero shape) in this operator's input list. + +* @par Attributes: +* @li coordinate_transformation_mode: String. Defaults to half_pixel. how to transform \n +the coordinate in the resized tensor to the coordinate in the original tensor. \n +other optional: pytorch_half_pixel, align_corners, asymmetric, tf_half_pixel_for_nn, \n +tf_crop_and_resize. +* @li cubic_coeff_a: Float. Defaults to -0.75, only used in cubic interpolation. \n +other optional: -0.5 +* @li exclude_outside: Int. Defaults to 0, If set to 1, the weight of sampling \n +locations outside the tensor will be set to 0 and the weight will be renormalized \n +so that their sum is 1.0. +* @li extrapolation_value: Float. Defaults to 0.0f. When coordinate_transformation_mode \n +is "tf_crop_and_resize" and x_original is outside the range [0, length_original - 1], \n +this value is used as the corresponding output value. +* @li mode: String. Defaults to nearest. Three interpolation modes: nearest (default), \n +linear and cubic. +* @li nearest_mode: String. Defaults to round_prefer_floor. Four modes: round_prefer_floor, \n +round_prefer_ceil, floor, ceil. Only used by nearest interpolation. + +* @par Outputs: +* y: A Tensor. Has the same type as x. + +* @attention Constraints: \n +* Input x must be a 4-D tensor. + +* @par Third-party framework compatibility +* Compatible with tensorflow ResizeNearestNeighborV2 operator. +*/ + +REG_OP(Resize) + .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, + DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .INPUT(roi, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .INPUT(scales, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(sizes, TensorType({DT_INT64})) + .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, + DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .ATTR(coordinate_transformation_mode, String, "half_pixel") + .ATTR(cubic_coeff_a, Float, -0.75) + .ATTR(exclude_outside, Int, 0) + .ATTR(extrapolation_value, Float, 0) + .ATTR(mode, String, "nearest") + .ATTR(nearest_mode, String, "round_prefer_floor") + .OP_END_FACTORY_REG(Resize) + +/** +*@brief Function parse image from string to int. \n + +*@par Inputs: +*@li contents: A Tensor of type string. 0-D. The JPEG-encoded image. \n + +*@par Attributes: +*@li channels: An optional int. Defaults to 0. Number of color channels for the decoded image. +*@li ratio: An optional int. Defaults to 1. Downscaling ratio. +*@li fancy_upscaling: An optional bool. Defaults to True. If true use a slower but nicer upscaling of the chroma planes +*@li try_recover_truncated: An optional bool. Defaults to False. If true try to recover an image from truncated input. +*@li acceptable_fraction: An optional float. Defaults to 1. The minimum required fraction of lines before a truncated input is accepted. +*@li dct_method: An optional string. Defaults to "". string specifying a hint about the algorithm used for decompression. \n + +*@par Outputs: +*image: A Tensor dtype of uint8. +*/ +REG_OP(DecodeJpeg) + .INPUT(contents, TensorType({DT_STRING})) + .OUTPUT(image, TensorType({DT_UINT8})) + .ATTR(channels, Int, 0) + .ATTR(ratio, Int, 1) + .ATTR(fancy_upscaling, Bool, true) + .ATTR(try_recover_truncated, Bool, false) + .ATTR(acceptable_fraction, Float, 1.0) + .ATTR(dct_method, String, "") + .OP_END_FACTORY_REG(DecodeJpeg) + +/** +*@brief Image warping using per-pixel flow vectors. \n + +*@par Inputs: +*@li image: 4-D Tensor with shape `[batch, height, width, channels]`. +*@li flow: 4-D Tensor with shape `[batch, height, width, 2]`. \n + +*@par Outputs: +*y: Returns 4-D with the same shape and dtype as `image`. \n +*/ +REG_OP(DenseImageWarp) + .INPUT(image, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(flow, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(DenseImageWarp) + +/** +*@brief Calculate the resize_d function. \n + +*@par Inputs: +*One inputs, including: +* @li x: A tensor. Must be one of the following types: +* float16, float32. \n + +*@par Attributes: +*@li sizes: An optional listInt. \n +*@li scales: An optional listFloat. + Defaults to none. \n +*@li roi: An optional listInt. + Defaults to none. \n +*@li coordinate_transformation_mode: An optional String. + Defaults to "half_pixel". \n +*@li cubic_coeff_a: An optional float. + Defaults to -0.75. \n +*@li exclude_outside: An optional int. + Defaults to 0. \n +*@li extrapolation_value: An optional float. + Defaults to 0.0. \n +*@li mode: An optional String. + Defaults to "nearest". \n +*@li nearest_mode: An optional String. + Defaults to "round_prefer_floor". \n + +*@par Outputs: +*y: A Tensor with the same type of x's, + shape depends on x and sizes. \n +*/ +REG_OP(ResizeD) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(sizes, ListInt) + .ATTR(scales, ListFloat, {}) + .ATTR(roi, ListInt, {}) + .ATTR(coordinate_transformation_mode, String, "half_pixel") + .ATTR(cubic_coeff_a, Float, -0.75) + .ATTR(exclude_outside, Int, 0) + .ATTR(extrapolation_value, Float, 0.0) + .ATTR(mode, String, "nearest") + .ATTR(nearest_mode, String, "round_prefer_floor") + .OP_END_FACTORY_REG(ResizeD) + +/** +*@brief Calculate the resize_grad_d function. \n + +*@par Inputs: +*One inputs, including: +* @li grads: A tensor. Must be one of the following types: +* float16, float32. \n + +*@par Attributes: +*@li original_size: An optional listInt. \n +*@li roi: An optional listInt. + Defaults to none. \n +*@li scales: An optional listFloat. + Defaults to none. \n +*@li coordinate_transformation_mode: An optional String. + Defaults to "half_pixel". \n +*@li cubic_coeff_a: An optional float. + Defaults to -0.75. \n +*@li exclude_outside: An optional int. + Defaults to 0. \n +*@li extrapolation_value: An optional float. + Defaults to 0.0. \n +*@li mode: An optional String. + Defaults to "nearest". \n +*@li nearest_mode: An optional String. + Defaults to "round_prefer_floor". \n + +*@par Outputs: +*y: A Tensor with the same type of x's, + shape depends on x and sizes. \n +*/ +REG_OP(ResizeGradD) + .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(original_size, ListInt) + .ATTR(roi, ListInt, {}) + .ATTR(scales, ListFloat, {}) + .ATTR(coordinate_transformation_mode, String, "half_pixel") + .ATTR(cubic_coeff_a, Float, -0.75) + .ATTR(exclude_outside, Int, 0) + .ATTR(extrapolation_value, Float, 0.0) + .ATTR(mode, String, "nearest") + .ATTR(nearest_mode, String, "round_prefer_floor") + .OP_END_FACTORY_REG(ResizeGradD) + +/** +*@brief Computes the gradients of DenseImageWarp with respect to image and flow. \n + +*@par Inputs: +*@li grad: gradients with respect to DenseImageWarp output. +*@li image: 4-D Tensor with shape `[batch, height, width, channels]`. +*@li flow: 4-D Tensor with shape `[batch, height, width, 2]`. \n + +*@par Outputs: +*grad_image: Returns 4-D with the same shape and dtype as `image`. +*grad_flow: Returns 4-D with the same shape and dtype as `flow`. \n +*/ +REG_OP(DenseImageWarpGrad) + .INPUT(grad, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(image, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(flow, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(grad_image, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(grad_flow, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(DenseImageWarpGrad) + +/** +*@brief This operation samples input X by using interpolation based on flow field grid, + which is usually gennerated by affine_grid. The grid of shape [N, H, W, 2] is the concatenation of + (x, y) coordinates with shape [N, H, W] each, where x is indexing the 4th dimension (in width dimension) of + input data x and y is indexng the 3rd dimention (in height dimension), finally results is + the interpolation value of 4 nearest corner points. The output tensor shape will be [N, C, H, W]. + +*@par Inputs: +*@li x: 4-D Tensor with shape `[batch, channels, height, width]`. +*@li grid: flow field grid, 4-D Tensor with shape `[batch, height, width, 2]`. + +*@par Attributes: +*@li interpolation_mode: An optional string specifying the interpolation method. Only 'bilinear' is + supported for now . +*@li padding_mode: An optional string specifying the pad method. Only 'zeros' is supported for now . +*@li align_corners: An optional bool. If "true", the centers of the corner + pixels of the input and output tensors are aligned. Defaults to "false" . + +*@par Outputs: +*y: Returns 4-D Tensor with the same dtype as `X`. + +*@par Third-party framework compatibility +*Compatible with pytorch GridSampler2D operator. + +*@par Restrictions: +*Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(GridSampler2D) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(interpolation_mode, String, "bilinear") + .ATTR(padding_mode, String, "zeros") + .ATTR(align_corners, Bool, false) + .OP_END_FACTORY_REG(GridSampler2D) + +/** +*@brief This operation unnormalize input Grid, which is usually gennerated by affine_grid. + +*@par Inputs: +*@li grid: flow field grid, 4-D Tensor with shape `[batch, height, width, 2]`. +*@li assist: Assist matrix, a 4-D tensor of type float16. + +*@par Attributes: +*@li align_corners: An optional bool. If "true", the centers of the corner + pixels of the input and output tensors are aligned. Defaults to "false" . + +*@par Outputs: +*diff: Returns 4-D Tensor with the same shape and dtype as `grid`. +*position: Returns 4-D Tensor with the same shape as `grid`. +*/ +REG_OP(GridUnnormal) + .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(assist, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(diff, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(position, TensorType({DT_INT32})) + .ATTR(align_corners, Bool, false) + .OP_END_FACTORY_REG(GridUnnormal) + +/** +*@brief This operation unfold input X based on unnormalized grid, which is gennerated by GridUnnormal. + +*@par Inputs: +*@li x: 4-D Tensor with shape `[batch, channels, height, width]`. +*@li position: 4-D Tensor with shape `[batch, output_height, output_width, 2]`. + +*@par Attributes: +*@li padding_mode: An optional string specifying the pad method. Only 'zeros' is supported for now . + +*@par Outputs: +*y: Returns 4-D Tensor with the same dtype as `x`. +*/ +REG_OP(ImageUnfold) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(position, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(padding_mode, String, "zeros") + .OP_END_FACTORY_REG(ImageUnfold) + +/** +*@brief This operation select images to warp_images according to offsets. + +*@par Inputs: +*@li images: 4-D Tensor with shape `[batch, height, width, 3]`. +*@li offsets: 4-D Tensor with shape `[batch, 4, new_height, new_width]`. + +*@par Outputs: +*warp_images: Returns 5-D Tensor with shape +`[batch, 4, new_height, new_width, 3]` and the same dtype as `images`. +*/ +REG_OP(IMGWarpOffsets) + .INPUT(images, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT})) + .INPUT(offsets, TensorType({DT_FLOAT, DT_INT32})) + .OUTPUT(warp_images, TensorType({DT_UINT8, DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(IMGWarpOffsets) + +/** +*@brief This operation samples 3d input x by using interpolation based on flow field grid, + which is usually gennerated by affine_grid. + +*@par Inputs: +*@li x: 5-D Tensor with shape `[batch, channels, depth, height, width]`. +*@li grid: flow field grid, 5-D Tensor with shape `[batch, depth, height, width, 2]`. + +*@par Attributes: +*@li interpolation_mode: An optional string specifying the interpolation method. +*@li padding_mode: An optional string specifying the pad method. +*@li align_corners: An optional bool. If "true", the centers of the corner + pixels of the input and output tensors are aligned. Defaults to "false" . + +*@par Outputs: +*y: Returns 5-D Tensor with the same dtype as `x`. + +*@par Third-party framework compatibility +*Compatible with pytorch GridSampler3D operator. + +*@par Restrictions: +*Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(GridSampler3D) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .ATTR(interpolation_mode, String, "bilinear") + .ATTR(padding_mode, String, "zeros") + .ATTR(align_corners, Bool, false) + .OP_END_FACTORY_REG(GridSampler3D) +/** +*@brief Computes the gradients of GridSampler3D. + +*@par Inputs: +*@li grad: 5-D Tensor with shape `[batch, channels, depth, height, width]`. +*@li x: 5-D Tensor with shape `[batch, channels, depth, height, width]`. +*@li grid: flow field grid, 5-D Tensor with shape `[batch, depth, height, width, 2]`. + +*@par Attributes: +*@li interpolation_mode: An optional string specifying the interpolation method. +*@li padding_mode: An optional string specifying the pad method. +*@li align_corners: An optional bool. If "true", the centers of the corner + pixels of the input and output tensors are aligned. Defaults to "false" . + +*@par Outputs: +*dx: Returns 5-D Tensor with the same dtype and shape as `x`. +*dgrid: Returns 5-D Tensor with the same dtype and shape as `grid`. + +*@par Third-party framework compatibility +*Compatible with pytorch GridSampler3DGrad operator. + +*@par Restrictions: +*Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(GridSampler3DGrad) + .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .INPUT(grid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(dx, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(dgrid, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .ATTR(interpolation_mode, String, "bilinear") + .ATTR(padding_mode, String, "zeros") + .ATTR(align_corners, Bool, false) + .OP_END_FACTORY_REG(GridSampler3DGrad) + +} // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_IMAGE_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/internal_ops.h b/third_party/fwkacllib/inc/ops/internal_ops.h index 9dde14a5..bcc3f1c3 100644 --- a/third_party/fwkacllib/inc/ops/internal_ops.h +++ b/third_party/fwkacllib/inc/ops/internal_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/linalg_ops.h b/third_party/fwkacllib/inc/ops/linalg_ops.h index 7a6fbc59..69c77bf6 100644 --- a/third_party/fwkacllib/inc/ops/linalg_ops.h +++ b/third_party/fwkacllib/inc/ops/linalg_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -61,8 +61,8 @@ REG_OP(CholeskyGrad) *@par Inputs: *The input x has to be symmetric and positive definite.Inputs include: -*x:A Tensor. Must be one of the following types: double, float32. Shape -is [..., M, M] . \n +*x:A Tensor. Must be one of the following types: double, float32, float16, +complex64, complex128. Shape is [..., M, M] . \n *@par Outputs: *y:A Tensor. Has the same type as x . \n @@ -76,19 +76,40 @@ form square matrices. */ REG_OP(Cholesky) - .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE, \ + DT_FLOAT16, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, \ + DT_FLOAT16, DT_COMPLEX64, DT_COMPLEX128})) .OP_END_FACTORY_REG(Cholesky) /** +*@brief Computes the outer product of two 1D vectors . \n + +*@par Inputs: +*The input x1 and x2 has to be a 1D vector.Inputs include: +*@li x1:A Tensor. Must be one of the following types: float16, float32. +Shape is [N] . \n +*@li x2:A Tensor. Must have the same type as x. Shape is [M] . \n + +*@par Outputs: +*y:A Tensor. Has the same type as x . \n +*/ + +REG_OP(Ger) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(Ger) + +/** *@brief Computes the sign and the log of the absolute value of the determinant of one or more square matrices . \n *@par Inputs: *The input x is a tensor of shape [N, M, M] whose inner-most 2 dimensions form square matrices. Inputs include: -*x:A Tensor. Must be one of the following types: double, float32. Shape is -[..., M, M] . \n +*x:A Tensor. Must be one of the following types: double, float32, +complex64, complex128. Shape is [..., M, M] . \n *@par Outputs: *@li y:A Tensor. Has the same type as x. @@ -103,9 +124,9 @@ form square matrices. \n */ REG_OP(LogMatrixDeterminant) - .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(sign, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(sign, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .OP_END_FACTORY_REG(LogMatrixDeterminant) /** @@ -114,8 +135,8 @@ REG_OP(LogMatrixDeterminant) *@par Inputs: *The input x is a tensor of shape [N, M, M] whose inner-most 2 dimensions form square matrices. Inputs include: -*x:A Tensor. Must be one of the following types: double, float32. Shape is -[..., M, M] . \n +*x:A Tensor. Must be one of the following types: double, float32, complex64, +complex128. Shape is [..., M, M] . \n *@par Outputs: *y:A Tensor. Has the same type as x . \n @@ -129,8 +150,8 @@ form square matrices. */ REG_OP(MatrixDeterminant) - .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .OP_END_FACTORY_REG(MatrixDeterminant) /** @@ -140,8 +161,7 @@ their adjoints (conjugate transposes) . \n *@par Inputs: *The input x is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. Inputs include: -*x:A Tensor. Must be one of the following types: double, float. Shape is -[..., M, M] . \n +*x:A Tensor of input. Shape is [..., M, M] . \n *@par Attributes: *adjoint:An optional bool. Defaults to False.Boolean indicating whether to @@ -159,8 +179,8 @@ form square matrices. \n */ REG_OP(MatrixInverse) - .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .ATTR(adjoint, Bool, false) .OP_END_FACTORY_REG(MatrixInverse) @@ -169,8 +189,7 @@ REG_OP(MatrixInverse) *@par Inputs: *The input rhs must have the same type as matrix. Inputs include: -*@li matrix:A Tensor. Must be one of the following types: double, float. -Shape is [..., M, M]. +*@li matrix:A Tensor of input. Shape is [..., M, M]. *@li rhs:A Tensor. Must have the same type as matrix. Shape is [..., M, K] . \n *@par Attributes: @@ -189,9 +208,9 @@ dimensions form square matrices. \n */ REG_OP(MatrixSolve) - .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE})) - .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .ATTR(adjoint, Bool, false) .OP_END_FACTORY_REG(MatrixSolve) @@ -221,8 +240,8 @@ dimensions form square matrices. \n */ REG_OP(MatrixSolveLs) - .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE})) - .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .INPUT(l2, TensorType({DT_DOUBLE})) .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) .ATTR(fast, Bool, true) @@ -234,8 +253,7 @@ matrices by backsubstitution . \n *@par Inputs: *The input rhs must have the same type as matrix. Inputs include: -*@li matrix: A Tensor. Must be one of the following types: double, float. -Shape is [..., M, M]. +*@li matrix: A Tensor. Shape is [..., M, M]. *@li rhs:A Tensor. Must have the same type as matrix. Shape is [..., M, K] . \n *@par Attributes: @@ -256,9 +274,9 @@ dimensions form square matrices. \n */ REG_OP(MatrixTriangularSolve) - .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE})) - .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(matrix, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .ATTR(lower, Bool, true) .ATTR(adjoint, Bool, false) .OP_END_FACTORY_REG(MatrixTriangularSolve) @@ -268,8 +286,7 @@ REG_OP(MatrixTriangularSolve) *@par Inputs: *The input shape of x must be [..., M, N]. Inputs include: -*x:A Tensor whose shape is [..., M, N]. Must be one of the following types: -double, float . \n +*x:A Tensor whose shape is [..., M, N]. \n *@par Attributes: *full_matrices: An optional bool. Defaults to False. If true, compute @@ -289,9 +306,12 @@ dimensions form matrices of size [M, N]. \n */ REG_OP(Qr) - .INPUT(x, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE })) - .OUTPUT(q, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE })) - .OUTPUT(r, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE })) + .INPUT(x, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE, \ + DT_COMPLEX64, DT_COMPLEX128 })) + .OUTPUT(q, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE, \ + DT_COMPLEX64, DT_COMPLEX128 })) + .OUTPUT(r, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE, \ + DT_COMPLEX64, DT_COMPLEX128 })) .ATTR(full_matrices, Bool, false) .OP_END_FACTORY_REG(Qr) @@ -320,13 +340,41 @@ form square matrices. \n */ REG_OP(SelfAdjointEig) - .INPUT(x, TensorType({ DT_DOUBLE, DT_FLOAT })) - .OUTPUT(eigen_value, TensorType({ DT_DOUBLE, DT_FLOAT })) - .OUTPUT(eigen_vector, TensorType({ DT_DOUBLE, DT_FLOAT })) + .INPUT(x, TensorType({ DT_DOUBLE, DT_FLOAT, DT_COMPLEX64, DT_COMPLEX128 })) + .OUTPUT(eigen_value, TensorType({ DT_DOUBLE, DT_FLOAT, DT_COMPLEX64, DT_COMPLEX128 })) + .OUTPUT(eigen_vector, TensorType({ DT_DOUBLE, DT_FLOAT, DT_COMPLEX64, DT_COMPLEX128 })) .ATTR(compute_v, Bool, true) .OP_END_FACTORY_REG(SelfAdjointEig) /** +*@brief Computes the sign and the log of the absolute value of the determinant +of one or more square matrices . \n + +*@par Inputs: +*The input x is a tensor of shape [N, M, M] whose inner-most 2 dimensions +form square matrices. Inputs include: +*x:A Tensor. Must be one of the following types: double, float32, float16 +Shape is [..., M, M] . \n + +*@par Outputs: +*@li y:A Tensor. Has the same type as x. +*@li sign:A Tensor. Has the same type as x . \n + +*@attention Constraints: +*The input x is a tensor of shape [N, M, M] whose inner-most 2 dimensions +form square matrices. \n + +*@par Third-party framework compatibility +*Compatible with tensorflow LogMatrixDeterminant operator. +*/ + +REG_OP(Slogdet) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(sign, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OP_END_FACTORY_REG(Slogdet) + +/** *@brief Computes the singular value decompositions of one or more matrices . \n *@par Inputs: @@ -384,8 +432,8 @@ of the rows encoded as a list of indices in `0..M-1`. Shape is `[..., M]` . \n */ REG_OP(Lu) - .INPUT(input, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(lu, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(input, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(lu, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .OUTPUT(p, TensorType({DT_INT32, DT_INT64})) .REQUIRED_ATTR(output_idx_type, Type) .OP_END_FACTORY_REG(Lu) @@ -404,8 +452,8 @@ y: Shape is `[..., M, M]` . \n */ REG_OP(MatrixSquareRoot) - .INPUT(input, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(input, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .OP_END_FACTORY_REG(MatrixSquareRoot) /** @@ -424,9 +472,9 @@ y: Tensor of shape `[..., M, K]` containing the solutions \n */ REG_OP(TridiagonalSolve) - .INPUT(diagonals, TensorType({DT_FLOAT, DT_DOUBLE})) - .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(diagonals, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .INPUT(rhs, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128})) .ATTR(partial_pivoting, Bool, true) .OP_END_FACTORY_REG(TridiagonalSolve) diff --git a/third_party/fwkacllib/inc/ops/list_ops.h b/third_party/fwkacllib/inc/ops/list_ops.h new file mode 100644 index 00000000..a1b622e9 --- /dev/null +++ b/third_party/fwkacllib/inc/ops/list_ops.h @@ -0,0 +1,504 @@ +/** + * Copyright 2019 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. + */ + +/*! + * \file list_ops.h + * \brief + */ +#ifndef OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_ +#define OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_ + +#include +#include "graph/operator_reg.h" +#include "graph/operator.h" + +namespace ge { + +/** +*@brief Creates and returns an empty tensor list. \n + +*@par Inputs: +*@li element_shape: A shape compatible with that of elements in the list. +*@li max_num_elements: The maximum number of elements. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li handle: An empty tensor list . \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow EmptyTensorList operator. +*/ +REG_OP(EmptyTensorList) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .INPUT(max_num_elements, TensorType({DT_INT32})) + .OUTPUT(handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(EmptyTensorList) + +/** +*@brief Returns a list which has the passed-in `Tensor` as last element +and the other elements of the given list in `input_handle`. \n + +*@par Inputs: +*@li input_handle: The old list. +*@li tensor: The tensor to put on the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle:A list with the elements of old list followed by tensor. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListPushBack operator. +*/ +REG_OP(TensorListPushBack) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListPushBack) + +/** +*@brief The last element of the input list as well as a +list with all but that element. \n + +*@par Inputs: +*@li input_handle: The input list. +*@li element_shape: A shape compatible with that of elements in the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle:A list with the elements of the old list followed by tensor. +*@li tensor:The withdrawn last element of the list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListPopBack operator. +*/ +REG_OP(TensorListPopBack) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(element_shape, TensorType({DT_INT32})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListPopBack) + +/** +*@brief The number of tensors in the input tensor list. \n + +*@par Inputs: +*@li input_handle: The input list. \n + +*@par Outputs: +*@li length:The number of tensors in the list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListLength operator. +*/ +REG_OP(TensorListLength) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .OUTPUT(length, TensorType({DT_INT32})) + .OP_END_FACTORY_REG(TensorListLength) + +/** +*@brief The shape of elements in the input tensor list. \n + +*@par Inputs: +*@li input_handle: The input list. \n + +*@par Attributes: +*@li shape_type: The type of shape in the list. \n + +*@par Outputs: +*@li element_shape:A shape compatible with that of elements in the list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListElementShape operator. +*/ +REG_OP(TensorListElementShape) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .OUTPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .ATTR(shape_type, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListElementShape) + +/** +*@brief List of the given size with empty elements. \n + +*@par Inputs: +*@li element_shape: A shape compatible with that of elements in the list. +*@li num_elements: The number of elements to reserve. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. +*@li shape_type: The type of shape in the list. \n + +*@par Outputs: +*@li handle: An output tensor list . \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListReserve operator. +*/ +REG_OP(TensorListReserve) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .INPUT(num_elements, TensorType({DT_INT32})) + .OUTPUT(handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .ATTR(shape_type, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListReserve) + +/** +*@brief Get input tensor list elements of index position. \n + +*@par Inputs: +*@li input_handle: The input list. +*@li index: A tensor of position. +*@li element_shape: A shape compatible with that of elements in the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li item: An output tensor value of index position . \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListGetItem operator. +*/ +REG_OP(TensorListGetItem) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(index, TensorType({DT_INT32})) + .INPUT(element_shape, TensorType({DT_INT32})) + .OUTPUT(item, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListGetItem) + +/** +*@brief Sets the index-th position of the list to contain the given tensor. \n + +*@par Inputs: +*@li input_handle: The input list. +*@li index: The position in the list to which the tensor will be assigned. +*@li item: The element to be assigned to that position. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle: An output tensor list . \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListSetItem operator. +*/ +REG_OP(TensorListSetItem) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(index, TensorType({DT_INT32})) + .INPUT(item, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListSetItem) + +/** +*@brief Push tensor to list. \n + +*@par Inputs: +*@li input_handles: The input tensor lists. +*@li tensor: The tensor push into tensor list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handles: The output tensor lists. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListPushBackBatch operator. +*/ +REG_OP(TensorListPushBackBatch) + .INPUT(input_handles, TensorType({DT_VARIANT})) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(output_handles, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListPushBackBatch) + +/** +*@brief Stacks all tensors in the list. \n + +*@par Inputs: +*@li input_handle: The input tensor list. +*@li element_shape: A shape compatible with that of elements in the tensor. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. +*@li num_elements: The number of elements in the list. \n + +*@par Outputs: +*@li tensor: The tensor of list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListStack operator. +*/ +REG_OP(TensorListStack) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(element_shape, TensorType({DT_INT32})) + .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .ATTR(element_dtype, Type, DT_INT32) + .ATTR(num_elements, Int, -1) + .OP_END_FACTORY_REG(TensorListStack) + +/** +*@brief Concats all tensors in the list along the 0th dimension. +Requires that all tensors have the same shape except the first dimension. \n + +*@par Inputs: +*@li input_handle: The input list. +*@li element_shape: The shape of the uninitialized elements in the list. +If the first dimension is not -1, it is assumed that all list elements have +the same leading dim. +*@li leading_dims: The list of leading dims of uninitialized list elements. Used if +the leading dim of input_handle.element_shape or the element_shape input arg +is not already set. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li tensor: The concated result. +*@li lengths: Output tensor containing sizes of the 0th dimension of tensors +in the list, used for computing the gradient. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListConcatV2 operator. +*/ +REG_OP(TensorListConcatV2) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .INPUT(leading_dims, TensorType({DT_INT64})) + .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(lengths, TensorType({DT_INT64})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListConcatV2) + +/** +*@brief Splits a tensor into a list. \n + +*@par Inputs: +*@li tensor: The input tensor. +*@li element_shape: A shape compatible with that of elements in the tensor. +*@li lengths: Vector of sizes of the 0th dimension of tensors in the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle: The list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListSplit operator. +*/ +REG_OP(TensorListSplit) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .INPUT(lengths, TensorType({DT_INT64})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListSplit) + +/** +*@brief Creates a TensorList which, when stacked, has the value of `tensor`. \n + +*@par Inputs: +*@li tensor: The input tensor. +*@li element_shape: The shape of elements in the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle: An output tensor list . \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListFromTensor operator. +*/ +REG_OP(TensorListFromTensor) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListFromTensor) + +/** +*@brief Resizes the list. \n + +*@par Inputs: +*@li input_handle: The input tensor list. +*@li size: size of the output list. \n + +*@par Outputs: +*@li output_handle: The output tensor list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListResize operator. +*/ +REG_OP(TensorListResize) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(size, TensorType({DT_INT32})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .OP_END_FACTORY_REG(TensorListResize) + +/** +*@brief Creates a Tensor by indexing into the TensorList. \n + +*@par Inputs: +*@li input_handle: The input tensor list. +*@li indices: The indices used to index into the list. +*@li element_shape: The shape of elements in the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li values: The tensor. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListGather operator. +*/ +REG_OP(TensorListGather) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(element_shape, TensorType({DT_INT32})) + .OUTPUT(values, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListGather) + +/** +*@brief Creates a TensorList by indexing into a Tensor. \n + +*@par Inputs: +*@li tensor: The input tensor. +*@li indices: The indices used to index into the list. +*@li element_shape: The shape of the elements in the list (can be less specified than +the shape of the tensor). +*@li num_elements: The size of the output list. Must be large enough to accommodate +the largest index in indices. If -1, the list is just large enough to include +the largest index in indices. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle: The TensorList. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListScatterV2 operator. +*/ +REG_OP(TensorListScatterV2) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(element_shape, TensorType({DT_INT32,DT_INT64})) + .INPUT(num_elements, TensorType({DT_INT32})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListScatterV2) + +/** +*@brief Scatters tensor at indices in an input list. \n + +*@par Inputs: +*@li input_handle: The input tensor list. +*@li tensor: The input tensor. +*@li indices: The indices used to index into the list. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output_handle: The TensorList. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListScatterIntoExistingList operator. +*/ +REG_OP(TensorListScatterIntoExistingList) + .INPUT(input_handle, TensorType({DT_VARIANT})) + .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8, + DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8, + DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL, + DT_STRING,DT_COMPLEX64,DT_COMPLEX128})) + .INPUT(indices, TensorType({DT_INT32})) + .OUTPUT(output_handle, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListScatterIntoExistingList) + +/** +*@brief Concat two tensor lists to a new tensor list. \n + +*@par Inputs: +*@li input_a: The input tensor list A. +*@li input_b: The input tensor list B. \n + +*@par Attributes: +*@li element_dtype: The type of elements in the list. \n + +*@par Outputs: +*@li output: The output list. \n + +*@par Third-party framework compatibility. +*Compatible with tensorflow TensorListConcatLists operator. +*/ +REG_OP(TensorListConcatLists) + .INPUT(input_a, TensorType({DT_VARIANT})) + .INPUT(input_b, TensorType({DT_VARIANT})) + .OUTPUT(output, TensorType({DT_VARIANT})) + .ATTR(element_dtype, Type, DT_INT32) + .OP_END_FACTORY_REG(TensorListConcatLists) +} // namespace ge + +#endif // OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/logging_ops.h b/third_party/fwkacllib/inc/ops/logging_ops.h index bc8ae2b8..03be7757 100644 --- a/third_party/fwkacllib/inc/ops/logging_ops.h +++ b/third_party/fwkacllib/inc/ops/logging_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/lookup_ops.h b/third_party/fwkacllib/inc/ops/lookup_ops.h index b37ab048..5d928e5a 100644 --- a/third_party/fwkacllib/inc/ops/lookup_ops.h +++ b/third_party/fwkacllib/inc/ops/lookup_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/math_ops.h b/third_party/fwkacllib/inc/ops/math_ops.h index 149e0e37..319bcf70 100644 --- a/third_party/fwkacllib/inc/ops/math_ops.h +++ b/third_party/fwkacllib/inc/ops/math_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -223,6 +223,24 @@ REG_OP(Bucketize) .OP_END_FACTORY_REG(Bucketize) /** +*@brief Returns a new tensor with the truncated integer values of the elements of input. \n + +*@par Inputs: +*One inputs, including: +* @li input_x: A tensor. Must be one of the following types: float16, float32, int8, uint8, int32. \n + +*@par Outputs: +*y: A tensor with the same type and shape of input_x \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Trunc. \n +*/ +REG_OP(Trunc) + .INPUT(input_x, TensorType({DT_FLOAT16,DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8})) + .OUTPUT(output_y, TensorType({DT_FLOAT16,DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8})) + .OP_END_FACTORY_REG(Trunc) + +/** *@brief Computes the sum along sparse segments of a tensor . \n *@par Inputs: @@ -366,6 +384,27 @@ REG_OP(GetNext) .OP_END_FACTORY_REG(GetNext) /** +*@brief Get dynamic dims after GetNext. \n + +*@par Inputs: +*input: A nested structure of Tensor objects, from GetNext's output. \n + +*@par Attributes: +*@li shape_info: GE shape_info for each inputs, -1 means unknow dim. +*@li N: Inputs number. \n + +*@par Outputs: +*dims: GE unknow dims, a vector of int64. \n +*/ + +REG_OP(GetDynamicDims) + .DYNAMIC_INPUT(input, TensorType({DT_INT32, DT_INT64})) + .OUTPUT(dims, TensorType({DT_INT32, DT_INT64})) + .REQUIRED_ATTR(shape_info, ListInt) + .REQUIRED_ATTR(N, Int) + .OP_END_FACTORY_REG(GetDynamicDims) + +/** *@brief End of sequence . \n *@par Inputs: @@ -495,6 +534,29 @@ REG_OP(NextAfter) .OP_END_FACTORY_REG(NextAfter) /** +*@brief Calculate the P-norm distance between vectors function. \n + +*@par Inputs: +*One inputs, including: +* @li input_x: A tensor. Must be one of the following types: +* float16, float32. \n + +*@par Attributes: +*@li p: An optional float.Defaults to 2. \n + +*@par Outputs: +*y: A Tensor with the same type and shape of input_x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Pdist. \n +*/ +REG_OP(Pdist) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(p, Float, 2.0) + .OP_END_FACTORY_REG(Pdist) + +/** *@brief Compute element-wise finiteness, return a boolean tensor. *@par Inputs: @@ -624,6 +686,7 @@ REG_OP(NLLLoss) .OUTPUT(y, TensorType({DT_FLOAT})) .OUTPUT(total_weight, TensorType({DT_FLOAT})) .ATTR(reduction, String, "mean") + .ATTR(ignore_index, Int, -100) .OP_END_FACTORY_REG(NLLLoss) /** @@ -653,6 +716,7 @@ REG_OP(NLLLossGrad) .INPUT(total_weight, TensorType({DT_FLOAT})) .OUTPUT(x_grad, TensorType({DT_FLOAT})) .ATTR(reduction, String, "mean") + .ATTR(ignore_index, Int, -100) .OP_END_FACTORY_REG(NLLLossGrad) /** @@ -710,6 +774,9 @@ REG_OP(IFMR) *@par Third-party framework compatibility *Compatible with mindspore + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(WtsARQ) @@ -741,6 +808,9 @@ REG_OP(WtsARQ) *@par Third-party framework compatibility *Compatible with mindspore + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(ActsULQ) @@ -748,8 +818,8 @@ REG_OP(ActsULQ) .INPUT(clamp_min, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(clamp_max, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) - .OUTPUT(clamp_min_mask, TensorType({DT_BOOL})) - .OUTPUT(clamp_max_mask, TensorType({DT_BOOL})) + .OUTPUT(clamp_min_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) + .OUTPUT(clamp_max_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) .OUTPUT(x_clamped_loss, TensorType({DT_FLOAT16, DT_FLOAT})) .ATTR(fixed_min, Bool, false) .ATTR(num_bits, Int, 8) @@ -768,12 +838,15 @@ REG_OP(ActsULQ) *@par Third-party framework compatibility *Compatible with mindspore + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(ActsULQInputGrad) .INPUT(y_grad, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(clamp_min_mask, TensorType({DT_BOOL})) - .INPUT(clamp_max_mask, TensorType({DT_BOOL})) + .INPUT(clamp_min_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) + .INPUT(clamp_max_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) .OUTPUT(x_grad, TensorType({DT_FLOAT16, DT_FLOAT})) .OP_END_FACTORY_REG(ActsULQInputGrad) @@ -790,11 +863,14 @@ REG_OP(ActsULQInputGrad) *@par Third-party framework compatibility *Compatible with mindspore + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(ActULQClampMaxGrad) .INPUT(y_grad, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(clamp_max_mask, TensorType({DT_BOOL})) + .INPUT(clamp_max_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) .INPUT(x_clamped_loss, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(clamp_max_grad, TensorType({DT_FLOAT16, DT_FLOAT})) .OP_END_FACTORY_REG(ActULQClampMaxGrad) @@ -812,15 +888,208 @@ REG_OP(ActULQClampMaxGrad) *@par Third-party framework compatibility *Compatible with mindspore + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(ActULQClampMinGrad) .INPUT(y_grad, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(clamp_min_mask, TensorType({DT_BOOL})) + .INPUT(clamp_min_mask, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT})) .INPUT(x_clamped_loss, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(clamp_min_grad, TensorType({DT_FLOAT16, DT_FLOAT})) .OP_END_FACTORY_REG(ActULQClampMinGrad) +/** +* @brief Computes Lp norm. + +* @par Inputs: +* @li x: An ND tensor of type float16, float32. \n +* +* @par Attributes: +* @li p: Int, "inf" or "-inf", default value is 2. +* @li axes: ListInt, {} means all axes will be computed. +* @li keepdim: Bool, default is false. +* @li epsilon: Float, default is 1e-12. \n + +* @par Outputs: +* @li y: An ND tensor of type float16, float32. The shape of y is depending +* on axes and keepdim. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator LpNorm. +*/ +REG_OP(LpNorm) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(p, Int, 2) + .ATTR(axes, ListInt, {}) + .ATTR(keepdim, Bool, false) + .ATTR(epsilon, Float, 1e-12) + .OP_END_FACTORY_REG(LpNorm) + +/** +* @brief get complex. + +* @par Inputs: +* @li real: An ND tensor of type float32. double +* @li imag: An ND tensor of type float32. double \n +* +* @par Outputs: +* @li out: An ND tensor of type complex64, complex128 \n +*/ +REG_OP(Complex) + .INPUT(real, TensorType({DT_FLOAT, DT_DOUBLE})) + .INPUT(imag, TensorType({DT_FLOAT, DT_DOUBLE})) + .OUTPUT(out, TensorType({DT_COMPLEX64, DT_COMPLEX128})) + .ATTR(Tout, Type, DT_COMPLEX64) + .OP_END_FACTORY_REG(Complex) + +/** +* @brief deal complex. + +* @par Inputs: +* @li input: An ND tensor of type complex64, complex128 \n +* +* @par Outputs: +* @li output: An ND tensor of type float32. double \n +*/ +REG_OP(Imag) + .INPUT(input, TensorType({DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(output, TensorType({DT_FLOAT, DT_DOUBLE})) + .ATTR(Tout, Type, DT_FLOAT) + .OP_END_FACTORY_REG(Imag) + +/** +* @brief deal complex. + +* @par Inputs: +* @li input: An ND tensor of type complex64, complex128 \n +* +* @par Outputs: +* @li output: An ND tensor of type float32. double \n +*/ +REG_OP(Angle) + .INPUT(input, TensorType({DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(output, TensorType({DT_FLOAT, DT_DOUBLE})) + .ATTR(Tout, Type, DT_FLOAT) + .OP_END_FACTORY_REG(Angle) + +/** +*@brief Computes the gradient of SoftMarginLossGrad. \n + +*@par Inputs: +*Three inputs, including: +* @li predict: A tensor. Must be one of the following types: +* float16, float32. \n +* @li label: A tensor with same shape of predict. Must be one of the following types: +* float16, float32. \n +* @li dout: A tensor with same shpae of predcit. Must be one of the following types: +* float16, float32. \n + +*@par Attributes: +* @li reduction: Specifies the reduction to apply to the output: +* 'none' | 'mean' | 'sum'. Default: 'mean'. \n + +*@par Outputs: +* gradient: A Tensor with the same type of predict. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator SoftMarginLoss Backward. \n +*/ +REG_OP(SoftMarginLossGrad) + .INPUT(predict, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(label, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(dout, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(gradient, TensorType({DT_FLOAT16,DT_FLOAT})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(SoftMarginLossGrad) + +/** +*@brief Calculate the cross product of two tensors. \n + +*@par Inputs: +*One inputs, including: +* @li x1: A tensor. Must be one of the following types: +* float16, float32, int32, int8, uint8, int16. \n +* @li x2: A tensor. Must be one of the following types: +* float16, float32, int32, int8, uint8, int16. \n + +*@par Attributes: +*@li dim: the dimination of compute.Defaults to -65530. \n + +*@par Outputs: +*y: A Tensor with the same type and shape of x1's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator cross. \n +*/ +REG_OP(Cross) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8, DT_INT16})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8, DT_INT16})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8, DT_INT16})) + .ATTR(dim, Int, -65530) + .OP_END_FACTORY_REG(Cross) + +/** + *@brief Computes batched the p-norm distance between each pair of + *the two collections of row vectors. \n + + *@par Inputs: + *Two inputs, including: + * @li x1: A tensor with shpae: BxPXM. Must be one of the following types: + * float16, float32. \n + * @li x2: A tensor with shpae: BxRxM. Must be one of the following types: + * float16, float32. \n + + *@par Attributes: + * @li p: An optional float >= 0 or inf. Defaults to 2.0. \n + + *@par Outputs: + * y: A Tensor with the same type of x1's and with shape BxPxR. \n + + *@par Third-party framework compatibility + *Compatible with the Pytorch operator Cdist. \n + */ +REG_OP(Cdist) + .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(p, Float, 2.0) + .OP_END_FACTORY_REG(Cdist) + +/** +*@brief Computes the grad of x1 in cdist. \n + +*@par Inputs: +*Four inputs, including: + * @li grad: Grad with shape BxPxR. Must be one of the following types: +* float16, float32. \n +* @li x1: A tensor with shpae: BxPXM. Must be one of the following types: +* float16, float32. \n +* @li x2: A tensor with shpae: BxRxM. Must be one of the following types: +* float16, float32. \n +* @li cdist: Output tensor of cdist forward with shpae: BxPXR. +* Must be one of the following types: float16, float32. \n + +*@par Attributes: +* @li p: An optional float >= 0 or inf. Defaults to 2.0. \n + +*@par Outputs: +* y: A Tensor with the same type and shape of x1's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Cdist Backward. \n +*/ +REG_OP(CdistGrad) + .INPUT(grad, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x1, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x2, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(cdist, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .ATTR(p, Float, 2.0) + .OP_END_FACTORY_REG(CdistGrad) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_MATH_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h b/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h index ed23d3f6..b317be37 100644 --- a/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -38,8 +38,8 @@ namespace ge { * float32, int32. Has format [ND, NHWC] . \n *@par Attributes: -*@li transpose_a: A bool. If True, changes the shape of "x1" from [M, K] to [K, M]. -*@li transpose_b: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n +*@li transpose_x1: A bool. If True, changes the shape of "x1" from [M, K] to [K, M]. +*@li transpose_x2: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n *@par Outputs: *y: The result matrix Tensor. 2D. Must be one of the following types: float16, @@ -70,8 +70,8 @@ REG_OP(MatMul) * float32, int32. Has format [ND, NHWC] . \n *@par Attributes: -*@li transpose_a: A bool. If True, changes the shape of "x1" from [M, K] to [K, M]. -*@li transpose_b: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n +*@li transpose_x1: A bool. If True, changes the shape of "x1" from [M, K] to [K, M]. +*@li transpose_x2: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n *@par Outputs: *y: The result matrix Tensor. 2D. Must be one of the following types: float16, @@ -91,6 +91,36 @@ REG_OP(MatMulV2) .ATTR(offset_x, Int, 0) .OP_END_FACTORY_REG(MatMulV2) +/** +*@brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n + +*@par Inputs: +*Two inputs, including: +* @li x1: A matrix Tensor. 2D. Must be one of the following types: int8. +* @li x2: A matrix Tensor. 2D. Must be one of the following types: int8. +* @li compress_index: A compress index matrix of type int8. +* @li bias: A 1D Tensor. Must be one of the following types: int32, float16. + +*@par Attributes: +*@li transpose_x1: A bool. If True, changes the shape of "x1" from [M, K] to [K, M]. +*@li transpose_x2: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n + +*@par Outputs: +*y: The result matrix Tensor. 2D. Must be one of the following types: float16, +* int32. \n + +*/ +REG_OP(MatMulV2Compress) + .INPUT(x1, TensorType({DT_INT8})) + .INPUT(x2, TensorType({DT_INT8})) + .INPUT(compress_index, TensorType({DT_INT8})) + .OPTIONAL_INPUT(bias, TensorType({DT_INT32, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_INT32, DT_FLOAT16})) + .OPTIONAL_INPUT(offset_w, TensorType({DT_INT8})) + .ATTR(transpose_x1, Bool, false) + .ATTR(transpose_x2, Bool, false) + .ATTR(offset_x, Int, 0) + .OP_END_FACTORY_REG(MatMulV2Compress) /** *@brief Performs Matrix-to-matrix Multiply, producing c=alpha[0]*a*b+beta[0]*c . \n @@ -149,15 +179,15 @@ REG_OP(GEMM) *@brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n *@par Inputs: -*Three inputs, including: +*Two inputs, including: * @li x1: A matrix Tensor. Must be one of the following types: float16, * float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ]. * @li x2: A matrix Tensor. Must be one of the following types: float16, * float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ] . \n *@par Attributes: -*@li adj_x: A bool. If True, changes the shape of "x1" from [B, M, K] to [B, K, M]. -*@li adj_y: A bool. If True, changes the shape of "x2" from [B, M, K] to [B, K, M] . \n +*@li adj_x1: A bool. If True, changes the shape of "x1" from [B, M, K] to [B, K, M]. +*@li adj_x2: A bool. If True, changes the shape of "x2" from [B, M, K] to [B, K, M] . \n *@par Outputs: *y: The result matrix Tensor. 2D or higher. Must be one of the following types: float16, @@ -175,6 +205,42 @@ REG_OP(BatchMatMul) .ATTR(adj_x2, Bool, false) .OP_END_FACTORY_REG(BatchMatMul) + +/** +* @brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n + +* @par Inputs: +* Three inputs, including: +* @li x1: A matrix Tensor. Must be one of the following types: float16, +* float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ]. +* @li x2: A matrix Tensor. Must be one of the following types: float16, +* float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ] . \n +* @li bias: A matrix Tensor. Must be one of the following types: float16, +* float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ] . \n + +* @par Attributes: +* @li adj_x1: A bool. If True, changes the shape of "x1" from [B, M, K] to [B, K, M]. +* @li adj_x2: A bool. If True, changes the shape of "x2" from [B, M, K] to [B, K, M] . \n + +* @par Outputs: +* y: The result matrix Tensor. 2D or higher. Must be one of the following types: float16, +* float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ]. Has the same shape length as "x1" and "x2" . \n + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator BatchMatmul. +*/ + +REG_OP(BatchMatMulV2) + .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8})) + .OPTIONAL_INPUT(bias, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32})) + .OPTIONAL_INPUT(offset_w, TensorType({DT_INT8})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32})) + .ATTR(adj_x1, Bool, false) + .ATTR(adj_x2, Bool, false) + .ATTR(offset_x, Int, 0) + .OP_END_FACTORY_REG(BatchMatMulV2) + /** *@brief Computes half the L2 norm of a tensor without the sqrt . \n @@ -334,7 +400,7 @@ REG_OP(MatrixSetDiagD) * int64, complex64, qint8, quint8, qint32, uint16, complex128, half, uint32, * uint64 *@li indices: An ND Tensor. -*Must be one of the following types: int32, int64 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. *Must be one of the following types: float16, float32, int8, uint8, double, * int64, complex64, qint8, quint8, qint32, uint16, complex128, half, uint32, @@ -378,6 +444,9 @@ REG_OP(ScatterNdUpdate) *@par Third-party framework compatibility * Compatible with the TensorFlow operator TensorScatterUpdate. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(TensorScatterUpdate) .INPUT(x, TensorType::BasicType()) @@ -387,6 +456,34 @@ REG_OP(TensorScatterUpdate) .OP_END_FACTORY_REG(TensorScatterUpdate) /** +*@brief Uses "updates" to update tensor "data" by "indices". \n + +*@par Inputs: +* Three inputs, including: +*@li data: An ND Tensor . \n +*Must be one of the following types: float16, float32, int32, int8, uint8 +*@li indices: An ND Tensor of type int32 or int64 +*@li updates: An Tensor. Same shape as indices. format:NCHW, NHWC . \n +*Must be one of the following types: float16, float32, int32, int8, uint8 + +*@par Attributes: +*@li axis: An optional attribute. Defaults to 0. + +*@par Outputs: +*y: A Tensor. Has the same type and format as input "data" . \n + +*@par Third-party framework compatibility +* Compatible with the ONNX operator ScatterElements. +*/ +REG_OP(ScatterElements) + .INPUT(data, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(indices, TensorType::IndexNumberType()) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .ATTR(axis, Int, 0) + .OP_END_FACTORY_REG(ScatterElements) + +/** *@brief Adds sparse "updates" to a variable reference . \n *@par Inputs: @@ -394,7 +491,7 @@ REG_OP(TensorScatterUpdate) *@li var: An ND Tensor . \n *Must be one of the following types: float16, float32, int32, int8, uint8 -*@li indices: An ND Tensor of type int32 or int64. +*@li indices: An ND Tensor of type int32 or int64 *@li updates: An Tensor. format:NCHW, NHWC . \n @@ -412,10 +509,10 @@ REG_OP(TensorScatterUpdate) * Compatible with the TensorFlow operator ScatterAdd. */ REG_OP(ScatterAdd) - .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .INPUT(indices, TensorType::IndexNumberType()) - .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterAdd) @@ -428,7 +525,7 @@ REG_OP(ScatterAdd) *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 @@ -443,10 +540,10 @@ REG_OP(ScatterAdd) * Compatible with the TensorFlow operator ScatterDiv. */ REG_OP(ScatterDiv) - .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .INPUT(indices, TensorType({DT_INT32})) - .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(indices, TensorType::IndexNumberType()) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterDiv) @@ -458,7 +555,7 @@ REG_OP(ScatterDiv) *@li var: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@par Attributes: @@ -472,10 +569,10 @@ REG_OP(ScatterDiv) * Compatible with the TensorFlow operator ScatterNdAdd. */ REG_OP(ScatterNdAdd) - .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .INPUT(indices, TensorType::IndexNumberType()) - .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterNdAdd) @@ -499,6 +596,9 @@ REG_OP(ScatterNdAdd) *@par Third-party framework compatibility * Compatible with the TensorFlow operator TensorScatterAdd. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(TensorScatterAdd) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) @@ -515,7 +615,7 @@ REG_OP(TensorScatterAdd) *@li var: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32, int64 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 @@ -530,10 +630,10 @@ REG_OP(TensorScatterAdd) * Compatible with the TensorFlow operator ScatterNdSub. */ REG_OP(ScatterNdSub) - .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .INPUT(indices, TensorType::IndexNumberType()) - .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterNdSub) @@ -557,6 +657,9 @@ REG_OP(ScatterNdSub) *@par Third-party framework compatibility * Compatible with the TensorFlow operator TensorScatterSub. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(TensorScatterSub) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) @@ -573,7 +676,7 @@ REG_OP(TensorScatterSub) *@li var: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32, int64 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@par Attributes: @@ -587,10 +690,10 @@ REG_OP(TensorScatterSub) * Compatible with the TensorFlow operator ScatterSub. */ REG_OP(ScatterSub) - .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .INPUT(indices, TensorType::IndexNumberType()) - .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterSub) @@ -761,7 +864,7 @@ REG_OP(ConfusionMatrix) *@li var: An ND Tensor. *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor . \n *Must be one of the following types: float16, float, int32, int8, uint8 @@ -778,7 +881,7 @@ REG_OP(ConfusionMatrix) */ REG_OP(ScatterMul) .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) - .INPUT(indices, TensorType({DT_INT32})) + .INPUT(indices, TensorType::IndexNumberType()) .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) @@ -791,13 +894,13 @@ REG_OP(ScatterMul) *@par Inputs: * Three inputs, including: *@li var: An ND Tensor. -*Must be one of the following types: float16, float, int32 +*Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor. -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor. -*Must be one of the following types: float16, float, int32 +*Must be one of the following types: float16, float, int32, int8, uint8 *@par Attributes: *use_locking: An optional bool. Defaults to "False". If "True", the operation @@ -810,10 +913,10 @@ REG_OP(ScatterMul) * Compatible with the TensorFlow operator ScatterMin. */ REG_OP(ScatterMin) - .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) - .INPUT(indices, TensorType({DT_INT32})) - .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) - .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(indices, TensorType::IndexNumberType()) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterMin) @@ -824,13 +927,13 @@ REG_OP(ScatterMin) * Three inputs, including: *@li var: An ND Tensor . \n -*Must be one of the following types: float16, float, int32 +*Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An NCHW, NHWC, or ND Tensor . \n -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An NCHW, NHWC, or ND Tensor . \n -*Must be one of the following types: float16, float, int32 +*Must be one of the following types: float16, float, int32, int8, uint8 *@par Attributes: *use_locking: An optional bool. Defaults to "False". @@ -843,10 +946,10 @@ REG_OP(ScatterMin) * Compatible with the TensorFlow operator ScatterMax. */ REG_OP(ScatterMax) - .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) - .INPUT(indices, TensorType({DT_INT32})) - .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) - .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(indices, TensorType::IndexNumberType()) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterMax) @@ -860,7 +963,7 @@ REG_OP(ScatterMax) *Must be one of the following types: float16, float, int32, int8, uint8 *@li indices: An ND Tensor . \n -*Must be one of the following types: int32 +*Must be one of the following types: int32 or int64 *@li updates: An ND Tensor . \n *Must be one of the following types: float16, float, int32, int8, uint8 @@ -876,10 +979,10 @@ REG_OP(ScatterMax) * Compatible with the TensorFlow operator ScatterUpdate. */ REG_OP(ScatterUpdate) - .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8})) - .INPUT(indices, TensorType({DT_INT32})) - .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8})) - .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8})) + .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .INPUT(indices, TensorType::IndexNumberType()) + .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .ATTR(use_locking, Bool, false) .OP_END_FACTORY_REG(ScatterUpdate) @@ -979,6 +1082,137 @@ REG_OP(MatrixDiagV2) .OUTPUT(output, TensorType::BasicType()) .OP_END_FACTORY_REG(MatrixDiagV2) +/** +* @brief Add updates to var_out according to axis and indices. + +* @par Inputs: +* Three inputs, including: +* @li var: A Tensor. Must be one of the following types: +* float16, float32, int32, int8, uint8. +* @li indices: A Tensor of the indices, type should be int32. +* @li updates: A Tensor of the same type as "var". + +* @par Attributes: +* @li axis: An required int to specify the axis to perform indices add. + +* @par Outputs: +* @li var_out: A Tensor. Same as input "var". + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator index_add. + +* @par Restrictions: +* Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(IndexAdd) + .INPUT(var, TensorType({DT_INT32, DT_INT8, DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(updates, TensorType({DT_INT32, DT_INT8, DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .OUTPUT(var_out, TensorType({DT_INT32, DT_INT8, DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .ATTR(axis, Int, 0) + .OP_END_FACTORY_REG(IndexAdd) + +/** +*@brief: Returns the upper triangular part of a matrix (2-D tensor) or batch of matrices input \n + +*@par Inputs: +* Two inputs, including: +*@li x: A Tensor. Must be one of the following types: +* float16, float32, double, int32, uint8, int16, int8, complex64, int64, +* qint8, quint8, qint32, uint16, complex128, uint32, uint64. +*@li diagonal:(int, optional) – the diagonal to consider。\n + +*@par Outputs: +*y: A Tensor. Has the same type as "x" . \n + +*@par Third-party framework compatibility +* Compatible with the Pytorch operator Triu. +*/ +REG_OP(Triu) + .INPUT(x, TensorType::BasicType()) + .ATTR(diagonal, Int, 0) + .OUTPUT(y, TensorType::BasicType()) + .OP_END_FACTORY_REG(Triu) + +/** +*@brief: Returns the upper triangular part of a matrix (2-D tensor) or batch of matrices input \n + +*@par Inputs: +* Two inputs, including: +*@li x: A Tensor. Must be one of the following types: +* float16, float32, double, int32, uint8, int16, int8, complex64, int64, +* qint8, quint8, qint32, uint16, complex128, uint32, uint64. +*@li diagonal:(int, optional) – the diagonal to consider。\n + +*@par Outputs: +*y: A Tensor. Has the same type as "x" . \n + +*@par Third-party framework compatibility +* Compatible with the Pytorch operator Tril. +*/ +REG_OP(Tril) + .INPUT(x, TensorType::BasicType()) + .ATTR(diagonal, Int, 0) + .OUTPUT(y, TensorType::BasicType()) + .OP_END_FACTORY_REG(Tril) +/** +*@brief Concatenates a list of N tensors along the first dimension. +*@par Inputs: +* Two inputs, including: +* @li values: A list of Tensors. Must be one of the following types: int32, float16, float32. +* Tensors to be concatenated. All must have size 1 in the first dimension and same shape. +* It's a dynamic input. +* @li shape: A Tensor of the same type as "x". +* The final shape of the result. Should be equal to the shapes of any input +* but with the number of input values in the first dimension . \n + +*@par Attributes: +*equation: The subscripts for the Einstein summation. \n +*N: tensor size of input \n + +*@par Outputs: +*@li y: Sums the product of the elements of the input operands along dimensions specified + using a notation based on the Einstein summation convention. \n + +*@attention Constraints: +*Input N must be Int. \n + +*@par Third-party framework compatibility +*Compatible with Pytorch einsum operator. +*/ +REG_OP(Einsum) + .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .REQUIRED_ATTR(equation, String) + .REQUIRED_ATTR(N, Int) + .OP_END_FACTORY_REG(Einsum) + +/** +*@brief Returns a 2-D tensor with ones on the diagonal and zeros elsewhere. \n + +*@par Inputs: +*No inputs + +*@par Attributes: +*@li num_rows: An required int. \n +*@li num_columns: An optional int.Defaults to 0. \n +*@li batch_shape: An optional ListInt.Defaults to []. \n +*@li dtype: An optional int.Defaults to 0. \n + +*@par Outputs: +*y: A Tensor with targeted type and shape. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Eye. \n +*/ +REG_OP(Eye) + .OUTPUT(y, TensorType::BasicType()) /* "Result, has targeted element type" */ + .REQUIRED_ATTR(num_rows, Int) + .ATTR(num_columns, Int, 0) + .ATTR(batch_shape, ListInt, {}) + .ATTR(dtype, Int, 0) + .OP_END_FACTORY_REG(Eye) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_MATRIX_CALCULATION_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h b/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h index 0c6a5dff..9629976e 100644 --- a/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -145,6 +145,64 @@ REG_OP(BatchNorm) *@brief Performs batch normalization . \n *@par Inputs: +* Five inputs, including: (NHWC, NCHW, or NC1HWC0 supported) +*@li x: A 3D or 6D Tensor of type float16 or float32, with format NDHWC or NCDHW for 4D or NDC1HWC0 for 6D. +*@li scale: A Tensor of type float32. Must be 1D if input "x" is with format NDHWC or NCDHW. Must be 6D +if input "x" is with format NDC1HWC0. Specifies the scaling factor. +*@li offset: A Tensor of type float32. Must be 3D if input "x" is with format NDHWC or NCDHW. Must be 6D +if input "x" is with format NC1HWC0. Specifies the offset. +*@li mean: A Tensor of type float32. Must be 3D if input "x" is with format NDHWC or NCDHW. Must be 6D +if input "x" is with format NC1HWC0. Specifies the mean used for inference. Must be "None" if the +operation is used for training. +*@li variance: A Tensor of type float32. Must be 3D if input "x" is with format NHWC or NCHW. Must be +5D if input "x" is with format NC1HWC0. Specifies the variance used for inference. Must be "None" +if the operation is used for training . \n + +*@par Attributes: +*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.0001". +*@li data_format: An optional string, specifying the format of "x". Defaults to "NHWC". +*@li is_training: An optional bool, specifying if the operation is used for training or inference. Defaults to "True" . \n + +*@par Outputs: +* Five outputs, including: (NHWC, NCHW, or NC1HWC0 supported) +*@li y: A 3D or 6D Tensor of type float16 or float32 for the normalized "x", with format NDHWC or NCDHW for 4D or NDC1HWC0 for 6D. +*@li batch_mean: A Tensor of type float32. Must be 3D if input "x" is with format NDHWC or NCDHW. Must be 6D +if input "x" is with format NDC1HWC0. Specifies the mean of "x". +*@li batch_variance: A Tensor of type float32. Must be 1D if input "x" is with format NDHWC or NCDHW. +Must be 6D if input "x" is with format NDC1HWC0. Specifies the variance of "x". +*@li reserve_space_1: An optional Tensor of type float32. Must be 1D if input "x" is with format NDHWC or NCDHW. +Must be 6D if input "x" is with format NDC1HWC0. Specifies the mean of "x" for gradient computation. Pass "None" to skip this output. +*@li reserve_space_2: An optional Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. +Must be 6D if input "x" is with format NDC1HWC0. Specifies the variance of "x" for gradient computation. Pass "None" to skip this output . \n + +*@attention Constraints: +*@li If the operation is used for inference and outputs "reserve_space_1" and "reserve_space_2" are available, +then "reserve_space_1" has the same value as "mean" and "reserve_space_2" has the same value as "variance". +*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction . \n + +*@par Third-party framework compatibility +*@li Compatible with the TensorFlow operator fused_batch_norm. +*@li Compatible with the TensorFlow operator fused_batch_norm_v2. +*/ +REG_OP(BatchNorm3D) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(scale, TensorType({DT_FLOAT})) + .INPUT(offset, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(mean, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(variance, TensorType({DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(batch_mean, TensorType({DT_FLOAT})) + .OUTPUT(batch_variance, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_1, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_2, TensorType({DT_FLOAT})) + .ATTR(epsilon, Float, 0.0001) + .ATTR(data_format, String, "NCDHW") + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(BatchNorm3D) +/** +*@brief Performs batch normalization . \n + +*@par Inputs: * Five inputs, including: (NHWC or NCHW supported) *@li x: A 4D Tensor of type float16 or float32. *@li scale: A 1D Tensor of type float32, for the scaling factor. @@ -244,6 +302,52 @@ REG_OP(BatchNormGrad) *@par Inputs: * Five inputs, including: +*@li y_backprop: A 3D or 6D Tensor of type float16 or float32, with format NDHWC, NCDHW, or NDC1HWC0, for the gradient. +*@li x: A 3D or 6D Tensor of type float16 or float32, with format NDHWC, NCDHW, or NDC1HWC0. +*@li scale: A 3D or 6D Tensor of type float32, with format NDHWC, NCDHW, or NDC1HWC0. +*@li reserve_space_1: A 3D or 6D Tensor of type float32, with format NDHWC, NCDHW, or NC1HWC0. It is an output of BatchNorm. +*@li reserve_space_2: A 3D or 6D Tensor of type float32, with format NDHWC, NCDHW, or NC1HWC0. It is an output of BatchNorm . \n + +*@par Attributes: +*@li epsilon: An optional float32. Defaults to "0.0001". A small float number added to the variance of "x". +*@li data_format: An optional string. Defaults to "NCDHW". +*@li is_training: An optional bool. Defaults to "true". Specifies the operation is for training (default) or inference . \n + +*@par Outputs: +*@li x_backprop: A Tensor of type float16 or float32, with format NHWC, NCHW, or NC1HWC0, for the offset of "x". +*@li scale_backprop: A Tensor of type float32, with format NDHWC, NCDHW, or NDC1HWC0, for the offset of "scale". +*@li *offset_backprop: A Tensor of type float32, with format NDHWC, NCDHW, or NDC1HWC0, for the offset of "offset". +*@li *reserve_space_4: A Tensor of type float32, with shape NDHWC, NCDHW, or NDC1HWC0. Pass "None" to skip this output. +*@li *reserve_space_5: A Tensor of type float32, with shape NDHWC, NCDHW, or NDC1HWC0. Pass "None" to skip this output . \n + +*@attention Constraints: +* The preceding layer of this operator must be operator BatchNorm . \n + +*@see BatchNorm +*@par Third-party framework compatibility +* Compatible with the TensorFlow operators FusedBatchNormGradV2 and FusedBatchNorm3DGrad. +*/ +REG_OP(BatchNorm3DGrad) + .INPUT(y_backprop, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(scale, TensorType({DT_FLOAT})) + .INPUT(reserve_space_1, TensorType({DT_FLOAT})) + .INPUT(reserve_space_2, TensorType({DT_FLOAT})) + .OUTPUT(x_backprop, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(scale_backprop, TensorType({DT_FLOAT})) + .OUTPUT(offset_backprop, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_4, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_5, TensorType({DT_FLOAT})) + .ATTR(epsilon, Float, 0.0001) + .ATTR(data_format, String, "NCDHW") + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(BatchNorm3DGrad) + +/** +*@brief Performs the backpropagation of BatchNorm . \n + +*@par Inputs: +* Five inputs, including: *@li y_backprop: A 4D Tensor of type float16 or float32, with format NHWC or NCHW, for the gradient. *@li x: A 4D Tensor of type float16 or float32, with format NHWC or NCHW. *@li scale: A 4D Tensor of type float32, with format NHWC or NCHW. @@ -315,35 +419,7 @@ REG_OP(BNInference) .ATTR(use_global_stats, Bool,true) .ATTR(mode, Int,1) .OP_END_FACTORY_REG(BNInference) -/** -*@brief aicpu batch normalization host . \n -*@par Inputs: - -*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x" Specifies the mean used for inference. -*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x" Specifies the variance used for inference. -*@li momentum: An optional float, mean and variance's Scale factor -*@par Attributes: -*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.00001". -*@li use_global_stats: mean inference mode , only can be "True". -*@li mode: An optional attr, not use -*@par Outputs: -*@li alpha: A Tensor of type float16 or float32 for the cpu calculate mean -*@li beta: A Tensor of type float16 or float32 for the cpu calculate variance -*/ -REG_OP(BnHost) - .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16})) - .INPUT(variance, TensorType({DT_FLOAT, DT_FLOAT16})) - .INPUT(momentum, TensorType({DT_FLOAT16,DT_FLOAT})) - .OPTIONAL_INPUT(scale, TensorType({DT_FLOAT16,DT_FLOAT})) - .OPTIONAL_INPUT(offset, TensorType({DT_FLOAT16,DT_FLOAT})) - .ATTR(epsilon, Float, 0.00001) - .ATTR(mode, Int, 1) - .ATTR(use_global_stats, Bool, true) - .OUTPUT(alpha, TensorType({DT_FLOAT, DT_FLOAT16})) - .OUTPUT(beta, TensorType({DT_FLOAT, DT_FLOAT16})) - .OUTPUT(mu, TensorType({DT_FLOAT16,DT_FLOAT})) - .OP_END_FACTORY_REG(BnHost) /** *@brief Performs batch normalization . \n diff --git a/third_party/fwkacllib/inc/ops/nn_calculation_ops.h b/third_party/fwkacllib/inc/ops/nn_calculation_ops.h index 35296870..98473c65 100644 --- a/third_party/fwkacllib/inc/ops/nn_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -365,6 +365,25 @@ REG_OP(BiasAddGrad) * 4-D with shape [batch, out_height, out_width, out_channels] * or [batch, out_channels, out_height, out_width]. * Gradients with respect to the output of the convolution. + *\n + *\n + * The following are the supported data types and data formats: +*@verbatim + | Tensor | out_bckprop | filter | y + ------------|-------------|---------|-------- + | Data Type | float16 | float16 | float16 + | |-------------|---------|-------- + | | float32 | float32 | float32 + | |-------------|---------|-------- + | | float64 | float64 | float64 + ------------|-------------|---------|-------- + | Format | NCHW | NCHW | NCHW + | | NHWC | HWCN | NHWC +@endverbatim + * For float32 and float64 type, the actual calculation on the chip is based on + * float16. + *\n + * *@par Attributes: * Five attributes: * @li strides: A tuple/list of 4 integers. The stride of the sliding window @@ -377,8 +396,53 @@ REG_OP(BiasAddGrad) * channels. * @li data_format: An optional string from: "NHWC", "NCHW". Defaults to * "NHWC". Specify the data format of the input and output data. + *\n + *\n + * The following value range restrictions must be met: +*@verbatim + | Name | Field | Scope + -------------------|----------|-------------- + | input_size | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Filter | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | out_backprop | H*strideH| [1, 4096] + | | W*strideW| [1, 4096] + -------------------|----------|-------------- + | y(fmap) | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Stride | H | [1, 63] + | | W | [1, 63] + -------------------|----------|-------------- + | Padding | Top | [0, 255] + | | Bottom | [0, 255] + | | Left | [0, 255] + | | Right | [0, 255] + -------------------|----------|-------------- + | Dilation | H | [1, 255] + | | W | [1, 255] + +@endverbatim + * In Ascend910, fmap or out_backprop's H and W not support 1 when + * fmap_h + pad_top + pad_bottom != (filter_height - 1) * dilation_h + 1 + * If filter_h = 1 and filter_w = 1, out_backprop_w * stride_h * stride_w < 4096 + *\n + * *@par Outputs: * y: A Tensor. Has the same type as filter,and has same format as input_size. + *\n + * out_backprop_height = (fmap_height + pad_top + pad_bottom - + * (dilation_h * (filter_height - 1) + 1)) + * / stride_h + 1 + *\n + * out_backprop_width = (fmap_width + pad_left + pad_right - + * (dilation_w * (filter_width - 1) + 1)) + * / stride_w + 1 + *\n + * *@par Third-party framework compatibility * Compatible with Tensorflow's conv2d_backprop_input */ @@ -454,6 +518,21 @@ REG_OP(Conv2DBackpropInputD) * @li bias: An optional tensor. Must have the same type as "y". * @li offset_w: An optional 1D tensor for quantized deconvolution. * Type is int8. Reserved.\n + *\n + *\n + * The following are the supported data types and data formats: +*@verbatim + | Tensor | x | filter | bias | y + ------------|---------|---------|---------|-------- + | Data Type | float16 | float16 | float16 | float16 + | |---------|---------|---------|-------- + | | int8 | int8 | int32 | int32 + ------------|---------|---------|---------|-------- + | Format | NCHW | NCHW | ND | NCHW +@endverbatim + * For int8, a dequant or requant operator must be followed. + *\n + * *@par Attributes: * Six attributes: * @li strides: A tuple or list of 2 integers. The stride of the sliding window @@ -467,9 +546,54 @@ REG_OP(Conv2DBackpropInputD) * @li data_format: An optional string from: "NCHW". Defaults to "NCHW". \n Specify the data format of the input and output data. * @li offset_x: An optional integer for quantized deconvolution. - * Defaults to "0". + * The negative offset added to the input image for int8 type. Ensure offset_x + * within the effective range of int8 [-128, 127]. Defaults to "0". + *\n + *\n + * The following value range restrictions must be met: +*@verbatim + | Name | Field | Scope + -------------------|----------|-------------- + | x (out_backprop) | H*strideH| [1, 4096] + | | W*strideW| [1, 4096] + -------------------|----------|-------------- + | Filter | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | y (fmap) | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Stride | H | [1, 63] + | | W | [1, 63] + -------------------|----------|-------------- + | Padding | Top | [0, 255] + | | Bottom | [0, 255] + | | Left | [0, 255] + | | Right | [0, 255] + -------------------|----------|-------------- + | Dilation | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | Offset_x | | [-128, 127] + +@endverbatim + * In Ascend910, fmap or out_backprop's H and W not support 1 when + * fmap_h + pad_top + pad_bottom != (filter_height - 1) * dilation_h + 1 + * If filter_h = 1 and filter_w = 1, out_backprop_w * stride_h * stride_w < 4096 + *\n + * *@par Outputs: * y: A Tensor. 4D tensor with shape [batch, channels, height, width]. + *\n + * out_backprop_height = (fmap_height + pad_top + pad_bottom - + * (dilation_h * (filter_height - 1) + 1)) + * / stride_h + 1 + *\n + * out_backprop_width = (fmap_width + pad_left + pad_right - + * (dilation_w * (filter_width - 1) + 1)) + * / stride_w + 1 + *\n + * * When type of x is float16, the type of y must be float16. * When type of x is int8, the type of y must be int32. */ @@ -502,6 +626,25 @@ REG_OP(Deconvolution) * [batch, out_height, out_width, out_channels] or [batch, out_channels, * out_height, out_width]. Gradients with respect to the output of the * convolution. + *\n + *\n + * The following are the supported data types and data formats: +*@verbatim + | Tensor | x | out_backprop | y + ------------|---------|--------------|--------- + | Data Type | float16 | float16 | float16 + | |---------|--------------|--------- + | | float32 | float32 | float32 + | |---------|--------------|--------- + | | float64 | float64 | float64 + |-----------|---------|--------------|--------- + | Format | NCHW | NCHW | NCHW + | | NHWC | NHWC | HWCN +@endverbatim + * For float32 and float64 type of x and outbackprop, the actual calculation on the chip + * is based on float16. + *\n + * *@par Attributes: * Five attributes: * @li strides: A tuple/list of 4 integers. The stride of the sliding window @@ -514,8 +657,52 @@ REG_OP(Deconvolution) * channels. * @li data_format: An optional string from: "NHWC", "NCHW". Defaults to * "NHWC". Specify the data format of the input and output data. + *\n +*\n +* The following value range restrictions must be met: +*@verbatim + | Name | Field | Scope + -------------------|----------|-------------- + | x(fmap) | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Filter Size | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | out_backprop | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | y | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Stride | H | [1, 63] + | | W | [1, 63] + -------------------|----------|-------------- + | Padding | Top | [0, 255] + | | Bottom | [0, 255] + | | Left | [0, 255] + | | Right | [0, 255] + -------------------|----------|-------------- + | Dilation | H | [1, 255] + | | W | [1, 255] + +@endverbatim + * In Ascend910, out_backprop's H and W not support 1 when + * fmap_h + pad_top + pad_bottom != (filter_height - 1) * dilation_h + 1 + *\n + * *@par Outputs: * y: A Tensor. Has the same type as x, has the same format as filter_size. + *\n + * out_backprop_height = (in_height + pad_top + pad_bottom - + * (dilation_h * (filter_height - 1) + 1)) + * / stride_h + 1 + *\n + * out_backprop_width = (in_width + pad_left + pad_right - + * (dilation_w * (filter_width - 1) + 1)) + * / stride_w + 1 + *\n + * *@par Third-party framework compatibility * Compatible with Tensorflow's conv2d_backprop_filter */ @@ -597,16 +784,14 @@ REG_OP(Conv2DBackpropFilterD) | Tensor | x | filter | bias | y ------------|---------|---------|---------|-------- | Data Type | float16 | float16 | float16 | float16 - | |---------|---------|---------|-------- | | float32 | float32 | float32 | float32 - | |---------|---------|---------|-------- | | int8 | int8 | int32 | int32 ------------|---------|---------|---------|-------- | Format | NCHW | NCHW | ND | NCHW | | NHWC | HWCN | | NHWC @endverbatim * For float32 type, the actual calculation on the chip is based on -* float16. For int8, a dequant or requant operator must be followed. +* float16. *\n * *@par Attributes: @@ -617,8 +802,7 @@ REG_OP(Conv2DBackpropFilterD) * (top, bottom, left, right) side of the input. *@li dilations: Optional. A list of 4 integers. The dilation factor for each * dimension of input. The dimension order is determined by the data format of -* "x". The N and C dimensions must be set to 1. The H and W dimensions must be -* set to 1 for int8 type. Defaults to [1, 1, 1, 1]. +* "x". The N and C dimensions must be set to 1. Defaults to [1, 1, 1, 1]. *@li groups: Optional. An integer of type int32. The number of blocked * connections from input channels to output channels. In_channels and * out_channels must both be divisible by "groups". Defaults to 1. @@ -652,6 +836,8 @@ REG_OP(Conv2DBackpropFilterD) | Offset_x | | [-128, 127] @endverbatim +* The W dimension of the input image supports cases exceeding 4096, but it may +* cause compilation errors. *\n * *@par Outputs: @@ -666,21 +852,6 @@ REG_OP(Conv2DBackpropFilterD) * out_width = (in_width + pad_left + pad_right - * (dilation_w * (filter_width - 1) + 1)) * / stride_w + 1 -* -*@attention Constraints: -*@li The following restrictions on the output must be met: -*@verbatim - | Output | Restrictions - ----------|-------------------------------- - | H == 1 | H * W(input) == H * W(filter) - | W == 1 | - ----------|-------------------------------- - | H != 1 | W(input) == W(filter) - | W == 1 | Only for Ascend310 Hi3796V300CS -@endverbatim -* "H * W (input)" indicates the image size after padding and "H * W (filter)" -* indicates the filter size after dilation."W(input)" and W(filter) indicate -* the same rule on the W dimension. *\n * *@par Quantization supported or not @@ -778,7 +949,7 @@ REG_OP(Conv2DCompress) * With the format "HWCN" , the data is stored in the order of: [filter_height, * filter_width, in_channels / groups, out_channels]. *@li offsets: A 4D tensor of x-y coordinates offset and mask. With the format -* "NHWC", the data is stored in the order of: [batch, in_height, in_width, +* "NHWC", the data is stored in the order of: [batch, out_height, out_width, * deformable_groups * filter_height * filter_width * 3]. *@li bias: An optional 1D tensor of additive biases to the filter outputs. * The data is stored in the order of: [out_channels]. @@ -816,31 +987,20 @@ REG_OP(Conv2DCompress) *@li deformable_groups: Optional. An integer of type int32. The number of * deformable group partitions. In_channels must be divisible by * "deformable_groups". Defaults to 1. +*@li modulated: Optional. Specify version of DeformableConv2D, true means v2, +* false means v1, currently only support v2. *\n *\n * The following value range restrictions must be met: *@verbatim | Name | Field | Scope --------------------|--------|---------------------------- - | Input Image Size | H | [1, 100000] - | | W | [1, 4096] - --------------------|--------|---------------------------- - | Filter Size | H | [1, 255] - | | W | [1, 255] + | Input Image Size | H | [1, 100000 / filter_height] + | | W | [1, 4096 / filter_width] --------------------|--------|---------------------------- - | Stride | H | [1, 63] + | Filter Size | H | [1, 63] | | W | [1, 63] - --------------------|--------|---------------------------- - | Padding | Top | [0, 255] - | | Bottom | [0, 255] - | | Left | [0, 255] - | | Right | [0, 255] - ------------ -------|--------|---------------------------- - | Dilation | H | [1, 255] - | | W | [1, 255] @endverbatim -* "W(input)" indicate the image width after padding and W(filter) indicates the -* filter width after dilation. *\n * *@par Outputs: @@ -855,21 +1015,7 @@ REG_OP(Conv2DCompress) * out_width = (in_width + pad_left + pad_right - * (dilation_w * (filter_width - 1) + 1)) * / stride_w + 1 -* -*@attention Constraints: -*@li The following restrictions on the output must be met: -*@verbatim - | Output | Restrictions - ----------|-------------------------------- - | H == 1 | H * W(input) == H * W(filter) - | W == 1 | - ----------|-------------------------------- - | H != 1 | W(input) == W(filter) - | W == 1 | Only for Ascend310 Hi3796V300CS -@endverbatim -* "H * W(input)" indicates the image size after padding and "H * W(filter)" -* indicates the filter size after dilation. "W(input)" and W(filter) indicate -* the same rule on the W dimension. +*\n * *@par Quantization supported or not *@li No @@ -891,6 +1037,7 @@ REG_OP(DeformableConv2D) .ATTR(groups, Int, 1) .ATTR(data_format, String, "NHWC") .ATTR(deformable_groups, Int, 1) + .ATTR(modulated, Bool, true) .OP_END_FACTORY_REG(DeformableConv2D) /** @@ -916,12 +1063,12 @@ REG_OP(DeformableConv2D) *@par Attributes: * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. * @li dilations: A list of 5 integers. Specifies the dilation factor for each - * dimension of "x", now only support [1,1,1,1,1] - * The N and C dimensions must be 1. Has the same format as "x". + * dimension of "x". + * The N, C and D dimensions must be 1. Has the same format as "x". * @li offset_x: An optional int. Input offset, used for quantized inference. * Defaults to 0. Reserved . \n @@ -967,8 +1114,8 @@ REG_OP(Conv3D) *@par Required Attributes: * @li strides: A list of 5 integers. Specifies the stride of the sliding window - * for each dimension of "x". - * The N and C dimensions must be 1. Has the same format as "x". + * for each dimension of "out_backprop". + * The N and C dimensions must be 1. Has the same format as "out_backprop". * @li pads: A list of 6 integers. * Supports only padding along the D, H and W dimensions in sequence of head, * tail, top, bottom, left and right . \n @@ -976,14 +1123,15 @@ REG_OP(Conv3D) *@par Attributes: * Three attributes: * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. * @li dilations: A tuple/list of 5 integers, The dilation factor for each - * dimension of the input, now only support [1,1,1,1,1] + * dimension of the input. + * The N, C and D dimensions must be 1. Has the same format as "out_backprop". *@par Outputs: - * y: A Tensor. Has the same type as filter,and has same format as input_size + * y: A Tensor. Has the same type as filter,and has same format as "input_size" *@par Third-party framework compatibility * Compatible with Tensorflow's conv3d_backprop_input @@ -1011,8 +1159,8 @@ REG_OP(Conv3DBackpropInput) *@par Required Attributes: * @li strides: A list of 5 integers. Specifies the stride of the sliding window - * for each dimension of "x". - * The N and C dimensions must be 1. Has the same format as "x". + * for each dimension of "out_backprop". + * The N and C dimensions must be 1. Has the same format as "out_backprop". * @li pads: A list of 6 integers. Supports only padding along the D, H and W * dimensions in sequence of head, tail, top, bottom, left and right. * @li input_size: A tuple/list of type int32, int64. An integer vector @@ -1023,13 +1171,14 @@ REG_OP(Conv3DBackpropInput) *@par Attributes: * Three attributes: * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. * @li dilations: A tuple/list of 5 integers, The dilation factor for each - * dimension of input, now only support [1,1,1,1,1] + * dimension of input. + * The N, C and D dimensions must be 1. Has the same format as "out_backprop". *@par Outputs: - * y: A Tensor. Has the same type and data format as out_backprop. + * y: A Tensor. Has the same type and data format as "out_backprop". *@par Third-party framework compatibility * Compatible with Tensorflow's conv3d_backprop_input @@ -1072,9 +1221,7 @@ REG_OP(Conv3DBackpropInputD) * @li c_t: A optinal Tensor dtype of float16, float32. The cell state at time t . \n *@par Third-party framework compatibility: -* Compatible with the Pytorch operator adds. -*@par Restrictions: -*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +* Compatible with the Caffe operator LSTM. */ REG_OP(LSTM) .INPUT(x, TensorType({DT_FLOAT16})) @@ -1121,14 +1268,15 @@ REG_OP(LSTM) *@par Attributes: * Three attributes: * @li dilations: A tuple/list of 5 integers, The dilation factor for each - * dimension of input, now only support [1,1,1,1,1]. + * dimension of input. + * The N, C and D dimensions must be 1. Has the same format as "x". * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. *@par Outputs: - * y: A Tensor that has the same type as x + * y: A Tensor that has the same type as "x" * and the format is NDHWC, NCDHW or DHWCN. *@par Third-party framework compatibility * Compatible with Tensorflow's conv3d_backprop_filter @@ -1172,9 +1320,10 @@ REG_OP(Conv3DBackpropFilter) *@par Attributes: * Three attributes: * @li dilations: A tuple/list of 5 integers, The dilation factor for each - * dimension of input, now only support [1,1,1,1,1]. + * dimension of input. + * The N, C and D dimensions must be 1. Has the same format as "x". * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. @@ -1224,15 +1373,16 @@ REG_OP(Conv3DBackpropFilterD) *@par Attributes: * Five attributes: * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li dilations: A tuple/list of 5 integers, - * The dilation factor for each dimension of input, now only support [1,1,1,1,1] + * The dilation factor for each dimension of input. + * The N, C and D dimensions must be 1. Has the same format as "x". * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. * @li output_padding: The size will be added in the output shape. * @li offset_x: Input offset_x value. Reserved. *@par Outputs: - * y: A Tensor. Has the same type and format as x. + * y: A Tensor. Has the same type and format as "x". */ REG_OP(Conv3DTranspose) .INPUT(input_size, TensorType({DT_INT32, DT_INT64})) @@ -1273,15 +1423,16 @@ REG_OP(Conv3DTranspose) *@par Attributes: * Five attributes: * @li dilations: A tuple/list of 5 integers, The dilation factor for each - * dimension of input, now only support [1,1,1,1,1] + * dimension of input. + * The N, C and D dimensions must be 1. Has the same format as "x". * @li groups: Number of blocked connections from input channels to output - * channels. Reserved. + * channels. * @li data_format: An optional string from: "NDHWC", "NCDHW". * Defaults to "NDHWC". Specify the data format of the input and output data. * @li output_padding: The size will be added in the output shape. * @li offset_x: Input offset_x value. Reserved. *@par Outputs: - * y: A Tensor. Has the same type and format as x. + * y: A Tensor. Has the same type and format as "x". *@par Restrictions: * Warning: THIS FUNCTION IS DEPRECATED. Please use Conv3DTranspose instead. */ @@ -1316,6 +1467,22 @@ REG_OP(Conv3DTransposeD) * or [out_channels, in_channel, filter_height, filter_width]. * @li bias: An optional 1D tensor of type float16 or int32. Format is "ND". * @li offset_w: An optional 1D tensor for quantized inference. Reserved. + *\n + *\n + * The following are the supported data types and data formats: +*@verbatim + | Tensor | x | filter | bias | y + ------------|---------|---------|---------|-------- + | Data Type | float16 | float16 | float16 | float16 + | |---------|---------|---------|-------- + | | int8 | int8 | int32 | int32 + ------------|---------|---------|---------|-------- + | Format | NCHW | NCHW | ND | NCHW + | | NHWC | HWCN | | NHWC +@endverbatim + * For int8, a dequant or requant operator must be followed. + *\n + * *@par Required Attributes: * @li strides: A required tuple/list of 4 integers. The stride of the sliding * window for H/W dimension. The index of H/W is same as data_format. @@ -1333,10 +1500,58 @@ REG_OP(Conv3DTransposeD) * @li output_padding: The size will be added in the output shape. Defaults * to [0, 0, 0, 0]. * @li offset_x: An optional int. Input offset, used for quantized inference. - * Defaults to "0". + * The negative offset added to the input image for int8 type. Ensure offset_x + * within the effective range of int8 [-128, 127]. Defaults to "0". + *\n + *\n + * The following value range restrictions must be met: +*@verbatim + | Name | Field | Scope + -------------------|----------|-------------- + | input_size | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | x (out_backprop) | H*strideH| [1, 4096] + | | W*strideW| [1, 4096] + -------------------|----------|-------------- + | filter | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | y (fmap) | H | [1, 4096] + | | W | [1, 4096] + -------------------|----------|-------------- + | Stride | H | [1, 63] + | | W | [1, 63] + -------------------|----------|-------------- + | Padding | Top | [0, 255] + | | Bottom | [0, 255] + | | Left | [0, 255] + | | Right | [0, 255] + -------------------|----------|-------------- + | Dilation | H | [1, 255] + | | W | [1, 255] + -------------------|----------|-------------- + | Offset_x | | [-128, 127] + +@endverbatim + * In Ascend910, fmap or out_backprop's H and W not support 1 when + * fmap_h + pad_top + pad_bottom != (filter_height - 1) * dilation_h + 1 + * If filter_h = 1 and filter_w = 1, out_backprop_w * stride_h * stride_w < 4096 + *\n + * *@par Outputs: * y: A Tensor. A Tensor of type float16 or int32, and has same format as * input_size. + *\n + * out_backprop_height = (fmap_height + pad_top + pad_bottom - + * (dilation_h * (filter_height - 1) + 1)) + * / stride_h + 1 + *\n + * out_backprop_width = (fmap_width + pad_left + pad_right - + * (dilation_w * (filter_width - 1) + 1)) + * / stride_w + 1 + *\n + * */ REG_OP(Conv2DTranspose) .INPUT(input_size, TensorType({DT_INT32, DT_INT64})) @@ -1405,21 +1620,22 @@ REG_OP(Conv2DTransposeD) /** *@brief Computes the deformed convolution output with the expected input *@par Inputs: - * Four inputs: + * Two inputs: * @li x: A Tensor of type float16,float32 * @li offsets: A Tensor of type float16,float32.Deformation offset parameter. *@par Required Attributes: * @li strides: A tuple/list of 4 integers.The stride of the sliding window for * height and width for H/W dimension. - * @li pads: A tuple/list of 4 integers.Padding added to each dimension + * @li pads: A tuple/list of 4 integers.Padding added to H/W dimension * of the input. * @li ksize: A tuple/list of 2 integers.kernel size. *@par Attributes: - * Three attributes: + * Four attributes: * @li dilations: A tuple/list of 4 integers, The dilation factor for each dimension * of input. Defaults to [1, 1, 1, 1] * @li data_format: An optional string from: "NCHW", "NHWC". Defaults to "NCHW". Specify the data format of the input x. * @li deformable_groups: Specify the c-axis grouping number of input x. + * @li modulated: Specify version of DeformableConv2D, true means v2, false means v1 *@par Outputs: * y: A Tensor. A Tensor of type float16, float32. */ @@ -1433,7 +1649,69 @@ REG_OP(DeformableOffsets) .ATTR(dilations, ListInt, {1, 1, 1, 1}) .ATTR(data_format, String, "NCHW") .ATTR(deformable_groups, Int, 1) + .ATTR(modulated, Bool, true) .OP_END_FACTORY_REG(DeformableOffsets) +/** +*@brief Computes the gradients of DeformableOffsets with respect to input and offsets +*@par Inputs: + * Three inputs: + * @li grad: A Tensor of type float16,float32. gradients with respect to DeformableOffsets output + * @li x: A Tensor of type float16,float32. + * @li offsets: A Tensor of type float16,float32.Deformation offset parameter. +*@par Required Attributes: + * @li strides: A tuple/list of 4 integers.The stride of the sliding window for + * height and width for H/W dimension. + * @li pads: A tuple/list of 4 integers.Padding added to H/W dimension + * of the input. + * @li ksize: A tuple/list of 2 integers.kernel size. +*@par Attributes: + * Three attributes: + * @li dilations: A tuple/list of 4 integers, The dilation factor for each dimension + * of input. Defaults to [1, 1, 1, 1] + * @li data_format: An optional string from: "NCHW", "NHWC". Defaults to "NCHW". Specify the data format of the input x. + * @li deformable_groups: Specify the c-axis grouping number of input x. + * @li modulated: Specify version of DeformableConv2D, true means v2, false means v1. +*@par Outputs: + * grad_x: A Tensor of type float16, float32. Gradients with respect to input_x + * grad_offsets: A Tensor of type float16, float32. Gradients with respect to input_offsets +*/ +REG_OP(DeformableOffsetsGrad) + .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(offsets, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(grad_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(grad_offsets, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .REQUIRED_ATTR(ksize, ListInt) + .ATTR(dilations, ListInt, {1, 1, 1, 1}) + .ATTR(data_format, String, "NCHW") + .ATTR(deformable_groups, Int, 1) + .ATTR(modulated, Bool, true) + .OP_END_FACTORY_REG(DeformableOffsetsGrad) + +/** +*@brief Computes the deformed dilation output with the expected input +*@par Inputs: + * One inputs: + * @li x: A Tensor of type int8, float16, float32 +*@par Required Attributes: + * @li dilations: A tuple/list of integers. +*@par Attributes: + * Two attributes: + * @li padding_value: default value filling in blank + * @li pads: A tuple/list of integers. +*@par Outputs: + * y: A Tensor. A Tensor of type int8, float16, float32. +*/ +REG_OP(Dilation) + .INPUT(x, TensorType({DT_INT8, DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_INT8, DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(dilations, ListInt) + .ATTR(pads, ListInt, {}) + .ATTR(padding_value, Float, 0.0) + .OP_END_FACTORY_REG(Dilation) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_CALCULATION_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/nn_detect_ops.h b/third_party/fwkacllib/inc/ops/nn_detect_ops.h index a013fb33..5fa40ad6 100644 --- a/third_party/fwkacllib/inc/ops/nn_detect_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_detect_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -254,22 +254,22 @@ is min_size/sqrt(aspect_ratio), the width is min_size*sqrt(aspect_ratio). Defaul *@par Third-party framework compatibility * It is a custom operator. It has no corresponding operator in Caffe. */ - REG_OP(PriorBox) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) - .REQUIRED_ATTR(min_size, ListFloat) - .REQUIRED_ATTR(max_size, ListFloat) - .REQUIRED_ATTR(aspect_ratio, ListFloat) - .ATTR(img_h, Int, 0) - .ATTR(img_w, Int, 0) - .ATTR(step_h, Float, 0.0) - .ATTR(step_w, Float, 0.0) - .ATTR(flip, Bool, true) - .ATTR(clip, Bool, false) - .ATTR(offset, Float, 0.5) - .ATTR(variance, ListFloat, {0.1}) - .OP_END_FACTORY_REG(PriorBox); +REG_OP(PriorBox) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(min_size, ListFloat) + .REQUIRED_ATTR(max_size, ListFloat) + .REQUIRED_ATTR(aspect_ratio, ListFloat) + .ATTR(img_h, Int, 0) + .ATTR(img_w, Int, 0) + .ATTR(step_h, Float, 0.0) + .ATTR(step_w, Float, 0.0) + .ATTR(flip, Bool, true) + .ATTR(clip, Bool, false) + .ATTR(offset, Float, 0.5) + .ATTR(variance, ListFloat, {0.1}) + .OP_END_FACTORY_REG(PriorBox); /** *@brief Performs SSD prior box detection, with four additional matrices and the "aspect_ratio" attribute deleted compared to PriorBox . \n @@ -306,25 +306,25 @@ is min_size/sqrt(aspect_ratio), the width is min_size*sqrt(aspect_ratio). Defaul *@par Restrictions: *Warning: THIS FUNCTION IS DEPRECATED. Please use PriorBox instead. */ - REG_OP(PriorBoxD) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(data_h, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(data_w, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(box_height, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(box_width, TensorType({DT_FLOAT16, DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) - .REQUIRED_ATTR(min_size, ListFloat) - .REQUIRED_ATTR(max_size, ListFloat) - .ATTR(img_h, Int, 0) - .ATTR(img_w, Int, 0) - .ATTR(step_h, Float, 0.0) - .ATTR(step_w, Float, 0.0) - .ATTR(flip, Bool, true) - .ATTR(clip, Bool, false) - .ATTR(offset, Float, 0.5) - .ATTR(variance, ListFloat, {0.1}) - .OP_END_FACTORY_REG(PriorBoxD); +REG_OP(PriorBoxD) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(data_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(data_w, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(box_height, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(box_width, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(min_size, ListFloat) + .REQUIRED_ATTR(max_size, ListFloat) + .ATTR(img_h, Int, 0) + .ATTR(img_w, Int, 0) + .ATTR(step_h, Float, 0.0) + .ATTR(step_w, Float, 0.0) + .ATTR(flip, Bool, true) + .ATTR(clip, Bool, false) + .ATTR(offset, Float, 0.5) + .ATTR(variance, ListFloat, {0.1}) + .OP_END_FACTORY_REG(PriorBoxD); /** *@brief Performs SSD prior box detection, with four additional matrices and the "aspect_ratio" attribute deleted compared to PriorBox . \n @@ -358,22 +358,22 @@ is min_size/sqrt(aspect_ratio), the width is min_size*sqrt(aspect_ratio). Defaul *@par Restrictions: *Warning: THIS FUNCTION IS DEPRECATED. Please use PriorBox instead. */ - REG_OP(PriorBoxDV2) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) - .REQUIRED_ATTR(min_size, ListFloat) - .REQUIRED_ATTR(max_size, ListFloat) - .ATTR(img_h, Int, 0) - .ATTR(img_w, Int, 0) - .ATTR(step_h, Float, 0.0) - .ATTR(step_w, Float, 0.0) - .ATTR(flip, Bool, true) - .ATTR(clip, Bool, false) - .ATTR(offset, Float, 0.5) - .ATTR(variance, ListFloat, {0.1}) - .OP_END_FACTORY_REG(PriorBoxDV2); +REG_OP(PriorBoxDV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(min_size, ListFloat) + .REQUIRED_ATTR(max_size, ListFloat) + .ATTR(img_h, Int, 0) + .ATTR(img_w, Int, 0) + .ATTR(step_h, Float, 0.0) + .ATTR(step_w, Float, 0.0) + .ATTR(flip, Bool, true) + .ATTR(clip, Bool, false) + .ATTR(offset, Float, 0.5) + .ATTR(variance, ListFloat, {0.1}) + .OP_END_FACTORY_REG(PriorBoxDV2); /** *@brief Performs Position Sensitive ROI Pooling . \n @@ -531,10 +531,10 @@ as xx...xyy...yww...whh...hbb...bc0c0..c0c1c1...c1......cncn...cn . \n * It is a custom operator. It has no corresponding operator in Caffe. */ REG_OP(Yolo) - .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) - .OUTPUT(coord_data, TensorType({DT_FLOAT16,DT_FLOAT})) - .OUTPUT(obj_prob, TensorType({DT_FLOAT16,DT_FLOAT})) - .OUTPUT(classes_prob, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(coord_data, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(obj_prob, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(classes_prob, TensorType({DT_FLOAT16, DT_FLOAT})) .ATTR(boxes, Int, 3) .ATTR(coords, Int, 4) .ATTR(classes, Int, 80) @@ -584,10 +584,10 @@ REG_OP(Yolo) * It is a custom operator. It has no corresponding operator in Caffe. */ REG_OP(YoloV2DetectionOutput) - .INPUT(coord_data, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(img_info, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(coord_data, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img_info, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases, ListFloat) .ATTR(boxes, Int, 5) .ATTR(coords, Int, 4) @@ -598,7 +598,7 @@ REG_OP(YoloV2DetectionOutput) .ATTR(score_threshold, Float, 0.5) .ATTR(iou_threshold, Float, 0.45) .ATTR(pre_nms_topn, Int, 512) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV2DetectionOutput) @@ -647,12 +647,12 @@ REG_OP(YoloV2DetectionOutput) *Warning: THIS FUNCTION IS DEPRECATED. Please use YoloV2DetectionOutput instead. */ REG_OP(YoloV2DetectionOutputD) - .INPUT(coord_data, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(img_info, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(windex, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(hindex, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(coord_data, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img_info, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(windex, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(hindex, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases, ListFloat) .ATTR(boxes, Int, 5) .ATTR(coords, Int, 4) @@ -663,7 +663,7 @@ REG_OP(YoloV2DetectionOutputD) .ATTR(score_threshold, Float, 0.5) .ATTR(iou_threshold, Float, 0.45) .ATTR(pre_nms_topn, Int, 512) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV2DetectionOutputD) @@ -707,16 +707,16 @@ REG_OP(YoloV2DetectionOutputD) * It is a custom operator. It has no corresponding operator in Caffe. */ REG_OP(YoloV3DetectionOutput) - .INPUT(coord_data_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(coord_data_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(coord_data_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(img_info, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(coord_data_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(coord_data_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(coord_data_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img_info, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases_low, ListFloat) .REQUIRED_ATTR(biases_mid, ListFloat) .REQUIRED_ATTR(biases_high, ListFloat) @@ -729,7 +729,7 @@ REG_OP(YoloV3DetectionOutput) .ATTR(score_threshold, Float, 0.5) .ATTR(iou_threshold, Float, 0.45) .ATTR(pre_nms_topn, Int, 512) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV3DetectionOutput) @@ -776,22 +776,22 @@ s *Warning: THIS FUNCTION IS DEPRECATED. Please use YoloV3DetectionOutput instead. */ REG_OP(YoloV3DetectionOutputD) - .INPUT(coord_data_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(coord_data_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(coord_data_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(obj_prob_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_low, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_mid, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(classes_prob_high, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(img_info, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(windex1, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(windex2, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(windex3, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(hindex1, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(hindex2, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(hindex3, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(coord_data_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(coord_data_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(coord_data_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(obj_prob_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_low, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_mid, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(classes_prob_high, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(img_info, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(windex1, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(windex2, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(windex3, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(hindex1, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(hindex2, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(hindex3, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases_low, ListFloat) .REQUIRED_ATTR(biases_mid, ListFloat) .REQUIRED_ATTR(biases_high, ListFloat) @@ -804,7 +804,7 @@ REG_OP(YoloV3DetectionOutputD) .ATTR(score_threshold, Float, 0.5) .ATTR(iou_threshold, Float, 0.45) .ATTR(pre_nms_topn, Int, 512) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV3DetectionOutputD) @@ -848,7 +848,7 @@ There are three Yolo operators at Yolov3DetectionOutput's preceding layer on Yol * It is a custom operator. It has no corresponding operator in Caffe. */ REG_OP(YoloV3DetectionOutputV2) - .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases, ListFloat) .ATTR(boxes, Int, 3) .ATTR(coords, Int, 4) @@ -862,7 +862,7 @@ REG_OP(YoloV3DetectionOutputV2) .ATTR(N, Int, 10) .ATTR(resize_origin_img_to_net, Bool, false) .ATTR(out_box_dim, Int, 3) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV3DetectionOutputV2) @@ -910,9 +910,9 @@ REG_OP(YoloV3DetectionOutputV2) * Warning: THIS FUNCTION IS DEPRECATED. Please use YoloV3DetectionOutputV2 instead. */ REG_OP(YoloV3DetectionOutputV2D) - .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) - .DYNAMIC_INPUT(windex, TensorType({DT_FLOAT16,DT_FLOAT})) - .DYNAMIC_INPUT(hindex, TensorType({DT_FLOAT16,DT_FLOAT})) + .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .DYNAMIC_INPUT(windex, TensorType({DT_FLOAT16, DT_FLOAT})) + .DYNAMIC_INPUT(hindex, TensorType({DT_FLOAT16, DT_FLOAT})) .REQUIRED_ATTR(biases, ListFloat) .ATTR(boxes, Int, 3) .ATTR(coords, Int, 4) @@ -926,7 +926,7 @@ REG_OP(YoloV3DetectionOutputV2D) .ATTR(N, Int, 10) .ATTR(resize_origin_img_to_net, Bool, false) .ATTR(out_box_dim, Int, 3) - .OUTPUT(box_out, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(box_out, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(box_out_num, TensorType({DT_INT32})) .OP_END_FACTORY_REG(YoloV3DetectionOutputV2D) @@ -968,8 +968,9 @@ REG_OP(SPP) * Three inputs, including: *@li x: An NC1HWC0 tensor of type float16 or float32, describing the feature * map. -*@li rois: A tensor of type float16 or float32, with shape +*@li rois: A tensor of type float16 or float32, with 3D shape * [batch, 5, roi_max_num], describing the RIOs. +* roi_max_num must be less than or equal to 6000 and must be divided by 16. *@li roi_actual_num: A optional tensor of type int32, with shape [batch, 8], specifying * the number of ROIs per batch . \n @@ -1201,35 +1202,6 @@ REG_OP(RpnProposalsD) .OUTPUT(sorted_box, TensorType({DT_FLOAT16})) .OP_END_FACTORY_REG(RpnProposalsD) -/** -*@brief Computes Score Filte Pre-Sort function. - -*@par Inputs: -*Inputs include: -* @li rois: A Tensor. Must be float16. N-D with shape [N, 4]. -* @li cls_bg_prob: A Tensor. Must be float16. N-D with shape [N, 1]. - -*@par Attributes: -* @li score_threshold: required, float, threahold of topk process. -* @li k: required, Int, threahold of topk process. -* @li score_filter: bool, mark of score_filter. Defaults to "true" -* @li core_max_num: int, max number of core. Defaults to "8" -*@par Outputs: -* @li sorted_proposal: A Tensor. Must be float16. -* N-D with shape [8*6002, 8]. -* @li proposal_num: A Tensor. Must be uint32. N-D with shape [8, 8]. -*/ - -REG_OP(ScoreFiltePreSort) - .INPUT(rois, TensorType({DT_FLOAT16})) - .INPUT(cls_bg_prob, TensorType({DT_FLOAT16})) - .OUTPUT(sorted_proposal, TensorType({ DT_FLOAT16})) - .OUTPUT(proposal_num, TensorType({ DT_UINT32})) - .REQUIRED_ATTR(score_threshold, Float) - .REQUIRED_ATTR(k, Int) - .ATTR(score_filter, Bool, true) - .ATTR(core_max_num, Int, 8) - .OP_END_FACTORY_REG(ScoreFiltePreSort) /** *@brief Computes Score Filte Pre-Sort function. @@ -1383,6 +1355,7 @@ REG_OP(DecodeWheelsTarget) *@attention Constraints: * Only computation of float16 data is supported. +* Note: when the class num per image * max_size_per_class is too big, will compile fail with ERROR-insufficient memory */ REG_OP(BatchMultiClassNonMaxSuppression) .INPUT(boxes, TensorType({DT_FLOAT16})) @@ -1464,9 +1437,9 @@ REG_OP(NormalizeBBox) * y: A Tensor. Must have the same type as box_predictions. */ REG_OP(DecodeBboxV2) - .INPUT(boxes, TensorType({DT_FLOAT16,DT_FLOAT})) - .INPUT(anchors, TensorType({DT_FLOAT16,DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(anchors, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) .ATTR(scales, ListFloat, {1.0, 1.0, 1.0, 1.0}) .ATTR(decode_clip, Float, 0.0) .ATTR(reversed_box, Bool, false) @@ -1477,7 +1450,8 @@ REG_OP(DecodeBboxV2) * *@par Inputs: *Inputs include: -* x: A Tensor. Must be float16 or float32. +* x: A Tensor. Dtype support: flaot16, flaot, int16, int8, + uint8, int32, int64. * *@par Attributes: * @li axis: optional, int. @@ -1485,16 +1459,364 @@ REG_OP(DecodeBboxV2) * *@par Outputs: * @li y1: A Tensor. Must have the same type as x. -* @li y2: A Tensor. Indices of y1 in x.Dtype must be int32. +* @li y2: A Tensor. Indices of y1 in x. Dtype must be int32. +* */ REG_OP(Sort) - .INPUT(x, TensorType({ DT_FLOAT16 })) - .OUTPUT(y1, TensorType({ DT_FLOAT16 })) - .OUTPUT(y2, TensorType({ DT_INT32 })) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT16, DT_INT8, + DT_UINT8, DT_INT32, DT_INT64})) + .OUTPUT(y1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT16, DT_INT8, + DT_UINT8, DT_INT32, DT_INT64})) + .OUTPUT(y2, TensorType({DT_INT32})) .ATTR(axis, Int, -1) .ATTR(descending, Bool, false) .OP_END_FACTORY_REG(Sort) +/** +*@brief Computes iou for input bboxes and gtboxes. + +*@par Inputs: +* Two inputs, including: +*@li bboxes: boxes, a 4D Tensor of type float16 with the shape (x0, x1, y0, y1), +*@li gtboxes: boxes, a 4D Tensor of type float16 with the shape (x0, x1, y0, y1).\n + +*@par Attributes: +*@li mode: A optional attribute of type string, whether judge the mode of iou. \n + +*@par Outputs: +*@li overlap: A 2D Tensor of type float16 with shape [n, m]. \n + +*@attention Constraints: +* Only computation of float16 data is supported. + +*@par Restrictions: +*Warning:THIS FUNCTION IS DEPRECATED. Please use Iou instead. +*/ +REG_OP(PtIou) + .INPUT(bboxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(gtboxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(overlap, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(mode, String, "iou") + .OP_END_FACTORY_REG(PtIou) + +/** +*@brief Greedily selects a subset of bounding boxes in descending order of +score . \n + +*@par Inputs: +*Input boxes and scores must be float16 type. Inputs include: +*@li boxes: A input tensor with shape [num_batches,spatial_dimension,4]. +The single box data format is indicated by center_point_box. +*@li scores: A input tensor with shape [num_batches,num_classes,spatial_dimension] +*@li max_output_size: A scalar integer tensor representing the maximum number +of boxes to be selected by non max suppression. +*@li iou_threshold: A 0-D float tensor representing the threshold for deciding +whether boxes overlap too much with respect to IOU. +*@li score_threshold: A 0-D float tensor representing the threshold for +deciding when to remove boxes based on score . \n + +*@par Attributes: +*center_point_box:Integer indicate the format of the box data. +The default is 0. 0 - the box data is supplied as [y1, x1, y2, x2] +where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair +of box corners and the coordinates can be provided as normalized +(i.e., lying in the interval [0, 1]) or absolute.Mostly used for TF models. +1 - the box data is supplied as [x_center, y_center, width, height]. + Mostly used for Pytorch models. \n + +*@par Outputs: +*@li selected_indices: A 2-D integer tensor of shape [M] representing the +selected indices from the boxes tensor, where M <= max_output_size. \n + +*@attention Constraints: +*Input boxes and scores must be float16 type . \n + +*@par Third-party framework compatibility +*Compatible with onnx NonMaxSuppression operator. + +*@par Restrictions: +*Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ + +REG_OP(NonMaxSuppressionV6) + .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(max_output_size, TensorType({DT_INT32})) + .OPTIONAL_INPUT(iou_threshold, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(score_threshold, TensorType({DT_FLOAT})) + .OUTPUT(selected_indices, TensorType({DT_INT32})) + .ATTR(center_point_box, Int, 0) + .ATTR(max_boxes_size, Int, 0) + .OP_END_FACTORY_REG(NonMaxSuppressionV6) + +/** +*@brief Greedily selects a subset of bounding boxes in descending order of +score . \n + +*@par Inputs: +*Input boxes and scores must be float16 type. Inputs include: +*@li boxes: A input tensor with shape [num_batches,spatial_dimension,4]. +The single box data format is indicated by center_point_box. +*@li scores: A input tensor with shape [num_batches,num_classes,spatial_dimension] +*@li max_output_size: A scalar integer tensor representing the maximum number +of boxes to be selected by non max suppression. +*@li iou_threshold: A 0-D float tensor representing the threshold for deciding +whether boxes overlap too much with respect to IOU. +*@li score_threshold: A 0-D float tensor representing the threshold for +deciding when to remove boxes based on score . \n +*@li index_id: A input tensor with shape [num_batches,num_classes,spatial_dimension,3] +the last dim representing (batch_id,class_id,index_id) . \n + +*@par Attributes: +*center_point_box:Integer indicate the format of the box data. +The default is 0. 0 - the box data is supplied as [y1, x1, y2, x2] +where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair +of box corners and the coordinates can be provided as normalized +(i.e., lying in the interval [0, 1]) or absolute.Mostly used for TF models. +1 - the box data is supplied as [x_center, y_center, width, height]. + Mostly used for Pytorch models. \n + +*@par Outputs: +*@li selected_indices: A 2-D integer tensor of shape [M] representing the +selected indices from the boxes tensor, where M <= max_output_size. \n + +*@attention Constraints: +*Input boxes and scores must be float16 type . \n + +*@par Third-party framework compatibility +*Compatible with onnx NonMaxSuppression operator. +*/ + +REG_OP(NonMaxSuppressionV7) + .INPUT(boxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(scores, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(max_output_size, TensorType({DT_INT32})) + .OPTIONAL_INPUT(iou_threshold, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(score_threshold, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(index_id, TensorType({DT_FLOAT16})) + .OUTPUT(selected_indices, TensorType({DT_INT32})) + .ATTR(center_point_box, Int, 0) + .ATTR(max_boxes_size, Int, 0) + .OP_END_FACTORY_REG(NonMaxSuppressionV7) + +/** +*@brief Obtains the ROI feature matrix from the feature map list. It is a customized fused operator for mmdetection. \n + +*@par Inputs: +* Three inputs, including: +*@li features: A 5HD Tensor list of type float32 or float16. +*@li rois: ROI position. A 2D Tensor of float32 or float16 with shape (N, 5). "N" indicates the number of ROIs, +* the value "5" indicates the indexes of images where the ROIs are located, "x0", "y0", "x1", and "y1". + +*@par Attributes: +*@li finest_scale: A optional attribute of type int, specifying the scale of calculate levels of "rois". +*@li roi_scale_factor: A optional attribute of type float32, specifying the rescaling of "rois" coordinates. +*@li spatial_scale: A optional attribute of type list float32, specifying the scaling ratio of "features" +* to the original image. +*@li pooled_height: A optional attribute of type int32, specifying the H dimension. +*@li pooled_width: A optional attribute of type int32, specifying the W dimension. +*@li sample_num: An optional attribute of type int32, specifying the horizontal and vertical sampling frequency +* of each output. If this attribute is set to "0", the sampling frequency is equal to the rounded up value of "rois", +* which is a floating point number. Defaults to "0". +*@li pool_mode: An optional attribute of type string to indicate pooling mode. Defaults to "avg" . \n +*@li aligned: An optional attribute of type bool, specifying the align to corner. Defaults to true . \n + +*@par Outputs: +* output: Outputs the feature sample of each ROI position. The format is 5HD Tensor of type float32 or float16. +* The axis N is the number of input ROIs. Axes H, W, and C are consistent with the values of "pooled_height", +* "pooled_width", and "features", respectively. + +*@par Third-party framework compatibility +*Compatible with mmdetection SingleRoIExtractor operator. +*/ +REG_OP(RoiExtractor) + .DYNAMIC_INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(finest_scale, Int, 56) + .ATTR(roi_scale_factor, Float, 0) + .ATTR(spatial_scale, ListFloat, {1.f / 4, 1.f / 8, 1.f / 16, 1.f / 32}) + .ATTR(pooled_height, Int, 7) + .ATTR(pooled_width, Int, 7) + .ATTR(sample_num, Int, 0) + .ATTR(pool_mode, String, "avg") + .ATTR(aligned, Bool, true) + .OP_END_FACTORY_REG(RoiExtractor) + +/** +*@brief Performs Position Sensitive PS ROI Pooling . \n + +*@par Inputs: +* Two inputs, including: +*@li x: An NC1HWC0 tensor of type float16 or float32, describing the feature +* map, dimension C1 must be equal to +* (int(output_dim+15)/C0))*group_size*group_size. +*@li rois: A tensor of type float16 or float32, with shape +* [batch, 5, rois_num], describing the ROIs, each ROI consists of five +* elements: "batch_id", "x1", "y1", "x2", and "y2", which "batch_id" indicates +* the index of the input feature map, "x1", "y1", "x2", or "y2" must be +* greater than or equal to "0.0" . \n + +*@par Attributes: +*@li output_dim: A required int32, specifying the number of output channels, +* must be greater than 0. +*@li group_size: A required int32, specifying the number of groups to encode +* position-sensitive score maps, must be within the range (0, 128). +*@li spatial_scale: A required float32, scaling factor for mapping the input +* coordinates to the ROI coordinates . \n + +*@par Outputs: +*y: An NC1HWC0 tensor of type float16 or float32, describing the result +* feature map . \n + +*@attention Constraints: +* HC1HWC0: channel must be Group_size squared, rois_num is a multiple of 16 +*/ +REG_OP(PSROIPoolingV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(spatial_scale, Float) + .REQUIRED_ATTR(output_dim, Int) + .REQUIRED_ATTR(group_size, Int) + .OP_END_FACTORY_REG(PSROIPoolingV2) + +/** +*@brief Performs Position Sensitive PS ROI Pooling Grad . \n + +*@par Inputs: +* Two inputs, including: +*@li x: An NC1HWC0 tensor of type float16 or float32, describing the result +* feature map . \n +*@li rois: A tensor of type float16 or float32, with shape +* [batch, 5, rois_num], describing the ROIs, each ROI consists of five +* elements: "batch_id", "x1", "y1", "x2", and "y2", which "batch_id" indicates +* the index of the input feature map, "x1", "y1", "x2", or "y2" must be +* greater than or equal to "0.0" . \n + +*@par Attributes: +*@li output_dim: A required int32, specifying the number of output channels, +* must be greater than 0. +*@li group_size: A required int32, specifying the number of groups to encode +* position-sensitive score maps, must be within the range (0, 128). +*@li spatial_scale: A required float32, scaling factor for mapping the input +* coordinates to the ROI coordinates . \n +*@li input_size: A required listInt, mapping the gradinput size: (H, W) + +*@par Outputs: +*y: An NC1HWC0 tensor of type float16 or float32, describing the feature +* map, dimension C1 must be equal to +* (int(output_dim+15)/C0))*group_size*group_size. + +*@attention Constraints: +* HC1HWC0: channel must be Group_size squared, rois_num is a multiple of 16 +*/ +REG_OP(PSROIPoolingGradV2D) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(spatial_scale, Float) + .REQUIRED_ATTR(output_dim, Int) + .REQUIRED_ATTR(group_size, Int) + .REQUIRED_ATTR(input_size, ListInt) + .OP_END_FACTORY_REG(PSROIPoolingGradV2D) + +/** +*@brief Generate the responsible flags of anchor in a single feature map. + +*@par Inputs: +*@li gt_bboxes: Ground truth box, 2-D Tensor with shape `[batch, 4]`. + +*@par Attributes: +*@li featmap_size: The size of feature maps, listint. +*@li strides: Stride of current level, listint. +*@li num_base_anchors: The number of base anchors. + +*@par Outputs: +*flags: The valid flags of each anchor in a single level. +*/ +REG_OP(AnchorResponseFlags) + .INPUT(gt_bboxes, TensorType({DT_FLOAT})) + .OUTPUT(flags, TensorType({DT_UINT8})) + .REQUIRED_ATTR(featmap_size, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(num_base_anchors, Int) + .OP_END_FACTORY_REG(AnchorResponseFlags) + +/** +*@brief Generates bounding boxes based on yolo's "anchor" and "ground-truth" boxes. +* It is a customized mmdetection operator . \n + +*@par Inputs: +* Three inputs, including: +*@li anchor_boxes: anchor boxes generated by the yolo training set. +* A 2D Tensor of type float32 or float16 with shape (N, 4). "N" indicates the number +* of ROIs, "N" indicates the number of ROIs, and the value "4" refers to (tx, ty, tw, th). +*@li gt_bboxes: target of the transformation, e.g, ground-truth boxes. +* A 2D Tensor of type float32 or float16 with shape (N, 4). +* "N" indicates the number of ROIs, and 4 indicates "dx", "dy", "dw", and "dh" . +*@li stride: Scale for each box. +* A 1D Tensor of type int32 shape (N,). +* "N" indicates the number of ROIs. \n + +*@par Attributes: +*@li performance_mode: select performance mode, "high_precision" or "high_performance". +* select "high_precision" when input type is float32, the output tensor precision +* will be smaller than 0.0001, select "high_performance" when input type is float32, +* the ops will be best performance, but precision will be only smaller than 0.005. + +*@par Outputs: +*encoded_bboxes: Bboxes generated based on "anchor_boxes" and "gt_bboxes". Have the +* same format and type as "anchor_boxes". +* +*@attention Constraints: +* input anchor boxes only support maximum N=20480. \n +*/ +REG_OP(YoloBoxesEncode) + .INPUT(anchor_boxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(gt_bboxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(stride, TensorType({DT_INT32})) + .ATTR(performance_mode, String, "high_precision") + .OUTPUT(encoded_bboxes, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(YoloBoxesEncode) + +/** +*@brief Performs Position Sensitive PS ROI Pooling Grad. + +*@par Inputs: +* Eight inputs, including: +*@li assigned_gt_inds: Tensor of type float16 or float32, shape (n, ) +*@li overlaps: A Tensor. Datatype is same as assigned_gt_inds. IOU between gt_bboxes and bboxes. shape(k, n) +*@li box_responsible_flags: A Tensor. Support uint8. Flag to indicate whether box is responsible. +*@li max_overlaps: A Tensor. Datatype is same as assigned_gt_inds. overlaps.max(axis=0). +*@li argmax_overlaps: A Tensor. Support int32. overlaps.argmax(axis=0). +*@li gt_max_overlaps: A Tensor. Datatype is same as assigned_gt_inds. overlaps.max(axis=1). +*@li gt_argmax_overlaps: A Tensor. Support int32. overlaps.argmax(axis=1). +*@li num_gts: A Tensor. Support int32. real k. shape (1, ) + +*@par Attributes: +*@li output_dim: float. IOU threshold for positive bboxes. +*@li group_size: float. minimum iou for a bbox to be considered as a positive bbox +*@li spatial_scale: bool. whether to assign all bboxes with the same highest overlap with some gt to that gt. + +*@par Outputs: +*@li assigned_gt_inds_pos: A Tensor. Support float16/float32. shape (n, ). +*/ +REG_OP(GridAssignPositive) + .INPUT(assigned_gt_inds, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(overlaps, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(box_responsible_flags, TensorType({ DT_UINT8 })) + .INPUT(max_overlaps, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(argmax_overlaps, TensorType({ DT_INT32 })) + .INPUT(gt_max_overlaps, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(gt_argmax_overlaps, TensorType({ DT_INT32 })) + .INPUT(num_gts, TensorType({ DT_INT32 })) + .OUTPUT(assigned_gt_inds_pos, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(pos_iou_thr, Float) + .REQUIRED_ATTR(min_pos_iou, Float) + .REQUIRED_ATTR(gt_max_assign_all, Bool) + .OP_END_FACTORY_REG(GridAssignPositive) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_DETECT_OPS_H_ + diff --git a/third_party/fwkacllib/inc/ops/nn_norm_ops.h b/third_party/fwkacllib/inc/ops/nn_norm_ops.h index 35c4c7d4..b44c0780 100644 --- a/third_party/fwkacllib/inc/ops/nn_norm_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_norm_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -55,7 +55,9 @@ REG_OP(LogSoftmaxGrad) *Two inputs, including: * @li features: A Tensor. Must be one of the following types: half, float32, double. * A "batch_size * num_classes" matrix. -* @li labels: A Tensor of the same type as "features". batch_size vector with values in [0, num_classes). +* @li labels: A Tensor. Must be one of the following types: 'int32', 'int64'. +* batch_size vector with values in [0, num_classes). +* This is the label for the given minibatch entry. *@par Outputs: @@ -105,6 +107,9 @@ REG_OP(SoftmaxCrossEntropyWithLogits) * @li grad_softmax: A Tensor. Has the same shape and type as "softmax". * The format is NC1HWC0 or DN . \n +*@par Attributes: +* axes: An optional list of ints. Defaults to "{-1}" . \n + *@par Outputs: *grad_x: A Tensor. Has the same shape and type as "softmax" . \n @@ -115,6 +120,7 @@ REG_OP(SoftmaxGrad) .INPUT(softmax, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .INPUT(grad_softmax, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) .OUTPUT(grad_x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8})) + .ATTR(axes, ListInt, {-1}) .OP_END_FACTORY_REG(SoftmaxGrad) /** @@ -160,20 +166,20 @@ REG_OP(SigmoidCrossEntropyWithLogits) .OP_END_FACTORY_REG(SigmoidCrossEntropyWithLogits) /** -*@brief Computes the sigmoid cross entropy loss of "predict" and "target" . \n +*@brief Computes the sigmoid cross entropy loss of "predict" and "target". *@par Inputs: * four inputs, including: *@li predict: A multi-dimensional Tensor of type float16 or float32, specifying the predictive value. -*@li target: A multi-dimensional Tensor of type float16 or float32, specifying the target value . \n -*@li weight: An multi-dimensional Tensor, specifying the weight value. \n +*@li target: A multi-dimensional Tensor of type float16 or float32, specifying the target value. +*@li weight: An multi-dimensional Tensor, specifying the weight value. *@li pos_weight: An multi-dimensional Tensor, specifying the pos weight value. \n *@par Attributes: -*reduction: A character string from "none", "mean", and "sum", specifying the reduction type to be applied to the output. Defaults to "mean" . \n +*reduction: A character string from "none", "mean", and "sum", specifying the reduction type to be applied to the output. Defaults to "mean". \n *@par Outputs: -*loss: Sigmoid cross entropy between the predictive value and target value. Has the same dimensions as "predict" . \n +*loss: Sigmoid cross entropy between the predictive value and target value. Has the same dimensions as "predict". \n *@par Third-party framework compatibility * Compatible with PyTorch operator BCEWithLogitsLoss. @@ -331,6 +337,41 @@ REG_OP(SoftmaxV2) .OP_END_FACTORY_REG(SoftmaxV2) /** +*@brief Function softmax with dropoutDoMaskV3D + +*@par Inputs: +*Two inputs, including: +* @li x: A mutable Tensor. The type only support float16. +* @li mask: A mutable Tensor. Must met all of the following rules: +* shape of mask should be 1D. +* dtype of mask should be uint8. +* value of shape should met the following algorithm: +* value = (size(x) + 128 - 1) // 128 * 128 + +*@par Attributes: +* @li keep_prob: A mutable Tensor. Must met all of the following rules: +* shape of "keep_prob" should be (1,) or [1,]. +* Has the same type as "x" . \n +* @li axes: A list of int. The dimension softmax would be performed on. Defaults +* to "[-1]" . \n + +*@par Outputs: +*y1: A mutable Tensor. Has the same type as "x". +*y2: A mutable Tensor. Has the same type as "x". \n + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(SoftmaxV2WithDropOutDoMaskV3D) + .INPUT(x, TensorType({DT_FLOAT16})) + .INPUT(mask, TensorType({DT_UINT8})) + .OUTPUT(y1, TensorType({DT_FLOAT16})) + .OUTPUT(y2, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(keep_prob, Float) + .ATTR(axes, ListInt, {-1}) + .OP_END_FACTORY_REG(SoftmaxV2WithDropOutDoMaskV3D) + +/** *@brief Computes log softmax activations . \n *@par Inputs: @@ -428,6 +469,33 @@ REG_OP(MVN) .OP_END_FACTORY_REG(MVN) /** +*@brief Normalizes the input . \n + +*@par Inputs: +* One input: +*x: An NCHW tensor of type float16 or float32 . \n + +*@par Attributes: +*@li eps: An optional float32 epsilon for not dividing by zero. Defaults to "1e-9" . \n +*@li axes: A list of Intefers, along which axis to reduce. Defaults to "[0, 2, 3]" . \n + +*@par Outputs: +*y: An NCHW tensor of type float16 or float32 . \n + +*@attention Constraints: +* The input tensor must have the NCHW format, whose shape length must be 4. +*@par Third-party framework compatibility +* Compatible with the ONNX operator MeanVarianceNormalization. +*/ + +REG_OP(MVNV2) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) /* "First operand." */ + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) /* "Result, has same element type as inputs" */ + .ATTR(eps, Float, 1e-9) + .ATTR(axes, ListInt, {0, 2, 3}) + .OP_END_FACTORY_REG(MVNV2) + +/** *@brief Normalizes the input "x1" . \n *@par Inputs: @@ -499,6 +567,31 @@ REG_OP(LayerNorm) .OP_END_FACTORY_REG(LayerNorm) /** +*@brief Returns a tensor where each sub-tensor of input along dimension +* dim is normalized such that the p-norm of the sub-tensor is lower than the value maxnorm. \n + +*@par Inputs: +*One input, including: +* @li x: A Tensor. Must be one of the following types: float16, float32 . \n + +*@par Attributes: +* @li p: Specify L_p norm, the type is float. +* @li dim: The processed dim, the type is int. +* @li maxnorm: Threshold for comparison, the type is float. \n + +*@par Outputs: +*One outputs, including: +* @li y: shape and dtype of output, should be same shape and type as input. +*/ +REG_OP(Renorm) + .INPUT(x, TensorType::BasicType()) + .OUTPUT(y, TensorType::BasicType()) + .REQUIRED_ATTR(p, Float) + .REQUIRED_ATTR(dim, Int) + .REQUIRED_ATTR(maxnorm, Float) + .OP_END_FACTORY_REG(Renorm) + +/** *@brief LayerNormGrad operator interface implementation * calculating: dy, x, variance, mean, gamma * pd_xl = data_dy*data_gamma @@ -587,6 +680,48 @@ REG_OP(LayerNormXBackprop) .OP_END_FACTORY_REG(LayerNormXBackprop) /** +*@brief LayerNormXBackpropV2 operator interface implementation +* calculating: dy, x, variance, mean, gamma +* pd_xl = data_dy*data_gamma +* pd_var = np.sum(((-0.5)*pd_xl*(data_x - data_mean) +* np.power((data_variance + EPSLON), (-1.5))), +* reduce_axis, keepdims=True) +* pd_mean = np.sum(((-1.0)*pd_xl +* np.power((data_variance + EPSLON), (-0.5))), +* reduce_axis, keepdims=True) +* + pd_var*(1.0/m) +* np.sum(((-2.0)*(data_x - data_mean)), reduce_axis, keepdims=True) +* pd_x = pd_xl*np.power((data_variance + EPSLON), (-0.5)) + +* pd_var*(2.0/m)*(data_x - data_mean) + pd_mean*(1.0/m) +* res_for_gamma = (data_x - data_mean) * np.power((data_variance + EPSLON), (-0.5)) + +*@par Inputs: +*Five inputs, including: +* @li dy: A Tensor. Must be one of the following types: float16, float32. +* @li x: A Tensor. Must be one of the following types: float16, float32. +* @li variance: A Tensor. Must be one of the following types: float16, float32. +* @li mean: A Tensor. Must be one of the following types: float16, float32. +* @li gamma: A Tensor. Must be one of the following types: float16, float32 . \n + +*@par Outputs: +*Three outputs, including: +* @li pd_x: A Tensor. Must be one of the following types: float16, float32. +* @li res_for_gamma: A Tensor. Must be one of the following types: float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(LayerNormXBackpropV2) + .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(variance, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(res_for_gamma, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(LayerNormXBackpropV2) + +/** *@brief LayerNormBetaGammaBackprop operator interface implementation * calculating: dy, x, variance, mean * pd_xl = data_dy*data_gamma @@ -630,6 +765,35 @@ REG_OP(LayerNormBetaGammaBackprop) .OP_END_FACTORY_REG(LayerNormBetaGammaBackprop) /** +*@brief LayerNormBetaGammaBackpropV2 operator interface implementation +* calculating: dy, x, variance, mean +* pd_gamma = np.sum((data_dy*res_for_gamma), param_axis, keepdims=True) +* pd_beta = np.sum(data_dy, param_axis, keepdims=True) + +*@par Inputs: +*Three inputs, including: +* @li dy: A Tensor. Must be one of the following types: float16, float32. +* @li x: A Tensor. Must be one of the following types: float16, float32. +* @li variance: A Tensor. Must be one of the following types: float16, float32. +* @li mean: A Tensor. Must be one of the following types: float16, float32 . \n + +*@par Outputs: +*Three outputs, including: +* @li pd_gamma: A Tensor. Must be one of the following types: float16, float32. +* @li pd_beta: A Tensor. Must be one of the following types: float16, float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(LayerNormBetaGammaBackpropV2) + .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(res_for_gamma, TensorType({DT_FLOAT})) + .OUTPUT(pd_gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_beta, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(shape_gamma, ListInt) + .OP_END_FACTORY_REG(LayerNormBetaGammaBackpropV2) + +/** *@brief Return "output" according to the algorithm of dropout_do_mask: * scale_x = x *(1 / keep_prob) * output = select(mask == 1, scale_x, 0) @@ -656,7 +820,68 @@ REG_OP(DropOutDoMask) .INPUT(keep_prob, TensorType({DT_FLOAT, DT_FLOAT16})) .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) .OP_END_FACTORY_REG(DropOutDoMask) - + +/** +*@brief Return "output" according to the algorithm of dropout_do_mask: +* scale_x = x *(1 / keep_prob) +* output = select(mask == 1, scale_x, 0) + +*@par Inputs: +*Three inputs, including: +* @li x: A mutable Tensor. Must be one of the following types: +* float16, float32 +* @li mask: A mutable Tensor. Must met all of the following rules: +* shape of mask should be 1D. +* dtype of mask should be uint8. +* value of shape should met the following algorithm: +* value = (size(x) + 128 - 1) // 128 * 128 +* @li keep_prob: A mutable Tensor. Must met all of the following rules: +* shape of "keep_prob" should be (1,) or [1,]. +* Has the same type as "x" . \n + +*@par Output: +*y: A mutable Tensor. Has the same type as "x". +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DropOutDoMaskV3) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mask, TensorType({DT_UINT8})) + .INPUT(keep_prob, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(DropOutDoMaskV3) + +/** +*@brief Return "output" according to the algorithm of dropout_do_mask: +* scale_x = x *(1 / keep_prob) +* output = select(mask == 1, scale_x, 0) + +*@par Inputs: +*Two inputs, including: +* @li x: A mutable Tensor. Must be one of the following types: +* float16, float32 +* @li mask: A mutable Tensor. Must met all of the following rules: +* shape of mask should be 1D. +* dtype of mask should be uint8. +* value of shape should met the following algorithm: +* value = (size(x) + 128 - 1) // 128 * 128 +*@par Attributes: +* @li keep_prob: A mutable Tensor. Must met all of the following rules: +* shape of "keep_prob" should be (1,) or [1,]. +* Has the same type as "x" . \n + +*@par Output: +*y: A mutable Tensor. Has the same type as "x". +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DropOutDoMaskV3D) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mask, TensorType({DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(keep_prob, Float) + .OP_END_FACTORY_REG(DropOutDoMaskV3D) + /** *@brief Scales the input . \n @@ -703,7 +928,7 @@ REG_OP(Scale) *@par Inputs: *One input, including: -*@li x: A Tensor. Must be 4-D shape, and only support the following types: float16, float32 . \n +*x: A Tensor. Must be 4-D shape, and only support the following types: float16, float32 . \n *@par Attributes: *@li depth_radius: An optional int32, specifying the half-width of the normalization window. Defaults to "5". @@ -960,24 +1185,532 @@ REG_OP(INInferV2D) .OP_END_FACTORY_REG(INInferV2D) /** -*@brief Performs instance normalization for inference of InHost part. +* @brief InstanceNorm operator interface implementation. -*@par Inputs:\n -* One input, including: (NC1HWC0 supported) -* variance: A [N, C1, 1, 1, C0] Tensor of type float32, for the variance. +* @par Inputs: +* Three inputs, including: +* @li x: A Tensor. Must be one of the following types: float16, float32. +* @li gamma: A Tensor. Must be one of the following types: float16, float32. +* @li beta: A Tensor. Must be one of the following types: float16, float32. + +* @par Attributes: +* @li data_format: An attribute of type String \n +* @li epsilon: An attribute of type Float. \n + +* @par Outputs: +*Three outputs, including: +* @li y: A Tensor. Has the same type as "x". \n +* @li mean: A Tensor. Has the same type as "x". \n +* @li variance: A Tensor. Has the same type as "x". \n + +* @par Third-party framework compatibility +* Can be used by onnx InstanceNormalization +*/ +REG_OP(InstanceNorm) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(gamma, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(beta, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(mean, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(variance, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(data_format, String, "NDHWC") + .ATTR(epsilon, Float, 1e-6) + .OP_END_FACTORY_REG(InstanceNorm) + +/** +*@brief InstanceNormGrad operator interface implementation. + +*@par Inputs: +*Five inputs, including: +* @li dy: A Tensor. Must be one of the following types: float16, float32. +* @li x: A Tensor. Must be one of the following types: float16, float32. +* @li variance: A Tensor. Must be one of the following types: float16, float32. +* @li mean: A Tensor. Must be one of the following types: float16, float32. +* @li gamma: A Tensor. Must be one of the following types: float16, float32 . \n + +*@par Outputs: +*Three outputs, including: +* @li pd_x: A Tensor. Must be one of the following types: float16, float32. +* @li pd_gamma: A Tensor. Must be one of the following types: float16, float32. +* @li pd_beta: A Tensor. Must be one of the following types: float16, float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(InstanceNormGrad) + .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(variance, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_beta, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(InstanceNormGrad) + +/** +*@brief InstanceNormXBackprop operator interface implementation. + +*@par Inputs: +*Five inputs, including: +* @li dy: A Tensor. Must be one of the following types: float16, float32. +* @li x: A Tensor. Must be one of the following types: float16, float32. +* @li variance: A Tensor. Must be one of the following types: float16, float32. +* @li mean: A Tensor. Must be one of the following types: float16, float32. +* @li gamma: A Tensor. Must be one of the following types: float16, float32 . \n + +*@par Outputs: +*Two outputs, including: +* @li pd_x: A Tensor. Must be one of the following types: float16, float32. +* @li res_for_gamma: A Tensor. Must be one of the following types: float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(InstanceNormXBackprop) + .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(variance, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(res_for_gamma, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(InstanceNormXBackprop) + +/** +*@brief InstanceNormBetaGammaBackprop operator interface implementation. + +*@par Inputs: +*Two inputs, including: +* @li dy: A Tensor. Must be one of the following types: float16, float32. +* @li res_for_gamma: A Tensor. Must be one of the following types: float32.\n + +*@par Outputs: +*Two outputs, including: +* @li pd_gamma: A Tensor. Must be one of the following types: float16, float32. +* @li pd_beta: A Tensor. Must be one of the following types: float16, float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(InstanceNormBetaGammaBackprop) + .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(res_for_gamma, TensorType({DT_FLOAT})) + .OUTPUT(pd_gamma, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(pd_beta, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(InstanceNormBetaGammaBackprop) + +/** +* @brief Computes Kl_div_loss_grad or Kl_div_loss_backward. \n + +* @par Inputs: +* Three inputs, including: +* @li grad: A Tensor. Must be one of the following types: float16, float32. +* Required. +* @li input: A Tensor. Has the same type as "grad". Required. +* @li target: A Tensor. Has the same type as "grad". Required. \n + +* @par Attributes: +* @li reduction: An optional attribute of type String. Defaults to "mean". \n +* @li log_target: An optional attribute of type Bool. Defaults to false. \n + +* @par Outputs: +* @li y: A Tensor. Has the same type as "grad". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator KlDivLossGrad. +*/ +REG_OP(KlDivLossGrad) + .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(input, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(reduction, String, "mean") + .ATTR(log_target, Bool, false) + .OP_END_FACTORY_REG(KlDivLossGrad) + +/** +* @brief Computes l1_loss_grad or l1_loss_backward. \n + +* @par Inputs: +* Three inputs, including: +* @li grads: A Tensor. Must be one of the following types: float16, float32. +* Required. +* @li predict: A Tensor. Has the same type as "grads". Required. +* @li label: A Tensor. Has the same type as "grads". Required. \n + +* @par Attributes: +* @li reduction: An optional attribute of type String. Defaults to "mean". \n + +* @par Outputs: +* @li y: A Tensor. Has the same type as "x". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator L1LossGrad. +*/ +REG_OP(L1LossGrad) + .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(label, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(L1LossGrad) + +/** +* @brief Computes loss of lp, p=1,2,3.... + +* @par Inputs: +* @li predict: An ND tensor of type float16, float32. +* @li label: An ND tensor of type float16, float32. \n + +* @par Attributes: +* @li p: A required int attribute that decides which loss to compute, now the p only can be 1 to compute l1_loss. +* @li reduction: An optional string.Defaults to "mean". \n + +* @par Outputs: +* @li y: An ND tensor tensor with the same shape and type as "predict". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator LpLoss. +*/ +REG_OP(LpLoss) + .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(label, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .REQUIRED_ATTR(p, Int) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(LpLoss) + +/** +* @brief Computes gradients of mse loss. + +* @par Inputs: +* @li predict: An ND tensor of type float16, float32. +* @li label: An ND tensor of type float16, float32. +* @li dout: An ND tensor of type float16, float32. \n + +* @par Attributes: +* @li reduction: An optional string.Defaults to "mean". \n + +* @par Outputs: +* @li y: An ND tensor tensor with the same shape and type as "predict". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator MseLossGrad. +*/ +REG_OP(MseLossGrad) + .INPUT(predict, TensorType({DT_FLOAT32, DT_FLOAT16})) + .INPUT(label, TensorType({DT_FLOAT32, DT_FLOAT16})) + .INPUT(dout, TensorType({DT_FLOAT32, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT32, DT_FLOAT16})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(MseLossGrad) + +/** +* @brief Computes mse loss. +* @par Inputs: +* two inputs, including: +* @li predict: An ND Tensor of dtype float16 or float32. +* @li label: An ND Tensor of dtype float16 or float32.\n +* +* @par Attributes: +* @li reduction:An optional str from sum, none, mean, Defaults to "mean".\n +* +* @par Outputs: +* @li y: when reduction=sum/mean, y is scale. when reduction=none, y has +* same type and shape as "predict".\n +*/ +REG_OP(MseLoss) + .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(label, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(MseLoss) + +/** +* @brief Calculates the reversed outputs of the function "smooth_l1_loss_v2". \n + +* @par Inputs: +* Three Inputs, including: +* @li predict: A Tensor. Must be one of the following types: +* float16, float32. +* @li label: A Tensor. Has the same type as "predict". +* @li dout: A Tensor. Has the same type as "predict". \n + +* @par Attributes: +* Two Attributes, including: +* @li sigma: An optional float. Defaults to 1.0. \n + +* @li reduction: An optional string. Defaults to "mean", +* Must be one of the following: "none", "mean", "sum". \n + +* @par Outputs: +* @li gradient: A Tensor. Has the same type as "predict". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator SmoothL1LossBackward. +*/ +REG_OP(SmoothL1LossGradV2) + .INPUT(predict, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(label, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(dout, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(gradient, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(sigma, Float, 1.0) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(SmoothL1LossGradV2) + +/** +* @brief Creates a criterion that uses a squared term if the absolute +* element-wise error falls below beta and an L1 term otherwise. It is +* less sensitive to outliers than the MSELoss and in some cases prevents +* exploding gradients. + +* @par Inputs: +* @li predict: A multi-dimensional Tensor of type float16 or float32, +* specifying the predictive value. \n +* @li label: A multi-dimensional Tensor of type float16 or float32, +* specifying the target value. \n + +* @par Attributes: +* @li sigma: An optional int. Specifies the threshold of loss. Defaults +* to "1.0". \n +* @li reduction: An optional str. Specifies the reduction to apply to +* the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, +* 'mean': the sum of the output will be divided by the number of elements in +* the output,'sum': the output will be summed. Default: 'mean'. \n + +* @par Outputs: +* @li loss: Indicates the loss between the predictive value and target value. +* Has the same dimensions as "predict". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator smooth_l1_loss. \n +*/ +REG_OP(SmoothL1LossV2) + .INPUT(predict, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(label, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .OUTPUT(loss, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .ATTR(sigma, Float, 1.0) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(SmoothL1LossV2) + +/** +* @brief Computes Centralization. result = x - mean(x, axes) + +* @par Inputs: +* @li x: An ND tensor of type float16, float32. +* @par Attributes: +* @li axes: The dimensions to reduce. Must be one of the following types: int, list, tuple, NoneType. +* Must be in the range [-rank(x), rank(x)). +* @par Outputs: +* @li y: A Tensor. Has the same type as "x". \n + +* @par Third-party framework compatibility +* custom operator \n +*/ +REG_OP(Centralization) + .INPUT(x, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .OUTPUT(y, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .ATTR(axes, ListInt, {-1}) + .OP_END_FACTORY_REG(Centralization) + +/** +*@brief Roll the tensor along the given dimension(s). +* Elements that are shifted beyond the last position are re-introduced at the first position. +* If a dimension is not specified, the tensor will be flattened before rolling and then restored to the original shape. \n + +*@par Inputs: +*One inputs, including: +* @li x: A tensor . Must be one of the following types: +* float16, float32, int32, uint32, int8, uint8. \n *@par Attributes: -* epsilon: An optional float32, specifying the small value added to -variance to avoid dividing by zero. Defaults to "0.00001" . \n +* @li shifts: The number of places by which the elements of the tensor are shifted. \n +* @li dims: Axis along which to roll. \n -*@par Outputs:\n -* variance_sqrt: A [N, C1, 1, 1, C0] Tensor of type float32, for the variance_sqrt. +*@par Outputs: +* y: A Tensor with the same type and shape of x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Roll. \n */ -REG_OP(InHost) - .INPUT(variance, TensorType({DT_FLOAT})) - .OUTPUT(variance_sqrt, TensorType({DT_FLOAT})) - .ATTR(epsilon, Float, 0.00001) - .OP_END_FACTORY_REG(InHost) +REG_OP(Roll) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_UINT32,DT_INT8,DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_UINT32,DT_INT8,DT_UINT8})) + .REQUIRED_ATTR(shifts, ListInt) + .ATTR(dims, ListInt, {}) + .OP_END_FACTORY_REG(Roll) + +/** + *@brief Calculate the loss. Creates a criterion that optimizes a two-class classification + logistic loss between input_x and input_y (containing 1 or -1). \n + + *@par Inputs: + *One inputs, including: + * @li input_x: A tensor. Must be one of the following types: + * float16, float32. \n + * @li input_y: A tensor. Must be one of the following types: + * float16, float32. \n + + *@par Attributes: + *@li lambd: An optional string.Defaults to "mean". \n + + *@par Outputs: + *output_z: while reduction == "none", A Tensor with the same type and shape of input_x's. \n + * while reduction == "sum" or "mean", A Tensor with the same type of input_x , shape of which is (1,) + + *@par Third-party framework compatibility + *Compatible with the Pytorch operator SoftMarginLoss. \n + */ +REG_OP(SoftMarginLoss) + .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(input_y, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(reduction, String, "mean") + .OUTPUT(output_z, TensorType({DT_FLOAT, DT_FLOAT16})) + .OP_END_FACTORY_REG(SoftMarginLoss) + +/** +* @brief Computes gradients of sigmoid_cross_entropy_with_logits_v2. + +* @par Inputs: +* @li predict: An ND tensor of type float16, float32. +* @li target: An ND tensor of type float16, float32. +* @li dout: An ND tensor of type float16, float32. +* @li weight: An optional ND tensor of type float16, float32. +* @li pos_weight: An optional ND tensor of type float16, float32. \n + +* @par Attributes: +* @li reduction: An optional string.Defaults to "mean". \n + +* @par Outputs: +* @li gradient: An ND tensor tensor with the same shape and type as "predict". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator SigmoidCrossEntropyWithLogitsGrad. +*/ +REG_OP(SigmoidCrossEntropyWithLogitsGradV2) + .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(dout, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(weight, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(pos_weight, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(gradient, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(SigmoidCrossEntropyWithLogitsGradV2) +/** + * @brief Calculate the PoissonNllLoss function. + * target∼Poisson(input)loss(input,target)=input−target∗log(input)+log(target!) \n + + * @par Inputs: + * Two inputs, including: + * @li input_x: A tensor. Must be one of the following types: + * float16, float32. \n + * + * @par Inputs: + * @li target: A tensor. Must be one of the following types: + * float16, float32. \n + + * @par Attributes: + * four Attributes, including: + * @li log_input: An optional bool. Defaults to "True" \n + * + * @par Attributes: + * @li full: An optional bool. Defaults to "False" \n + * + * @par Attributes: + * @li eps: An optional float. Defaults to "1e-8" \n + * + * @par Attributes: + * @li reduction: An optional string. Defaults to "mean" \n + + * @par Outputs: + * loss: A Tensor has same element type as two inputs. \n + + * @par Third-party framework compatibility + * Compatible with the Pytorch operator PoissonNllLoss. \n + */ +REG_OP(PoissonNllLoss) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(loss, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(log_input, Bool, true) + .ATTR(full, Bool, false) + .ATTR(eps, Float, 1e-8) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(PoissonNllLoss) +/** + *@brief rnn_gen_mask + * @par Inputs: + * @li seq_length: A ND Tensor of type int32. Recoed the current length of each batch.\n + * + * @par Attributes: + * @li num_step: A required int.\n + * @li hidden_size: A required int. \n + * + * + * @par Output: + * y: A mutable Tensor of type float16, with the shape of [num_step, batch_size, hidden_size]. \n + * + */ +REG_OP(RnnGenMask) + .INPUT(seq_length, TensorType({DT_INT32})) + .OUTPUT(seq_mask, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(num_step, Int) + .REQUIRED_ATTR(hidden_size, Int) + .OP_END_FACTORY_REG(RnnGenMask) + +/** +* @brief Creates a criterion that optimizes a multi-class multi-classification hinge loss (margin-based loss) +* between input x (a 2D mini-batch Tensor) and output y (which is a 2D Tensor of target class indices) \n + +* @par Inputs: +* Two inputs, including: +* @li x: A tensor. Must be one of the following types: +* float16, float32. \n +* +* @par Inputs: +* @li target: A tensor. Must be the following types: +* int32. \n + +* @par Attributes: +* @li reduction: An optional string. Defaults to "mean" \n + +* @par Outputs: +* y: A Tensor has same element type as input x. \n +* is_target: A Tensor has same element type as input target. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator MultiLabelMarginLoss. \n +*/ +REG_OP(MultilabelMarginLoss) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(target, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(is_target, TensorType({DT_INT32})) + .ATTR(reduction, String, "mean") + .OP_END_FACTORY_REG(MultilabelMarginLoss) + +/** +*@brief Performs batch normalization . \n +*@par Inputs: +* Two inputs +*@li input_x: A Tensor. Support float32. shape (n, c, d). +*@li seq_len: A Tensor. Each batch normalize data num. Support Int32. Shape (n, ). \n +*@par Attributes: +*@li normalize_type: Str. Support "per_feature" or "all_features". +*@li epsilon: An optional float32, specifying the small value added to +variance to avoid dividing by zero. Defaults to "0.00001" . \n +*@par Outputs: +* One outputs +*@li output_y: A Tensor for the normalized "x".Support float32. shape (n, c, d).\n +*/ +REG_OP(NormalizeBatch) + .INPUT(input_x, TensorType({ DT_FLOAT })) + .INPUT(seq_len, TensorType({ DT_INT32 })) + .OUTPUT(output_y, TensorType({ DT_FLOAT })) + .REQUIRED_ATTR(normalize_type, String) + .ATTR(epsilon, Float, 0.00001) + .OP_END_FACTORY_REG(NormalizeBatch) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_NORM_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/nn_ops.h b/third_party/fwkacllib/inc/ops/nn_ops.h index 9edc469a..49fd02fa 100644 --- a/third_party/fwkacllib/inc/ops/nn_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -20,7 +20,144 @@ */ #ifndef OPS_BUILT_IN_OP_PROTO_INC_NN_OPS_H_ #define OPS_BUILT_IN_OP_PROTO_INC_NN_OPS_H_ - +#include "graph/operator_reg.h" #include "nn_pooling_ops.h" +namespace ge { +/** +* @brief Says whether the targets are in the top "k" predictions . \n + +* @par Inputs: +* Three inputs, including: +* @li predictions: A 2D Tensor of type float32. A "batch_size * classes" tensor. +* @li targets: A 1D Tensor of type IndexNumberType. A batch_size tensor of class ids. +* @li k: A 1D Tensor of the same type as "targets". +* Specifies the number of top elements to look at for computing precision . \n + +* @par Outputs: +* precision: A Tensor of type bool . \n + +* @attention Constraints: +* @li targets must be non-negative tensor. + +* @par Third-party framework compatibility +* @li Compatible with the TensorFlow operator InTopKV2. +*/ +REG_OP(InTopKV2) + .INPUT(predictions, TensorType({DT_FLOAT})) + .INPUT(targets, TensorType(IndexNumberType)) + .INPUT(k, TensorType({IndexNumberType})) + .OUTPUT(precision, TensorType({DT_BOOL})) + .OP_END_FACTORY_REG(InTopKV2) + +/** +*@brief Performs batch normalization . \n + +*@par Inputs: +* Five inputs, including: (NHWC, NCHW, or NC1HWC0 supported) +*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW for 4D or NC1HWC0 for 5D. +*@li scale: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D +if input "x" is with format NC1HWC0. Specifies the scaling factor. +*@li offset: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D +if input "x" is with format NC1HWC0. Specifies the offset. +*@li mean: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D +if input "x" is with format NC1HWC0. Specifies the mean used for inference. Must be "None" if the +operation is used for training. +*@li variance: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be +5D if input "x" is with format NC1HWC0. Specifies the variance used for inference. Must be "None" +if the operation is used for training . \n + +*@par Attributes: +*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.0001". +*@li data_format: An optional string, specifying the format of "x". Defaults to "NHWC". +*@li is_training: An optional bool, specifying if the operation is used for training or inference. Defaults to "True" . \n + +*@par Outputs: +* Five outputs, including: (NHWC, NCHW, or NC1HWC0 supported) +*@li y: A 4D or 5D Tensor of type float16 or float32 for the normalized "x", with format NHWC or NCHW for 4D or NC1HWC0 for 5D. +*@li batch_mean: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D +if input "x" is with format NC1HWC0. Specifies the mean of "x". +*@li batch_variance: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. +Must be 5D if input "x" is with format NC1HWC0. Specifies the variance of "x". +*@li reserve_space_1: An optional Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. +Must be 5D if input "x" is with format NC1HWC0. Specifies the mean of "x" for gradient computation. Pass "None" to skip this output. +*@li reserve_space_2: An optional Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. +Must be 5D if input "x" is with format NC1HWC0. Specifies the variance of "x" for gradient computation. Pass "None" to skip this output . \n + +*@attention Constraints: +*@li If the operation is used for inference and outputs "reserve_space_1" and "reserve_space_2" are available, +then "reserve_space_1" has the same value as "mean" and "reserve_space_2" has the same value as "variance". +*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction . \n +*/ +REG_OP(FusedBatchNormV2) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(scale, TensorType({DT_FLOAT})) + .INPUT(offset, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(mean, TensorType({DT_FLOAT})) + .OPTIONAL_INPUT(variance, TensorType({DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(batch_mean, TensorType({DT_FLOAT})) + .OUTPUT(batch_variance, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_1, TensorType({DT_FLOAT})) + .OUTPUT(reserve_space_2, TensorType({DT_FLOAT})) + .ATTR(epsilon, Float, 0.0001) + .ATTR(data_format, String, "NHWC") + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(FusedBatchNormV2) + +/** + * @brief: Large amount of data sort.First operator of TopK. + * @par Inputs: + * two input, including: + * @li input_data: A Tensor. Data to be sorted. Support float16 + * @li input_index: A Tensor. Range(0, 2048). Datatype and format is same as input_data. + * @par Attributes: + * @li k_num: Int.Number to be sorted. + * @par Outputs: + * 1 output, including: + * @li output_proposal: A Tensor. Datatype and format is same as input_data. Proposal sorted for each channel. + */ +REG_OP(SegmentSort) + .INPUT(input_data, TensorType({DT_FLOAT16})) + .INPUT(input_index, TensorType({DT_FLOAT16})) + .OUTPUT(output_proposal, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(k_num, Int) + .OP_END_FACTORY_REG(SegmentSort) + +/** + * @brief: Large amount of data sort.Second operator of TopK. + * @par Inputs: + * two input, including: + * @li input_proposal: A Tensor. Proposal sorted for each channel. Support float16 + * @par Attributes: + * @li k_num: Int.Number to be sorted. + * @par Outputs: + * 1 output, including: + * @li output_proposal: A Tensor. Datatype and format is same as input_data. Proposal sorted for each channel. + */ +REG_OP(MultiMerge) + .INPUT(input_proposal, TensorType({DT_FLOAT16})) + .OUTPUT(output_proposal, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(k_num, Int) + .OP_END_FACTORY_REG(MultiMerge) + +/** + * @brief: Large amount of data sort.Third operator of TopK. + * @par Inputs: + * two input, including: + * @li input_proposal: A Tensor. Proposal sorted for each channel. Support float16 + * @par Attributes: + * @li k_num: Int.Number to be sorted. + * @par Outputs: + * 2 output, including: + * @li output_data: A Tensor. Datatype and format is same as input_data. Data sorted. + * @li output_index: A Tensor. int32. Data index. + */ +REG_OP(SingleMerge) + .INPUT(input_proposal, TensorType({DT_FLOAT16})) + .OUTPUT(output_data, TensorType({DT_FLOAT16})) + .OUTPUT(output_index, TensorType({DT_INT32})) + .REQUIRED_ATTR(k_num, Int) + .OP_END_FACTORY_REG(SingleMerge) +}// namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/nn_pooling_ops.h b/third_party/fwkacllib/inc/ops/nn_pooling_ops.h index ab35ba47..80a21333 100644 --- a/third_party/fwkacllib/inc/ops/nn_pooling_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_pooling_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -182,6 +182,128 @@ REG_OP(AvgPool3D) .ATTR(data_format, String, "NDHWC") .OP_END_FACTORY_REG(AvgPool3D) + +/** +*@brief Performs average pooling on the input. + +*@par Inputs: +*@li x: A 5-D Tensor of shape [batch, depth, height, width, channels] and type float16, float32, double. +*@li filter: An optional tensor of type float16, float32, double, fractal_z_3d layout. +*@li multiplier: An optional tensor of float16, float32, double. + +*@par Attributes: +*@li ksize: List of ints that has length 1, 3 or 5. The size of the window for each dimension of the input tensor. +*@li strides:List of ints that has length 1, 3 or 5. The stride of the sliding window for each dimension of the input tensor. +*@li pads: List of ints, implicit zero paddings on both sides of the input. +*@li ceil_mode: When true, will use ceil instead of floor in the formula to compute the output shape. +*@li count_include_pad: When true, will include the zero-padding in the averaging calculation. +*@li divisor_override: if specified, it will be used as divisor, otherwise size of the pooling region will be used. +*@li data_format: A string, format of input data . \n + +*@par Outputs: +*y: The average pooled output tensor . \n + +*@attention Constraints: +*@li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator AvgPool3D. +*/ +REG_OP(AvgPool3DD) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OPTIONAL_INPUT(filter, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OPTIONAL_INPUT(multiplier, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(ceil_mode, Bool, false) + .ATTR(count_include_pad, Bool, true) + .ATTR(divisor_override, Int, 0) + .ATTR(data_format, String, "NDHWC") + .OP_END_FACTORY_REG(AvgPool3DD) + +/** +* @brief Computes AvgPool3DGrad function. + +* @par Inputs: +* @li orig_input_shape: An NDHWC tensor of type int32. +* @li grads: An NDHWC tensor of type float16, float32, or double. + +* @par Attributes: +* @li ksize: List of ints that has length 5. The size of the window for each dimension of the input tensor. +* @li strides:List of ints that has length 5. The stride of the sliding window for each dimension of the input tensor. +* @li pads: List of ints, implicit zero paddings on both sides of the input. +* @li ceil_mode: When true, will use ceil instead of floor in the formula to compute the output shape. +* @li count_include_pad: When true, will include the zero-padding in the averaging calculation. +* @li divisor_override: if specified, it will be used as divisor, otherwise size of the pooling region will be used. +* @li data_format: A string, format of input data. + +* @par Outputs: +* @output: A mutable tensor with the same shape and type as "orig_input_shape". + +* @attention Constraints: +* @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] + +* @par Third-party framework compatibility +* @li Compatible with the TensorFlow operator AvgPoolGrad. +*/ + +REG_OP(AvgPool3DGrad) + .INPUT(orig_input_shape, TensorType({DT_INT32})) + .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OUTPUT(output, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(ceil_mode, Bool, false) + .ATTR(count_include_pad, Bool, true) + .ATTR(divisor_override, Int, 0) + .ATTR(data_format, String, "NDHWC") + .OP_END_FACTORY_REG(AvgPool3DGrad) + +/** +* @brief Performs average pooling on the input. + +* @par Inputs: +* @li grads: An NDHWC tensor of type float16. +* @li filter: An optional tensor of type float16, fractal_z_3d layout. +* @li multiplier: An optional tensor of float16. + +* @par Attributes: +* @li orig_input_shape: List of ints that has length 5. The size of the window for each dimension of the input tensor. +* @li ksize: List of ints that has length 5. The size of the window for each dimension of the input tensor. +* @li strides:List of ints that has length 5. The stride of the sliding window for each dimension of the input tensor. +* @li pads: List of ints, implicit zero paddings on both sides of the input. +* @li ceil_mode: When true, will use ceil instead of floor in the formula to compute the output shape. +* @li count_include_pad: When true, will include the zero-padding in the averaging calculation. +* @li divisor_override: if specified, it will be used as divisor, otherwise size of the pooling region will be used. +* @li data_format: A string, format of input data . \n + +* @par Outputs: +* @output: The average pooled output tensor . \n + +* @attention Constraints: +* @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator AvgPool3DGradD. +*/ +REG_OP(AvgPool3DGradD) + .INPUT(grads, TensorType({DT_FLOAT16})) + .OPTIONAL_INPUT(filter, TensorType({DT_FLOAT16})) + .OPTIONAL_INPUT(multiplier, TensorType({DT_FLOAT16})) + .OUTPUT(output, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(orig_input_shape, ListInt) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(ceil_mode, Bool, false) + .ATTR(count_include_pad, Bool, true) + .ATTR(divisor_override, Int, 0) + .ATTR(data_format, String, "NDHWC") + .OP_END_FACTORY_REG(AvgPool3DGradD) + /** *@brief Performs max_pool_ext2 on the input . \n @@ -278,8 +400,8 @@ No default value. specifying the stride of the sliding window for each dimension of the input tensor. No default value. *@li padding: A required string type of float16. -*@li pads: A list type of int32. Default value {0, 0, 0}. -*@li dilation: A list type of int32. Default value {1, 1, 1}. +*@li pads: A list type of int32. Default value {0,0,0,0,0,0}. +*@li dilation: A list type of int32. Default value {1,1,1,1,1,1}. *@li ceil_mode: A ceil mode number of int32 . Default value 0. *@li data_format: An optional string. Defaults to "NDHWC" . \n @@ -302,12 +424,37 @@ REG_OP(MaxPool3D) .REQUIRED_ATTR(ksize, ListInt) .REQUIRED_ATTR(strides, ListInt) .REQUIRED_ATTR(padding, String) - .ATTR(pads, ListInt, {0,0,0}) - .ATTR(dilation, ListInt, {1,1,1}) + .ATTR(pads, ListInt, {0,0,0,0,0,0}) + .ATTR(dilation, ListInt, {1,1,1,1,1,1}) .ATTR(ceil_mode, Int, 0) .ATTR(data_format, String, "NDHWC") .OP_END_FACTORY_REG(MaxPool3D) +/** +*@brief Applies a 2D adaptive max pooling over an input signal conposed of several input planes. \n +* The output is of size H x W, for any input size. + +* @par Inputs: +* One input, including: +* @li x: A Tensor. Must be one of the following data types: +* float16, float32, float64. \n + +* @par Attributes: +* @li output_size: A required list of 2 ints +* specifying the size (H,W) of the output tensor. \n + +* @par Outputs: +* @li y: A Tensor. Has the same data type as "x" \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator AdaptiveMaxPool2d. +*/ +REG_OP(AdaptiveMaxPool2d) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE})) + .OUTPUT(argmax, TensorType::IndexNumberType()) + .REQUIRED_ATTR(output_size, ListInt) + .OP_END_FACTORY_REG(AdaptiveMaxPool2d) /** * @brief Computes second-order gradients of the maxpooling3d function . \n @@ -477,8 +624,9 @@ REG_OP(MaxPoolV2) *@par Inputs: * One input: -*x: An NC1HWC0 Tensor. Supported type: float, double, int32, - * uint8, int16, int8, int64, uint16, half, uint32, uint64 . \n +* x: An 4D Tensor. Supported type: float, double, int32, + * uint8, int16, int8, int64, uint16, half, uint32, uint64. + * Must set the format, supported format list ["NCHW, NHWC"]. \n *@par Attributes: *@li ksize: A required list of int8, int16, int32, or int64 values, @@ -490,8 +638,8 @@ REG_OP(MaxPoolV2) *@li padding: A required string. No default value . \n *@par Outputs: -*y: A Tensor. Has the same type and format as input "x". -*argmax: A Tensor. Has the same type and format as input "x". +*@li y: A Tensor. Has the same type and format as input "x". +*@li argmax: A Tensor. Has the same type and format as input "x". *@attention Constraints: *@li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, * ksize[1] * ksize[2] <= 255. @@ -517,10 +665,12 @@ REG_OP(MaxPoolWithArgmax) *@par Inputs: * Three inputs, including: -*@li x: An NC1HWC0 tensor. Supported type: float, double, int32, +*@li x: An 4d tensor. Supported type: float, double, int32, * uint8, int16, int8, int64, uint16, half, uint32, uint64. -*@li grad: An NC1HWC0 tensor. Supported type: float, double, int32, + * Must set the format, supported format list ["NCHW, NHWC"] +*@li grad: An 4d tensor. Supported type: float, double, int32, * uint8, int16, int8, int64, uint16, half, uint32, uint64. + * Must set the format, supported format list ["NCHW, NHWC"] *@li argmx: An NC1HWC0 tensor of type int32 or int64 . \n *@par Attributes: @@ -741,7 +891,7 @@ REG_OP(AvgPoolV2Grad) * @brief Computes gradients of averagev2 pooling function. * @par Inputs: -* @li input_grad: An NHWC tensor of type float16, float32, or double. +*input_grad: An NHWC tensor of type float16, float32, or double. * @par Attributes: * @li orig_input_shape: A required tuple or list of type int32. @@ -759,10 +909,10 @@ REG_OP(AvgPoolV2Grad) * @li data_format: An optional string. Defaults to "NHWC". * @par Outputs: -* @out_grad: A mutable tensor with the same shape and type as "orig_input". +*out_grad: A mutable tensor with the same shape and type as "orig_input". * @par Third-party framework compatibility -* @li Compatible with the TensorFlow operator AvgPoolGrad. +*Compatible with the TensorFlow operator AvgPoolGrad. */ REG_OP(AvgPoolV2GradD) .INPUT(input_grad, TensorType({DT_FLOAT16})) @@ -1037,6 +1187,7 @@ REG_OP(MaxPool3DGrad) .OUTPUT(y, TensorType::RealNumberType()) .REQUIRED_ATTR(ksize, ListInt) .REQUIRED_ATTR(strides, ListInt) + .ATTR(padding, String, "SAME") .REQUIRED_ATTR(pads, ListInt) .ATTR(data_format, String, "NDHWC") .OP_END_FACTORY_REG(MaxPool3DGrad) @@ -1107,7 +1258,7 @@ REG_OP(AvgPool1DD) *@par Inputs: * One input: -*x: An NC1HWC0 Tensor of type float16. +*x: An 4d Tensor of type float16. Must set the format, supported format list ["NCHW, NHWC"]. *@par Attributes: *@li ksize: A required list of int8, int16, int32, or int64 values, specifying the size of the window for * each dimension of the input tensor. No default value. @@ -1148,9 +1299,9 @@ REG_OP(MaxPoolWithArgmaxV2) *@par Inputs: * Three inputs, including: -*@li x: An NC1HWC0 tensor of type float16. -*@li grad: An NC1HWC0 tensor of type float16. -*@li argmx: An NC1HWC0 tensor of type uint16 or int64 . \n +*@li x: An 4d tensor of type float16. Must set the format, supported format list ["NCHW, NHWC"] +*@li grad: An 4d tensor of type float16. Must set the format, supported format list ["NCHW, NHWC"] +*@li argmx: An 4d tensor of type uint16 or int64. Must set the format, supported format list ["NCHW, NHWC"] \n *@par Attributes: *@li ksize: A required list of int8, int16, int32, or int64 values, specifying the size of the window for @@ -1291,5 +1442,306 @@ REG_OP(MaxPoolV3Grad) .ATTR(global_pooling, Bool, false) .ATTR(ceil_mode, Bool, false) .OP_END_FACTORY_REG(MaxPoolV3Grad) + +/** +*@brief Performs Dilation2D on the input . \n + +*@par Inputs: +*x: A tensor of shape is 4d, format is support NHWC. +*filter: A tensor of shape is 3d, the type is same with x, and the c dimension is same with x. \n + +*@par Attributes: +*@li strides: A required list of 4 ints, specifying the stride of the sliding window. The strides of the N and C dimensions are 1. +*@li rates: A required list of 4 ints. The rates of the N and C dimensions are 1. +*@li padding_mode: A optional string. Defaults to "SAME", it support SAME and VALID. +*@li pads: An optional list of 4 ints. +*@li ceil_mode: An optional bool. Defaults to "false". Use ceil or floor to calculate the output size when padding_mode is "CALCULATED". +*@li data_format: An optional string, specifying the data format of "rates" and "strides", either "NCHW" or "NHWC" (default). \n + +*@par Outputs: +*y: The output tensor. Has the same type and format as input "x" . \n + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator Dilation2D. +*/ +REG_OP(Dilation2D) + .INPUT(x,TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .INPUT(filter,TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .OUTPUT(y,TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(rates, ListInt) + .ATTR(padding_mode, String, "SAME") + .ATTR(pads, ListInt, {0,0,0,0}) + .ATTR(ceil_mode, Bool, false) + .ATTR(data_format, String, "NHWC") + .OP_END_FACTORY_REG(Dilation2D) + +/** +*@brief Performs Dilation2DBackpropFilter on the input. \n + +*@par Inputs: +*x: A tensor of shape is 4d, format is support NHWC. +*filter: A tensor of shape is 3d, the type is same with x, and the c dimension is same with x. +*out_backprop: Has the same type and format as input x and the c dimension is same with x. \n + +*@par Attributes +*@li strides: A required list of 4 ints, specifying the stride of the sliding window. The strides of the N and C dimension are 1. +*@li rates: A required list of 4 ints, the rates of the N and C dimensions are 1. +*@li padding_mode: A optional string. Defaults to "SAME", it support SAME and VALID. +*@li pads: A optional list of 4 ints. +*@li ceil_mode: An optional bool. Defaults to "false". Use ceil or floor to calculate the output size when padding_mode is "CALCULATED". +*@li data_format: An optional string, specifying the data format of "rates" and "strides", either "NCHW" or "NHWC" (default). \n + +*@par Outputs: +*y: The output tensor. Has the same type and format as input "filter" . \n + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator Dilation2DBackpropFilter. +*/ + +REG_OP(Dilation2DBackpropFilter) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .INPUT(filter, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .INPUT(out_backprop, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .OUTPUT(y, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(rates, ListInt) + .ATTR(padding_mode, String, "SAME") + .ATTR(pads, ListInt, {0, 0, 0, 0}) + .ATTR(ceil_mode, Bool, false) + .ATTR(data_format, String, "NHWC") + .OP_END_FACTORY_REG(Dilation2DBackpropFilter) + +/** +*@brief Performs Dilation2DBackpropInput on the input. \n + +*@par Inputs: +*x: A tensor of shape is 4d, format is support NHWC. +*filter: A tensor of shape is 3d, the type is same with x, and the c dimension is same with x. +*out_backprop: Has the same type and format as input x and the c dimension is same with x. \n + +*@par Attributes +*@li strides: A required list of 4 ints, specifying the stride of the sliding window. The strides of the N and C dimension are 1. +*@li rates: A required list of 4 ints, the rates of the N and C dimensions are 1. +*@li padding_mode: A optional string. Defaults to "SAME", it support SAME and VALID. +*@li pads: A optional list of 4 ints. +*@li ceil_mode: An optional bool. Defaults to "false". Use ceil or floor to calculate the output size when padding_mode is "CALCULATED". +*@li data_format: An optional string, specifying the data format of "rates" and "strides", either "NCHW" or "NHWC" (default). \n + +*@par Outputs: +*y: The output tensor. Has the same type and format as input "x" . \n + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator Dilation2DBackpropInput. +*/ + +REG_OP(Dilation2DBackpropInput) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .INPUT(filter, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .INPUT(out_backprop, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .OUTPUT(y, + TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_UINT8, DT_INT16, DT_INT8, DT_UINT16})) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(rates, ListInt) + .ATTR(padding_mode, String, "SAME") + .ATTR(pads, ListInt, {0, 0, 0, 0}) + .ATTR(ceil_mode, Bool, false) + .ATTR(data_format, String, "NHWC") + .OP_END_FACTORY_REG(Dilation2DBackpropInput) + +/** +* @brief Applies a 2D adaptive average pooling over +* an input signal composed of several input planes. \n + +* @par Inputs: +* One input, including: +* @li x: A Tensor. Must be one of the following data types: +* float16, float32. \n + +* @par Attributes: +* @li output_size: A required list of 2 ints +* specifying the size (H,W) of the output tensor. \n + +* @par Outputs: +* @li y: A Tensor. Has the same data type as "x" \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator AdaptiveAvgPool2d. +*/ +REG_OP(AdaptiveAvgPool2d) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(output_size, ListInt) + .OP_END_FACTORY_REG(AdaptiveAvgPool2d) + +/** +* @brief Compute gradients of adaptive averagev2 pooling function. + +* @par Inputs: +* @li input_grad: A Tensor. Must be one of the following data types: +* float16, float32. + +* @par Attributes: +* @li orig_input_shape: A required tuple or list of type int32. + +* @par Outputs: +* @li output_grad: A tensor with the same type as "input_grad". + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator AdaptiveAvgPool2dGrad. +*/ +REG_OP(AdaptiveAvgPool2dGrad) + .INPUT(input_grad, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(output_grad, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(orig_input_shape, ListInt) + .OP_END_FACTORY_REG(AdaptiveAvgPool2dGrad) + +/** +* @brief Performs the backpropagation of MaxPoolWithGradArgmaxV1. + +* @par Inputs: +* Three inputs, including: +* @li x: An NC1HWC0 tensor of type float16. +* @li grad: An NC1HWC0 tensor of type float16. +* @li argmax: An NC1HWC0 tensor of type uint16 or int64. \n + +* @par Attributes: +* @li ksize: A required list of int8, int16, int32, or int64 values, specifying the size of the window for +* each dimension of the input tensor. No default value. +* @li strides: A required list of int8, int16, int32, or int64 values, specifying the stride of the sliding window for +* each dimension of the input tensor. No default value. +* @li pads: A required listint. \n + +* @par Outputs: +* y: A Tensor. Has the same type and format as input "x". \n + +* @attention Constraints: +* @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, ksize[1] * ksize[2] <= 255. +* @li "strides" is a list that has length 4: strides[0] = 1 or strides[3] = 1 +* @li "pads" is listint. +* @li "ceil_mode" defaults to False. +* @li "data_format" defaults to "NC1HWC0". \n + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator MaxPoolGradWithArgmaxV1. +*/ + +REG_OP(MaxPoolGradWithArgmaxV1) + .INPUT(x, TensorType({DT_FLOAT16})) + .INPUT(grad, TensorType({DT_FLOAT16})) + .INPUT(argmax, TensorType({DT_UINT16})) + .OUTPUT(y, TensorType({DT_FLOAT16})) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(dtype, Int, 3) + .ATTR(dilation, ListInt, {1, 1, 1, 1}) + .ATTR(ceil_mode, Bool, false) + .OP_END_FACTORY_REG(MaxPoolGradWithArgmaxV1) + +/** +* @brief Performs max pooling on the input and outputs both max values and indices. + +* @par Inputs: +* One input: +* x: An NC1HWC0 Tensor of type float16. \n + +* @par Attributes: +* @li ksize: A required list of int8, int16, int32, or int64 values, specifying the size of the window for +* each dimension of the input tensor. No default value. +* @li strides: A required list of int8, int16, int32, or int64 values, specifying the stride of the sliding window for +* each dimension of the input tensor. No default value. +* @li pads: A required string. No default value. \n + +* @par Outputs: +* y: A Tensor. Has the same type and format as input "x". +* argmax: A Tensor. type:uint16, format:NC1HWC0. \n + +* @attention Constraints: +* @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, ksize[1] * ksize[2] <= 255. +* @li "stride is a list that has length 4: strides[0] = 1 or strides[3] = 1, strides[1] <= 63, strides[0] >= 1, +* strides[2] <= 63, strides[2] >= 1. +* @li "pads" is listint. +* @li "ceil_mode" defaults to False. +* @li "data_format" defaults to "NC1HWC0". \n + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator MaxPoolWithArgmaxV1. +*/ +REG_OP(MaxPoolWithArgmaxV1) + .INPUT(x, TensorType({DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT16})) + .OUTPUT(argmax, TensorType({DT_UINT16})) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .REQUIRED_ATTR(pads, ListInt) + .ATTR(dtype, Int, 3) + .ATTR(dilation, ListInt, {1, 1, 1, 1}) + .ATTR(ceil_mode, Bool, false) + .OP_END_FACTORY_REG(MaxPoolWithArgmaxV1) + +/** +*@brief Randomly sample a subset of positive and negative examples,and overwrite +the label vector to the ignore value (-1) for all elements that are not +included in the sample.\n + +* @par Inputs: +* One input: +* labels: shape of labels,(N, ) label vector with values. \n + +* @par Attributes: +* @li batch_size_per_images: A require attribute of type int. +* @li positive_fraction: A require attribute of type float. + +*@par Outputs: +*y: The result of subSample. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator SubSample. +*@par Restrictions: +*Warning: This operator can be integrated only by MaskRcnn. Please do not use it directly. +*/ +REG_OP(SubSample) + .INPUT(labels, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_INT32})) + .REQUIRED_ATTR(batch_size_per_images, Int) + .REQUIRED_ATTR(positive_fraction, Float) + .OP_END_FACTORY_REG(SubSample) + +/** +*@brief Randomly sample a subset of positive and negative examples,and overwrite +the label vector to the ignore value (-1) for all elements that are not +included in the sample.\n + +* @par Inputs: +* two inputs, including: +* @li labels: shape of labels,(N, ) label vector with values:. +* @li shuffle_matrix: random matrix with shape (N, ). \n + +* @par Attributes: +* @li batch_size_per_images: A require attribute of type int. +* @li positive_fraction: A require attribute of type float. + +*@par Outputs: +*y: The result of subSample. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator SubSampleLabels. +*@par Restrictions: +*Warning: This operator can be integrated only by MaskRcnn. Please do not use it directly. +*/ +REG_OP(SubSampleLabels) + .INPUT(labels, TensorType({DT_INT32})) + .INPUT(shuffle_matrix, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_INT32})) + .REQUIRED_ATTR(batch_size_per_images, Int) + .REQUIRED_ATTR(positive_fraction, Float) + .OP_END_FACTORY_REG(SubSampleLabels) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H diff --git a/third_party/fwkacllib/inc/ops/nn_training_ops.h b/third_party/fwkacllib/inc/ops/nn_training_ops.h index 047fd6da..75e91aee 100644 --- a/third_party/fwkacllib/inc/ops/nn_training_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_training_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -2102,6 +2102,55 @@ REG_OP(FusedMulApplyMomentumExtern) .OP_END_FACTORY_REG(FusedMulApplyMomentumExtern) /** +*@brief Updates '*var' according to the momentum scheme. +* accum = accum * momentum - x1 * x2 * lr +* if use_nesterov is True: +* var += accum * momentum - x1 * x2 * lr +* else: +* var += accum +* +*@par Inputs: +*@li var: A mutable tensor. Must be one of the data types defined in +* TensorType::NumberType(). Should be from a Variable(). +*@li accum: A mutable tensor. Has the same type as "var". Should be from a +* Variable(). +*@li lr: A tensor for the learning rate. Has the same type as "var". Should be +* from a Variable(). +*@li x1: A Tensor has type TensorType::NumberType(). +*@li momentum: A scalar. Has the same type as "var". +*@li x2: A scalar has the same type as "var". +* +*@par Attributes: +*@li use_nesterov: An optional bool. Defaults to "False". +* If "True", var will be updated by using Nesterov momentum. +*@li use_locking: An optional bool. Defaults to "False". +* If "True", updating of the "var" tensor is protected by a lock; +* otherwise the behavior is undefined, but may exhibit less contention. +* +*@par Outputs: +* var: A mutable tensor. Has the same type as input "var". +* +*@attention Constraints: +* The input tensors must have the same shape. +* +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator ResourceApplyKerasMomentum. +* +*/ +REG_OP(FusedMulApplyKerasMomentum) + .INPUT(var, TensorType::NumberType()) + .INPUT(accum, TensorType::NumberType()) + .INPUT(lr, TensorType::NumberType()) + .INPUT(x1, TensorType::NumberType()) + .INPUT(momentum, TensorType::NumberType()) + .INPUT(x2, TensorType::NumberType()) + .OUTPUT(var, TensorType::NumberType()) + .OUTPUT(accum, TensorType::NumberType()) + .ATTR(use_locking, Bool, false) + .ATTR(use_nesterov, Bool, false) + .OP_END_FACTORY_REG(FusedMulApplyKerasMomentum) + +/** *@brief Update "g" according to the LARS algorithm . \n *@par Inputs: diff --git a/third_party/fwkacllib/inc/ops/no_op.h b/third_party/fwkacllib/inc/ops/no_op.h index 7834591c..b27b1fa0 100644 --- a/third_party/fwkacllib/inc/ops/no_op.h +++ b/third_party/fwkacllib/inc/ops/no_op.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h b/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h index e0e5dfc6..ca1c24eb 100644 --- a/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h +++ b/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -223,7 +223,29 @@ REG_OP(Relu6Grad) .INPUT(features, TensorType::RealNumberType()) .OUTPUT(backprops, TensorType::RealNumberType()) .OP_END_FACTORY_REG(Relu6Grad) - +/** +*@brief Calculate the elu_grad_v2 function. +*Applies the element-wise function: +* Computes the backward for the elu: if x>0, 1; otherwise elu() + alpha . +*@par Inputs: +*One inputs, including: +* @li grads: A tensor. Must be one of the following types: +* float16, float32. +* @li activations: A tensor. Must be one of the following types: +* float16, float32. +* +*@par Outputs: +*y: A Tensor with the same type and shape of grads's. +* +*@par Attributes: +*@li alpha: scalar parameter, default value = 1.0 +*/ +REG_OP(EluGradV2) + .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(activations, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(alpha, Float, 1.0) + .OP_END_FACTORY_REG(EluGradV2) /** * @brief Compute sigmoid of "x" element-wise . \n @@ -509,6 +531,42 @@ REG_OP(Elu) .OP_END_FACTORY_REG(Elu) /** +*@brief Continuously Differentiable Exponential Linear Uints: +* Perform the linear uint element-wise on the input tensor X using formula: +* max(0, x) + min(0, alpha * (exp(x/alpha) - 1)). \n + +*@par Inputs: +*x: A float16, float32, for the input data type . \n + +*@par Attributes: +*alpha1: A float32. Defines at which negative value the ELU saturates. Defaults to "1.0" . \n + +*@par Attributes: +*alpha2: A float32. Defines at which negative value the ELU saturates. Defaults to "1.0" . \n + +*@par Attributes: +*alpha3: A float32. Defines at which positive value the ELU saturates. Defaults to "1.0" . \n + +*@par Outputs: +*y: A float16, float32, for the normalized result . \n + +*@attention Constraints: +*@li The input is of type float16 or float32 . \n + +*@par Multiple batches supported or not +*Supported +*@par Third-party framework compatibility +*@li Compatible with ONNX's Celu operator +*/ +REG_OP(Celu) + .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT,DT_FLOAT16})) + .ATTR(alpha1, Float, 1.0) + .ATTR(alpha2, Float, 1.0) + .ATTR(alpha3, Float, 1.0) + .OP_END_FACTORY_REG(Celu) + +/** *@brief Computes gradients for the exponential linear (Elu) operation. * *@par Inputs: @@ -640,6 +698,352 @@ REG_OP(Mish) .OUTPUT(y, TensorType({ DT_FLOAT,DT_FLOAT16 })) .OP_END_FACTORY_REG(Mish) +/** + * @brief: pytorch mish_grad operator. + * @par Inputs: + * three input, including: + * @li grad: A Tensor. shape, datatype and format is same as x + * @li x: A Tensor. Must be one of the following types: float16, float32 + * @li tanhx: A Tensor. shape, datatype and format is same as x + * @par Outputs: + * 1 output, including: + * @li x_grad: A Tensor. shape, datatype and format is same as x + */ + +REG_OP(MishGrad) + .INPUT(grad, TensorType({ DT_FLOAT,DT_FLOAT16 })) + .INPUT(x, TensorType({ DT_FLOAT,DT_FLOAT16 })) + .OPTIONAL_INPUT(tanhx, TensorType({ DT_FLOAT,DT_FLOAT16 })) + .OUTPUT(x_grad, TensorType({ DT_FLOAT,DT_FLOAT16 })) + .OP_END_FACTORY_REG(MishGrad) + +/** + * @brief pytorch hardtanh_backward operator. + * + * @par Inputs: + * 2 inputs, including: + * @li result, minimum tensor of the linear region range, + * datatype: float16/float32, format:ND/5HD. + * @li grad, maximum tensor of the linear region range, + * datatype:float16/float32, format:ND/5HD. \n + + * @par Attributes: + * 2 attributes, including: + * @li min_val, minimum value of the linear region range, datatype:float. + * @li max_val, maximum value of the linear region range, datatype:float. \n + + * @par Outputs: + * 1 output, including: + * @li y, hardtanh_backward output tensor, datatype and format is same as + * input result. \n + + * @attention Constraints: + * This operator only supports dataType: float16/float32, format: ND/5HD. \n + + * @par Third-party framework compatibility + * Compatible with the Pytorch operator HardtanhGrad. + */ +REG_OP(HardtanhGrad) + .INPUT(result, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "First operand." */ + .INPUT(grad, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "Second operand." */ + .OUTPUT(y, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "Result, has same element type as two inputs" */ + .ATTR(min_val, Float, -1.0) + .ATTR(max_val, Float, 1.0) + .OP_END_FACTORY_REG(HardtanhGrad) + +/** +* @brief Calculates the softplus loss function with attributes of beta and threshold. \n + +* @par Inputs: +* One inputs, including: +* @li x: A mutable Tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* @li beta: An optional float. Defaults to "1.0" \n + +* @li threshold: An optional float. Defaults to "20.0" \n + +* @par Outputs: +* @li y: A mutable Tensor. Has the same type as "x" \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Softplus. +*/ +REG_OP(SoftplusV2) + .INPUT(x, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .OUTPUT(y, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .ATTR(beta, Float, 1.0) + .ATTR(threshold, Float, 20.0) + .OP_END_FACTORY_REG(SoftplusV2) + +/** +* @brief Calculates the reversed outputs of the function "softplus_v2". \n + +* @par Inputs: +* Two inputs, including: +* @li input_gradients: A mutable Tensor. Must be one of the following types: +* float16, float32. +* @li input_features: A mutable Tensor of the same type as "input_gradients" \n + +* @par Attributes: +* @li beta: An optional float. Defaults to "1.0" \n + +* @li threshold: An optional float. Defaults to "20.0" \n + +* @par Outputs: +* @li output_backprops: A mutable Tensor. Has the same type as "input_gradients" \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator SoftplusGrad. +*/ +REG_OP(SoftplusV2Grad) + .INPUT(input_gradients, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .INPUT(input_features, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .OUTPUT(output_backprops, TensorType({ DT_FLOAT, DT_FLOAT16 })) + .ATTR(beta, Float, 1.0) + .ATTR(threshold, Float, 20.0) + .OP_END_FACTORY_REG(SoftplusV2Grad) + +/** + * @brief ThresholdedRelu takes one input data (Tensor) and produces one output data (Tensor) + * where the rectified linear function, y = x for x > alpha, y = 0 otherwise, is applied to the tensor elementwise. + * + * @par inputs + * one input including: + * @li x: input A Tensor. Must be one of the following types: float32, float16 + * + * @par output + * one output including: + * @li y:A Tensor of the same type as x + * + */ +REG_OP(ThresholdedRelu) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(alpha, Float, 1.0) + .OP_END_FACTORY_REG(ThresholdedRelu) + +/** +* @brief Calculate the hard shrinkage function. \n + +* @par Inputs: +* One inputs, including: +* @li input_x: A tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* @li lambd: An optional float. Defaults to 0.5. \n + +* @par Outputs: +* y: A Tensor with the same dtype and shape of input_x's. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Hardshrink. \n +*/ +REG_OP(HardShrink) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(lambd, Float, 0.5) + .OP_END_FACTORY_REG(HardShrink) + +/** +*@brief Calculate the hard shrink grad function. \n +* +* Computes the gradient for the HardShrink: if x > lambda or x < -lambda, x,otherwise 0 +* +*@par Inputs: +*Two inputs, including: +* @li gradients: A tensor. Must be one of the following types: +* float16, float32. \n +* @li features: A tensor. Must be one of the following types: +* float16, float32. \n +* +*@par Outputs: +*backprops: A Tensor with the same type and shape of features's. \n +* +*@par Attributes: +*@li lambd: An optional float.Defaults to 0.5. \n +* +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Hardshrink_backward. \n +*/ + REG_OP(HardShrinkGrad) + .INPUT(gradients, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(lambd, Float, 0.5) + .OP_END_FACTORY_REG(HardShrinkGrad) + +/** +* @brief Calculate the hard sigmoid function. \n + +* @par Inputs: +* One inputs, including: +* @li input_x: A tensor. Must be one of the following types: +* float16, float32, int32. \n + +* @par Attributes: +* @li alpha: An optional float. Defaults to 0.16666666. \n +* @li beta: An optional float. Defaults to 0.5. \n + +* @par Outputs: +* y: A Tensor with the same dtype and shape of input_x's. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Hardsigmoid. \n +*/ +REG_OP(HardSigmoid) + .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32})) + .OUTPUT(output_y, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(alpha, Float, 0.16666666) + .ATTR(beta, Float, 0.5) + .OP_END_FACTORY_REG(HardSigmoid) + +/** +* @brief Calculate the soft shrinkage function. \n + +* @par Inputs: +* One inputs, including: +* @li input_x: A tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* @li lambd: An optional float. Defaults to 0.5. \n + +* @par Outputs: +* y: A Tensor with the same dtype and shape of input_x's. \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator Softshrink. \n +*/ +REG_OP(SoftShrink) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(lambd, Float, 0.5) + .OP_END_FACTORY_REG(SoftShrink) + +/** +* @brief Calculate the reversed outputs of the function "soft_shrink". \n + +* @par Inputs: +* Two inputs, including: +* @li input_grad: A tensor. Must be one of the following types: +* float16, float32. \n +* @li input_x: A tensor of the same dtype as "input_grad". \n + +* @par Attributes: +* @li lambd: An optional float. Defaults to 0.5. \n + +* @par Outputs: +* y: A Tensor of the same dtype and shape as "input_graxd". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator SoftShrinkGrad. \n +*/ +REG_OP(SoftShrinkGrad) + .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(lambd, Float, 0.5) + .OP_END_FACTORY_REG(SoftShrinkGrad) + +/** +*@brief Calculate the gradient of log simoid. \n + +*@par Inputs: +*Two inputs, including: +* @li grads: A tensor, gradient of previous layer. Must be one of the following types: +* float16, float32. \n +* @li features: A tensor, input of log sigmoid. Must be one of the following types: +* float16, float32. \n + +*@par Outputs: +*One outputs, including: +* @li backprops: A tensor with the same type of and shape of grads. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator LogSigmoidBackward. \n +*/ +REG_OP(LogSigmoidGrad) + .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(LogSigmoidGrad) + +/** +*@brief Calculate -ln(1+e^(-x)). \n + +*@par Inputs: +*One inputs, including: +* @li x: A tensor. Must be one of the following types: +* float16, float32. \n + +*@par Outputs: +*One outputs, including: +* @li y: A tensor with the same type and shape of x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator LogSigmoid. \n +*/ +REG_OP(LogSigmoid) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) /* "input:x" */ + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) /* "output:y" */ + .OP_END_FACTORY_REG(LogSigmoid) + +/** +*@brief Calculate the backward outputs of the function "hard_sigmoid" \n + +*@par Inputs: +*One inputs, including: +* @li grads: A tensor. Must be one of the following types: +* float16, float32. \n +* @li input_x: A tensor. Must be one of the following types: +* float16, float32. \n + +*@par Outputs: +*One outputs, including: +* @li y: A tensor with the same type and shape of x's. \n + +* @par Attributes: +* @li alpha: An optional float. Defaults to 0.16666666. \n +* @li beta: An optional float. Defaults to 0.5. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator LogSigmoidGrad. \n +*/ +REG_OP(HardSigmoidGrad) + .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(alpha, Float, 0.16666666) + .ATTR(beta, Float, 0.5) + .OP_END_FACTORY_REG(HardSigmoidGrad) + +/** +* @brief Calculate the shrink function. \n + +* @par Inputs: +* One inputs, including: +* @li input_x: A tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* @li lambd: An optional float. Defaults to 0.5. \n +* @li bias: An optional float. Defaults to 0.0. \n + +* @par Outputs: +* y: A Tensor with the same dtype and shape of input_x's. \n + +* @par Third-party framework compatibility +* Compatible with the ONNX operator Shrink. \n +*/ +REG_OP(Shrink) + .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(lambd, Float, 0.5) + .ATTR(bias, Float, 0.0) + .OP_END_FACTORY_REG(Shrink) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NONLINEAR_FUC_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h b/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h index 8d7ef9f9..f36d2935 100644 --- a/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h +++ b/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/outfeed_ops.h b/third_party/fwkacllib/inc/ops/outfeed_ops.h index e0b783bc..53b9d701 100644 --- a/third_party/fwkacllib/inc/ops/outfeed_ops.h +++ b/third_party/fwkacllib/inc/ops/outfeed_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/pad_ops.h b/third_party/fwkacllib/inc/ops/pad_ops.h index f746b3b3..6854c866 100644 --- a/third_party/fwkacllib/inc/ops/pad_ops.h +++ b/third_party/fwkacllib/inc/ops/pad_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -101,7 +101,7 @@ REG_OP(FillD) */ REG_OP(BroadcastTo) .INPUT(x, TensorType::BasicType()) - .INPUT(shape, TensorType({DT_INT32})) + .INPUT(shape, TensorType({DT_INT32,DT_INT64})) .OUTPUT(y, TensorType::BasicType()) .OP_END_FACTORY_REG(BroadcastTo) @@ -161,7 +161,7 @@ REG_OP(Pad) *@brief Pads a tensor . \n *@par Inputs: -*x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int32 . \n +*x: A Tensor. Must be one of the following types: float16, float32, int32 . \n *@par Attributes: *paddings: An optional "vector>". Defaults to "{}". @@ -180,8 +180,8 @@ REG_OP(Pad) * Warning: THIS FUNCTION IS DEPRECATED. Please use Pad instead. */ REG_OP(PadD) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8, DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8, DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) .REQUIRED_ATTR(paddings, ListListInt) .OP_END_FACTORY_REG(PadD) @@ -213,7 +213,7 @@ REG_OP(PadV2) *@brief Pads a tensor . \n *@par Inputs: -*x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int32 . \n +*x: A Tensor. Must be one of the following types: float16, float32, int32 . \n *constant_values: A Tensor. Must have the same type as input. *@par Attributes: @@ -227,10 +227,7 @@ REG_OP(PadV2) *y: A Tensor of the same type as "x" . \n *@par Third-party framework compatibility: -* Compatible with TensorFlow operator Pad. -* -* @par Restrictions: -* Warning: THIS FUNCTION IS DEPRECATED. Please use Pad instead. +* Compatible with TensorFlow operator PadV2. */ REG_OP(PadV2D) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) @@ -272,42 +269,42 @@ REG_OP(PadV3) .ATTR(paddings_contiguous, Bool, true) .OP_END_FACTORY_REG(PadV3) -/** -*@brief Pads a tensor. - -*@par Inputs: -*x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int32. - -*@par Attributes: -* @li paddings: An required "vector>". -* For each dimension D of input, paddings[D, 0] indicates how many -* values to add before the contents of tensor in that dimension, -* and paddings[D, 1] indicates how many values to add after the -* contents of tensor in that dimension. -* @li constant_values: An optional int value for pad. -* @li mode: An optional string, Defaults to "constant", indicates paddings mode, -* support "constant", "reflect", "edge" -* @li paddings_contiguous: An optional bool value, Defaults to true. -* If true, paddings is arranged as [[begin0, end0], [begin1, end1], ...] -* If false, paddings is arranged as [[begin0, begin1], ..., [end0, end1], ...] - -*@par Outputs: -*y: A Tensor of the same type as "x". - -*@par Third-party framework compatibility: -* Compatible with ONNX operator Pad. - -* @par Restrictions: -* Warning: THIS FUNCTION IS DEPRECATED. Please use PadV3 instead. -*/ -REG_OP(PadV3D) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8})) - .REQUIRED_ATTR(paddings, ListListInt) - .ATTR(constant_values, Int, 0) - .ATTR(mode, String, "constant") - .ATTR(paddings_contiguous, Bool, true) - .OP_END_FACTORY_REG(PadV3D) + /** + *@brief Pads a tensor. + + *@par Inputs: + *x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int32. + + *@par Attributes: + * @li paddings: An required "vector>". + * For each dimension D of input, paddings[D, 0] indicates how many + * values to add before the contents of tensor in that dimension, + * and paddings[D, 1] indicates how many values to add after the + * contents of tensor in that dimension. + * @li constant_values: An optional int value for pad. + * @li mode: An optional string, Defaults to "constant", indicates paddings mode, + * support "constant", "reflect", "edge" + * @li paddings_contiguous: An optional bool value, Defaults to true. + * If true, paddings is arranged as [[begin0, end0], [begin1, end1], ...] + * If false, paddings is arranged as [[begin0, begin1], ..., [end0, end1], ...] + + *@par Outputs: + *y: A Tensor of the same type as "x". + + *@par Third-party framework compatibility: + * Compatible with ONNX operator Pad. + + * @par Restrictions: + * Warning: THIS FUNCTION IS DEPRECATED. Please use PadV3 instead. + */ + REG_OP(PadV3D) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8})) + .REQUIRED_ATTR(paddings, ListListInt) + .ATTR(constant_values, Int, 0) + .ATTR(mode, String, "constant") + .ATTR(paddings_contiguous, Bool, true) + .OP_END_FACTORY_REG(PadV3D) /** *@brief Create a diagonal tensor @@ -403,5 +400,76 @@ REG_OP(EmbeddingRankId) .ATTR(mode, String, "mod") .OP_END_FACTORY_REG(EmbeddingRankId) +/** +*@brief EmbeddingLocalIndex, Sort statistics index according to rank_id \n + +*@par Inputs: +* @li addr_table: A 2D tensor which last dimension must be 3. +* @li index: A tensor with data type int32, int64, uint32, uint64. + +*@par Attributes: +* @li row_memory: The size of Embedding vector in a row, the default is 320. +* @li mode: String type, currently there are two options: 'mod' and 'order' + +*@par Outputs: +* @li local_idx:Index on each server. +* @li nums:The number of local_idx found on each server. +* @li recover_idx:The sorted local_idx element is at the position corresponding +* to the original input index. + +*@par Third-party framework compatibility +* Compatible with the TensorFlow operator Diag. +*/ +REG_OP(EmbeddingLocalIndex) + .INPUT(addr_table, TensorType({DT_UINT64})) + .INPUT(index, TensorType({DT_INT64,DT_INT32,DT_UINT32,DT_UINT64})) + .OUTPUT(local_idx, TensorType({DT_INT64,DT_INT32,DT_UINT32,DT_UINT64})) + .OUTPUT(nums, TensorType({DT_INT64,DT_INT32,DT_UINT32,DT_UINT64})) + .OUTPUT(recover_idx, TensorType({DT_INT64,DT_INT32,DT_UINT32,DT_UINT64})) + .ATTR(row_memory, Int, 320) + .ATTR(mode, String, "mod") + .OP_END_FACTORY_REG(EmbeddingLocalIndex) + +/** +* @brief Fill the value to a tensor has the specified shape. + +* @par Inputs: +* One inputs, including: +* @li dims: An Tensor, specify the shape that the value to fill. + +* @par Attributes: +* @li value: An optional float value. Defaults to 0.0. + +* @par Outputs: +* @li y: A Tensor. Has the shape specify by attr shape, and full of the value specify by attr value. + +* @par Third-party framework compatibility +* Compatible with the ONNX operator ConstantOfShape. +*/ +REG_OP(FillV2) + .INPUT(dims, TensorType({DT_INT16, DT_INT32, DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64})) + .ATTR(value, Float, 0) + .OP_END_FACTORY_REG(FillV2) + +/** +* @brief Fill the value to a tensor has the specified shape. + +* @par Attributes: +* @li value: An optional float value. Defaults to 0.0. + +* @li dims: An required listInt to specify the shape that the value to fill. + +* @par Outputs: +* @li y: A Tensor. Has the shape specify by attr shape, and full of the value specify by attr value. + +* @par Third-party framework compatibility +* Compatible with the ONNX operator ConstantOfShape. +*/ +REG_OP(FillV2D) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_UINT8, DT_INT16, DT_INT32, DT_INT64})) + .ATTR(value, Float, 0) + .REQUIRED_ATTR(dims, ListInt) + .OP_END_FACTORY_REG(FillV2D) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_PAD_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/parsing_ops.h b/third_party/fwkacllib/inc/ops/parsing_ops.h index 5c7adfd8..b625180a 100644 --- a/third_party/fwkacllib/inc/ops/parsing_ops.h +++ b/third_party/fwkacllib/inc/ops/parsing_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -51,6 +51,246 @@ REG_OP(StringToNumber) .ATTR(out_type, Type, DT_FLOAT) .OP_END_FACTORY_REG(StringToNumber) +/** +*@brief Convert serialized tensorflow.TensorProto prototype to Tensor. +*@brief Parse an Example prototype. +*@par Input: +*serialized: A Tensor of type string. +*dense_defaults: DYNAMIC INPUT Tensor type as string, float, int64. \n + +*@par Attributes: +*num_sparse: type int num of inputs sparse_indices , sparse_values, sparse_shapes +*out_type: output type +*sparse_keys: ListString +*sparse_types: types of sparse_values +*dense_keys: ListString +*dense_shapes: output of dense_defaults shape +*dense_types: output of dense_defaults type \n + +*@par Outputs: +*sparse_indices: A Tensor of type string. +*sparse_values: Has the same type as sparse_types. +*sparse_shapes: A Tensor of type int64 +*dense_values: Has the same type as dense_defaults. + +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +**/ +REG_OP(ParseSingleExample) + .INPUT(serialized, TensorType({DT_STRING})) + .DYNAMIC_INPUT(dense_defaults, TensorType({DT_STRING,DT_FLOAT,DT_INT64})) + .DYNAMIC_OUTPUT(sparse_indices, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(sparse_values, TensorType({DT_STRING,DT_FLOAT,DT_INT64})) + .DYNAMIC_OUTPUT(sparse_shapes, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(dense_values, TensorType({DT_STRING,DT_FLOAT,DT_INT64})) + .ATTR(num_sparse, Int, 0) + .ATTR(sparse_keys, ListString, {}) + .ATTR(dense_keys, ListString, {}) + .ATTR(sparse_types, ListType, {}) + .ATTR(Tdense, ListType, {}) + .ATTR(dense_shapes, ListListInt, {}) + .OP_END_FACTORY_REG(ParseSingleExample) + +/** +*@brief Decodes raw file into tensor . \n +*@par Input: +*bytes: A Tensor of type string. + +*@par Attributes: +*little_endian: bool ture +*out_type: output type + +*@par Outputs: +*Output: A Tensor +**/ +REG_OP(DecodeRaw) + .INPUT(bytes, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_BOOL,DT_FLOAT16,DT_DOUBLE,DT_FLOAT, + DT_INT64,DT_INT32,DT_INT8,DT_UINT8,DT_INT16, + DT_UINT16,DT_COMPLEX64,DT_COMPLEX128})) + .ATTR(out_type, Type, DT_FLOAT) + .ATTR(little_endian, Bool, true) + .OP_END_FACTORY_REG(DecodeRaw) + +/** +*@brief Convert serialized tensorflow.TensorProto prototype to Tensor. \n + +*@par Inputs: +*serialized: A Tensor of string type. Scalar string containing serialized +*TensorProto prototype. \n + +*@par Attributes: +*out_type: The type of the serialized tensor. The provided type must match the +*type of the serialized tensor and no implicit conversion will take place. \n + +*@par Outputs: +*output: A Tensor of type out_type. \n + +*@attention Constraints: +*The implementation for StringToNumber on Ascend uses AICPU, +*with badperformance. \n + +*@par Third-party framework compatibility +*@li compatible with tensorflow ParseTensor operator. +*/ +REG_OP(ParseTensor) + .INPUT(serialized, TensorType({DT_STRING})) + .OUTPUT(output, TensorType(DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT16, + DT_UINT16, DT_UINT8, DT_INT32, DT_INT64, DT_UINT32, + DT_UINT64, DT_BOOL, DT_DOUBLE, DT_STRING, + DT_COMPLEX64, DT_COMPLEX128})) + .ATTR(out_type, Type, DT_FLOAT) + .OP_END_FACTORY_REG(ParseTensor) + +/** +*@brief Converts each string in the input Tensor to the specified numeric +*type . \n + +*@par Inputs: +*Inputs include: +*records: Each string is a record/row in the csv and all records should have the +*same format. \n +*record_defaults: One tensor per column of the input record, with either a +*scalar default value for that column or an empty vector if the column is +*required. \n + +*@par Attributes: +*OUT_TYPE: The numeric type to interpret each string in string_tensor as . \n +*field_delim: char delimiter to separate fields in a record. \n +*use_quote_delim: If false, treats double quotation marks as regular characters +*inside of the string fields (ignoring RFC 4180, Section 2, Bullet 5). \n +*na_value: Additional string to recognize as NA/NaN. \n + +*@par Outputs: +*output: A Tensor. Has the same type as x . \n + +*@attention Constraints: +*The implementation for StringToNumber on Ascend uses AICPU, with bad +*performance. \n + +*@par Third-party framework compatibility +*@li compatible with tensorflow StringToNumber operator. +*/ +REG_OP(DecodeCSV) + .INPUT(records, TensorType({DT_STRING})) + .DYNAMIC_INPUT(record_defaults, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, + DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(output, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, + DT_INT64, DT_STRING})) + .ATTR(OUT_TYPE, ListType, {}) + .ATTR(field_delim, String, ",") + .ATTR(use_quote_delim, Bool, true) + .ATTR(na_value, String, ",") + .ATTR(select_cols, ListInt, {}) + .OP_END_FACTORY_REG(DecodeCSV) + +/** +*@brief Convert serialized tensorflow.TensorProto prototype to Tensor. +*@brief Parse an Example prototype. +*@par Input: +*serialized: A Tensor of type string. \n +*name:A Tensor of type string. \n +*sparse_keys: Dynamic input tensor of string. \n +*dense_keys: Dynamic input tensor of string \n +*dense_defaults: Dynamic input tensor type as string, float, int64. \n + +*@par Attributes: +*Nsparse: Number of sparse_keys, sparse_indices and sparse_shapes \n +*Ndense: Number of dense_keys \n +*sparse_types: types of sparse_values \n +*Tdense: Type of dense_defaults dense_defaults and dense_values \n +*dense_shapes: output of dense_defaults shape \n + +*@par Outputs: +*sparse_indices: A Tensor of type string. \n +*sparse_values: Has the same type as sparse_types. \n +*sparse_shapes: A Tensor of type int64 \n +*dense_values: Has the same type as dense_defaults. \n +*@par Third-party framework compatibility \n +*@li compatible with tensorflow StringToNumber operator. \n +*/ +REG_OP(ParseExample) + .INPUT(serialized, TensorType({DT_STRING})) + .INPUT(name, TensorType({DT_STRING})) + .DYNAMIC_INPUT(sparse_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(dense_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(dense_defaults, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(sparse_indices, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(sparse_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(sparse_shapes, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(dense_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .ATTR(Nsparse, Int, 0) + .ATTR(Ndense, Int, 0) + .ATTR(sparse_types, ListType, {}) + .ATTR(Tdense, ListType, {}) + .ATTR(dense_shapes, ListListInt, {}) + .OP_END_FACTORY_REG(ParseExample) + +/** +*@brief Transforms a scalar brain.SequenceExample proto (as strings) into typed +*tensors. +*@par Input: +*serialized: A Tensor of type string. \n +*feature_list_dense_missing_assumed_empty:A Tensor of type string. \n +*context_sparse_keys: Dynamic input tensor of string. \n +*context_dense_keys: Dynamic input tensor of string \n +*feature_list_sparse_keys: Dynamic input tensor of string \n +*feature_list_dense_keys: Dynamic input tensor of string \n +*context_dense_defaults: Dynamic input tensor of string, float, int64 \n +*debug_name: A Tensor of type string. \n + +*@par Attributes: +*Ncontext_sparse: Number of context_sparse_keys, context_sparse_indices and context_sparse_shapes \n +*Ncontext_dense: Number of context_dense_keys \n +*Nfeature_list_sparse: Number of feature_list_sparse_keys \n +*Nfeature_list_dense: Number of feature_list_dense_keys \n +*context_sparse_types: Types of context_sparse_values \n +*Tcontext_dense: Number of dense_keys \n +*feature_list_dense_types: Types of feature_list_dense_values \n +*context_dense_shapes: Shape of context_dense \n +*feature_list_sparse_types: Type of feature_list_sparse_values \n +*feature_list_dense_shapes: Shape of feature_list_dense \n + +*@par Outputs: +*context_sparse_indices: Dynamic output tensor of type int64. \n +*context_sparse_values: Dynamic output tensor of type string, float, int64. \n +*context_sparse_shapes: Dynamic output tensor of type int64 \n +*context_dense_values: Dynamic output tensor of type string, float, int64. \n +*feature_list_sparse_indices: Dynamic output tensor of type int64. \n +*feature_list_sparse_values: Dynamic output tensor of type string, float, int64. \n +*feature_list_sparse_shapes: Dynamic output tensor of type int64 \n +*feature_list_dense_values: Dynamic output tensor of type string, float, int64. \n +*@par Third-party framework compatibility \n +*@li compatible with tensorflow StringToNumber operator. \n +*/ +REG_OP(ParseSingleSequenceExample) + .INPUT(serialized, TensorType({DT_STRING})) + .INPUT(feature_list_dense_missing_assumed_empty, TensorType({DT_STRING})) + .DYNAMIC_INPUT(context_sparse_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(context_dense_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(feature_list_sparse_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(feature_list_dense_keys, TensorType({DT_STRING})) + .DYNAMIC_INPUT(context_dense_defaults, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .INPUT(debug_name, TensorType({DT_STRING})) + .DYNAMIC_OUTPUT(context_sparse_indices, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(context_sparse_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(context_sparse_shapes, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(context_dense_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(feature_list_sparse_indices, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(feature_list_sparse_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .DYNAMIC_OUTPUT(feature_list_sparse_shapes, TensorType({DT_INT64})) + .DYNAMIC_OUTPUT(feature_list_dense_values, TensorType({DT_FLOAT, DT_INT64, DT_STRING})) + .ATTR(Ncontext_sparse, Int, 0) + .ATTR(Ncontext_dense, Int, 0) + .ATTR(Nfeature_list_sparse, Int, 0) + .ATTR(Nfeature_list_dense, Int, 0) + .ATTR(context_sparse_types, ListType, {}) + .ATTR(Tcontext_dense, ListType, {}) + .ATTR(feature_list_dense_types, ListType, {}) + .ATTR(context_dense_shapes, ListListInt, {}) + .ATTR(feature_list_sparse_types, ListType, {}) + .ATTR(feature_list_dense_shapes, ListListInt, {}) + .OP_END_FACTORY_REG(ParseSingleSequenceExample) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_PARSING_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/quantize_ops.h b/third_party/fwkacllib/inc/ops/quantize_ops.h index b53cfeb6..69d5e67e 100644 --- a/third_party/fwkacllib/inc/ops/quantize_ops.h +++ b/third_party/fwkacllib/inc/ops/quantize_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -62,6 +62,26 @@ REG_OP(Dequantize) /** *@brief Quantizes the input . \n +*@par Inputs: +*x: shape and dtype of input_x. \n +*scales: shape and dtype of input_scales. \n +*zero_points: shape and dtype of input_zero_points \n +*@par Attributes: +*@li axis: the processed dim. \n +*@par Outputs: +*y: shape and dtype of output_y, should be same shape as input, dtype is same as the quantified type . \n +*/ +REG_OP(Quantize) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(scales, TensorType({DT_FLOAT})) + .INPUT(zero_points, TensorType({DT_INT8,DT_UINT8,DT_INT32})) + .OUTPUT(y, TensorType({DT_INT8,DT_UINT8,DT_INT32})) + .REQUIRED_ATTR(dtype, String) + .ATTR(axis, Int, 1) + .OP_END_FACTORY_REG(Quantize) + +/** +*@brief Quantizes the input . \n *@par Inputs: *x: An NC1HWC0 tensor of type float16 or float32, specifying the input . \n @@ -194,7 +214,7 @@ REG_OP(AscendRequant) *@brief Requantizes the input of int16 . \n *@par Inputs: -*@li x: An NC1HWC0 tensor of type int16, specifying the input. +*@li x0: An NC1HWC0 tensor of type int16, specifying the input. *@li req_scale: An NC1HWC0 tensor of type uint64, specifying the scaling ratio. *@li x1: An NC1HWC0 tensor of type int16 . \n @@ -203,22 +223,21 @@ REG_OP(AscendRequant) *@li relu_flag: A optional bool, specifying whether to perform ReLU, either "True" or "False". Defaults to "False" . \n *@par Outputs: -*@li y: The dequantized output tensor of type int8 and with format NC1HWC0. +*@li y0: The dequantized output tensor of type int8 and with format NC1HWC0. *@li y1: The dequantized output tensor of type int16 and with format NC1HWC0 . \n *@par Third-party framework compatibility * It is a custom operator. It has no corresponding operator in Caffe. */ REG_OP(AscendRequantS16) - .INPUT(x, TensorType({DT_INT16})) + .INPUT(x0, TensorType({DT_INT16})) .INPUT(req_scale, TensorType({DT_UINT64})) .OPTIONAL_INPUT(x1, TensorType({DT_INT16})) - .OUTPUT(y, TensorType({DT_INT8})) + .OUTPUT(y0, TensorType({DT_INT8})) .OUTPUT(y1, TensorType({DT_INT16})) .ATTR(dual_output, Bool, false) .ATTR(relu_flag, Bool, false) .OP_END_FACTORY_REG(AscendRequantS16) - } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_QUANTIZE_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/ragged_array_ops.h b/third_party/fwkacllib/inc/ops/ragged_array_ops.h index 9b31aa8e..20484623 100644 --- a/third_party/fwkacllib/inc/ops/ragged_array_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_array_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h b/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h index 13488a25..020e3da4 100644 --- a/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/ragged_math_ops.h b/third_party/fwkacllib/inc/ops/ragged_math_ops.h index 8af4f867..258b0ca1 100644 --- a/third_party/fwkacllib/inc/ops/ragged_math_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_math_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/random_ops.h b/third_party/fwkacllib/inc/ops/random_ops.h index b46da435..b65a68f1 100644 --- a/third_party/fwkacllib/inc/ops/random_ops.h +++ b/third_party/fwkacllib/inc/ops/random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -356,6 +356,39 @@ REG_OP(DropOutGenMask) .ATTR(seed2, Int, 0) .OP_END_FACTORY_REG(DropOutGenMask) + +/** +*@brief Generate random uint8 mask for dropout v3 . \n + +*@par Inputs: +include: +*@li shape:The shape of the output tensor. +*@li prob:0-D. Prob of 1 . \n + +*@par Attributes: +*@li seed:If either seed or seed2 are set to be non-zero, the random number +*generator is seeded by the given seed. Otherwise, it is seeded by a random seed. +*@li seed2:A second seed to avoid seed collision . \n + +*@par Outputs: +*y:Output (1-D) random number using uint8 data format . \n + +*@attention Constraints: +*The output is aligned with 16 + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. + +*@see DropOutGenMaskV3() +*/ +REG_OP(DropOutGenMaskV3) + .INPUT(shape, TensorType({ DT_INT32, DT_INT64 })) + .INPUT(prob, TensorType({ DT_FLOAT16, DT_FLOAT })) + .OUTPUT(y, TensorType({ DT_UINT8 })) + .ATTR(seed, Int, 0) + .ATTR(seed2, Int, 0) + .OP_END_FACTORY_REG(DropOutGenMaskV3) + /** *@brief Generates values in an interval . \n @@ -495,6 +528,62 @@ REG_OP(ShuffleChannel) DT_UINT16, DT_INT32, DT_UINT32,DT_INT64,DT_UINT64})) .ATTR(group, Int, 1) .OP_END_FACTORY_REG(ShuffleChannel) + +/** + * @briefGenerate a tensor of samples from a multinomial + * distribution according to the probabilities of each of + * the possible outcomes. + * + * @par inputs + * one input including: + * @li x:Input tensor with shape [batch_size, class_size], + * where class_size is the number of all possible outcomes. + * Each value along the axis zero represents the unnormalized + * log-probability of each corresponding outcome in a batch. + * + * @par output + * one output including: + * @li y:Output tensor with shape [batch_size, sample_size], + * where sample_size is the number of times to sample. + * Each value along the axis zero represents the outcome of + * the corresponding sample in a batch. + * + * @par Restrictions: + * Warning:THIS FUNCTION IS EXPERIMENTAL. Please do not use. + */ +REG_OP(MultinomialFuss) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_FLOAT64})) + .OUTPUT(y, TensorType({DT_INT32, DT_INT64})) + .ATTR(dtype, Int, 6) + .ATTR(sample_size, Int, 1) + .ATTR(seed, Float, 0) + .OP_END_FACTORY_REG(MultinomialFuss) + +/** +* @brief During training, randomly zeroes some of the elements of the input tensor +* with probability +* +* @par Inputs: +* @li x: A ND Tensor. Must be one of the following data types: Float, Float16 +* @li seed: A ND Tensor. Must be one of the following data types: Float +* +* @par Attributes: +* @li p: probability of an element to be zeroed +* +* @par Outputs: +* @li y: A tensor with the same shape and type as "x". +* @li mask: A tensor with the same shape and type as "x". +* @li new_seed: A tensor with the same shape and type as "seed". +*/ + +REG_OP(DropoutV2) + .INPUT(x, TensorType({ DT_FLOAT16, DT_FLOAT })) + .INPUT(seed, TensorType({ DT_FLOAT })) + .OUTPUT(y, TensorType({ DT_FLOAT16, DT_FLOAT })) + .OUTPUT(mask, TensorType({ DT_FLOAT })) + .OUTPUT(seed, TensorType({ DT_FLOAT })) + .REQUIRED_ATTR(p, Float) + .OP_END_FACTORY_REG(DropoutV2) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_RANDOM_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/reduce_ops.h b/third_party/fwkacllib/inc/ops/reduce_ops.h index 6f44093e..97c7b8e1 100644 --- a/third_party/fwkacllib/inc/ops/reduce_ops.h +++ b/third_party/fwkacllib/inc/ops/reduce_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 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. @@ -37,7 +37,7 @@ namespace ge { *@attention Constraints: * This operator is a BatchNorm fusion operator for updating the moving * averages for training. -* This operator is used in conjunction with BNTrainingUpdate. +* This operator is used in conjunction with BNTrainingReduce. */ REG_OP(BNTrainingReduce) .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) @@ -46,6 +46,27 @@ REG_OP(BNTrainingReduce) .OP_END_FACTORY_REG(BNTrainingReduce) /** +*@brief Performs reduced batch normalization . \n + +*@par Inputs: +*x: A 6D Tensor of type float16 or float32, with format NDC1HWC0 . \n + +*@par Outputs: +*@li sum: A 3D Tensor of type float32 for SUM reduced "x". +*@li square_sum: A 3D Tensor of type float32 for SUMSQ reduced "x" . \n + +*@attention Constraints: +* This operator is a BatchNorm fusion operator for updating the moving +* averages for training. +* This operator is used in conjunction with BN3DTrainingReduce. +*/ +REG_OP(BN3DTrainingReduce) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(sum, TensorType({DT_FLOAT})) + .OUTPUT(square_sum, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(BN3DTrainingReduce) + +/** *@brief Performs the backpropagation of BatchNorm . \n *@par Inputs: @@ -89,6 +110,49 @@ REG_OP(BNTrainingReduceGrad) .OP_END_FACTORY_REG(BNTrainingReduceGrad) /** +*@brief Performs the backpropagation of BatchNorm . \n + +*@par Inputs: +* Seven inputs, including: +*@li grads: A 6D Tensor of type float16 or float32, with format NDC1HWC0, for +* the gradient. +*@li x: A 6D Tensor of type float16 or float32, with format NDC1HWC0. +*@li diff_scale: A 6D Tensor of type float32, with format NDC1HWC0, +* for the mean of "x". +*@li diff_offset: A 6D Tensor of type float32, with format NDC1HWC0, +* for the variance of "x". +*@li scale: A 6D Tensor of type float32, with format NDC1HWC0. +*@li batch_mean: A 6D Tensor of type float32, with format NDC1HWC0, +* for the mean of "x". +*@li batch_variance: A 6D Tensor of type float32, with format NDC1HWC0, +* for the variance of "x" . \n + +*@par Attributes: +*epsilon: An optional float32. Defaults to "0.0001". A small float number +* added to the variance of "x" . \n + +*@par Outputs: +*y: A Tensor of type float16 or float32, with format NDC1HWC0, for the offset +* of "x" . \n + +*@attention Constraints: +* The preceding layer of this operator must be BN3DTrainingReduceGrad . \n + +*@see BN3DTrainingReduceGrad +*/ +REG_OP(BN3DTrainingReduceGrad) + .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(diff_scale, TensorType({DT_FLOAT})) + .INPUT(diff_offset, TensorType({DT_FLOAT})) + .INPUT(scale, TensorType({DT_FLOAT})) + .INPUT(batch_mean, TensorType({DT_FLOAT})) + .INPUT(batch_variance, TensorType({DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .ATTR(epsilon, Float, 0.0001) + .OP_END_FACTORY_REG(BN3DTrainingReduceGrad) + +/** *@brief Performs reduced batch normalization . \n *@par Inputs: @@ -120,7 +184,7 @@ REG_OP(BNTrainingReduceGrad) *@attention Constraints: *@li This operator is a BatchNorm fusion operator for updating the moving averages for training. -*This operator is used in conjunction with BNTrainingReduce. +*This operator is used in conjunction with BNTrainingUpdate. *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square * root instruction. */ @@ -142,6 +206,59 @@ REG_OP(BNTrainingUpdate) .OP_END_FACTORY_REG(BNTrainingUpdate) /** +*@brief Performs reduced batch normalization . \n + +*@par Inputs: +* Seven inputs, including: (NDC1HWC0 supported) +*@li x: A 6D Tensor of type float16 or float32. +*@li sum: A 6D Tensor of type float32 for the output of operator +* BN3DTrainingUpdate. +*@li square_sum: A 6D Tensor of type float32 for the output of operator +* BN3DTrainingUpdate. +*@li scale: A 6D Tensor of type float32, for the scaling factor. +*@li offset: A 6D Tensor of type float32, for the scaling offset. +*@li mean: A 6D Tensor of type float32, for the updated mean. +*@li variance: A 6D Tensor of type float32, for the updated variance . \n + +*@par Attributes: +*@li epsilon: A required float32, specifying the small value added to variance +* to avoid dividing by zero. +*@li factor: A required float32, specifying the weight for updating the mean +* and variance . \n + +*@par Outputs: +* Five outputs, including: (NDC1HWC0 supported) +*@li y: A 6D Tensor of type float16 or float32, for normalized "x". +*@li mean: A 6D Tensor of type float32, for the updated mean. +*@li variance: A 6D Tensor of type float32, for the updated variance. +*@li batch_mean: A 6D Tensor of type float32, for the mean of "x". +*@li batch_variance: A 6D Tensor of type float32, for the variance of "x" . \n + +*@attention Constraints: +*@li This operator is a BatchNorm fusion operator for updating the moving +averages for training. +*This operator is used in conjunction with BN3DTrainingUpdate. +*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square +* root instruction. +*/ +REG_OP(BN3DTrainingUpdate) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(sum, TensorType({DT_FLOAT})) + .INPUT(square_sum, TensorType({DT_FLOAT})) + .INPUT(scale, TensorType({DT_FLOAT})) + .INPUT(offset, TensorType({DT_FLOAT})) + .INPUT(mean, TensorType({DT_FLOAT})) + .INPUT(variance, TensorType({DT_FLOAT})) + .REQUIRED_ATTR(factor, Float) + .REQUIRED_ATTR(epsilon, Float) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT})) + .OUTPUT(mean, TensorType({DT_FLOAT})) + .OUTPUT(variance, TensorType({DT_FLOAT})) + .OUTPUT(batch_mean, TensorType({DT_FLOAT})) + .OUTPUT(batch_variance, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(BN3DTrainingUpdate) + +/** *@brief Performs batch normalization for inference . \n *@par Inputs: @@ -285,6 +402,40 @@ REG_OP(BNTrainingUpdateGrad) .OP_END_FACTORY_REG(BNTrainingUpdateGrad) /** +*@brief Performs the backpropagation of BatchNorm . \n + +*@par Inputs: +* Four inputs, including: +*@li grads: A 6D Tensor of type float16 or float32, with format NDC1HWC0, +* for the gradient. +*@li x: A 6D Tensor of type float16 or float32, with format NDC1HWC0. +*@li batch_mean: A 6D Tensor of type float32, with format NDC1HWC0, +* for the mean of "x". +*@li batch_variance: A 6D Tensor of type float32, with format NDC1HWC0, +* for the variance of "x" . \n + +*@par Attributes: +*epsilon: An optional float32. Defaults to "0.0001". A small float number +* added to the variance of "x" . \n + +*@par Outputs: +*@li diff_scale: A Tensor of type float32, with format NDC1HWC0, +* for the offset of "scale". +*@li diff_offset: A Tensor of type float32, with format NDC1HWC0, +* for the offset of "offset" . \n + +*/ +REG_OP(BN3DTrainingUpdateGrad) + .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(batch_mean, TensorType({DT_FLOAT})) + .INPUT(batch_variance, TensorType({DT_FLOAT})) + .ATTR(epsilon, Float, 0.0001) + .OUTPUT(diff_scale, TensorType({DT_FLOAT})) + .OUTPUT(diff_offset, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(BN3DTrainingUpdateGrad) + +/** *@brief Performs the backpropagation of BatchNorm for inference . \n *@par Inputs: @@ -635,8 +786,8 @@ REG_OP(ReduceMin) * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceMin instead. */ REG_OP(ReduceMinD) - .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8})) - .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8})) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8,DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8,DT_INT32})) .REQUIRED_ATTR(axes, ListInt) .ATTR(keep_dims, Bool, false) .OP_END_FACTORY_REG(ReduceMinD) @@ -747,14 +898,14 @@ REG_OP(Reduction) *@brief Computes the euclidean norm of elements across dimensions of a tensor . \n *@par Inputs: -*@li input_tensor: A Tensor. Must be one of the following types: float16, float32, int32. +*@li x: A Tensor. Must be one of the following types: float16, float32, int32. *@li axes: A Tensor of type int8 or int32. Specifies the dimensions to reduce. Defaults to "None" . \n *@par Attributes: *keep_dims: An optional bool. If "True", reduced dimensions will be retained. Defaults to "False" . \n *@par Outputs: -*output_tensor: A Tensor. Must be one of the following types: float16, float32, int32 . \n +*y: A Tensor. Must be one of the following types: float16, float32, int32 . \n *@attention Constraints: * If "axes = None", all dimensions will be reduced. "axes" must be in the range [-rank(input_shape), rank(input_shape)) . \n @@ -821,7 +972,7 @@ Defaults to "0.00001" . \n *batch_ variance: A Tensor of type float32 for the result variance . \n *@attention Constraints: -*For Ascend 310, the result accuracy fails to reach 1 due to the square root instruction. +*For Ascend 310, the result accuracy fails to reach 0.001 due to the square root instruction. */ REG_OP(INInferV2) .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) @@ -839,7 +990,7 @@ REG_OP(INInferV2) *@brief Performs reduced instance normalization . \n *@par Inputs: -*x: A Tensor of type float16 or float32, with format NC1HWC0 . \n +*x: A Tensor of type float16 or float32. \n *@par Outputs: *@li sum: A Tensor of type float32 for SUM reduced "x". @@ -862,19 +1013,19 @@ REG_OP(INTrainingReduceV2) *@par Inputs: * Seven inputs, including: (NC1HWC0supported) *@li x: A Tensor of type float16 or float32. -*@li sum: A T [N, C1, 1, 1, C0] ensor of type float32 for the output of operator INTrainingReduceV2. -*@li square_sum: A [N, C1, 1, 1, C0] Tensor of type float32 for the output of operator INTrainingReduceV2. -*@li gamma: A [N, C1, 1, 1, C0] Tensor of type float32, for the scaling gamma. -*@li beta: A [N, C1, 1, 1, C0] Tensor of type float32, for the scaling beta. -*@li mean: A [N, C1, 1, 1, C0] Tensor of type float32, for the updated mean. -*@li variance: A [N, C1, 1, 1, C0] Tensor of type float32, for the updated variance . \n +*@li sum: A Tensor of type float32 for the output of operator INTrainingReduceV2. +*@li square_sum: A Tensor of type float32 for the output of operator INTrainingReduceV2. +*@li gamma: A Tensor of type float32, for the scaling gamma. +*@li beta: A Tensor of type float32, for the scaling beta. +*@li mean: A Tensor of type float32, for the updated mean. +*@li variance: A Tensor of type float32, for the updated variance . \n *@par Attributes: *@li momentum: A required float32, specifying the momentum to update mean and var. *@li epsilon: A required float32, specifying the small value added to variance to avoid dividing by zero . \n *@par Outputs: -* Three outputs, including: (NC1HWC0 supported) +* Three outputs *@li y: A Tensor of type float16 or float32, for normalized "x". *@li batch_mean: A Tensor of type float32, for the updated mean. *@li batch_variance: A Tensor of type float32, for the updated variance . \n @@ -882,7 +1033,7 @@ REG_OP(INTrainingReduceV2) *@attention Constraints: *@li This operator is a InstanceNorm fusion operator for updating the moving averages for training. * This operator is used in conjunction with INTrainingReduceV2. -*@li For Ascend 310, the result accuracy fails to reach 1 due to the square root instruction. +*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction. */ REG_OP(INTrainingUpdateV2) .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) @@ -965,7 +1116,7 @@ for the updated variance. *@attention Constraints: *@li This operator is a InstanceNorm fusion operator for updating the moving averages for training. * This operator is used in conjunction with GNTrainingUpdate. -*@li For Ascend 310, the result accuracy fails to reach 1 due to the square root instruction. +*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction. */ REG_OP(GNTrainingUpdate) .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) @@ -982,6 +1133,98 @@ REG_OP(GNTrainingUpdate) .OUTPUT(batch_variance, TensorType({DT_FLOAT})) .OP_END_FACTORY_REG(GNTrainingUpdate) +/** +*@brief Joins a string Tensor across the given dimensions. \n + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. +*@li reduction_indices:A Tensor of type int. The text to be processed. + +*@par Attributes: +*@li keep_dims:A bool, An optional bool. Defaults to False. If True, retain reduced dimensions with length 1.. +*@li separator:string. + +*@par output: +*@li output::A Tensor of type string.. +*/ +REG_OP(ReduceJoin) + .INPUT(input, TensorType({DT_STRING})) + .INPUT(reduction_indices, TensorType({DT_INT32})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(keep_dims, Bool, true) + .ATTR(separator, String, "") + .OP_END_FACTORY_REG(ReduceJoin) + +/** +* @brief Calculates the standard deviation and average value of Tensors. + +* @par Inputs: +* @li x: A Tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* Three Attributes, including: +* @li dim: An optional listint, Defaults to "None". \n + +* @li unbiased: An optional bool. Defaults to "True". +* If "True", Use Bessel Correction. +* If "False", Do not use Bessel Correction. \n + +* @li keepdim: An optional bool. Defaults to "False". +* If "True", Keep the original tensor dimension. +* If "False", Do not keep the original tensor dimension. \n + +* @par Outputs: +* Two Outputs, including: +* @li y1: A Tensor. Has the same type as "x". +* @li y2: A Tensor. Has the same type as "x". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator ReduceStd. +*/ +REG_OP(ReduceStd) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y1, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y2, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(dim, ListInt, {}) + .ATTR(unbiased, Bool, true) + .ATTR(keepdim, Bool, false) + .OP_END_FACTORY_REG(ReduceStd) + +/** +* @brief Calculates the standard deviation of Tensors. + +* @par Inputs: +* include: +* @li x: A Tensor. Must be one of the following types: float16, float32. \n +* @li mean: A Tensor. It's the mean of X. Must be one of the following types: float16, float32. \n + + +* @par Attributes: +* Three Attributes, including: +* @li dim: An optional listint, Defaults to "None". \n +* @li unbiased: An optional bool. Defaults to "True". +* If "True", Use Bessel Correction. +* If "False", Do not use Bessel Correction. \n +* @li keepdim: An optional bool. Defaults to "False". +* If "True", Keep the original tensor dimension. +* If "False", Do not keep the original tensor dimension. \n + +* @par Outputs: +* @li y: A Tensor. It's the std of X. Has the same type as "x". + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator ReduceStdWithMean. +*/ +REG_OP(ReduceStdWithMean) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .ATTR(dim, ListInt, {}) + .ATTR(unbiased, Bool, true) + .ATTR(keepdim, Bool, false) + .OP_END_FACTORY_REG(ReduceStdWithMean) } //namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_REDUCE_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/resource_variable_ops.h b/third_party/fwkacllib/inc/ops/resource_variable_ops.h index 1b60d42a..74ac83f8 100644 --- a/third_party/fwkacllib/inc/ops/resource_variable_ops.h +++ b/third_party/fwkacllib/inc/ops/resource_variable_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/rnn.h b/third_party/fwkacllib/inc/ops/rnn.h index 84723872..80546860 100644 --- a/third_party/fwkacllib/inc/ops/rnn.h +++ b/third_party/fwkacllib/inc/ops/rnn.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -33,6 +33,7 @@ namespace ge { *@li c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li w:A 4D Tensor. Must be one of the following types: float16. The format must be FRACTAL_Z. *@li b:A 1D Tensor. Must be one of the following types: float16. The format must be ND . \n +*@li mask:A 1D Tensor. Must be one of the following types: uint8. *@par Attributes: *@li keep_prob:An integer identifying the keep prob in the op. Default to 1. @@ -42,7 +43,6 @@ namespace ge { *@par Outputs: *seven outputs: -*@li mask:A 1D Tensor. Must be one of the following types: uint8. *@li ct:A 4D Tensor. Must be one of the following types: float16, float32. *@li ht:A 4D Tensor. Must be one of the following types: float16. *@li it:A 4D Tensor. Must be one of the following types: float16, float32. @@ -187,16 +187,16 @@ REG_OP(DynamicRNNGrad) *@brief: DynamicRNN calculation. *@par Inputs: *ten inputs: -*@li x:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. -*@li w:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. -*@li b:A 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. -*@li seq_length:A 1D Tensor. Must be one of the following types: int32. The format must be ND. -*@li init_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. -*@li init_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. -*@li wci:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. -*@li wcf:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. -*@li wco:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. -*@li mask:A 1D Tensor. Must be one of the following types: uint8. The format must be ND . \n +*@li x:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li w:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li b:A required 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li seq_length:A optional Tensor. Only Support float16 in FRACTAL_NZ and int32 in ND. +*@li init_h:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li init_c:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wci:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wcf:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wco:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li mask:A 1D optional Tensor. Must be one of the following types: uint8. The format must be ND . \n *@par Attributes: *@li cell_type:An string identifying the cell type in the op. Default to "LSTM". Only LSTM is currently supported. @@ -209,6 +209,7 @@ REG_OP(DynamicRNNGrad) *@li time_major:An bool identifying the time major in the op. Default to true. *@li activation:An string identifying the type of activation function in the op. Default to "tanh". Only tanh is currently supported. *@li forget_bias:An float identifying the forget bias in the op. Default to 0. +*@li gate_order:An string identifying the type of gate order in the op. Support "ijfo" and "ifjo". Default to "ijfo". *@li is_training:An bool identifying is training in the op. Default to true . \n *@par Outputs: @@ -221,12 +222,14 @@ REG_OP(DynamicRNNGrad) *@li f:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li o:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li tanhct:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@par Third-party framework compatibility: +* Compatible with the TF operator LSTM. */ REG_OP(DynamicRNN) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(w, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) - .OPTIONAL_INPUT(seq_length, TensorType({DT_INT32})) + .OPTIONAL_INPUT(seq_length, TensorType({DT_INT32, DT_FLOAT16})) .OPTIONAL_INPUT(init_h, TensorType({DT_FLOAT16, DT_FLOAT})) .OPTIONAL_INPUT(init_c, TensorType({DT_FLOAT16, DT_FLOAT})) .OPTIONAL_INPUT(wci, TensorType({DT_FLOAT16, DT_FLOAT})) @@ -251,10 +254,238 @@ REG_OP(DynamicRNN) .ATTR(time_major, Bool, true) .ATTR(activation, String, "tanh") .ATTR(forget_bias, Float, 0.0) + .ATTR(gate_order, String, "ijfo") .ATTR(is_training, Bool, true) .OP_END_FACTORY_REG(DynamicRNN) /** +*@brief: DynamicRNNV2 calculation. +*@par Inputs: +*ten inputs: +*@li x:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li weight_input:A required 4D Tensor. Must be one of the following types: float16, float32. +*The format must be FRACTAL_Z. +*@li weight_hidden:A required 4D Tensor. Must be one of the following types: float16, float32. +*The format must be FRACTAL_Z. +*@li b:A required 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li seq_length:A optional 1D Tensor. Must be one of the following types: int32. The format must be ND. +*@li init_h:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li init_c:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wci:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wcf:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wco:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li mask:A 1D optional Tensor. Must be one of the following types: uint8. The format must be ND . \n + +*@par Attributes: +*@li cell_type:An string identifying the cell type in the op. Default to "LSTM". Only LSTM is currently supported. +*@li direction:An string identifying the direction in the op. Default to "UNIDIRECTIONAL". +*Only UNIDIRECTIONAL is currently supported. +*@li cell_depth:An integer identifying the cell depth in the op. Default to 1. +*@li use_peephole:An bool identifying if use peephole in the op. Default to false. +*@li keep_prob:An float identifying the keep prob in the op. Default to 1. +*@li cell_clip:An float identifying the cell clip in the op. Default to -1. +*@li num_proj:An integer identifying the num projection in the op. Default to 0. +*@li time_major:An bool identifying the time major in the op. Default to true. +*@li activation:An string identifying the type of activation function in the op. Default to "tanh". +*Only tanh is currently supported. +*@li recurrent_activation:An string identifying the type of activation function in the op. Default to "sigmoid". +*Supprot "sigmoid" and "hard_sigmoid". In general, set "hard_sigmoid" for TF Keras LSTM. +*@li forget_bias:An float identifying the forget bias in the op. Default to 0. +*@li gate_order:An string identifying the type of gate order in the op. Support "ijfo" and "ifco". Default to "ijfo". +*Set "ijfo" for TF operator LSTM, Set "ifco" for TF Keras LSTM. +*@li stateful: An bool identifying the type of stateful in the op. Default to fasle.Only false is currently supported. +*@li merge_mode: An string identifying the type of merge_modein the op. Default to "concat". +*Only "concat" is currently supported +*@li is_training:An bool identifying is training in the op. Default to true . \n + +*@par Outputs: +*eight outputs: +*@li y:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*Return the last output_h. +*@li output_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*Return the last output_c. +*@li i:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li j:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li f:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li o:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li tanhct:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@par Third-party framework compatibility: +* Compatible with the TF operator LSTM or TF keras operator LSTM. +*/ + +REG_OP(DynamicRNNV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(weight_input, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(weight_hidden, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(seq_length, TensorType({DT_INT32})) + .OPTIONAL_INPUT(init_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(init_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wci, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wcf, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wco, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(mask, TensorType({DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(i, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(j, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(f, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(o, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(tanhc, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(cell_type, String, "LSTM") + .ATTR(direction, String, "UNIDIRECTIONAL") + .ATTR(cell_depth, Int, 1) + .ATTR(use_peephole, Bool, false) + .ATTR(keep_prob, Float, 1.0) + .ATTR(cell_clip, Float, -1.0) + .ATTR(num_proj, Int, 0) + .ATTR(time_major, Bool, true) + .ATTR(activation, String, "tanh") + .ATTR(recurrent_activation, String, "sigmoid") + .ATTR(forget_bias, Float, 0.0) + .ATTR(gate_order, String, "ijfo") + .ATTR(stateful, Bool, false) + .ATTR(merge_mode, String, "concat") + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(DynamicRNNV2) + +/** +*@brief: DynamicRNNV3 calculation. +*@par Inputs: +*ten inputs: +*@li x:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li w:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li b:A required 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li seq_length:A optional 1D Tensor. Must be one of the following types: int32. The format must be ND. +*@li init_h:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li init_c:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wci:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wcf:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wco:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li mask:A 1D optional Tensor. Must be one of the following types: uint8. The format must be ND . \n +*@li real_mask:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li project:A 4D optional Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. + +*@par Attributes: +*@li cell_type:An string identifying the cell type in the op. Default to "LSTM". Only LSTM is currently supported. +*@li direction:An string identifying the direction in the op. Default to "UNIDIRECTIONAL". Only UNIDIRECTIONAL is currently supported. +*@li cell_depth:An integer identifying the cell depth in the op. Default to 1. +*@li use_peephole:An bool identifying if use peephole in the op. Default to false. +*@li keep_prob:An float identifying the keep prob in the op. Default to 1. +*@li cell_clip:An float identifying the cell clip in the op. Default to -1. +*@li num_proj:An integer identifying the num projection in the op. Default to 0. +*@li time_major:An bool identifying the time major in the op. Default to true. +*@li activation:An string identifying the type of activation function in the op. Default to "tanh". Only tanh is currently supported. +*@li forget_bias:An float identifying the forget bias in the op. Default to 0. +*@li is_training:An bool identifying is training in the op. Default to true . \n + +*@par Outputs: +*eight outputs: +*@li y:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li i:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li j:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li f:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li o:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li tanhct:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@par Third-party framework compatibility: +* Compatible with the TF operator LSTM. +*/ +REG_OP(DynamicRNNV3) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(w, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(seq_length, TensorType({DT_INT32})) + .OPTIONAL_INPUT(init_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(init_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wci, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wcf, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wco, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(mask, TensorType({DT_UINT8})) + .OPTIONAL_INPUT(real_mask, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(project, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(i, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(j, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(f, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(o, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(tanhc, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(cell_type, String, "LSTM") + .ATTR(direction, String, "UNIDIRECTIONAL") + .ATTR(cell_depth, Int, 1) + .ATTR(use_peephole, Bool, false) + .ATTR(keep_prob, Float, 1.0) + .ATTR(cell_clip, Float, -1.0) + .ATTR(num_proj, Int, 0) + .ATTR(time_major, Bool, true) + .ATTR(activation, String, "tanh") + .ATTR(forget_bias, Float, 0.0) + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(DynamicRNNV3) + +/** +*@brief: DynamicLSTMV2 calculation. +*@par Inputs: +*ten inputs: +*@li x:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li w:A required 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li b:A required 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li cont:A required 2D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li w_xc_x_static:A optional 2D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li h0:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li c0:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li wci:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wcf:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li wco:A optional 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li mask:A optional 1D Tensor. Must be one of the following types: uint8. The format must be ND . + +*@par Attributes: +*@li num_output:An integer identifying the num projection in the op. Default to 0. +*@li expose_hidden:An bool identifying the expose_hidden in the op. Default to flase. +*@li need_output_last:An bool identifying the time major in the op. Default to true. +*@li forget_bias:An float identifying the forget bias in the op. Default to 0. + +*@par Outputs: +*eight outputs: +*@li y:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li last_output_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li last_output_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@par Third-party framework compatibility: +* Compatible with the Caffe operator LSTM. +*@par Restrictions: +* Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DynamicLSTMV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(w, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(cont, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(w_xc_x_static, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(h0, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(c0, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wci, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wcf, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(wco, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(mask, TensorType({DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(last_output_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(last_output_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(num_output, Int, 0) + .ATTR(expose_hidden, Bool, false) + .ATTR(need_output_last, Bool, false) + .ATTR(forget_bias, Float, 0.0) + .OP_END_FACTORY_REG(DynamicLSTMV2) + +/** *@brief: LSTMInputGrad calculation. *@par Inputs: *ten inputs: \n @@ -297,6 +528,60 @@ REG_OP(LSTMInputGrad) .OP_END_FACTORY_REG(LSTMInputGrad) + +/** +*@brief: Dynamic LSTM Cell grad calculation.Calculate the gradient of gates and cell state. +*@par Inputs: +*twelve inputs: +*@li init_c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li c:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li dy:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li dh:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li dc:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li i:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li j:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li f:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li o:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li tanhct:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li mask:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li t_state:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ . \n + +*@par Attributes: +*@li forget_bias:An integer identifying the forget bias in the op. Default to 1. +*@li activation:An string identifying the type of activation function in the op. Default to "tanh". Only tanh is currently supported . \n +*@li direction:An string that marks the calculation sequence of the operator. Default to "Forward". +*@li gate_order:An string mark the order of output 4 gate. Default to "ijfo". + +*@par Outputs: +*two outputs: +*@li dgate:A 4D Tensor. Must be one of the following types: float16. +*@li dct_1:A 4D Tensor. Must be one of the following types: float16, float32. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DynamicLSTMGradCell) + .INPUT(init_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(c, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(dh, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(dc, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(i, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(j, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(f, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(o, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(tanhct, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(mask, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(t_state, TensorType({DT_INT32, DT_INT32})) + .OUTPUT(dgate, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(dct_1, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(forget_bias, Float, 1) + .ATTR(activation, String, "") + .ATTR(direction, String, "Forward") + .ATTR(gate_order, String, "ijfo") + .OP_END_FACTORY_REG(DynamicLSTMGradCell) + + /** *@brief: Basic LSTM Cell backward calculation.Calculate the gradient of input and hidden state. *@par Inputs: @@ -475,9 +760,9 @@ REG_OP(BasicRNNCell) .OP_END_FACTORY_REG(BasicRNNCell) /** -*@brief: DynamicGRU calculation. +*@brief DynamicGRU calculation. *@par Inputs: -*seven inputs: \n +*seven inputs: *@li x:Must be one of the following types: float16. The format must be FRACTAL_NZ. *@li w:Must be one of the following types: float16. The format must be FRACTAL_Z. *@li b:Must be one of the following types: float16, float32. The format must be ND. @@ -497,7 +782,7 @@ REG_OP(BasicRNNCell) *@li is_training:An bool identifying is training in the op. Default to true. *@par Outputs: -*five outputs: \n +*five outputs: *@li y:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li output_h:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li r:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. @@ -531,9 +816,9 @@ REG_OP(DynamicGRU) .OP_END_FACTORY_REG(DynamicGRU) /** -*@brief: DynamicGRUV2 calculation. +*@brief DynamicGRUV2 calculation. *@par Inputs: -*seven inputs: \n +*seven inputs: *@li x:Must be one of the following types: float16. The format must be FRACTAL_NZ. *@li weight_input:Must be one of the following types: float16. The format must be FRACTAL_Z. *@li weight_hidden:Must be one of the following types: float16. The format must be FRACTAL_Z. @@ -555,16 +840,13 @@ REG_OP(DynamicGRU) *@li is_training:An bool identifying is training in the op. Default to true. *@par Outputs: -*six outputs: \n +*six outputs: *@li y:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li output_h:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li update:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li reset:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li new:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li hidden_new:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. - -*@par Restrictions: -*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(DynamicGRUV2) .INPUT(x, TensorType({DT_FLOAT16})) @@ -592,6 +874,68 @@ REG_OP(DynamicGRUV2) .ATTR(is_training, Bool, true) .OP_END_FACTORY_REG(DynamicGRUV2) + +/** +*@brief DynamicGRUV2Hidden calculation. +*@par Inputs: +*five inputs: +*@li x_weight_input:Must be one of the following types: float32. The format must be FRACTAL_NZ. +*@li weight_hidden:Must be one of the following types: float16. The format must be FRACTAL_Z. +*@li bias_hidden:Must be one of the following types: float16, float32. The format must be ND. +*@li seq_length:Must be one of the following types: int32. The format must be ND. +*@li init_h:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. + +*@par Attributes: +*@li direction:An string identifying the direction in the op. Default to "UNIDIRECTIONAL". +Only UNIDIRECTIONAL is currently supported. +*@li cell_depth:An integer identifying the cell depth in the op. Default to 1. +*@li keep_prob:An float identifying the keep prob in the op. Default to 1. +*@li cell_clip:An float identifying the cell clip in the op. Default to -1. +*@li num_proj:An integer identifying the num projection in the op. Default to 0. +*@li time_major:An bool identifying the time major in the op. Default to true. +*@li activation:An string identifying the type of activation function in the op. Default to "tanh". +Only tanh is currently supported. +*@li gate_order:An string identifying the gate order in weight and bias. Default to "zrh". "rzh" is another option. +*@li reset_after:An bool identifying whether to apply reset gate after matrix multiplication. Default to true. +*@li is_training:An bool identifying is training in the op. Default to true. + +*@par Outputs: +*six outputs: +*@li y:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li output_h:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li update:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li reset:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li new:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li hidden_new:Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(DynamicGRUV2Hidden) + .INPUT(x_weight_input, TensorType({DT_FLOAT32})) + .INPUT(weight_hidden, TensorType({DT_FLOAT16})) + .OPTIONAL_INPUT(bias_hidden, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(seq_length, TensorType({DT_INT32})) + .OPTIONAL_INPUT(init_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(output_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(update, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(reset, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(new, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(hidden_new, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(direction, String, "UNIDIRECTIONAL") + .ATTR(cell_depth, Int, 1) + .ATTR(keep_prob, Float, 1.0) + .ATTR(cell_clip, Float, -1.0) + .ATTR(num_proj, Int, 0) + .ATTR(time_major, Bool, true) + .ATTR(activation, String, "tanh") + .ATTR(gate_order, String, "zrh") + .ATTR(reset_after, Bool, true) + .ATTR(is_training, Bool, true) + .OP_END_FACTORY_REG(DynamicGRUV2Hidden) + + /** *@brief: DynamicGRUV2Grad calculation. *@par Inputs: @@ -618,7 +962,6 @@ REG_OP(DynamicGRUV2) *@li cell_clip:An float identifying the cell clip in the op. Default to -1. *@li num_proj:An integer identifying the num projection in the op. Default to 0. *@li time_major:An bool identifying the time major in the op. Default to true. -*@li bias_type:An string identifying the type of bias_type function in the op. Default to "double_bias". *@li gate_order:An string identifying the gate order in weight and bias. Default to "zrh". "rzh" is another option. *@li reset_after:An bool identifying whether to apply reset gate after matrix multiplication. Default to true. @@ -630,6 +973,9 @@ REG_OP(DynamicGRUV2) *@li db_hidden:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li dx:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li dh_prev:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ REG_OP(DynamicGRUV2Grad) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) @@ -658,7 +1004,6 @@ REG_OP(DynamicGRUV2Grad) .ATTR(cell_clip, Float, -1.0) .ATTR(num_proj, Int, 0) .ATTR(time_major, Bool, true) - .ATTR(bias_type, String, "double_bias") .ATTR(gate_order, String, "zrh") .ATTR(reset_after, Bool, true) .OP_END_FACTORY_REG(DynamicGRUV2Grad) @@ -667,7 +1012,7 @@ REG_OP(DynamicGRUV2Grad) *@brief: GRUV2HiddenGrad calculation. *@par Inputs: *nine inputs: \n -*@li weight_hidden:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li dh_pre_t:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li init_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li dy:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. @@ -678,6 +1023,7 @@ REG_OP(DynamicGRUV2Grad) *@li hidden_new:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@par Attributes: +*@li t_state:An Int identifying the current t state. Default to [0, 4]. *@li gate_order:An string identifying the gate order in weight and bias. Default to "zrh". "rzh" is another option. *@par Outputs: @@ -685,10 +1031,12 @@ REG_OP(DynamicGRUV2Grad) *@li dh_prev:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li dgate_h:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. *@li dnt_x:A 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. */ -REG_OP(GRUV2HiddenGrad) - .INPUT(weight_hidden, TensorType({DT_FLOAT16, DT_FLOAT})) - .INPUT(init_h, TensorType({DT_FLOAT16, DT_FLOAT})) +REG_OP(GRUV2HiddenGradCell) + .INPUT(dh_pre_t, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(h, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT})) .INPUT(dh, TensorType({DT_FLOAT16, DT_FLOAT})) @@ -699,8 +1047,197 @@ REG_OP(GRUV2HiddenGrad) .OUTPUT(dh_prev, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(dgate_h, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(dnt_x, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(t_state, Int, 0) .ATTR(gate_order, String, "zrh") - .OP_END_FACTORY_REG(GRUV2HiddenGrad) + .OP_END_FACTORY_REG(GRUV2HiddenGradCell) + +/** +* @brief Calculates the reversed outputs of the function "embedding". \n + +* @par Inputs: +* Two inputs, including: +* @li grad: A mutable Tensor of word grad. Must be one of the following types: +* float32. +* @li indices: A mutable word index Tensor of the int32 type.\n + +* @par Attributes: +* @li num_weights: An int attr which use to judge how many words in dict. \n + +* @li padding_idx: An int attr judge which word to fill zeros. Defaults to "-1". \n + +* @li scale_grad_by_freq: An optional bool. Defaults to "False". +* If "True", "grad_weight" will be scale by word_frequency. +* If "False", "grad_weight" will not be scale by word_frequency. \n + +* @par Outputs: +* @li grad_weight: A mutable output Tensor of new word grad has the same type as "grads". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator EmbeddingDenseGrad. +*/ +REG_OP(EmbeddingDenseGrad) + .INPUT(grad, TensorType({ DT_FLOAT32 })) /* "First operand." */ + .INPUT(indices, TensorType({ DT_INT32 })) /* "Second operand." */ + .OUTPUT(y, TensorType({ DT_FLOAT32 })) /* "Result, has same element type as two inputs" */ + .REQUIRED_ATTR(num_weights, Int) + .ATTR(padding_idx, Int, -1) + .ATTR(scale_grad_by_freq, Bool, false) + .OP_END_FACTORY_REG(EmbeddingDenseGrad) + +/** +*@brief CommonLSTM calculation. +*@par Inputs: +*eight inputs: \n +*@li x:Each time step is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li w:Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li r:Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_ZN_LSTM. +*@li b:An optional input. Each direction is a 1D Tensor. Must be one of the following types: float16, float32. The format must be ND. +*@li sequence_lens:An optional input. A 1D Tensor.Must be one of the following types: int32. The format must be ND. +*@li initial_h:An optional input. Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li initial_c:An optional input. Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li p:An optional input. Each direction is a 1D Tensor.Must be one of the following types: float16, float32. The format must be ND. + +*@par Attributes: +*@li activation_alpha:Optional scaling values used by some activation functions. Empty is currently supported. +*@li activation_beta:Optional scaling values used by some activation functions. Empty is currently supported. +*@li activations:The list of activation functions. Empty is currently supported. +*@li clip:An float identifying the cell clip in the op. Default to -1. +*@li direction:Specify if the RNN is forward, reverse, or bidirectional. Must be one of forward(default), reverse, or bidirectional. +*@li hidden_size:Number of neurons in the hidden layer. Reserved. +*@li input_forget:Couple the input and forget gates if 1. Reserved. + +*@par Outputs: +*three outputs: \n +*@li y:First dimension is time step, second dimension is direction, others is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li y_h:Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*@li y_c:Each direction is a 4D Tensor. Must be one of the following types: float16, float32. The format must be FRACTAL_NZ. +*/ + +REG_OP(CommonLSTM) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(w, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(r, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(sequence_lens, TensorType({DT_INT32})) + .OPTIONAL_INPUT(initial_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(initial_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(p, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y_c, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(activation_alpha, ListFloat, {}) + .ATTR(activation_beta, ListFloat, {}) + .ATTR(activations, ListString, {}) + .ATTR(clip, Float, -1.0) + .ATTR(direction, String, "forward") + .REQUIRED_ATTR(hidden_size, Int) + .ATTR(input_forget, Int, 0) + .OP_END_FACTORY_REG(CommonLSTM) + +/** + * @brief Calculate the mask. According to hidden_size and num_step, convert seq_length to mask. + * + * @par Inputs: + * @li seq_length: A 1D Tensor. Must be one of the following types: int32. Record the current length of each batch. [batch_size]. + * @li b: A 1D Tensor. Must be one of the following types: fp16/fp32. Record the hidden_size. [4 * hidden_size]. + * @li x: A 3D Tensor. Must be one of the following types: fp16/fp32. Record the num_step/batch_size/input_size. [num_step, batch_size, input_size]. + * + * @par Outputs: + * seq_mask: A 3D Tensor. Must be one of the following types: fp16/fp32. with the shape of [num_step, batch_size, hidden_size]. And has the same type as "b" \n + * + * @par Restrictions: + * Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. + */ +REG_OP(RnnGenMaskV2) + .INPUT(seq_length, TensorType({DT_INT32})) + .INPUT(b, TensorType({{DT_FLOAT16, DT_FLOAT})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(seq_mask, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(RnnGenMaskV2) + +/** +* @brief Common GRU calculation. + +* @par Inputs: +* Eight inputs, including: +* @li x: The input sequences packed (and pontentially padded) into on 3D Tesnor(float16). The format must be FRACTAL_NZ +* @li w: The weight tensor for the gates is 3D Tensor(float16). The format must be FRACTAL_Z +* @li r: The recurrence weight tesnor is 3D Tensor(float16). The format must be FRACTAL_Z +* @li b: The bias tensor for the gates. The format must be ND +* @li sequence_lens: Optional tensor specifying lengths of sequences(int32). The format must be ND +* @li init_h: Optional initial value of the hidden(float16,float32). The format must be FRACTAL_NZ + +* @par Attributes: +* @li activation_alpha: Optional scaling values used by some activation functions. \n +* @li activation_beta: Optional scaling values used by some activation functions. \n +* @li activations: A list of 2 (or 4 if bidirectional) activation functions for update, reset, and hidden gates. \n +* @li clip: Cell clip threshold. \n +* @li direction: Specify if the RNN is forward, reverse, or bidirectional. \n +* @li hidden_size: Number of neurons in the hidden layer. \n +* @li linear_before_reset: When computing the output of the hidden gate, apply the linear transformation before multiplying by the output of the reset gate. \n + +* @par Outputs: +* @li y: A Tensor that concats all the intermediate output values of the hidden(float16,float32). The format must be FRACTAL_NZ +* @li y_h: The last output value of the hidden(float16,float32). The format must be FRACTAL_NZ +*/ +REG_OP(CommonGRU) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(w, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(r, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(b, TensorType({DT_FLOAT16, DT_FLOAT})) + .OPTIONAL_INPUT(sequence_lens, TensorType({DT_INT32})) + .OPTIONAL_INPUT(initial_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y_h, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(activation_alpha, ListFloat, {}) + .ATTR(activation_beta , ListFloat, {}) + .ATTR(activations , ListString, {}) + .ATTR(clip, Float, -1.0) + .ATTR(direction, String, "forward") + .REQUIRED_ATTR(hidden_size, Int) + .ATTR(linear_before_reset , Int, 0) + .OP_END_FACTORY_REG(CommonGRU) +/** +* @brief Calculates the reversed outputs of the function "embedding". \n + +* @par Inputs: +* Four inputs, including: +* @li weight: A mutable Tensor of word grad. Must be one of the following types: +* float32. +* @li indices: A mutable word index Tensor of the int32 type.\n +* @li offsets: A mutable word index Tensor of the int32 type.\n +* @li per_sample_weights: to indicate all weights should be taken to be 1. +* If specified, per_sample_weights must have exactly the same shape as input +* and is treated as having the same offsets, if those are not None. +* Only supported for mode='sum'..\n + +* @par Attributes: +* @li mode: An string attr which use "sum"``, ``"mean"`` or ``"max"``. Specifies the way to reduce the bag.. \n + +* @li scale_grad_by_freq: An optional bool. Defaults to "False". +* If "True", "grad_weight" will be scale by word_frequency. +* If "False", "grad_weight" will not be scale by word_frequency. \n +* @li sparse: if True, gradient w.r.t.attr weight matrix will be a sparse tensor. \n +* @li include_last_offset: if True, attr offsets has one additional element, where the last element +* is equivalent to the size of indices. This matches the CSR format.. \n + +* @par Outputs: +* @li grad_weight: A mutable output Tensor of new word grad has the same type as "grads". \n + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator EmbeddingBag. +*/ +REG_OP(EmbeddingBag) + .INPUT(weight, TensorType({ DT_FLOAT32 })) + .INPUT(indices, TensorType({ DT_INT32 })) + .OPTIONAL_INPUT(offsets, TensorType({DT_INT32})) + .OPTIONAL_INPUT(per_sample_weights, TensorType({DT_FLOAT32})) + .OUTPUT(y, TensorType({ DT_FLOAT32 })) + .ATTR(mode, String, "mean") + .ATTR(scale_grad_by_freq, Bool, false) + .ATTR(sparse, Bool, false) + .ATTR(include_last_offset, Bool, false) + .OP_END_FACTORY_REG(EmbeddingBag) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_RNN_H_ diff --git a/third_party/fwkacllib/inc/ops/rpn_ops.h b/third_party/fwkacllib/inc/ops/rpn_ops.h index b7649a44..089af326 100644 --- a/third_party/fwkacllib/inc/ops/rpn_ops.h +++ b/third_party/fwkacllib/inc/ops/rpn_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/save_ops.h b/third_party/fwkacllib/inc/ops/save_ops.h index 0ce473b7..5ce6c2e0 100644 --- a/third_party/fwkacllib/inc/ops/save_ops.h +++ b/third_party/fwkacllib/inc/ops/save_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/sdca_ops.h b/third_party/fwkacllib/inc/ops/sdca_ops.h index cbd9839d..34c6a268 100644 --- a/third_party/fwkacllib/inc/ops/sdca_ops.h +++ b/third_party/fwkacllib/inc/ops/sdca_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/selection_ops.h b/third_party/fwkacllib/inc/ops/selection_ops.h index 2c99e82e..1c26e033 100644 --- a/third_party/fwkacllib/inc/ops/selection_ops.h +++ b/third_party/fwkacllib/inc/ops/selection_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -240,6 +240,30 @@ REG_OP(GatherV2D) .OP_END_FACTORY_REG(GatherV2D) /** +*@Gathers values along an axis specified by dim . \n + +*@par Inputs: +*@li x: A Tensor. Must be one of the following types: float16, float32, int32, int64. +*@li index: A Tensor. Must be one of the following types: int64 . \n + +*@par Attributes: +* dim: the axis along which to index . \n + +*@par Outputs: +* y: A Tensor. Has the same type as "x" . \n + +*@par Third-party framework compatibility +*Compatible with the PyTorch operator Gather. +*/ + +REG_OP(GatherElements) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64})) + .INPUT(index, TensorType({DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64})) + .ATTR(dim, Int, 0) + .OP_END_FACTORY_REG(GatherElements) + +/** *@brief Extracts a strided slice of a tensor. Roughly speaking, this op extracts a slice of size (end-begin)/stride from the given input tensor. Starting at the location specified by begin the slice continues by @@ -275,8 +299,6 @@ REG_OP(GatherV2D) *@par Outputs: *y: A Tensor. Has the same type as "x" . \n -*@attention Constraints: - *@par Third-party framework compatibility * Compatible with the TensorFlow operator StridedSlice. */ @@ -327,8 +349,6 @@ REG_OP(StridedSlice) *@par Outputs: *y: A Tensor. Has the same type as "x" . \n -*@attention Constraints: - *@par Third-party framework compatibility * Compatible with the TensorFlow operator StridedSlice. @@ -385,8 +405,6 @@ REG_OP(StridedSliceD) *@par Outputs: *output: A Tensor. Has the same type as "dy" . \n -*@attention Constraints: - *@par Third-party framework compatibility * Compatible with the TensorFlow operator StridedSliceGradD. @@ -444,8 +462,6 @@ REG_OP(StridedSliceGradD) *@par Outputs: *output: A Tensor has the same type as "dy" . \n -*@attention Constraints: - *@par Third-party framework compatibility * Compatible with the TensorFlow operator StridedSliceGrad. */ @@ -487,6 +503,38 @@ REG_OP(UnsortedSegmentSum) .OP_END_FACTORY_REG(UnsortedSegmentSum) /** +*@brief Creates a one-dimensional tensor of size steps whose values are evenly spaced from start to +* end, inclusive, on a logarithmic scale with base base. \n + +*@par Inputs: +*One inputs, including: +* @li assist: A tensor. Must be one of the following types: +* float16, float32. \n + +* @par Attributes: +* @li start: An required float. Used to select the start. \n +* @li end: An required float. Used to select the end. \n +* @li steps: An optional int.Defaults to 100. \n +* @li base: An optional float.Defaults to 10.0. \n +* @li dtype: An optional int.Defaults to 1. \n + +*@par Outputs: +*y: A Tensor with the same type and shape of input_x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator logspaced. \n +*/ +REG_OP(LogSpaceD) + .INPUT(assist, TensorType({DT_FLOAT, DT_FLOAT16})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR (start, Float) + .REQUIRED_ATTR (end, Float) + .ATTR(steps, Int, 100) + .ATTR(base, Float, 10.0) + .ATTR(dtype, Int, 1) + .OP_END_FACTORY_REG(LogSpaceD) + +/** *@brief Computes the sum along segments of a tensor . \n *@par Inputs: @@ -797,6 +845,34 @@ REG_OP(SliceD) .OP_END_FACTORY_REG(SliceD) /** +*@brief Extracts a slice from a tensor. +* This operation extracts a slice of size "size" from a tensor "x" +* starting at the location specified by "begin" . \n + +*@par Inputs: +*@li x: A Tensor. Must be one of the following types: +* float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8, +* int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32 . \n + +*@par Inputs: +*@li offsets: The starting location for the slice. + +*@par Attributes: +*@li size: The tensor shape . \n + +*@par Outputs: +*y: A Tensor. Has the same type as "x". The slice extracted from the tensor. +*@par Restrictions: +*Warning: THIS FUNCTION IS DEPRECATED. Please use Slice instead. +*/ +REG_OP(SliceDV2) + .INPUT(x, TensorType::BasicType()) + .INPUT(offsets, TensorType::IndexNumberType()) + .OUTPUT(y, TensorType::BasicType()) + .REQUIRED_ATTR(size, ListInt) + .OP_END_FACTORY_REG(SliceDV2) + +/** * @brief Finds values and indices of the "k" largest elements for the last * dimension . \n @@ -829,8 +905,8 @@ REG_OP(SliceD) * @li sorted = true * @li It's unstable sorted indices on the platform of Ascend310 -* @par Third-party framework compatibility -* @li Compatible with the TensorFlow operator TopK. +* @par Restrictions: +* Warning: THIS FUNCTION IS DEPRECATED. Please use TopKV2 instead. */ REG_OP(TopKD) .INPUT(x, TensorType::RealNumberType()) @@ -859,6 +935,44 @@ REG_OP(TopKD) * @li sorted: An optional bool. Defaults to true. * If true, the resulting "k" elements will be sorted by the values in descending * order. +* @li dim: An optional int. Defaults to -1. For reserved use. +* @li largest: An optional bool. Defaults to true. For reserved use. \n + +* @par Outputs: +* @li values: A Tensor, specifying the sorted data. Has the same type as +* "input". +* @li indices: A Tensor of type int32, specifying the indices of sorted data . \n + +* @see TopK() +* @par Third-party framework compatibility +* @li Compatible with the TensorFlow operator TopKV2. +*/ +REG_OP(TopKV2) + .INPUT(x, TensorType::RealNumberType()) + .INPUT(k, TensorType({DT_INT32})) + .OUTPUT(values, TensorType::RealNumberType()) + .OUTPUT(indices, TensorType({DT_INT32})) + .ATTR(sorted, Bool, true) + .ATTR(dim, Int, -1) + .ATTR(largest, Bool, true) + .OP_END_FACTORY_REG(TopKV2) + +/** +* @brief Finds values and indices of the "k" largest elements for the last +* dimension . \n + +* @par Inputs: +* Two inputs, including: +* @li x: A 1D or higher tensor of type BasicType, with the last dimension +* at least "k". +* @li k: A 0D Tensor of type int32. +* Number of top elements to look for along the last dimension (along each row +* for matrices) . \n + +* @par Attributes: +* @li sorted: An optional bool. Defaults to true. +* If true, the resulting "k" elements will be sorted by the values in descending +* order. * @li T: Indicator of indices type . \n * @par Outputs: @@ -876,15 +990,17 @@ REG_OP(TopK) .OUTPUT(values, TensorType::RealNumberType()) .OUTPUT(indices, TensorType({DT_INT32})) .ATTR(sorted, Bool, true) + .ATTR(largest, Bool, true) + .ATTR(dim, Int, -1) .OP_END_FACTORY_REG(TopK) /** *@brief Creates a new tensor by applying sparse "updates" to individual values or slices within a tensor (initially zero for numeric, empty for string) of the given "shape" according to "indices" . \n *@par Inputs: *Inputs including: -* @li indices: A required index tensor. Must be one of the following types: float32, float16, int32, int8, uint8. -* @li x: A required slice tensor. Must be one of the following types: float32, float16, int32, int8, uint8. -* @li shape: A required list of int32, specifying the output shape. +* @li indices: A required index tensor. Must be one of the following types: int32 or int64. +* @li x: A required slice tensor. Must be one of the following types: float32, float16, int32, int8, uint8... +* @li shape: A required list of int32 or int64, specifying the output shape. *@par Outputs: *y:A output Tensor with same datatype as "updates" . \n @@ -895,7 +1011,7 @@ REG_OP(TopK) * Compatible with the TensorFlow operator ScatterNd. */ REG_OP(ScatterNd) - .INPUT(indices, TensorType::BasicType()) + .INPUT(indices, TensorType::IndexNumberType()) .INPUT(x, TensorType::BasicType()) .INPUT(shape, TensorType::IndexNumberType()) .OUTPUT(y, TensorType::BasicType()) @@ -908,11 +1024,11 @@ REG_OP(ScatterNd) *@par Inputs: *Inputs including: * @li indices: A required index tensor. Must be one of the following types: - * float, float16, int32, int16. format:ND. + * int32 or int64. format:ND. * @li x: A required slice tensor. Must be one of the following types: - * float, float16, int32, int16. format:ND. + * float16, float, int32, int8, uint8. format:ND. *@par Attributes: -* @li shape: A required list of int32, specifying the output shape. +* @li shape: A required list of int32 or int64, specifying the output shape. *@par Outputs: *y: A Tensor. Has the same type as "x". format:ND . \n @@ -927,8 +1043,8 @@ REG_OP(ScatterNd) */ REG_OP(ScatterNdD) .INPUT(indices, TensorType::IndexNumberType()) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT16})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT16})) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) .REQUIRED_ATTR(shape, ListInt) .OP_END_FACTORY_REG(ScatterNdD) @@ -1753,6 +1869,33 @@ REG_OP(Crop) .OP_END_FACTORY_REG(Crop) /** +*@brief Returns a namedtuple (values, indices) where values is the cumulative +* the cumulative minimum of elements of input in the dimension dim. +* And indices is the index location of each maximum value found in the dimension dim. \n + +*@par Inputs: +*One inputs, including: +* @li x: A tensor . Must be one of the following types: +* float16, float32, int32, uint32, int8, uint8. \n + +*@par Attributes: +* @li axis: Axis along which to cummin. \n + +*@par Outputs: +* y: A Tensor with the same type and shape of x's. \n +* indices: A Tensor with the int32 type and the same shape of x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator Cummin. \n +*/ +REG_OP(Cummin) + .INPUT(x, TensorType::BasicType()) + .OUTPUT(y, TensorType::BasicType()) + .OUTPUT(indices, TensorType::BasicType()) + .REQUIRED_ATTR(axis, Int) + .OP_END_FACTORY_REG(Cummin) + +/** *@brief Extends the input with copies of data along a specified dimension. For example: *(1) If x = [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]], with shape (2, 3, 2); *(2) axis = 1; @@ -1921,6 +2064,249 @@ REG_OP(CumulativeLogsumexpD) .ATTR(exclusive, Bool, false) .ATTR(reverse, Bool, false) .OP_END_FACTORY_REG(CumulativeLogsumexpD) + +/** +* @brief Add updates to var according to axis and indices. + +* @par Inputs: +* Three inputs, including: +* @li var: A Tensor. Must be one of the following types: +* float16, float32, int16, int32, int8, uint8. +* @li indices: A Tensor of the indices, type should be int32. +* @li updates: A Tensor of the same type as "var". \n + +* @par Attributes: +* @li axis: An required int to specify the axis to perform indices add. \n + +* @par Outputs: +* @li var: A Tensor. Same as input "var". + +* @par Third-party framework compatibility +* Compatible with the Pytorch operator index_add_. +*/ +REG_OP(InplaceIndexAdd) + .INPUT(var, TensorType({DT_INT16, DT_INT32, DT_INT8, + DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .INPUT(indices, TensorType({DT_INT32})) + .INPUT(updates, TensorType({DT_INT16, DT_INT32, DT_INT8, + DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .OUTPUT(var, TensorType({DT_INT16, DT_INT32, DT_INT8, + DT_UINT8, DT_FLOAT32, DT_FLOAT16})) + .REQUIRED_ATTR(axis, Int) + .OP_END_FACTORY_REG(InplaceIndexAdd) + +/** +* @brief Replace the value of X with value according to mask. +* @par Inputs: +* three inputs, including: +* @li x: A Tensor of dtype is float16 or float32 or int64 or int32 or int8. +* @li mask: A Tensor of dtype bool. +* @li value: A Tensor of dtype float16 or float32 or int64 or int32 or int8. + +* @par Outputs: +* @li y: A tensor. Must be one of the following dtypes: +* float16, float32, int64, int32, int8. +*/ +REG_OP(MaskedFill) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64})) + .INPUT(mask, TensorType({DT_BOOL})) + .INPUT(value, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64})) + .OP_END_FACTORY_REG(MaskedFill) + +/** +* @brief Choose the value of X with value according to mask. + +* @par Inputs: +* two inputs, including: +* @li x: A Tensor of dtype is float16 or float32. +* @li mask: A Tensor of dtype is bool. \n + +* @par Outputs: +* @li y: A tensor with the same type as x. \n + +* @par Third-party framework compatibility +* Compatible with the Numpy operator select. +* Replaces the pytorch operator masked_select in some scenarios.\n +*/ +REG_OP(MaskedSelectV2) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(mask, TensorType({DT_BOOL})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(MaskedSelectV2) + +/** +* @brief Slice a tensor at its last dim, e.x. a[..., begin:end:stride]. \n + +* @par Inputs: +* One inputs, including: +* @li x: A Tensor. Must be one of the following types: float16, float32, int16, int32. + +* @par Attributes: +* @li start: An attribute of type Int, start index of last dim. \n +* @li end: An attribute of type Int, end index of last dim. \n +* @li stride: An attribute of type Int, stride of slice. \n + +* @par Outputs: +* @li y: A Tensor. Has the same type as "x". \n + +* @par Third-party framework compatibility +* No compatibility +*/ +REG_OP(SliceLastDim) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64})) + .REQUIRED_ATTR(start, Int) + .REQUIRED_ATTR(end, Int) + .ATTR(stride, Int, 1) + .OP_END_FACTORY_REG(SliceLastDim) + +/** +* @brief Extracts a strided slice of a tensor. Roughly speaking, this op \n +* extracts a slice of size (end-begin)/stride from the given input tensor. \n +* Starting at the location specified by begin the slice continues by \n +* adding stride to the index until all dimensions are not less than end. \n +* +* @par Inputs: +* Four inputs, including: +* @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, \n +* complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16, \n +* complex128, float16, uint32, uint64, complex64, complex128. \n +* @li begin: A Tensor of type int32 or int64, for the index of the first value to select. +* +* @li end: A Tensor of type int32 or int64, for the index of the last value to select. +* +* @li axes: A Tensor of type int32 or int64, indicate axis to be select. +* +* @li strides: A Tensor of type int32 or int64, for the increment. +* +* @par Attributes: +* @li begin_mask: A Tensor of type int32. \n +* A bitmask where a bit "i" being "1" means to ignore the begin \n +* value and instead use the largest interval possible. +* @li end_mask: A Tensor of type int32. \n +* Analogous to "begin_mask". +* @li ellipsis_mask: A Tensor of type int32. \n +* A bitmask where bit "i" being "1" means the "i"th position \n +* is actually an ellipsis. +* @li new_axis_mask: A Tensor of type int32. \n +* A bitmask where bit "i" being "1" means the "i"th \n +* specification creates a new shape 1 dimension. +* @li shrink_axis_mask: A Tensor of type int32. \n +* A bitmask where bit "i" implies that the "i"th \n +* specification should shrink the dimensionality. +* +* @par Outputs: +* y: A Tensor. Has the same type as "x". +* +* @attention Constraints: +* +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator StridedSliceV2. +*/ +REG_OP(StridedSliceV2) + .INPUT(x, TensorType::BasicType()) + .INPUT(begin, TensorType::IndexNumberType()) + .INPUT(end, TensorType::IndexNumberType()) + .OPTIONAL_INPUT(axes, TensorType::IndexNumberType()) + .OPTIONAL_INPUT(strides, TensorType::IndexNumberType()) + .ATTR(begin_mask, Int, 0) + .ATTR(end_mask, Int, 0) + .ATTR(ellipsis_mask, Int, 0) + .ATTR(new_axis_mask, Int, 0) + .ATTR(shrink_axis_mask, Int, 0) + .OUTPUT(y, TensorType::BasicType()) + .OP_END_FACTORY_REG(StridedSliceV2) + +/** +*@brief Fills the elements of the input tensor with value val by selecting the indices in the order given in index. \n + +*@par Inputs: +*Three inputs, including: +* @li x: A tensor. Must be one of the following types: +* float16, float32, int32. \n +*@li assist1: A tensor. Must be one of the following types: +* float16, float32, int32. \n +*@li assist2: A tensor. Must be one of the following types: +* float16, float32, int32. \n + +* @par Attributes: +* @li dim: A required int. Used to select the dimension of this tensor. \n + +*@par Outputs: +*y: A Tensor with the same type and shape of input_x's. \n + +*@par Third-party framework compatibility +*Compatible with the Pytorch operator IndexFill. \n +*/ +REG_OP(IndexFillD) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(assist1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .INPUT(assist2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32})) + .REQUIRED_ATTR(dim, Int) + .OP_END_FACTORY_REG(IndexFillD) + +/** +* @brief For each row r of this and for each column c, do (*this)(r, c) += src(j, c), \n +* where j ranges from indexes[r].first through indexes[r].second - 1. \n +* In general indexes must be >= 0 and < src.NumRows(); \n +* but to represent an empty range you may use the pair (-1, -1) or any pair of numbers (i, j) such that i >= j. \n + +* @par Inputs: +* Three inputs, including: +* @li x: A Tensor. Must be one of the following types: +* float16, float32. +* @li indices: A Tensor of the indices, type should be int32. +* @li src: A Tensor of the same type as "x". \n + +* @par Outputs: +* @li x: A Tensor. Same as input "x". + +* @par Third-party framework compatibility +* Compatible with the kaldi operator AddRowRanges. +*/ +REG_OP(AddRowRanges) + .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(src, TensorType({DT_FLOAT16,DT_FLOAT})) + .INPUT(indices, TensorType({DT_INT32})) + .OUTPUT(x, TensorType({DT_FLOAT16,DT_FLOAT})) + .OP_END_FACTORY_REG(AddRowRanges) + +/** +*@brief masked fill tensor along with one axis by range. +* boxes. It is a customized masked fill range operator . \n + +*@par Inputs: +* Four inputs, including: +*@li x: input tensor. A ND Tensor of float32/float16/int32/int8 with shapes +* 1-D (D,), 2-D(N, D), 3-D(N, C, D) +*@li start: masked fill start pos. A 3D Tensor of int32 with +* shape (num, N). "num" indicates the number of loop masked fill, and the value N +* indicates the batch of ND Tensor, if input x shape is 1-D, N = 1. \n +*@li end: masked fill end pos. A 3D Tensor of int32 with +* shape (num, N). "num" indicates the number of loop masked fill, and the value N +* indicates the batch of ND Tensor. \n +*@li value: masked fill value. A 2D Tensor of float32/float16/int32/int8 with +* shape (num,). "num" indicates the number of loop masked fill + +*@par Attributes: +*@li axis: axis with masked fill of int32. Defaults to -1. + +*@par Outputs: +*y: A ND Tensor of float32/float16/int32/int8 with shapes 1-D (D,), 2-D(N, D), 3-D(N, C, D) + +* @par Restrictions: +* Warning: input shape's length must not be bigger than 1024 * 1024 * 1024. +*/ +REG_OP(MaskedFillRange) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32})) + .INPUT(start, TensorType({DT_INT32})) + .INPUT(end, TensorType({DT_INT32})) + .INPUT(value, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32})) + .REQUIRED_ATTR(axis, Int) + .OP_END_FACTORY_REG(MaskedFillRange) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_SELECTION_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/set_ops.h b/third_party/fwkacllib/inc/ops/set_ops.h index 1d02fa15..04e04f1b 100644 --- a/third_party/fwkacllib/inc/ops/set_ops.h +++ b/third_party/fwkacllib/inc/ops/set_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/sparse_ops.h b/third_party/fwkacllib/inc/ops/sparse_ops.h index d7512790..a1fc9ee6 100644 --- a/third_party/fwkacllib/inc/ops/sparse_ops.h +++ b/third_party/fwkacllib/inc/ops/sparse_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -383,11 +383,11 @@ REG_OP(SparseFillEmptyRowsGrad) REG_OP(SparseTensorDenseMatMul) .INPUT(x1_indices, TensorType({DT_INT32, DT_INT64})) .INPUT(x1_values, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, \ - DT_COMPLEXT64, DT_COMPLEX128, DT_FLOAT16})) + DT_COMPLEXT64, DT_COMPLEX128, DT_FLOAT16, DT_INT64})) .INPUT(x1_shape, TensorType({DT_INT64})) - .INPUT(x2, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, DT_COMPLEXT64, \ + .INPUT(x2, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_COMPLEXT64, \ DT_COMPLEX128, DT_FLOAT16})) - .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, DT_COMPLEXT64, \ + .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_COMPLEXT64, \ DT_COMPLEX128, DT_FLOAT16})) .ATTR(adjoint_a, Bool, false) .ATTR(adjoint_b, Bool, false) diff --git a/third_party/fwkacllib/inc/ops/spectral_ops.h b/third_party/fwkacllib/inc/ops/spectral_ops.h index 64fa7814..34ccb398 100644 --- a/third_party/fwkacllib/inc/ops/spectral_ops.h +++ b/third_party/fwkacllib/inc/ops/spectral_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -27,6 +27,24 @@ namespace ge { /** +*@brief Computes the inverse 1-dimensional discrete Fourier transform over the +inner-most dimension of `x`. \n + +*@par Inputs: +*@li x: A Tensor. Must be the following types: complex64, complex128. \n + +*@par Outputs: +*@li y: A complex tensor of the same rank as `x`. \n + +*@par Third-party framework compatibility +* Compatible with TensorFlow IFFT operator. +*/ +REG_OP(IFFT) + .INPUT(x, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OP_END_FACTORY_REG(IFFT) + +/** *@brief Real-valued fast Fourier transform . \n *@par Inputs: @@ -47,6 +65,84 @@ REG_OP(RFFT) .OUTPUT(y, TensorType({DT_COMPLEX64})) .OP_END_FACTORY_REG(RFFT) +/** +*@brief Inverse real-valued fast Fourier transform. \n + +*@par Inputs: +*@li x: A complex64 tensor. +*@li fft_length: An int32 tensor of shape [1]. The FFT length. \n + +*@par Outputs: +*@li y: A float32 tensor of the same rank as `input`. The inner-most + dimension of `input` is replaced with the `fft_length` samples of its inverse + 1D Fourier transform. \n + +*@par Third-party framework compatibility +* Compatible with TensorFlow IRFFT operator. +*/ +REG_OP(IRFFT) + .INPUT(x, TensorType({DT_COMPLEX64})) + .INPUT(fft_length, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT})) + .OP_END_FACTORY_REG(IRFFT) + + +/** +*@brief 2D fast Fourier transform. \n + +*@par Inputs: +*@li x: A complex64 tensor. + +*@par Outputs: +*@li y: A complex64 tensor of the same shape as `input`. The inner-most 2 + dimensions of `input` are replaced with their 2D Fourier transform. \n + +*@par Third-party framework compatibility +* Compatible with TensorFlow FFT2D operator. +*/ +REG_OP(FFT2D) + .INPUT(x, TensorType({DT_COMPLEX64, DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_COMPLEX64, DT_COMPLEX128})) + .OP_END_FACTORY_REG(FFT2D) + +/** +*@brief Calculate the one-dimensional discrete Fourier transform on the +innermost dimension of the input. \n + +*@par Inputs: +*@li x: A Tensor. Must be the following types: complex64, complex128. \n + +*@par Outputs: +*@li y: A complex tensor with the same shape as input. The innermost dimension +of the input is replaced by its 1-dimensional Fourier transform. \n + +*@par Third-party framework compatibility +* Compatible with TensorFlow FFT operator. +*/ +REG_OP(FFT) + .INPUT(x, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OP_END_FACTORY_REG(FFT) + +/** +*@brief Calculate the inverse 1-dimensional discrete Fourier transform on the +innermost dimension of the input. \n + +*@par Inputs: +*@li x: A Tensor. Must be the following types: complex64, complex128. \n + +*@par Outputs: +*@li y: A complex tensor with the same shape as input. The innermost dimension +of the input is replaced by its inverse two-dimensional Fourier transform. \n + +*@par Third-party framework compatibility +* Compatible with TensorFlow IFFT2D operator. +*/ +REG_OP(IFFT2D) + .INPUT(x, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OUTPUT(y, TensorType({DT_COMPLEX64,DT_COMPLEX128})) + .OP_END_FACTORY_REG(IFFT2D) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_SPECTRAL_OPS_H_ \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/split_combination_ops.h b/third_party/fwkacllib/inc/ops/split_combination_ops.h index efe4715d..fe25a46f 100644 --- a/third_party/fwkacllib/inc/ops/split_combination_ops.h +++ b/third_party/fwkacllib/inc/ops/split_combination_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -62,8 +62,8 @@ REG_OP(Split) *Must be one of the following types: float16, float32, int32, int8, int16, int64, uint8, uint16, uint32, uint64 *@par Attributes: -*@li split_dim: A required int8, int16, int32, or int64. Specifies the dimension along which to split. No default value. -*@li num_split: A required int8, int16, int32, or int64. Specifies the number of output tensors. No default value . \n +*@li split_dim: A required int32. Specifies the dimension along which to split. No default value. +*@li num_split: A required int32. Specifies the number of output tensors. No default value . \n *@par Outputs: *y:Dynamic output. A list of output tensors. Has the same type and format as "x" . \n @@ -94,12 +94,12 @@ REG_OP(SplitD) *@par Inputs: * Three inputs, including: *@li x: An ND Tensor. -*Must be one of the following types: -*@li size_splits: A list of int8, int16, int32, or int64. Specifies a list containing the sizes of each output tensor along the split dimension. -*@li split_dim: An int8, int16, int32, or int64. Specifies the dimension along which to split . \n +*Must be one of the types:float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8, int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32. +*@li size_splits: Must be one of the types:int32, int64. Specifies a list containing the sizes of each output tensor along the split dimension. +*@li split_dim: Must be the following type:int32. Specifies the dimension along which to split . \n *@par Attributes: -*num_split: A required int8, int16, int32, or int64. Specifies the number of output tensors. No default value . \n +*num_split: A required int32. Specifies the number of output tensors. No default value . \n *@par Outputs: *y: Dynamic output.A list of output tensors. Has the same type and format as "x" . \n @@ -129,9 +129,9 @@ REG_OP(SplitV) *Must be one of the following types: float16, float32, int32, int8, int16, int64, uint8, uint16, uint32, uint64 *@par Attributes: -*@li size_splits: A required list of int8, int16, int32, or int64. Specifies a list containing the sizes of each output tensor along the split dimension. -*@li split_dim: A required int8, int16, int32, or int64. Specifies the dimension along which to split. No default value. -*@li num_split: A required int8, int16, int32, or int64. Specifies the number of output tensors. No default value . \n +*@li size_splits: A required list of int32. Specifies a list containing the sizes of each output tensor along the split dimension. +*@li split_dim: A required int32. Specifies the dimension along which to split. No default value. +*@li num_split: A required int32. Specifies the number of output tensors. No default value . \n *@par Outputs: *y: Dynamic output.A list of output tensors. Has the same type and format as "x" . \n @@ -317,15 +317,15 @@ REG_OP(Concat) * int64, uint8, uint16, uint32, uint64, float16, float32, bool . It's a dynamic input. \n *@par Attributes: -*@li axis: A optional int, defaultvalue is 0. +*@li axis: A optional int, default value is 0. * Dimension along which to pack. The range is [-(R+1), R+1). *@li N: A required int. Number of tensors . \n *@par Outputs: *y: A Tensor. Has the same type as "x". + *@par Third-party framework compatibility -*Compatible with the TensorFlow operator Pack. -It's a dynamic output. +* Compatible with the TensorFlow operator Pack. */ REG_OP(Pack) .DYNAMIC_INPUT(x, TensorType::BasicType()) diff --git a/third_party/fwkacllib/inc/ops/state_ops.h b/third_party/fwkacllib/inc/ops/state_ops.h index db1f5353..3c8e32b6 100644 --- a/third_party/fwkacllib/inc/ops/state_ops.h +++ b/third_party/fwkacllib/inc/ops/state_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/stateful_random_ops.h b/third_party/fwkacllib/inc/ops/stateful_random_ops.h index 366112d6..c2f65c6a 100644 --- a/third_party/fwkacllib/inc/ops/stateful_random_ops.h +++ b/third_party/fwkacllib/inc/ops/stateful_random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/stateless_random_ops.h b/third_party/fwkacllib/inc/ops/stateless_random_ops.h index dad3c379..ff9daaa3 100644 --- a/third_party/fwkacllib/inc/ops/stateless_random_ops.h +++ b/third_party/fwkacllib/inc/ops/stateless_random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/string_ops.h b/third_party/fwkacllib/inc/ops/string_ops.h index 4a88bc79..f9cc2549 100644 --- a/third_party/fwkacllib/inc/ops/string_ops.h +++ b/third_party/fwkacllib/inc/ops/string_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -25,6 +25,235 @@ #include "graph/operator_reg.h" namespace ge { +/** +*@brief Creates ngrams from ragged string data . \n + +*@par Inputs: +include: +*@li data:1-D.The values tensor of the ragged string tensor to make ngrams out of. +*@li data_splits:The splits tensor of the ragged string tensor to make ngrams out of . \n + +*@par Attributes: +* separator:The string to append between elements of the token. Use "" for no separator. +* ngram_widths:The sizes of the ngrams to create. +* left_pad:The string to use to pad the left side of the ngram sequence. Only used if pad_width != 0. +* right_pad:The string to use to pad the right side of the ngram sequence. Only used if pad_width != 0. +* pad_width:The number of padding elements to add to each side of each sequence. +* preserve_short_sequences: Preserve short sequences. \n + +*@par Outputs: +*@li ngrams:The values tensor of the output ngrams ragged tensor. +*@li ngrams_splits:The splits tensor of the output ngrams ragged tensor. \n + +*@see StringNGrams() + +*@par Third-party framework compatibility +*compatible with StringNGrams op of tensorflow + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(StringNGrams) + .INPUT(data, TensorType({DT_STRING})) + .INPUT(data_splits, TensorType({DT_INT32, DT_INT64})) + .OUTPUT(ngrams, TensorType({DT_STRING})) + .OUTPUT(ngrams_splits, TensorType({DT_INT32, DT_INT64})) + .REQUIRED_ATTR(separator, String) + .ATTR(ngram_widths, ListInt, {}) + .REQUIRED_ATTR(left_pad, String) + .REQUIRED_ATTR(right_pad, String) + .REQUIRED_ATTR(pad_width, Int) + .REQUIRED_ATTR(preserve_short_sequences, Bool) + .OP_END_FACTORY_REG(StringNGrams) + +/** +*@brief Decodes each string in `input` into a sequence of Unicode code points . \n + +*@par Inputs: +include: +*@li input:The text to be decoded. Can have any shape. Note that the output is flattened +to a vector of char values. \n + +*@par Attributes: +* input_encoding:Text encoding of the input strings. This is any of the encodings supported +by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +* errors:Error handling policy when there is invalid formatting found in the input. +The value of 'strict' will cause the operation to produce a InvalidArgument +error on any invalid input formatting. A value of 'replace' (the default) will +cause the operation to replace any invalid formatting in the input with the +`replacement_char` codepoint. A value of 'ignore' will cause the operation to +skip any invalid formatting in the input and produce no corresponding output +character. +* replacement_char:The replacement character codepoint to be used in place of any invalid +formatting in the input when `errors='replace'`. Any valid unicode codepoint may +be used. The default value is the default unicode replacement character is +0xFFFD or U+65533. +* replace_control_characters:Whether to replace the C0 control characters (00-1F) with the +`replacement_char`. Default is false. \n + +*@par Outputs: +*@li row_splits:A 1D tensor containing the row splits. +*@li char_values:A 1D tensor containing the decoded codepoints. +*@li char_to_byte_starts:A 1D int32 Tensor containing the byte index in the input string where each +character in `char_values` starts. \n + +*@see UnicodeDecodeWithOffsets() + +*@par Third-party framework compatibility +*compatible with UnicodeDecodeWithOffsets op of tensorflow + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(UnicodeDecodeWithOffsets) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(row_splits, TensorType({DT_INT64})) + .OUTPUT(char_values, TensorType({DT_INT32})) + .OUTPUT(char_to_byte_starts, TensorType({DT_INT64})) + .REQUIRED_ATTR(input_encoding, String) + .ATTR(errors, String, "replace") + .ATTR(replacement_char, Int, 65533) + .ATTR(replace_control_characters, Bool, false) + .ATTR(Tsplits, Type, DT_INT64) + .OP_END_FACTORY_REG(UnicodeDecodeWithOffsets) + +/** +*@brief Decodes each string in `input` into a sequence of Unicode code points. \n + +*@par Inputs: +include: +*@li input:The text to be decoded. Can have any shape. Note that the output is flattened +to a vector of char values. \n + +*@par Attributes: +* input_encoding:Text encoding of the input strings. This is any of the encodings supported +by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +* errors:Error handling policy when there is invalid formatting found in the input. +The value of 'strict' will cause the operation to produce a InvalidArgument +error on any invalid input formatting. A value of 'replace' (the default) will +cause the operation to replace any invalid formatting in the input with the +`replacement_char` codepoint. A value of 'ignore' will cause the operation to +skip any invalid formatting in the input and produce no corresponding output +character. +* replacement_char:The replacement character codepoint to be used in place of any invalid +formatting in the input when `errors='replace'`. Any valid unicode codepoint may +be used. The default value is the default unicode replacement character is +0xFFFD or U+65533. +* replace_control_characters:Whether to replace the C0 control characters (00-1F) with the +`replacement_char`. Default is false. \n + +*@par Outputs: +*@li row_splits:A 1D tensor containing the row splits. +*@li char_values:A 1D tensor containing the decoded codepoints. \n + +*@see UnicodeDecode() + +*@par Third-party framework compatibility +*compatible with UnicodeDecode op of tensorflow + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(UnicodeDecode) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(row_splits, TensorType({DT_INT64})) + .OUTPUT(char_values, TensorType({DT_INT32})) + .REQUIRED_ATTR(input_encoding, String) + .ATTR(errors, String, "replace") + .ATTR(replacement_char, Int, 65533) + .ATTR(replace_control_characters, Bool, false) + .ATTR(Tsplits, Type, DT_INT64) + .OP_END_FACTORY_REG(UnicodeDecode) + +/** +*@brief Transcode the input text from a source encoding to a destination encoding. \n + +*@par Inputs: +include: +*@li input:The text to be processed. Can have any shape. \n + +*@par Attributes: +* input_encoding:Text encoding of the input strings. This is any of the encodings supported +by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +* output_encoding:The unicode encoding to use in the output. Must be one of `"UTF-8", "UTF-16-BE", "UTF-32-BE"`. +Multi-byte encodings will be big-endian. +* errors:Error handling policy when there is invalid formatting found in the input. +The value of 'strict' will cause the operation to produce a InvalidArgument +error on any invalid input formatting. A value of 'replace' (the default) will +cause the operation to replace any invalid formatting in the input with the +`replacement_char` codepoint. A value of 'ignore' will cause the operation to +skip any invalid formatting in the input and produce no corresponding output +character. +* replacement_char:The replacement character codepoint to be used in place of any invalid +formatting in the input when `errors='replace'`. Any valid unicode codepoint may +be used. The default value is the default unicode replacement character is +0xFFFD or U+65533. +* replace_control_characters:Whether to replace the C0 control characters (00-1F) with the +`replacement_char`. Default is false. \n + +*@par Outputs: +*@li output:A string tensor containing unicode text encoded using `output_encoding`. \n + +*@see UnicodeTranscode() + +*@par Third-party framework compatibility +*compatible with UnicodeTranscode op of tensorflow + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(UnicodeTranscode) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_STRING})) + .REQUIRED_ATTR(input_encoding, String) + .ATTR(output_encoding, String, "UTF-8") + .ATTR(errors, String, "replace") + .ATTR(replacement_char, Int, 65533) + .ATTR(replace_control_characters, Bool, false) + .OP_END_FACTORY_REG(UnicodeTranscode) + +/** +*@brief Encode a tensor of ints into unicode strings. \n + +*@par Inputs: +include: +*@li input_values:A 1D tensor containing the unicode codepoints that should be encoded. +*@li input_splits:A 1D tensor specifying how the unicode codepoints should be split into strings. \n + +*@par Attributes: +* output_encoding:The unicode encoding to use in the output. Must be one of `"UTF-8", "UTF-16-BE", "UTF-32-BE"`. +Multi-byte encodings will be big-endian. +* errors:Error handling policy when there is invalid formatting found in the input. +The value of 'strict' will cause the operation to produce a InvalidArgument +error on any invalid input formatting. A value of 'replace' (the default) will +cause the operation to replace any invalid formatting in the input with the +`replacement_char` codepoint. A value of 'ignore' will cause the operation to +skip any invalid formatting in the input and produce no corresponding output +character. +* replacement_char:The replacement character codepoint to be used in place of any invalid +formatting in the input when `errors='replace'`. Any valid unicode codepoint may +be used. The default value is the default unicode replacement character is +0xFFFD or U+65533. \n + +*@par Outputs: +*@li output:The 1-D Tensor of strings encoded from the provided unicode codepoints. \n + +*@see UnicodeEncode() + +*@par Third-party framework compatibility +*compatible with UnicodeEncode op of tensorflow + +*@par Restrictions: +*Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use. +*/ +REG_OP(UnicodeEncode) + .INPUT(input_values, TensorType({DT_INT32})) + .INPUT(input_splits, TensorType({DT_INT32, DT_INT64})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(errors, String, "replace") + .ATTR(output_encoding, String, "UTF-8") + .ATTR(replacement_char, Int, 65533) + .OP_END_FACTORY_REG(UnicodeEncode) /** *@brief Split elements of input based on delimiter into a SparseTensor . \n @@ -62,6 +291,116 @@ REG_OP(StringSplit) .OP_END_FACTORY_REG(StringSplit) /** +*@brief Replaces the match of pattern in input with rewrite. \n + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. \n + +*@par Attributes: +*@li pattern:A string. The regular expression to match the input. +*@li rewrite:A string. The rewrite to be applied to the matched expression. +*@li replace_global:An optional bool. Defaults to True. If True, the replacement is global, +otherwise the replacement is done only on the first match. + +*@par output: +*@li output::A Tensor of type string. +*/ +REG_OP(StaticRegexReplace) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(pattern, String, "") + .ATTR(rewrite, String, "") + .ATTR(replace_global, Bool, true) + .OP_END_FACTORY_REG(StaticRegexReplace) + +/** +*@brief The input is a string tensor of any shape. The pattern is the +*regular expression to be matched with every element of the input tensor. +*The boolean values (True or False) of the output tensor indicate +*if the input matches the regex pattern provided. + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. \n + +*@par Attributes: +*@li pattern:A string. The regular expression to match the input. + +*@par output: +*@li output::A bool tensor with the same shape as `input`. +*/ +REG_OP(StaticRegexFullMatch) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_BOOL})) + .ATTR(pattern, String, "") + .OP_END_FACTORY_REG(StaticRegexFullMatch) + +/** +*@brief A Tensor of type string. The input to be joined. \n + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. +*@li segment_ids:A Tensor. Must be one of the following types: int32, int64. +*A tensor whose shape is a prefix of data.shape. Negative segment ids are not supported. +*@li num_segments:A Tensor. Must be one of the following types: int32, int64. A scalar. + +*@par Attributes: +*@li separator:An optional string. Defaults to "". The separator to use when joining. + +*@par output: +*@li output::A Tensor of type string.. +*/ +REG_OP(UnsortedSegmentJoin) + .INPUT(input, TensorType({DT_STRING})) + .INPUT(segment_ids, TensorType({DT_INT32,DT_INT64})) + .INPUT(num_segments, TensorType({DT_INT32,DT_INT64})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(separator, String, "") + .OP_END_FACTORY_REG(UnsortedSegmentJoin) + +/** +*@brief Inputs to TensorFlow operations are outputs of another TensorFlow operation. +*This method is used to obtain a symbolic handle that represents the computation of the input. + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. + +*@par Attributes: +*@li encoding:An optional string. Defaults to "". + +*@par output: +*@li output::A Tensor of type string.. +*/ +REG_OP(StringLower) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(encoding, String, "") + .OP_END_FACTORY_REG(StringLower) + +/** +*@brief Inputs to TensorFlow operations are outputs of another TensorFlow operation. +*This method is used to obtain a symbolic handle that represents the computation of the input. + +*@par Inputs: +include: +*@li input:A Tensor of type string. The text to be processed. + +*@par Attributes: +*@li encoding:An optional string. Defaults to "". + +*@par output: +*@li output::A Tensor of type string.. +*/ +REG_OP(StringUpper) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(encoding, String, "") + .OP_END_FACTORY_REG(StringUpper) + +/** *@brief Split elements of source based on sep into a SparseTensor . \n *@par Inputs: @@ -488,7 +827,7 @@ include: */ REG_OP(AsString) .INPUT(x, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, DT_FLOAT, \ - DT_DOUBLE, DT_BOOL})) + DT_DOUBLE, DT_BOOL, DT_COMPLEX64, DT_COMPLEX128})) .OUTPUT(y, TensorType({DT_STRING})) .ATTR(precision, Int, -1) .ATTR(scientific, Bool, false) @@ -557,6 +896,45 @@ REG_OP(DecodeBase64) .INPUT(x, TensorType({DT_STRING})) .OUTPUT(y, TensorType({DT_STRING})) .OP_END_FACTORY_REG(DecodeBase64) + +/** +*@brief StringNormalization performs string operations for basic cleaning . \n + +*@par Inputs: +*@li input: only accepts [C] or [1, C] UTF-8 strings tensor . \n + +*@par Outputs: +*@li output: UTF-8 strings tensor after cleaning . \n + +*@par Attributes: +*@li stopwords : list of strings (default is empty). +*List of stop words. If not set, no word would be removed from input strings +tensor. + +*@li is_case_sensitive : bool (default is false). +*Boolean. Whether the identification of stop words in input strings tensor is +case-sensitive. Default is false. + +*@li case_change_action : string (default is "NONE"). +*string enum that cases output to be lowercased/uppercases/unchanged. Valid +values are "LOWER", "UPPER", "NONE". Default is "NONE". + +*@li local : string (default is "en_US"). +*Environment dependent string that denotes the locale according to which output +strings needs to be upper/lowercased.Default en_US or platform specific equivalent +as decided by the implementation . \n + +*@attention Constraints: +*@li input can be either a 1-D or 2-D tensor, the shape of 2-D tensor must be [1, C]. +*/ +REG_OP(StringNormalizer) + .INPUT(input, TensorType({DT_STRING})) + .OUTPUT(output, TensorType({DT_STRING})) + .ATTR(stopwords, ListString, {}) + .ATTR(is_case_sensitive, Bool, false) + .ATTR(case_change_action, String, "NONE") + .ATTR(local, String, "en_US") + .OP_END_FACTORY_REG(StringNormalizer) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_STRING_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/swap_co_ops.h b/third_party/fwkacllib/inc/ops/swap_co_ops.h index a1bf4f8b..6e8eaac3 100644 --- a/third_party/fwkacllib/inc/ops/swap_co_ops.h +++ b/third_party/fwkacllib/inc/ops/swap_co_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/target_crop_and_resize.h b/third_party/fwkacllib/inc/ops/target_crop_and_resize.h index 9c61f2c9..9bef1d7b 100644 --- a/third_party/fwkacllib/inc/ops/target_crop_and_resize.h +++ b/third_party/fwkacllib/inc/ops/target_crop_and_resize.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/ops/transformation_ops.h b/third_party/fwkacllib/inc/ops/transformation_ops.h index 64e18fc7..4a46e35f 100644 --- a/third_party/fwkacllib/inc/ops/transformation_ops.h +++ b/third_party/fwkacllib/inc/ops/transformation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. @@ -130,28 +130,27 @@ REG_OP(Transpose) .OP_END_FACTORY_REG(Transpose) /** -*@brief Doing format_transfer for various data format only -support "NHWC/NCHW" to "NC1HWC0" and "NC1HWC0" to "NHWC/NCHW" -"NCHW" to "FRACTAL_Zn" or "FRACTAL_Zn" to "NCHW". -"HWCN" to "FRACTAL_Zn" or "FRACTAL_Zn" to "HWCN" . \n +*@brief Do format transfer for various data format. +* In general, the framework will insert it atomatically . \n *@par Inputs: -*src: A Tensor dtype of all types . \n +*src: A Tensor. For all branches can be types: float16, float32, int32, int8, bool. +* For branches without padding also can be types: int16, int64, uint8, uint16, uint32, uint64 . \n *@par Attributes: -*@li src_format: A string source data format, can be "NHWC", "NCHW", "FRACTAL_Zn" etc. -*@li dst_format: A string target data format, can be "NC1HWC0", "NCHW", "FRACTAL_Zn" etc. -*@li group: A required int32, default value is 1. \n +*@li src_format: A string source data format, can be "NHWC", "NCHW", "FRACTAL_Z" etc. +*@li dst_format: A string target data format, can be "NC1HWC0", "NCHW", "FRACTAL_Z" etc. +*@li group: A optional int32, default value is 1. \n *@par Outputs: -*dst: A Tensor dtype of all types. +*dst: A Tensor. Has the same type as "src". */ REG_OP(TransData) .INPUT(src, TensorType::BasicType()) .OUTPUT(dst, TensorType::BasicType()) .REQUIRED_ATTR(src_format, String) .REQUIRED_ATTR(dst_format, String) - .ATTR(group, Int, 1) + .ATTR(groups, Int, 1) .OP_END_FACTORY_REG(TransData) /** @@ -174,21 +173,27 @@ REG_OP(Permute) .OP_END_FACTORY_REG(Permute) /** -*@brief Flattens the inputs. Reserves axis 0 and flattens the input tensors -* along axis 1 . \n +*@brief Flattens the inputs tensor into a 2D matrix. If input tensor has shape (d_0, d_1,..., d_n), +* then the output will have shape (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis + 1)...X d_n)\n *@par Inputs: -*One input: -*x: A multi-dimensional Tensor. Must be one of the following types: -* int8, uint8, int16, uint16, int32, uint32, int64,uint64, float16, float32 . \n +* One input: +* x: A multi-dimensional Tensor. Must be one of the following types: +* int8, uint8, int16, uint16, int32, uint32, int64,uint64, float16, float32. *@par Outputs: -*y: A 2D flattened Tensor (Reserves axis 0 and flattens the input tensors -* along axis 1). Must be one of the following data types: int8, uint8, int16, -* uint16, int32, uint32, int64,uint64, float16, float32 . \n +* y: A 2D flattened Tensor with the contents of the input tensor, with input dimensions up to axis flattened +* to the outer dimension of the output and remaining input dimensions flattened into the inner dimension of the output. +* Must be one of the following data types: int8, uint8, int16, uint16, int32, uint32, int64,uint64, float16, float32 . + +*@par Attributes: +* axis: A optional int32, default value is 1. Indicate up to which input dimensions (exclusive) should be flattened +* to the outer dimension of the output. The value for axis must be in the range [-r, r], where r is the rank of +* the input tensor. Negative value means counting dimensions from the back. When axis = 0, the shape of +* the output tensor is (1, (d_0 X d_1 ... d_n), where the shape of the input tensor is (d_0, d_1, ... d_n). *@par Third-party framework compatibility -* Compatible with TensorFlow operator Flatten. +* Compatible with TensorFlow / ONNX operator Flatten. */ REG_OP(Flatten) .INPUT(x, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, @@ -197,6 +202,7 @@ REG_OP(Flatten) .OUTPUT(y, TensorType({DT_INT8, DT_INT16, DT_INT32, DT_INT64, DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64, DT_FLOAT, DT_FLOAT16})) + .ATTR(axis, Int, 1) .OP_END_FACTORY_REG(Flatten) /** @@ -357,7 +363,7 @@ REG_OP(DepthToSpace) *@brief Permutes data into spatial data blocks and then prunes them . \n *@par Inputs: -*@li x: A 4D Tensor with format NHWC. +*@li x: A 4D Tensor with format. Must set the format, supported format list ["NCHW, NHWC"] *@li crops: A 1D list or tuple of int32 or int64 . \n *Must be one of the following types: float16, float32 @@ -418,12 +424,8 @@ REG_OP(BatchToSpace) * Warning: THIS FUNCTION IS DEPRECATED. Please use BatchToSpace instead. */ REG_OP(BatchToSpaceD) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, - DT_UINT16, DT_UINT32, DT_UINT64, DT_INT8, DT_INT16, DT_COMPLEX64, - DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, - DT_UINT16, DT_UINT32, DT_UINT64, DT_INT8, DT_INT16, DT_COMPLEX64, - DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) + .INPUT(x, TensorType::BasicType()) + .OUTPUT(y, TensorType::BasicType()) .REQUIRED_ATTR(block_size, Int) .REQUIRED_ATTR(crops, ListInt) .OP_END_FACTORY_REG(BatchToSpaceD) @@ -434,9 +436,10 @@ REG_OP(BatchToSpaceD) *@par Inputs: * Two inputs, including: -*@li x: An NHWC Tensor. Must be one of the following types: +*@li x: An 4D Tensor. Must be one of the following types: * float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8, * int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32. +* Must set the format, supported format list ["NCHW, NHWC"] *@li paddings: A 2D tensor of type int, specifying the input . \n *@par Attributes: @@ -518,7 +521,8 @@ REG_OP(Unpack) * @par Inputs: * x: A 4D Tensor with shape [batch, in_rows, in_cols, depth], Must be one of the * following types:float32, double, int32, uint8, int16, int8, int64, uint16, -* float16, uint32, uint64 +* float16, uint32, uint64. The inputs must have data_format with one of follows: +* NHWC, NCHW. * @par Attributes: * @li ksizes: A required list or tuple. The size of the sliding window for each @@ -533,7 +537,6 @@ REG_OP(Unpack) * This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. * @li padding: A required string. The type of padding algorithm to use, support "SAME" or "VALID". \n -* @li data_format: A required string. The format of input, only supported NHWC. \n * @par Outputs: * y: A 4D Tensor with shape [batch, out_rows, out_cols, ksize_rows * @@ -554,7 +557,6 @@ REG_OP(ExtractImagePatches) .REQUIRED_ATTR(strides, ListInt) .REQUIRED_ATTR(rates, ListInt) .REQUIRED_ATTR(padding, String) - .ATTR(data_format, String, "NHWC") .OP_END_FACTORY_REG(ExtractImagePatches) /** @@ -563,6 +565,7 @@ REG_OP(ExtractImagePatches) * @par Inputs: * x: A 5D Tensor with shape [batch, in_planes, in_rows, in_cols, depth] . \n +* The inputs must have data_format with one of follows: NDHWC, NCDHW. \n * @par Attributes: * @li ksizes: A required list or tuple. The size of the sliding window for each @@ -571,7 +574,6 @@ REG_OP(ExtractImagePatches) * patches are in "x". Must be: [1, stride_planes, stride_rows, stride_cols, 1]. * @li padding: A required string. The type of padding algorithm to use , * support "SAME" or "VALID" . \n -* @li data_format: An optional string. The format of input, only supported NDHWC. \n * @par Outputs: * Output: A 5D Tensor with shape [batch, out_planes, out_rows, out_cols, ksize_planes * @@ -590,7 +592,6 @@ REG_OP(ExtractVolumePatches) .REQUIRED_ATTR(ksizes, ListInt) .REQUIRED_ATTR(strides, ListInt) .REQUIRED_ATTR(padding, String) - .ATTR(data_format, String, "NDHWC") .OP_END_FACTORY_REG(ExtractVolumePatches) /** @@ -717,6 +718,210 @@ REG_OP(CompressFcOp) .OUTPUT(compress_index, TensorType({DT_INT8})) .REQUIRED_ATTR(compress_parameters, ListInt) .OP_END_FACTORY_REG(CompressFcOp) + +/** +*@brief Performs Col2im for each batch entry. \n + +*@par Inputs: +*@li input_x: The Col Tensor. 5-D, shape: `(n, c1, kernel_h*kernel_w, ho*wo, c0)`. +where ho/wo is do = (output_d + 2*padding_d - dilation_d*(kernel_d - 1) - 1)//stride_d + 1 \n + +*@par Outputs: +*@li output_y: The img Tensor. 5-D, shape: `(n, c1, output_h, output_w, c0)`. \n + +*@par Attributes: +*@li kernel_shape: ListInt, value: `(kernel_h, kernel_w)`, the shape of kernel in convolution. +*@li dilation: ListInt, value: `(dilation_h, dilation_w)`, the dilation in convolution. +*@li padding: ListInt, value: `(padding_h, padding_w)`, the dilation in convolution. +*@li stride: ListInt, value: `(stride_h, stride_w)`, the dilation in convolution. \n + +*@par Third-party framework compatibility +* Compatible with Pytorch col2im/im2col_backward operator. +*/ +REG_OP(Col2im) + .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) + .INPUT(output_size, TensorType({DT_INT32, DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) + .REQUIRED_ATTR(kernel_size, ListInt) + .REQUIRED_ATTR(dilation, ListInt) + .REQUIRED_ATTR(padding, ListInt) + .REQUIRED_ATTR(stride, ListInt) + .OP_END_FACTORY_REG(Col2im) + +/** +* @brief Performs Im2col for each batch entry. \n + +* @par Inputs: +* x: A 4D Tensor with shape [batch, in_rows, in_cols, depth], Must be one of the +* following types:float32, int8, float16. The inputs must have data_format with +* one of follows:NHWC, NCHW. + +* @par Attributes: +* @li ksizes: A required list or tuple. The size of the sliding window for each +* dimension of images. +* @li strides: A optional list or tuple. How far the centers of two consecutive +* patches are in the images. Defaults to "{1}". +* @li dilations: A optional list or tuple. Defaults to "{1}". +* This is the input stride, specifying how far two consecutive patch +* samples are in the input. Equivalent to extracting patches +* with patch_sizes_eff = patch_sizes + (patch_sizes - 1) * +* (dilations - 1), followed by subsampling them spatially by a factor of dilations. +* This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. +* @li padding_mode: A optional String. The type of padding algorithm to use, +* support "SAME", "VALID", "CALCULATED". Among the three modes, only the "CALCULATED" +* means to use the pads below. Defaults to "CALCULATED". +* @li pads: A optional list or tuple. The pad distance. Defaults to "{0}". \n + +* @par Outputs: +* y: A 4D Tensor with shape [batch, out_rows, out_cols, ksize_rows * +* ksize_cols * depth] containing image patches with size ksize_rows x ksize_cols +* x depth vectorized in the "depth" dimension. Note "out_rows" and "out_cols" +* are the dimensions of the output patches . \n + +* @attention Constraints: +* "ksizes", "strides", "dilations" and "pads" are lists of integers . \n + +* @par Third-party framework compatibility +* Compatible with Pytorch Im2col operator. +*/ +REG_OP(Im2col) + .INPUT(x, TensorType::RealNumberType()) + .OUTPUT(y, TensorType::RealNumberType()) + .REQUIRED_ATTR(ksizes, ListInt) + .ATTR(strides, ListInt, {1}) + .ATTR(dilations, ListInt, {1}) + .ATTR(padding_mode, String, "CALCULATED") + .ATTR(pads, ListInt, {0}) + .OP_END_FACTORY_REG(Im2col) + +/** +*@brief Generates a 2D or 3D flow field (sampling grid), given a batch of affine +matrices theta. \n + +*@par Inputs: +*Input theta must be float16 or float, output_size must be int32 type.Inputs +include: +*@li theta: input batch of affine matrices with shape (N,2,3) for 2D or (N,3,4) +for 3D +*@li output_size: the target output image size. (N×C×H×W for 2D or N×C×D×H×W for +3D) Example: torch.Size((32, 3, 24, 24)) . \n + + +*@par Attributes: +*align_corners: if True, consider -1 and 1 to refer to the centers of the corner +pixels rather than the image corners.Refer to grid_sample() for a more complete +description. A grid generated by affine_grid() should be passed to grid_sample() +with the same setting for this option. Default: False \n + +*@par Outputs: +*@li y: A 2-D integer tensor of shape [M] representing the +selected indices from the boxes tensor, where M <= max_output_size. \n + +*@attention Constraints: +*Input theta must be float16 or float, output_size must be int32 type . \n + +*@par Third-party framework compatibility +*Compatible with Pytorch affine_grid operator. +*/ + +REG_OP(AffineGrid) + .INPUT(theta, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(output_size, TensorType({DT_INT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(align_corners, Bool, false) + .OP_END_FACTORY_REG(AffineGrid) + +/** +*@brief Make memory of a view be contiguous. \n + +*@par Inputs: +*Four inputs, including: +*@li x: The input tensor. +*@li size: The shape of output tensor. +*@li stride: The stride of output tensor. +*@li storage_offset: The offset in the underlying storage of the output tensor. \n + +*@par Outputs: +*y: A Tensor. Has the same type as "x" . \n + +*@par Third-party framework compatibility +*Compatible with the pytorch operator as_strided. +*/ +REG_OP(AsStrided) + .INPUT(x, TensorType::BasicType()) + .INPUT(size, TensorType::IndexNumberType()) + .INPUT(stride, TensorType::IndexNumberType()) + .INPUT(storage_offset, TensorType::IndexNumberType()) + .OUTPUT(y, TensorType::BasicType()) + .OP_END_FACTORY_REG(AsStrided) + +/** +*@brief This transform extracts n-grams from the input sequence and save them as a +vector. \n + +*@par Inputs: +*@li input: can be either a 1-D or 2-D tensor for n-gram extraction, It is ether string UTF-8 or int32/int64 . \n + +*@par Attributes: +*@li max_gram_length : int (required) +*Maximum n-gram length. If this value is 3, 3-grams will be used to generate the output . +*@li max_skip_count : int (required) +*Maximum number of items (integers/strings) to be skipped when constructing an n-gram from X. +If max_skip_count=1, min_gram_length=2, max_gram_length=3, this operator may generate 2-grams +with skip_count=0 and skip_count=1, and 3-grams with skip_count=0 and skip_count=1. +*@li min_gram_length : int (required) +*Minimum n-gram length. If this value is 2 and max_gram_length is 3, output may contain counts of +2-grams and 3-grams. +*@li mode : string (required) +*The weighting criteria. It can be one of "TF" (term frequency), "IDF" (inverse document frequency), +and "TFIDF" (the combination of TF and IDF). +*@li ngram_counts : list of ints (required) +*The starting indexes of 1-grams, 2-grams, and so on in pool. It is useful when determining the boundary +between two consecutive collections of n-grams. For example, if ngram_counts is [0, 17, 36], +the first index (zero-based) of 1-gram/2-gram/3-gram in pool are 0/17/36. This format is essentially identical +to CSR (or CSC) sparse matrix format, and we choose to use this due to its popularity. +*@li ngram_indexes : list of ints (required) +*list of int64s (type: AttributeProto::INTS). This list is parallel to the specified 'pool_*' attribute. The i-th element +in ngram_indexes indicate the coordinate of the i-th n-gram in the output tensor. +*@li pool_int64s : list of ints +*List of int64 n-grams learned from the training set. Either this or pool_strings attributes must be present but not both. +It's an 1-D tensor starting with the collections of all 1-grams and ending with the collections of n-grams. The i-th element +in pool stores the n-gram that should be mapped to coordinate ngram_indexes[i] in the output vector. +*@li pool_strings : list of strings +*List of strings n-grams learned from the training set. Either this or pool_int64s attributes must be present but not both. +It's an 1-D tensor starting with the collections of all 1-grams and ending with the collections of n-grams. The i-th element +in pool stores the n-gram that should be mapped to coordinate ngram_indexes[i] in the output vector. +*@li weights : list of floats +*list of floats. This attribute stores the weight of each n-gram in pool. The i-th element in weights is the weight of +the i-th n-gram in pool. Its length equals to the size of ngram_indexes. By default, weights is an all-one tensor.This attribute +is used when mode is "IDF" or "TFIDF" to scale the associated word counts. \n + +*@par Outputs: +*@li output: tensor(float) +*For 1-D input, output is the n-gram representation of that input. For 2-D input, the output is also a 2-D tensor +whose i-th row is the n-gram representation of the i-th input row. More specifically, if input shape is [C], the corresponding +output shape would be [max(ngram_indexes) + 1]. If input shape is [N, C], this operator produces a [N, max(ngram_indexes) + 1]-tensor. \n + +*@attention Constraints: +*@li input can be either a 1-D or 2-D tensor, shape is [C] or [N, C]. +*@li max(ngram_indexes) + 1 == len(weights), len(y) == len(weights). +*@li ngram_counts and pool(pool_int64s or pool_strings) must match. +*@li either pool_strings or pool_int64s attributes must be present but not both. +*/ + +REG_OP(TfidVectorizer) + .INPUT(input, TensorType({DT_INT32, DT_INT64, DT_STRING})) + .OUTPUT(output, TensorType({DT_FLOAT})) + .REQUIRED_ATTR(max_gram_length, Int) + .REQUIRED_ATTR(max_skip_count, Int) + .REQUIRED_ATTR(min_gram_length, Int) + .REQUIRED_ATTR(mode, String) + .REQUIRED_ATTR(ngram_counts, ListInt) + .REQUIRED_ATTR(ngram_indexes, ListInt) + .ATTR(pool_int64s, ListInt, {}) + .ATTR(pool_strings, ListString, {}) + .ATTR(weights, ListFloat, {}) + .OP_END_FACTORY_REG(TfidVectorizer) } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_TRANSFORMATION_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/warp_perspective_ops.h b/third_party/fwkacllib/inc/ops/warp_perspective_ops.h index e19cbd7c..8ef69d8b 100644 --- a/third_party/fwkacllib/inc/ops/warp_perspective_ops.h +++ b/third_party/fwkacllib/inc/ops/warp_perspective_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 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. diff --git a/third_party/fwkacllib/inc/runtime/event.h b/third_party/fwkacllib/inc/runtime/event.h index 57948c47..01f63705 100644 --- a/third_party/fwkacllib/inc/runtime/event.h +++ b/third_party/fwkacllib/inc/runtime/event.h @@ -41,6 +41,11 @@ typedef enum rtEventWaitStatus { #define RT_EVENT_DDSYNC 0x04U #define RT_EVENT_TIME_LINE 0x08U +#define RT_EVENT_DDSYNC_NS 0x01U +#define RT_EVENT_STREAM_MARK 0x02U +#define RT_EVENT_DDSYNC 0x04U +#define RT_EVENT_TIME_LINE 0x08U + /** * @ingroup dvrt_event * @brief create event instance diff --git a/third_party/fwkacllib/inc/runtime/rt.h b/third_party/fwkacllib/inc/runtime/rt.h index aa394eea..10f884f2 100644 --- a/third_party/fwkacllib/inc/runtime/rt.h +++ b/third_party/fwkacllib/inc/runtime/rt.h @@ -27,6 +27,7 @@ #include "mem.h" #include "rt_model.h" #include "stream.h" +#include "rt_stars.h" #include "rt_ffts.h" #endif // __CCE_RUNTIME_RT_H__ diff --git a/third_party/fwkacllib/inc/runtime/rt_stars.h b/third_party/fwkacllib/inc/runtime/rt_stars.h new file mode 100644 index 00000000..188656b1 --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_stars.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: + */ + +#ifndef __CCE_RUNTIME_STARS_H +#define __CCE_RUNTIME_STARS_H + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup rt_stars + * @brief launch stars task. + * used for send star sqe directly. + * @param [in] taskSqe stars task sqe + * @param [in] sqeLen stars task sqe length + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok, others failed + */ +RTS_API rtError_t rtStarsTaskLaunch(const void *taskSqe, uint32_t sqeLen, rtStream_t stream); + +/** + * @ingroup rt_stars + * @brief create cdq instance. + * @param [in] batchNum batch number + * @param [in] batchSize batch size + * @param [in] queName cdq name + * @return RT_ERROR_NONE for ok, ACL_ERROR_RT_NO_CDQ_RESOURCE for no cdq resources + */ +RTS_API rtError_t rtCdqCreate(uint32_t batchNum, uint32_t batchSize, const char *queName); + +/** + * @ingroup rt_stars + * @brief destroy cdq instance. + * @param [in] queName cdq name + * @return RT_ERROR_NONE for ok, others failed + */ +RTS_API rtError_t rtCdqDestroy(const char *queName); + +/** + * @ingroup rt_stars + * @brief get free batch in the queue. + * @param [in] queName cdq name + * @param [in] timeout batch size + * @param [out] batchId batch index + * @return RT_ERROR_NONE for ok, ACL_ERROR_RT_WAIT_TIMEOUT for timeout + */ +RTS_API rtError_t rtCdqAllocBatch(const char *queName, int32_t timeout, uint32_t *batchId); + +/** + * @ingroup rt_stars + * @brief launch a write_cdqm task on the stream. + * When the task is executed, the data information will be inserted into the cdqe index position of the queue. + * @param [in] queName cdq name + * @param [in] cdqeIndex cdqe index + * @param [in] data cdqe infomation + * @param [in] dataSize data size + * @param [in] stream launch task on the stream + * @return RT_ERROR_NONE for ok, others failed + */ +RTS_API rtError_t rtCdqEnQueue(const char *queName, uint32_t cdqeIndex, void *data, uint32_t dataSize, + rtStream_t stream); + +/** + * @ingroup rt_stars + * @brief launch a write_cdqm task on the stream. + * When the task is executed, the data information will be inserted into the cdqe index position of the queue. + * @param [in] queName cdq name + * @param [in] cdqeIndex cdqe index + * @param [in] data cdqe infomation + * @param [in] dataSize data size + * @param [in] stream launch task on the stream + * @return RT_ERROR_NONE for ok, others failed + */ +RTS_API rtError_t rtCdqEnQueuePtrMode(const char *queName, uint32_t cdqeIndex, const void *prtAddr, + rtStream_t stream); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif +#endif // __CCE_RUNTIME_STARS_H diff --git a/third_party/fwkacllib/inc/tdt/tsd_client.h b/third_party/fwkacllib/inc/tdt/tsd_client.h index 665c8b82..36fc500e 100644 --- a/third_party/fwkacllib/inc/tdt/tsd_client.h +++ b/third_party/fwkacllib/inc/tdt/tsd_client.h @@ -107,88 +107,6 @@ TDT_LIB_EXPORT TDT_StatusT UpdateProfilingMode(const uint32_t logicDeviceId, con */ TDT_LIB_EXPORT TDT_StatusT TsdSetMsprofReporterCallback(MsprofReporterCallback callback); -/** -* @ingroup CreateCmdParameterObj -* @brief creat tsdclient func parameter obj. -* -* @par Function -* creat tsdclient func parameter obj. -* -* @param type [IN] type tdt::TsdCmdType, tsd func type. -* @param cmdParameterObj [IN] type void *, func parameter obj. -* @retval TDT_OK Success -* @retval TDT_INTERFACE_NOT_SUPPORT -* -* @par Dependency -* @li libtsdclient.so: Library to which the interface belongs. -* @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined. -* @li status.h: Header file where 'TDT_StatusT' defined -*/ -TDT_StatusT CreateCmdParameterObj(tdt::TsdCmdType type, void **cmdParameterObj); - -/** -* @ingroup SetCmdParameterObjAttribute -* @brief set cmdParameterObj input value. -* -* @par Function -* set cmdParameterObj input value. -* -* @param type [IN] type tdt::TsdCmdType, tsd func type. -* @param cmdParameterObj [IN] type void *, func parameter obj. -* @param itemType [IN] type tdt::InputItem, func input type. -* @param valuePtr [IN] type const void *, input value. -* @param valueLength [IN] type int, input value length. -* @retval TDT_OK Success -* @retval TDT_INTERFACE_NOT_SUPPORT -* -* @par Dependency -* @li libtsdclient.so: Library to which the interface belongs. -* @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined. -* @li status.h: Header file where 'TDT_StatusT' defined -*/ -TDT_StatusT SetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, const void *valuePtr, int valueLength); - -/** -* @ingroup GetCmdParameterObjAttribute -* @brief set cmdParameterObj input value. -* -* @par Function -* set cmdParameterObj input value. -* -* @param type [IN] type tdt::TsdCmdType, tsd func type. -* @param cmdParameterObj [IN] type void *, func parameter obj. -* @param itemType [IN] type tdt::InputItem, func input type. -* @param valuePtr [IN] type const void *, input value. -* @param valueLength [IN] type int, input value length. -* @retval TDT_OK Success -* @retval TDT_INTERFACE_NOT_SUPPORT -* -* @par Dependency -* @li libtsdclient.so: Library to which the interface belongs. -* @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined. -* @li status.h: Header file where 'TDT_StatusT' defined -*/ -TDT_StatusT GetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, void *valuePtr, int &valueLength); - -/** -* @ingroup TsdClientCmd -* @brief creat tsdclient func parameter obj. -* -* @par Function -* creat tsdclient func parameter obj. -* -* @param type [IN] type tdt::TsdCmdType, tsd func type. -* @param cmdParameterObj [IN] type void *, func parameter obj. -* @retval TDT_OK Success -* @retval TDT_INTERFACE_NOT_SUPPORT -* -* @par Dependency -* @li libtsdclient.so: Library to which the interface belongs. -* @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined. -* @li status.h: Header file where 'TDT_StatusT' defined -*/ -TDT_StatusT TsdClientCmd(tdt::TsdCmdType cmd, void *cmdParameterObj); - #ifdef __cplusplus } #endif // __cplusplus diff --git a/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h b/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h index a1c39a51..67adecd9 100644 --- a/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h +++ b/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h @@ -1,12 +1,18 @@ /** -* @file adx_datadump_server.h -* -* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ + * 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 ADX_DATADUMP_SERVER_H #define ADX_DATADUMP_SERVER_H diff --git a/third_party/fwkacllib/inc/toolchain/prof_acl_api.h b/third_party/fwkacllib/inc/toolchain/prof_acl_api.h index c8715041..07b32149 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_acl_api.h +++ b/third_party/fwkacllib/inc/toolchain/prof_acl_api.h @@ -14,151 +14,99 @@ * limitations under the License. */ -#ifndef MSPROF_ENGINE_PROF_ACL_API_H_ -#define MSPROF_ENGINE_PROF_ACL_API_H_ - -#define MSVP_MAX_DEV_NUM 64 -#define MSVP_PROF_API __attribute__((visibility("default"))) +#ifndef MSPROFILER_API_PROF_ACL_API_H_ +#define MSPROFILER_API_PROF_ACL_API_H_ // DataTypeConfig -#define PROF_ACL_API 0x0001 -#define PROF_TASK_TIME 0x0002 -#define PROF_AICORE_METRICS 0x0004 -#define PROF_AICPU_TRACE 0x0008 -#define PROF_MODEL_EXECUTE 0x0010 -#define PROF_RUNTIME_API 0x0020 -#define PROF_RUNTIME_TRACE 0x0040 -#define PROF_SCHEDULE_TIMELINE 0x0080 -#define PROF_SCHEDULE_TRACE 0x0100 -#define PROF_AIVECTORCORE_METRICS 0x0200 -#define PROF_SUBTASK_TIME 0x0400 - -#define PROF_TRAINING_TRACE 0x0800 -#define PROF_HCCL_TRACE 0x1000 -#define PROF_DATA_PROCESS 0x2000 -#define PROF_TASK_TRACE 0x3842 +#define PROF_ACL_API 0x00000001 +#define PROF_TASK_TIME 0x00000002 +#define PROF_AICORE_METRICS 0x00000004 +#define PROF_AICPU_TRACE 0x00000008 +#define PROF_MODEL_EXECUTE 0x00000010 +#define PROF_RUNTIME_API 0x00000020 +#define PROF_RUNTIME_TRACE 0x00000040 +#define PROF_SCHEDULE_TIMELINE 0x00000080 +#define PROF_SCHEDULE_TRACE 0x00000100 +#define PROF_AIVECTORCORE_METRICS 0x00000200 +#define PROF_SUBTASK_TIME 0x00000400 + +#define PROF_TRAINING_TRACE 0x00000800 +#define PROF_HCCL_TRACE 0x00001000 + +#define PROF_TASK_TRACE 0x00001852 + +// system profilinig switch +#define PROF_CPU 0x00010000 +#define PROF_HARDWARE_MEMORY 0x00020000 +#define PROF_IO 0x00040000 +#define PROF_INTER_CONNECTION 0x00080000 +#define PROF_DVPP 0x00100000 +#define PROF_SYS_AICORE_SAMPLE 0x00200000 +#define PROF_AIVECTORCORE_SAMPLE 0x00400000 #define PROF_MODEL_LOAD 0x8000000000000000 // DataTypeConfig MASK -#define PROF_ACL_API_MASK 0x0001 -#define PROF_TASK_TIME_MASK 0x0002 -#define PROF_AICORE_METRICS_MASK 0x0004 -#define PROF_AICPU_TRACE_MASK 0x0008 -#define PROF_MODEL_EXECUTE_MASK 0x0010 -#define PROF_RUNTIME_API_MASK 0x0020 -#define PROF_RUNTIME_TRACE_MASK 0x0040 -#define PROF_SCHEDULE_TIMELINE_MASK 0x0080 -#define PROF_SCHEDULE_TRACE_MASK 0x0100 -#define PROF_AIVECTORCORE_METRICS_MASK 0x0200 -#define PROF_SUBTASK_TIME_MASK 0x0400 - -#define PROF_TRAINING_TRACE_MASK 0x0800 -#define PROF_HCCL_TRACE_MASK 0x1000 -#define PROF_DATA_PROCESS_MASK 0x2000 +#define PROF_ACL_API_MASK 0x00000001 +#define PROF_TASK_TIME_MASK 0x00000002 +#define PROF_AICORE_METRICS_MASK 0x00000004 +#define PROF_AICPU_TRACE_MASK 0x00000008 +#define PROF_MODEL_EXECUTE_MASK 0x00000010 +#define PROF_RUNTIME_API_MASK 0x00000020 +#define PROF_RUNTIME_TRACE_MASK 0x00000040 +#define PROF_SCHEDULE_TIMELINE_MASK 0x00000080 +#define PROF_SCHEDULE_TRACE_MASK 0x00000100 +#define PROF_AIVECTORCORE_METRICS_MASK 0x00000200 +#define PROF_SUBTASK_TIME_MASK 0x00000400 + +#define PROF_TRAINING_TRACE_MASK 0x00000800 +#define PROF_HCCL_TRACE_MASK 0x00001000 + +// system profilinig mask +#define PROF_CPU_MASK 0x00010000 +#define PROF_HARDWARE_MEMORY_MASK 0x00020000 +#define PROF_IO_MASK 0x00040000 +#define PROF_INTER_CONNECTION_MASK 0x00080000 +#define PROF_DVPP_MASK 0x00100000 +#define PROF_SYS_AICORE_SAMPLE_MASK 0x00200000 +#define PROF_AIVECTORCORE_SAMPLE_MASK 0x00400000 #define PROF_MODEL_LOAD_MASK 0x8000000000000000 -#include -#include - -/** - * @name ProrErrorCode - * @brief error code enum of prof_acl_apis - */ -enum ProfErrorCode { - PROF_ERROR_NONE = 0, // ok - PROF_ERROR_PARAM_INVALID, // param invalid, for example nullptr - PROF_ERROR_REPEAT_INIT, // profiling has already been inited - PROF_ERROR_CONFIG_INVALID, // config invalid, for example invalid json string - PROF_ERROR_DIR_NO_ACCESS, // dir is not accessable - PROF_ERROR_FAILURE, // failed to init or start profiling - PROF_ERROR_NOT_INITED, // profiling has not been inited - PROF_ERROR_DEVICE_INVALID, // device id invalid - PROF_ERROR_UNSUPPORTED, // unsupported data type or ai core metrics - PROF_ERROR_REPEAT_START, // profiilng has already been started - PROF_ERROR_NOT_STARTED, // profiling has not been started -}; - -/** - * @brief transfer profiling config in acl.json to sample config - * @param aclCfg [IN] profiling json string from acl.json as {"switch":"on", "result_path":"/home",...} - * @param sampleCfg [OUT] json string for GE as {"startCfg":[{"deviceID":"all","jobID":"1234",...}]} - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfAclCfgToSampleCfg(const std::string &aclCfg, std::string &sampleCfg); +#ifndef OS_TYPE +#define OS_TYPE 0 +#endif // OS_TYPE -/** - * @name ProfInit - * @brief init profiling - * @param profInitCfg [IN] config of init profiling of json format - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfInit(const std::string &profInitCfg); - -/** - * @name ProfAicoreMetrics - * @brief aicore metrics enum - */ -enum ProfAicoreMetrics { - PROF_AICORE_ARITHMATIC_THROUGHPUT = 0, - PROF_AICORE_PIPELINE = 1, - PROF_AICORE_SYNCHRONIZATION = 2, - PROF_AICORE_MEMORY = 3, - PROF_AICORE_INTERNAL_MEMORY = 4, - PROF_AICORE_STALL = 5, - PROF_AICORE_EVENT = 255 -}; +#if (OS_TYPE != LINUX) +#define MSVP_PROF_API __declspec(dllexport) +#else +#define MSVP_PROF_API __attribute__((visibility("default"))) +#endif -/** - * @name ProfConfig - * @brief struct of ProfStart - */ -struct ProfConfig { - uint32_t devNums; // length of device id list - uint32_t devIdList[MSVP_MAX_DEV_NUM]; // physical device id list - ProfAicoreMetrics aicoreMetrics; // aicore metric - uint64_t dataTypeConfig; // data type to start profiling -}; +#include +namespace Msprofiler { +namespace Api { /** - * @name ProfStartProfiling - * @brief start profiling - * @param profStartCfg [IN] config to start profiling - * @return ProfErrorCode + * @name ProfGetOpExecutionTime + * @brief get op execution time of specific part of data + * @param data [IN] data read from pipe + * @param len [IN] data length + * @param index [IN] index of part(op) + * @return op execution time (us) */ -MSVP_PROF_API int32_t ProfStartProfiling(const ProfConfig *profStartCfg); +MSVP_PROF_API uint64_t ProfGetOpExecutionTime(const void *data, uint32_t len, uint32_t index); +} +} -/** - * @name ProfStopConfig - * @brief struct of ProfStop - */ -struct ProfStopConfig { - uint64_t padding; -}; +#ifdef __cplusplus +extern "C" { +#endif -/** - * @name ProfStopProfiling - * @brief stop profiling - * @param profStopCfg [IN] config to stop profiling - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfStopProfiling(const ProfConfig *profStopCfg); - -/** - * @name ProfFinalize - * @brief finalize profiling task - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfFinalize(); +MSVP_PROF_API uint64_t ProfGetOpExecutionTime(const void *data, uint32_t len, uint32_t index); -/** - * @name ProfGetDataTypeConfig - * @brief get dataTypeConfig started with of one device - * @param deviceId [IN] deviceId to get dataTypeConfig - * @param dataTypeConfig [OUT] result get - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfGetDataTypeConfig(uint32_t deviceId, uint64_t &dataTypeConfig); +#ifdef __cplusplus +} +#endif -#endif // MSPROF_ENGINE_PROF_ACL_API_H_ +#endif // MSPROFILER_API_PROF_ACL_API_H_ diff --git a/third_party/fwkacllib/inc/toolchain/prof_mgr_core.h b/third_party/fwkacllib/inc/toolchain/prof_mgr_core.h index 4f013eef..f8cb1b22 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_mgr_core.h +++ b/third_party/fwkacllib/inc/toolchain/prof_mgr_core.h @@ -16,7 +16,16 @@ #ifndef MSPROF_ENGINE_PROF_MGR_CORE_H_ #define MSPROF_ENGINE_PROF_MGR_CORE_H_ +#ifndef OS_TYPE +#define OS_TYPE 0 +#endif // OS_TYPE + +#if (OS_TYPE != LINUX) +#define MSVP_PROF_API __declspec(dllexport) +#else #define MSVP_PROF_API __attribute__((visibility("default"))) +#endif + #include #include diff --git a/third_party/fwkacllib/inc/toolchain/prof_reporter.h b/third_party/fwkacllib/inc/toolchain/prof_reporter.h index ff91351b..d5ed7569 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_reporter.h +++ b/third_party/fwkacllib/inc/toolchain/prof_reporter.h @@ -41,42 +41,44 @@ namespace Engine { * the Reporter class .used to send data to profiling */ class MSVP_PROF_API Reporter { - public: - virtual ~Reporter() {} +public: + virtual ~Reporter() {} - public: - /** - * @ingroup reporter - * @name : Report - * @brief : API of libmsprof, report data to libmsprof, it's a non-blocking function \n - The data will be firstly appended to cache, if the cache is full, data will be ignored - * @param data [IN] const ReporterData * the data send to libmsporf - * @retval PROFILING_SUCCESS 0 (success) - * @retval PROFILING_FAILED -1 (failed) - * - * @par depend: - * @li libmsprof - * @li prof_reporter.h - * @since c60 - * @see Flush - */ - virtual int Report(const ReporterData *data) = 0; +public: + /** + * @ingroup reporter + * @name : Report + * @brief : API of libmsprof, report data to libmsprof, it's a non-blocking function \n + The data will be firstly appended to cache, if the cache is full, data will be ignored + * @param data [IN] const ReporterData * the data send to libmsporf + * @retval PROFILING_SUCCESS 0 (success) + * @retval PROFILING_FAILED -1 (failed) + * + * @par depend: + * @li libmsprof + * @li prof_reporter.h + * @since c60 + * @see Flush + */ + virtual int Report(const ReporterData *data) = 0; - /** - * @ingroup reporter - * @name : Flush - * @brief : API of libmsprof, notify libmsprof send data over, it's a blocking function \n - The all datas of cache will be write to file or send to host - * @retval PROFILING_SUCCESS 0 (success) - * @retval PROFILING_FAILED -1 (failed) - * - * @par depend: - * @li libmsprof - * @li prof_reporter.h - * @since c60 - * @see ProfMgrStop - */ - virtual int Flush() = 0; + /** + * @ingroup reporter + * @name : Flush + * @brief : API of libmsprof, notify libmsprof send data over, it's a blocking function \n + The all datas of cache will be write to file or send to host + * @retval PROFILING_SUCCESS 0 (success) + * @retval PROFILING_FAILED -1 (failed) + * + * @par depend: + * @li libmsprof + * @li prof_reporter.h + * @since c60 + * @see ProfMgrStop + */ + virtual int Flush() = 0; + + virtual uint32_t GetReportDataMaxLen() = 0; }; } // namespace Engine diff --git a/third_party/prebuild/aarch64/libalog.so b/third_party/prebuild/aarch64/libalog.so index e041ad7e1e1f697da1328537689b7b300ae292dd..65aefa59a84fb99b46d0674ef6870f62e282ec82 100755 GIT binary patch delta 96075 zcmV+W{{#TA)eV5)4UiZT5S0J`00000KmY&$00000KxvUGHh&N|0ssI2000m-0ssI2 z000000RR9100031000I6007wW0ssI2007wW0{{R3007wW0{{R3003AN00000001C9 z00000000000RR9100062000I60002;0ssI20002;0{{R30002;0{{R3003|T00000 z003|T000000FmEGBFN|g000000LbV8000000LbV80000002B%U0000002B(7N&!wH z*zp1Y00000*zp4Z00000*zp4Z00000C=LJs00000C=Qdl0UjL%uMpmq1tlp06T6Gy zOaimxAM(%u000070RRAbll1`~4Cg7tk{|$wXn-g{%#$DjDSwDU5`nk?8MPq-g9AVg zAZRF9S5P_`II{#Z03fG;f&?Q95HJv6P(&f5hM<@v01g140q%+82^dfip#ZRD1K0xy zKnNf~K}-Tc004+V7yvN1fB;GW01kx^0776E0pm(s0t$dnM1TSSln4?w5fC6|P{|7c zP+`5$0T6Np34aC^8884=2mzG@x&R1GXHx*w00;;YMAiThpvXxikpch>0H6RVK7t5{ zPy~QLL^2Rj0IntigD`mj00000004Rb00000004df004gg00000004jh004sk004vl z004&o004*p004~u00000000000052v00000005Ez0Dl0K0001%0001(0001*0001- z00000000000001;000000001>0001^0001`0001|0001}00000000000002100022 z0000000025000270002A0002C0002E0000000000000000002H0002I000000002L z0002N0Dk}g!TV!Z00000&Hw-a(EtDd)Bpeg z)&Kwi*8l(j+5i9m-2eap-v9sr;Q#;t;s5{u;{X5vHq)$>;M1&?f?J)?*IS*@Bjb+@&Et;^8f$<^&|iQ000000QUd@000000Qdj^0Qmp_ z000000Q&#{000000R59;0TX}z0000000030000000RR920RR930RR940RR9100006 z0RR980RR9A0RR910000B0RR9G0RR9H0RR9I0RR9J0RR9L0RR910000M0RR9O0RR9Q z0RR9R0RR910000R0RR910000V0RR9Y0RR910000Y0RR910000Z0RVph00000B>?~c zC;+{&LjeE) zL;(N*MF9W+Mgaf-NCAHU07?M>00000080S?00000089Y@00000000000000008jw{ z08s$|0000008;?~08{}009XM409ye70000009*k80AB$B0AT?D000000Am3F0A>LI z0B8XK000000BZpN0B!*Q00000000000B->R000000CNEV0Cflf00000004HA0R|I) zcL4wZcmV(a00000c>w?b00000dI10cdjS9dd;tIeeE|Rf0000000000egOag00000 zfB^si00000fdK#jf&l;kg8={lgaH5mg#iEn00000hyefq00000iU9xsi~#@ujR61v zj{yJxkO2Sy00000kpTbzk^uk!0001g0Fwa#0F(g$0F?m%0G0s&00000000000G9y( z000000GI&)0GR;*0Ga^+0Gj~-000000G$B<000000G0H6T?000000HOf^ z0Hgr`0Hpx{0Hy%|0H^@~0I2~00IC510IUH30ImT50I>l80I~r90000000007006TA z006X;83$JcBvZUdlW+$V1c>F(dXt0)NF0@Sfx`+e8iIn5-_~7Aw-AYSR;k^m zCucCp)s-j|-uQ`YDrxVD4Rj(|>OmP^-kcmQlW+*E45_B3>|+HGRoOD@F_Rz(co=LU zhutlHk|t}yr3F=Hegfz#uP52(Wvi2*34jFq=y2ncAPS5GFu!V6ldKA81UY7Nk&_e) zSQG?nO&N)VB#>*Kw!ATRZB0E0xjmDB3m^n9`#Z;zpbJcsZ~+7c0{{sCz<-nS3nl?% zmys9)7XjUqF$@<05|@z}0~Y}llOYWk0d$ig4Hp3wm(d*q7Xi_eu?-gi6_b$+7XkZ| zF$@=z;0+i7_LCtE7XgEpktYKe0e6$J4Hp3vlQ9ez0dtd44Hp3elW`Fj0SuFI5f=gC zld%mK0R)o)5*Gm$lkp4}0r!(Z6c+*8lTi&90S%KO4Hp4&m(d*q7X{b=000q_VF42X zEtk<90~Z0AlQ9ez0l1gZ9Rn8urjtPw7XikT(GC{@Hj{A?7XhD>0S^}eC6fUU7Xjpx z@eCIMER$gj7XiMLkqj3BWS4<10~Y~?lTi&90X>sp3>TBY4;TS>mys9)7Xf{fVGI`m zV3Sb|7Xf~kktYKe0eF+K4HuJ85Eun#8vpN{H zlR*?00Yj6~5f_sv6c_=!lfeuZ0br9c3>N_;mmw$v7XhA=K@=AO=aXR!7Xj*%Q4kja z_>)l$7XdAokr)FP0f>_!4Hp44ld%mK0S=duCj%D&@RI=&7Xeh0(GeE`QN{blQ9ez0jZNA z4Hp60lfeuZ0T7eX5f=g4ld%mK0l$+W4Hp4-lVJ=O0dben9Rn8uxtGx$0~Y~JlVJ=O z0VN{LlTi&90Zo%34HuJ0 z6&L~glhF|u0VISY@5dZ)Z01E)P76AYN00004000000000(5C8xY01E(+5&-}J0000400000 z0000`0ssIK01E)Hod5s;0000$0ssI20002m82|th01E&Ja{&MV0001(000000000a z7ytkg01E(+UjYCB0001#0RR910000d0RR9J01JNrD4PHP000003;+NC00000VFLgF z5&#PT@b&-z00000Bme*a00000w*mkF5&#PT(4qhU00000`~d&}00000nhXE{5dahb z7ytwS000001ONa400000E*Ag*5&#PT2vPw600000U;zLC00000!T|sP5&#PT@S6Yt z004gg0KfqN000000D%ku01^NT0D$!X000000PFw&0000004Wgw01^NT05BE-00000 z05AXm000000HFc^01^NT0MPdU0000004x9i000000E`&`01^NT05EU?000000Ehqp z000000K^mk01^NT0MIM}000000Pp|+004gg0049u000sI3jok>0RR91003YB00000 z005B+000sI3jiSH00000001xp000000021{000sI3jio#0RR91000aC00000004Xs z000sI3jhER0RR91000C500000006BS000sI3jpYG0RR91000O900000006WA004gy z01E&Bng9R*00008000000002A1pojN01E(s_W%F@0000e000000002?0ssIK01E&J z`2YX_000130ssI20000=3;+NU01E(U6afGL0000O00000000012><{R01E)X836zQ z000040RR910002L761Se01E){NdbQV00000*Z}|l00000eiQ%z5&#PTKs^Bf00000 zWB>pF00000N&^4@5&#PTn5O^$00000xBvhE00000ehmNs5&#PT$P)no00000C;$Ke z00000jtc+)5&#PTc00000paFjX00000 z0KWqO01^NT0KljK000000GI#(000000NWA(01^NT0Kk?2000000H^@~000000QMOG z01^NT0HAXL000000OSDx0000007D1>01^NT09eZa0000006YKy0000003i?n01^NT z0Duw!0000000aO4000000CIm9000sI3jlys0RR91002w@00000007|=000sI3jla0 z0RR91001}v00000005={000sI3jnYU0RR91001Ze00000005Z*000sI3jnB_00000 z001-q00000003nG000sI3jo*+0RR91001Ze00000006-U000sI3jlw>$p8QV0001N z000000000g1ONaM01E&>tN;K20000K000000000n3jhET01E)f>;M1&0000m00000 z000265dZ)Z01E(^7XbhO00004000000001u5C8xY01E(E6afGL0000G000000001N z0ssIK01E){p8x;=004ggd;tIe00000G6w(v5&#PTIK=<}000000096100000j|l(( z5&#PT5Y+$x00000^Z@_>00000F$e$v5&#PTP|E-S000001ONa400000kp=(&5&#PT zh!z0=00000FaQ7m00000@e=?55&#PTASwX>000006afGL004gg0Pzq201^NT0ALjX z0000006+i$000000MrHm01^NT0C>Rw000000Pp|+000000Qv_201^NT0BFhp00000 z0Mq~g0000005cE(01^NT0EiL+0000000aO4000000K*Od01^NT05A>#0000004Mh($0002g000000001O1^@sO01E)v z6#)PM0000S000000000Q2LJ#P01E&}!~g&Q0002+00000000035&!@a01E)f7y$qP z00004004gg00000dV z01^NT08rEb0000008jt`000000F@E|01^NT09Y;o000000Ehqp0000004f>)01^NT z0Jwj40RR91007_s00000004CW000sI3jm-O0RR91000;O00000007Do000sI3jjzW z0RR91006WA00000003|k000sI3jo+U0RR910000100000008L`000sI3jmlH0RR91 z001xm00000003tP000sI3jnak00000004gk000000002$5&!@a01E*4f&l;k0002Q z00000000113jhES02Khx7X$zR00008000000000o82|th01E(6Zvg-R0000K00000 z0001>82|th01E)PZ~*`S0000m0RR910001x2LJ#P01E&($N&HU0001p00000004gg zMF#)?5&#PTIK}_~00000cmV(a00000tQG(O5&#PT_(K5z00000KmY&$00000^$7p~ z5&#PT(A)q3000007ytkO00000(h~px5&#PT=q~{P00000d;tIe00000Hq)$0001300000000188UO$i01E(kcmV(a0000u000000000!0RR9J01E&( zn*aa+0000q000000002z8UO$i01E)J$I~5&#PTz%2m)00000 zlmGw#00000I}rc?5&#PTU={%Y00000C;$Ke00000wGIFP5&#PT$ld?|000003;+NC z00000TMPgI5&#PTsPTUQ000000DJ)e000000L>Zz01^NT0PubR000000Q3O>00000 z0Q3a_01^NT0BE@Y000000IUE2000000I?1L01^NT04NRt0000000;m8000000NfP- z01^NT0BAn}0000006+i$000000R0dE01^NT0H75C0000004RR|00000006lV000sI z3jn|r0RR91003+N00000002-9000sI3jlZx0RR91000C400000002D{000sI3jpwf z0RR91000C400000001Nw000sI3jnA;0RR91002M$00000007$z000sI3jnbA00000 z003A300000004g^3;+NU01E)<5&-}J0000;000000002z2LJ#P01E&Z_W%F@0000e z000000002K5&!@a01E)vG64Vp0002E0{{R30002e761Se01E)fO921?0000)0{{R3 z000293jhET01E*4>;M1&000000RR91000256#xJd01JNrXh8u000000KmY&$00000 zdKLfx5&#PTs6qh%00000C;$Ke000006%qgd5&#PT&=>C8xG000001QY-O z5&#PT*gF9L00000WB>pF000000RaF25&#PTP!|CJ000001ONa400000RSf_D5&#PT zfD{1$004gg01yBG000000DKq#01^NT09auG000000CWKW000000HOl`01^NT0O-yD z0000002BZK0000008hi01^NT0QeOF0000005|{u00000 z0D2k#01^NT0N{H80000001N;C0000007Di401^NT0BAq~0000006+i$000000Jj?~c z0002=0RR910000E6951b01E&BBLM&a0002!000000000d6951b01E)}K01^NT z0I&c70000003-nb0000001_4e01^NT0O&sf0000006+i$0000003Zke01^NT07%OK z0000000aO40000005S;x01^NT065eD0000001N;C000000RIF401^NT0C>;<00000 z00062000000GAX101|%y3jnA+0RR91002M$00000002M<000pH6#%#g1ONa4000mW z00000004v)000sI3jpXq0RR91002M$00000007?#000sI3jpxw00000008U&00000 z003?f000sI3jmN40RR91001}u00000004>-000sI3jmNd0RVph0000)1ONa40002% z1^@sO01E(U!T;M1&0000W004gg00000ody5^5&#PTIKTh^00000Pyhe`00000P6_}35&#PTc;Em4 z00000m;nF)00000f(ift5&#PTnBo8c00000gaQBn000003;_TD5&#PTSQh~R00000 zKmY&$00000S_%LF5&#PTI0OLz00000FaiJo00000gam&801^NT08p*~000000Mr2h z00000009aB01^NT0O;HR0000005kyr000000E_|v01^NT0C1rI0000009*k800000 z07()601*Hc0Jts$0000001yBG000000Gb*A01^NT0PuSO000000FVFx000000PYn4 z01^NT04RSz0RR91002M$00000008h0000sI3ji1r0RR91001BW00000007w#000sI z3jjzJ0RR91000;O00000003MB000sI3jpw}00000000C40000000069000sI3jkQd z00000008g+00000007(t000sI3jiRw00000004hT000000001B6951b01E&}D**ri z0002+000000001^1pojN01E)9_W%F@0000e000000002V5C8xY01E&x6#)PM0000O z00000000236aWAc01E)v00000oB#j-000001Qq}Q5&#PTs6hb$00000KmY&$00000o)`cC z5&#PTNMiv200000v;Y7A00000sR;l85&(Y-00`Fr0000005k#s000000I&!E01^NT z02mYj0000000;m8000000Gbs501^NT05CEE000000Hgo_0000005T2$01*Hc0N57< z0000008sz{000000L=mb01^NT09X?N0000005|{u0000006Pr;01^NT0AT(A004gg z005W(00000005;B000sI3jmN50RR91001xm00000004ss000pH6##e#1ONa4000O8 z00000004>u000sI3jlbi00000002Y)00000006rf000sI3jhda0RR91004vl00000 z000ya000sI3jlBu0RR91000aC004gg0000B4FCWV01E&(`~Uy|0000q0RR910000@ z6951b01E(UF#!Mo0002U000000001G3;+NU01E&p^8f$<000130ssI20000R82|th z01E)vZUF!Q0001Z000000000I6#xJd01E(UJ^=s#0000$000000000B1pt2l5&#PT zn6dx>000001ONa400000We@-W5&#PTpb`N900000NB{r;00000F#`Yq5&#PT@TLF& z00000r~m)}00000!WjSn5&#PT@NxkF000006aWAK00000fENG&5dakc_$~wh00000 z0096100000H5LE>5&#PT=s|x00000006+i$000000I>l801^NT0N|Sd0000001N;C z000000P76^01^NT0B8mQ0000009XJ3000000OSM!01^NT09XeB0000001N;C00000 z06YW$01^NT09dR5000000F(d#000000Pza|01^NT0B8pR0000001STs00000004y( z000sI3jnYv0RR91005`}00000003VN000sI3jp~300000005i-00000007Sk000sI z3jjdb00000007(o00000008z4000sI3jn|d0RR91005W(00000008U^000sI3jkpI z00000007hg00000004ih7XSbf01E)vTmb+80000?000000001v7XSbf01E)nRsjG2 z0001B0ssI20000_6#xJd01E)9Kmh;%0000$000000000L8UO$i01E(!bpZeX0000i z0RR910001+5dZ)Z01E&}7XbhO0000800000000237ytkg01JNr0Av9G000002m$~A z00000a0CDV5&#PT_^bc`00000SOEY4000001O@;A5&#PT=#>Bf00000)Bpeg00000 zrxE}F5&#PTfO-J{00000U;zLC000002Mz!L5dakcFc<^?00000K>z>%00000K?(o> z5&#PTAQS-r004gg05|{u000000D}eq01^NT0PqX}000000DJ%d000000HO#001^NT z0LU5v000000I&c6000000Cfid01^NT0Jz5h000000Du4h000000GJOKaz0000a000000000l z4*&oX01E(E4*>uG0001_000000000O3;+NU01E)9?*IS*0002|0RR910000b4gdfV z02Kgu7z6+S000080RR910001G7ytkg01E&}VF7;t000003;+NC00000$_oGh5&#PT z;1>Y^00000v;Y7A00000%ohLv5&#PTC|v;n00000ga7~l00000Y!v_i5&#PTC_VuI z00000KmY&$00000RR9105&#PTK$!pl00000U;qFB00000LJI%@5&#PT*a-mu00000 zU;=*t0000002>Pc01^NT00`><0000002BZK0000002TxQ01^NT02t2z0000009*k8 z0000009ghA01^NT0LT>q0000001yBG000000A^NT0KgUj0000006+i$00000 z08t4501^NT07%pT0000000aO40000005N|B000sI3jm<900000005`}00000008R& z000sI3jjd(00000000aC00000006uO000sI3jm0~00000008g+00000005^9000pH z6aX**1ONa4007_v00000000~c000sI3jiSA00000005)_00000000*b000pH6###L z83X_T000000RR910001Q2mk;Q01E)1%m4rY0001Z0RR910002g6aWAc01E)9J^=s# z0000$000000001F82|th01E)9Zvg-R0000a000000000G7ytkg01E(sUjYCB0000C z000000001a5dZ)Z01E&B7XbhO004ggKmY&$00000>j(e<5&#PTc+vm>000002mt^9 z00000Xchnf5&#PTctZgI00000d;kCd00000aS{Lk5&#PTFdYE^00000@h~Us^FSMr?I+XhCprOmAmUb^u>rb97;2YhPn%YhPz|VRB>uV{C6@ zYhPz&baZKLWdKxZZDmAhW@Z3XZ*OczWpq$!WB^oeZ){U+Wo2-a5j7N(&NI7{rZjDn zBsDM}Ute%?Z)a{{ZDjyoS}`?DZ)Zbva%@R%V@z*nX=8Sie>Id9IZ1A5bVYV$Zgfm# zc4cfrc|~q^c9Rb_wWo$xuMQ(Pp@;MCwvk5zX1(TdWF0=GN!2vu} zZ*OcpY*T1WVRQgpY*T1$M05aiXl-P4090>p zY*T1$Lv(Dj$3pA@U1wi#OmAmGb!GrV>)Wo%_( zb7hkcMH?tWb!Jy`X>?@(OmAmKY;|*JLt$)eVqs%z08nyoV`X!5OmAmNZfSIrYegk3 zNp5L$OmAmKY;|*JRB3HxZ*_D+c|~q^07PtWXHsQwZ*p`=ZfSIBVQgu7Ws^rmC6kav zP=7>nc0+7wWo~p*Wo%_(b7cTTWp+?(Z)Z|vV|G(?VRCc;L~?dhWpi_BZ*EC$X>MtB07PZfSG?Pz-W!V`X!5OmAmKa%GeLMJyUjZ((Faa%pyD zazt!wMs;pubZKvHa{yItY_m*8*a1vTZ((Fob#8QNZDmAkYyeDeVPr&XY({l%V^e8v zXKZBvRc>r=VPsNuZggpFWkhUj08DRTWJGLiMs;pu0Ay@$aAj@)WNc$>Z*yg{cSxiJ z9dL4QXL4a}UukZ3Z)0I}X>V>{b7*gJbYE^^ZDo@hP0#@alfg|BlRi!clLAgWlRQos zlRQoivtUkI0+Vn~9+SFI3V#9{000mG001BW005VfmIeR-1pu`h00000000310RV&> z000mG001BW005VfmIeR-1OT-g00000000310RWmC000mG001BW005VfmIeR-0|2!f z00000000310RTT6000mG00000005VfmIeR-0syre00000007wW11A6g000031ONa4 z0000unE(I)0002+@dE$=000031ONa40002+n3HNzE`M;Q0RR91001xm1ONa400097 z00000004NV0RR91002M$1ONa40009700000004ld0RR91002+`1ONa40009700000 z004-l0RR91003YB1ONa40009700000005At0RR91003|R1ONa40009700000005Y# z0RR910Dl0000aO4000031ONa40001>rU3u|0000W0R#X5000031ONa40001}rU3u| z0000m0R#X5000031ONa400026rU3u|0000$0R#X5000031ONa40002ErU3u|0000` z0R#X5000031ONa40002MrU3u|0001B0R#X50Dk}g0|Wp700000$ff}R00000Z~+7W z000000|Wp700000(53+Z00000fB^&m000000|Wp700000*rovh00000kO2e$00000 z0|Wp700000=%xVx00000paBE`000000|Wp700000@TLI(00000umJ=B000000|Wp7 z0Dk}g0QjZ>000000KfqR0000000RU700000005@}000000MG#h0000000RU700000 z00^f6000000N?=x0000000RU70000001&4E000000Pq0>0000000RU70000003fFU z00000000660000000RU70000005GQk0Dk}g000mI1ONa40009700000002Oz0RR91 z001BY1ONa40009700000002m*0RR91001xo1ONa40009700000003C00RR91002M& z1ONa40009700000003yG0RR91002+|1ONa40009700000003~O0RR91003YD1b+Yk z000031ONa40001hrvU%}0001R0t5g6000031ONa40001prvU%}0001h0t5g600003 z1ONa40001xrvU%}0001x0t5g6000031ONa40001(rvU%}0001>0t5g6000031ONa4 z0001>rvU%}000260t5g6000031b+Yk00000sHXt{00000zybsS000000|Wp700000 zxTgUC00000&;kSi000000|Wp700000z^4HK00000-~t2y000000|Wp700000(5C?a z00000@B#z?000000|Wp700000*rx#i0000000RU7000000|Wp700000;D4t900000 z01yKN0000000RU7000000O+Ry0000003ZVd0000000RU7000000Qjc?0000005Agt z0000000RU70000000^i70000006+r-0000000RU70000001&7F0000008j%200000 z00RU70000002rtN000000DoWu1ONa40009700000001DU0RR91003|U1ONa400097 z00000001bc0RR91004jk1ONa40009700000001zk0RR910058!1ONa40009700000 z0020s0RR91005u^1ONa40009700000002O!0RR91006K91ONa40Dk}j1ONa40000; zr~v=~0002M0|Wp7000031ONa40000`r~v=~0002c0|Wp7000031ONa400013r~v=~ z0002s0|Wp7000031ONa40001Br~v=~0002+0|Wp7000031ONa40001Jr~v=~00000 z1Oxy8000031ONa40Dk}gaHs(Q000005CjAO000000|Wp700000c&GsY00000AOr*e z000000|Wp700000fT#fg00000Fa!hu000000|Wp700000h^PSo00000Km-H;00000 z0|Wp700000n5Y2&00000Py_@3000000|Wp700000pr`==0Dk}g0AK_J0000000RU7 z000000H~+|000000B{5Z0000000RU7000000I;Y5000000DuGp0000000RU700000 z0Jx|D000000FVR(0000000RU7000000KljL000000H6c}0000000RU7000000LZ8T z000000I&oE0Dk}g0009700000007Xa0RR91006)Q1ONa40009700000007{q0RR91 z007Vg1ONa40009700000008Ky0RR91007_w1ONa40009700000008i)0RR91008g= z1ONa40009700000008)?0RR91000mL1ONa4000970Dk}g00000#{mEU0000W1q1*9 z000031ONa40000O#{mEU0000m1q1*9000031ONa40000m#{mEU0000$1q1*900003 z1ONa40000;#{mEU0000`1q1*9000031ONa40001B#{mEU0001B1q1*9000031ONa4 z0001Z$A19;00000a0LVa000000|Wp700000kjDW400000fCU5q000000|Wp700000 zsK)^S00000kOc$)000000|Wp700000xW@qi00000palc~000000|Wp700000$j1Qy z00000umuDF000000|Wp700000*vA0?00000z<&h<0000000RU7000000Px2F00000 z0MG>l0000000RU70000000_td000000N@1#0000000RU70000004T@-000000PqC_ z0000000RU70000006@qA00000000IA0000000RU70000009eQY0000001yTQ00000 z0Dl7n00000003~v0RR91001Bc1ONa40009700000004l<0RR91007|e0{{R300032 z004dg0000000000008Lm0{{R300032005c*0000000000008*$0{{R300032006oG z0000000000000>O0{{R3000350058y0Fw_}36uC)3>wq`0000000000001ce0{{R3 z00035001)qlO9?YlT2C+4mke<00000009I503897PFfa|d|C_+NdE%>000000R#X5 zMFEq3S{9S6S_}?Y{{sL3000011ONc30h6v;78yzb0000000000003zJ0{{R300035 z005zr-C7q7YXJZN0000000000c#|<(7n2xU3>km{0000000000004;p0{{R300035 z006_2JzEzU76AYN0000000000nEwL+000000R#X5i<50z7aB(Z0000000000005}} z0{{R300035005r>lb%}^8I=J500000000000J#4H00000009I509upHTNfG600000 z000000002U{{sL3000011ONbMll@y48fyRm00000000000NDQn00000009I50CEA7 zE?gEFZvX%Q0000000000=>G!%000000R#X5bCX?M7k|nC0000000000008*^0{{R3 z00035004FX0000000000004;e0{{R300066000930000000000005Bm0{{R300066 z000C40000000000005Zu0{{R300066000F50000000000005x$0{{R300066004jh z000000Dk}g0001}^aB6@000021ONcS000000000000026^aB6@000021ONa`0RR91 z000000002E^aB6@000021ONaA00000000000002M^aB6@000021ONaA0RR9100000 z0002U^aB6@000021ONce00000000000002c^nU{Y000000t5g6SOEY40000000000 z*z^Mc000000t5g6Zvg-R0000000000;Pe9k000000t5g62LJ#70000000000==1{s z000000t5g6mH+?%0000000000@bm)!000000t5g6+5i9m0000000000`1At+00000 z0yG2w00;m80000000000008v^0000000IO600031000000000000{L10000000IO6 z0FIN5To)P%00000000000000O^#cF^000021ONb=0h7L577ZH#0000000000001bH zFpjo0000000000002n!0{{R300066 z003qIlTKY04SE0o000000000009cd3UKf*yT?`ox00000000000001J^#cF^00002 z1ONc2ldWAB8XN%t00000000000C@ES0000000IO600RM&-dz?N4*&oF0000000000 zi1h;i000000t5g6mjIIvUKSb<00000000000001(^#cF^000021ONag0h2yn78zp! z0000000000005}<0{{R300066004rMZC)1|5dZ)H0000000000xb*`7000000t5g6 z5&)B)UKSb?00000000000002U^#cF^000021ONa*0h7*N78wx%0000000000007wa z0{{R300066006O*{azOtTmb+80000000000==B2t000000t5g66q7Aq7a0`*00000 z00000008*)0{{R300066000(~U0)Xs2LS*800000000002$RuZ7n7J@3>qB)00000 z00000000>F0{{R300066003VBlfGXT8K?mO000000000004VkY0000000IO602!0* zUl$py00000000000000u_5%O_000021ONb*lO13elWbuO4M_F_0000000IO6034G| zU>6xw0RR910000000013_5%O_000021ONaXlYL+p8598k00000000000BH6D00000 z00IO60LzoDU>6yE0RR91000000001Z_5%O_000021ONaYligq!8lwOJ0000000000 z0EqSj0000000IO603QI84q+A=Z~*`S0000000000nDzqz000000t5g6O#zcWVHO$l z00000000000001}_5%O_000021ONaalWk!a8X*7x00000000000J!!80000000IO6 z0N4PNo?#XmA^-pY0000000000$o2yO000000t5g6egKosVHO&R00000000000002k z_5%O_000021ONad0F(Y<78xV}0000000000008Lr0{{R300066001SEEn*iLP5}S_ z0000000000`1S(;000000t5g6ER$Vg7a7C=0000000000000R00{{R300066001VF zjbay*++z$5821AJ000000t5g6T>+E6ViuDOWDEf)lW}7gllWo`8O;Cy0000000000 z066yp0000000IO60O6AzV;31H0RR91000000000;_X7X`000021ONc^lTBk68k7M5 z000000000009f|}0000000IO604V^Ieq$CIRRI710000000000X!ipE000000t5g6 z5&@I0V-}PAWDE{?_X7X`000021ONaz0h8Wi7LzPx3=W9*0{{R300066001rllMZAS z8khh800000000000GRg!0000000IO60H6VrK4cadcL4wZ0000000000sP_W^00000 z0t5g6gp+M#7aFqx0000000000006l60{{R300066004>rlb&Q28Y}<+0000000000 z0Lb?P0000000IO60H*+x&SVxDwg3PC0000000000*!Kef000000t5g6EtCCZ7a5%a z0000000000008Ls0{{R300066001tNEoB!P(f|Me0000000000`1b<<000000t5g6 ztpSr>Wfl!D000000000000008lW}GjlbB@;8bbj9000000000002ufK0000000IO6 z05<`XzGW5-IspIx0000000000D3j4<7nAs93=NF|00000000000020X0cRJJC}s>A zGynhq0000000000NcaN)000000t5g6odANN0RR910000000013_yYg{00002 z1ONcIlYM3w3;+NC0000000000Xp@m=7n8VV3>r580000000000004OS0{{R300066 z000C5lip?)8aMy|00000000000EqYl0000000IO602%?44rdk(#Q*>R0000000000 zn3ExB7n4Y53>oDB0000000000005}?0{{R30006600735ZD$u6d;tIe0000000000 zxcCDA000000t5g67Xg!=XBG{|00000000000002Uld)wNlh|hr8O#6x0000000000 z0ND5g0000000IO60E(0SXBQbe00000000000002!_yYg{000021ONb(lPzc$89)I5 z00000000000QmR=0000000IO60Hu>%Xcrkg000000000000008`2zp|000021ONbz zlZ|K>8bSd8000000000002uiL0000000IO6009A$zGxPc+-VFBDER{b000000t5g6 z=m3-MXcigY00000000000000u`2zp|000021ONa&lO1Un8b1I4000000000007&@* z0000000IO60IC3!PH7eyEdc-k0000000000Sos40000000t5g6@soXN7n5vi3=U}d z0{{R300066001EYldfqNlbmV{4tV(k0000000IO603HF8-f0$-%xVk{i1`Bm00000 z0t5g669JPBY8Dx)0RR91000000001(`2zp|000021ONa-lRat|lN@Ob4XF7800000 z00IO60G^X=Y8R7SYYYvz`2zp|000021ONc000000t5g6-jiKx7a2$Z z0000000000000R30{{R300066001YGjcXSg2>}2A000000000082SSM000000t5g6 zg8`GiYZeXF00000000000000elL2iPllW^48Il120000000000066*s0000000IO6 z0F{#+Y!@2r00000000000000;`U3y}000021ONaE0h3N_78#)c0000000000003C} z0{{R300066005PfeQXz#Y;6n)JZWbBV00000000000002^`U3y}000021ONb1lU;5X8ngfa00000 z0000000{d70000000IO605JiRj&2qjj{yJx000000000082bYN000000t5g62mzD6 zZWbAA0RR91000000000e`vU*~000021ONaulkIL785jWo0000000000066;t00000 z00IO608^74ZxI000000t5g6p8%7tZx$JI0RR9100000 z0001Z`vU*~000021ONa=lihC@8GZo(00000000000Eqho0000000IO60A-U6a2Fbj z00000000000001(`vU*~000021ONb30Fyp&78#QP0000000000005}_0{{R300066 z008onZEzPFi2(or0000000000xcdVD000000t5g6{Q#4ma26Vj00000000000002U z`vU*~000021ONb40F%ye78>mU0000000000007wg0{{R300066003zLlm2iPlU#8O z4e0v=0000000IO609TVOaTgj`00000000000002^`vU*~000021ONa90h3;F78#iU z0000000000000R50{{R300066003E&jd2$mS^xk5000000000082keO000000t5g6 zQ2~>_aTXa{00000000000000e`~v_0000021ONb>lkIUA4fy~70000000000063FD zau<^*ats<>00000000000000;`~v_0000021ONbd0h3O077ddC0000000000003B% z(Q+4)h;j@Wy8r+H0000000000X#4{J000000t5g6>65K;7aCsx0000000000004OW z0{{R300066004ObliqR`8jt`000000000000Eqkp0000000IO608#;y4s#Y6=Kufz z0000000000nEV3(000000t5g6q?0{!7a9x!0000000000005}`0{{R300066008v> zlWubs8h-!)00000000000J!`E0000000IO609OH%o^uu&s{sH20000000000$ovBU z000000t5g6VE~iPa~2J-00000000000002klTmaRlL&MS8a)9300000000000OpF0000000000`1}I^000000t5g6vXfnO7aHOK00000 z00000000R60{{R300066007_sla6#28D#(f000000000002uuP0000000IO60HTw< zbQc+B00000000000000e{R031000021ONbhlkIdD84Upd0000000000066^v00000 z00IO60QQp|br%}k00000000000000;{R031000021ONa&0h3O378xS}0000000000 z003D10{{R300066003Zm=y0000000000007AS z0{{R300066003!|&2|?VY5)KL0000000000*!=?l000000t5g6o0I)^7a9-&00000 z00000008Ly0{{R300066003+NlP-4_8V&&f00000000000Qmg_0000000IO60KWi} zUUwE6<^TWy00000000002>t^A000000t5g6qXCnScNUXOcnl2~{sRC2000021ONd0 zlf8Er8T$liYX=4oLn30000000IO60Br%2PIwlR40#LzSd)=?7n6v13>h*30000000000 z003zI0{{R300066002jmt#}t2a{vGU0000000000c>V(b000000t5g6b^(*#corIT z00000000000001p{sRC2000021ONc90h11S78#8I0000000000005Z&0{{R300066 z008%sJ$V-mumJ!70000000000sFT5Y7n68-3>tL+0000000000006lD0{{R300066 z005-{lb(4N8JGb800000000000LcCW0000000IO607R3`c^4T10RR91000000002k z{sRC2000021ONbcll^%Yll*xM4e0&@0000000IO60Ckstye*02Ep z@DY|m`4FNMkstye*02Ep@DZ9q`4GYskstye*02Ep@DZMWLirHl6p`4A!)kstye*02Ep z@DU0_`4B=Fkstye*02Ep@DUC}`4D0lkstye*02Ep@DUP2`4EB_kstye*02Ep@DUb6 z`4FNQkstye*02Ep@DUnA`4GYwkstye*02G80PqnWL-`Qm7?B_XAJ(t|0PqnaL-`N_ z8Id3YAJ(t|0PqneL-`OQ8Id3YAJ(t|0PqniL-`Ow8Id3YAJ(t|0PqnmL-`P58Id3Y zAJ(t|0PqnqL-`Pb8Id3YAJ(t|0PqnuL-`P*8Id3YAJ(t|0PqnyL-`QG8Id3YAJ(vc z0RZq3K12Bs;u(=30w30}0RZq3LPPlw0veGZ0w30}0RZq3Mnm}!A{vn(0w30}0RZq3 zN<;Y&LK=}E0w30}0RZq3PDA++Vj7Vk0w30}0RZq3QbYL=f*O$^0w30}0RZq3Rzvv^ zq8gDP0w30}0RZq3T0{8|!Wxkv0w30YumJ$@5ne<25aJqL-`Qm9FZUbAJ(t|0Pqo_L-`N_9g!dc zAJ(t|0Pqo}L-`OQ9g!dcAJ(t|0Pqp2L-`Ow9g!dcAJ(t|0Pqp6L-`P59g!dcAJ(t| z0PqpAL-`Pb9g!dcAJ(t|0PqpEL-`P*9g!dcAJ(t|0PqpIL-`QG9g!e60w30}0RZq3 zzC-yC;vJD70w30}0RZq3!bABG0v?ed0w30}0RZq3#zXlKA|8<-0w30}0RZr`^ndRO zf6x&|M)?pTGLawxAJ(t|0MHRiM)?pzGLawxAJ(t|0MHRmM)?q8GLawxAJ(t|0MHRq zM)?qeGLawxAJ(t|0MHRuM)?q;GLawxAJ(t|0MHRyM)?rJGLawxAJ(t|0MHR$M)?rp zGLawxAJ(t|0MHR)M)?o|Gm#(yAJ(t|e*n-CW=8oCA~TU70w30}0RYeuYDW1GLNk#d z0w30}0RYeuZbtbKVl$B-0w30}0RYeuaz^H%5W+N(AOauOumJ$j5uQf*5aKkE zAOauOumJ$j5u!%<5CS!kAOauOf3N`n&=ICa`4A#Ckstye*02Ep&=IOe`4B=ikstye z*02Ep&=Iai`4D0?kstye*02Ep&=Imm`4ECNkstye*02Ep&=Iyq`4FNtkstye*02Ep z&=I;u`4GZ2kstye*02Ep&=I~y`4HkYkstye*02Ep&=JB$`49p&kstyef7Y-80MHS} zM)?pTHjy9#AJ(t|0MHT2M)?pzHjy9#AJ(t|0MHT6M)?q8Hjy9#AJ(t|0MHTAM)?qe zHjy9#AJ(t|0MHTEM)?q;Hjy9#AJ(t|0MHTIM)?rJHjy9#AJ(t|0MHTMM)?rpHjy9# zAJ(t|0MHTQM)?o|H<2I$e;?Mc0RYeu=0^DtA~%sB0w30}0RYeu>PGnxLN}2h0w30} z0RYeu?ne0#VmFZ>0w30}0RYeu@<#a(f;W*M0w30}0RYeu_D1;-qBoHs0w30}0RYeu z`bPN>!Z(p10w30}0RYeu{zmx_;x~~X0w30}0RYeu0!R4}0yvQ%e*z!YumJ$j5e7&3 z5F$8{AOauOumJ$j5ei575JEVSAOauOumJ$j5e`TB5MnryAOauOumJ$j5fVrF5P~?7 zAOauOumJ$j5f(@J5TZDdAOauOumJ$j5gJGN5W+Z-AOauOumJ$j5gteR5aKwIAOauO zumJ$j5h6$V5CS=oe;@)M*02Ep&=Dp_`4A#Gkstye*02Ep&=D#}`4B=mkstye*02Ep z&=D?2`4D0`kstye*02Ep&=E36`4ECRkstye*02Ep&=EFA`4FNxkstye*02Ep&=ERE z`4GZ6kstye*02Ep&=EdI`4Hkckstye*02Ep&=EpM`49p+e~};pAJ(t|0MHReNBIyU zI*}j(AJ(t|0MHRiNBIy!I*}j(AJ(t|0MHRmNBIz9I*}j(AJ(t|0MHRqNBIzfI*}j( zAJ(t|0MHRuNBIz;&N0w30}0RYeuW=HuDB0G^F0w30}0RYeuYDf7HLOYQl0w30}0RYeu zZb$hLVmpx_0w30}0RYeua!2_Pf;*8Q0w30}0RYeuc1QUTqC1fw0w30}0RYeudPn&X z!aI>50w30}0RYeuenKszyScTApn3<{R04z^HTw-vjG6m^;-g|)BymH0f06+2_*oO0RVtf004l} zto#3$mH+_IApn3<004l}sQdqyb*4x8q6$E{!U6y_bEZf6U;;q-U;qHL&HMkCe*ysc zlmaS|f8YZYs?_0k=6hImjD2OQu9+m zsr6ezsr`GysK5hX)}aDG`G5i{k!k<`m*fKgDy0fQxq$!x(8CviQo^Dbks-i0k-z|e zQpNxOm*D^Z7at%4)%|^0kx2djm!Jaxe>JlU0QpJ&|Ce9^05zZi0MMcV0MG!O zNBKh7NBQ9c0;*~|0F?6s04hKO05u>0fKpoh|CfFG|Ch4?0Pyqt|Ce*(7?FAY|Ch}C z|CeCq0J%Q?|ChD=|CeAQ0l6UnfKp*T0J*aZK>7W9!l=LlU)KG5!l+^Z0PukT0FVQ! ze}Ga#fDe%&011)60Dw}P|Nj@({{NR9{QsBb0|2Vz0~0E<3qbk(d%~z<008iT005A~ zs(?~LfDe%&fC-Uc0Dw}C|Nj>sAOqF?d%das0|1fpQvs>e0RWKo69D;u0xFSe`u~@J z2mm#+0RYf-rbqdp0zmm72LQBWrbqb$e*l!y;{l-Z0sw$g;R6GzfB-=Gn)?5jpaB5T z0RVtf0LVxAHv9jVAOiq2lmGzGfdBx|g9?CBf}$9aA;2S%U;uzpZvX$6U;uzpfdBx| zBMg92f}$9aA;2b)X#fA0bEZf6U;;q-Km-7^Q2YOv6##$|e*ysc-~$yZ^%Fq(fAdp8 zsr`GysK5hX)}R3Z&>;YTQULfz`5F8FmmmZHHIxD>kpT#RQs4s=s&M=Nm-PbxDqsWv zG?V}U(BuOEDuDn1&_fG=Qi7rwks)9ukzfFTQcC~-m)!sV7XSd1(%=E0^8Wq*m!JXw z`GENUwG{w>65;><7nA@1(BuOEe=30h0MH`|fKq~@7?B|WBavVLfKsyo0MI%A|Ch`E z{}+@10MLN|0MNqB#~eMfKoC4|Chu6{}%&5fzkp1fKuTD1FC?6B#}${ z|CfRQ0MLN|0MMfgfKo!B7?B|$CXv7ZfKnv?|Chr5{}-SE0MG#RNBKYi1^~3z{{I(~ z(32RGxRVV5P|@Z%7GQbK?aks+WEk=c{Alp}v2 z{Qs991OPFB002}V0Dw~cd%>u{17Fq#{{NRv`~R2Z0|2Vy5`a>G0Dw|r008h|008hp zfDe%&fDw_w{{NRC0Dw~cd%>u{17Fr3AOqC^0Dw}!17Fttd%LM%008g+01}b?0|1fr zTLP)I0RYhRQvs=V008izqDT2606>5Fq9*|P0sw&0PW=CuAO-+6v*Q4fv;hF{;R6$@ zfB=9}l;RkXzyAZNw)_8=srmnxAOZk2-~$t?3i|(-9~=Ym4FmvGfEqygzyJWWCHnuD zfEqygKmY)=002MMMg0Gl;R6$@fB=9}ru+Ywnfd>hApZX}pZoup49Z0{H;|fYLydA(j(2ANv27zkdd)zkdg* zzXJj}oBIEk^aB8@002Pwzy<)cxaR|@c>n$Q*QsM&{s^J3|s^0zomw*mI z_`vu7wdMc+7k~;txiOQCmmdL5ldYE^6rxA@0RTYxp(g_Q0RVu~_ZtBD(39bp6B)1h z|Ce9@0Py2~fKuWE6RLp$fKmY96_LG@4VWfY@L>P|@Z|#+D&zweDh32VxuY6@QbK?a zks%-!k$?bzQm6g@mji%+(gFa0QsDyws^9|?s>1mHm-YhyDu4t4HDCY$@Z*1gQsM&> zs$l_uQUD+sk)D%@m?9_eVE_Q|0RYedAOMj83_!U*2mo;b1OQa? zQ$nfzdqJuH!vK-M17Fr3AOqFm+lA5}00HZu0RYedAOMj}1prh53_!U*1ORb>{{K`V z0Dw{f3;?+#`u~^Ye**w2XBtc?VE_QoV+ubX6fB=9}VgLZp zBOriMLVypE3;q9>&bK0So}S68is_mXTm%IP}7at%4)&D~Q(V+nVuwVcH&;WoNk^OrDsr`chks76}0Qq&|7?Ga>0Pz$6l$xU2K)Ip?05qWi0MH>I0FfXJK)D|X z0C7zL090Y(7?JfOK>71iL#coOfKvT?La8Aj0g?Yh0g=@C{}&%11J$+{0Qmp}01+Sz z0J$If|Cjay0IJFP|Cgd3Oex|60J)?NODW?E0J-E7e*n4V0{|-K0~D&{0~V@)0Dw~C zBY;w2007Wp007V-U?h=3fDe(b{QsA>7eM)8;uw+jBS87{Q$wkM0Dw~cdqSxpAOVs8 zLjjSs`TrLp0Dw|q0Dw}U0RYgV+5ou$6acxa`Tv)v8cZqV0{|+c3QH;C0|2?>3jn$0 z0~D%&e*l0|BO`!PVE_QoVgLZpAs`}=LVypElKlUd^&>#}Vd5B(fB=9}^HW2qAs_*f z{d+>G|3d+hn)&}1A0PwO|HA^&{d)tc{lfr}qiX=U{6_%!!VUnmw_^jT_yYhcpaB4| zvr_@7xoZTe^8*2@0Psiod;kE@wOazIx&Z*te}RJ=k@N!ss+N2}lUm~#kr@DhQoAbv z`Jn>`sS5xA6rcnI2SR5=423zPx?>%a#9RG>dV z`Sk-7DjNWRQWpR~`Jg*M`Tqg{@fQG>n&JZ$D&YeYs^9|{Dlq#0m;3_&Dwg~Im!AUw ze{l-^|5P6k0C9i>08}3=0CB(yLwcYC093O90MK*d7?I(lkWzGF0g+)ns&bVKfKp=K zK)Hi@cDO52p_?K6Wz(UG0UMzM05m@X0CAiHnHsZGL8-M{ zLaDc7L#erIM5((gK>6SU94h=rK>7W9e?zJN!vc}O17FslZveR&{QsArZ$PsAOqE6_y3oGe?XIS0sxC202J#f`2SS=0~spl|Nj>sAOqE^`2Uyo z0|2Tp`Tv*a0{|*w223gD0~V@e4ofNF69BoPYe2c>0~{*i8vwb00Dw~CBLKN#VE_Qo zVxv8~}h)(f|J! z004l}q5uCEA0PwO|APY2{d)qb{eu9J^HT$; z02Ch}1Jwxo|Cdkr|Ci(g0IKB!7Aj%@0MKCo0MJ7}fKoz$50N3jDUpBxfKtNy|ChEG zK>2f`laik5@E{};9w0Qn8~|CjxH zzo}pV0MGzHEs^~L0Fi+D|Ca#(fKtE!0JLEM0MH@8Es^{AlXjpXf6xHnEs^~L0FiL| z|CitZ0JO6U0QvI+0IGcY|Cb*e0CK?r093OJK>7W9!l4Eq0MPw=!l+;ne*n4U0{|*w007Wo007W~MSxO5fDe%&U@nos0Dw|g`~MgHd%me) z007Vc05FmL0|1fp3jp~=`u~@p006Y}0|2U0`u~?78~}0w0svH@0RYf50Dw~90~0DU z3;?+w`u~^Y0~0Fq3qbk(d%~z<007Wo007WqNPtp8fDe%&SimunzyN?!J^TL`-~$t? zLIHqM0RVu~5%>R>^8)~?9}oa>X#M|Gp#cEUAPfMx3;O?;ZwVgLZp zVE_Qoqep;JLVypEAz(0(zyN?!DU(H^OAgZa|CfLU0J&fSKso37lb)eY0bi5tp|Citc7OFV*|Cjdz0IEilk)oF}5cdC<;R6+_;sXGx-~$w@`1k*pp#J|g zpff=E;R72g`U4y)C;9)E;R66FUQu{R04z#`pi1{d>Wvl=%M_ zA0PwO{d>Nt{R04z^9um^FZchK^8)}X1@`}!fB=)yrxt07`Tv*T001=r0Duy^`Tv*m z3qbh*0Dw~cd%~!b`TrMA`Tv)d_WzgU0|2V!0~0D@007Wo007WJfDe%&fHje0VSrMA z0Dw{m`u~>z0Duyz`Tv*m3qbk(d%~yy0Dw}0`TrLmAOqFNlToNU0b!Gks3-y2leVZr zE#mh7mlXhjQsn~xD&_+eD&zwbDkEipQh)$}QeprA&|v@o&_aL@ks&}fk;{`MsZ2j2 z0g)f||Ca&Wh0-4Y0qgAf|5Ts>0MGywK)HVc0BdUb|5TJ>0g+*TK$C!aVYmPU01<$C zA-J`oumIpXk^OrBsr>^0k@Hglsj~q9ko8*vsbQi=`62*7`Jzt(`2qld z()l9*`FQ{Uu)OyFmmmRu05m4{|Ci(g04iYs0I-8{fKnoZ50N22JCT3@fKn6r|Cay& zfD*s|1*yOP2C24V0g=D|2dTgR2&te03Mu#V|Ceg?|CjUw0IHNW01@-^|CiwhfYRdw z0IFmF0I*^J0I-BWJdr|xJdxl77OH3X|CjXx04kpX0Bb-408}@B`2UxF_5YXj0|2T7 z_WzgW0{|*v006M%0~D&{0~IRcbAVDJgAb7*pgfUa0Dw~O`2Ux4qDT1v0D#h>PeS=& z0zmme00GK@2mrP7Q$eZqTSBS*dqAoABS888gA$Rz17Fs+V*{zUQvs2;LjjTE0~V^` z0~o5{0~e~`_WzfE^aB7Y00#gyx+ehnIfD<8dH?{hT0=jPwPOO20)T+h0RVtf-~$z^ z!Sw%^pi@A(0)T+h;R6+_LG}Na^aB8@9{>RH4FdpFv;qK&p8^%@>Hhyz^8*#C2LJ#R zKmkxUVGcmKAwU3;a{>X2e*zTi;{E?rUrsk$cs`5*NEm#+2ym*oQhDq#Qsu;c?2Dr0nj zQX+#7ks$zJK9OJmfKr45_0Qmp_fYQGk0QsPU0FeUr|Cb;E05x-> zlgg_if4BGlm;Utsm-GVws)Y6bm*oQhD&zwcs$u{DuweiI&?A6=QbK?aks*KpkzfFT zQg8VGm$VN+`RV`v7qkxm`RDWhm;HObsr>^0k@E`x`Lh84uyf)Vk#Y6^mti77xjz5^ zYoGuCRE75cm-P1kmuvO^mtZ0Rx$_G^`TcvsBB;OvU)KLa1JV6^0;&Cj0FnE12dP^m zKq*`VK>7JI0Qp&yjjR`cU?l)lvr_@7^8*5^q5%MqxE}!dwOazI^aB8@LhwiV^#cJa zU;qHHp#cD}0Dv2jA>bI1x+ehn_5&5FSO7rz`U3>2qelSw9|HjKBa}e-7yy`>KN$dV z;D?_YKS2O-02H4ZfAauw=?DN+zzzU3V;2Cl-~$ONC-nc9phEzE`8oCfm!v~L`Q`%v zD*OWg`C|Y8(B}gfs^tS4Dq}zck>Udvs^J3_s^9|@s+#lvm;3_&DxU`cF#sR{R6hd% zadQel`OOFbR5b?xQFj0U(6t5tk@vy|k#!Okiv$1w6dxc1)qesN>!1e!RNw;?s&VuG zmt+<|slfsOOXCB77pfuz08xO#Ad7QC0Fi?8|Cjs&04g5@05M_y|5QTv|CfpM|CjRv z0ICo5|Ci+h04ibt0I*>I0MO?H8!F}l7^>t06RJXh50N1N1(5@rfKq?}fKvGP|Ch5< zL8-M{LaDc7L#etaK>6SU94h%UK>7P~N2&dLLaF~l1ChXg17Fr3AOqDv2mmyr3IMd= z0|_eO^Z%FR0|2Vv0~;!&KLGjt^8c5hLjd{j^#7Oq0|5D?mq)4Q0{|*x007YE0~o4f zfB})>0~e~{0~M;^0~D%J^Z%Fp0{|+w|Nj@@0~D$?^Z%DZ4?(HH0su=y7eJ|^4+^QG zM?m?bLjsY1q!$UPfWjb)p!5Hi`~v_g9|Qm~;1~c@8~}h)x+g&Svr|E--~${gwOc}| zw_`)8`*TOB{d+>G`7=QI|3d?jzyn{_A0PwO;|~C|se=Hy#`OP}se?ed<^upK`~v{_ zV*miq=K~n3m;3_&`KfzAx#j}^Dy2g}`C|Y8(B}gfs$<{+k>Udv zs^J3_s^9|@s^kL+DiQPlm;3_&DtG_?7ok4@`Kf~dxs>z&m#Kq5xuHKm`QY^bH6#>V zDc}Qt2`VP&K)Ixs4JoE~0J($n|Ci?j0IJ{v8!D$i0QsNt|CgXc0Qr&h|Cji40jZ~l zN2%ch0QsbsO)20D0J)}jK)GW80MOzC7pi060g>SY6{_F^6sqy^|Cjs&04i7i{}-V@ z0Qsqd0J(JY|CgzQK)InmK=~l(|1~5OTq)px0|_c7=s>xo7Y-?=djPp(^Z%EiLjd`8 z^#7Oma{;NO7fvbQ3jn#MdqBBk007XZLqPdspaYTn0|2?=0~e~{0~M;^0~D&&^8c6o z0{|*J|Nj@EKLGiug8;c$^Z%ErgFv~VKS23__5U>_6kI8(lMN{*=s>yP0~;!(n+_>| zXY&7-phE!pS@i#x_;UfNsgq49;0pk`rJGJEV*miqp+i9VV_*W2;R68q;sY0|=K~2U z;R6+_-~$w@xbpv(`~v_g9{>Lrp+5lmse=HyJM;gSse?edp+7+Rpzr@RBotgJsS^$< zCg?!9rF#Imrh@>vKJ@>W_;UfNsS{3rDc}nLxuttRxnlqT(58bxxnm#%k^2Jxx#9yC zs^J3_s^QsM&>s(=81Qegl9&>;W?kr4N5|Cize z6RLxmfKp)q0MLK{fKnkK29XN)|Ch5? z|CfdH|CjRv0ICc0|Ci+h04ibt0I*>I0MO?H8!F}l7^>t06RJa;fKoz$50N1N2a)`f z4YFqvJM#aRq5%M~;R66F-~$t?La>vDvMN|X0f15g_zyW^007YA0|2T*UsAOqEsvlJ;g^#7N@001-~0Dw~SQ$eZyd%~!|17Fr3AOqFv^#7OP0~9LY z0~0D=lRdLI0iu(3vo-;HldZEi0RfZcvqOKN^8c5h3jj6p@&A{=2>>*-0RXUo;uw(u zFhRLL1ORbi002|~ltB5w2mrJ_^Z%FO0~jjc0~aa^^Z%D12mmx(^8c4W0RT0C;uw(t zltB5w4*;~_0~M;a@&A|M0{|-E0~M;T^Z%E?1^_jn0RWHy&`0?I06_Uh_Wzgm0{{jp zpaTezwUgzvBY#fw|Cjm$04m@E6{?@{|Cjj#0IJ^t0CBAz08~5j|CfLU05zgx1Cika z7ApJj|Cb*G05PBl092ssK)C=66cQf@KyhFN092IX7?FTJLAe1008u|UA90Bc08}3U z0CC_KpBjKZ0l8%L|Cg)s|Ci(g0IFgD0I*>I0MG{dfG<+z0~#uWUVu_UfDe%&KoOB( z0Dw{*_Wzg2^Z%D~qDT3m??U-t0zmm7007EB8I0MJ9DfKoz$ z50N2Y3Xy;SfKmwd|Cj9l{}|CgWh|CiVQ{}&%1 z1J#t`7=Mv~IzhPs1OQP#I3ICo4**mj0042|7oQq{Isv&P_5YV^^8c6Q0|2V!0~#t~ z006LI007WJfDe%&01%M|`hZfSU4T+x0Dw~6_5YWM^Z%E?|Nj@h@&A{g0su55@&A{g z001>s_5YWk!vc}4@c);B|Nj@@0~M+<@&A|O149@p;R66F;sX~d-~$z^)bjtAck}<3 zumArSA0PwO00aOLfIb1aa`XR}s{j8N(DMJ6`U3ze0sw$gK>&eLAOL_;Z6SU7Ahw7|Cb;DfKmYU|Cgu#{};OS|Ca&s|Ci(g0IKB! z8Y*G{0I*>I0I6?g{}%uR01<#X0l6FV|Cdw$ zfBzTc0{|*w006LI007YC0~#uWCxB8yfDe%&zzmUq0Dw|u_5YW`|Nj@C^#7OU@&A|Q z0|2V#0~#t~006LI006M$0~;#CCV)~xfDe%&Kp2sL0Dw|h_5YWx|Nj>N1OO2rGy%EH z|Nj?{^#7OE@&A|P0|2V!0~#t~006LIe*gf`BPM`SLVypEA>a#+=7XBme&wyDI?sxbXj%cl7_4 zzVZK;Z{};5^0jVGG|CjxH ztf~D20Fm^Z%D%0RT0$*FmXsqLZGyZZePk|ChAaL8;>Z{};5^0ja0&|CjxHtf~D20Fm^0k@E`x`I7+v@THp)si&U+`DLP$D!*bDfAasAKm-6awAVqYw%NtU;qG+ z0N^c={R04zKJx#U-~a%$vkL(E^8)~?O7j1g9~=O3fdBwhvkO4^{d>Zwzyn{_LIHqM z0RVu~-~$t?74QF-9|Qn#2><_7vkO4^qX7Vr{d>ZwU=RSg{}`TcvssK5hX*5CsZszL#PQUL&f()I5Dm-7Pvsvi&lap?a4RG|R? zkRS{Ix$p7+m*fKzDzghf`TcvssA2#BkYNCS0FVRAfKoz$50N2YFpWOr^8c4z z@Bf!L@Bfzo0Dw~cd%>u{17Fr)0Dw|r0059-006KA0Dw}1%z#otfDe%&U=)$r^8c3r z0DuzS|Nj?Y0Dw|r0059-006M$0|zR91I>U^LVypEAs`iz&+`A5004jz)c^k%{d>Nt z{R04z^HTw-^8*1Y^aB8@PwxMhQvm=pe+B??VE_PBpaB4o6f^_*ZSen>004ke^HV{o z{d>Zwzyn{_paB4o0N@yr6qEq@6#xIUApn3<0Wbl%V(|Z$004ke^HV{o{d>Y9sK5hX z)*m1P)%|^0k%0gJw4wn3kU|hZxgr1nxk8g+!DD~v?*EtI0~IRu6F~X%Q$eZy zd&8)}17Fr3AOqE4005BW0|F`)0Duw#fDe&j006K9)__tW;1-d90Dw}0^8c6W|Nj@E z0RWKT0~0DU3;?-R@&A|L0~IRu6F~X%Q$eZyd&8)}17Fr+0059-006M$0~0Ev)__t% zfDe%&z!xWxfB=9}6##$|Z}R__-v9p>A0PwORPg^7A0PwOQt|&6A0PwOAnucD!Zs43 z@Bf$md&Q{017Fr3AOqEI?vt{@BLSk5F1|(*EAjuAfB^tCwAVqYwiiJ8bE1^0k@E`x`I7+v@THp)si&U+`DLP$D!*bD64aFY4B{0Qmv{fYQ_g0JNc_0Fi(IfKs^b|Cc}m05zb8LaAb#hSGxuK>5P3 zK>1+;K>0xc0m`8P0JW2p#S=ZSVE_QIBLjd^LVy^NA;1}thw=ZH004lJ@c;i80PX*m zA0PwO02l;Q00aP09~1y_05qQ(zyn{_A0PwOliPv0 zKJNdQ^aB7YZ1De=v+e(vy!S+E&{3TlP<^>0^9GCM#wTI!tVc<^8)}XfC2zD z-~vFoLh%2W<^TT|4DkP#Q|Kpv69@c)-U1AtQG z|Nj^K@Bf!W?f;kc0|2VY?UUZf7AhkSfKoz$7?B|$9g%K`q0c$7&092p@0g)d}AGqxA|CjUw04g5@05M<#092qiK)C|| zfKmd0fKuTD6{`5{|CjUw04g8@05!D}K>2f`lhVmEf1ogt6aat{W$^!(wG%-3@BjZ7 zU;qG+0KhSkfb0L4wG%-3>i_>2U;qG+6aat{0N^r_dh7p}wG%-3Ks{R04z^HTw-lK}wG^aB8@VxmX+LjXYeqZa`A z0|0>1lZ46~Dy;ASmmdTGF#rJoRG=q7xdQ-zQUU^kQsDy>s?qKLmmdTGG2j!QT63b4 z%E~8ypfHgu@c)+p0Duzn|Nj?Y0058xATW_e>;IPk0Duzi|Nj@O>;IR40RYedlt=l% z17Fr3AOqEc?*A7bAOqF?d%das0|1fp3jq0(0RYgTlK_!(qDT2*0zmnp7XbMI0D#he z@Bfz{1OPFh7eM)80zmlz00GLO006b~3qbjkaLWujk?a4L{d>Ks{R04z^9um^lK}wG zV4_F)zb62>0RTYxp%(!80RVu~-|YXFzySa>ppyWRAn*T|bE1>B%PI;8>;ISX|Nj?u z>yzrsHCNEH3jq1^0|2Vl&PVwGiGb3#8vyy&0zmnm?*Etd0|2T(3jnkOiGb1q0Dw~A z0|Tl6>;ISH0~4y@2Y}Mx0~M+`>;ISGe}K~S0{|-G0~D&D0s)aT>yviOJ`Q6bfKoz0 zGm#fB=9}VgLY;LO?T-w(tL!v=2b}AOL_;{d>fyzyn{_ zA0PwOgCBrWfB=9}VgLY;VE_P-LO?T-Az(C-s_*}oAOL_;{d>fyzyn{_qaT1$fB=9} zVgLY;VE_P-LO?T-ApkXzpzr^ev=2b}AOL_;{d>fyzyn{_lVr^mRX{V5A;37110sM@ zfB=9}lJEbQ-~$z^eCz+0zyN?!w;MqDvr|E-wOc}|%K!ft#_s=@4ebAyys+ZUK+zDfKq?}fKp-r0FYq-0FXjJ zGm#;HJdsTAlcLTl0^#eE&dw?s<0ODmfB=9}VgLY;VE_P-LO?T-A)qypFq09_BMk#3 zfKoz0Gm#-6JCP)lLC+U|Vcx zzyn{_gCu}bfB=9}VgLY;VE_P-LO?T-A%HrO4)6b$wG%-3AOL_;{d>cxzyn{_A0PwO zMDG8Wi|hZFcca^6rxg&?kQa9+5Zf|Cb*G05PBh092I$0MMY$NBIB%K>6SR0JO6U0QnOj zLix(-|Citc6RNZS|FyFVK>2_I9+Bnk|Cb*G05MGUmU)CQW1Jwxb|Cdke|Ci(g0IGvLfKosAOqF>?f;iU>;ISJ0|2UHJAhJR0059d008hpKr@jcfDw^^ z0Dw}r?vwV=PZa_lk@D;RmmdTGF#r$%RDb~h&;ZPnTG1X_3hn=wVE_L$Vgdn?;R6;b z-~$z^?dkuQ^8)}XpbP*s%I*J`bN~R55bOV!ltMF+fyzyn{_-~t|za{_=;RPFzl z9|Qm~A^HDQf$jg7$m;)>qd|aDVgLY;L~?006M{0|2VQ0s@iX0~4z5=>L~@006M~0|2Vw zA_9@%0~4z0=>M1V0|2Vk006Y%0~D&@0~M-V?EjY`0Dw|}0su7F006YX0s@iX0~o4S z?EjY`0Dw}!0RS`s0Dw}H0RRiM;UWT&-~$t?PwbOs)ILVzLx56%0Dw|r0059-006K; zKr@jc-~f@u?f;hn0Dw~90|6@id&H=~17FsoLx56%0Dw|r0059-006K;Kr@jcKmd`t z?UU-%Mh9a60I*{~0+Tn@Jw5|QfKq?}fKp-r0FeCy0FgpKGm&8c0I(rI0FjXG|Ca** zfKuQC11kM{!KlCkU)CQW1J&UJ0IJ{tfKn{!ld{z|PBQHOm-7Pvs=x*Sv?Bn5(gFa0 zQsDyws+8#em%jo4@n8S|umE5Jks<(sQsDy=ssI3#nicB*mp}smHQ)mis>P|kU~H+ks;s(kt0ojQh)$}QZMcQm*4{v zsuKW!(irLgm$cVGsmK5S7at%4)j|LO@L>P|kONA9QbIs8ks$yBk$?bzQWF4x(jo2t zm%ac07at&#R@WYX&+Gq}zy$!bvkL(EBLITZ0sw$g;R6Gz^8)~?FzEl6)Bpgq0sw+i z;R6$@-~$w@Z|MJ*Km!0ZwG#mO0sw+i;R6$@-~$w@CG7u~^#cH^U>#HvkO3z^VcCl+vxw7KmdSJvkO4^ z^bbJ!_7_0;{d>cxzyn{_B<%l}Yw7=&z^oLO?T-As{%B z-|UlC*diWb0059eKr@jcpazjc9Dq`Q0Dw}_?EjbG0~4yd=#!S%Djs0~0FXjJGm#;{ z2a!V^fKq?}fKtEg|Citc6{@M|lit{|6tMRj0QvU=1FD3gNBQ#u0IHx6P?MwCEf#R- z|Ciwd7OJBI0g>VZ6)NBZ6RKD1ljhkX0?y}?3ffKrzUPx#+EOy9=l_?${{J;X008h| z005BW0~V?wfC-U9Er3!&Kr@km0Dw|J?EjazA3*tG0)SGKqLbd*Is)?RlN#F^MT6)6 zmjM8PQu6}P|kb^6L zQXyankwQQ-k$?bzQWleW+Z;)N3Xy{@fKoz0Gm(G*fKm(W|Ca#*fKs?0K>5r6{})5+ z|CfsB|Ci+h0IK8z6DmRg0PtY|0FXm3fKnkq3z0%VGm(G*fKvVIliu4J0&?e*`r9E3 zu=isFskdVSk)xuMCfqGs(7*o(sdEAzktX6mjZ}@ z(g6T~Qs4s?s>J92mtZnLxxXs_`M>}GHQ)mis{85xmjDw0H6Q?hQeZLwx#0sCs-Qyw zk?rb}uG|)Cuj~Jp^8)}XAP@LAxoZTeSO5U)UbpD~m-7PvD&YG6G|cM%mlNp!m*oQh zs^S9}s^J3~s(=81Qse^@DuXwGQi$vSm!c~``Qe9vQs4s=s{HBym%#b|wV*3N`4a$u zQosfPv^(ejm$_?1so(<>Dz&1M;@vKPtm^-l^XLDUIm*xWis^tR{Du4ihQbGU# z@L>P|kmLgxs$(>OQbIs8ks;s>kv;4Gm$LzYQlKk9`JngzwDsoym%IP}7at%4)pF|p zmvaVyQn=^;m*fKgs$(*MQbGWK0PtY|0FXjJGm#-643U5UfKn{$|Cg@+{};Jy1gWLw z|CjxHy{TgW0FYt;0FYx~0+Ia#0Fm=k0jZP$0I)&;5|IG{g3^PiE6RLFq05s6(|CfN4NBM5&|Cb+=edQYp9_as< zfR;!3WapE545m0JIYzLiye1 z|Citc6RNZS|Fx9PNBQ6b7OI~D0QpDf|CjRv04ksY9+C9v|Cb*G05QM-094=u6Dspl zL8GUmU)CJz|CeLu|Ci(g0IH)pfKq?}fKoyL0Ps#h008hpKr@jcAU=`T z>i?JE0~0FqQ$eZqTSBS*d&8)}17Fr3AOqD5>i?Hh=l_@F0|2T+Ie=0^008ho007WJ zKr@jcfDw^^0Dw}*>XY{1svcugfKq?}fKvSf0Fgof0PsRUGm&8c0FWUd5|NealfK~| ze>LX+mw*5OH2r(QsK5hX)*m1P)d=SQmmmQEHT`?Rs6qe$@L>P|kYiPVQbIs8ks%-y zk-z|eQh)0I7yWy|s9*p9kN_YPk&os77yWy`sr>^0k*Mkam;HOesB-837at%4)%|^0k@OD$`3>g(m!Jp$HM0u<`I7+v2e9-504j6hlTzX$0UMKb;vau|<^Pv;0zmmG z>Hn8u005BU0|2Ta02PtrB7joh0~M;n=l_>>0zmoo0{|)@>HnAF0|2VlVg!+400597 zKoybWB7joh0~V^e=l_>>0zmn-0stx&>HnAF0|2Vl!U&P$B7jn1005BS0~V?wfEAIi z=l_?r0sty?0RS{$0ze1(paB51CgzhG<5DVM0058xz!i}p;79o(06_Ua008j-0D+po z17FsG0RXUI0058xU>1=f;FFf)9tvOp0FVFx7m*?0lfL6C4dO@nU;;q-U;qHL@8y&B z<1YcClP2Ug4rS^8mw*8PG_(&u`E#O^YUDNoaOabvZ)<&y^GP7Md;|Cay)05#wP6sic5VdWPB{^XN-L~s0RS~x=>L}>0RXfC06;n6001<`=#%Q@X91#}=zyn{_(B%J@A0PwO{d=*gVE_P-{R04z^9um^ zlK}v*_7?#8cA`i5A)G>!*XA7pqvVtJ<{|>}=aU-e8eUW6|ChLf1CihZ6{@!@0Qt0A z0J)Cj|Cjj#0IJ{v7^;ip|Ci$f04k(I0g>VZ7^>j|87kld6{>yc|ChiA05$LC|Ca(Z zfKovSfKm|Y|CjUw04e|n_&31-fKtfklal8qe|qNsm!g9Kk>LXXssI3hQj+KYm%st| zH=#>F`QU$_(%=E0@;?9o>n#BQRNw;_s=DR>mr3ORmjNVzQvc}xm*E2!s^9|^s#xa# zm*4{zs_NwbmjMBQQs4s=DyQfFm*4{wDrxBdm&E4(m#gLfm$@TA`Lx$TskdW8sdJ)7 zlQ-xs0$1phX6PRHBp5*Y{R04z^%DU3l>q>d^HTw-^aB8@prVu7=u0*JzY+p8fKnldfKuQC6sn`> z|CjRv04e|j_%?U|05vP+|Chi405rDWLaDgtL#etaK>4+zlUnIA0*&aCj_Dc>TI2th z-~j+N-~$$_^W&4Y=^`@v=l_@B0~D%|=Kq(`|Nj@l=l_=p<^PxA0|2T(008g+Kp2sA z=>M1C0~0C}0Duzi=aUNRCNl8j|Cb*i1J(aS8PWZF0IB^00FkHz7?JY}0Qr*v0FVL= z0;vQQ1F5DX1No;X1Nma2lVa*}0z2fB*6KD+&FBA@-~$w@o8$kN;sX?_;{yPy0f2zg z-~$z^*5v<}^aB7YfC2zCZ|DD)w&eep;sXGxLjVBq;R6&ZVBi>$A?W{?wAVqYw%nZ|&FI|Ciwd6{_L`0IJ{v z7b>RaliKSZ0&3-x`s*?R;pUSr>>htr=Kq)U0{|+Z{Qo!L0~M-CZ z>{bG!=94Dv9)B0+|Cjay04iVr_%^l|K>6PP{}64I{};9w0Qnx{|Cb*i1J(U|zN!5K0Fm=k0jcx@0IKr?0jgpGK>6SU6sq9^0;-|_ z0JIC{|Cay(05o$#0I?ze|5N|~fYS3*L8<+F!l=LlUqjX(AOqFl0~4zAQ$eZyd%~!| z17FtS0{|)j0Dw|o@Bneh002~j0RWI70Dw|s)JOSZ&?1XL3;?;n17FsG0RWI8)RV65 zEq{<9)JORs&>)Kd3_!WS17Fr3AOqDP0Dw}!17FsF0RWHy)JOTi17Fr3AOqEa006Xs z0RWI8)JOTn|Nj@j17Fr3AOqEa006Xs0RXTefB=!d|Nj@j17Fr3AOqDO@Bne>002~h z0RWHye0-B3)JORsXkhrj17Fr3AOqC^0FyfJ6#=l5Q12rgumF5~lOccrksxSb_`m~S z)*m1P)j$9M@BpA0laKEtKajMe0Fh&&NBQ6b6slwZK>4H>0{H|0fYKl1|Cc}j0Py2~ zfKuWE6skc2fKmX!G?6Xm|CfLP05kvqfKqd!lk)E>0Uwhc@D~#8;{TT)1ORd17oQsJ z|Nj?_;*&=3X91v-uJ9uP>9f-CDFFoVApj(k|M8Lmpp%mFVgljellJl=1-Rw^mmiZI z^EM9fK>z^oLLfDfA%HiLN|RypA`b9D008hpAT^O8;5Lyylacct67WF)0Pq78fKoyr zHIX4eHjy%u!Sf^mqLb$HCJNi-|Cc}k05o%=lNR(=0^jA6ZuB01*X940^#cGZAOiR| zwOc}|-v9p>Hs$}9ed7O@<^uq#z^ogBXBPLLfDfA>cQWfB=9} z@8$oOwOc}|(EtAzDCPf`Z{q)#<^uq#z^oF^0k@HglsgnT!kn{rps$im%9`zj?@Ie3o@PiwGQbHg#ks$y% zk$?bzQqJZ7mvf?%R`oW2d*%O^ApZX~p$kSSwG#mO-~$w@^5XxO^#cGZfB*nBwG%-3 z>Hq&1A0PwO@Z|rOH{$=7<^uq#z^osd*{d>KsApn3<{R04z^HTw-lK}t+kn{rps$im%680h* zQRV-a9|Qn#fdqh3XaE3IU;zL$0RVtfbE1<@_9_-^<^PwV1b|Xt{{J-r0Dw~Q|Nj^J z;FFH_8v&w|s`e%UDwEOn908(}?)EA!oZ$bLVE+F$pag(Y^8f!A)ZqV@A0PwOfCB)u z{d>Nt{R04z^9um^^8)~?IpC8<_aZ<%;QyDP001=L0~4w(;QyB)1AtPX{{J-rJ%Cc+ z0~4w|<^Px90~4zA3qbk(d%~!!;QtpNAOqDQ0Dw~90|6?Np!XaR8Q}ky0096s;Q)YA z-~$t?EtAdn7g=ZI|CjRv04hNL|1@Ca|CguX|Cize0IJ~w6DsoyK>7W9!l*+40MK9{ zJCP9O{}&%11J%F-U)CQW1JzXI|CgKL|CjR%K>7W9!l*(30MOwB0IEQMI*|pFJ@_kT zV&wmq$>RT);R6#YU;+TN0uVs?-~$w@T;Ttg^8)}X69fP?z^IBQAha zLLfDfA;3P7zyN?!_T>MUv=2b}-~$sX^9w-v{d>Zwzyn{_VgLZp-~$w@Lf{9HN#K*t z_!@shEPzr%AT^O8pgfU)0Dw{x0DuzVnsAOn+U`5pz}Kas}YlZyEsGVtU`2YZb60=i5sh|J<7w_W# zmp0)4m*)cjs^$X~D&+$clgIrL4x>GQQbHg#ks-hck*DL6=KVGj`QHDR;sXGx;R6$@ z-~$w@;oy@l{x%us-v5_j0RZsh0|2Vx0~4wsz(@HZ2!PTdlYRatYO~`1m-^rTm-GVw zs(|4Cm*xWiD&zwbD&+$dszLw&&_MtI@B=}BQbHg#ks$yIk$?bzQWF4x5^3ZAm$VN+ z`RV`v7hnMZ@BqL^`M?8T)*m1P)nEYt@Bp+&`M?8T)*m1P)nEYt@BoaH4*wb+a{&PG zbO8YHV4_F)0RTYxp(g_Q0RVu~^%DU3mBN!o{~jtg-~X3D008jge}Gcr0~V@*0f15f zzzdN@;ggR47D-p$|Cb^Ff>PlF7pmX`7OLCd|Cay=05t;$ zfYRav7pfr$fYRUt6{^kO|Cc}s05#wP7pfND|ChHLK>3uyNBN-ufKuQC6sjeY?f(}V zgGhiz^ogG7K*LLfDfA>ay;0OS9c004ke<^TT|A0PwOfB=9} zK>z^o@}b>IJ&R;_mjD2O61Lw$slEUI7ZKwB zmssEbm*fKgs^dj~Qh)$}QbGU#&_MtIutGH;HIX48IFZca|Cay&fD*RfLaDI-{};C3 z0;xmZ|Cj$m5z+m70IB^00Fm=k0jYBV0Pta=mwo{O7ZHv}`2YYwIiLXmG!y`UQgfo0 zrU3yhf6%ty0;$4(fYJc~fKp>%QhA^&0g0g3?pr|Cjdz0IC2C0JI|jg3PlF z7pmX`6skGj|CfLO05r?t|Cb*K0C52c091AXQ~>bfAAr*00~e|RAb`@qwnzCV-~X5N z0{|*u1pqbR0~e}q-v5`@wnzEk0~V^h-~X4Ojz{@L008hq008i%fD)190~V@dpc0Yd zAb`>VA%N2F-It~U0U>|z_hJu`LjVBKz_v&ELJ9w%yR|Citb0E-_$GwVnK094`w6sq9^ z6RO|?7OHaH|CgWv05#$R6{_I_6RO|?7OI8amp%jmQ(fLi`G5jIIluq_G+^FG`SVjj zsr`GxsK5hX)*m1P)!^L!m*N8eszCq%@B<2fQX!xdk>CRqs$Sp!mw^8NG{XddQh)$} zQbGU#&_MtI@IoLpks-hnk>=t5mtfwP?gRlM5kLU|wEcU(sR00h()|Mfkwlk42mvbr zC6{do0Z#$Jm%Ru9I02%U_6Pwp0iu^G2>~tv7MEEG0V4sWmwgEVKNXqW|CfLYK)K-q z7OJ2#0J-1;6{@_K(Fp-F9pl{pm;HOasr>^0k@Hglsq_N@s`V29`Sk+;s$7>L3IR_Q z6yN`sApZX}699k`^8f!A-~$z^6PJYw0YVGV_TK`j_X7Z`fTEYu3IReHL)`zD-~$t? z&D{T&00aOv;R6<`-~$t?A(t%+0T&+c-v5{N0{|-E0~4yS-T#-r0swKd3qbky1D{%y zqL*R|0V)BZmyHVnBLR4qu?qnn3()o#0QvR<0IGnZm)Z*fHUR{e5exwrGOFGGmtX?` zHKGncso?_?s^9|_smq7at%4)qt153;`Db&X?H?0W$$bmkkX8 z8zFY!{}&%11J#h+{}&%11J%ad{}&%11JwxM{}&%11J!z$Neuy`0nwL12muq84gnwm z{FfmP0XG50mst)0D*&35&Pv0(B1!+7u)}r;R67w zLI42JKp+;8gWi|s1_43>>e-hn2LT!?*V+G^0k@VLAsdNDV(3Pe~`J@6s`D6zGw6hBU`SSw-Dz+B@`St?RN?=VQsV;?D&Ya3av=Z!OX33-f2tvTK$Cz#Ad80E|Citd z05z1RNBOoFK>2|RK)Evj6AP0H0J*aZK>767L8<+F#HhdnU)CQW1J&XK04m`F1gf_i z0QrCc0FVFxDv_<-|Cgl-K)Lq=04hQN0MJ1I0MO(E04n1jfKo!B7?B}>8IiyMfKmtE z|Cbj605zZje?a*I0F=_>0if~%0Dw~A0|TnR3IMqu+5eZf8$kJ>3P8D}0zmoF|Nj@W z3qbj{7eM&{0DuzR|Nj@Z-$JPX0Duy+3qbkV|Nj>N0Duy}17Fttd$g(j0|1frTLP(d z0RYhR3jq1^0|2U^qDT4n8vywM06_VnUjX?50D#hDe*!?c{4W6cpZoxE$PWNifP6rc zmH_~e00;n!!U8IhLJR>d z`~w-P01*JRxE}!dxB~-`y6*(3yMqFeK>z^IKmY*HAwV3F001446aauyR{#LengIZ? zpa%!3f4@@z`5(_6xIhCgkpy>vQUQQSIpF{RGz26)x#I&Es^SA1s^9||szKWSmp}*rHKbEO`K6ygxg-Ywv;_wMG@&~{`QQTts-=ej zxxxg1(xgWK`S#lXm!*e5xui!x`Jf2^H9-IXf6(JBfKuY37?B~M9g%1(*0JMqO|Chg00QtY40J)zI0CB35&|Ch86K>4`mL#ev&M5*8d z9IA5K|CiPRDv@OZK)JvGfKuY37?D8$0MO(E1u7xn9+9PdK$8P6fKsIh1&hTF1&hC! ze+2o3-T#-hqDT1v0D#h>UqJbx0zmme00GK@2mrP9TSBSx3qbkz8$kK|FF^VId(5c7 z17FsmKS24TEPzttq8O2Y0Dw|--T#-=|Nj@{0{|-HD}Yksq8O2Y0Dw|K007V-fE$r) z-T#+C11^z30f15=fJiw%0042629z3Jf7<_-%m4ouR{#LeK>z^I!zqAL;-VOlAwU|D zfB=9}8~}jQUETkemH_~e$p8Nrq5}hw;R6J!zyd0fMT{P}j@z^IgDrqk;-VOlAs`-+fB=9}Ox^#NtpEQPbOJ!Rh1~y_%-R2!R{#Lef8_%J zs^kL{DnS4M(4#7VQsSZ*ks-huk$?bzQa|1Qm$VN+`MD!N`KkZ^7r5sGsk-k3sk9FO z`Lx*ommeSl)%|^0k@Z^wsa6yK5!QY{llbQYsq+f}`S}9?s`Uc_svrP>(%}OZ zs#p*J5%U8ADp}b7mmm%Rw1EKte~`2f0QvL-0IK2x6{;kpO}XO(6DkBm0JvcW01<=Q z|CjXx04ksY05n+K|CgWH|Ci(g0IEU&0I)#-0I))!7?B}BAd$l*fKq?}fKn6P|Citc z6srB$|Ch86K>6SU6)N)!K>77sLaF%YL#h3H#i+moU)CQW1J(5d7%I0Le*pO)0D#h= zW&n{i*#DRJ0|2Uk1pu@kC;)kY0Dw~C0~M;^3IKWH0~D&^0~V^_VgQl&VgV`t5&*ee z+W(jJ0{|+30su8)asUzG0~e~`0~xAD-2a#L0{|)j1^_kS0~D&-*#DQ{0~e~;*#DQ{ z0~IQ?4?y|18$kK>TSBS$f9FG~^9w-v{d>izzyn{_A0PwO9^C(zW!e9iz@-LnnYzLZBFtA>bg9fB=9}*xdh@=>Pv065Rin6##$|SlR!Vz@-LZBFtA)p_TLneSyfB=9}%-sK%-~$w@w%Grd-~$yZv=2b}f43Vz`Sn{usrctZ zsq+g!`TcvvsK5hX)*m1P)#L*JDnbANut5L-u%jn{QbM2@ks*K~k$?bzQn}p!m&yPC z7xUZymlXhj5;@ubm*fKgszW7!QbGU#ut5L-utK01ks+WTk$?bzQmx$om!1Fr7at%4 z)%|^0k@Hglf2nf;0I+kWNBLm_K>48r0JLHXK)DnEfKs9W05#wP6e{ymL8<+F z!>GUmU)Hq~0Qq160Pp|+Dv>qZ|CeP7K)Lk;04hQN0I)#-0I=i(04f6`fKo!B7?B}B zB9XuVfKrd#|CiMP05xC&K=}gzl+xn?pz;C$fKuTD1FC-te*n3s*Z-Hb6F~Xk0~9Lr zQ$eZyd&8)}17Fr3AOqF46F~VC0DuzS|Nj>sAOqF?d%mea006K6U?-9N0|1fq4*>aV z+y9qT006K60RXhK3jq04006M_0|2UZ+y9pz8~}3R0RU993qbjT0RWHy`hZeF006M$ z0{|*Oqz$=(f1((X^bbJ!gARaF{d>ZwA>b*IzyN?!V%+~1A0PwO0RVu~LIHqM-~$t? zHQ4``0pyobK>(m~9{>SsX#oIKz@-0}g;vf}$9aA>b&HfB=9}Qr!QSvkO4^ zz@-K%@=1f}$9afAkMP`J)YhQvG|vs3G7dk-z|e zQbXMT7yWy@sr>^0k@HglsdE7UuwkM{`M);+xgr2S`Jx{H`2qld()AMn`IP|xkhB6W zk$|E|IiLXmG!y`UQgfn5`QQT-Dxx1i`C$S;`9S~y%HatBwewR!sr3^;`TcvusK5hX z)*m1Pf7KuWfKq^>2sv`w|Ce9`05zb~0FiUo|Chi705zaDK)D|T0C8dc|5Tv>fKq_M z2$AU5|Cb;I05#6n|Cita05xC%0I&e;NBOSU|CjUw04iVw05vz@-RsaC7!x4Z|As{S~U;uzp!lD?F;oJY0*#G|*wif{TTG#)VA0PwO z{d>5n{R04z^;-g|bpZgd^HTw-a{&PGp`u6ma{?-nbAlw1A^<@7qCWun0sw&0_ZtBD z7kogI`X>PS^a>Y?l=6MkdIA)SKnpUdvDxpIGk-1|5kz^D=sic<$sb&a3fB66# zLHT1CK)I$j0QsYH0J)vn|CfLP05s$S04hQN0I)#-0I=l)7b>GLfKo!B7?B}hFOh%% zfKr>=|ChMuL#f&S{}-SuK>0xc0I&iDfKnkqFp*yV|Citb05t&xfKp%q0I;GfK>6W* zA)5fKNBLlCH25Q60Fgoy0QqAAe*=qG8vwaO2LSmXKmd_o0sxC)0s)KS0~xC0+5eY7 z0su7_;|P%;0Dw{edpEea=R>Kz|Nj@{0~abIF@REl0Dw|L006K-006K;pcs)M;4qPO z+y9rKD?s^E*#DQf=R>Kn|Nj@P+W(jH*Z-I00|2Vz0~aczGJsNm0Dw|Le*gfmK>z@- zLZBFtA)qmlX50UlpesQ6MA-kAxaUKuqW}LFxaR|@+}8h>A0PwO0(?M|fB^uI001tL z{d>Ks0pJLc{R04zBY0xC^9um^a{&ObzY_rYWTHp;g#bYLr56DC1pt83LjeFabD~H2 zp%*~;U;;q-AOHZ$AO`@ofAb4K`TcvtsK5hX)*m1P)c_bl`LquJ`Sb$2qQbM2@ zks;tPk$?bzQZn2Bm$VN+`QiWn7at%4)#U>eD&zwIDnbANut5L-f3U+efKo!B7?B}h zFOh%%fKn#g|Ch86K>5}G{}&%11J$4tK=}dK|CfLO05!A^K>5%A{}&%11J&dM6e>ah z0I)#-0I-8KfKo!B7?B~sGLe7)fKnCP|Ch86K>5V~{};3m0Qrs9|Cb;90C6Y;095^Z zy{Y5_04hTrfKvSfmrfc1AAcY;kyQWyu%eE_(r~@8=QX$|pk-z|eQu5mW7at%4)xg;Qm-GMs7eW94 zut5L-u;c>(DgzyWQbM2@ks*LHkzfFTQs>(L7yWy^sr>^0k@Hglsef|;0Pu4HDv|YD z0;zMtB#{&VfKv4X6RHFN02Gu401=-80dXJ!092p?K>4+z0Fhw-|Fqx(6e^Sk01*h; z|CgTv0dXP!|5QQ%0I)#-0I*h|7?CyLHIWnmfKp)sK>6SU6RLp#0JO2!|Cc}k05yLC z0Qr;#01p0e^Af{{K|-Q$eZqTSBS*d&8)}17Ftq+5eY8*Z-I00|2Vz0~9Jl z6@XIW0~V^`0~M-(0Dw}q+W(jC|Nj^Ld%UUr0|1fpQvs=S0RXU|0|Aj?qDT2606_Vo z9{~9R0D#gTOdq)V)&H0D0{|+Z1pqamH$b@`1ORbh0RU8UqJKyE-~$vYq8~u{VFEz; zK>z{D!36-d^HV{o{d>fyzyn{_A0PwOwG#mOl>q>dwE`}Yp@K*`fdBwBwG%-3@c;i8 zA0PwOpn?cFtN;I(pc+B>RR936rr7_NU;zL%jMe{_^Va{DqM{g)K>z@-gByTSAwV~g zzyN?!h1&m@wSN;p`QQKl7eN33umc-_Qlg?5ks-h~kzfFTQhnP0m+=4p7vuu~DnbAN zut5L-u)`UEQbM2@ks-h;kzfFTQWOAy5_8)Bm(KtH7qt@r`RvvImmeSl)lSv_7at%4 z)nM2E7at%4)%|^0k@HglsdE7Uu=E1}s$il=`IZ|2C;|%Fmns_p9|5A5N*e(t zDumhpm&?}wm*oQhs^kL|Du4ihQbGU#ut5L-u)_s_QbGVZks;tYkv`g&ni~NcBI5;s zQbGVZks-i3ku=)>m$ef>`2YZb65s#-7qt@r`K#5JUL64(96OQs8vyzA0|2U5006M} z0y&Wt0Dw~90~D%3*q06*0WuaN2!K+60Dw{w+W(ie1^^L&41iJx*Oyit0VxZx^%DU3 z^#cH^V4|0b904){dD)k~903~vqL2V06CE%fIN}f*_SFE0U8=Z3V>2V z06CE%06dY<+5eXS0DuzU|Nj?B)t6o!0UR7Xk@p(_`Sb$-s#gF2u=fHvkre=dQs4s= zs=wElmK^~y7NZP+Qh)$}Qn1rd0>;#r3LXI(D%aTmmmb#t zm*oQhs^kL`Du4ihQbGU#ut5L-up<h`E#O|-W~xue}fKyQbGVZks*LTkz3jS zmjD2O672u~7vuu~DnbANut5L-&_Vz?ks+V}ks}X)Qh)$}Qc>Cem*4{wsxQ|6mjD2O z65#*;7k~hOQbGU#ut5L-(4!83QbGVZks%-ekw)47mjD2O64(F#7r)g1m;HOZsr>^0 zk@HglsdE7U3$XM90jl8x0xDvnm!cm5GAdWq|CjXx04iVu05zZ+K>6p_|Chi705zc- zK=}XwfKs&+K>2|J0QqyGm;N6CEq}1X5P(ub06CE%paPK=+5eXS0Duzj|Nj>sAOqD- z*#DQ6)&G~}0|2Vz0~IQO0Dw|L0059d006MV5r9%c06CE%Km(Bo+5eXS0Duy;6F~Xk z|Nj@{0{|*R5`a>G0Dw|L0059d006K;06CE%pa7Bm*#DQH8$kKn)&G~Z6MsPY004jz z)Bpb$fB=9}LI41eK>z@-qY!{nLI63DApioA@!0>D004jz%K!ftfB=9}LI41eK>z@- zgAjmHLI63DAz%TK=-B_4004jz!TKs{R04z^HTw-a{&O5 z^aB8@V4_F)0RTYxp%(!80X+bK(sTj7cJEPm;HOasUH9U@%;k;k@HglsdE7Ukn{rrs$!x?`Gguk`a=Lf`J)#A`2zre z(jWo=FI1w#0FhrzAGrS3|Cita05zc}K)C<_fKq`10J(FbNBN=`K>1+;K>0xc0m>l) zm+l?`A%Bp70Dw|K006LK7l2Yi06CE%fCZ6@*#DOR0Duzg|Nj>R)c=UCV+;UPAOL{Uk<&f7Sn&U=jc| zpanBP`9KwyDkA|lA*R*;m-PbxDgXokHJ~#<`QZZ;s)7PQxk4}i5%1Ukmw=anBLNd7 zWz_$d00{s!pff=EcGUlu;0XXVfC50da{>TsKn4I*-vSeBiI=$}0V98h)&H0E0{|*O z{Qopu*Z-HJ)c=>{0|2T*0059d006MV9)MCp06CE%fC-U+0Dw{#*#DQHGeG$j0Duxe z0|2xy*Z-HiFF^Ua??kEK0~D(J)Bl&VQ$eY=-$JQi0RWHzphx-O0~IQwH$eFz06_Uc z00GJ&4FI+H=R>LW6F`6Y{d>o#zyn{_A0PwO;Whvf_5%T`od5q9A0PwOpff=E0R8{9 zy6;4(ye~lc=>Pv0A0PwOz@-Lmz-rLI63DAs`BofB=9}@7MpA*#G|* zA0PwOz@-!ykZBLI63DApi@JfB=9}<=6k0&i{Y^7at%4)#L*JDnbAN zkU;4>DK>4)){}9+UmmVeo7JuLw08~Hx0CA`p092vF0+F~M0QtNx0Qn*SfKtDc0J-=B0IENX9{8)& z|Cjs&04g9605zdcK>1-50JNY(0+FCY0QsO(0+F**0jZ!r0QockfD)jC0+G3E1gX0# z0QsOh0Qn9802Ch}1J$4cK>0ub0JK=s|CgXoK>51@0Dt+@0sy(J)Bl(J0{|*O6aY1! z1^{uPPeA$L5&%@Ck3hLY0D#h@LqPcg0iaUg0~o4p)&H0L0{|)j1^_jp4@ap10Dw}U zPeA#NH&AqW6e zU;`J6;{zEgLMH%`;R6S%p49)B_X7YbK>7bPbJqWty3_xcV<>=9z@d zLI63DAwVFJfB=9}F4zB;-~$_~7}Nikpie;gV1EDrv_;ncm%mQ{`Je(o`2Yw2v=P() zm%A%K`Lk0&skv)JslNgM`JZP1ai94`;{}&%11J&dM04hQN0FXfd0I=gL zfKoyLIgue?2$6sQfKu(&|Ch}F{}&%11Ao;f*8i7n)Bl&_CxBA3|Nj@WQ$eY@YecEL zD?s_f|Nj?40059d006M$0~{)YEr3!&06CE%U<{Ff0Dw~4*8i8U|Nj>sAOqDx0059d z006K9EPzr%06CE%011(R0Dw{#0Dw}_*8i8dA3*uMFF^UY|Nj>sAOqEb0syq&1AhUk z=GFg~vr|E-xaUKuy6;4(ye~lcumArSz@-<1Tz@-V={nJLI63DApj4NfB=9}7k>bN5~|k!m$)B5`MfVc`H}zs7o?9sxk3N{kU;k)(@2x$Xb|7qe3Vsh9XE0Stcx z(*KtqAOqF?d%das0|1fpQvs=S0RZq60Dw|pW=HwJ006Y$0~9LrQ$eZyd&8)}17Fr3 zAOqF469D;jB0G^l006K6zz>m1(f^mA1_1eB0|2zP7XbNI006Mo0uYho1b|Y&0Dw~B z0~V@5006Kdpb?R4*8i8F20-~i004imAwUw5_tF2CU}gvTzybiY;sX|{qXmFczyN?! zK>z@-A%GK+U)KMZ-~$vYwOc}|^HV{o{d>cxzyn{_LI41;K>z@-g9Lz5LI4nvApjAP zU;uzp6aat{Qr7>MwG%-3(f|J!;sX|{K>z@-Lj{0RA;1!mU;uzp6aat{N!EY=m$h3$ zsmTBT7yWy_sbB#B@cjb-kpO5%`SVi&sZ;;}uyEA>m-7PvD&PPBG(i9Wu%iZmQi1{y zks&}7k$?bzQaINCmx2Nik>dt{Qh)$}Qb7O!ups~ykuui*m*4{vD)Uo8sr`GxsK5hX z)*m1P)nWkv@ZkdhszPK(`GS7{0JJ~=0I&eS6_G#yAJzZ>fD*t1U)CQW1J(U|zNtU} z0I&ey6_Nb|0Fm?$0QqzQ0Pyh8|CfMn2l=1`0JO6U0Qpk@0I+jH7LmgSfKtE!fKuWE z6RJS~0I(t87m*Rx|CfMnNBLm^0I)&=fKnkq6p?t-|CjUw04jh105yN&0~4x2006Lq z2Y^x`KpBz10Dw{i*8i8Y3qbkc0~9Ls4?y|-d%~!|17FtS0~4x2006Kf2Y^x`fEbZr z0Dw{y0Duzs)&G~X3qbkw|Nj?4006K-006LK27ppRKo*f9Ko^l<0Dw{y0Duzi)&H04 z|Nj^Ld%me)0RZs*0|0-K0BlG3^HTw-Q~&_57S#Wj^8)}X-~a$LK>z@-g9w09fz@-A;21u*wz1+-~$sX^HV{o{d>Zwzyn{_ zA0PwOWB~xMgp5M@L;wJ^fB+xX{d>Qu!wG;=fB=9}LI41;{R4jhkwQQgkwE|eupxjO zk;c{kmjD2O68(F@sK5hX)?onvupyK}`9S~xv>*T<*8O|Gsly6@Qh)$}QbGU#u>Au7 zkwQQgkwE|eupxjOk+#+UmjD2O68(F@sK5hX)?@(yu!NjK`9uH!w15B~*8O|Gsly9^ zQh)$}QbGU#u>F4n0FgpK7Lh>!0I(r|8Z70FgpK7Lh>!0I(r|8u{17Fr*0RXTev_kno006Wg03X)u{17Fr+0RXTRgK>z@-A%Gi^X4U_f004jz{d>Wvzyn{_V*voLW5h!FLjVA@ zU;rQ1{d>Qu!w`T{fB=9}LI41;{R04zLO>RgK>z@-A%Gi^R@MKP004jz{d>Wvzyn{_ zVF3WJAz@>AOIiM{d>Qu!x4Z|fB=9}LI8gNu>Au7kwQQgkwE|eupxjOkw(@3 zmjD2O68(F@sK5hX)?onvup!h!`9S~xv>*T<*8O|GslyV0Qh)$}QbGU#ko^MykwQQg zkwE|ekRgB@kv7%;mjD2O68(F@sK5hX)?)zxkYn6J`9lBzv|s=q*8O|GslyY1Qh)$} zQbK!0FWVo8<8f}|Cay&fD-+C!KlCkU)E#+0FZ>_Lit1h0JMMr zAJ+YQzp29%fKq?}fKoyL0FeCy0FgpK7Lh>!0FWVo8<7^(|Cay&fD-+C!KlCkU)Es( z0FWWu{17Fr*0RWI8^g{VT006Wg03X)u{17Fr*0RWI8{6hIb006Wg03X)RgK>z@dA%Gi^=G6a}004jz{d>Wvzyn{_V*vn=V+2F_LjVA@U;rQ1 z{d>Qu!x(^4fB=9}LI41e{R04zLO>RgK>z@dA%Gi^*3|!(004jz{d>Wvzyn{_WB~w> zgbYLZL;wJ^fB+xX{d>Qu!x?~5fB=7hQbGU#ko^MykwQQgkwE|ekRgB@k;c^jmjD2O z68(F@sK5hX)@A_!kj4~4`9=T$w7>u#*8O|GspA@eQh)$}QbGU#ko^MykwQQgkwE|e zkRgB@k+#(TmjD2O68(F@sK5hX*8O|Fsr>^0k@OD$`Je#+w6hBU`5^#+QuBWU0IFNj z|CjUw0IDDX0JO6UK>6SU6sq(OK>7W9!l=LlU)CQW1Jx7&fYSQ^{}6+e{}&%11JwWl0JQyk zzp4EL0Fi&u|Cb*C0CC_0pIU$Yd%>u{17Fqv0Duy}17FrZ008ks7(jXi7(n`<1OQb1 zd%UUr0|1fpQvs<|1OQR>TLP)|0|2TZKmd{R0|BZ+0059d005Bp8vywfP&A7+z$1}Y zKq8T10zmoT0~M;_0|Kgo006W$(EpcU0RXgM1_1eULI9C}0u<}v{{Mee004ke_ZvX@ z^HV{o^;<%z{d>fyzyn{_qX~dg;sY0|;R6<`zyN?!V$}ba^8f!A004jzzyn{_{d>Nt z9{>RHBp5*Y{R04z^9um^AOQeW9MJ!l^8)~?fB^us-~$t?^9w-v{d>Zwzyn{_A0PwO z699nH-~$t?^9w-v{d@0~4zA z3qbk(d%~!|17Fr3AOqFF0RXg@a54cDD45Uxm*E2dD&PYXs)5k|m-7oi`2ZXM68(F^ zsK5hX)&Ky2QosXW)|NB@7=Kd%0Pyq!0IEO$0FYy%NBICSQh8(mK>4H}0{H|0fYS97 z0QrFy0J*i}0Fj_`0C@obfKs6A0FesN|Cc}j0FdKIDP091e$0J-azoihO!O2b!xQbHg)ks$y(k?7O^mjD8wQh*i!x!?c)7vuu~ zDnbANkU;w@`QlRSq zk+jeMmp}jjkmG-VQsM&@s$l|vQUHKHk;2pem!JRuHQ)mks=w0zmmeGea$y1hRD>Ep zxk3N{kU;s(a7>mjV925+48oYs~-vR29geQXc>nYwQ64RDc=)x$BpmGXWQW z<6nSMLLfSkA>cldlGFc}00N*=fEoa~-~ay?z@-&bK!he9${d)kZ{R04z^HTw-Qvm?* z^aB8@KmY)cW1>g-05DQ{WB@?w@`QlRSq zkzUXLmp}jju;YJ#QsM&@s$l|vQUIU=k!;idm!JRuHQ)mks%g^ymmeGea$y1hRD=#d zxk3N{kU;=`Jo>|`CtM-`5*uQ$^ZqIt~3D_ ze?kF(QUL&f(%=IXswL0=mmdHCaV-J>R3D%ZaclqpRDccux$Xb|7vuu~DnbANkbnSy zQb7O!umyd9Qp00_QbHg)ks*Ktkv`M^mjHc$Qh*Ksx#9o+7vuu~DnbANkbnSyQb7O! zuq6P1QbS{aQbHg)ks$yBkuuZ&mmmOue^P)B0J+uw{}-yx|Cb*i1J(Zn5z)ebfYJc~ zfKvT?0IB^00Fm=k0jW~~0Pyq!0IKy{0;yx7NBKYi0FV{|pi;Ht0Fh(>K>4H}0{H|0 zfYO#80J#7#QhA_r0C}M60FemK|Cc}j0I=hKfKuWE6{>*(fKmX!29Xxi|CgWue*iV$ z0~M+h(*Ktq8~}1*0svHm9zeN50059d006K9Xn;~eAUcsD;0cj{0Dw{j)Bl%qqDT3m zA42(H0zmm7007D$1pu}4Q$eZqTSBS*dqAoG0}+wH17Fqw0D#g$0f18A0~M;z&i|JI z|GyF+00C>w002}K$e>am02OQOe*pkgfF1z3>;L~3z@-z@-RHBp5*Y00970002PwzyJWWmuxiw5K=+W z{}=sxzo}yefKq?}fKoyL0FeCy0Fgo0Qpk^0PyuA0QvO;04idlm(Dc-HX0|=|Cc}n05zZ^K>49V0g<2| z0QsQf0Fgb=mmW3&MPIPs0~D%bKn;380Dw|L0059d006K;AUcsDzzdOo(*KvV4?y`K z0Dw|+qL;!p0Wp8D!v}y;LLfSkAs`EpY|{UiAOL_;?*IQ6A0PwOq|yJE>(2j|z@-LLfSkA%F~#U()}Vv=2b}AOL_;;Q#*@A0PwOmeK#0-Om4) zz@-;|qXNLLfSkA;1lhP||<@mmmOuQnU|1`O*LX7qkxm z`Nz%wm;HOTsr>^0k@HglsZ#*}@bm)!s$-%@`M-Y%sbBy=`Jhh#`2YZb(!WyzIln&u z`M;9@xwH=ew6+%j`St?=s(}Omw6|jeskZ|Hk@y1wDkA^@(1fA{kz)W7k%9t%(xC!? z(%=IZs;D&0|Cb*G05L!W093UT0QvO;6so!>0QrFefYRUt7pkz)|Chf;0r>g@0IJ{v z6{-x)|CgYbAvggPf1*eEqEA5iVFEz;K>z{DffE3=^HV{o{d>x&zyn{_fB=9}LI41e zK>z@-gARaFLLfSkA%G8&5YqpbwiiJ8AOL_;@BjZ7NYVe7kIw&>z@-LLfSkAs`Tu1JeJOxF10IAOL_;w%z@- zV-A2)LLfSkA;1oiy3zlaAOL_;n*aY7A0PwOyK_aUlmGu0xg$XNLI41eK>z@-DbD|w<^uq# z54>{}%xO zfKpb?|Cay&fKs(vLaDc7L#ev&M5$x{{}&tpfKtr=m$o_q5+3%<|Cb*i1J(U|xT*aE z0Fm=k0jX300Pynz0IGqam*zSFGXbKP8an|Yf3P_tI+6E66p;jw1sgipWcc9&7^(mS zfKva@|CjXx04kse05xU?fVt%Z7^+~RK>1{%1d-zd7pejXfYKodfYJbXX86R+|Cjay z04g5@05RYP090WHfVp6zK=~GUVff$!7OJGo|Ciwd7OLU{0IJ{v8mf%W|CfLO05xC= z7(lrn1ORc&0RU9C-$JRl=R>KwCqVg>qL5V~{};C30;#y?1F50|2Vz0~4wu008ho005AK9)MCpAUcsD zz!#B#0Dw~2(Epe1|Nj>sAOqDB(Epbo2mo=w{Qp!B(EpcK&HtC>0|2Vz0~4wu008ho z0059eAUcsD02h&C9e`4R0Dw}-(Epd<0~4w%&HsOwVEg|x-~ay?gB*ZTfB=9}A^-sJ zK>z@dLLfSkAz&7fzR>@dAOL_;{d>Zwzyn{_{d=dWf+~R00RVtf{R04z^HTw-Qvm?b z^aB8@W1>g-WB@?3FLQbHg)ks+WNk&n>-mmmOu zQVIY76o3GLQX&8V@Ie3okmLgfDnlfIQbG|RI*}oO7?Fk0|Cb;DfKqd!m!>`eCVwIT z0PsNo0FZ+tfKoyrI*}p34v}=w|Cb;DfKu=O{}&%11J$h0|CjU3|Ci+h0IK8z6e@rK zfKnm=0PsNo0FVPFfKoyrI*}oO6p?1o|Cb;DfKuWA{}S35D**ZW0|2UE3jnmWTLP)JLjjRh005BS0~V^G0vnOn&i|KS1^~3U z=L4x3008h<0059VgFKNKBO8~eKLH&ovCIFL9|Qm~zybhN-~$t?bz{Dfdl}x^bbInuRsAAe>%_q zmx0Xxm*fKgs$(&LQh)$}QX&8V@F4&I&_W7W9!>GUmU)CQW1J$(G0jX300ML}WNBQ6b6snNU|CjXx04jh3 z05oC&0I)#dPPqXD08u{}199mE08}3U0CC_KpBg~m4!Ql#|CdC}|Ci+he*miH0~IRd z0~D$U8GuqE008ho00599IDk@M0Dw|LAUcsDKpT;@&;OSo0Dw}o*FmY?|Nj>sAOqDP z0Dw}!17FtQ0~4z4&i|M60{|*u0{}E(0RXTefIE>O1VFh01OQQA7z1(X0svGW0042| z7oQp+1OU0+&i|Jr%>S3=TLS>92N{4;A^-sJK>z@d<^vQes)5RvMneH2e|XCOmtYD&xxWGcYibGrRCc03 z`5*{@(hAQ1m$e1}5hDnI(gFa0QsDyws=#VA_>>|5kzoG+wT90Bm(9!nm*fKgs>4Kp zQh)$}QX&8V@Ie3okU}6jks$yfkwMS@mmmOuQnOP*skK`|sS5xA6d(Wq@Zcxzyn{_A0PwOUe5oQrOW@9z@d!$W{lLLfSkAs`@;@c;i8 zA0PwO!$E*jfB=9}A^-sJK>z@dLLfSkA;1oi63_paAOL_;{d>cxzyn{_<3WH@fE56M zQX&8V@Ie3okU}6jks*K_kqFP1szd=UQaH~4mw(Ium*oQhs^kL{Dk1;?@Ie3okb^>i zQbHg)ks%-+k$?bzQu5CKmxKTR7yWyxsiOjb()|Mfk@HglsZ#*}(DhpasT80Dk@W)r zs$im*Dn$V%fBwn;mx2O-(nJ6NkV60fkc7Y?kz?Q?k)Z;B(%=IWs!q!PmmdTGF+c?X zRI~#Dk%A(C(g6T~Qs4s=s=vzrmjeI*@Z|#+s>G52kz;^7kzyi%(t#p?(%=IWsz1vA zmmdTGG2j6JRAM54QsDy>s^9|^s%6dpmvf>=`J%5tm(N83A%F7C|Cc$-|Ci(g0IDNN zfKq?}fKnm=0PsNo0FXi;I*}pZB9X1m|Cb;DfKu!K{}=QF04n9p|CcPw|Ci+h0IK8z z6e@rKfKnm=0PsNo0FXmSfKoyrI*}m&B9WiY|Cb;DfKuK6{}&j_|Cb*i1J(U|sHyz} z0FnDE0Qp-10DsW;8vyzD0|2UFqeuAw06;k+06_VozX16H0D#iq3jj2=TLP&T0D#iC z=L4w~0Dw|i005A>Cjj}gQvs=30059VBP5Zyg8`9RLnM(j000zpq6Cqn0)Wy20Dw~A z0|Tny0~D&A$^Vx@0f15fD4B;|>^aB7Y9|Qm~00;n7f+B#@0RVtf-~$+{TFU>I-~$yZjLQF)<^vh3=K}yL zMF0ShLjVAfr2rd|B`J%r-`C$V<`9S~y%Hah7wf7r9`THwC`G5U;*r>n*U)CQW1J$!rL8-M{LaDgt zL#etaK=}XwfKu`Q{}*b_|Ch1K|Ci+h0IK8z6e=PB0PsNo0FcANfKoyrI*}n@B$0ps zfKnvR|CiwZ{}*1(|Cgo8|Ciz@dA;2e*_|5;9AOL_;{d>Wv zzyn{_1pogRA0PwO00aQE0-%>pNdZ0v&B_0lqN10QNdY1T!^!`bzoM7ANdaLN(DVZU zs$il=`2hex`Jo>I`2hfc($tqRN&ysqFj9HKe}K{f0Dw}Ua{zg@;{cJM>j06R$^Vx? z005BVe}Gcr0~M+P0)SEgpeT{6&HtBx0su6G20*zY008ho0058!Re(}LAUcsDz$=k} z0Dw}S&HtCRTSBRGqDT3mA42(H0zmm7007D$2LQG6Q$eZydqAoG0}+wH17Fr6A0PwO z-~$z^mCXN_9~=O3K>hzz;sX{c0RVu~-~$z^W677^N&y-r=>Pv0A0PwOA^-sJK>z@d zV^V-pLLfSkA;1oiU;uzpe9ixt-2f`NBN;2Liu0S1k8~}1a{r^-#0f15g0D#iq0~MsAOqDR007V-008iVT7XhQAUcsDzz&gM0Dw{w&HtC*|Nj@{0{|)_007W{ z0Dw{<008g>eSlJ9T!2zSAUcsDfG&{;&HtCR6F~U@eSlJc3IMs%|Nj>sAOqFp0{|)_ z007W{0Dw{<008hM0Dw~CTYyqRAUcsD;4FWU`po~AwG%-3AOL_;fC>P)#Q*;nwG#mO zaLE6cA0PwOKmY)=8TtPgzyn{_A0PwOKmY)=Yx(~dzyn{_A0PwOKmY)=z4`wazyn{_ zA0PwO{d>Ks{R04z^bY{}Gys57U<3fPvkL(EApnBXwG#mO^8)~?AOL{U49NeN^#fc0 zssIE4v;hEuQUJ>Tm!Jm#HRA&nswDsb@FV~L@TFifk%Rynks<&9@Is(6kpUop(sPmk zkrV)cQs4s;W-@IoLuks$yvk+95{+E4)=V&u#Jmn+Htm*oQh zs^kL`Dk1;?&>;W-@FR7AQbHg)ks-h`k$?bzQl8BJm$M5%`Lz>3`P~2i7vuu~Dk1;? z&>;W-@IoLuks+Wlk)v{eQh)$}Qj^U8m*4{xsx$zAQhdmlT2TQee?S5Nw6hBU`SSw+ zs?*E=m*4{vs>#a#m*4{vs&~i#m*4{vsy)j8m*4{vsxQm`m*4{vs#VPYm*4{vs;W-@IoLuks-hik#5ZYmmmOuQvG|vsK5hX)<6OP zwEcU&sRA^BQXznVm+w&l4S!S2|CjUw04iVs_&2o5|CjRv04hKN05#wP6e{ymL8<+F z!l=s2{}&%11J%F-U)CQW1J&dM6RIKr0MPSOL8&1C0FeEA!l*-lfKoyrI*}p32a$jP zfKpA&{}+hM|Ci6m|Ci+h0IK8z6Dk9NfKq?}fKnm=0MH=-0PsQ}IyaFa;4_gz%>S3* z0~9LrQ$eZyd%~!$%l{W2AOqF?d$Xzi0|1fq*8! z0s#5o0~o5t$N!h$20*!?0zmoT10X6tKp^W31prjw0~4zI$N!hJ3qbh*0Dw}IqL*4z z0V+CS$N!h%0{|-E0~4xB$p4og8~}2F1OQYa005BS0~4wtpa+pe%Kw-40|2TZ{QtC} zBLR`%0~4yx$(O!U0U|!8$N!h$0~4y$$N!fg0Dw}n3qbkV|Nj>t%m0^W$p4q*0|2T6 zgn&|j0Dw{=007Vd008hpAUcsDAUKiR%aT!HfAEH& zK=~s80Pv*%8x0FlOcXZR$?|Cb*G05O0708{_~fKvT?!KlCkU)JKv z|CcGq|Ci(g0IGwEfKq?}fKnm=0MH=-0PsQ}I*}n@HIbdm|Cb;DfKvT?!KlCkU)CQW z1J(U|p{e}?0Fm=k0jW~~0I>WoJOKIp0|2UEqDT3(LjsZYTLP)|0|Kh}=L4zs0|P4g z0|BanDuB`f06_Vn_W=0;0D#iJM*#WY0~D%t$Cq|h0VWcs%Kw+Z1pqX2qDT4Q0~jiz z_m{3!0U&?hsK5hX)*m1P)gS;W-@PjFUQbHg)ks%;9k$?bzQaAvBQd!IYm*4;Y7at%4 z)gk}@&>;W-@S`b!QbHg)ks-h~k$?bzQaAvBQcp3<|CiPO{}&%11J$=10QsXM0+Hea z6{_I_8LHp|9I7A4|Cjdz04iV(05u>7K)Iqvmwr|O7Xc%emR12V2=E~wI*|Z?6qnCd z0X2VvDuB`g0Dw~A0|Tny0~D$~#{ZXvqd@uO0~)F$gFKPq0~@M=DuB}90~D&IXn6RI z#{ZWe1OPFh0{~P3B!E)j0~D$Z%m0@k{r@yd%Kw)i2mo=w{Qp!(%Kw*+$N!h*0|2U` zKS2590~D$u008jAE`U-Y02h&f0Dw{g%l}iC+yDO;A^-r;ApijI!zqALLLfSkAz(L= zfB=9}H~@fB`O5#7fB*j%A0PwOpmzYdG0Oj!c*p;jmbA0PwOfFqY8 zSOG3N!z+MNLLfSkAs{%BfB=9}%F6$jw;MqDPyhcHA0PwO-~$}08OHyYfCE6ej{pA` zy6*(3w;KTYJjR!bSOGUeOa*c11OQaG8vyxZDu7Zq1VH)m$^V!00{|)@1^_j-7XbMJ zG=Neeh=5Yy0~M;4%Kw-40{|+34EQ!+0RWHyfIF81Spgwh)ye;t9LN8c`X+wAVqYw%ua?1agw;MqDmvCAE7#?GvfKq?}fKoF6fKnm=0MH=-0PsQ}I*}nDHj!h>m;PA+ z8dig!fKq?}fKoF6fKnm=0MH=-0PsQ}I*}p3Hj!1z|Citc6DqV1K>70%K>7W9L8<>k z0g=E1U)H0afKq?}fKoF6fKnm=0MH=-0PsQ}I*}m&Igv-omu^}CA|n#W|Cjdz04jh6 zK)L?{0Bhg_7Ajx`092^S|Ce9^0FVHHJD0Os0VM`#$^VzH#+Tk&0Uj1(qkvLEAUcs? z0Dw{<008hIpgfTt%9j#b0X|Mf$p4r00{|+(001@M0~RWJ$^VzM*FmYa-$JQ}|Nj?4 z$^Vy$#{ZY*0|2V!0~9JE007V-008jh0~M+xq<~UFAUcsDU_Oz60Dw~a$(Np60Ua-} z^;-g|_5%Q_V4_F)^#cK_L11(_Vk&^rp#uRq0RTYxq0a#M0RVu~pa%hw*u|IXTLB*d zqL&I>0Ww1;$N!ff1ORbh|Nm6C8vyyY0|AlZ0~e};Du7bq0~M;^0~V@6$^V!10{|)k zG=Ngz0~e~o$^Vz20su5%0RWHyfIF9eTmdf-I*}oOKam4KfKq?}fKs!`m%dy9CVwTx z|CjxHzp4EL0Fl4~0JPx)0IEU&0FVIS1d&3(0Fm*<|Ci(g04e|gfKr4205$!4!KlCk zU)CQW1Jz@ufKq?}fKnm=0MJ1I0FXi;I*}pZ0Fji*|Cb;DfKvT?!KlCkU)JNLfKq?} zfKnm=0MH=-0PsQ}I*}p34v~t<{~MPe0Dw~cd%>u{17Fttd%vmu0|1dg0sypM#g~3v z0Ty0EOMp^<0Dw{=007WI0059eAUcsDpaGG0$^Vxi0Dw~cd%>u{17Fr3AOqE7N`O*; z0Dw{=007V-008hpAUcsDzz&gY$^Vxi0Dw~cd%>u{17FsF006WA-~^Gj$CvV50V03# z$p4q%0~4zA3qbk(d%~y#B!SWb0Dw~A0|Tmd#Qzr`AOqFF17Fr3AOqDv006WZ#{U;0 z007V-008jAeSlIzAUcsDzz&gs0Dw|T$^RE0AOqFF0syrAd%vjxkN}bW0|1c%1VFg} z-~^G*$p4q*0{|)j0Dw|t001@pd%+*5zyn{_gQ$Q~fB=9}A^-reApijILLfSkAz%WL zHp!Q=UI8is6UCR_UI89PLluBhfB=9}A^-reApijILLfSkA;1HX9m)TfAOL_;vkO4^ z{d>Zwzyn{_Lll5gfB=9}A^-reApijILLfSkAs_>h63LfBUjZW-B!SYk69D=10|2T5 z0Dw|88~_sG0|Tlf#Fu_w0TzE9#Q&Eg0058z008h~U=NW(01}Y_Ab`@~0~D&J#{ZY# z0~4x*#s8OJ0RT1N0~4w>$N!hW1OPSQ0~4y!#s8OJ0{}I%Q$eY<6F~X>d&8)}17Fr6 z006Kd008hpAUcsDzyy(_dVo@Z0Dw~B$p4oh0Dw}p6F~X1Q$eZyd&7UIzyn{_qj`W* zfB=9}A^-reApii-LLfSkA;1oi*2w>tAOL_;{d>cxzyn{_-~$t?nZ^H?A^-reApijI zgM5HeLLfSkApi!E=>Pv0-~$t?k;VU)A^-reApijIgL{BdLLfSkAz%fO;Q#*@{d>Hr zimS6!c2JOWEmvf?*%3uL4I`E^ZfKoyrI*}m&2$7-4 z|Cb;DfKu=O{}+G&fKnm=0I(qd0PusUfKoyrI*}nj2a%Y_|Cb;DfKuj{!D;~$6+@|j zQbHg)ks+W4k&ej!mmmOuQrwp@VF42+W2t~rLLfSkA;1oigvkGwAOL_;(*OS#{lov4 zfB*or03ZsH&c>ILVF4ozAPSLTate_G2tc|1$Ctuk0U|{suYgj30Dw{=006Kd008hp zAUcsDzzC6J$p4oh0Dw}n3qbk(d%~!|17Fqyt$4Jv0Qm#}fYSFH0Qt8A z0g>PX7pgYI|CjRy0JLEWK)Is=fYM+ZK)C_{fKs?00Qq<#3X!#20;zSv4v{th0Pxo0 z36TK{0J-4<1F8TM0J-1;6{=Rl|Citc6{;fu0Dti00~V@dAPSL!0)Wz?0)Wz|!~d7{ z0{|)?1OPDr1priJk^qq<007V<007YD0~V^K02`5GpfZtSB7o9?B7oB10~e~A!~d7_ z0{|)?1OPE$1priHB7joi0~e~`0~o5m#{ZW91^_j+TSBS0A3*t(qDT3nuR!^M0zmme z0GB#r0V026uz*rRAUcsDAU2T*$p4oh0Dw~O|Nj>sAOqDv$N!gy#Q&G&0|2Tb006Kd z008jh0~IPlAUcsDKnjtgw18580Dw~Z$N!fg0Dw}sA3*uFTSBSd|Nj>sAOqDf$N!gi z#Q&G&0|2Tb006Kd008jh0~0DEwSZDWAUcsDKno+0@c;i8Nt{R04zzytua10;dcvkL(E;R6Gz z^8)~?0sw$g^1}a@BLD!90ssK;V_*-FLI4tx0U&_VV3Gild&U2k-~$t?S;YUBKmhBe{T5LLfSkA%G8&TF3vFAOL_;+yDO; z)58CkfCB)u0gRV6W&tjLnZ^H?U;;onlm-A1wL%4vVU9%kp8^1DEC2sgwAVqYfdBxs z-~$1wE5rYne~twC^9w-v{d>cxzyn{_zyn{_A0PwOzyScX0RTWbAprn10gOcX0sw$g zKYRcwLIeO2AwUI@0{}ode*gk&Z2$jM004kezyn{_A0PwO{d>PxsUy9BQh)$}QX&8V zu>Au7kwPFkks$y8&>Au7kwPFkks$y8&>_GMkrc<5vS$G!0Va{_^Tz*| zGXQ{6fR04@U;_ZO+rs~spN<6iv=2b}3jhEVA0PwOA^-reApijIH*HQ)miDzpzk`SS}v`Tcvs zsK5hX)?>whQh)$}QZoR6QX&8Vups~d&_WQbxo7m*fKgs$<50Qh)$}QX&8VumJ!7&_Wml|mS8h>lV z|Ca;EfKnm=0I(qd0PsQ}I*}oO5|MxafKoF6fKsc*|Ch86K>5i3{}57?{}=sxys7;I0Fm4H}0Qm#}fS0pr0V*ksMEO7m0JH-tfKoyLK)InC0QsS#0Fi(I zqno6o06C&B0J*%v|Ce*3mj-G9Ef(;j%79WrAUcsD02PsN#{ZWf0Dw~OmoZ@h6BXmh zfKoyrI*}p34v}WY|Cb;DfKug`!D;~$6$8qEQbHg)ks;s{kzB_AmmmOuQrnloY5@}t zBg%kMLLfSkA%GN-QpT6MY5^J|L(70tLLfSkAs`l!NXGw{AOL_;$N&Eq!NLERKmY)= zlf;+yY5^t!#l@E%YXKgAW6pq5fB=9}A^-reApijILLfSkA>bB~E5`qqAOL_;vkO4^ z{d>Zwzyn{_!_9zFfB=9}A^-reApijILLfSkAs_>hAjbcfAOL_;{d>Zwzyn{_{d=mZ zBLD!w^;-g|0USWN_5%Q__hSQ>yK4aoe*zeh0t`U8 z0RVu~p#p%?fT9GEdcpsf9|Qm~ z00;n7xB~%^f+B#@0RVtf-~$+{>%sq*<^vU~B>(`>BLD!<=K~iir2rd|#F7A!V?ZU5 zVj_Ujfg*s?-~$+{XuPX7phjl|Chf@0J#DxfYJc~fKuQC7^+dh z|Ca+Kfzkp1fKuTD1FGNy7pk;R0J*j+0Qq{r|Ca+QfYRXu1F8Z5fKuQC7^-!^|Citc z7pmjI|Cay;05#$R6{_I_7^>g{7pjK9|Cb;L05u{2fKnQvBLR`%0~o5Jg9bT-!T*=^ z0{|-E0~o3a!k6xD0U9O))PPb#AUcsDU>}iy0Dw|D#s8PJ6F~Vi0Dw|+qDT4Q0~9Kv zXO}K-0UUoTk-!6A*5m^eDk1;?kRbp7(4*6UQbHg)ks-hxk$?bzQZxX7QY6Lym+b%l z7a{-vkRbp7&_W`L|<3sp0?s7at%4)gk}@ zkRbp7(8JS!QbHg)ks+WSk$?bzQZxX7QV+%dm$iQrK>61H{}&4As0Qms`fYLJv0JOIo0Qq;~1d+8{0;vQjpi-j(fYLw#fKucV0J-4<1FB#`0l5MI zfKq>do&foEf(en}0~M+^007Vm!2g%lA|R3U!T*=#0{|)`007Y70~M;|0~V@dKp>HV z0)Wz?0)Wz3!2g%^0{|)?1OPGM1prjF0|AkOB7o8X0Dw~90~M;s!2g$Ik^qq<006Kf z006M&0~V^K02`5GpfZtSB7o9?B7oB10~LR&M!^4<^8)}X9|Qm~palR_Vj_T2;R6+_ z-~$(`Ys3GSz{Dfd&Az^HV{o z{d?A^zyn{_A0PwOfB=9}A^-r8Apiid7W9!l=LlU)CQW1JxtkfKq>e0Dw{= z00597007WJAUcsDzyy(M#Q&GG3qbiG0Dw~cd%~!|17Fr3AOqE-+kjGl0Dw{=00597 z006K;AUcsDzz&gK#Q&Ed0Dw~cd%~!|17FtQ0~4w(!~d7#+<;Pm0Dw{=00597007WJ zAUcsDUZwzyn{_A0PwOLjeGgV*o(;zQdOSa{;z6VQg<_ zMr?I+XaE2J00000C389@WI7;oWpp5PXmVv?WM6J!ZDlB7Y;R{qY;|*Jm(hCx7ng5& z0SF*eXmVv?WGG>5Z)Zkqb#rJbAaQkRbSxlnX=FVmWG)J~w{rnu20}qoLq$$RUsFs^ zM_*7R8L=1R76izQ~&?~001!n00000002Q#Lq$$RUq?(&LP1PlMOH;lR9{6- zK|)MLmr8m88z4bbLq$$RUq?(&LP1PlMOH;lR9{6-K|)MLC?#YmE(({OdI23RWp-t5 zbRcYHc4cfJC?#YmE(!nu002Q#Lq$$RUq?(&LP1PlOixE&Ohr~jOqWl30Tu^AQ$s~g zL|>O>dI39^pLzlDxA=SkSOK??djW6(7II}_bY&oPVRLIBMr?I+XhCprOmAnGA$|cG zm!Ek72)BTK0p|f2OmAl(Xkl|8Vr5}&AZc!CbY)~N3IG5Aw_kt(F9RbWVRUqIEFf@c zWIZKyEFg4waAiFuWGoz{j)MWh4wsOU0e~zeb2=qtIv`1I zX>=fCZ*FEFVQyp~b7gF1AZ%}EAaG%HXdrWSV`F7=b1n+EM3VtS4jE2wbRc14V`X!5 zAa`$aYjbd6V`U(4VRUG>sG$MZ0wZ^FX>?^EXm4|LAZ%}EEFf}abUh_?EFf=YW^-k9 zJtcK63YYSv0WOz_#sLnO9;pE%5o2~BY;R{EVs&O9VtF8FWMh}X#sLmu{v3IhTjV0T`EXy8#H7pQHf|mlUr7BbTS7 z0azhsY;|*JAZTxMbRcYRXDlFcWpq6ybu1unW@d9`bUh_?moU!(6qgLA0V|i+rU5XQ z*QNm#6=rO8b7&xAVQg$-VPk6`W?^Y;Wn`BD!T}SPJf{IGm+z+mNgqK|Lq$$RUrbL& zUqnS#Nkc_nMod*xNMBS*O+`;tRF_YB0TzEjQ$s~gL|;r#M_)umR!KueUq(z-Q%GM_ zNlishRa7V?WGOBR00000001R(IwfQ}AZ2cLAVE_@MNULtOixE&L`7CfLq%UkOjT1z zUsOp=MNd^!C?#YmAZc!PVQgt+E(!nu00000001R(IwfQ}AaiAOAY^4`VRdYDAY>b5 zc4=c}AZ%}EAZBcJb7&xRX>Db1b#y2tWGR=IrU5{gAEf~Ymu{y4A(ywO0XRQIY;R{E zX>MtBX<=+>dSxJHX>MtAXk}y|W^ZyJaB^>BWpi^b3IG5AC389@WI7;3Y;R{EX>MtB zX<=+>dS#a%r~w(5Z>9klm(QpHFPEOI0T7p%uK^gBPNe~1m-navl>v2^ji~{1mpG^a z9G6_E0YgSaY;R{EW@&C=Y-xIBAZBT9X>(|0WG)H-C389@WI7;BZ)ZVgWo~p=a%psB zP;zf$OmAl(a%FTqC3P$yZ)Rq5Wpq6yb(fW>0VB4m0S^V2H?IL%7IbNCWp8zKEFg4g zZDntDbUh_xE(!pbey;&Cm(Z^PP?w0O0TelGX<~9=a(N(TVQFk-WG)H-0000bb2=qt zIv{LsVPqh3b#8QNZDk;AX<~9=a(N(gbz@^?Wn?Z2m#wb>BbSJ$0Th31X<~9=a(N(T zb#7yHX>V>IW?^Y;Wn?Z20000bb2=qtIv{LsVPqh3b#8QNZDk;AX<~9=a(N(Tb#7yH zX>V>Ib9G~5Wo2Y83IG5lb2=qtIv`_gZ*yfJa&>NWX>Da7Y-wV0VRCsOXkl(-Y-J#3 zVQFk-WG)H-0000bb2=&|WI7;YY;SXAAaZqXbZKp6AZ%%3a$$0LAZTH3WNc+1b9G~5 zWo2Y83YQ(Q0d{|EX<~9=a(N(TVQFk-WG)H-00000C389@WI7;hZ((F0WO8YCWpW^F zX<~9=a(N(gbz@^?Wn?Z200000C389@WI7;hZ((F0WO8YCWpW^FX<~9=a(N(Tb#7yH zX>V>IW?^Y;Wn?Z200000C389@WI7;hZ((F0WO8YCWpYO#Y-wV0VRCsOW_503bZKvH zAaiwNV`XJzE(!nu03~xeC1g4vV{C78Wguj7X?A6DAZ%%3a$$0LAZTH3WNc+1W?^Y; zWn`D}d;t_6WO8YCWpW^FX<~9=a(N(VVQyq>Wgv5PV`F7yWG)J~#IOM{0tjYdX>4U= zE(*7C9s*nix3IVY2LUEkb7df8WoBV@Y;+)GWp-&}Wgu-~cpzqJY-J#GX?kTnC3P+e z0GH*t0pbc(b7df8WoBV@Y?pDw0Tl^zX?kTnC3P+em#4%5*_W`n0S6;hb7df8WoBV@ zY;+)PVR#^6aBv`IX>4U6Zgp)vC1frN005VI#R1g{RdZz^WMyVyb!?YW#sL!rJtcK6 z3YWow0T#Cpy8%E53RQDuAY^4`VRdYmQNsZk20bNYE(!pbf5QRr3RQDuAY^4`VRdYm zal`=|20bNYE(!pbdd2}>7GZN^Wo~3IY;R`(0000003~xJb0u?^?#2PEx1z@Z?FP5s z&H>8<1T7_GUzeuR0k(e>3IG5>0RR9Sv43IG6bu>Svi3IG6ju>Sv$3IG7uu>SwJ3IG5&vHt($3IG5= zvHt(~3IG6Lvi|=p3jhFcvi|=-3jhG9vi|>63jhGXvi|>Q3jlur(6avjdf z2)zFPqzwQ7=)L~`@C^U}D8Byx6b=9Y(7yivOb!45h`;{-d=3Bru)qHQkPZL<_`m-D zxDEgSkih=`2oHY%0NBC)|5OhE0C>ax|AY?!0FcA}|ELcD04T)%|Ktw<05HV<|M(98 z0Eor@|6C9N0AR=d|GW?Y0D#B-|IiQs0MN<)|1c2%0NBa?|3nc00D#K=|8x-m0Km%r z|C|v309ere|5OqH0HDzR|7a2b08r8X|JV`$0I1Ra{|tW<003~;{{M6n006+({{N^G z006Mq{{Qe3005xb{{J`>005BM{{Mg!004m7{{P4n003~@{{Ija003~^{{LhZ008LT z{{Pq&008jb{{QS1003~`{{JKv008*k{{LJS008*l{{M^?003y={{O%h005xj{{Q3_ z004O6{{Md<7XSc&;{N|M7XSc=;{N|g7XSc|;{N|!7XSdz;{N}D7XSd*;{N}X7XSd* zHhyv z82|vd>i++n82|uq>;C`982|u)>;C`T82|u?>;8ZL@EHIA*z5lP7#aWoNbLUqKpFr5 zK<@tk;2Hn`c<}!Jgc|?=Sn>YN~b@bmuvU>pDd2=xB{bQ}NxAoTwKh#UX_SoQw@ z>>L090QUa>5FG#j5cdB6Bpm<%u=oD|bR7TyNcsN%_#FTM(E0xV3?2XgSp5F~gdP9@ zi2r~7{|Fxd04M002M`|NpEc005X0|Nqn^004h* z6aW7(B>(`Z6#xHtB>(`J761RRB>(_07XSa;B>(`>7XSYUCIA3X7yth_CIA5F7ytiw zCIA2s8UO#dCIA4C8UO$6CIA3%8~^`kCjbDT9smFACjbEW9smCnC;$ME9{>MDC;$MU z9{>MXC;$Mk9{>MrC;$M!9{>MKq&wJbSnS=Kq>$K#47**NGbpS*eibk08lCa z|LiLO0B|Y){{Soi0H`Vd|0FB`0Jtgt|2QlF0Kh5#|4b|Z0LUr-|6nWt0MIG_|8y(> z0N5%2|A;IA03a&=|Ew$k0B9=z|IjP|0FWyG|MV;X0LUu;{}?R*001lh|2!=K04OW} z|6nZu08lIc|AZ|709Y&k|CoO*0059H|Np!#005vX|Nqb}006iv|NrDI0077<|Nr0?|Hw7~0Qf}z|M)fl0FXuh|2Q`Q02oI9|7%P0C-dX|6Do%0H9O<|8P10 z0C-gY|EM|u0N{UA|NqcB001CW|Nrzl003ZB|Nj^}005v>|NlHY007`s|Nme+001CX z|Nn$L003ZC|Np2v005v?|NqQ8007`t|Nrni001CY|Nj&`003ZD|Nl5V005v@|NmS( z007`u|NnqI001CZ|No>s003ZE|NqE5005v^|Nrbf004jBSpWYJJpce8S^xhuJpce; zS^xi7JpcgUS^xixJpcd*TL1sBJpcf(TL1s_JpceOTmSzsJ^%o4TmS!9J^%p7T>t-& zJ^%n9UjP5dJ^%oCU;qCAKL7yGVE_L-KL7wIVgLVNKL7v#WB>oCKL7woX8-@3KmY(x zX#f8xK>&XMKxzN~TtNT;plbjBj6nbZxNQIb5JCU|2yXxXWI_M{XmJ1k@In9pz;XZo zC_?}M5On|lz(W84V08cgN)03eC~ z|EPaS001b8|NqcQ002OW|NrDk007vE|NkUP006*@|NnqW008if|NqoV007XA|Ns0- z002mj|NksY006L$|Nl@+008KZ|NnGL006j=|NrPq000=1|Njt7001bH|NkUR006j? z|Nmr6005Ac|No#&001bK|Nq=f001DE|NkObO#lE8n*aZ>O#lEWn*aaAO#lEen*aaU zO#lG+n*aYWPM6Bu0U|1drT+gc000000000G0000i0001>rT+gs000000000a0000$ z0002YrI!}n0VWpgrT+f}000000000a0001d0002srI%9O0VV<%rk8r%0V;n?rvCp3 z000000000m0002w0000$rvCpR0RR91K@L!z3Z4l=4IM$129^avlL(XtaSGnu)z;J0 z3?BeO3jhER0000O0RR9jr~dy8000000000G0000i0RR9fr~dym000000000G0000$ z0RR9@r~dyG000000000G00372Q~>}0P^bR?3;+NC000005C8xGXaN8KOsD?;3;+NC z000005C8xGd;tIeNT>e)Gynhq000005C8xGkO2SyY^VPJ3;+NC00000kN^MxqyYc` zXs4Gl-T{sYI066wl&JpyK$i{r0U4L#-T@kaGynhqcme`3&1e61R zl>(gxo&{Rn-qq983?Bdh0E7Sl00;vB0OYLx|NH>}002P_umM4x5S|Y~3>|<0LYxIc zm|<0lMa*( zl?;{(mkO8(nFyK(n+BW(oe-W6Y17ms)z;V8+1lGelMa*(l?;{(mkO8(nFyK(n+8Y# z0058!003OBmlEIsMh4si008i>mtNoj8bUMx00004000cI{{N@|0000%4j`Qbo&!S- z9Yd1>Mbkmv-3%W9OAH+#lLDOto&!hILf+jB9{?->001}y004ZjmxAB{DjH}6000EB z{{JKZ00000001Na004Xh000=Vm&V`$A_k-c0020#m+s&JN(S@<004lompnm!RPR5DFjw003|W008W>mmcu}8VWc7005K)007{#mp0-7HXYCf z002C+{{I9300000003YB0086#001zw{{L8)iQ)lL4^Pz7003M7002k^001Plm+ImH zR(}ux005{4005k}{{I{R00000003M7006uO005}A{{Kt@0000%4xkA`os_ey z1fByy-rWoz07ncRAd>=}1fBy$(?Q_eo0-Xe&14q+B-rWoz05kvq01ylS07S|D|A+tp002P_ zAe{uB149iRLz4nU(?Q_eo0-Xe&15DFF-rWoze*i21002k~005N9{{H|0 z0000%4iKFJo&iA(9a0M3-3%W9LJL(2-rWoz06_}?001xm004Ll003ml{{L(M0000% z4j`Qbo&!M*9YK=%a=Ci0cv6Z z0000e0000?4gdh?%>Mt(00000K@LEj2%ZN)4IM#~29yP53f|q*)C?a0K??v70001Z z4gdg*&Hn!s000000000G0001t4gdg<&Hn!s00000000130001>4gdg@&6n=!0agb5 z4gdg{&X-E+0Xhae4*&pI(3gtp0Y(Xk4*&oZ(f<4*&q5(f$);-rd#H)C?a0LJLUV-PP073?BeI z0000i6#xL>;FpH*0Xhb36#xK`;g`nn0UkP#6#xJ{;{N|w00000K@Jd|0-gav4IM)Y z-rWoz0745x3f|oe9{@)SLEhaA9{>O(0002Q6#xKW;+G!r0U8bf000170002&6#xKG z;+I140a`*#761S!0VW1q7XSdj6c>k0XBay0000?82|u4>i+*&00000K@K3D1fByy4IM#~0+azw z3f|q*)C?a0LJLFQ-P6Ol0001h82|ue>i+*I000000000G0001#82|uy>i+*E z000000000G0001}82|u`>i+*I000000000G0002I82|vF>i+)>004gg000005C8xG z&=~*#oa+An6aWAK000005C8xGp9cxa$7@C;$Ke000005C8xGAQ}Jw%}8{@0Tj~0VWB^8vp=I@c#dtmy!Je6PIlF0Sr1U0002=8vp>n@c#dN00000LJlCE z1fByy4IM#~0!Iqo-O~&o06_~*-rds-9{>P60000a8~^|i@t4B)0Xhd{8~^}l@&1C0000001yBG07M=D06_Ns{|o>C00000 z01yBG09YOX06g~o{|o>C000000C)fZ0Bjxr066ykmkasP&`u_iXm#yRh9%NG9-P6Ol0002U9{>Qv z`u_h2000000000K0002o9{>Qj`u_g}00000000000000W0002=9{>QT`u_hg00000 zLJkm}0-gav4IM<@-3%W90000W0000OAOHZg`u>+6{Q()5@caP;2RtAE0J!@8mmmEB z8JF<<0R#tNAOHZo`u>+6{Q(^tgdhL_!216G2mk;800000Gynhqm>>WEwEF&+SN#Do z2hbn@0Hpi=myi7cH3tkK000pD{+G-B0Zj*BApiix{Qj38{sBotups~dbp8JS1ONa4 z000005C8xG#329xX#M{G1ONa4000005C8xG*dYJ_T>bw4AOHXW00000AOHXW>>&UE zX#M_|tNsBUe-I)70DS%a{|o>C0000001yBG03;#+0C@fW{{#R40000001yBG05~E5 z0BrsK{{#R40000001yBG08AnP0AT(8{{#R40000001yBG0AL~j095_{{{#R400000 z03ZMW0CXY%07(7*|40A;002l15S;>^0YVKOMBd#D7asrs001BW005XG003PpfpZ@_J2LvMk0I2=`m!JOu z9S0~Q006xG{+A#90U4L@`~d_9Od|jQ!2SN0AN>Ix8*n240L1LzUYC6)!j>000#J{{I*N z00000000mG002xR000>N{{I*N00000001BW003Yl0012R{+AyC0v!j0Bme+7{{ELA z{Q(^ts3ZUYJpTUw5C8xG00000AOHXWyd(esIR5^ZdjSF+2jC^0YVKOMBd#D9{>OV03ZMW z0H`GZ0CfKTmuCV39Yf3|005Bw{{IL700000000mG007`6004yk{{IL700000000mG z008tQ004OY{{I9300000001BW000Ok003It3n%~p0Ei|40CfKTmq!BvB@VPE00030 z{{Jul0000&m(BtL7Bko;000dC{{I9300000000yK008VJ00030{{IjF0000000000 z001xm000Ch008*@{+E;c0WAkOCjbCU|NfW9`vEBjXeR&wbpQUB_xk}&2D~Q#04M;L zO8fyf2KXlc0Gt4qhWr5{e_Q|n03;{?0Qdm^|1bdn002Y|K%EGl2SE)TL6ilR1Vxhu zLY4zj)`p|29yPr1eODx2%ZN+mjYJTMAJdmLX!rT1D66p*VaPQ zK@1-N)YaYI0E_?t0E8$20LTIV|KtJy002P_zyX~Yo)000nr{{N@}0000%4ltbto&`Y-9YK=> zlmkMQ0%{80-PP073?BeN3jja>008_c001Bc|NrO!0000%4j`Qbo&!S-9YK@|---rd#H)C?a0LJMD(15DOK3YG&%3qcB&14s)(3YG&% z3qh6x000130001tDgXcw2><`|0RR91K@NZcoe-W6K@A;2m46JD3qq3)lnqFi3PhR* zRSMqS+Sk?A)6@(f0745vnFyE(TG`k^m z-PP99)C?a0K??u?JOBUylq&!Ls0;u96afGL06`8wod})>K@A;2lLnLpRSMqS)6@(f z0745vl>|lALX`wh3e`aiN7YM}1ONa4Gynhq)GGi0Sa$yZ)Bpeg06`8god%u-Lk%54 zlLV9lLX`rR0bvT>-PP7V)6@(f06_}?0000001yBG01PYu07wk~{{#R40000001yBG z03a*?06Yx;{{#R40000006YKy05mKB05A-fW(EQ}26QX{0N@OlrUn8!2DB^y05}bo z<^}>P2IMRN0Qe1;76$@41|%&208kE>RtEwu23Rcs0Hh9=iU$HF281mD0Dupdwg&<_ z3B)Y`0KgFc|Hzk-{Q(n2R|?+U)6@(f0744@C;$Ke@GSrUToM2OqyPW_06`8god%u- zLJb{3lLV9lRtnzT)6@(f0744@v;Y7A94-I=*b)E#xR+4~0v`lNlnYpwbO-`13!M(0 z4Mds+n*^K#m#YW@P!03|007i3007t&|Nlgn2?+ul9GnYHloOK_M4Anm4ndm?0#4gO z)YC!Q*-F?!+?PNJ0wyL_)7078+e(uZloOc_nhl!_MGDl@LE70t+d&IT)7078+ez3# z+?R|A0zwm<3rh;vLEJ$LN($IP+(8RY*xZ-l2?7&;Pyhe`%r5`{C>a0$0096106`8g zod%u-K@A;2lLV9lM+)BE)6@(f0745vl>$eW0an)4Lf+le)C?a0K@1%*lLV9ll>(gx zo&`zOL6riQ0Z7)>Bme*aATR&`)ENK&WB>pF06`8Qodli(LJb{4lLC|hQ{LUv)C?a0 z5C8yw07x(Z02CSj|0Dna0000005kvq09-Ht04N#%|JVQk002P_Ae{uB149iRL6iYS zlLA)LL*Cug3?BeN3>_eo0+a!r1fBy((Z5FM8~ z4gwq;NtJ{FVhY{f)zj1r9{@oM001-q004Y6001x^mpTpt93M%QgaKj--QLyH)C?a0 zK??u?Gynhqv@`$!P#^#QRF^#t0vQ}hm4pFe3fA(xg80zw9qH2?rmBbVL|0v8`lmJdUi4VMl~l@LOj z3rW`1LfF?q+DG2q)6@(f06~`&4+6Lbh&BKKq$QWq4+4e;6gL0>ASahz5CSd+NH+ig z+$Wck5CSGafB*mhcsBq53@QKr6aoMM06`95oeZ7}LJb{3mj*(V2}zR*LYf0cmIsvx zN0|he1#b%3*g*?H+1N(b)j`ui+Lr+l0vdms1Dy<>3qje~LDSXN+DwxQngdSLLE1u= z2bBmxnFN>xL6ZtWngaj;Pyhe`{5Jpqpeq0WOaTA@074Ehod%u-K@A;2lLSTz-rds- z9{@rNL6riO16|eBLJS`O)7{=e3>`3&1e61n0-Xk)1zZZ%)ItkE3f0s>3q#e^hyVxx z08lsp0GunAnh^qq2HZFR0B|jrCK3WJ4U_-?02Da@0FW;K|4^4<5&{!{mnuk>E0rul znJAbkLz*W+lr57k0!7r*Le|wm+1NqaNZ#Gs*9;#3LJS>%1CuV4EtM>mE0-#mDVZpm zCz~dnFrF_#)YC!M)j`?VLE1u-E|e{mES4*nDVZpmCu7sp)z;YA+Ch{plP*D)E0ruk znJAbkL7FE3AOHXWtT_M%07x+Z|4f&W3IZ1jEC2ui&^Z7AbTF4z69Ot706G8w%rO7| zGynhq00000XaE2J6gmI^@G$@Xl$V_o0w4iemj)FAA(!710wEoMIsgD1GXMV!00000 z000130001#IsgC|GXMXSmmL%W9RXUGs}uqrmsu177e(+o002}o|NjgC00000000mG z000C#002-k|NjgC00000000mG000;}002xg|NjgC00000003M7001mI002lc|NnHC zO%(zc0bZA76#_pSj5`1TU^M^#cmMzZ06`8Qodli(K@A;3lLAhczZC)*2EaQ20HidR z-W38u1_(R=02DQsCKdu(253A00K7Jrh86-Qf0R4`02nv_|6~II002P_@B^Jbo;^Vg z9YK>klsiJ4Geng-mN`S1H<>nG3f|q^*xA+A)6@(f07464mpECQG@3PX*V@}kmpGa= zn>0<^+Dr=9Lkm(0*Fp!nl(X}IM4t90Q@`v02n&|{}clN002P_P(hsto(Dk; zmn# zCIw!P6oh0000z2m);rz zA_nL{007KGmj)XGCK4b3000<4000z3|Nm$J0000_m);5j76v>)003A-mxdbx9tL1R z003-6m#P~AZU)pr0078EmmVAfA{zWb0000-|NjgC00000002Ay000m|008_(ms%VG zItfrh002x!|NqpNF&Y9Cm$4iI9|?>?008Jn|NoemZ5RR z0000%4$u`to!SDP*#bcg9YK@W0+iPRLYCD6NR`$CMVQk9m(&7i*w;bTLY3A6NYzUU z-QL#I)C?a0K?_Qi)&iH*0+`bRN!3Bv*Fu%n0!h_DmDU26)B>2(0!G!>*g=@n0+-YR zL6z15002|~002Zo00scSO8@`xmysO;6c&QD000006aWAK000002LJ#700000 z7XSbN00000C}02p000002LJ#70000I0Ju~D0000000;m8000000C1Nv^a4LII8*=t z00000|NsAQ000001ONa400000@c;jB00000$WQr~v=~ z0000o000050001}r~v=~0000p0000500026r~v=~0000q000050002Er~v=~0000r z000050002Mr~v=~0000se*gdg1poj5$fyAT00000Hvj+t1poj5(5L|b00000H~;_u z1poj5;HUur00000IRF3v1poj5=%@hz00000IsgCw1poj5@TdU*00000I{*Lx1poj5 z_^1H@00000JOBUy1poj50000000000|NsC0|NsC00LK9U00000e*gdg0000002s#s z00000000000000005Hb^00000000000000007%CH0000000000000000AR-f00000 z00000000000C>j%0000000000000000FcK40000000000000000I0_S0000000000 z000000Jz5i00000e*gdg000000079x0RR910000000000007v>0RR910000000000 z008jE0RR910000000000000Qc0RR910000000000001b+0RR910000000000002P9 z0RR910000000000003CX0RR910000000000003~v0RR913;+NC000000001h$d@7p z12zn3m;e9(0001dm;eBmKn4RC48VT?000000L*^?0GB`p0~id`%<00000000000000000000000933IO1L00000000000000000000000933jh$6 z00000000000000000000000933;@i70RR91000000000000000000934FKSS0RR91 z0000000000YXATM0000301g1i=m7u#0000000000000000000301p7*@&Nz<00000 z00000000000000301yD!@dE$=0000000000000000000301*K2@dE$=0000000000 z000000000301^NIm%#`F6$29haF_82178vNF9ZMp000000000000001mvIXNAW4`2 z000000000000000073u&00ICD0BD#10000002BZK0000006zc#000090Kk6$00000 z000000000006zc#0000C0L+7z$_WE5Da?NW00000000000000006zc#0000C0Mvs4 z0000000000000000F9Sn2?HO002~1T000000000000000n*aa+0sspD7$5-v00000 zECK)k00000KL7v#000XBz?J|2000000000000000ssI20000mG={000316#%d;1ONa4 z000O800000000O9000316#%#`1ONa40000100000006200000j01W^rwgCVD00000 z00000000200000001p5F8v+0T00000000000000J0hjs>10GR8nE(I)0000000000 z0000#0000001E)h($0000000000000200000001yD+@dE$=00000000000000S z0RR9301E(cx&QzG0002Qm*EQo9|1|10Sp5d8C3xQ0096L01N;G0000000aO400000 z0Be^q30RR9202Kf@1_S^A0000m000000001^0RR9202Kge1_S^A z00008000000002Im%$7J7k|$I000316##Sw1ONa4000C400000007?s000316##e! z1ONa4000C400000008s>000316##$+1ONa4000mG0000000033000316#$S11ONa4 z004jh00000000vL000316#x(i1ONa4000C400000001Zg0003160ssI302KgO2Lu2B0000400000 z000100ssI302KgW2Lu2B00008000000001Km$3~47g2r!000316##4p1ONa4000C4 z00000005E#000316##Gt1ONa4000C400000005@~000316##Sx1ONa4000C400000 z00620000004FKSmfe!;05m@s90000000000000000K1p@4FexCfS3RP0000000000 z00000#sUBU0sspDfS3RP000000000000000$N~TW0sspDu$Y%h4g)3`+X4Up0sspD z@R$Gq000000000000000@t27X10R3z@dE$=0000000000000000{{R401*K2@dE$= z00000000000000d0{{R501E&(nE(I)0000000000000200000001yD!@dE$=00000 z000000000p0{{R401yD!@dE$=0000000000000200000001p84@&Nz<005UK4+9|q zQkM}C10O*c&Hw-a0000000000000200000001W^jmH_|&00000000000002000000 z01p5t0RjL300000000000001Bmk|*IAAfk#00000000000000000620000004FCw3 z0RR91000000000000620000006##$-1ONa400000000000040V000316##$-1ONa4 z001xm00000004ah000316#%dY1ONa4000C40000000620000004FCw70RR9103rYY z00000000200000001p5d0s;U400000000000001tmk|*I9~vO*000000000000000 z00620000004FEW$m!c2@E|&-r0~si#0RR91000000000000620000004*0RR91000000000000620000004*)nL0ssI20000000000 z004*tm--C@9zrNW0RR91000000000000620000004FHhH0RR91000000000000620 z000004*(!00ssI20000000000005T+m--C@9)I{l0RR910000000000005-~00062 z3jjDo0RR91003A400000006)Q000623jmNs0RR91003A400000007+t000623jpXw z0RR91002}000000008;~000623jjb!0RR91003A400000000;T000623ji=#0RR91 z0Dk~f0RR910000$1poj701E(!S^)q60000`0ssI20001G1poj701E(6Zvg-R0000K z000000001v1poj701E(sd;tIe0002g0RR91000200000001W^b$pHWW0000000000 z000200000002Kh>E(8Do00000000000Dk}gtOWo70RR;M;4TCJ000001ONa400000 zy#)XO0RR;M@7e0RR;M=q>~R000001ONa400000+ywvt z0RR;M>@EZV000001ONa400000?F9e;0RR;M@Gb-Z000001ONa400000ssI2004x9v z0C3I$0000000000000000IC200000F0Qe>X0000000000000000RERz76Tsvz?Xp! z0~ZnaHUa00000000000000008<740096LN&qkh1ONa4 z0000000000003bI000623jn}_0RR91000aC00000003VG000623jn}_0RR91000aC z00000003|X00031@&6E)!50G;Dd2wq0000000000000000EPwt01^NT01y%Z00000 z00aO4000000FsxH7y}mpr$$3>RTl2mk;Q01E&})Bpeg00004000000001E2mk;Q z01E&Z5&-}J0000W000000001P2mk;Q01E(UKmh;%0000$000000001l2mk;Q01E(c z{Qv*}0002+000000001#lfeuZF{KCq01^NT04NRt0000000;m8000000JjJL01^NT z0D$)Z0000004M+e000000LhcV3>N|1lfeuZN#zIt01^NT0BAk|0000006+i$00000 z0Q(3401^NT0FV*^0000000aO40000000jvE01^NT0N^eG0000000;p90000002Pyw z3>N_|laUM;VL=H101^NT06@zC0000000aO40000008$A601^NT0Pvpx000000DJ)e z000000A~pR01^NT09bwj000000GI#(000000DTDn01^NT09auG000000CWKW00000 z0FaZB3>Pt@2><{R01E(E%K!iX0000y00000000292><{R01E(k>;M1&0000a00000 z0002RlaUM;f9weW01^NT0C1ZC0000002BZK00000009aB01^NT0BA7*000000LTCU z0000002B%U01*Hc0C*S#0000000;p90000003iwh01^NT00>e6000000AK+C00000 z06Pi*01^NT0KgUj0000006+i$0000007?n~01^NT5&-x^0RR91002M$00000002~% z(H#R90dtqp9Rn8ue3#K30~ddf3IG5S01E&(1OWg50000m0ssI20001{3IG5S01E&Z z&Hw-a0002Y00000000253IG5S01E(!5&-}J00004000000002F3IG5S01E)n7y$qP z0000G000000002U3IG5S01E)nECB!j0002+000000002k3IG5S01H|GKo7Xc)b;Sd)AFO%UA7ne{U0|-GN z>i_@%0000u0RR910001E3jhES02KhZ2Lu2B0000G5C8xG0001V3jhET01E&xG64Vp z0001_000000001qli?5-0iToM5Eo&{3jhET01E)1nE(I)00017000000002h3jhET z01E(kr~m)}0000)000000002(3jhET01E(kLjeE)0001d00000000303jhET01E(! zbpZeX0000i0RR910000KlhF|uF((WF01^NT0EiX=0000005AXm0000005c2#01^NT z0N4ou000000AKv z00000oB#j-00000f0NM>7k`}$000sI3jh#L0RR91000C600000006fP000sI3jo+U z0RR910000100000007Jk000sI3jjF9000000000100000007?%000sI3jp}600000 z003A400000008q0000sI3jm35g8f{000sI z3jn~$00000003+N00000001kKu?-hNJq-W=5&#PTSgZg500000lmGw#00000Qw;zB z5&#PTNGkyV00000@Bjb+00000V+{ZR5&#PTz!U)h00000Y?sj?10Mm2ld%mKF`Nwm z01^NT08nlL000000Ehqp000000JjYQ01^NT07$R^00000089b^000000ML`M4HseP z4FCWU02KhZE(8Do0000G000000002;4FCWV01E&pn*aa+0000C00000000094gdfW z01E)nZvg-R0001B000000000X4gdfW01E&}!~g&Q0002+000000000vlTi&90ZNlm z4Hp4jlTi&9NpKDT01^NT0I2r>0000004M+e000000D%qw01^NT02omL000000Pp|+ z000000F({@01^NT0I;S20000006YKy000000H~8u4Hp5slTi&98O{y>01^NT0FV>` z0000005AXm000000NRsL4Htj=4gdfW01E(^;s5{u0001l0ssI20000A4*&oX01E)H z#{d8T00004000000000O4*&oX01E&x76AYN0000m000000000Z4*&oX01E)HcmV(a z0002c0RR910000s4*&oX01E)P+yDRo0000K000000000!4*&oX01GMrcntvn00000 z1ONa400000P7eS85&#PTC_VuI00000KmY&$00000W|J`t7iD-4000sI3jnA=0RR91 z002M$00000004#$000sI3jm0-00000005W;00000006cR000sI3jlb*00000008g+ z00000007Mo000sI3jnxq0RR91001xn00000007z#001JBVF42v^$!355&#PT5N!bf z00000Kmh;%000002a{n87k?fQ000sI3jpXp0RR91002M$00000001x$000sI3jm<1 z00000005u?00000002Y~000sI3jiSA00000005)_000000031G000sI3jo+$0RR91 z002w?00000004Fn000sI3ji=30RR910086y00000004*(000sI3t9lU#{d8T0001h z000000001^5C8xY01E)f_5c6?0000e000000002C5C8xY01E)f7y$qP0000400000 z0002N5C8xY01E&h_W%F@0000C000000000<5dZ)Z01E){tN;K20000400000 z00018lOYWkF>Vn601^NT06541000000Ehqp000000EZC(01^NT0I2Q&0000008{_~ z000000FjfC3>O)g5dZ)Z01E)1%K!iX000000RR910001{lOYWk0lSky5f@?75dZ)Z z01E)<+yDRo0000q0RR910002y5dZ)Z01E(+HUR(t0000)1ONa40002-5dZ)Z01E)X zmH+?%0001}0RR91000005&!@a01E)nVgUdE0001Z000000000Fmyss}7a1rL000sI z3jjbo0RR91001Na00000002UlktYKe0b`euCj%ErZ4v+g5&#PTfD!=!000001ONa4 z00000coF~r5&#PTAQS-r00000H~;_u00000g%SV&5&#PT7`gxe00000Q~&?~00000 zqnD8<0~Z0dmyss}7XitaktYKe8Qc;801^NT0O-yD0000002BZK000000PB~LCj%FM z1QP%N5&#PT;Clf8000003;+NC00000BohDt5&#PTXm0@k00000JOBUy00000I}-o^ z5dakcfEfe;000000096100000NfQ775dakc_$~wh000000096100000R}%mL5&#PT z02cuO00000KmY&$00000W)lDa5&!^~=O_aae~uFX01^NT0C;!-0000005|{u00000 z0IL%K01^NT08rEb0000008jt`000000K5|b01^NT003kG0000000;sA000000Ll{p z01^NT07$a{0000006+i$000000M`=$01^NT09Y;o000000Ehqp000000O=C|01*HH zlVbr9fBX{w01^NT05EU?000000Ehqp0000001y-a01^NT0JwGm000000N?-s00000 z04Wpz01^NT0GJp70000005AXm0000005%i=01*Hc05BK?0000006_o%0000007eu5 z01^NT04P5J0000006+i$0000009_OS01^NImuD&i5lL|r000sI3jjbp0RR91003kF z00000004><000sI3jkOb0RR91002M$00000005K}000sI3joOM00000001xm00000 z00500000006cX000sI3jnYH0RR91 z001Nb00000006`l000sI3jk<80RR91002M$00000007n%000sI3jp{P0RR91001}u z00000007^Yu`2@?8SoVV01^NT04T5k0000002}}S0000000xsm6cV$B01^NT0Eh=pn35&#PT zXt@9Y00000tN;K200000{1yNJ5&#PT(DwiU00000EC2ui000005|@E40~dcA7XSbf z01E(E>;M1&0000W000000000g7XSbf01E)nLID5(0001}000000000s7XSbf01E&( z3;_TD0002E000000000$7XSbf01E&p^8f$<000130ssI20000@7XSbf01E)X836zQ z000040RR91000157XSbf005VVE&~xYY!?6k5dakc$QJ|v000002mk;800000cNYKv z5&#PT2oV7Q00000`~Uy|00000kQV>|5tCs769J=_fi43Vf3+6?01^NT0MMiW00000 z0N?=t000000K*pm01^NT0En9a0000001N;C000000Mr)%01^NT0LU5v000000I&c6 z000000OA(_01^NT0MOh30000002lxO000000PYt601*Hb05Aar000000N?`v00000 z0Q(mJ01^NImxnF`5q}dH000sI3jk2}00000000yK00000001W#000sI3jp930RR91 z006WA00000001@^000sI3jmm>00000006iE00000005~7000sI3joO800000000aC z00000002!G000sI3jkQD00000002Y*00000003ne000sI3qk;>n*aa+0000q00000 z0001e7ytkg01E&hDggih0000K0RR910001x7ytkg01E&>nE(I)0001B000000001V zld%mKf1nru01^NT0B8pR0000001N;C000000IwJT01^NT0GM|H000000CWHV00000 z0L2&p01^NT0D#i~000000Js1E000000Noe>01^NT07zj00000001N;C000000Q49D z01^NT0BFJh000000Pp|+0000001Fua01^NIm-jFO5dk2V@h}4yVMZAM01^NT07%OK z0000000aO40000009P3R01^NT0HEvu0000003-ka000000BRWk01^NT0DvU{00000 z0Q3O>000000DBn#01^NT09X?N0000005|{u000000EL(FFasAcpcw!F5&#PTU=;xX z00000KmY&$00000tQi0R5&#PTIMe_D000003;+NC00000x|i`V0~cY<82|th01E)1 z5&-}J0000;000000002i82|th01E){3;_TD0001d000000002w82|th01E)X1_1y7 z0001(000000002>82|th01E&x$^ZZW0000q000000000Alfe}i0Vk8e6&C?Jlfe}i z8BZDj01^NT0O&6P000000DJ)e000000A7>96&HVd8UO$i01E)+{&0000$000000002L8UO$i01E)+{&0000$000000002Z8UO$i z01H9@=s*Dg00000KmY&$00000;~D?}5&#PT5S0J`00000)Bpeg00000@)`gD5&#PT zI4l7G00000m;e9(000001DBCA0~dc48vpj`5&#PTs6qh%00000C;$Ke00000n;QTC5&#PTXa)fQ00000 zSO5S300000rW*hN5&#PTu<8H+00000SO5S300000yc+-j5&#PTcqah>00000H~|0v z00000%o_jz5&#PT`2GL@004gg0Gt2-000000OT7001*Hc0N57<0000008sz{00000 z0QDOH01^NT0PuSO000000FVFx0000001_Mk01^NT0O*wf000000Mq~g0000003aLy z01^NT0N8E;000000C)fZ0000005==}01^NT00`><0000002BZK001-q002!K000sI z3jio#0RR91000aC00000003hg000sI3jmlG0RR91000C4000000045A;WPsme}o(W z01^NT04QAn000000E7Sl000000HGWJ01^NT0H75C0000004M+e000000IM7T01^NT z0C*b#000000Ehqp000000Jj_f01^NT0BAu00000006+i$000000M8r%01^NT000mH z0000000aR50000000<2L01^NIleY~KN$eZ|01^NT0I2Z*000000DJ)e000000QMXJ z01^NT0B{Wf0000000;m80000000SKW01^NT0Pv;&000000H^=}00000034UWHUk#{ zE|tN;K20000K z000000000H9{>On01JNr@aO;l00000>;M1&00000ARhn#5&#PTcn1Lh000003;+NC z00000FdqN_5&#PT@PYvV000001ONa400000L>~YE5dakc&=&*%000002mk;800000 zQy%~T5&#PT@b&-z00000Bme*a00000XCD9n5&#PTn9BeF002J#00aO4000000CgV# z01^NT00`Fr0000005k#s000000E!;~01^NT000gF0000004M+e000000Gl5G01}g7 z0TVT@9{>On01E(+69E7K0000u000000002D9{>On01E(U$^ZZW0002g000000002Y z9{>OnlVJf9G2tHo01^NT064$^0000008jt`00000001BW01*Hc0C)!k0000000;m8 z0000002r4cIs+F0E0-ZU0~bk2AOHXo01E&x4gmlF0000e0RR910001CAOHXo01E){ z69E7K0000e000000001VAOHXo01E)%=>Px#0002c000000001lmmxX>7a67?000sI z3jo*+0RR91001Ze00000006d^AvyyWf65>L01^NT00?sd000000GI#(000000OlY7 z01^NT0N@w_000000Ehqp000000P!FI01^NT0H{9!0000006+i$0000000JQZ01^NT z0ALmY0000004M+e0000001Y7k01^NT0NCCD000000Gt5;0000002?6y01^NTe*k#k z00000005W)00000001W;000sI3jhEk0RR91008I!00000002NC000sI3jhda0RR91 z004vl00000002)R000sI3jkQd00000008g+00000003tp000sI3jjdb00000007(o z000000049$000sI3jpwP0RR91ZvX%k000000001tApigp01E)1)Bpeg0001N00000 z0001#Apigp01E(sdI10c0001B0RR9100021Apigp01E)17XbhO0000O000000002I zApigp01E(^{{R300001d000000002YApig%lVJf9f9N3q01^NT0FY(@000000AvFI z000000Q?~U01^NT01$Wq000000B8UJ0000002U$u01^NT05~fF0000000aO400000 z04E{<01^NT0FYk+000000F(g$0000006Zc901^NT0N64C000000JsAH0000007xPL z01^NT5&-z^00000006K600000002*yF+2ko8Db&;01^NT0B9Kj0000009XJ300000 z0Bn~rJOdX2eU~vj0~axeA^-pq01E)1a{&MV0002w0RR910001{A^-pq01E&x69E7K z0000e000000002JlR*&|0kD@bJOdYh&LRK+5&#PT_-O$E000006axSN00000-XZ`1 z5&#PTI1&K>00000H~;_u00000=^_9C5&#PTxEBEc00000C;$Ke00000`XT@T5&#PT zIGX?f00000Gynhq000007$X1x5&#PTuqXil00000r~m)}00000DI)*?5&#Pp0H{6z z0000006+i$0000006!xD01}g70TX3YBLDyr01E);M1&000000RR910001-BLDyr01E(6 zZvg-R0000K000000002DBLDyrlVJf99myjA01^NT0N8>70000002BZK000000Nx`2 z01=a60TTuFBLDyrlVJf9H3=jD01^NT0N|Sd0000001N;C0000002(9!01^NT0H|*P z0000003-ka0000004gK^01}g70TUfPBme*s01E)HT>$_90000q000000000{Bme*s zlVJf9Wo9G*01^NT064|~000000C)ia000000Ei?201^NT0H{3y0000006+i$00000 z0G=cO01^NT08q;S0000000aO4000000I(zg01^NT04P8K0000006+i$000000LCN$ z03efL0TUh7Bme*s01E(M`v3p{0002g000000002wBme*slVJf9fBGZ<01^NT01)B; z000000Ehqp0000000kug01^NT0O)Z60000000;p90000002(C#01^NT0I>J~00000 z09XJ30000004pT`01^NT0N4Qm000000DJ%d0000006irD01^NT007Sb0000002BZK z00000081qR01^NT763>h0RR91006WA00000003Mi000t`VF42bZzTW#Ad_JM6Mu;% z000sI3jly$0RR91000aC00000005mO000sI3ji3;00000003M8000000068d000sI z3jnwl0RR91000C400000006ut000sI3jlDT00000003M800000007Y?000sI3jlx= z0RR91000mG00000007%1000sI3l;!)(f|Me000080RR910002-B>(^tlVJf99Rnr+ z01^NT0O%3{0000007w7;0000002C$w01}g70TWUuCIA2u01E)f6#)PM0000G00000 z0000oCIA2u01E(U6afGL0000O000000000yCIA2u01E&B?*IS*0001_000000000+ zCIA2u01E&h+Lzis1G{BZXmVv?WKv~pWnpt=E@N+Qb98WWZ*VR$0B2utY;R{qX>4Uo zX>)V{XJ2q^Z)a3!a%Ev;0B2umb47S*bO2{xW^8qHXjEx!Wp8zK0B2utY;R{nY-wd~ zbO2{xWMy_!bYXO5m%Tp&l@vK=Uu0}=XGUywb7(_hY;0m-V{4a9Km)Q6HD_OFVRKSt zXK8bEWpZU?xB5T>EddlqWpqhyW^Y1yPGN0jE^uLTbS^NLCPD){mu*4=DJFAhVRB_( zZDnmPV*qS#XJ2G;b}nN8Y;R{@a&>NWX>DaLV*qDgm$0t^87606Y-wUhVQyq>WdLMy zX?A6DUtw@*E@J>^Uu1H2Ms;puNp5Cum%2g&HMtB z08nyiZgfduZBu1zW=wBqMsIRcWpZ|9asXdiF)~SWRA_Q#VPr*kX>@kC4n_m80}o+j zL~LwEb#7x*X>Mn1WtUH10~NQ>NdwgZ31?q$OmAmGb!NAuO9Phz8edv6F;#G6VRU6h zc4cmKOl5XuY(jZOZgzH;I!*&-5=3%#Ms;pubZKvHb5(9>ZfSIvpH2f*7++d3IaP3E zVRU6oZ)Z$pc4cfrc|~q^c9-%_15CGBPXmhrEM#nBY;SXAKtM-KNkT(kGA=PU099^m zZ((Faa%pyDazt!wMs;pubZKvHbC=^$1GW)gS}`$3Y;|*JL2z(PZ)Z?;mzYumpd4RX zF*ZbRRd8fsbY)C$XG~>wWo&i;Y-4C|cW#$(U;`SHtV|7;Wm5z93rufeWJGLiMs;pu zw_8*LNC6T=Y;R{$WpHnDbVg}zVQgu7Ww)YL1N#CHRc>r=VPsNuZggpFWkhUjx13l5 zX#p5tS}{3EZfSHyc4cmKOl5XuY(jZOZgzH;1X=^T8(&&7GE;P6a&%N^a%Ev;MsIRV zZ)Zkqb#rKTlQB9Jx6)bzTmqLvT?57#Np5L$OmAmKY;|*JRB3HxZ*_D+c|~q^w+LPX z6ao}PY;R{$WpHnDbV+V$bZKF1X?kUs8(;%>7GGa*a&KpDVQpnVKu1hTLPK9NE-^Q^ zkzfN?0T4`YXGUywb7(_hY;0m-V{4b^VFTB<%whv%0hcah17ZRk3YU^(11=H}3;+NC z0000G3;+NC0002^D3{V?11=H>H2?qr00008H2?qr0002M8|i~00000005VXXahG9aP$KJ00000aP$HI00000keAVD1AhX@DVI`d18xHNFPFk; u15XS(00000000>P006?59clwC2|)t@00000StgfKY6CU`L1>qXY6B({sz(I? delta 88078 zcmV+W{{#Sl;0>_V4UiZT0FM9w00000KmY&$00000@MDoGHh*v)0ssI2003|v0ssI2 z000000RR9100031000I6003a}0ssI2003a}0{{R3003a}0{{R3007Vv00000001yL z00000000000RR9100062000I6004;c0ssI2004;c0{{R3004;c0{{R3003|T00000 z003|T000000FmEGB3RP_0000009exj0000009exj000000CWie000000CWkHN&!wH zVDbV000000VDbY100000VDbY100000pbY>300000pbe9{0UjNbt7h`opA!rxV|_$& zbbD>_uD06%000070RRAYll1`~4C5)pk{|$wNPs9n$de!fDSxO!5`nM)7_}h+g9AVg zAZRF9RS-HEII{pV005_e0t6!p5HJv6P(&f5hM<@v01g140nUiy2^dfip#ZRD1K0xy zKnNf~K}-NZ004+V7yvN1002q=01kx^0776E0pmhk01ALlM3902ga{Hg5fC6|P{|7c zP+>jL0T5CJ2!93@8884=2mzG@ssIQ~XHx*w00;;YMAiThAjnB1kOBY=0H6RVK7t5{ zPy~QLL^2Rj0Inngg8+5_00000004IY00000004Uc004Xd00000004ae004jh004mi z004vl004ym004>r0000000000004^s000000052v0Dl0G0001y0001!0001$0001& z00000000000001(000000001+0001<0001>0001@0001_00000000000001|0001} z0000000021000230002600028000290000000000000000002C0002D000000002G z0002I0Dk}gy#N3J0000000000z5oCK!~g&Q00000#sB~S00000#{d8T$^ZZW%m4rY z&Hw-a&j0`b(f|Me)c^nh*8l(j*#H0l+5i9m+W-In+yDRo00000-2eap-v9sr-~a#s z;s5{uHq)$>i_@%?IZvI000000Pg?*000000Pp|+0Pz3- z000000P_F<000000QHk$0ULkz000000002@0002^0002_000000002|0002}00030 z00000000010RR960RR970RR980RR990RR9B0RR910000C0RR9E0RR9G0RR9H0RR91 z0000H0RR910000L0RR91000000000M0RR9100000000000000N0RVph8UX+R00000 z9svLV000009{~UWAOQdXAprmY00000A^`vZB>?~cC;q<%00000mjM6(m;nF)ngIX+oB;p;p8)^>paB2?00000000L70HFZ@0HTu_2Uipn zX6_>}4Hs~)x8eMZ%5qR22aigVj0Z>{ly`x{k0tKx3N9Lgf{@?VU5Y+>hhFcJEESZ@ zOnP%Ulkf*1lN1OrG?K1l&CV|Y9E@3B5_XF$;uKd$)yXGrt5&JqrzdAH$<>u86yErW zYbt5)i4AljS?WOnW_|*b%n5*#PzsEb;0kDyObb{P z1#3+iYo4~eF?MZDJP5fxr>7Rpleh~YliUkT1_J;I0I+(KG7KgG%aaig7Xew5aSRs$ zj*}4&7XfCIF%TC4#*;A+7Xea}0Sy-c4wLZ>7Xea}Q4tpbcaw1p7XhS`F%1_1NRy!q z7Xh%7p$r!Rw38tb7XgryQ4SXY@00Nj7Xhu4F%1_1wv#ap7XcrW@eLON%ag$k7n3jz z7y+@D;VT0d0auez4i^DmlQ9q%0k4w*4HpG*0RR9IlVJf90cw*04Hp3wlW`0e0riss z4Hp4mm*Fb|7Xd<(5f2vu;FB>87XgivK@S%N(*pni5|d#869JBsF%1_1os)447XkZ| zQ4tpb9+zP)0~Y}TlTi*A0i=_03>T6R7y;jt5f2vu&y#Ts7XjRp@eLON*^{9R7Xh`C zArTjokPsLJ0~!DT5tCs769FQVp$r!RHj{A-7Xbp30Sy-cS(o7}0~Y~+mr)-B7Xj*% zaSRs$_?Mv?0~Z0@lTi*A1$Get01=a60TTf^lQ9q%0a}y64Hp4)lTi*A0hE&w4;KO2 zlQ9q%0dbQd5f=eqlc5Y31)c){01}g70TTg{mr)-B7Xi1Ep$r!RS(7mk7X`Tm000q_ zVF42X@sn{37XdGmp$r!RLz58?7Xd$$ArTh=!jn-B7Xc@eaSRs$`;##c7XcTOQ4tpb zO_xz00~Y}olkp7~0TGj-3>N{(lW`0e0j`q)4Hp6SlK~AE0jiU63>N|Mlfexa0q>Im z4Hp4;mr)-B7n3*<7y%`hVJ!m~mr)-B7XgWraSRs$a+gsb0~Z0#m!TR17Xh%7aSRs$ zwU<#J0~Z16lfexa0R@v$5f=d$lTi*Alh6_vleiTa0XUN(5f=e=lQ9q%0Rodj4;KXm z8UO$hlVJf90S=czG6NR@sh8m^0~Y}$lQ9q%0RxjU5ElW4lQ9q%0oIdo3>TO1ZUY39 z+!ho8nUg^e7Xez6ArTjoAQu<`>5~Bs7XeF?Q4tq^rw{-D5&#PTXb}Mb000001ONa4 z00000#|;1g5&#PTKn(!^000001ONa4000003jzQD5&#PTu$KS;00000Kmq^&00000 zlo$X25&#PTpkV<300000m;e9(00000-WC7=5&#PTs7nC=00000i~#@u00000v;Y7A z5&#Q-04S9J0000001N;C0000001pEI01^NT0I2N%0000003-ka000000Db}h01^NT z0Fayj000000N?=t000000M`ou01*Hb02lxS0000000aO4000000O%C}01^NT0LVQ7 z000000AK+C0000008aq`01^NT0PvLn0001g006)N00000006!V000sI3jmPp00000 z008U&00000004Us000sI3jp8{0RR91001xm00000003wL000sI3jk>E00000001li z00000002f9000sI3joMo0RR91004*p00000004Ir000sI3jlB&0RR91008g+0001g z0000k7ytkg01E(UUI73A0001B000000002a2><{R01E&B+yDRo0000m0{{R30002< z761Se01E&(O#uJ^0000C000000002^4gdfW01E)H3IPBB000040RR910001I7ytkg z01E(sU;zLC000080RR910000m1pokl5&#PT81Dc800000C;$Ke00000y#fFL5&#PT zpzr_y00000SONe500000hYJ7z5&#PT7!Lse000007ytkO00000J_rB+5&#PT@C5+? z000001OWg500000c@+Qv5&#PTur&by00000*Z}|l00000_yPa`5&#PTke~p600000 z0Js1E000000J{tT01^NT0C)}o0000004M+e000000Luyh01^NT0EpuN0000003-ka z000000Hy-~01^NT0GOiy000000H6T?000000Br*R01^NT0Jxz5000000GI#(00000 z03i|p01^NT09cU#0000006YSJ00000006KU000sI3jjD`0RR910086x00000004Fe z000sI3jlD!00000002Ay00000006QL000sI3ji<;0RR91000C400000001l&000sI z3jjz#0RR91003YC00000001Ks000sI3jjD70RR91008^|00000005?c0000I01E(M z2mt^90000e000000000c0RR9J01E)9l>h($0000q000000001G0000I01E(!2mt^9 z0000e000000002=1^@sO01E&(!2kdN0000G000000000O1ONaM01E)HrvLx|00004 z000000001P3IG5S01E(r*y8{I00000FaQ7m000000ucZJ5&#PTND=`6000001ONa4 z00000-wyx)5&#PT2oC`O000005C8xG00000JQV-{5dahb5CsGP00000AOQdX00000 zCjtNf5&#PT@R000000AvRM01^NT0BFJh0000000aO4000000Qdy}01^NT z05}l=0000005AXm0000001OoX01*Hc0B|b=0000000;m80000007DP}01^NT01yxX z0000006+i$0001g0027%000sI3jk2M00000008g+00000001oq000sI3jlz@00000 z007hg00000006xW000sI3jjC`0RR91000C400000002J@000sI3jp8<0RR91001Zf z00000005g2000sI3jo-00RR91000yK00000006EN000ty01E(!ECB!j0000;00000 z0001f4*&oX01E)<3;_TD0000u000000000M3jhET01E&J$_90000K00000000157ytkg01E(6UjYCB0001g zFaZDn00000tOfu85&#PT5WfHb00000cmV(a00000W)%Pc5&#PTa54b^00000Gynhq z00000G6?_x5&#PTu+snl000007ytkO00000-Vp!*5&#PTh#vs}00000d;tIe00000 zU=IKQ5&#PTzzhKZ000001ONa40001g0J;|d01^NT0O(u+000000Ehqp000000R0#M z01^NT0H|gG000000N?-s0000000|cW01^NT07y*%0000008{}0000000F(y+01^NT z0Jy>c0000000031000000B{Ka01^NT0Jzlv000000Gt5;000000NWD)01^Oy3jlx~ z0RR91000O900000007AZ000sI3jnwa0RR91008^|00000001Kc000sI3jj!=00000 z001Na00000007Vd000sI3jhG&00000007Vc00000003nY000sI3jn}p0RR91007Vd z00000007$z000sI3jm-F0RRAh0000e000000001R6#xJd01E(EH30ws0001300000 z0000h3IG5S01E)n;Q#;t0000;000000000N82|th01E(!X8`~J0000u000000002X z0000I01E&(l>h($0000q000000001?82|th01E*4Zvg-R0002s0RRAh000001PTBE z5&#PT==lHu00000+yMXp00000w-x{Z5&#PT2uc9}00000i~#@u00000of7~65&#PT zU>yMf00000lmGw#00000jSv6;5&#PT5D@_Y00000C;$Ke00000F%AF#5&#PTsMP=f z000003;+NC00000m01^NT003?Q00000 z0Q3O>000000B{8W01^NT09djB000000H^=}0000004)vx01^NT0N4lt0000000;m8 z000000FM*^01^NT02nO+0000007w7;0000008bDA01^NT08kKr0RR91001Ze00000 z000XR000sI3jlBr0RR91003+N00000005#5000sI3jhcO0RR91000C400000008I` z000sI3jpwO0RR91000C400000007q%000sI3jkm(0RR91002k;00000000;a000sI z3jj#)00000003Bj000000001C3jhET01E(^4FLcE0000;000000000Q2LJ#P01E)n z?EnA(0000e000000002M5dZ)Z01E(UA^`vZ0001x0{{R30001t6#xJd01E(!Hvs?u z0000)0{{R30002+3IG5S01E&J01^NT05IYJ0000005|~v000000D2Sv01^NT z01z($0000007w7;000000R8{~01^NT0Em?U0001g000aC00000004#q000sI3jk1} z00000002Y*00000007+z000sI3jna=00000001Na00000005#2000sI3jhfJ00000 z000aC00000006-V000sI3jh!W0RR91004*p00000005X5000sI3jmN<0RR91000yN z0001g000052LJ#P01E&}!2kdN0000q000000000$1ONaM01E)%4FLcE0000e00000 z0000y0ssIK01E&x#Q*>R0001(000000002*1ONaM01E(ctN;K20001>1poj50001Q z4FCWV01E&Z{{R300000`0ssI20002H6#xK#5&#PT&^iGC000001Ofm600000JqrK; z5&#PTF!ule00000bN~PV00000i4gz*5&#PTkP`s_00000KmY&$00000;sgKy5&#PT zFsuLo00000JOBUy00000*Af5#5&#PT*c$-=00000m;e9(00000Z4dwe5&#PTs1N~v z0000005|{u0000005ll@01^NT0Pt!70000001N;C000000QM9B01^NT05~oI00000 z07w7;000000C5=r01^NT0BCIi000000GI#(000000GR*)01^NT0LYX80000009*h7 z000000L2Ud01^NT0I2r>000000GI%O00000007tn000sI3jjE!00000004Lb00000 z000sb000sI3ji<}0RR91000C500000003bO000sI3jhf900000008g+00000008L# z000sI3jlDH00000000yK00000005o>000sI3jlDQ00000007_t00000001g~2><{R z01E(^(*OVf0000K00000000283IG5S01E)f0|5X40002E00000000122mk;Q01E(M z$^ZZW0002E000000000m5&!@a01E)%8UX+R00004000000002h6#xJd01E)vJOKaz z0002+000000002)3;+NU01E(rK==Rv00000Bmn>b00000#S{Pl5&#PTs4W2i00000 zNB{r;00000QwIP55&#PTV8Q?Z000001ONa400000ZwLSY5&#PT7|Q?v000003;+NC z00000301^NT0LU%@0000007w7;0000002~Sc z01^NT01)5+000000PFw&000000Kg9b01^NT06-1_0000005|{u000000PPU~01^NT z0Qe;V0000001yNK0001g002@3000sI3jjd700000008g+00000005{L000sI3jnBF z0RR91002M%00000002oB000sI3jlag0RR91003wJ00000005N@000sI3jhEG0RR91 z000O800000006uS000sI3jk>200000001BW00000000CA000ty01E&Rxc~qF0000` z000000001s2><{R01E(E*8l(j0001(0RR910002L2><{R01E(k*#H0l0001l0ssI2 z0002v2LJ#P01E&J5&-}J0000$000000001&2><{R01E)f`v3p{0000m0ssI20001T z1ONaM01E)HsQ>_f00000)Bykh00000J_!H-5&#PT$kPA-00000Gywnr00000MFIc- z5&#PTSepO<00000Gywnr00000R2cvO5&#PT0BZpN00000kN^Mx00000p%efB5&#PT z@GSuV00000NB{r;00000Y!3hc5&#PT$P57h00000AOHY=0000004opx01^NT0Qe69 z0000002lxO0000007?V^01^NT08pp^0000000aO4000000BHsQ01^NT05H4&00000 z0Pp|+0000009XY801^NT01&bO0000007w7;000000C*Ar01^NT0O%S4000000Pp|+ z0000003QW^000sI3jjdx00000001Ze00000000{h000sI3jp8`0RR91000;O00000 z003YU000sI3jk;<0RR91002k;00000000jG000sI3jmmv00000000aC000000006O z000sI3jioT0RR91000~U00000002u5000sI3jnx(3;_TD00004000000002|2><{R z01E&x-v9sr0002s000000002D6aWAc01E)1F984m0000;00000000137XSbf01E)% zQ2_t|0002A000000002y2mk;Q01E)<%>V!Z0000q0ssI20002(2LJ#P01E)f4gmlF z0001g2mk;800000O%wnC5&#PT$RPm$00000oB#j-00000gbe@y5dakc&=&*%00000 zQ2+n{00000lmY+%5&#PT2o3=N00000H~;_u00000cnkml5&#PT`1Jq)00000m;e9( z00000_YVL75&#PTKo0=`00000FaQ7m0001g0JaAJ01*Hc0B{Ec0000000;m800000 z05}5x01^NT0C1rI0000007L))000000Cg7t01^NT0H9O>000000E7Sl000000FVy= z01^NT03Zzk0000001N;C0000007wh~01^NT0MPRQ0000005kyr0000006`J}01^Oy z3jhcq0RR91006)M00000005#3000sI3jjFk00000003A500000007k&000sI3jlCk z0RR91004LZ00000006}k000sI3jp{l0RR91002k;00000005%|000sI3jm0#00000 z005`}00000006fS000sI3jk0J0RRAh0000;000000001d7ytkg01E(!VF3UD0000K z000000000w761Sd02Kg`D+B-l000000RR910002!6aWAc01E)h($0000C000000000e4FCWV01E*4{Qv*}000130001g00000 z@dE$=5&#PT=>7lz000003;+NC00000Dg*!k5&#PTxTgRB00000lmGw#00000E(-tv z5&#PT`2GL@000003;+NC00000oe}^55&#PTI2r)}00000r~m)}00000oD2W}5&#PT zkoEuo00000oB#j-000003<&^#01^NT03gr+000000Nelo0000005c5$01^NT08st_ z000000GI#(0000004WRr01^NT0Qm9%000000Mq~g000000A&^c01^NT0Qg7&00000 z089V?0000007w=901^NT0H{I%000000AK0RR91000OA00000003SD000sI3jkQC00000002}000000004jm z000sI3jnZ?00000005|e000000002^5dZ)Z01E(+X#oHL0001B0RR910000)4FCWU z02Kfz7z6+S0000%000000001f2><{R01E)n4gmlF0000u000000002$1pojN01E(s z1OWg50001d000000002h2LJ#P01E*41_1y700026000000001g+X(;w5&#PTFbDwv z00000FaQ7m00000qZR-F5&#PT&`ALR00000Gynhq00000UjqOD5&#PT;Kcv{00000 z6aWAK00000-w*%*5&#PT@DTw3000002mk;800000oCp8_5&#PTs0RT600000hyVZp z00000>k|L~5&#Q-0MIM}0000007w7;000000NV%v01*Hc0KgXn0000000;m800000 z0EPzu01^NT0IR000170RR91 z0002M1pojN01E(k5CH%H0000G000000002D5C8yw5&#PTa1j9j00000KmY&$00000 zjtBq%5&#PTD9Zo<000001ONa400000l>q<%5&#PT`0W4y000003;+NC00000BL)Bf z5&#PTV7UMQ00000@Bjb+00000<{R01E)H2mt^90000e00000000053;+NU01E(+?f?J)0001l000000000T3jhET z01E)P<{R01E){ z*Z=?k0001p000000002|3;+NU01E(OX!!sD00000d;kCd00000y#W9K5&#PT0MP&d z00000m;wL*00000gckq+5&#PTC{+Of00000WCH*I00000=K%l!5&#PTfb9SP00000 zC;$Ke00000{1N~F5&#PTFlLkbG{uuLHo6>NUvqR}V{2byXlq|*bzyR3090>pY)55u zP-$e7>o#r=UvqR}V{2byXlq|)VQFlWS2r>%RB3HxL}_Mb0AE@$HB4`3Lv(U%Np53I zZ)a&^b^v2+Z)0m;XJvGBX>Dbbs5g|8RXE_6qE7=Blk7PulQcPtmmpmOB$r=V0~wQU zIpY*T1$M05aDZ*Oc;adtWdjvQV_|G;Z({&$Wo=_{d0%q?L~?dQb!Jy`X>?@(L}hkRY;R{$ zWn*?!XmVv?WB^2Rc2i|@b7^mGNp5L$07P0 zX>DahY;03$Zf9&|0B2uha&|^_ZevMqW^VvYZ((Fob#8QNZDmAkYyf0zZ*XO9v#m>{ z1e0%2&yyTc5|ge`29sD(Jd>_b46~$BZ~}h-00000009620K6Fh01yBG03ZMW0GE-L z1^@sB08ttM000000096203aFw01yBG03ZMW0GE-L1^@sA08ttM000000096205%!` z01yBG03ZMW0GE-L1^@s908ttM00000009620QngJ01yBG000000GE-L1^@s808ud- z00000003a}0{{R30009700000003Z=00000004OM0{{R30009700000000=2lj2k^ ze}I$$0000005AXq0000000RU7000000Em0R#X5000031ONa400000 zl>q<%000260R#X5000031ONa4e*gdg2$cZ<00000zySmR000000|Wp7000005S0M{ z00000&;bMh000000|Wp7000007?lA400000-~j{x000000|Wp700000Ae8|C00000 z@Bst>000000|Wp700000FqHuS0000000IO6000000|Wp700000K$QUie*gdg01yHM z0000000RU70000008o_y0000003ZSc0000000RU70000009cg)0000005Ads00000 z00RU7000000BDr~0000006+o+0000000RU7000000C<%F0000008j!10000000RU7 z000000DzSN000000AKq<% z0002M0t5g6000031ONa40002Ul>q<%0002c0t5g6000031ONa40002cl>q<%0002s z0t5g6000031ONa40002sl>q<%0002+0t5g6000031ONa40002!l>q<%000000|Wp7 z000031ONa40002+f0Y3M000005Ca4N000000|Wp700000_>}L00000e_#Uy0000000RU700000 z05FyT000000B{2Y0000000RU700000063Nb000000DuDo0000000RU70000006>-j z000000FVO&0000000RU70000007#Yr000000H6Z|0000000RU70000008o|z00000 z0I&lD00000e*gmn00000003B)0RR91006)P1ONa40009700000003Z?0RR91007Vf z1ONa40009700000003x~0RR91007_v1ONa40009700000003~70RR91008g<1ONa4 z0009700000004NF0RR91000041ONa40009700000e*gf0mH_|&0000G1Oxy800003 z1ONa40001pmH_|&0000W1Oxy8000031ONa40001xmH_|&0000m1Oxy8000031ONa4 z0001(mH_|&0000$1Oxy8000031ONa40001}mH_|&0000`1Oxy8000031ONa400026 zmH_|&e*gdgU<3pJ000000|Wp700000xRwC`00000a0CPZ000000|Wp700000z?K03 z00000fCK~p000000|Wp700000$d&;B00000kOTw(000000|Wp700000(3SxJ00000 zpacW}000000|Wp700000*p>kR00000uml7Ee*gdg00RU7000000N|DZ000000KfzU z0000000RU7000000PvOp000000MG;k0000000RU7000000Qi;x000000N?}!00000 z00RU700000005T(000000Pq9^0000000RU70000000@@>0000001yQP0000000RU7 ze*gdg008K)0RR91001Bb1ONa40009700000000270RR91001xr1ONa40009700000 z000=V0RR91002M*1ONa40009700000001zt0RR91002-01ONa40009700000002m_ z0RR91003YG1ONa40009700000003aIe*pjh0001R1q1*9000031ONa40001Zu>k-8 z0001h1q1*9000031ONa40001xu>k-80001x1q1*9000031ONa40001>u>k-80001> z1q1*9000031ONa400026u>k-8000261q1*9000031ONa40002Mu>k-80002Me+2{p z000000|Wp700000*s%cs00000&;WTLAz700000 z00000h?9|C7n9gt3>k0%0000000000005Z(0{{R300035000b={azOudI10c00000 z00000sQ&{1000000R#X5MgWs8UltjS0RR91000000002E{{sL3000011ONbplU-jI z8A|~G00000000000LcFX00000009I50LYV#Ul$r>00000000000002k{{sL300001 z1ONbO0F%C778zmz0000000000008L!0{{R300035003~4?Ozv@>|YEe`2Pa{00000 z0R#X5qW}N^00000000005cLB9000000t5g61Cz~R7a9Zr0000000000001EM0{{R3 z00066000F5lm1~A8GQf%000000000005J6f0000000IO60KJnfViy@b0RR9100000 z0000$^#cF^000021ONaAlU-sL8T`4F~`L00000000000DzOhVHcAqV+;+70RR91000000001xlL2HGlUQR6 z8VUda00000000000HE~)0000000IO60E+;Veq$C53jhEB0000000000u#-_@7n8VS z3>jAe0000000000006-C0{{R300066004KB-D4LG4FCWD0000000000(37!Z7n2xd z3>l;V0000000000007|i0{{R300066000t`J!BUR`2YX_0000000000@RJc^7n68o z3>uOE00000000000002?0{{R300066000mGlb&Q33;_TD00000000005R-vr7n9gz z3>tp`0000000000001EN0{{R300066000pHlm28D84>^h000000000005J9g00000 z00IO6027lfWfu)I0RR91000000000$laXW>lW1iO8La>S000000000008sV=00000 z00IO608NvPWfvM000000000000001B_5%O_000021ONaP0F%CD78(`+0000000000 z0040I0{{R300066008{}lkQ~}8W;co00000000000D$%b0000000IO6022X|9%dFA zPyqk{0000000000koE%r000000t5g6832<`W)>Q#00000000000001>_5%O_00002 z1ONbq0h4}a7L#0M3=OdM0{{R30006600115t!5V)MF9W+0000000000!1ei_@%00000000005cdNB000000t5g6 zAd}5!7a1V{0000000000001EO0{{R300066007XF{bv^$A^-pY0000000000F!uuh z000000t5g6dy_3_7aE2D0000000000002Pu0{{R300066001KZlU`^R8YBP!00000 z0000008sY>0000000IO603`sEj%XGcKLG#$0000000000VD|$6000000t5g69+SOj z7a6_)00000000000040J0{{R300066001VF?PwR1%x4S^fcFCc000000t5g6P63l1 zX%>_GXABOI_X7X`000021ONar0h3N?78=F?0000000000005x(0{{R300066007wl zlYVIy8X5rr00000000000I>H10000000IO60PFyhu4xt-g8={l0000000000!1n_H z000000t5g6DU;o47aB$Z0000000000007YU0{{R300066000O9lMZSYlk8{=4dC|! z0000000IO604tL{Y8R6nX$%hV_X7X`000021ONaa0h4ZO78;WP00000000000002^ z0{{R3000660055xlb&i88D{|i000000000001)^C0000000IO60HKr3Y8M)Z00000 z000000000W_yYg{000021ONam0F(Y|78;@e0000000000001!f0{{R300066001oj zlP+r(8H)h`000000000006_Qy0000000IO604|eVYZnch0RR91000000000`laXo{ zlbCA^8ZZC=00000000000ATn70000000IO605t)VzH1g5DFFZg0000000000aQFiN z000000t5g6ECG}5YZeVM00000000000001hlc8)ElPGKq4Kn}$00000000000FaYW zYZsGPYz!Kh00000000000001>_yYg{000021ONbW0h4}g77eoi0000000000006L) zv1=ETxNHm!HUIzs0000000000z?0!?7nA603=R4K0000000000007XF5o{Ne7;Ow0 z5CH%H0000000000;P?Xo000000t5g6zmq*}7aBPL0000000000008j#0{{R300066 z007+plWuJm8o&Sm0000000000008*|0000000IO60Bix1o^2Ky4FLcE0000000000 z5cvZD000000t5g6!2pxaZ5A1X00000000000000W`2zp|000021ONcVll^TM8hHT# z000000000005JIj0000000IO605SoSE^Zc+d~Xa5K=}gz000000t5g6JCj{*7a4s4 z0000000000002<=0{{R300066001n}6 z00000000000040L0{{R300066007sM?QR#7{A~;kfcXOe000000t5g6K9e197a67i z0000000000005Br0{{R300066001A8O>Y+s=>Px#0000000000pp#K<7n6u@43oTW z3=XjQ0{{R300066000yLldf+Tlk9E`4#4>X0000000IO60GI)j-ftF@9B&K`(D?%Z z000000t5g6n*fsza26Vw00000000000002s`2zp|000021ONa-0Fyp&78&ON00000 z00000008j$0{{R300066004uNZEzQptZxhs0Qv&}000000t5g6E&-FCa26UH0RR91 z000000000G`U3y}000021ONbz0F%ye77axJ0000000000001D9VRILg2yqM7aIQn0000000000002Px0{{R3000660046V zlU{Ka4b1=m000000000008o>Wa2J!9aSR!O0RR91000000001B`U3y}000021ONb# zlf7{l8RP%}00000000000C4&P0000000IO6005KiaTgh!00000000000001h`U3y} z000021ONbplO1vw8c6^E00000000000Fe3v0000000IO60AT@>PI49*q5%K^00000 z00000p!x#<000000t5g69Fu)=7n8hk3=OdQ0{{R300066002vqt#TI{0RaF200000 z00000!1@CK000000t5g676Fsqauy9t0RR91000000002clRlF000000t5g6&H$6na~2v=00000 z000000000W`vU*~000021ONcA0F(Z677Zf-0000000000001zP5p@@nICKn?ymSl= zK>Gs#000000t5g6T$5dN7a1l20000000000002?G#bQT#{0RR91000000001R`vU*~000021ONa> zlkIdD8gu~w00000000000D$`g0000000IO60Ga@k9(5KPV*vmF0000000000koyAw z000000t5g6HvyAQbrub70RR91000000001>lYw*>lZbT;8i)V@00000000000I>T5 z0000000IO608;>yu5}g}f&l;k0000000000!21IL000000t5g6>XY4d7a4c~00000 z00000007YY0{{R300066008xq4R#k9i2wiq0000000000;QIpr000000t5g6RFge+ z7a8RM0000000000008j&0{{R3000660032!ZFU!vJa!BX0Q>_0000000t5g6SCgG~ z7a98i0000000000000pD0{{R300066005Me&2|?VSO5S30000000000Ap8RW00000 z0t5g6S(E*C7Y#xI0000000000001zP!FCsuICl&U@c;k-0000000000K$G!y7n5jr z3>sVj0000000000002<@0{{R300066003wKla6;54UYf-00000000000AQ0*cNde$ zcMKV}00000000000001R`~v_0000021ONcxlkImG8eRYZ00000000000D$}h00000 z00IO60BHe}9(WcSi~s-t0000000000ko*Gx000000t5g6LjjXccorJp0000000000 z0001>`~v_0000021ONb^0F!=r78wEo0000000000006N30{{R300066008Zit#}t1 zd;kCd0000000000!2AOM000000t5g6NR!=o7Y&&K0000000000007XF;dd947WdlniC0RR91000000001x{R031000021ONb_0h3O9 z78=n20000000000005x<0{{R3000660012UlYV;^8F~N!00000000000I>Z700000 z00IO60P>TqdlwC|00000000000002Mlks^MljwU48N2`h00000000000MPvd00000 z00IO60B4g8d>0yM00000000000002s{R031000021ONb*0Fyp^77Ydg0000000000 z008il0elyeczg^Q1OWg500000000000R962000000t5g6x|5xJ7aHCG0000000000 z000pF0{{R300066005E!lg@k=8EXIl000000000003iMY0000000IO60P~amd>0w? z00000000000000m{sRC2000021ONcZlP!H08EgOm000000000006_i&0000000IO6 z0I!o>eHfF?d7LzP}3=Uxa0{{R300066003_QlfHcx z8YBS#00000000000C4^T0000000IO605}1Y?tK=MTzw1c80000000IO60CoYBu6`C7asU7T0000000000!2SaO z000000t5g6l#|_l7a4~E0000000000007Yb0{{R300066001_V4SyGtJbw%U;FA%4 z7n4YT3=QxA0000000000008ilp?(*Wcz+BThyefq00000000000RIC3000000t5g6 zjgy^!7cIL00000000000000pG0{{R300066005r>0000000000008}azp4EL0FgJ7 z$$ub!hC=xeA{3Dz0w2~NAOqDOAOqDOAOqFV0RWH@ibDAiLKKl80w31U0RWH@jzakm zVib`e0w31U0RWH@l0x|qf)tS;0w31U0RWH@mO}Xuq7;!J0w31U0RWH@nnL*y!W5Ap z0w31U0RWH@oLirHl7m*+WAJ)(T0FV)X0z>%_ z0vM4X0w31U0RWH@21EG}A{db%0w31U0RWH@3Pbr2LKu-C0w31U0RWH@4nz46Vi=Ji z0w31U0RWH@5<~eAf*6q?0w31U0RWH@7DM?Eq8O1N0w31U0RWH@8bkRI!WfYt0w31U z0RWH@9z*#M;uw)20w31U0RWJH5h6qR5CR#IAOauO&;bCD5hg?V5F#0oAOauO&;bCD z5h_FZ5JDM|AOauO&;bCD5iUdd5MmjTAOauO&;bCD5i&#h5P}(zAOauO&;bCD5jI2l z5TY58AOauO&;bCD5jsQp5W*ReAOauO&;bCD5k5ot5aJn;AOauO&;bB{kP$*d`49pc zkstye*3ba}kP${h`4A!+kstye*3ba}kP%8l`4B=Hkstye*3ba}kP%Kp`4D0nkstye z*3ba}kP%Wt`4EB{kstye*3ba}kP%ix`4FNSkstye*3ba}kP%u#`4GYykstye*3ba} zkP%)(`4Hk7kstye*3bce0FV)4L-`N_8<8LaAJ)(T0FV)8L-`OQ8<8LaAJ)(T0FV)C zL-`Ow8<8LaAJ)(T0FV)GL-`P58<8LaAJ)(T0FV)KL-`Pb8<8LaAJ)(T0FV)OL-`P* z8<8LaAJ)(T0FV)SL-`QG8<8LaAJ)(T0FV)WL-`Qm8<8LaAJ))+0RWH@fz*0w31U0RWH@ibMGjLL8AG0w31U0RWH@jzjqnVjPhm0w31U z0RWH@l0*3rf*g?`0w31U0RWH@mP7dvq8yPR0w31U0RWH@nnU>z!W@wx0w31U0RWH@ zoMAOauO&;bCD5vD`=5F#CsAOauO&;bCD5voJ^ z5JDZ1AOauO&;bCD5w1h|5MmvXAOauO&;bCD5wb)15P}_%AOauO&;bCD5w=755TYHC zAOauO&;bCD5xPV95W*diAOauO&;bCD5xztD5aJz?AOasH*3ba}kP*T|`49pgkstye z*3ba}kP*g1`4A!=kstye*3ba}kh2tq?+JhK5k^M&5F#>>AOauOumJ$@5lTk+5JEDM zAOauOumJ$@5l%+=5MnZsAOauOumJ$@5mH9^5P~w1AOauOumJ$@5mrX|5TY`XAOauO zumJ$@5n4w15W+H%AOauOumJ$@5ne|55aKeCAOauOumJ$@5n@L95CSuiAOauOumOJn z@DXN4`4A#Akstye*02Ep@DXZ8`4B=gkstye*02Ep@DXlC`4D0=kstye*02Ep@DXxG z`4ECLkstye*02Ep@DX-K`4FNrkstye*02Ep@DX}O`4GZ0kstye*02Ep@DYAS`4HkW zkstye*02Ep@DYMW`49p$kstye*06s80PqopM)?pTG?5?zAJ(t|0PqotM)?pzG?5?z zAJ(t|0PqoxM)?q8G?5?zAJ(t|0Pqo#M)?qeG?5?zAJ(t|0Pqo(M)?q;G?5?zAJ(t| z0Pqo-M)?rJG?5?zAJ(t|0Pqo>M)?rpG?5?zAJ(t|0Pqo_M)?o|HIX0!AJ%`c0RZq3 zrbhV?A~lg90w30}0RZq3sz&(`LN$>f0w30}0RZq3u15I~Vl|N<0w30}0RZq3vPSt3 zf;EvK0w30}0RZq3wnq67qBW5q0w30}0RZq3x<>gB!Znc~0w30}0RZq3zDD^F;x&;V z0w30}0RZq3!bbTJ0ydE#0v~_YumJ$@5ynRO5F$2_AOauOumJ$@5z0pS5JEPQAOauO zumJ$@5za>W5MnlwAOauOumJ$@5z`49p)ksyBpAJ(t|0Pqn8NBIyUIFTR%AJ(t|0PqnCNBIy!IFTR%AJ(t| z0PqnGNBIz9IFTR%AJ(t|0PqnKNBIzfIFTR%AJ(t|0PqnONBIz5Mnx!AOauOumJ$@5mHC_5P~|9AOauOumJ$@5mra}5TZJfAOauOumJ$@5n4z2 z5W+f0QrHYNBJTEK>4CK0Qmv{fYKjKAGmS*|Cjay04m@K05zaz zK)D|T0C8Xe092HwNBQ6b7Am4QK>2|JK>0xc0m^>?3IMhA4?y|$7eM*_d&j8217Fs+ zV*{zz0RXVG3jq1^;wh22YXqr*007XL007XtD**XA0}+vPA|#PJ;2@E;69D-Y0Dw|q z0zmn}006Y$0~4y*{QsBu0{|+Z0{}ID0s#571^^Lrf&h`f0s(Qs{{K_}0D#i8`~R2V z;wgWT0C+_C<^BJcpaTFk_u?s$-~$(`k^cXe-~$(`gZ=-PA_EbT0}+5yfdBxozyN?! zAz&hrwg3N@w_`)8xobqJvkO4^wG%-3yDLEX$p8Nr>i++iRs8>#<^uq#&ou;UJZQbGU`ks*K@kzfFTQWgM!5|sb{m#qK)7q?>rskv(esj~|J z`Lz=O`MWCs`91spm;HObsr>^0k@E`x`5FHImtX+^HJ||i(4qkV&;X!E`9j=B`Qd*9 z0;-5O0F?6s04g8?05u>0fKoR7|CfpS|Ch4?0Psit|Ce*(7?G*{|CgZr|Cb>EfKp%@ z0l8r|0J*UI|CeCi0J-xEK>7W9!l=LlU)HPs|Cbj0|Ci+h0IK8z6DsoyK>7W9!l+^Z z0MKCo0PusCfKozW43Qy#0g+$;fKq>B|Nj^Ld%UUr0|1fpQvs>70RYforbqd|HvqW- z06_Vn9{~9Q0D#h^{{NTY2mm#p(*Tj$`u~^o0{|+Z2mm#pH$b@`1ORbB0RU8UrbqeU z0~9KvA3*tG0zmme00GLu4gj_DQ$eZyd&H=~17Fsl0RYed%t!e(`~R2V2LOLH0|0^2 z;R6Gz0sw$g)BymHl;SCofZ`*Ok^29a-~$w@U;6)-zy|;|0SJIn-~$w@gZuxNfCvCJ zp#XqVfWjk@FZ=(OKnVaf75o2}zySa?paB5T0Psio>HGhe^aB7YfC&IKf&c)pfdBxo z!wP^>LI4qwA)p_TzyN?!B>#W^m(&0M7l8l(u(cBa`6CK|Qk4JzupuBGkzfFTQlbJ8 zksJU2m!bj@k%0gJutN)gQXxPfkzfFTQWOAy5)}Xcm$ef>`NIGI7Zd=162Sle7vuu~ zDuMt2uz>&ou!9GHQbGU`ks*K@kzfFTQWOAy5(oePm$v`^7lHr)uz`O70I(wnfKoyL z5s@K481}z#frc0Dw}W0uhnd{{NS}|Nj@Y69D;y`u~@p0RYed^hfzX006Xz{{I)i17FsY zfS4Tt=#!q9I|2BU+L$vCtVj8P006Y00RZp-06_Tu{17Fs-{r{IE`~R2Z0|2T+5r9&F0Dw|r007Wo007WJU<{EV zU=ERU{{NRC0Dw~cd%>u{17Fr3AOqE)0RZp-Xp=6R86VJL007Vf34l^UU<{EV;0}?1 z0Dw|q{{I)D0RZqIXp?4}Ckt#wxxfQo)*m1P)srZjA0ND!~K*HQ)mis+#%# zm*ancQsDytD&hkbs^9|?ss)qXoFf7N`jY~kCjq9DDxE?hLll5g;sY6~;R6_|+Wr5R zfDS?U!1w>P<^TT|fC@mlS(A;O9|3)nt(_ngrbqb!06_VnCj$8a0D#i>8vyy}li{5c z8Qb~)mtX(@(BprAQsM&>s(}H3QUCxEk-3u%o+eh%VE_Qo0Pp}H0FeO7c}0Fl50U)CQW1Jxfa0P&y!0Pp}H z0FkT(08{}CK)F8z0CAxH|5PCWfKmYr0J%l_|Ci(g04ir1ODSal0MKI!N-5$40J-A} z0J&iR0MMnN7Lg$U8Igd00Dw|r007W~9)MCpU<{ED{r{Ka|Nj>sAOqDw0Dw{f3;?+@ z`u~^Y0{|*#8cQjF0Dw|s3Q8&B0|2?>3jn!g007W~9e`4$pcau~007Wp007V-z!s50 zU<{G`{QsBp6F~X>dqJuH!vK-M17Fr3AOqC_1VFg~3;?-*egvt1f6@TC8v6g2WdH!sV+u+s;sXG=;|l<}VE_QorJxp(As`!(fB=9}VgLZp!ykZBLSPJ$La8AD0g?Yh0g>JL{}&Y*8!>Y0|BbI=L4zr0|KhL?*ys%0|P3y z-vX(-0RZs&0{|+Sd_a?X;~0?_0Dw}wF97)r000ypAOqDv3;eQTqRv^8)}X ztNZ_#e*yq;s{Q{|9}oa>pacL^A1nZIAPYl!zyknOv;hF{l;RkX;iHgJl|liLVLhsH zmJEPWg4RH}qk4I`LIeO2g4O`JV*~&Zqk1{GL42W`A^c_2!HNMJ!2h`QQT+D)S>i`TcuCssDolk-!6A)*m1P)u3+xxh?$v zm!NMzxts?85uXnLaUuHuRNepo7at%4)vEXZmtcNClavAgiyr_L>#6wvRPzHDD(CN&5enZwVgLZJVE_QI zBSe5wLSPJ$AwVgSzyN?!XOm5+OAa*n|CfLU0J&fSKshD*lcuOn0nwB7s9yqE_>)$t zG7;GJ|Citc7OJZD|Cjdz0IIB$nW>jDg7*KH;R6+_;sXGx-~$w@O8Ebmp#J|gpff=E z;R72g`U4y)Y5D(`;R66FUFNxdVWJ zQUU;hQlaAjk)D(Bsux0-`u~^n0{|)j0{}GL_y3pV0{|*w006Ln0Dw|q006KfRDe=K zU<{EVz$}ri`u~^n0~IQuA3*s)006Yb_WzfZrjtsmDt}S<|CjXx04ks(K>1(*0JOFC z|Chfb0QsOFK>1(*0JO38|ChfX0Qq(O|1`Sy|CbX0fD+{c04n4I6)Iu?0I*>I0I*|K zfKozW43Qy#Es=l#fKrJ1|CitY{}-I0I*|IfKozW43QxK zERlc!fPYeb`u~^I|Nj>sAOqF&0{|+a_y3pm0{|+s`Tv(5_y3pW0|2Vz0~IP_006LI z006L~Qh-uIU<{EVKr4}e0Dw|$`u~^2|Nj>o_Wzgv!xGV8006K6KrWH}djP5Z0|1fp zQvs>70RXV|TLP(JrbqcA06_VoR|5G00D#i?AAbP(cmM#f4EX<-AOQe0g7^QIrLVgLZJgrF~xLf|iv-~$z^r}_Vv z_J0EaDxU%XYd`}4RCoFRm*V#Sm-GVws$lp3m*xWiDq#Qsu;l|3s^kL}Dr0YeQUYTP zks$yukzfFTQZM@dmvg2^`2YZb(xO*F`C$S;`9S~y%E1W$wewR!sr6ezsr`FEsrVm2 z`TxTbk-!6A*0&n~`L=@rk++ipk>Udts(;`E7OLR`7pg4y|CjUw04iVz05!R51gRKf z43WDl0Qq?U0I<6O0MI$3GLd`Z7?HH20+9lMfYJc~fKuQC6sj)v|CgX+K)C{dfYRXu z6so57|Cjm$0IDAV0P*bu092X+0E=G(6zl2!|5Wn>6siaS02Ch}1J%I+P&Z)?K!3R* zKmd_*0s)JE0vhYW{r^;920*zX{~tDB+d#P=1ORd2{{K{M_Wzgl|Nj>sAOqFn0~M;_ z0~e~`0~V_P_y3n5{Qosz+d#P=1ORb?{r^<;|Nj>sAOqDT`Tv)X_Wzgj0|2TG_y3pX z0{|-J0~4y`0~)HsaDYNt{R04z^9um^@Am(f^8)}X+4YldtQu)9`Tv*T001=r0Dux-`Tv*m3qbh*0Dw~c zd%~zU`TrO4`2Uw(_WzgU0|2V!0~0D@006LI006K;U<{EV;4_iKU4T-60Dw}g`Tv&y z0Duxs`Tv*m3qbk(d%~yy0Dw{^`TrLmAOqE$lku!O0WFg)ttbJ~lUA)lEu!}SmlXhj zQsn~xD&_+eD&zwbDuZEwQh)$}QeprAuweiIutH!Aks+Wok#Cd5txP`x0g?Cg|Cb*y z0Pzg^|5Ts>0MGywK)HVc0Bef*|5TJh0g+*TK$C!aVYmPU01<$CA-JcQWfB=9$Qr`Igm$w^0`MU2!sjUD1 z7rO5Rska*d`H1xYmmeSl)%|u>Au7k@E`x`Lh84umGq>`Jtl#kz%HkzOot$ zRQCUuAOQe1bEcExvLb)^_y3n<_5YXj0|2Vx_5YXU0{|-I0~D%a006LI006MVb%0Vr zU<{EVKsk|M0Dw}l`2Ux*4?y|p|Nj@X4*>aH^#7Ord%mgt0|1fp3jq1E0RYf*;uw+7 z_5YV)8bP@~003)%0030e_Wzg4_5YV(8UeZU3qbk(d%~!|17CmEA0PwO|3d@O{d)qb z{eu9J_%8tY`Zoai{67HsS^z+~SQtRLz$pN*o8lOM_aR3yb8ej7OaY+dPR3HujG=UcYwBQ2-DxUQJm-7Pvs+{%z zm!U^M`Q`%vD&YeF`Fj8Wu;Bw7s$&2EuxFzdk>vv#D&zwbs$;-Ak>Udvs^9|@suT48 zm;3_&DxU`cG2kEoR38HXakC0Q`7H?mR22sRQFj0Uu(ccp0Fn1XKaq736^jD^02F@$ z73&}f094=u6sqf!t+X3|{PX{p`~v_g9|Qm~VgCPAi1+`O^Ys6h^8)~?arOU~G`ZqxN{69eX|3d?jzyn{_A0PvN)j$UTG~o#VwBQ2- zDpmCVm-7Pvs^9|}Dt7b#m!LlY`B3%$mwNyJu%$mh`Q`%vDxpU}`C|Y8u;Bv$`DddR zk>LXzs^kL`s$&2;k>Udvs^9|@s>k#Hm;3_&DzyLq7vKXFs;l$=mm&{AslfsOOC%RS zsiF@GsiH$b`J+RB0+FN_38{d>Ad3?8|Cjs&04g5@05RYg08|_RfKtr={}*8q0JNlg z0J$#p|CgkDK)L1v04kwJK>2$B0I=Z$0QqA80I=Z$9I9ud7Lnxx8Y*KTJ(1!A7pmX` z6so23|Cjs&04kFI{}%xZ0JNlg0J-1;8Y(~Y|CjRv0IC^(_5YW9006M0dqBD70{|+a zM?m>w006Mz0|5DFqZX0j101U50~4xaU^|iG0~e~`0~D%|^Z%Fp0{|+0|Nj>sAOqE; zdjPo)^#7NndqBD1_5U?sVgr$L+CaH`006KBm_R9|8x1Mo0|YAm^Z%FU0|2Vv0~#u) zI{^6}^Z%EBpg#cl`1Jpm;0pk`p+`XZV51h1r5jBt;ST`$r#nFTV*miKp+7+R+}DYqCpe`Q!r=Dq|o#k>Udvs^9|@s!j9%m;3_& zDmwrF7o>Xtxy|$cm!x|@xxn=QHDF=`k#pKWxqAQrkOi1PDWn$-DW-D(x!?mDD&O+| zm!Lm?0QtG}|Citk0J)?WO(|ml0Fb70K)GY!I+3A2K>6nb1S+6MK>6YW7pma{0Quwt z6Dr^j0Qq2}7Lni!0Qunq9ID_06sj!q|Cjs&04f>({}-ft0J*I5|CgkDK)GP<|21G@ z1CevuK)HJW0FVWkKq;h`4JoF30J)p=|CjoI0|2?CmrW_)3jn#MdqBBhqZW~&M?m@K z0|YAJ4*>aN005BS3jq1y101SjpgfV{0~e~~0~0FX0~D$c^Z%Fp0{|-g{{I&o0Duy= z8$kIc|Nj@6_Wzdz^#7Oh0|2Um^#7OT0{|-I0~4y}0~#u3qZW~K005A4VhoWZgMd+}DY^8)~?Y4rb>>C%Ih`uk!zwq5%M~;R66F-~$t?LadXPxhiF2 z006M$0|2UH-~f^0e}K{ffPm7o^8c3~1OPE1{r^-z_Wzfw^Z%FR0|2Tcjet^s0Dw|r z0059-006K;U<{EV00EKv_Wzdv0Dw~F|Nj^Ld%mgt0|1fpQvs>-0{|-Y0|6?FlP$U% z4K(%tm*E2xD&PYXD$$cwx;O!*la9JJ0qv8;x;Ft+ll{6wA`aHE8nxm!JXw zHFKs%`JwMZ`CtM-`5*uQ%3vgumb@N+VgLY;VE_QI!;pYdLSPJ$Az%WLfB=9}nD+md z?f?H5mh=CY;R6^d-~$&bWAp!)Uu1OO2MFaf#9^Z%D&|Nj><^Z%Fn0{|)l0Dw|K0D)2<0Dw}pll8qTe`@momjDd- zH@Ra2k;4su(gFa0QsDyws^9||sz>qvm-_<%D!>N-H6Q?hQlPT|dEWE?m*N8es(}rF z(jW@}k$Um}mtY70HNp*mQsDy`s^9|_Dy{MVmp}smG?d~Pk-=%0Qh+K!xdH?LQC|Q7 zYe@(IR388Uao`u98h|PRf4LU*|CfRC|Ci(g0IFgD0FYq-0I&vXm{R2f8Y;skfKozW z43QyV1(ARNfKt!(|Citc7Ah71fD%0Q|CitZ05!WSK>6SU7AkD@|Cb;DfKo>F|Cf>f z{}%xD|Cej>|Ci(g0IKB!8Y*G{0FYq-0FWamfKozW43Qz=Gm(G*e}GcD_5YWu1OO2MECIQ3^Z%C$|Nj^7^#7My^8c6R0|2V#0~#t~0059-005BW0~;zMC4f>w zU<{EVU=xvm0Dw}c_5YW*|Nj@{0{|*w0059-006M%0~#vhC4f>wU<{EVzyy(i0Dw}S z_5YW(|Nj>N1OO3$e<}gF%>Vxv)%5?DK=S{Wad%fB=9}kM;kTmjC}3*FmY`|Nj@X*8!>3@c)^0k@E`x`Lh84kfIL}siYSYsiq$jsbZ#+hQdM)!1Mo?U;zL%wAVqY zbEcEl!frCp{r{J=*FmY`|Nj@X*8!^0k@E`x`Lh84kfIL}siYSYsiq$jsbZ#+X2e1cNb~=fU;zL%wAVqYbEcEF#BMTI z{r{J=*FmY`|Nj@X*8!>J@Bf$md#tJb0|1fp3jq1E0RWJrlM$(2f~ldi>X0U47W#upx?@Bf$md#tJb0|1fp3jq1E0RWJt zn-Zy~p8)w~rjxqNViv{n|Cc}n05!DNL8-RiLaDePK>2f~lgh?AHAAj|QbJ%1ks&|} zkzfFTQoZy4m$VN+`Ro7x7h(VakYNA-up_R3QbJ%1ks*KzkzfFTQnZsf$5R2lla0q8 ze@E~Cm%syG)*m1P)dCbiDFg^WxxxVeHT`?Psr>^0ktG5EG@twcaVP@-RG|R?kRjk0 zkpKXIQX&)^DJ0+kx&3>=sK5hX)*m1P)u90ZkRjk0kpKXIQX&)^DJ0+kxxfQo)?fgD zQbGU#@L>P|kOTmLQp2@?QbJ%1ks)9VMUi*&|Cay&fD-Qi{}*5YfKoyL0PtY|0FXnr zfKozW43Qxq4Uum1|Cay&fD+~Z{}&%11J$7c0FWT81Ni^|fKtE%U)GZ_$`}FolS#^B z0?Y4{uF4uVKmY*nc0VE_P-!@Ph}Apj1MfB=9}IP?FP>i_>2p#cDp z-~$sXGYkN^3-Xh$$`(FC008h|005BW0~0D^y?|0eU<{EV;0}?10Dw{z0DuxD^Z%FL z|Nj>sAOqDF@&6YeAOqD1^8XhfAOqC~?~_u?HWF;`|CjxH#i+moU)CQW1JzXTlbXvT z0j86_%SIC6@&A{A0RT0$*FmYa7eM)QrjxG4ZUXQ7lODzv0(2f~lgh?2K0*Kh@L>P|kb}j5QbJ%1ks&|}kzfFTQj_xk zm$VN+`Ro7x7eW94@L>P|kYmMwQbJ%1ks*KzkzfFTQi}4EI>%B1llzm7#~xN4?*Etl zd%UUr0|1fpQvs=y0RZsy0|2T30D#hArbqd|{{pEZ06_Vo9{~9R0D#go0RXh2qX3bB z0Dw}8@Bf#e0RT0D0zmno7eM&{00HX&P@kG}rjwq|B{`5`005991AtOOpbwED;1H2Y z^8c3r0DzM4|Nj^F?f;hm7z9&c0Dw{e1OQPV6aaAmFo7Dt17FsX&vY)^@c)K7TOp|CjRv04hT9 z|Cg=q|Ci+h0IK8z6Dnc=0FYq-0Fc87fKo!B50N2Y5s`oZfKn3xfD-%h|ChKQK>4)S zL8-RiLaFHg{}&$b|CjUw04gx?|CgKY|Ci+h0IK8z6e?l>0FYq-0FXkU50N1t5|IN6 zfKq?}fKux5|Citc7XzvU?vrBBV+I2gkvXFelgrQ{GVSjFmj-H>Qsn~xD&zwcsv`}6 zQsM&{s^J3|s(=81QoZs2mjHc$QqS)Hm*4{ws^RRD9?>oWk?xaD(G~)q@RMfIGA5Gm z|CjRv04jh205#wOK)D9-|Cit7r^lUmn-i7m-Pbxs;Tai{?QgH0}g;vLZA+JuR0t5h2;Q@kDUjPAXC<6dgpaTJsA50&(u<-wv^aB7Y9|Qm~ zU;_YDpf^Cd0|0(ldX+Cy^8YfD$S3 z|ChBBK>6?g{}*5Y0FVISD3N&V|ChBBK>6zb{}*5Y0FV>_fD!-zDv@&R|ChBBK>6hV z{}*5Y0FV>_fD!;eCy{LI|CitY{};6r0Qu4E|CjxHy{Y{J0Fm=k0jZM#0Pyq!0IFi9 zNBKhlK>4E=0Qmy|fYOts(;O;r@c)+|1OPDr0RU8>CqTIa0Dw{g0)kTE0~D&I?*Eq` z1OPGM6Q5dhrjzQ^Cx5^vk?-*TmjD2O67&E67hnJYkN`j@kv{DImjD2O67K*17o+U| zmw*8P@Bo-c`M?8T)*m1P)lTpK7at%4)%|^0k@E`x`I7+v@Su|bk#nX;`C$S; z`Jop8`2hfc(nIk7mmdTGF`ySf`C$S;`2hd{%Ao)Nwet%=`IC^;3_6MI|CjxHy{Y{J z0Fm48;0Qms`fYQh9|Chi405qVJ0FmhL|Ce*7lh)KK z3IOc?m-7Gr7jEp63e`1N@Usg5`SSw+s@Bp+`2dN4(zhD``PTwK`C{+?m-Pbxsz3_> zv;&EN(gFa0QsDyws`%^wm*N8xs^JHK(%=IXsxa*Tm*Iba((?lVD&hkas-OY^kt^(z zmeoEEBO!oNLSQP9ApkCsi13r*)gynvERn+?fKq?}fKp-r0FXjpDv^5d|Ch86K=~j5 zfKvT?#HhdnU)CQW1Jy$yfKq?}fKp-r0FYq-0FXjpDv=?8E0J#S|Cb;DfKvT?#Hhdn zU)EzFfKq?}fKp-r0FYq-0FXjpDv==|ERkgJ|Ch86K=~j5fKvT?#HhdnU)Ga^))iG? zDv=@JFOkC{fKq?}fKpcQ|Citc6{>LT|Chi3fKs;`K>4#%L8-M{LaECC{}+ny|Cjab z|Ci(g0II_wfKq?}fKp-r0FYq-0FXjpDv=>TFOfy?lkV190%GiwO4nW*gC~GefB=9} zVgLY;VE_P-LSQP9A)qsn5b%@2*D3GUmU)DnGUmU)CQW1Jwxc|Ce*@|Ci+h0IK8z6DoiJfKp-r0FYq-0FXl{fKozWDv=>TGy{>s z@00r2A`U|)fKozWDv==oGm*CMlPcLKf8rgH5AFY#9|Qm~pacL^l>q?IpwdVA002Pw z-~a%$vkL(E6CgtQzU%*&-~$t?v;Y6KvkO4^fZ`pIt?vJq9|Qm~U;zMBl;Rzc-~$w@ zc<%p~wbDoVpE3ZszXAaH^w&YD{d>cxzyn{_A0PwO%SY7AoKa6{_Xx|CjRv04ksi05p#7|Cdw%0Py(h|Cf|vDv{*_0IK8z6Dr~Z z6skc00PrDTHjzU?fKq?}fKo^A|Ciw69g))jfKpWMlk(as9zp;B@Ie3o@a2DiQbRz1 zQbJ%Vks$ysk$?bzQZnz8I@=y5KmY*nfB=9}GXQ{6LI42p zLSQP9A@7rZ+ZumkKY&tz0Dw|60Dw|L008ho008hpU@DOzfGd#`@Bf$J0~0Fq3qbk( zd&H=~17FtQ;vJE50)SE+?*Eq`1OPE1`TtZ!?*Est>;IQyLV!|2008jh0|2T*U@DP8 z008hIKsAwo0Dw{e@Bf#y*FmYa-$JR*|Nj?*KY&tz0Du-!GXQ{6LI42pK>z^oLSQP9 zA;2|}^^+~!9B1MkkrM!bQvB`zmmdTGF(LK;R3+~JmyqlKm%~ATQsDpp7at%4)gbQw zmy7HFm*fKgs)Im)QbGU#@Ie3o&_ZA;ks)9Xk$?bzQrqtTmv{gF7ZvXRmw@a4m*fKg zs$)TbQb7O!@RP9IOn+1W0PvIoIg#@N0IIcH0;%Bx6sosl1F7@r|Cd$(0Pyt#0IIE zfKq@005sSD0JOm(Ig#K47^)ua|Cb>EfKtE#05kyrfKrnI01LF?LOGG(0~4wj?URPx zK1QQNfKq?}fKoyL0PsNo0PsR!Dv==oIFX6&|Ca#(fKuQC0V@4_#HhdnU)EzpfKq?} zfKoyL0PsNo0PsR!Dv=>zH<5nslM3EO2SWe=@MB;(lULq7KEps z_U!+c^8)~?zy<)cBLITZ0sw$g;R6GzjOqWEzXAa9KmY*n0Dw7>A^?I?;R6$@005Ml z{p$ahKm!0Z-~$t?!s-8);R66F-~$t?*Xom2-y(lN008jh0|F{R008g;U@DOX0D@A3 zOMp@#z&eqD0Dw{x0D#gN?*Esy6F~X!|Nj?K?f;j(>i?JJ0|2Vz0~M-5008ho008hp zU@DOzAUu%+O@LB>0Dw{q?*EtI0~4wf0D#gZ>i?It*FmY^|Nj?4?f;jp>i?JI0|2T+ zOn`qz^oLSQP9AwVyYfB=9}{q6skwAVqY)c^k%z^oLSQP9 zApkv*<4u54fB=9}^X>na-~$t?699nH4C?=vwAVqY$N&EqA0PwOLI42pK>z^o!%Bcs zLSQP9As{-DfB=9}699nHHnA1006WC0D@BC0~4y?0~D%f>Hn8N0{}I(69D-F0D@BC0~4y?0~D(5 z?Ejbb0|2UE1pu_*0~4y@>HnAD0~M-4008hIz&?=`?Eja*0s#4-1^~3+0~M;->Hn9r z3qX?-;UPlL>Hn8N0Dw}n3qbkw4?y|$7eM*_d&8)}17FtY?EjZj>i?JI0|2Tc8-P-P z0Dw|L008ho008hpU@DOzKrfM_?UQ!lA|62i0PsR!Dv=?;J&^+)fKq?}fKrw1|Citc z6RNN2leXb19zg&A@IqiJks;tdkpmupQh)$}QiJXPm*4{xs-5YR{^79{(Dxev`S$|@ zs)VLT`SSw+s-U1tlf&XI7G&xFm*E2zs-pt|k>UdtD&PYXsvGQ+2IC?E#^{qO<4yv$ z=#zTmQZk|F|Chl2|20AY0PtY|0FdMZ7OEkj0FeVOfKozWDv^KyfKmkQ|ChKQK>1+; zfKrsElm6p60=DdvI^-Hfd+7g{0RVtf^8)}XpaTFkxF10I<^TT|A0PwOAngB_i|PND zz^oLo9$&A%H)TLSQP9fB=9}+LM{&97&)7kwY(lQbJ%Vk$?bz zQqS!FmjMERQn(*L`OE+R7YFSBmvZUP|kOMG)QXyahkwRc9 zk$?bzQo-z#{^S}0YUq<1-~$t?%j*A^ z022T;AOL_;U@`!?;R6_|phE$Xwd<44i?I31^~36V^TR20D#gL>i?G?8~}3R{{K{f zYI8Wl=>L}=8~}1*1^|)Z0030;0|BalYI8Wf=#x(78Ups`lWOK30;1@Xisl+#m+AkP z^8)}X;QIeGkn8`K`{@6d;ISA=>M1H z0|2Vz0~0D?0059fH-J*&0~o3yAO?|u0Dw{}?Ejan|Nj>sAOqE8>;IR}=>M1H0|2Vz z0~0D?005A~H-J*&0~o3yAP13v0Dw{-?Ejab|Nj>sAOqD{>;IR-=>M1I0|2V!0~0Dj z008h|005BW0~o49G=P6nLSQP9ApiuCfB=9}a{z!+5bXb#&j0@xxobqJ%>VxvNbCQX zv*`bq<^uq#F58KyZ`?eA0PwOHtYYFa|VD?py>aXP|kV0T8ks&|> zk$?bzQt<2lm#+W+7rAQ$sh#Klm;HOasY3t&@L~V}kYj*3k^KVzk@HglsgwZ#&_W;y zkpTjN(vzA;`SlY3`Sk+;D&PYXs-Nlqm*4{vss-o&mjD6)GywvFQs4s6SU0V?xTL8<+F!>GUmU)CQW1J&RI6RK0_ z|CiwY|1@<005kyrfD+&X0V?$qK>71iL8<+F!>GUmU)J*I|Citc6RJq)|CfOM|1^P` zNBLj?0FVGc36Zbs|CjX>K=}axfD+&X0V?xTL8<+F!>9zn17FsY@aP$T;vJC@>Hn7> z1OPGM1OQZ&0RXUo(nt9K06_Vm006WTAVT@U=l_@B0~4yV|Npg=(ntB=0~V^E0s#3Z z=>M1V0{|+Z;vJE!>i?G?1OPF>0030r0~0FqQ$eZqTSBS*d&8)}17FtA>i?HJ=>M1G z0|2UHJAhJv0Dw|L007WVK>z^ILSQP9AwV^ei|hZF-~$sX^HV{o^;<%z{d>cxzyn{_ zA0PwO!0P{(E9n21z@-LSQP9Az%)XfB=9}d+U?d>8c(hRDe=| z0Dw~c0|1di007WJU@DP8008hIKnjsb>yw`99)B6<|Chi305$XG|Cay(05$!4!KlCk zU)CQW1J(U|!Kgq00Pp}n43U54{}=sx!Kgq00Pp}n3z2)~{}=sxzp4EL0Fhwo|CjxH z!Kg;){}&%11J(U|ys7;I0Fm?$0QvRi|CgW$05!7<0Qr*v0I>7}04j6lNBLj^K>5G` z0Fz7W83EIiW$Pb*XXgKxbpk;7;pzXEK>z^o;sXGxAwUh0<061k-~$z^i|GHCb^<{8 z^#cGZ*y;b5;sXGx)?x&aK>z^oA%G2$<061k-~$$_f$0C2b^<{8wE_St&guV`;sXGx z*1`yp<061kK>z^o-~$$_A;1lhcj*6@wE_StbpZf0U;;n~`Je#+v<~N!3hYuUKmY*n z000h=A>>E-Apk)6KL7yn004oSzyn{_fdK%pKmY*n0H6+$A>@;W>>dh0008g+Ko5~2 z2f~lUnUI0yyZC zlI=nwLjVBq-~$w@W8e>wq6Pp_C+7c`v=2b}+yDO;v=0FJC+3s(?M@Bz<^Pue0suAO z0~D(ClTq#$0_x?HYVJlV4Cw!t-~j-%0RTWbp#cCigz5j6U;zL%66yb!AOQfh0RTWb z;Q#m}lS1!4M-b@$m!UU6`CtM-`5*uQ%76d>wet%=`Tcv+sK5hX*1YBa zmmeSl)%|<1sX+h$@cjb-k@E`x`I7+vu=W=K`F5s9`5~l1lgIBJ0*~dB=IHn9&2LLs*=l_=iG=Ne;2!K+^>HnAX0{|)j2lzL^0Dw|}=#zr*CVxif z|CgeJ0g>SY0IC20fKpEA|Chi4_&1?TK>6T*pVHt7pz=Qe0P8IQ094=u7pj)#|Ccr8 z|Ca$IfKs>V|Ciwd7pmX`6{;lX|Citc7pl_b|Ca#)fKuQC6e?fn|Citc6e=O<|Cfm8 z|Cfj6|ChNVK>4)SL8-T6L#cD7N0TSHnAW0{|)j1Nb(0001=y=Kq(#0RS|%-$JRl=R>Kw zCqVhNrjttYG6F^ElYa6V4pQX*m*4>aHQ)mls^8?3rt%^(vgrSp-~$w@ROkPf(f|J! zdg%X`<>mjE;R67wKmY*n0DusYE$RQ4-~$sX699k`rs$LU@+LCe3jq0(0RXT94FahI6$7cJBLn%TCjb}0|2T7000ypAOqE54ng=K0RXh%0~D%# z=Kq&~|Nk}M0~4yW4?y|z3qbk(d%~!|17Fq?0D#i84?y|g0~4zA3qbk(d%~!|17Fsc zutNbD5+CpYap(X5RDl5iumF5~lOfoXlJ_M6(380LBLUEp-1iv*;1QGe_ar~Cw4(r# zW2Q&>-~$w@WB@?UXCKmY*n<9~os;sX?_K>~nM001qK!{`5(fB^tB z004kebEcD8_$n&7=Kq%;8~}1a{{K`$0f15g0D#iq0~D&W7WpFq?Xx=hDFFn~AwV3HXZn%>q?7vkVgjq;lV1BG1y1Jwm%)>T`!){H zK>z^ILSQYCA;2$@;FHPwA`Z|&007WJU@eg$ATN>Blll7|63{^a0MG*zfKozWEs-IB zE|JKSDf}b>rjt(mCJJ%p|Cc}k05o%^lYabG0(It-*8CoSZRY=%^#cGZAOiR|wOc}| z-v9p>%;o==H{<`8<^uq#z^IgBXBPLSQYCAs{f3fB=9}h35a4 zwOc}|(EtAzzUBXyDdYc_<^uq#z^IHVbNv!Irbqb!06_Vn9{~9Q0D#hT006Xr0zf$+0su8a007WI007W~8-P+m zU@eg$KrxYk0Dw|t=Kq&-rjx$?Hfa&&|Cb>C|23ftMk%!u0Qukp6sn-(|CjXx04jh0 z05!D}K>6wa{}&%11J#D*|CjON|Ci zF_C}(fKor^|ChBBK>6DL{};6r0Qu{aUH%*arjvU9A_3=7W9!l-@W{}&+ufKuQC z0V==)U)CQW1Jxk|fKu}dK>6SU0V@4_!l;!H0UQzW;QyBZ0RT1O0Dw~90~4yrl|2C$ zS^wn!m-7PvDnS4LH2CEImt*4pm*N8es^J3@D)S3K`Tcvss6zk%&|qLQk*MYW7at%4 z)xZN^)*m1P)$HW|msjHdm-7oi`Tcvss6qe$(BT6BszAUpk)4&T0V`(u0syoE5J36h0~D$#;s2NO0{|)$1OPSU0~D%4007WI007VfE`U-(U@eg$05_4q z0Dw}C<^Pwo4?y|g0~0Fq3qbk(d%~!|17Fr+006My0~D%405Opj;g>!E0UCcJEPzr% zU@eg$;53nd0Dw{x0DuyC<^Pwo4?y|r|Nj@VsAOn}z0RbKbAUKhd;FtOV0Uk1nsAOqFn0~D&^0~IPj007Vx0Duwzz&nxYy*CRLSQYCA>cHTi{zIk1pz5b(8D}{QbJ%Yks-i8k$vR`2YZb60=i5sh|J< z7l-5jm-68Mm*)cjs^$X~D&+$cmp29h5e|brfKozWEs-Gr0g*rCmsSP=HWJ0(|Cize z0IJ~w6RO|?6snEkm!1XzHW{`M?8T)*m1P)qnv2kN~_#`M?8T)*m1P)qnv2kN}XE zeg^>>9+Lq8kdy%ckYJ`q`2hex`JpEQ`2hfc()AMn`IX9-wg&+oD*xaAmp}jj@Z*1g zQsM&^s(}H3QUCx1k=^6}mp}#pHMbi8`5*v-(v9Mm{s#dTNh9C?mm&ayQsDy^s^9|_ zs+ZvZmjDO=H3JBM(&7Ubsv!t~(%=IXs)^wLmp};sHQ)mms@~uKm$w^0`IO2>`Jn)S zQs4s=s==3C2mu!wV@QBfLSQYCApi%FwB!GmwiiJ8004kebEcP$2mvjB&_VzJuwy_3 zkwPE|ks%0x(%=IXs$k*&m*4;Y7r+33QbGU#ut5L-&|^e^QbJ%Yks%-hk(lHEmjD2O zQsw{u7at%4)nEXCQb7O!(BuOYssl)XQbJ%Yks$yEk&fg4m$nx``2YZb659X&7slfM zmoeb~m*oQhs^kL}szLyN0I)#-0MJ5UEs-IB1d(G#fKq?}fKq_t|Citc7pj`y|Cay& zfD*RfLaECC{}?`f0aO6+;~#+1;sY0| z0U&_Vz`jTMVeK z(g7fV(yQM8m-GVwDjx&@F+u$QR5#-Pm!jYQm*N8eszU$((BT6Ys$d`pk?G?9m$u(R zsign^7cS!emzm%Hm*N8es^J3^DnI}L&;S4mk>KM0m*4{zsuTc#5(VG?m$u(RshIzN z{}&?S|Cf#5|Cize0IEX(0MOwB7OG$%3z5{~|ChGkLaC4c{}&nJ|CfZ{|Cize0IJ~w z6skY~0MGzn36aa<|Citc7pfEhfD-WD|ChGkLaBrQ{}&D7|Cba1fD(7#|Ciwd0IEO$ z0MG#72$8?y|ChGkLaBQH{};C30;zWa-j_BE0XjZR-v5{P0|2Vv0~M-C-v5{20sxC2 z02Av-0svIv0~D&^0~4y?0~V@2-v5`N0RT1P0~M;_0~4y?0~V@L-j}Wn0aIP#NBMvP zKsmqw05o9YNBQ$pL8<+F!l=LlU)CQW1J$_Q|Cize0IER%0MG*pfKnj<43Xdi6siW` z|CfON|1`q{fKq?}fKoyL0I)#-0MJ5UEs-H043U1~|CeCmmtGA4BA4J80UQ=N;{TTd z1Q#;Eh>21G0D{us>8Nrr-96`WgWmDtq1kmwy5PYvTa` zRHH&Ri{S$kDnbANutFdSk>CRqs-NHgm*4{xsyW@4J{ti^7x18y0Fhy)NBJTEK>4B< z0Qmv{fYK%5m!2B|779P$|Cc}k05x-_m%bYTA~Epb|Cd|d|Ciwd0IEU&0MJ0-50Rtc z|CjOq{})}||Cc}k0JQykzo`KLfYSW~0FgYGkqrSW0V$Wg4FOL9m6r_;0XPAsmqrc& zGXbWTdJX|D0UDR74gn(pk(bR50Y4R;-2az=3P8Ex0~V^FGXS~Z0~M;kmmv=UGacvL z|CjxHy{Y{J0Fm=k0jcx@0jl*A0QvO;0IDpPaSs7c74Y8wmmvQCG!p=T67v857vKXG zst1?V4*^08@b=#VsrLf_s(_}KA`k&W8Asgzm*4{vs?FU0mjDC+HQ@sms^9|?stuQY z5CIn+%ijN&^#cGZ-~$t?q}~6QzXAYpvkO4^_5+_6SUpIVfrm#Pr~LM2h%|Cay&fD*F{K>6(d{};0h0Qo%J z|Cb*i1J#n-{}&%11J#h15fT9x0n(Q#5&<&-6_;HS0UIGk;QtpNAOqEq-2WFJAOqFL z-2WFJAOqFh-v1XLAOqD(mzfd)qXDUxkqrS8mrxS{AOXymaT5VI0lt^169Fp$KbMgW z0TY+d4FMDZnV0<&0UrSgmmL%V8v&}9ITQgS0nwLT6ag0zf8GBVAOL_8zyn{_KmY)= zkC%lM0UrW`-^0k^SA5ZWaMD0eF|876C&6 zgO}wN0Y3td+?Q?^0UDP;7Xc6fbeB;V0V@F+mwgujD*-B(sTTno0@K@5P7y&E+rk7qA0WtxYmys9&8v;Svm%a@F8a*=H{}&%11Jz&w0MG!$ zNBIB%K>5G}U)CQ00P!RkKze`y095^Zzp3H_0V?4G0IGli0FeCy0FeOTDUoNFkqrS8 ze*gf062Jpr*8O|Dsr>^0k@Z^wsr3T_D)$=z`St?=s`mo`s-b28kstto(jVIYmmmlL zw6jwIsq+H>svjr-d4K?bQsV;^s-Xq|5nu`cdGrGns&!TYDdGbbs(%syxnN=dktN*! zm-PbxD&PYEHG*OQ5#a+9s^9|`s{7slf0y+G04g8>05#wP6RN-3|Ch5x zLaFx~K>7W9#HhdnU)JOU04hQN0I)#-0I)&;5s@Jv6Olt0fKq?}fKrv-|Citc6RNM; z|Cje0K>6SU6)Lk+L8Q$eZqTSBS*d&H=~17Fs) z-T#*r0Dux7+y9s30|2U{7JyPh006K-006K;01=TP;1Q940Dw|&-v5`)|Nj>sAOqF? zd$y_l0|1fs-vX(30RYhRQvs>-e**xj;HF3Uzdr!^0RTYxp-%w$0RVu~Vgf+9U;F@Z zs1N{DlmP&cfZ{2Uq2mFO0C+_CUflneAPE39pg%zQK>z@-xE}!d0tJ9lAwU(8kN^Ld z_yYhc;1K{dxoZTexq||cyK@Dpx&s1{VFEz8TL1vCwG#mOU;`MDRsaC7f1o!2`M*N| z`Jf{Lk-rBKDZi5dxj#=GxS%rt`Jg{Q`BeY_u;T+6sUdys_WYSmw*ERHM~PW z`MY;Ox%>zKwA%;(G@&;@`N9N%(%=Ies*>CPmmmxPG@>&=`QZZ`s(|7tk-Likxn$k{ zmtYA1HK0R4`CtG5v_#tff0w^Q0Qq48K)DzIfKs48K>6bX8LGc`0J-7=8miFR|Chl0 z|1{(S04l-)5s^Uv0I(sT7LmgnfKq?}fKnLV|CbmC01 zPeA$M0zmme00GK@2mrP7Q$eZr-$JSVd&;Q517FsF0Dw|K006M%0~;#j101S@9Dq{7 z0uhlRKo^ne-T#-Me?vg|U;qHL0^0wVze51|zjpw+VFEz8qW}LFA0PwOLmq%q!U7SI z;R6+_fB=9}+};0|vH$-URsaC7z@-;~9Wb!U7SIA>b2{fB=9}lmP&c(%t`; z%K!ftfB=9}K>z@-Lmhxp!U7SIA)pwM%iaH%phH0UAOZljf4JvEsk-k(skIY8`MfVc z`Mv-D7at%4)m8uiut5L-u;c?1s-qf!Qo;feks;s}k$?bzQoG&%m$)B5`Lh527u4DR zm$ef>`MBppslP)2`MU2!sk|>h`K$l`7r5sGsk-k3skIXT`MfUx`CZxnm;HOYsr>^0 zk@Hglsq_N?e=2|h0FVISDUpJHdy@d*Baw3f0MG#d0*hp(NBJWNK>39LK>4L70Qm&~ zfYKuZ0JK5?0I)#-0I=i(6e=SifKoyL5s@L_B9VXqfKrv+|Ce*7NBN;AK>1(-K=~j5 z0Lp*_0JZZ|L8<+F#i+moU)Dna0I*|#5RqpA0MJHYe*lq4Kmd^j00xU>6hNsa1OWMI z7(lsd2tfJcut)g=Xd?KcqX3aK7y!8d00@humjbD(9{~BOLjbwr+y9rK{Qoqx-2ay! z+W(j30|2Vz0~9Jk006K-006LKA%Ids01=TPz$1}>0Dw|%-T#-_|Nj>p+5eXxAOqF? zd%dZGe*pln{R04z^HTw-a{&O*p~C=?^aB7YW2Q&>K(s;m;sX>aWB@?z@-cxzyn{_e;*(N)u0nV`9S~xu)+j@QXv2sk%0dH zmtX+^G(rFXut5L-u;c?2Dgz^cQbGU`ks;s}k$?bzQaj!Mm+Ali7at%4)u0nV`8(SG zm!SOrG(rFXut5L-u;c?2Dq|ynQbGU`ks;tDk$?bzQZC*9m)!sV7u?wYmmeSl)gSx- z4{<02095^Zy{Y5_04n1Wm%=CkBY!|9kyQWyu%ZGHks96qm*4{vD%1f0HB;OFm*oQ# zD&zwbDxv}rk@XWm`SVjjsX+h$u>E_(sG}2rQXv2*k-z|eQViYy7at%4)#lp&m-GMs z7eW94ut5L-u;c>(Dx(sBQbGU`ks+WZkzfFTQUTrn7a-XG7at%4)%|`2YZb z65s#-7qt@r`E%HpzAXV994e9b8vyzA0|2U5006M}0w|Fc0Dw~90~D&^+LvxD0WubY z2Y^z50Dw}a-2a!g1^^L&41iL%*_XB~0Vxa6^%DU3^#cH^V5XPqECDhC4cwO=Edd(= zrk6S`0YVPL34l^U04R|mfGd%1+?R?i0U8>k34l^U04R|m04tGX-2ayV0DuzU|Nj>e z*q6R70UR7Gk@p(_`Sb$-s#gF2u=fHekre=dQs4s=s$bfd_ALQ276S}`Qh)$}QbgSU zm$e1}5r7PUQdQZPJ}v<&0*=?0YAyj9Dr?*Sm)6+-m*oQhs^kL`Du4ihQbGU#ut5L- zu!9qTQbGVIks+WhktN)ht}X!@G6NHUQbGVIks$yrksI9qmjD2O66pW`7yWy^sUH9U z@%;k;k@HglsdE7U(DVZVs$r&=`Yr(;CK}oQmtX<_HJ}qf`QQWqw8Gl|mmmWGHK7wg z`2YZbQh@>h`E#b1J}&_}f8z~+QbGVIks*LCk?-68mjD2O672u~7vuu~DnbANut5L- zutESRks+Wjk%JC^Qh)$}QsvwKm*4{ws^{4MmjD2O65#*;7k~hOQbGU#ut5L-umcW& zQbGVIks%;2k=on;mjD2O64(F#7l+sXm;HOZsr>^0k@HglsdE7U3()if0jl8x0xDvr zmjW;WGAbL`|CjXx04iVu05zZ+K>2&x|Chi705zc-K=}XwfKs&+K>2|J0QqyKmtHUd zEq{sAOqFn+W(hL*#DR10|2Vz0~IQO0Dw|L z0059d005995r9%c04R|mKr)e>+y9pU0Duy;6F~Xk|Nj@{0{|+c5r9&F0Dw|L0059d z0059e04R|mpf8b;+y9rK8$kJ!*#DQc6MsPY004jz)Bpb$fB=9}LI41eK>z@d0}y~x zLI5a{ApkLvh1>s^004jz%K!ftfB=9}LI41eK>z@d;}3vRLI5a{Az(0(eB1w*004jz z!TKs{R04z^HTw-a{&Ob^aB8@V5Ud;0RTYxp%(!80e=91 z(li19w4jp!k&D^?mmmWGHKZp%xt|08ai{?RQ~&^gQiK8kxpSsR`Jxv<`C$S;`9S~y z${_;)wewR!sr`GysK5hX)&Ky268HcA7k~hOQbGU#kU;9-fK>4E=0Qmy|fYRUr092xr0Fj;9|Chi405zc}K)C<_ zfKq`10J(FfNBN=`K>1+;K>0xc0m=aa0JZZ|L8<+F!>GUmU)BHsfD-rr{}{ z0Dw}n3jq1Eg8`AZ8vyyBe+()20|F}G0~4ws+5eY7696@~7XbMH|GyHpXF$2Z1^`h% z003)F2oV5Ov=0FJ;R6;bAOL{UVb=eb^aB8@fD{0&IoSV~;1K{dpff=Ez!aCVGXXXNSlE~9GXWYsjoSa000;mz zp))}F0|0Tszy$zQ-vSeB zgO@=x0V97o*#DRH0{|*O{Qori+5eYi*Z-H~0|2T*0059d005999)MCp04R|mfH;wW z0Dw}p+W(iJGeG$j0Duy}0syqp+5eZkFF^Ua??kEK0~D&s*8i8YQ$eY=-$JQi0RXT8 zq(}MS0~IQwH$eFz06_Uc00GLO3;?zG=R>LW6F`6Y{d>o#zyn{_A0PwOpff=Efc^iq zy6;4(ye~lc?En84A0PwOz@dqaJ`#LI5a{As{)CfB=9}k=p;4-2eX< zA0PwOz@dBOicLLI5a{Apkm&fB=9}huZ&_(*OS#A0PwO&XMkfR@fQbGVIks+Wuk$?bzQhnP0m&pJB7Zm`2643wu7vuvLDnbANkU;u9m$M5%`L^Fesl@;P7vuu~DnbANkU;A-vX(+?*ys5F97-L)t8Po0U3X=_5%Z|p>F`Wq#8i_LZnCe z#2P^QLjXYeqgMd=0|0>1_ZtBDAQ=EuKl}i3=okQ0p~C`^xE}!dx+ehnA^?C=zmovD z_yYi{Ka3vuY1jXk`U3ze;1B>cp-({hp%VbKphE(Yphp1tpi=^ovr_@7phE!pGys4S zpo0RDyK{d9sktKn`Jg`l`3?X86dxc1)t~}E`9J^wv?|vBm!MBT`Md%E`O^XbxqjCF zm-+($Du5FJHJ=6maiLE@`5+PiRHR2h`6U2=QUd^h(gFdXQs4s^svFqK+ zHKLD4sR00hQlL*j`M;L{xxZ5Y`8(DBm-+($Dqt8505!W)K>0fj0JLEvKsg`)fYR3j zK)HFBy*B|De@)f@m;3_&s^A9zw4wq)`DcDWllKD`Dk1>@wBrL8s^J3%s;4^u`B&Hf zmp}*rHP-?_xp@OXxu-io`G5l#i{k?sDq<%9k>LXes!rGcm-hnzDuDR^G!NPTmwML! zmqRCjQse^wszLw&kU;1(*0JP=U z|Chf{0QsN-K>2_M0JPoJ|ChNVK>4#%L8-fQMXA360Qp~M0C6A>090R-0C8Xq08|$M zfKr+Z05!NDK>4~SK>1(+0I&h1NBQ6b7b>DxK=~m6K>0xc0m@+x0JZg7LaFx~K>7W9 z%c#Hue_z%gAOqFp*#DPL*8i8}0|2T+CV)~x0059d0059e04R|m;1Q940Dw}T+5eZ< z|Nj>sAOqFd*#DP9*8i8oCV*1O|Nj@{0{|*Q0059d005A~Du7Z#04R|mU^kI~0Dw}F z+5eZ+|Nj>sAOqF2Q$eY_b497SBS87j|Nj?4e*gfGK>z@dz@d<0^nsLI5a{Apkg$fB=9}7XW}#dD;J$xF10I zx+g&S!vFslA0PwOfdT-u-~$1wlGy*3vr|E-xaUKuy6;4(ye~lcx&Qwch`KbT@7o~4Nx#R;HDnbANkU;na!m$)B5 z`MM`S`J4a$7o=}Mxk3N{kU;4~S zK>3gV{})040FXfd0FWavfKoyLD3Kw+JdvbtK)Lk){};1U0jap>1F5?21gX3)0Qu+C z|CjxHzN!5K0Fm5G`0JH!AfKu}dK>7W9!l=LlU)CQWe*@J) z0059c00597z&?=xKtGWt*#DPc0s#4-{{OXL0Dw|L0059d005A~1AtOOfIpETARdt& z+5eXS0Duzh|Nj?a0RXV!0|2T*xJUUy06_VI006W=006K6fB=y|03X%>0Duy}17Ftt zd%me*0RXT-006K;0)SHe0|1dBfBZ-J0H6So^9um^9Mu1ppaB3i^8)}XLI41;K>z@- zBL;v{LI44gA%FsrzyN?!|JeVR-~$sX^9w-v{d>Zwzyn{_LI41;K>z@-!v%m+LI44g zApioAfB=9}699k`^Vt8F^#A`CA0PwOWB~xMg#1VOgaknOWB>rPfB+xXe;*(N)%|Au7kwO3gkwE|eupuA=k>c3@mjD2O68(F@sK5hX)?onvup#_M z`5_EI`C$M6v>*T<)*m1P)%|Au7kwO3gkwE|eupuA=k1_<0JMMrAJ!ir1J(U|zo{b$fKq?}fKoyL z0I>Z70Fgof0g*uf0I(q-1ChSi|Cay&fD-+C!KlCkU)Es(0I(taNBJQfK>1++0JIZ70Fgof0g*uf0I(q-1CgxQfB%;N0Duzxd%>u{ z17Fr-0RXUL{73m?BtZFN006XL03X&LAOqF?d%vk83xHC90Dw|L006N40|1di00EIf z006KdAOn$_*#DOR0Duzxd%>u{17Fr*0RXTe{73mAEI|2T006Wg03X&LAOqF?d%vk8 z41iLA0Dw|L006N4e**xKLI44gK>z@-As_>hh}i#^004jz{d>Wvzyn{_VgUfKLi|Vh zLNq}6VgLZNKmZ@sA0PwO{d>QuBMpF3fB=9}LI41;{R04zLI44gK>z@-As_>hcG&-y z004jz{d>Wvzyn{_V*voLWBfAu7kwO3gkwE|eupuA=k!0BamjD2O68(F@sK5hX)?onvup#_M`5{C=`C$M6v>*T< z)*m1P)%|Au7kwO3gkwE|eupuA=ky61++0JIZ70Fgof0g*uf z0I(q-1Cc=3|Cay&fD-+C!KlCkU)Ey*0I*~HNBLt^K>1?;0JLBLAJ!ir1J(U|zo{b; zfKq?}fKoyL0I>Z70Fgof0g*uf0I(q-1CcJ+|Cay&e}EGGd%>u{17Fr;0RXUs{73nO zTtN9`006Xr03X&LAOqF?d%vk85`a>G0Dw|L006N40|1di00EIf006KdAOn#c*#DOR z0Duzxd%>u{17Fr*0RXTe{73mAWI*|0006Wg03X&LAOqF?d%vk86M#~H0Dw|L006N4 z0|1die*giIK>z@-As_>h3fTXb004jz{d>Wvzyn{_VF3WJA^b=AA#6bTVE_QMAOIiM zA0PwO{d>QuBNTvAfB=9}LI41;{R04zLI44gK>z@-As_>h_}BlJ004jz{d>Wvzyn{_ zVF3WJA^b=AA#_0bVE_QMAOIiMA0PwO{d>QueAu7kwO3gkwE|e zupuA=k>=O`mjD2O68(F@sK5hX)?)zxuw(p3`D1)Q`C|Y8v|s=q)*m1P)%|Au7kwO3gkwE|eupuA=k<{1!mjD2O68(F@sK5hX)?@(yu!Q_a`GkZ( zfB9qp0JMMrAJ!ir1J(U|zo{b^fKq?}fKoyL0I>Z70Fgof0g*uf0I(q-1Chel|Cay& zfD-+C!KlCkU)E*;0I20>0JOjWAJ!ir1J(U|zo|nQfKq?}fKoyL0FeCy z0Fgof0g*uf0FWUd1Cg-T|Cay&fD-+Cf5E8017FrZ008ks7(jXi7(n`92LM$4d%LOq z0|1ftV*{!80|2V?3jq1^0|Bb_69D-k0Dw~U0|F{@)c=?G0|2TZ1^~3R1^`iDLI9Du zYXqr50059#0058`P&JD=;|Y;EAPkYT4*>bL7XbNm0zmoT0~o5|0~D&10RXguf7Ab$ z_5%Q_zybiYK>z@dizzyn{_A0PwO{J`SSw-sswdR{m-GVws^A0wwBZ92szcNNf0sf40Fd+p z0II+N0JK2>0Fc87fKo!>36UY-43WS9fKo=+|Ch51K>4*3K>6SU6sq(OK>7W9!>GUm zU)CQW1J&gN6{_R|6RHCVfKo!>36X#RfKovK0FWUd43Rh2|Citc6sofeK>4*3K>73! zK>7W9!>GUmU)B@=fYRUte-x_p4?y|-d&8)}17Fr3AOqEA*8i8$)Bl&{0|2Vz0~M-5 z0059d005992!K*T;0ci-;0lp|0Dw{;*Z-HZ3qbj`6F~Xe|Nj^Ld%mgt0|1fp3jp~O zOaPJK0~4yN(*Kv?0{|-E0~4x{)Bl(A3qbh*8~_sid%~!|17Fr310Vy{myksP7=LpC z0Fbof0Fh&+NBLv`K>4H}0{H|0fYS970QvO;0IEO$0FVH{MtPwY0J#AGfKs4y0C}M6 z0FfHg|Cc}j0FdKmYwQ64RG=CFx$2iKMFAH|BVT}0LLeiNApj_ma@PNs00N*= zpc(+V-v9p>z@dE`p)Bpb$ z6VjKKNdYEO(bWGJ{d>Qu0|tOnfB=9}LI41e{R04zLLeiNK>z@dApk6qP}cvK004jz z{d>Wvzyn{_|HA^&{d)qb{eu9J^BVy9a{&O5^&jQh)$}QbGU#kU;FOl5UfB%;t0Dw}o z4?y|R|Nj@X4*>ax(f^nId$y_l0|1fpQvs=S0RWKn0|2UHrbqd|e+a2y06_VmPXPG< z0D#iJLjpO!KLGjE4*;~b7XbP80|Ba`1OT+RV*{zT0|Jrw0|F`|007X0k_3@sAPJEI z0)WyX0)W!s0~e}k(f^kpe*^$AU<3eEwG#mO^#c^Dx+ehn0Rn*1-~$(`J=Oo0zeWN0 z`U3!}-~$z^+0g%&zyts^wOc}|004kew_`)8x+g&SbEZf6qEA5iVFEz;K>z{Dp%VbL z^HV{o{d>x&zyn{_A0PwOfB=9}LI41eK>z@dBMyL4LLeiNA>c5Pf1K6-m$nx``5*v* zQtto%7u3}Mmp{_~m*fKgs$&j-Qh)$}QbGU#kU;s^9|^s>Ra(mjD3( zHR1ymsv!t~(%=Ics_@X4qD=uJ0$0(O#!Uetf205Z7at%4)qntiQbGU#kU;=sgnQy7r7%q`9c5ykU;Kr)dh)&G|u0Dw}pTSBR~V?(LB??kD0|Nj>sAOqE0)c=>q z(f^m_0|2Vz0~IPl0059d005AK5r9%cAS00>z%!A60Dw{!)&G~dBS87P|Nj>O0Dw{w z(f^kK0Dw}pTSBR~V?(LB??kC$|Nj>p0Dw}=|Cjbo0TLdz(EpboAOqF?d$_6n0|1fp zQvs=T0RWKm0|2Ulrk5s90W$%fms(E&A%BoLBO{UbqBW5OkOdn$*kt(O0~o3R1b|YD z)Bl(C0{|+Z2mm!^27tNc0~o4coo$3K&4S z9|Qn#%mDyYw%fHaYS0Dw|80Dw}d)c=>{|Nj>sAOqDx0059d005BV z7JyPhAS00>ATW`D0Dw|80Dw}T)R(4E0V03W)Bl$}(f^m_0|2Vz0~RVm0059d00599 z8GuqkAS00>;5Cte0Dw}A)c=>Z-$JRl=R>KwCqVhc|Nj@Z-vX()=L4y_Cjj|0(Epbo zAOqF?d%mgt0|1c#1^~3P3jp~6G=Ng`0|2Uc)c=z@dBOZWKLLeiNAs{)C zfB=9}Wz_$d?f?H5A0PwOp40!A9|!<(!2JJIo74Z72GReQz@d zLLeiNAz(O>108@;fB=9}Rn-5N-~$t?CRrs#wtfmox?dw1$>IDc=AEYl;H^RE3^@ zK>37H0FfgA0FdG-fYM{&FOdN%fYRUt6{@A!X8707|CjUw04g5@05O0C094=u6{=Fu z|Ci+h04e|gfKr7505pIAfKoyL0FXfd0FdMZ6{=$;5m^I)c=ATW^t)c=sAOqDn)Bl&F(Epd^0|2Vz0~9KN0Dw|L z0059d005AqC4f>wAS00>;5Cu*)Bl$s0Dw~A|Nj@C&;OVGd%CFsAb`^S0|1ft8vyxt z0RWKn4*>b}0|2Vxrbqc80DxT5LjXYeqb~sY0|0>1M$iA3U<&}WvkL(E^8)~?-~$w@ z70~~epeq3RAPfMswOazIwL<}sRsaBy-~$z^!D2j-Y103fAO`@nxaR|@IRF5VSO5T! zIpZ&p7=t{Q?^6LCDs#{OmmdTGF~9-ssq#im-GVwDj){{HNj#$k>CRrs#4Pb zmmma}HdFyBe_qf3mmdTGF@gR6RO{0Jm(&1&QdQ9Zm*fKgsv-aY@F4&I&_W<1ks%;F zk)tz!Qh)$}Ql-=Xm*4{vs<`JvslLzum!K;^`9J{xwY6J9sj~|}`3e946u9R@sT2T! zQs4sJK>6VUK>0xc0m@;Q z*;D}^f5OuLmo3o$m*fKgssk~AQh)$}QX&8V@F4&I&_W<1ks;s_k@N!qDty!bm+1fh z7q-&>m(&1&QXtU(m*fKgsv-aY@F4&I@IoLXks-i4k;5^7Qh)$}QgGA%m*4{vs*2D5 zm$M5%`Pu*f7qwdgskr9@sj~|J`54dtmmeSlf7Shay{Y{J0Fm?$0QvL-0IG`4|CgWu z05t#rfKv1iK>7W9!>GUmU)Hk=0Qpk^0PwXF0QqymNBQ6b6RI21|CjXx04ksa05oC& z0MI~qOSu6A08u{}191rh08}3U0CC_KpBg}T3%Q8W|CjU6|Ci+h0IKE#6)NNd6RHOp ze}GaV008hI008h~H-J(?AS00>pgfUa0Dw|J)Bl$s0Dw}n3qbj`6F~X&4?y|-d&8)} z17Fr3AOqC_1OO4U3qbiG0Dw}p6F~X&4?y`rcni7xd&8)}17FtQ0~D%n(*Kw90{|+Z z0su5&0RYe;;4P6L1VFh01OQQA7z1%>V*&tF9{>Px;1{17AOrxpU()}V%Fq9ob!Tm(W%LC^7>gfYJg0fKuTD1FG`_0IJ{v6sl9s|Citc z6sqI{6{;fu0I=dAfYM_i36TLJfYPMSmnv5QDjKEH|CeB%0Qq1D0JP%+6siIMfKuTD z6skMUmu^=9A{sKz|CeA2K)JsH0BdRr091CKK=~jDfYOlBm#S9*9wrRZ|Ce{q|Ci(g z0ICB-fKq?}fKnm=0PsNo0FXi;BatCs0+Gkkm+n^q8Wte{0Pq4JBauTvfKq?}fKnlV zK9Rf9mmXLFAP^&wA%FmpV?uyZfB=9}uhN%JSOFS;z@d z14DpPLLeiNA%Fpq@c;i8A0PwO13`dNfB=9}A^-sJApijILLeiNAs{f3n9~23AOL_; z{d>cxzyn{_BSC;tfB=9}A^-sJApijILLeiNA>cicj?({^wG%-3AOL_;{d>cxzyn{_ zA0Pvl=U4$5QohmumnqNxm*oQhs^kL{Dk1;?@F4&I@WVlXQbHgjks*LTk$?bzQh3t; zmxKTR7yWyxsUre_()|Mfk@HglsZ#*}@by~)sT7a|k@W)rs$iyG52kz?R5k>VkM(g7lX(%=IWs`<_TmmdTGG2j6JRN^6kQsDy> zs^9|^s_W4Imvg2^`J%5tm-kr#A%A$$|Ci&=|Ci(g0IFk1fKq?}fKnm=0PsNo0FXi; zBatCM1d%h+|Cb;DfKu!K{}=QF04i(I|CiRz|Ci+h0IK8z6e@rKfKnm=0PsNo0FZ-6 zfKoyrBatCs1Cb@t|Cb;DfKuK6{}b} z0|2UFr$_k!06;k+06_VozX16H0D#iK3;;B<3jq0(c0~D84FI&YTLP&S0Dw}rV*{zS zqXCh*YXqrS0059V008h8DS*;i0058}g9VW}V?2?(F97)=000yMB7o8X0Dw~90~V?w z&i|L-0~IP$&i|L@0~o631AhQ2LjVAfCRysxQs| zm*4{xDlN|cm*fK&s^tR!Dnp|Mk>CRyssaLl(jfwX(tgeVm;3_&Djx&@F=6@tR0`4m zmvzqnm*oQhs^kM4Dk1;?@Ie3okYm4qQbHgjks-hZk$?bzQpC~!m$h3$skdW8skv)J zsk|>h`Lhc^`5*v*Qh$4=NBN?^K>1+0xc0m=af0JZcFK>7PCK>7W9*r>n*U)Hr- zLaDc7L#erIM5(h2K>55cK=}XwfKu`Q{}&%11J$)#LaDc7L#erIM5(+lK=~p70PsNo z0FZ;efKoyrBatBh1(ARNfKsB-|Ci$b{};0BR^0Dw}J(f^mcFF^UVTSBR~V?(LAYecEh|Nj>sAOqFp0{|)_ z008ho00599!GKaiAS00>APA9w0Dw}5(f^mVTSBR~V?(LAYecEMFF^Uj|Nj@YTLP)K zV*{zVYXqsY3l0GJye|OxEY1IyA0PwOm)KkZ96F;$fKq?}fKnm=0Py_-0Fgo z0FWUd36X5k|Cb;DfKvT?!KlCkU)J*e{}&%11JwWo0JH*}mo8laJ_d2k|CgekmvUVJ zA_iy8|Chg>mzrGxVHWW80|2UErbqb!06_Vn9|HLS0D#hzml0k86llOkdBT5y(g6T~ zQlN7Hd9~vJk)Z1UkwMM>mp}jjkmG-VQsM&@ssRFkQUCx7kss0jmp}plG$H^1@Ie3o zkV8~}QbHgjks%-rk$?bzQWMetm$h3$sdJ`B`Jo>|`CtM-`5*uQ$^e&Pxtpfm5AD|C$tN{R2wOc}|fCd1$ z>Hq&1A0PwOA^-sJApijIqfvlTLLeiNAs{f3U;uzp^3ea6;Q#*@z@d1$}^0gHwP~LLeiNA;1d~k?7F>mjHc$Qngz`selFmxzm?9UjZ9515~nM000h=x6uEWKmq_XA^-sJK>z@dV_bkzLLeiNA)pbFfB=9} ztI+?KwG%-3bEZf6p&vr|U;;q-AOHZ$0GE+o0TUkJ0~M;L&;OSn8~}2F{r^-#0f15g z0D#iq0~M;F%$IIp0UBB9|Nj>sAOqDR008hI008jAS%6YPAS00>ATW_&0Dw}8(Epd< z|Nj@{0{|)_008iS0Dw|K0058$eSlJ01%OY(EpdU6F~U@eSlJc3IMs& zmpNYn8#E(ZfKoyrBatCs4v})u|ChBBK=~j5fKq@80J+8g{};6r0Qnru|Cb*i1JytP z0JO3B{}-3wT>%>`@bm)!s$ix^`2hex`Jo>I`2hfc(v$)Kw6zle`5*uQ@L>ReQh^Qt zxd6aMm(O1T6*h6q|Cc}j0FdK2f~NBN;2 zLiu02_U0J-S@{}&%11J&dM04gE?0PuhSfKovK0FVWJfKmfvfKoyr zBatD16p<#-|ChBBK=}ZDfKq@C0J+-#{}&%11J&dM04gE?0PuhSfR{^O0SSMDVt`UY zAS00>027fI(EpdU6F~VO0Dw|}4gk5#|Nj@Y69Dj04)%>RFvKmY)c<9~os;sX_`fdYV1000(|`p^HDpa1|h-~$z^ z`_BKD9~=O3VFCbDA^-sJK>z@d<7R+TLLeiNAs`u%fB=9}>d*g|wOc}|bEZf6p&vr| zU;;q-AOHZ$fCT`x^HV{o{d+*E{{s<`zyn{_A0PwO0RVu~LIHqM-~)dZs^iQ5mjV92 z5+48oYmEW`R29geQXc>nYpehORJB_|sem2;x$6J_7at%4)#U>fD&zwIDk1;?@Ie3o zkRxV*QbHgjks-hrk$?bzQpnH$mz5p>xwTtDsonqo7v%#MD&zwIDk1;?@Ie3okfUXQ zQbHgjks)9fk$?bzQoMi9|Cg2?0J*hWLaEXJ{};7e0;y-q|CjxHy{Y{J0Fm?$0Qock zfKng?0JO6U0Qn&Rg3`4U0QvI+0IDDWfYK1l|CjXx0II+P0JH%Bf>P|v|Ce9~05#6c z|Ci(g04n1H6{;ct0PsR!8<7DZfYNi40Fe{`fKuQC6RKU!|Cbuz0~M;b%m0@^0RYhA z0~4wNAb`>Uz(@He%a`I|0VaRQ&i|J*0Dw|5%>S3<0|2U{aDY;P0Dw{=007V-008hp zAS00>02+~k&;OUR3qbkc0~9K?6F~X&4?y|-d&8)}17Fr3AOqF5&i|Jo%>S3=0|2Vz z0~0DD007V-008h~bAVDpAS00>z#EZ(0Dw|(&;OUR3qbj`6F~Xg|NobVVgU~vBatDX z8j%BWfKq?}fKp}8|Citc6{<77W9!l=8-{}*F)fKq?}fKnm=0MH=-0MJ4p zBatB>Fp)&hmpWqsDkdq<|CjUw04iVs_&1Wx|CjRv04hKN05#wP6e{ymL8<+F!l0IGndNBQ*w1FH7l0+%CX0XYJ*&6i$e0U9Dm%Kw)l0D@BC z0~4y?0~V^h%m0_)0su6>0s#5o0~o5z%9omC0U8bg%m0_N3qbh*0Dw}IrkBEG0V+Cc z%Kw+)0{|-E0~4xH%m0@j8~}2F1OQY4008jd0~4wtz&?>8&HtD70|2TZ{QtC}BLR`% z0~4yT%$Fu*0V02_%Kw+(0~4y+%Kw)j0Dw}n3qbkV|Nj^E&HtBS%m0_;0|2UHf`C$h z0Dw{=007Vd008hpAS00>KrfN8&i|Ky0Dw}>|Nj@|0~4y`0~V?x007V-008hpAS00> zfE|&8gMdQu;sXLI-~$1w{R04zhXjDRB>(`> zhMYk8BLD#KrC>afV_+VUK?DF1girvH#&~D=F3SIx9|Qm~fB*ng004ke{d>Wvzyn{_ zxXu5UBg_An;W-@IoLXks*K{k#o-fmmmOuQvG|usK5hX z)*m1P)%|;-sr>^0k@HglsZ#*}(EKj|`TPR_s$ix^`LrXKu4Vxi8UiYS(g6TK`JwLs z`2hfc(!WCh`QQT-s(Z?p-ev(N5`E48m%s%8G;^j$`QQT>Dx&X~7H0tsAOqDR z007V-008hKDS%Q!AS00>Kp&BS0Dw|B0Dw|2&i|L+|Nj>sAOqDR007V-008hqDS%Q! zAS00>;2)8I0Dw|B0Dw{@NzVV5)&Kt&A0PwOw;KTYqXPnw;sX_`;R6|}-~$}08O#5d z_X7YbU=9E^AO}FXqC-IWffGQv0007u9{>UCtqcHEApn36eY8mc4XFOlK{8>#^+fYRUt6so0Y zc=(se|Cb*G05PBg08{}afKuQC6sqFQ|Cb>B|1==Y|Cb*K0CB+l|5P2#|Cfl$|Ci+h z0IH%tK>6eY6sjQr0MKJDfKnk~IFWz=fKu4a|5KOS|Nj>v007V-008h~DS%Q!AS00> zfFO~80Dw|B0Dw}@&HtBw|Nj>sAOqE)cL2Eu&HtBj%Kw+;0|2U|cR;zrEr3#?H$eG- z0Dw}WKS24z&6hrD0VXDy$^Vz)0~RXb0~M;^101U1%>S3S8$kK^0{|*x|Nj>sAOqEa z1DA?v0WLaYD}Yi$AS00>Kp~NU0Dw}U&HtCT8$kI_|Nj>sAOqFl101R&$^Vyt135eamp*C%8WU{I|Cjay z04jhC_%>hx0I&eyEthL*0U<7{%>S1b%Kw+;0|2Vz0~M+U8GuqE007V-008h~pny_B zAS00>U?h=X0Dw|t&6m1r0U8n`o`6z9AS00>z#@@=0Dw|i&6nnC0VW<}pMX+e0Dw|6 z0Dw{=007V-008hpAS00>z$1}J&6g@`0UjWuoq$q+0Dw|60Dw{=007V-008hpAS00> zKp&Ag&HtB|@M-}V9>bl0Qh)$}QZoR6QX&8V&>;W-@IoLXks;t8kt@xYo@)UbAmg2Y zQh)$}QZoR6QX&8V&>;W-@IoLXks%-=ksZzdmzOYW0T`F?YXJx&^veI2_X7YbfCfOh z{{jGO-~$#aU2$HQ)mlDp1V-m$cVGskYxjsfYjn7Z}X{ zmxIZd-fRIDe`BJ6QbHgjks*L5k$?bzQqj!+m+$}o7at%4)%|;>sUiRX(ES4dk@Hgl zsZ#*}(DhpasrCZ^s$ix^`Sk+(IROAb`JvAM`2hfc(x4{+k>1Gv zmo@?bv=jhVZ7pem)fKuTD6{_F^7OEJ`|CjUw04f1AfKuQC7pj=d|CgWw05o6$0I&ey zEtltQ0WT0Eks+WckwZU#Qh)$}Qi;r$CT;;HA}`4Qm;HOcsr>^0k-!1~wBZ8)sv-aY z@BrWhkwV}pk@v`#Zf*e@LZhUBQh)$}QX&8V&>;W-@IoLXks$yok!sBUmmmOuQvG|u zsK5hX)+3~VQh)$}QX&8V&>;W-&_W<1ks%;3kzmZ1%5DJ~e`U!3mw*5OHT`?RsK5hX z)*m1P)#L*JDuYUZQh)$}QX&8V&>;W-@IoLXks-h;kxk71mmmOuQvG|usK5hX)*m1P z)uTy(Qh)$}QX&8V&>;W-&_W<1ks%;3kwVP>mmmOuQvG|usK5hX)_?#2v;g1)k(A2+ z7at%4)xZN^mt$`M8BWK`|Citc6RPtIK>7W9!l(ltfzkp1fKuTD1FC?>{}&%11J%F- zU)CQW1JytP0JIay{}&Fp+=&fKnjLm&$Je9x|lM|Ci(g z04e|gfKp@t05$!4!KlCkU)IB>fKq?}fKnm=0MH=-0PsQ}BatD1E0GM$ml|*ZDgqhE zmkxXZ8kb;j0R%?l6o68I0Dw{=007V-008hpAS00>;4G2z%m0@k0Dw}n3qbk(d%~!| z17FtT6M#~H0Dw{=007V-008hpAS00>KrE5y%a^Kf0V4q(m(Fkj7Jn_r|Cg0U0yqO8 zfYJg0fKuTD1FGNy6sjl3|Cb{G0I(te0FYzA2a!S`36TLHfYRUt6snBL|Citc6RLj5 z|Ce9^05#wP6RH!+|Chi705#wP6ROO}|Ce9`05!8yL8-M9K>7W9!>GUmU)CZ30MH=- z0PsQ}BatECEs+CxfCo~50Dw}s%a=}A0TzD)cz{xX0Dw{=006Kd006K;AS00>ATW`v z%m0@k0Dw~cd&8)}17FtQ0~4x~$p4oj006Kd007YAdVo?wAS00>ATN>V|Nj@@0~4x? z$p4oj006Kd007YAd4N(vAS00>fG&~X|Nj^Ld%UUT0|Bc20|1fp3jq030RXUJrbn0m zaRDs`^T+>}bEcOvase$m(Br3oQbHgjks%;4k$21gmmmOuQt$u&7k~hOQX&8Vups~d z(8H&IQbHgjks)9(k#5WXmmmOuQs$Szasd-ggQtK}LLeiNA;2$@WXu1TAOL_;-2eX< zA0PwOfB=9}A^-reApiidqo;sULLeiNAs{f3TFd{JAOL_;(*OS#2gm=HfB*or000V+ ztjU-9aseX^01A;|QVNj*2tc{i%9kp00V02ct$;4zUo z%m0@k0Dw}n3qbk(d%~!|17Fr-tAJ8~0Dw{=006Kd007WJAS00>KrE3i%m0@k0Dw~c zd%~!|17Fttd#b4dB7o8X0Dw~c0|1fpQvs<|0RXV`0|2Unrbqc?06_VquK@W30Dyne z_ZtBDw<7_O-~$(`Jjef+^9BI4VG2OGBLaZZU>ZQV0sw$gxE}!dcmfKMwOazIb&?K| zHUI$7)&et;0Sf@R;R6Gz022VY-~$z^V8;KK-~$z^BLD!<+qSupVkM(g7lX(%=IZ zs-(vMm-7PvDjx&@F<=D%RN^6kQsDy^s^9|{s+GzAmjDI;HMLtpskk3N`IM%YmUICw zf5WbTQbHgjks&}Ik>1MxmmmOuQt$u&7at%4)fUSCmx0Ism*oQhsv-aYups~d(BuOZ zDncM5ks)9+kpr`UQh)$}Qqao(mmmOuQn(*L`L$a@so($q7at%4)dtG{mvP7cm*oQh zsv-aYups~d(BuOXDuc6tQbHgjks)9-f06M2{}|Cb;DfKs?0K>4*>LaE6A{};7e0;#wk0Qq9Z|Cb*i1J(U|zN!5K0Fl51 z0JH-hfzq=J0Qunq1FG`_0IC82fKvR$|Cb{G0FVLz0PthL2a!S`36TLHfYM-+e*lqT z$p4q%0~4xK$N!f=0RT1N0~4wU%Kw)j1pqbR0~4yT$^Vx?0{}I%3qbk(d%~!|17FsF z0Dw{=006Kd007WKwSZDWAS00>fHski%Kw+M3qbiG0Dw~cd%~!|17Fr3AOqE-w1858 z0Dw{=006Kd006K;AS00>ATW`Ff6D)tAOL_;{d>Zwzyn{_-~$t?vC03JfB=9}gSLQD zA^-reApii-LLeiNA>cQWcFO;kvkO4^AOL_;=>Pv0-~$t?rOE%7Zwzyn{_A0PwO{d>Hr-~$1wm%w%b3j?rW zrkBok0Ur?n3X#7L1u3E%0Qtbi|Ce*7m;QDEEf&zDw}4VYAS00>U^$UQ%Kw)j0Dw~O zm%(xY6BWa^fKoyrBatCMACWrB|Cb;DfKug`!Eyl;B7?VpQbHgjks+Wskub{tmmmOu zQrrLk7v07Gmw*ERv;lONo_7H*5_ib|mtX=wIg|zf5w#)(kzsb1-gf~Oe=)}Ymw$Ey z`SS}v`TcvtsK5hX*1!W_)*m1P)%|^0k$?pNw6jwIsS^Nz(zO!+`Sk+;suTc# zQUCxzIRFFzG`1H2`2_#~6rch?Ig|zf5gz~)Yb^r+RHAl7`9c5_i*q6ckycOuk>CRY zs^J3`szL}rxr537mw^8NLNw+B04n7J6e{Ec7OLaCfKq?}fKnm=0I(qd0MJ4pBatB> zI+5(j|Cb;DfKszlL8-M{LaF_G!>GUmU)Hu4K=}ZdQCI;JQiHpIQh)$}QX&8Vups~d z&_W<1ks&}Ik=n`smmmOuQvG|wsK5hX)<6INw6*vD7yWy`sRO=%Qh)$}QX&8Vu>Au7 zkwPFNks$y8upuBYk<7`LqIdx#0V$WpcmW=NbIAXffOZ7=pa%f7;{y|_;R6$@0sw$g z3B~`H-~$w@XU6}Rzykm@fB=9}A^-reApii-!^415LLeiNAwWEltI7YDGXQ{6fObUr zU;_ZO!^QuXpLPWKv=2b}3jhEVA0PwOA^-reApii-gTjDPLLeiNAz(X^fB=9}oXP)} zV|f7~e}~5Zm%s!7HQ)mjs@TZ?m-7PvD!>H*HQ)miDzpzk`SS}v`TcvssK5hX)&s(T zQh)$}QZoR6QX&8Vups~d&_W<1ks&}Ik%7tom*4{vD)S3K`TcvssK5hX*0{+3moor> zQX5i3{}57?{}=sxys7;I0Fm4H}0Qm#}fS03s0V*kUMEO7m0JH-sfKoyLK)InC0QsS#0Fi(Iqno6o06C&B z0J)^a|Ce*7m-c!AEk4jg$AD5oAS00>U_X&4$^Vxi0Dw~O|Nj>sAOqEa0Dw{=006Kd z006Lq#(+{nAS00>ATW_0$^Vxi0Dw~Em%(xY6BVPzfKoyrBatCMK9Lm3|Cb;DfKuC+ z!Eyl;6~o4WQbHgjks;tdkqXKGmmmOuQqh-TdjS(7Zwzyn{_W6FS1fB=9}A^-reApii-LLeiNAwVpV*q4!W0TUP_ z007Wqpaqfr0|1fpQvs>;0|Ba20RXU0RVu~Ap(HXfRY4}X2k!O9|Qm~00;n7xFZ3P0wRFY0RVtf z-~$+{)5QOm<^vU~B>(`hBLD!<=K~iirC>af#F7A!W1t3+;vs<20V06X-~$+{RK)+6 zfAs?ZDjx&@F`xnfRN^6kQsDy_s^9|@szt~Dm%s)9HQ)mjs^Z4~mp}smG~fdis)NP< zmw*6(QbW&xQX&8Vups~d@IoLXks;s(k(9{)mmmOuQV#$C6dxc1)y&8Lmp8@#m*xWi zs^tR}Du4ihQX&8Vups~d@ZPX7pgwQ|Chf*0J#DwfYJc~fKuQC7^*qM|Ca+Efzkp1fKuTD1FGNy z7pk;J0J*j&0QqLa|Ca+PfYRXu1F8Z5fKuQC7^-2z|Citc7plL+|Cay;05#$R6{_I_ z7^>g{7pii@|Cb;L05u{2fKnQv0|AlX0~o5JLk2l)#Q&G{0{|-E0~o61#FyTG0U9Qw z(121xAS00>zzLCn0Dw~R$N!hL6F~Vi0Dw|+rbqeU0~9KvN0%Oe0UUoSk-!6A*5m^e zDk1;?ups~d@I%mmQbHgjks%-mk$?bzQZxX7QryS?m+b%l7a{-vups~d&_W<1ks*LK zkz>+;Qh)$}QZxX7Qq#x(m$ef>`L|<3sp0?s7at%4)gk}@ups~d@MF+`QbHgjks$yH zk$?bzQZxX7Qpd;tm$iQrK>61H{}&4As0Qms`fYP%E0JLES zK)E9VfYM+VK)C_{fKs;`0Qq;~1d+8{0;zR!36VAc0MOQg3Xy-|3IMs`0|Tny5&*g2 z0~M1prjFBLR^D zB7o8X0Dw~90~M;X!~d6Lk^qq<00599006M&0~V^KU_6myU>=d;A%M~WB7oB10~M+@ z!~d7_0{|)?1OR_AfCT_l;vs-i;R6+_-~$(`CdU7lz{DVFm!T^HV{o{d?A^zyn{_fB=9}A^-r8Apii7gVcahLLeiN zAs{f3ZpZ(ZAOL_;@c;i8A0PwOrpEu55ybzO{}&%11J(Ze z{}&%11J(U|zN!5K0Fgig0JO6U0QvI+0IKQ3|Cc}k05#wP6RP^f|Cb;I05#wP6RJ1F z|Cc}m05!77W9!l=LlU)F#CfKnm=0FWU70I&_i*nm<(AS00>;4P6Pml1XW7#P@q zQh)$}QX&8VkRbp7kU}6Mks%;3kr}j0Dw{=00597006K;AS00>fG&{$ml1XW7zqIYuwwu~ z`E16Q%7X#6xA24kUPgPU^0000n000000000-Oiw~V zOkYe-M_)`uRz*wzm!Y8n6A5W&XmlWDZgwD-G>ic|mw37X6PJUG0o}K_jsb81w`h$4 zPyrGpb2=qtIv`_mWnpw>Aar4KYnM@x0UDQ}iU9<-V2}al0k>z80Ve~O{*?g?x6+jX zwhkCuS3y!vNlr&yAVY6%W@%?2aA9<4JtcFOPNV@C4;#t=xB)1aPs0IOm(arjAeWHD0U(#~!vRp2aK!<0F=T9PAZB4{Y-MCF3IHW@ zIwfQ}AZ%}8WFTa6X?A6DAY^Q8AaiwNV`XJzE(!nu006h##sM$_4<&OTb9G~5Wo2Y8 z3IG5Am+Qy@ArmEYAZB4{Y-MC1W^!+BASH7y3YYK50UZT%bz@^?w-CtzR|U6l&H)Dj z0%v8HfzJUJ79eI}X>4U=EFg7rWgui_W?^+~bS?^)ozDT{mp9@84wuQ#0S*>sVQFk- zWGo4U=EFg7rWgui_W?^+~bS?@200000m#5GH*_W`< z0naOEWpp5IVR#^6aBv`IX>4U6b7^{IAZB4{Y-MCDAa!$PAY^4`VRdYDE((`A+yPz| zC37!fb7N(0WG`%QXD=mW00000005V++ySfvC37WnmmbvtC6`~=0S%X6jsXX^kKF;d z2A5~q0S}i1;Q=5SWMy_~V`X1yWIZKhEFf}ab9HQVJtbr=3b#Mx0n-DQ8t4JCe{=}| z04)Ik0I0kE|L`#Y09d{L{}>Sf006%J|D-Vh08qgG|BML$0D!>$|DXu~0KmZh|Fj7J z00_bU|J(@x01(0c|L_R_0C2(n{}>7Y0MNny|3nG^0N}y?|5yqD02spl|7;2X05HP- z|9}br06@b2|C9;<08qmI|ELN8e*lQW{{OrR005Z6{{PSl003CT{{LhP005ZA{{N&4 z0002U{{Pqu00212{{JWp000=v{{OHH008*R{{Q?800216{{J8i008jK{{K)7000=y z{{LhR003al{{M^(008*T{{P$!002PH{{JWr007|8{{L7G003Cj{{O%Ze*ger)c*g} z4gdi7)c*ev4*&oF)&Bn^4*&pI*8cy94*&o#*#7_M4*&qz*#7?*5C8xe+5Z1P5C8zU z-v0mG5C8xG-~Rvb5C8zE-~Rtd5dZ)H;Qs%75dZ+V<^KQV5dZ)P=KlW}5&!`B=KlX+ z5&!_`=l=hw5&!_$=>Grke-Z!y$m#z7I1>N>xa$7@fD-@!xaTNE847 zIPL!bToeER;O+kZh!g+-@a_KpoD={6DDM9Mz!U%g0Pp_){1gBH2=D&?5ETFb5byr~ zBozPv81Mf7I28Z@SnvM-TonKSVDJ9_a1{UmVDSF`#1#Ml*zx}Ve>fHZ0C4jD|6~>b z0EqJb|9BPv0HE^z|BMy@008v<|L7I~008#>|0ov#00{T~|8y4s0KoVD|DYED0MPgT z|FjnX0ND5b|Hu~r04VtW|L_+80GRmx{}>nm0Fe6r|F{?c0Lc9Q|6CaW0I2=`|BM*` z06+l$|2P@|09XM3fB#Gx003|R|Nmeb005`~|Nq1q002+||NrP3003YD|Ns0N00004 z|Nl%I005W;|Nqb%001Bc|NrD0005{6|NmSZ007tv|Nr0|006iQ|NkT%005{B|Nmqi z004Ln|Nn>`006)a|Np!l007ty|Nr0}000mW|NlT9001x$fB*kf9smGX5dZ&Z9smG< z5dZ&t9smHa5dZ(A9smHa5&!?}9smGf694}s9{>Qj694~D9{>Pg6aW8w9{>Pg761Pb zAOHa17XSZ%AOHY38UOzPApig<8vp-5ApihS8vp-PApih)8vp-jApiiN8vp-%Apiid z8vp;0Apih4e;fb**dYJ_z#ISnAR+(&=o|n4G$H^15FG#iNFo3LKpg-7U?Knj@ErgD zlp+8CNFD$G#3BFypdbJL>>>aFcp(4(NFx9Mup$5dkRt#9pd$bO$Rhv%I3xf6^dkTO z*dzb{AS3_)P$d8VU?czl=p_IDpd2s{}d$v0B|V(|BxjB0H7-W z{}d(w0Qf5Z|2!rD0FW#H|7<1z0H7=X|9~a{0I)0n|CA;G0KhB%|EMMa01z(!|0E{> z0B|t>|BNR904Op4|IjA@0H`tl{{$!i0I)It{}?C$0Jt&#|1c;306;ST|70it0GKlW z|CA^Ie*mB}|NrPH002-l|NkT@007uD|Nl@a000Oz|NnF;001yG|NodN003Au|Np!x z004kB|Nr1A004+J|NrzU006Ky|Nks1003Aw|Nm$z003Y(|Np!y003Y)|Njgt003w? z|NkH>003|~|Nk^A0059V|NlrU00782|Nm?&e*gg3IsgBFD*yoCIsgBZD*yoKIsgBt zD*yoSIsgB>D*yoaIsgCAD*ymMI{*LlD*yn9I{*I|EC2woI{*JXEC2xLI{*J*EC2u? zJOBTLEC2vVJOBTvEC2v-JOBU8EC2v_JOBUSEC2woJOBR#EdT((JOBR}EdT)6JOBSI ze=Pt2=sW-aKrH|O7(D;~WGw&yh&=!Qlq~=NpgjNos4V~hxIF*=ye$9#_&opr;4J_E zAU*&81TFvoFg^eO7%l(+P(A>gf0L8;64BUs4f5i5I+C^ z%q{=`7(W01;4T0FSU&&%1TO#pm_Gmie<&{i0H8kq|2!`M0H{9y|4=Ug0I)v)|70%! z0PsHl|A;RD0Qf%t|C}!X01!X_|G+N*060JY|Ku+K0PsKm{}3<$03bmB|1>ZF04PBJ z|41+Z060MZ|6nix0C+(E|Aa6A0N6qQ|MV~b0N6zT|6DQv0N_Rc|A;aG0N_UdfB&>H z004+b|NrnZ0059j|NjIt004kU|NlfY000l006L7|No#i z001CY|NqD~002l=|Nr1N0078WfB*joHvj+-SpWYlHvj-wSpWY}Hvj;jSpWZYHvjt+hIRF4ie_a3nNI3ui zkX--&Y&ie`*j)erkU0PV5MKZP2s!`&7+?SYcsc+8P+$N5pgI5ms9^v9*g60J0Am0D z5IX<>SYrSGG&=wQFl7J#d^-RDcxV6ra6AA2fNB5#{5${vaBBbmFg*YO&};wyU_Af; z@NNJ9;5`5UP;dYLI6eRXf3R`?|HM8300?vc|NK4x0HAgM|Ij}G0PuDH|MWiq0C;x) z|0F;F0I+ud|2RMZ06=*E|D-?w08n`U|F}Q^0N{E5{}e$00PuPL|0qEK07!fP|A0XN z0I+=j|L8#g03d$<|42dr0EmA7|9nCK06>5L|HMK707!xV|0F{Ie*n;d|Nl@!0020J z|Npo{002;k|No3c005AQ|NqoP000<@|NjU@005AR|NlHi005|p|Nl@$008KU|NnSJ z000n+|No3d003}{|Npo}008)l|Nrh%ENB{t6l>h%o zNB{shmjC~}NB{tsm;e9dNB{t+m;e9xNB{shnE(GcNdN#4n*aZFNdN$-n*aZ>NdN$# zod5qUN&oN&o<$pa1^=0ZW(K@&O_$yte-TEC2ui z000005C8xGEC2ui*tY)vJOBUy00000Bme*aKmY&$1he=q<505Ado0PMQ{|7ZaK002P_FhQLJ zo&!M)9UwuI0#FLw-qQ>p0746H3f`3&1e61v2A&04-QLsG zPYfRb004vl006WC000QR{{P?s0000%4xj-+oerK2K@1&mL6ZzZl?s##LYW4b2SS?! zngv3a2$l&(oC9vv)IrzQLD|?r+uA|gMBU!gmp~x`6*HOzn*^K#oerK2YSh)%*Vx(G z+uTBw3zZ6%36}_%2bl(%1)Bt%0{{R>0000y0{{SEzL$3P0Y)l_0{{T@zyAL`00000 zK@Jd|0-gaw4IN6}-3%W90000i000220{{RJz?UBP0V*2Y0{{S+!2bUv000000000a z0002+0{{T5z?Wk80U`z%1ONccz?X{m0ZImF1ONaO!I#?i0Y(P21ONaK!j~ra0VaQB z0002w1ONbl!~Xwx0ssI2K@PA9L!FiZo|OSX4IM#~lmV2J0Y{aR0hW;gn2!N^3fU000000000u000L7U?;Kly`1ONa400000 zU;qFBumu1B)W!b)RF}>80a6c6)YAX}TmS$76b1kQ$i|m0`2ki6EC2uibOrzbK**OC z`T;6`qy_*0xXAwhJOBUy06`8Qodli(K@A;2lLAZL-O~&o00000m;e9(%mx4e(8&J( zpalQ`06`AW0YRM>o)tk19k2mIm=Br_oC`#k5Ji*|lN3gl5tR}|nGQvp3<5&b(?QnN zLDxaqLEA>%-rU;Q3?BeO3>~lmlN6K_l@gYhzxn|YQ3BA@)YaD6+d|htlN6K_l@gW_ zmk^l_n+#Xe)YaD4+1o;s6qFN{5|$B{5Sb2}3=jYS0B8pQ0MyO?|40A;0000003-ka z0DK1k00_?h|EQNe`vDt0EC2uiqz3>1IIRBvr~m)}06`8Qodli(K@A;2lLA=^-rds- z9{@oMM&8}i3?BdhFaQ7m)CT|nSkC_cRF`4@0TY+N`vDjU2nYZGe9r#=w3p%g0WLao z3f+Sl0C*3;As9{@oM0-u|*0e0I(o3a5++eMqQ0cP7vo3a5x+W-InFaQ7ma0mbZ z%+vn=P?ur<0TY+N`vD7=XZ!&T2BZi80O-?~di()G2J8p`0Fcy|di()G1~dr(065i` zdi()G27Czs0N~Y^di()G2E+*f0EpI?n*9Mn3JeMW05I47{{R7(e*6Izm4E^;3UB}b z0ALCL0NmG=x&msKp#A{_f7A*90N~jE{{#R40000004M+e0O$$;0Myw2|D*r_002Y| z5S;>^0YMENN#5NI9{@-U9T1%Yo&f*=01yBG02B)V08rWf{}2EG0000003ZMW04NIp z08H8b|1^0YMENO5WWJ9{>OV05|{u089%20AShvm$&}`HA09B008{i z{{I9300000000mG005i|008jW{{I9300000000mG006KH0089K{{I9300000001BW z006`b007w8l`aAv9_R}I0QA}Z{{#R40000008jt`0Q?I80O;BN{{R7(e*6Izm4E^; z3UB}b08k770F>I5x&mrmC;$Ke#0&rcnA`sUm;e9(06`8wod})>K@A;2lLnLpSPI_V z)6@(f06_}?5C8xG@C*O|1l$1=SnQ|%{}=!O0000001yBG00a#H00`Xv{}ccK00000 z09XJ302mDb01Vuhh5-Ur26PPo01(}m;sF9W3A7CW0MOq4{|J|X69N{OI|2eN1^^BK z0F2+4ZUO=(E-VfJ02tu@{|o>C0000001yBG06-1^02JW<{{#R40000003-ka08|bD z00`ih!U6&!27C?x05IT}>H-2H2BZ!E0C?b+5(5I721E}40MOx=vI7F12Ivm}0A%Br zRs;en1{e?k02Jhxh6DnpF2oQ3008Fx{}ccK0000001yBG0N4-!00id#{}=!O00000 z0AK(B0PGL|00`!nS_J}L22c?I0Nm!6z6Amv8gvl=0AT0-{|o>C00000089V?0EiI) z09@yn_5}h;2G|h*0IcYjMg{_Y8e9?p0Kn<~|A+tp000000CWHV0B{lj05s~C-Ub44 z2Ivw107UGURtExlPCx(v0BjQg0Pybq|KI=s002P_Fr5aT1w;)UL6ZcO14WerQwrYQ z)zj1r9{@rNNebTG)zj1r9{@oMP2Szr)6@(f06YKy0I(AP0F3XK5(ol1UhoqD06g&i z|Ih#c003tW5S;>^0YnWQNZ#EH9{>OV05AXm02CAe0O;`k|40A;002P_5S;>^0YVKO zMGD^C3?BeO3qcCr-3%W9LkmIP-3%W903ZMW07w)70Q~Tmst5ua3S0mH0BjTh0Pyga z(g*@tLd+BZ0LbzF{~!PW0000001yBG0N@k=0MzmR|0Dna0000001yBG0Q3|90O;}l z|0Dna0000003-ka0000i=vmI(qv26z--U$LS2Cx+X z05tQL7779;2HX_@0ATZ%LJ9&V1_%}a0NnGJZVCd92AmcE07&(h0t*6a1`HPf09f{y zati`_28C0000007L))02~+q z02ulH|AYVl002P_Ae{uB13?WPL6ZVTlmSW#)I#3f(+nQ~K?_3Ee?#8g(+nQ~K@1%r zlLDOto&!YQ-O~&o002Y)003kd003C|{{Msk0000%4j`Qbo&!M*9YK=tU0wM-@82|vR{FkN;0#*jp82|t% z{g(m`0zw8H8UO$o{+CJ)0x||v8UO&${+EId0wxB48UO%1|Cg=~0wN7O000228UO&W z|Nj4Um)#Bm8wf|<-O~&o07aKD4+0bh>>2<7=>L}r4+1&|EE@m-Kmh-jOAi7$2W%Sv z04M?fmx~VqEeD_*0049W|ChfH0(A!*8~^~=0{@pg5CVM%pd0`IgarSWzYqc;3CJ7( z0JH@E|CpCi4FViclmSrG0000G0002^8~^|u1^@pH000000000G0000C9RL6r1^@pH z000000000G0000W9RL6n1^@pH000000001Z0000q9RL6j1^@q0mm&258JBJm0$K;K z9RL922LG4O5dvWc7#;us+z9`dHxdFp30xik08k14|9qEW{{a)1kP-qIGmstt0GtW` z{|Ep80000002BZK0HhuO0FVj){{#R4000000000005AXm0K6Um0DuYqm+KhRS3ICT*8UjrQbRPf!unL!=8Ui*3upa;bBny|`8Ui80E`R&mwyuiF$uUJ004Xp|No?yaRLGp zm&_9aAP4jy008I=|CjR<0!;@~cFOb-A51ONa4000005C8xG ztRVmZKo0-^1ONa4000005C8xGz##wtG!Fm&AOHXW00000AOHXW)FA)>Ko0-^H~;_u z07VWEodTW#Lk%56-rWoz000005C8xG_#prQR1W|D3;+NC000005C8xG3?cvkP!9k9 z1ONa`0000001yBG03ad&07MS|{{#R40000001yBG05l>105}f+{{#R40000001yBG z07xPL04xsw{{#R40000003ZMW09+yf03Z(kms=GA9S49S002Y||CfIi0v!jWA^-qr z4*!?`5&|6u$RYp$Y!3gI>lFeW2kasM0Dunvm+KV*9S0C2005K@|Cj#~0v!i5BLD!H z4*!?`5&{{QU=soa8(1R%0Gtm0{|Ep80000003ZMW0Bj=w0FVy<<6`7ytkO000005C8xGG$a53 z@DBg~7ytkO00000AOHXWNF)FN^bY@*M;8Je2W%t&01yxVm;Vw18JA!a0t6zEBme*u z5C8uV000000000W0001_Bme*q5C8uh00000L6^=K0u~3zBme*m5C4~I76KWU;1>b} z2kayO03Z+lm+Kb-9S0C4001lx|Cj#~0v$gzB>(_05C8u#00000MGg?10-gau4IM+? z-3%W90000G00013B>(_C5C8uJ000000000W0001NB>(_05C4~s7y=oW;1vP{2aqKI z089`6myZ|%9YeGw003wY|NjU800000000mG0077(003MM|NjU800000000mG007)2 z002-A|NjI400000001BW008hM002Y}|CjF=0v#I^CIA3n5C8uJ000000000W0000e zCIA3b5C4}Z83G*#OeO#TNDu#){}KWj3n%~p0B|M%089`6mv0#YB?p`)007tz|CgH? z0v&(ACIA5B5C8uJ000000000K0002gCIA4~5C8uV00000000000000W0002&CIA4? z5C8u_00000L=F(00-gax4IM?^-3%W90001N0000GCjbEK5C8vM0RR91K@LEj2%ZN) z4IM$11eOCsmjXtV1(OC>)YC-X-PhID3?G+rFai^QO$yZ0Lf+li)z%Cj06_~-)YC%V z-PhID3?BeN3>`p~1eODr0-Xq+2LP-9004j|007(&|Nj630000%4xj;@6rK}74IM$2 z50?%?lM<8>QkV@!nhTi>LYxVk3PhC zmJgR{4wwy@44Mm@3Y-a@6rK}S)!5nE+uTZ(5SR^_44Mm@3Y-Z^+1Nqb+CkMp+(MWQ zN!US^5SR^_44Mm@3Y-Z-)j`?VLfhIw+(MZQm<>Uj3YrT+l@LLk2><{{0000mC;$Ld zjQ;;T0+&t>0vmrp3ul!CPSscnl>|r&LJE}xNDDy|r&LJE}xNDD!g1OR9N004X_ z006Lw{{OH60000%4se|go((|_9YK@}NR|mt3f|q;)C?a0K?^~c2bTy!lMF(d1(^mz zn*>Ca3SJ7>*FoCZLDNCiLEAwKQq$Gf*xB0KOPB|j2tj|E1(^mxlMF$X3PGC$0000e z0002!C;$L-694}M0RR91K@L!z3Z4l;4IM#~2$Tn03f|q*)C?a0K??vV0000KDF6Ua z6aWAG00000K@KpT2A%~%4IM#~1e60@3f|q*)C?a0LJI&m0000$DF6T@6#xII00000 zLk=*V2A-E29s(gE000005C8xGd?^3`kQD#_1ONa400000JOBUykSPEFgcO$=9|AfC z&?x`_G!>Ux9|AfC5Gnuwj1`xf9|9@{Kq>$LOcs~Q9|AfCfGPk0q!yP7AObE1v?>4q z_!gHwAOa={;3@zB)EEE%e3yX}0uz^jAOa)_AS(a>6dC{jz?X3X0ux163f|q*)C?a0 zK??vV0000?D*ynf8UO#B00000K@KpT2A%~%4IM#~1e60+3f|q*)C?a0K??x10001Z zD*yl-8vp;0mjxjL9|T5}3saXUAp$K5ngyE#oCBQ>o(-2^Ap%ei0Qdj^05B{70Q4OH z{}7kGAp#pBnhi~q6O$A~oC})_L75H$RM|n)(?Q(ZNZ3KzO5WYq)z+7=`T-y&P}9`e z+uTZ%6qFO04x0>|3qcCh(?Q(ZLD@kIO4HQY+uTXmLE4u^0YnWQM&8{F9{>OV0CWHV030v?06-)E z|1<#r002b}P@M{%2|*1VL6-!W145GsLzM{FD2$Tnv29^bv1egPv0-6Dx3Z4l_3?Bf~KGfCL*Vx(G-QGeB9Z-`9l?Imt zm;;>(o(XIK005LQ0000a|NjU90000%4ltbto&`e<9YK@>LX!kSl>$+hEiM8W7E04W z)k5Cg)C?a0K@1%*lmndxo&`jgF)jiX8q-150000003-ka00c1r0GK5I|1@1}rfE0H`FFDklOQ97mOe0b>f?-qq983?BeO3jhE#0001FF#rI_C6_8E0vsGi zm4pFf3f4lo3mo4?~y@mkvyo5JH*@N!Hau*w;bY zN8a7j)C?a0LYJ^80=NeJG5`PoE0=C50)_^NGXMa5ESLHz0xkx;GXMZMEtf7T0wxW7 z0002&GXMZ+F8}`=mtiUb7k@^U2bBm%nFN>xaM{>I*407NL6ZuV2$lz!1(^gv+1N+Z zLDtnt-rd*K3?BeO3>{#T3X}000Ou|NmeC0000%4ltbto&`Y-9YK@>Mhf2D)ISU#06_~ulLSJQ z0$d8yLDfRu-P8;p0745w3e!T>L*Cug3?BeN3t0-&LDfPFLeoLj0001p0002QGynh) zF_$(g0)_@qH2?tQGMBmE0-#mDVZpmCz~dmC7m#yFG1GTLD<(p+Sx(VLEJ-=E|n~nE0=#Nm?@bknkSqk zLDtnl*w;bY*+JY$l`NJkmnxVknJAhkoFz>P+(FjWLD<(p+Sx)2N!Hat*w;bY*+JYv z(?OOil`KJ+DVHiinkShkL6a^)oFxDNAOHXWTs8mz$Tk1}OaK4?07niGodTW#L=7EA z-rWoz00000EC2uifHnjG0Q5DNwk!fF9k4b408BRj|12wGBE-!8pt~U08B;y{}ccK0000003-ka0NgtO08mAjdNBeb8U#E50BA-3|0Dna z0000004M+e02n*~0DMK4wlM-G21Gmn0I)@u;xPg`2828S0Qg0hA~FI}2HZRV0MJI4 zdNKkc9Rxi90I)~@{}ccK0000006YKy02n<00JKN{|CpEkDFPgq)iMGb23S1+01QZ% z_A&xi2DCi@0GLUaQZoWh1_(X?0CY;1rZWN}1~5JV04z(F&NBige@p-X0AM}<0CY?L z|KI=s002P_Fr5aT1wjoRLX-oO1VWVpMV0|t3e?j<*407Y-3%W9K?_0FLe)Xk(?Q`3?2A%~;-rWoz03ZMW0I)s)00d0`|2O~u002V{5S;>^0YnWQM&8{F9{>OV z0B`^R0MtGJ02oaFmq#=LZ3aj`004ANm%20pA{uZ%0068`|NjgC00000002Ay004wP z005{?m-aLQItIi)008(-mo_y5HU0000%4v-Z? zozeoH(E>pY9YK@O0+i1JLYB<}NR`e4MVQM1m&^ia*w;bTLY2+}NYzUU-QL#I)C?a0 zK?_Qi&H|Ur0+`DJN!3Bv*Fu%f0!h_DmCgc}%mSFp0!G!>*g=@f0+-AJL6yz|002|~ z006i^05Je;Qvd(p0RR91K@Q*ooh+U!K@A;2lPZ)cOqV7?mM4`cY}VC5*GCH8-P6000001^@s6 z00000&00000(0Tv>00000(0Tv>00000 z(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv> z00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>004gg z0ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2> z000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>00000 z0ML2>000000ML2>000000ML2>004gg007W>00000007W>00000007W>00000007W> z00000007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000 z007W>00000007W>00000007W>00000007W>00000007W>00000007W>004gg0002c zdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b z0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002c zdH?_b0002cdH?_b0002cdH{a_00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv> z00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000 z(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0YFW000000ML2> z000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>00000 z0ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2> z000000ML2>000000MLJW00000007W>00000007W>00000007W>00000007W>00000 z007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000007W> z00000007W>00000007W>00000007W>00000007W>00000004i`dH?_b0002cdH?_b z0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002c zdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b z0002cdH?_b004gg(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000 z(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv> z00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>004gg0ML2>000000ML2>00000 z0ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2> z000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>00000 z0ML2>004gg007W>00000007W>00000007W>00000007W>00000007W>00000007W> z00000007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000 z007W>00000007W>00000007W>00000007W>004gg0002cdH?_b0002cdH?_b0002c zdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b z0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002c zdH{a_00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv> z00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000 z(0Tv>00000(0Tv>00000(0Tv>00000(0YFW000000ML2>000000ML2>000000ML2> z000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>00000 z0ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000MLJW z00000007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000 z007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000007W> z00000007W>00000007W>00000004i`dH?_b0002cdH?_b0002cdH?_b0002cdH?_b z0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002c zdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b0002cdH?_b004gg(0Tv> z00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000 z(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv>00000(0Tv> z00000(0Tv>00000(0Tv>004gg0ML2>000000ML2>000000ML2>000000ML2>00000 z0ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>000000ML2> z000000ML2>000000ML2>000000ML2>000000ML2>000000ML2>004gg007W>00000 z007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000007W> z00000007W>00000007W>00000007W>00000007W>00000007W>00000007W>00000 z007W>00000007W>0012T0002cdH?_b0002cdH?_b0002cdH?_b0001pml6L0>6fr+ z0|tNp|Ns93000010000300030|Ns900001hlmP$$00000000000001plmP$$00001 z000010001xlmP$$00002000020001(lmP$$00003000030001>lmP$$0000400004 z0001}lmP$$000050000500026lmP$$005PT1DSuglmP$$0000G0000G0002MlmP$$ z00000000050002UlmP$$00001000050002clmP$$00002000050002klmP$$00003 z000050002slmP$$00004000050002!lmP$$00005000050002^lmP$$0000600005 z004gg0F?m%000002LJ#71poj52$cZ<000002mk;81poj55S0M{000002><{91poj5 z7?lA4000003IG5A1poj5Ae8|C000003jhEB1poj5FqHuS000003;+NC1poj5K$QUi z000004FCWD1poj5P?Z4y000004gdfE1pt2l09cg)0000001p5F00jU50BDr~00000 z01yBG00jU50C<%F0000001*HH00jU50DzSN0000001^NI00jU50Fadd00000022TJ z00jU50GO2l0000002BZK00jU50HBot0000002KfL00jU50H~D#0000002TlM00n;l z006L+0RR91000*N000F5006j^0RR91000;O000F5007990RR91000>P000F5007XH z0RR91000^Q000F5007{X0RR91000{R000F5008Kf0RR91000~S000F5008in0RR91 z0012T000F5008)v0RR910015U004gl00008mH_|&0000V000050000OmH_|&0000W z000050000WmH_|&0000X000050000emH_|&0000Y000050000mmH_|&0000Z00005 z0000umH_|&0000a000050000$mH_|&0000b000050000;mH_|&0000c004gg1poj5 zP?iAz00000CjbBd1poj5Se5|*00000C;$Ke1poj5V3q*@00000DF6Tf1poj5XqEv0 z00000DgXcg1poj5aFzi800000D*ylh1poj5c$NVG00000EC2ui1poj5fR+IO00000 zEdT%j1poj5h?W5W00000E&zW300jU50Fage00000051Rl00jU50GO5m0000005AXm z00jU50H~G$0000005Jdn00jU50I-$;0000005Sjo00jU50JxR`0000005bpp00jU5 z0Kk?30000005kvq00jU50LYdB0000005t#r00jU50MM2J0000005*RB000F5007vQ z0RR91001`t000F5007{Y0RR91001}u000F5008io0RR910021v000F5008)w0RR91 z0024w000F50001&0RR910027x000F5000P=0RR91002Ay000F5000000000000960 z|NsC0|NrQ)0RR91004gg0000000000u>k-800000000000000Ou>k-80000000000 z0000mu>k-800000000000000;u>k-800000000000001Bu>k-800000000000001Z zu>k-800000000000001xu>k-800000000000001>u>k-8004gg0000000000u(1IE z000000000000000z_9@U000000000000000*s%cs000000000000000@UZ~^00000 z00000000005V8RP000000000000000D6#( z000000K|F#0GB`p0~iVna{&MV0000KbCUrE6O(WO6PG*(12jp{3jhEB0000000000 z000000000300aOSGXMYp0000000000000000000300jVaO#lD@000000000000000 z0000300scSm!Ss(6@Lc+Kv4hy000000000000000000000{{pBm|Oq=0000000000 z00000000000{{sCuzCOh000000000000000000000{{vD(0Tv>000000000000000 z000000{{yE0FM9w000000000000000000000{{#F1akoZ09*h7000000000000000 z00RIG02p%t0000000000000000000000RIH09exj0000000000000000000000RII z0MOh40000000000000000000000RIJ0AQC9{{j;Q0{{^Kc$X3X0uu!T01^O*ml6L0 z69oeR69D*^@dyK70+1}1QV9btN|ciT000000000000000073u&00ICD0F;ve00000 z02BZK0000006zc#000090I+%h00000000000000006zc#0000C00eWF$_WE5DZF|B z00000000000000006zc#0000C01R^h0000000000000000F9Sn2?HO0kP`s_00000 z0000000000n*aa+0sspD&=Uaw00000Tmb+800000KL7v#000XBSdjn#0000000000 z00000ssI20000mGaPk8H000000000000000KL7v#000XB0FM9w000000000000000 zssI20000pHfbs(X0001g00000000000IC200000D03f6R0000000000000000IC20 z0000L0C*Y%0000000000000000IdK30096M0C*Y%000000PqL^000000K5PI0096M z0B9ow0000000;m8000000LcIV0096M0B|D&00000000O80000p00620000004FEu- z0RR91000000000000620000004*<9W0ssI20000000000007pPVF?2uP?P`w00000 z0000000000KL7v#000XBu#f-%000000000000000ssI20000mGXz~L90000000000 z00000-v9sr0sspDShD~C00000w3k^710NX-0RR9202BZS00aO400004000000000O zmyrwu7a1-A000316aWwa1ONa4000C400000002Rk!3+a00acgr3I0RR;M zXa)oT000001ONa400000c>w?b0RR;MYz71X000001ONa400000iI*V_0~ddu0RR92 z02Kgu1_S^A0000G00000000210RR9202Kg;1_S^A0001h000000002J0RR9202KfT z2Lu2B00004000000002e0RR9202KfX2Lu2B00004000000002z0RR9202Kfb2Lu2B z0000$000000002>0RR9202NvQPzMA6000001ONa400000{{a910RR;MSO)|E00000 z2mk;80000069NDL0RR;MU=A3-q10000000000000000062000000 z4FKqa0RR91000000000000620000004*-zq0RR910000000000008xup$-EdVOYrk z0000000000000000IC200000D0MLa20000000000000000IC200000L0C)!k00000 z000000000000sj90096M0C)!k0000005AXm0000001^WL0096M0H~K?4g(h{(1`&6 z000000000000000ssI20000jFfa(DN000000000000000A(!zF10NbN;s5{u00000 z00000000200000001W_0lb1>n11>?x7X$zR0000000000000200000001W_8lK}t# z0000000000000200000001p5-@c{q;00000000000000jm+=n+9|?f%000000001& z`4Iyj0Y8@+5(6J8c$5JE000000000000000ssI20000jFnDhYv000000000000000 zOPBEv10OS(?*IS*0000000000000180{{R501E(^?*IS*00026000000002000000 z01W^TmjRb!5d$tLn*jg-0000000000000200000001p7T^#K3?00000000000001a zm+=n+A3+cW0RR91000000000000620000004FE8s0RR9100000000000062000000 z4*-b!0RR910000000000004!T@eczZK`;mb0000000000000000G9&*00ICD0N@P) z0000004M+e000000IC200000F0I2){0000000000000000Irwu4+9@T;2Hq{00000 z0000000000ssI20000dD0IC51000000000000000ssI20000jFNCpA`0000000000 z00000xR>z{10PukDggih0000000000000200000002KgmD+B-l000000000000020 z0000001W`JuK@r60000000000000200000001p882?78B00000000000002Sm+=n+ z9|@o;0RR910001&DHQ`BF{%In0000D04T5l0000000000000000IC200000F05}Q) z0000000000000000MnQ84+9@TFfaiC000000000000000ssI20000dDc(MTi00000 z0000000000ssI20000jF=nMh?000000000000000;+OFc10R2IG64Vp0000000000 z0002+0{{R501E)9G64Vp000130RR910000B1ONa601E&BGywnr000130RR910000e z1ONa601E&JMF9W+0000~0RR910000`1ONa601E(MMgaf-0001#0ssI20001W1ONa6 z01E)$_9004gg6aWAK00000o&*2@0sspDkZS<|00000)Bykh00000ssI20000dD zV6y=L000000000000000ssI20000#Lcq;?|000000000000000yaWIM0RR;Mcq;?| z000001ONa400000%>)1d0RR;Md@BS1000001ONa4004gg0Nn%t0096M0Dvn500000 z00aO4000000PF++0096M0E8<90000000aO4000000R0320096M0EjCD0000000aO4 z000000IC200000D0I;|L0000000000000000IC200000F0MHEr000000000000000 z01gEJ00fuq3j-S|_;LXN000000000000000ssI20000jFSRMiZ000000000000000 zP?rH110Nb}9s&RW00000000000000W1poj601p6c9+x^8115hi1poj501g0H(*Xbg z00000000000000%1poj602BZK00aO400000000000000^1poj701N;Ga{&MV00000 z000000000~1poj700{uFdH?_b0000000000000151poj60P+8b@&f<>0000000000 z0001E1poj602F@!Fa`tw000000000000000aRmSX0sspD_;LXN000003;+NC00000 zZv_AV0sspD_;LXN000003;+NC00000fCT^m0RZv;82000000000000000mIVL+5&#PTzzhKZ000XB00aO4000000HTu-4;KNq zlMxRW0m_pR4;M+?1pojN01E(+oB#j-0002s0RR910002;1pojN01E&xFaZDn0000q z0RR91000011^@sO01E&RvH$=80000;000000000Pmw_1r7k?}U000sI3jm-h0RR91 z004Xd00000002V<000sI3jkob00000008g+00000003JC000sI3jp|W0RR91008^| z00000003+T000sI3joLt0RR91000O800000004Ie000sI3jpZ;00000000aC00000 z004*v000sI3laeEl>h($0002M0RR9100020mw_1r7fHJY000sI3jlZy0RR91001Ze z00000006}X000pH6aW|i1ONa4000C400000007bk000sI3jjz>0RR91002}000000 z008Khff)lAG5ZDp01^NT0Fdqg000000E7Sl0000001gKL01^NT0Fdke000000PFw& z0000004JBB8Uq($JO=;(5&#PTD9Zo<000001ONa400000N(TS{5&#PT$P57h00000 zAOHXW00000RR;h75&#PTI4%JI00000NB{r;00000YX<-T5&#PT2=xE}00000@Bjb+ z00000dzYaa0~axj2LJ#P01E)v2mt^900008000000001<2LJ#P01E&Z?*IS*0000e z0000000026m!TR17XibUp&A1hNz4ZT01^NT0Qf5b0000007w7;000000OAJ#01^NT z06+}^0000000aO4000000PF_<01^NT0Dv9=0000000;p9000000Q{Gs8Uq&r6_ZgB z7hxy}000sI3jkQc00000000C4000000021%000sI3jpw$00000003wK00000002%1 z000sI3jk@5&#PTh~oeN00000Bme*a00000tdmg@ z7k|?T000sI3jlDH00000000yK00000008I+000sI3jhcq0RR91006)M00000008?4 z000pH6##G;1ONa4000O900000000OH000sI3joMH0RR91003YC00000001Hh000sI z3jlBt0RR91002M$00000001!w000sI3lacuG64Vp0000q000000000xlK~AE0a}v* z4Hp4plK~AEe|8A~01^NT0Lc3Q0000005Ado000000F4O%01^NT05HV>000000GI#( z000000G0^=01^NT05}Z+0000000aO4000000H6r~01^NT0Duz#0000001yBG00000 z0IvxE01^NT0B{@u000000Pp|+000000KW+U01^NTS^)470RR91000O800000007Mi z000sI3jiPu0RR91000aC00000007zv000sI3jp}_00000005W(00000008s}000sI z3jp{L0RR91000O8000000007$(F_*>3zN|d7XcQN(F_+!GYS9z5&#PTFya6J00000 zH~|0v00000N(uk~5dakcum=PH000005D)+W00000TM7UG5&#PT$RPm$00000oB#j- z00000aFfvt7XgNo(F_+!uL=MF5&#PT$dmv800000TmS$700000yb1sS5&#PTaG?MI z00000L;wH)00000)CvFq5&#PTAY=gm00000ECB!j00000>66h67cu+_000sI3jjC~ z0RR91001xm00000000OJ000sI3jk;V0RR91003YD000000051bK{5ju1sn?i01=a6 z0TTf_mw_Jx9}zI$00000007_s00000002~%Q6B>re{u@|01^NT0MI%C0000000aU6 z000000E`O&01^NT00=4p000000B`^R000000HF&201^NT01&Pui4*&oX01E*4?EnA(0000C000000002y4*&oX01E(6r~m)}00004000000002` zlW`0e84C~q01^NT0J!A<0000008{_~000000CR85C8xY01E)P!T?~c0000G1ONa40001x5C8xY01E(E zkpKVy0000y0ssI20001=5C8xY01E(kQ2_t|0001J00000000245C8xY005IW5D^*2 z5C8xY01E(kDggih0000e000000002tlQ9q%0Roeu3>QfZ5dZ)Z01E&x4FLcE00004 z000000000N5dZ)Z01E)n4gmlF0000u000000000a5dZ)Z01E&Bvj6}90000~00000 z0000&lc5Y30acTs3>N`tlc5Y38G8``01^NT0LaAv0000002lxO000000E&~L3>SZ+ z5dZ)Z01E){Y5@QM0000C000000002P5dZ)Z01E&BUI73A0000y000000002m5dZ)Y z02Kgu83X_T000000RR910002!5dZ)Y02Kg`D+B-l000000RR910002?5dZ)Z01E)H z5di=I0000$00000000055&!@a005I`4H17W5&!@a01E(!X8`~J0000u000000000= z5&!@a01E&x%K!iX0000`00000000165&!@a01E(^QUL$}000080ssI20001K5&!@a z01E&xtN;K20000y000000001X5&!@a01E*49RUCU0001p000000001p5&!@Z005JR z5fOiz5&!@a01E)fUI73A0001p00000000255&!@a01E(6WdQ&H0002s000000002U z5&!@a01E&}69E7K0000m000000002h5&!@Z02Kfz7z6+S0000%000000002x5&!@a z01E)nECB!j0000;000000002|5&!@a01GYv2oeDR00000KmY&$000001`_}P5&#PT z*y8{I00000FaQ7m000007ZU&g5|d#86HP4>000sI3jhcT0RR91005)_00000002Z2 z000sI3jnaG00000007hh00000003VT000sI3jhET0RR91000C400000003$e000t` zVF43OgcAS&5&#PT==lHu00000+yMXp00000oD%>55&#PTNTC1#00000Bme*a00000 zu@e9Q5&#PTkP`s_00000KmY&$00000!xI1i5|d#86CLXl000sI3jkO(0RR91003A3 z00000008t8000t`VF43m2NVDR5&#PT@XG)I00000^Z@_>0000078C#g5&#PTK==Rv z00000Bmn>b00000BoqJu5&#PT7%c$+00000NB{r;00000HWUB=5&#PTs1N}F00000 zH~;_u00000KNJ7}5|d#869rHd000t`VF43CV-x@Y5&#PT0B!*Q00000^Z@_>00000 zeG~uy5&#PT(DMKQ00000Gywnr00000j}!m^5&#PTsP_N>00000n3n-710OZG6aWAc z01E&Z{{R300000`0ssI20002Z6aWAc01E(+zyJUM0001_000000002x6aWAclVJf9 zN%<5201^NT0AL6K0000004M+e0000000$KS01^NT07yXr000000AK+C0000002LJg z01^NT0JsbR0000000aO40000003(;-D+3oXHWdH>5&#PTSh4^B00000r~m)}00000 zMil@65&#PTXzu_300000EC2ui00000T$kZ10~cXs6#xJd01E(U;{X5v0000W00000 z0001V6#xJd01E)f0|5X40002E000000001f6#xJd01E&(>Hq)$000130ssI20001s z6#xJd01E){1pxp6000040RR910001(m*Fb|7d5IC000pH6#&2&1ONa4000O800000 z006ZW000sI3jnwa0RR91008^|00000007Pv000q_VF42X;g{hn0~deu6#xJd01E(c zo&W#<0002s0RR9100001761Se01E(!l>h($0000C000000000I761Se01E*41_1y7 z00026000000000W761Se01E)H(*OVf0000O000000000i761Sd02BZ)0R#X50002s z0{{R30000v761Se005U~EdvpMQ5FCI5&#PT2<`v?00000ga7~l00000WflMc5&#PT zkP-m^00000v;Y7A00000bQS;r5&#PTke~nn00000xBvhE00000kOu$&5&#PTsMP=f z000003;+NC00000ixvO?5&#PTP@(_;00000L;(N*00000qZR-F5&#P-0H~D!00000 z05kvq000000J|0d01^NT0BDo|000000AK(B0000007;V}5f^{U761Se01E*4{r~^~ z0000C000000002m761Se01E&xW&r>I0001V000000002+761Se01E(M$^ZZW0002E z00000000087XSbf01E)1P5}S_0001J0RR910000V7XSbf01E&>y8r+H0002+00000 z0000s7XSbf005I?0TBgD7XSbflVJf9WpNh(01^NT0ARuZ0000000aO4000000D>0) z01^NT0I=f#0000003-ka000000F@U201^NT05BK<0000000aR5000000HzlJ01^NT z00<5N0000005|{u000000I(MT01}g70TVUL7XSbf01E&R5CH%H0000$000000002j z7XSbf01E&Z%K!iX0000C000000002x7XSbflVJf9W%w5W01^NT08kA90000007w7; z00000009^P01^NT0DuGm000000DJ%d0000001p@d01^NT08st_000000GI#(00000 z03a9u01^NT07$_A0000005kvq0000005uo@01}g70TTsM7ytkglVJf91!fok01}g7 z0TUg17ytkg01E(!9{~UW0001d0RR910001q7ytkglVJf9f2J4!01^NT0EjFB00000 z07w7;000000KFIh01^NT09eNW0000000062000000Ld5t01^NT0J!D=000000Q>;} z000000M!@(01^NT01z($0000007w7;000000O}Y301^NT0O&6P0000007w7;00000 z0QeXH01^NTLIB7v0RR91002k;00000000gd000sI3jhF*00000006K7000000012s z000sI3jo*~0RR91005W(00000001tR@h}4ye?S=k01^NT0B9=#0000007w7;00000 z09P3R01^NT0N@V+0000002lxO000000AU#b01^NT0Envq000000H^=}000000EZa> z01^NT0N_yp000000JH!A000000G1g501^NT05Avv0000005AXm000000HhfJ01^NT ze*j<|0RR91005K#00000006Za000sI3jp~200000003A300000006)l000sI3jomJ z00000002k;00000007n*000sI3jjD70RR91008^|00000008D0000sI3jmPz00000 z005i-000000090O000pH6#&o|1ONa4e*gec000000000F8UO$i01E&BYXJZN0001x z000000000i8UO$i01E)HkN^Mx0001}000000000w8UO$i01E(cT>$_90001Z00000 z0000{8UO$i01E&Z;s5{u0000K000000001I8UO$i01E&(O#uJ^0000C000008~^|S zeHs7&5&#PTND=`6000001ONa400000jF&+&0~ddu8UO$i01E&}NdW)=0001l00000 z0002H8UO$i01E(65CH%H0000e000000002R8UO$i01E)92LS*80001p000000002d z8UO$i01E(EF984m0000;000000002#8UO$i01E)H3IPBB000040RR910002p3jhET z005U)9|I9F1{(kX5&#PTxaa@?00000d;tIe000005E}ph5&#PT00jX6000002mk;8 z000009g{H@7XdGmF%}mALX$BT7fDnb000sI3jjzB0RR91000C400000003Vb000sI z3jnyG00000005W(00000004L!000sI3jp{J0RR91000;O00000004%QF%}mAnv*dW z7a6S^000sI3jmmv00000000aC00000006|3F%}mY*Bbx;5&#PT(Cq*K00000C;$Ke z00000>XR`R7Xkc}F%}mw4;%mh5&#PTs6qh%00000U;+RD00000EF1s;5&#PTur&by z00000*Z}|l00000KbJu@0~aw-8~^|k01E(!5CH%H0000S00000000178~^|k01E&J zN&x@>0001t0RR910001Qmq9fH7k`2r000sI3jlyF0RR91002k;00000005sH000sI z3jm<-00000003A500000006BV000sI3jioT0RR91000~U00000007Ax000sI3jp|U z0RR91007_t0000000871000sI3jnaE00000000C400000008zJ000sI3x5C*-~a#s z0002&00000000059RL6l01E&J{{R300000C000000000L9RL6l01E){aRC4T00004 z000000000f9RL6k02Khp7X$zR00008000000000u9RL6l01E)9?EnA(0000a00000 z0000?9RL6l01E)H!T4gmlF0000u00000 z0001-9RL6l01E(s!2kdN0002g0000000027moYX27cs^i000sI3jh$g00000002+` z00000008A3000pH6##Gt1ONa4000O800000008}$F*XAi0T7o_Hv<=8E*<~?5&#PT z;0OT#00000C;On01E)1Q~>}00001l000000000m9{>On01E&xyZ`_I0002+ z000000000;9{>On01E&h&;S4c0002o00000000109{>On01E(!VF3UD0000K00000 z0001O9{>On01E(s%K!iX09OD2YybcN00000bsqo#5&#PTkZAz`00000U;zLC00000 zj2{315&#PTP!a(E000007ytkO00000ogV-I5&#PTF!ule00000bN~PV00000tsejY zAd_JM6MxAc000sI3jiop0RR91003kI00000007+|000sI3jnBQ0RR91007_s00000 z008$N000sI3jp960RR91000C400000000Oe000sI3jnA~0RR91004{u000000012z z000sI3jk;$0RR910058!00000001c<000sI3labb0000005|{u000000LmZ$ z01^NT0B8~c0000004M+e000000NWq{01^NT063KZ0000005kvq000000Qn#Q01^NT z05}=}000000H^=}00000016=h01^NT763pj0RR91002k;00000001B%000t`VF43O zG$8;05&#PTh&KTM00000L<0Z-00000Q6T^T5&#PT2;=|&000000096100000XdwUq z5&#PT=v@H-000006aWAK00000gCPI_5|d#86CITy000sI3jo-00RR91000yK00000 z0062X000t`VF430z99er5&#PT;FSOX000003;+NC00000&mjN+5&#PTKwbd=00000 zBme*a00000-yr}15|d#86B+U$000sI3jokb0RR91001-q00000000J;@jL?;Wg8*@ z01^NT01&?b000000C)ia0000006iiA01^NT03a&?0000007w7;0000008=6W01^NT z0BFJh0000000aO4000000A(To01^NT0PrmV0000007w7;000000DB?;03efL0TUUD zA^-pq01E*4@&Et;0002g000000001)m+?FU7k{rJ000sI3jpxg00000004*p00000 z006oo000sI3jly%0RR91000O900000007S-000sI3jj#)00000003A300000007`3 z000sI3jk>O00000004Xd00000008nL000sI3jpB700000000yK000000000Z000sI z0GD?@0}%xiBLDy(lVJf9e=Q>b01^NT0GLYw0000001N;C0000006`-F01^NT0QkiK z0000009*k80000008k?U01^NT0B8{b0000000aO4000000AM2k01^NT09cy<00000 z05kyr000000Cgh(01^NT05A^$0000001yBG000000DmI@01^NT5&&4q00000000O9 z00000005PjaXteV8K)xv01^NT0GJH{0000007w7;000000JxWNJ_8qj%Od~)5&#PT zcn|>q000005C8xG00000)*}D_5dahb5CsGP00000AOQdX00000ND#OAO#{~flP@+GxA9K{ ze*%|_QUhg|15*Q2mv2)8O9E$KmypB(8MnGq1B(Kea#jPimpNAhpSSK;10(^r9$5oN z0k?Qs1Ns8DgIxn?0ha_{1G=}`UjuIf6ijbnWKwl*bZKp6L~LwRX>Mn1WtT`|1IM>0 zV*?Wcm)%hV2$xu818%q7Wdl|Lmqcd+)(mG~WO8;!b#7xxZf3U_Xai;emw;&lU;^L? zm*QyyE)viS00000007Vn00000002lQmm+EdE)p0s00000000;>00000003MXmttxI zE)jH100000004AN00000002gpp=tv!3cyeR000000Kia}+G+zf5kOG@000000600000(0Tv>00000Fcg>KYXdG40FM9w000000FM9w000001mu?@Yy&O|1akoZ z000001ap^KYy&nD7;^yt000007;^yt00000Kwy`mYy&P5SknOj00000SknOj00000 zbP1Q@Yy&P5(A)t400000(A)t400000ph1@+Z38X}VDbY100000VDgt*Z38w6c=7`P z00000c=DH;Z38w5i1Gsf00000h?m)I12+-)^aB6@0002^^a20?00008mmzKge*$18 zm!fV1ZUT@jmlAISPYgEz0000002u%P0JE2EZv!j|J_7&%0000BB$uLZ12zKlVwc)) F118zhvjqSE diff --git a/third_party/prebuild/aarch64/liberror_manager.so b/third_party/prebuild/aarch64/liberror_manager.so index 759d8e30accaaca6dd3cd9dcecbc97d03f1cb20b..6358365b0c05acca93660d60e3cf70a0a3444d73 100755 GIT binary patch delta 529194 zcmV+W{{#TApf<4JMvxd2pwI;X00000KmY&$00000u&5D{D>Z*K+zJ2y0000q+zJ2y z000000096100001000060001hy9)pS0001hy9@vT0001hy9@vT0002^L;wH)0001Z zO#lD@000000096100002000060001xz6$^V0001xz6<~W0001xz6<~W0001x0ssI2 z0001x0ssI2005ESNfUs(3jhEB004ly3;+NC004ly43j$nB_fE42><{9004-I2><{9 z004-I2><{9000y`00000000y`lY#+Ge}KCS000000D!v;000000D!v;000000DwdQ z000000DwdQ00000009610000000aO402BZK00RI307p($0G}vuQz|^ig{J33Eo*t4 z*6o)xSpWb400jsD01yEH0003101f~E0Kfo1011Nth#3S2gxEkdApo$Tfq(!2f7lGB zVG>hFlnzM?03krYgx~;x1PmY$!5{z#08ju5gdl(elMKi~F0udsAVdrR;3x`&5(kN_?a0ZRoiN)WUnBrrF?AubXT00}@r06+kS0D`C}Kp=t9 zMFH{{3JkdcLJ$B_KHyGC#vlNce+?KR5CAABU;r`>Xo3L)1(-Y&LI8jOngoCV6bKCj z1ORXZMo|O+Kmb5_2yqB9fS@T!%`l<_fFubdf_f+*qzpmuQlJ2UC_(`c#Rby=AOM2^ z24xK>>`;LKL4chQ1P~wr5C8xGkN^SzB!UPNPVmtaNdX7~AT~)LBTbSpe}FU+0y6jj z7!?K*073!890V|nLP7wb0I>jQ000CC0|F8tEF&xk2rvf)l0*fF2*3~kAPh1>AOHXu z+A5I200IJvv;;5!cpw1?RS=*d&=?~i0YM>AC_n&;045Ot0RRGk5DMf36#!t805CCO zK%7Ak03Z*VffyiYK>-2)e+a=qK_I{oA`vJNaUcKy5C}-ZBS{bg7$`t60f0gY0s_E6 zlmJvnQVYNkfHDF=N&o@~h%ToI0u0aqx-tnM3^)J;mHl@0;U880E}rs0LTJN2><~^C`l)P$bbMGG(Z3me{p~f00smA000OK zBmp7G1A>c`1PCGr@hAY0M8^mbBBB@o2oeCv013009^PBLPAH z003f;01%)AC>bLWf59U{5dye1B+BHF5JUn7WU2`Qx(Wb+2~-Hsy9n^C0))Vj0>F?M zKoCGp5E1|)o&XS31j8WEfKUN|Kr0|13cyYmBNXR3=kk(2PhDb z#sf$IR=y_G09hcINC0p{LBIek2mlBI2mlzegX)D)MFa>8e-xk~EQASCU_?ML0N?{C zGzfqyMBzjdU;vT;1P}y(C=dXYKtKQi1;T)W5WoUP43=n&0*Gn=21p@{MGR8_0s;|% zB|;iRfG7zZAP@j0WD5Y$jfkiMngT!}0#X79gis&=AOX-q8$#G1fJPADqyV4^0zeP} z00;m85CI8Le?UMO003|ZKmdUNS`q^V&p{4A282ie4G4i1F#sST2C)PH001HY3IKo- z05AXm00Pkfhi#x6)Bq#|Lqvk$5CA|B2mk5sVa&fG99#0tNwta0&=yX5kNp7H9+KI2{@V*hzJ@0Okg463B(|R0VqfilPE|?Dgl52 z0U!tfe}DiGz&9@l6a!9B0GJTM0hAyjfIxr)0s#PkWf1@Y0{|FW24ty1R3#AzA}~-8 z0{~Ei00IgEKmiC81ONep2tY&tAp``90!auU00aOCfI|cjFa+Qc*$`9!fhYlz1ON;G z000350000W0B9os2vG`6W?%pa2$BFm1ON~ae*i&X1p)w2NDze$s*ofQ6o3Q>07xK0 zAR!=>2%rD}7(_!20RX5Gj0Tk?nE(nA&}mYH1OlXh2EqgY00I^Qgaji2000Vu5Eu{u z00BS%h5$r}LTC&Uf`M=V073)`kRkvB7cc;ju%HA&00;;H2mk;u6p#QQ2t_1HfJA@* ze*pn>G7E_fK!gerK!}8phzNvN2yg*V1YiId7$AWd0U!V*01Jj_z*tt2{0t}nAV5(= zkTehg0E9pU0XTwCAyk9_3=jZmC=?XvfB*yn0007E;sFRC2moLJ0FokL0-y*50Dxcs zLI_|RU=#u*fk2H(BPOd51HhCL2PUARfA9qcphyro5TpQv1pqMtG6@KPGGQR01T+u; z0GP2G2w4Ckpm+f>08Rn`BLo@|3?LDpAhiJyKq3$X0da5u5ikId03lW-FflSL06<0n zMl1o4zyJUM002n@SPcmR5@ARP000yg1tc+GAw;PP0LUmuN>E`KFTfO{fJ#7se;}eM zSPB&bgNh=x2r_^H004q28H@w~AQ4Cb0%NI2Y=K4$2p}K~qA)lC01$MLA%ZOch7te> z1R;?+DQGpQv%r1a}WdIQ%aR4wx zpa=*FVk;DZf)a!Rn*;$wx17OQe~2amWDGzc0)!$A6d*1ELjVW_0#E>eoh$Nm3jh%)A&}4r14LjTLJ$BXC>ekv z007D%Km?))BEl$Q000;OAO-*s5HOGxfL;Iq03a~{074iGC=^HoMZ*#xe-RY?$^aT< zN)SK*h>Z{d07L?y002P(Qvm=7Ge`nR!VoM50000=5Rh=75(Ofx5Cl|!1Ox(t0s_z= z1Q0YW>7auEqSH002w@002z^002(`00000002+{0Dk~d0RR910000~0RRA20RRA30RRA40RRA5 z0RRA60RR91000170RRA90RRAB0RRAC0RR91000000001C0RRAE0RRAG0RRAH0RR91 z0001I0RRAL0RRAN0RR910001N0RRAQ0RR910001S0RR910001T0RRAX0RRAY0e=7h zc>w?bdI10cdjS9dd;tIeegOag00000fB^sig8={lgaH5mg#iEnh5-Nohyefq00000 ziU9xsiva)t0000000000i~#@ujR61vj{yJx00000kO2Syk^uk!lmP$$l>q<%mH_|& z00000m;nF)nE?O*n*jg-00000oPPlT0G|N>00000000000H6T?0HFZ@0HXl_00000 z0Hgr`0Hpx{0H*-}0I2~00IUH30IvZ600000000000I&f700000000000I>l80I~r9 z000000000000000000000J8xA0JH%B0JQ-C000000Ji}E000000Js4F0Drjw006oH z00000006xK0000000000006!L00000006-O00000006`R006}S0074U007AW007DX z00000007GY00000007Ma00000007Pb00000007Vd007bf007nj00000007tl00000 z007wm007(p007+q0000001p7*0RRBu0RRBw0RRBx0hhtZ2qu5%0RR91000000002# z0RRB%0RRB&0RRB(0RR910002*0RRB;0RRB=0RR910002=0RRB@0RRB^0RRB`0RRB{ z0RR910002{0RRB}0RRB~0RRC10RR91000020ssI50ssI20000000000000040ssI7 z0ssI80ssI90swyi0000000000000003IYHC4gvrG4*~!H5CQ-I000000000069NDL z00000000006aoMM0000076JeO00000000007XknP8v+0T90C9U9s&RW000009|8aX zAOZjYAp!sZBLV;bB?15dCISEe00000CjtNfDFOfhDgsjg04o9j04)Ll051Xn05Ado z05Spq05bvr00000000000000005k#s0000005t*t00000000000000005$>u05<{v z000000000005}2w06CX20SOZ&I|2XzJOTg!Jpup#J^}y$KLP*%00000K>`2(00000 z00000LYFZC2@`)r0ssI-0ssI;0ssI20000-0ssI=0ssI>0ssI?0ssI20000>0ssI_ z0ssI2000000000_0ssI|0ssI}0ssI~0ssJ10ssJ20ssI20000000000000130ssI2 z00000000140ssJ70ssI2000170ssJB0ssI200000002S&UjhIC0000000000VFCaE z00000WC8#H0000000000W&!{JX955KXaWEL00000Y61WNYXSfOZ2|xQ00000Z+00000000000Gk2;0Gt8005r?00000005u@005x^ z00000005%`005){005-|005=}005~1006530068400000006B5006E6006H7006WC z00000006iG000000000000000006oI006rJ006uK006xL000000000000000006%N z8vp>o0ssI20002P0ssKU0ssKW0ssKX0ssKYmoWhe6O*t32!G20007Ja007Pc00000 z00000007Sd00000007Ve007Yf00000007bg00000007hi007nk00000007tm00000 z007$p007+r007XX00000 zA_D*b00000CIbKfCj$TgC<6chD+2%kECT=lF9QGo00000FarPpF#`Yq00000GXnqs z00000Gy?zt00000HUj_vHv<3wI0FCx0000000000Is*UzJ_7&%K?48)LjwQ+L<0Z- zMFRi;0Dk}g07nA=000000000007wG>0000007?S@080Y^08Ik`0000008s+~08#@0 z08;}109FG409OM509XS60000009yk90000009*qA09^wB0A2$C0AB+D000000AK?E z0AT|F0Ad3G0Am9H0A>RK00000000000B8dM0Dk}g003zN0000000000003$}AvjYGCv;zPDwF3YE0000000000 zwgUhFw*vqGxdQ+Iy8{3Ky#oLM0000000000zXJdOzykmP!UF&R#{&QW$^!rZ00000 z%mV-b&;tMf(E|Vg(*pni)&l?l00000000000000000000*aH9n00000*#iIo+kXQ9 z0Nn!s0Nw)t000000O11w0OA7x0OJDy000000OkV#00000000000Otb$0O|t(0P6z) z0PO<+00000000000Ph0;00000000000Pq6<000000P_O?0QCa^000000Qds{00000 z000000Qmy|0Qv&}00000000000Dt`h00902009330000000000000040003500000 z000970000000000000C8000F9000OC000RD000XF00000000aG000jJ000sM000vN z000yO000&Q0000000000000*R00000000^U000~W0015Y0018Z001Eb0Dk}?1ONae z1ONaf1ONag1ONa400000000000000d1ONa40000f1ONa40000h1ONam1ONao1ONap z1ONaq1ONa40000o1ONau1ONa40000t1ONa40000u1ONa40000v1ONa4000000000x z1ONa$1ONa400000000000Dk}gJp=#%KLh{(00000Km-5)00000K?DE*00000LIeN+ z0000000000L<9f;000000000000000MFaoUL000000B8gN000000BQsP000000BZyQ z0000000000000000Do@;0043X00000000000046Y000000049Z004Ca004Ic00000 z00000004Ld004Rf0000000000004Xh004dj004gk004jl004mm004vp004yq004#r z00000004;u0000000000004>v004~y0055!005B$0000008Rh^0001z1ONb&1ONa4 z0001$1ONb*1ONb;1ONb<1ONb?1ONb@1ONa40001^1ONb}1ONb~1ONa40001{1ONa4 z0001}1ONa400020lkpQ1Zm$FY0I&oA0I>uB00000000000J8)D0Ja1G000000J#JJ z0J{VL0K5bM0KEhN0KNnO0KWtP0Ko(R000000K)_T0L26V000000LKIX0LTOY00000 z00000000000LcUZ0L%mc0L=sd0M7)Ip#dI$&;$Sg(F6bh(gXki)C2$k0000000000 z)&u|m*8~6n00000*#rOp+XMgr+ynps00000-2?yt-UI*u00000;RFBx;sgKyz}(>jVG*?*sq<@dN+>@&o_?00000^8^3@^#lNa z0QLj`0Qdv|0RIF4000F5009L600ad90000000jjA00spB0000000#vC00;#D015>F z0000001O2H01gEJ0000001yQL01*WM01^cN0000002T!R02l=T02&1V0000002>7W z038JY000000000003QVa0000003Zc_001Ec001Hd001Th0000000000001Wi001Zj z001im001oo001uq0000000000001%t001)u001-v00000001@x00000001`y001}z z0024#002A%00000002D&00000002G(002S-002Y<002h?00000002k@002pU1poj` z1poj{1poj}1poj~1pok21pok51pok61pok71pok81pok91poj5000181poj500000 z000191poj50001A1poj50001B1pokI1pokJ1poj50001G1pokM1pokN1pokO1pokQ z1poj500000000000001M1pokl00000Z3O@TZv_AV00000a0LJWaRmSXas>bYa|HkZ zbp-$bb_D0G$N@0G00000@dW??00000@&y0@00000^#uR`0000000000 z_XPj|00000_yqs}`2_#~`UL<0`~?62{sjO4{{;X500000000000tNs8000000|o#9 z1O@;A0000000000000001_l5C00000000002L=ED2nGOu015^G000000000001O5I z0000001XBJ000000000001gHK01pNL01yTM000000000001*ZN000000000001^fO z02KxR02T%S02c-T000000000002l@U0000002u}V02&4W0000002>AX00000038MZ z03HSa03Zf`001Ed001He001Kf001Ng001Qh001Wj001Zk00000001cl001fm001in z001op0000000000001!t001-w001@y00000001}!0024$0027%00000002A&002D( z002J*002M+00000002S;00000002Y=002e?002jS1^@s^1^@s`1^@s}1^@s600000 z0000_1^@s6000000000{1^@s6000000000|1^@t41^@s6000101^@t71^@s600013 z1^@tA1^@s6000151^@tC1^@tD1^@tE1^@tH1^@tJ1^@s600000000000001G1^@tN z1^@tmXa)cPYX$%SYz6=TZw3GW00000aRvYYa|Qqabp`+cb_M_d0000000000cm@Cf zdmfCc~nfd&8oga!Zrg$4isi3R`wiUt4xiv|DyjRpV!00000 zjs^e#kp=(&00000lLi0)lm-9*00000mj(cT00000000000GS2=0Gb8>000000GtK@ z0G$Q^0G|c`0H6i{0HOu}0Hp>10H_840000000000000000I3E50ICK6000000ILQ7 z00000000000Idc9000000ImiA0I>!D000000I~)E0J8=F0JH`G0JjDJ000000JsK! z00000006oM00000006rN00000006uO006!Q006%R006)S006=U006@V006}X0074Z z00000000000077a007Ab0000000000007Je00000007Mf007Sh007Vi007el00000 z007hm007kn007qp007tq007$t007*71^@uw1^@ux1^@uz1^@s60002u1^@s60002x z1^@u&1^@s6000000002z1^@u+1^@u-1^@s600000000000002&1^@u<1^@u>1^@u^ z1^@u_1^@u`1^@s60002>1^@s6000000002?1^@s60002^1^@s60002_1^@tm`vw32 z0000000000{00C3{RRL4{ssU500000000000000000#g71P1^B2L}KE2nPTF00000 z2?qcG3kLuI3DY000000000002~JZ038Pa03Qbc03rtf z03!zg0000003-(h03`002e@00000 z00000002q{002z~002%0002-2002@4002`5002}600000003480000000379003AA z003DB003ME003SG003Wq2LJ$I2LJ#70001E2LJ$O2LJ$Q2LJ$R2LJ$S2LJ#70001N z2LJ$V2LJ$W2LJ$X2LJ#7000000001R2LJ#70001S2LJ#70001T2LJ#7000000001W z2LJ$f2LJ$g2LJ$i2LJ#70001d2LJ#70001e2LJ$m2LJ$o2LJ$n00000fd>Ep00000 zf(HNqga-fsg$Dot00000h6exu00000hX()v00000iw6Jzj0XS!0000000000jRyb# zjt2k$j|Tt%kp}<(lLr6*lm`F+nFjy>00000ng;*?oCg2^o(BK`00000p9cT{pa%c| z00000q6Yu~qXz(g000000000000000000000Hg;10Hp^2000000Hy~30H+540I3H6 z00000000000ImlB000000I&xD0J8@G000000JaAJ000000JsML00000000000J#SM z0J;YN000000KEqQ0KW$S00000000000Kf+T000000001g0000000000006=V006@W z006`X00000000000071Z000000077b007Ac007Ge007Jf007Mg007Si007Yk00000 z007bl007np007tr007ws007$u0072LJ%?2LJ%^2LJ%`2LJ%}2LJ%~2LJ#70002^2LJ#7 z0000000000000000002`2LJ&42LJ&62LJ#700000000302LJ#72mk;92mk;A2mk;B z2mk;C2mk;8000052mk;E2mk;I2mk;8000000001g4F~`L4hR4M5C{MO0000000000 z5(oeQ69@nR0000076x05k{y00000067Q%0000006GW&00000 z06ho*0000006qu+06z!-06_=<07D1>07M7?0000007eJ^07nP_07wV`07?h|080py zp#c_uO$Y!0Q3wD4QV0M5R0se7RR{n8RtNw9R|o(A00000SO@?B00000S_l9D00000 zTL=IETnGRFT?haGUI+jH00000Vh8{L000000000000000WC#ENXb1oR00000Y6t)T zYX|@UYzP1V00000Z3qAWZU_JXZwLSY0001g0B{HZ0C5Na0CETb0CWfd0Corf00000 z0Cxxg000000C@-i0DK4l0DcGn0DlMo000000DuSp000000D=er0D}ks0E7qt0EGwu z0EY+w0Eq|y0E!3z0E-9!0F4L$000000FMX&0Fnp*0Fwv+0F?*;0G0><0GS8?0GbGY z005f^005i_005o{0000000000005r|00000005u}005x~005#0005*2005>4005^5 z005~7006280068A00000006BB006EC000000000000000006HD006QG006TH006WI z0000000000006ZJ006cK006lN006pw2mk;8000000002I2mk=R2mk;80000000000 z000000002K2mk=T2mk;80002Q2mk=Z2mk;80002S2mk=e2mk;80002Y2mk=j2mk=k z2mk;8000000002d2mk=n2mk;80002h2mk=s2mk;8000000002m2mk=w2mkIeV;>j(e?g#(??+5?@00000 z0000000000@CX0^00000@dy9_00000^9TR{00000^aua|^#}j}_6Ps~`3L|2`v?F4 z{0IO5{RjX600000000000001g000000R9L700000000R9009XA00IdB00RjC00jvE z00s#F00#*G00{{I0162J0000001XKM01pWO01^oR022uS000000000002K)U00000 z0000002c`W02v7Y02>Ja02~Pb0000003Hbd0000003Znf0000003r#0001Nj00000 z001Tl001co001fp001os00000000000000000000001rt001xv001!w00000001-z z00000001=!00000001@#001`$001}%0021&0024(0027)000000000000000002A* z002D+002M<002P=002UN2><{?2><{@2><{9000000000+2><{`2><{{2><{|2><{9 z00000000000000=2><{9000000000>2><|02><|32><|52><|62><{90000}2><|9 z2><|A2><{900000000122><|C2><|D2><{900000000162><|pTnPXGUI_pI00000 zUkLyJVF>^LVhI2M00000V+jBNWC;KOW(fcQXbAuS00000YY6}VYzY7WZ3zGX00000 z00000ZwUYZa0vhaaR~qbatQzcbqN3fcL@LhdInehB~ofe8Qr00000 zf(ZZsg9!itg$V$E0Eh_y0E-C#0F6rQ0>2xY?aNBZ2PJW{cu|hnRJ3g`q|1J=;BZ0j z*G}&6QUjvUklYbBXlwMNsV5*D(GW}rKb|eiRqrvPZ!<(J^?JgK?j84-Q+a%*t;m4+ zZcAV~uStY8oky&*TwwG!5v^-!i+O{)1e*t<$BraclO-*G^<1B;Ph!`(1y_wiYmujd z88^d;6qw3-{J=M;00DY&JJ$lRZgj!NTa@fZAtcwppu*IO5V&`7j}E^)@_k-ra?d3M0tU-#`FUe!oWa^*YWz9e@#?Q82BAS$-4ZxvC< z{w67ZXn_)cRS=0a*9P0w$>=C9+w1~&!Bc}mc)3R_O%d@Z{4|}RHIM8e2EiNM5m|Qa zF@6oR2ua4&&Tl96f%z__GSQH*aJT1Q^yqYX-7rB9pB}{1($C8vX2c99AKhBNBwP(R zxvn4ai9FaI`synm$3qG1sa@nnu$n*T&SLbcWaj^WZOKbH+5`~r0AOEShhq@*50!8& zFy*HTR`2@o$2DE5NqOD87kiF5>v_}Y zrGG4cuy|3S!kH?|*&%$ftO~^t@eA;K+)fzM>cLz3@%&Vn9if)tIb52Mh$!% z5SsfXhhceTC5H8SB z`?Xb7+A^eIPHFya7iwpIiuh@dKBej>T&mFk4FFg)Z)@*D=G(s`8| zA@RqX!a<@C^b{FKD6Fn z@jp??Ud~zlK^{V%KxJjEvrx>%Sc_zTw4np~G>A{C^{%3hxGN`~SD685UVM7H0UlHH z@f;b#V(Eh!^Bft%y`^%iqNt2g&B)b>5e(cU5&!zh*DQR0ect_j`WzX;dnp;B){9*e znlTcB`y3g<`Me-1{lln>N!5Dy?~1AcanxgR&AscIopdmUaezCFBwO zT@C9*k~K33McvFg0&VF`gO z*YxRd@MS~N0^cJ*beUQZrc&5{^!jN@l0~R?DGQwx0*X!01~y8#?O)$R*1$KJ3}yxG zTqIke7@|iqyJn~!ZbkB1#Yv2L*3DZX zO#IF{OB&22$=n}5z5urT`$?ho#{lP~KTI;|_dU14V%{W{vebZX3%UULzUiM)pw3zD^l1%Tpkmw^h5)d5A8d zMVh(7ads3i?m2X-YSNP~k=&fWVrD@VpO4YItI)fo!@s)>6!UPHzJAjDJbV5}J7y)f=>z6qarPpJl2jr*vCCPLUAE z$kd8Eknzr!;!6=w^T;!iekia+SmCsF2#{~?GI%cM6`h|>)JbrU?6iv;og3%aK^{4GQ6cUROeUde4 zjX5JF0=dn+u9=D5Wz?DQlb0q$)Dnns)fL;E?V@OZQ^>E0xrqOf@Uwm>utDJ-ac<%U z3f1WTXG5ltc9vzAZWWZ7+!!$3GcjAj12v;!BJkZSSYV2=Y`q*b<7dr3%6I3z^&{ zVi{7Ymd`ean-l)St-v+I1@sKj9n~1qTXKp#NGR&;(@+J=uWdD--5S1479=E`wX@G>Pm=z4a3U>8P4IIDNtd7}ij(=j;oP>& zozOX9kt&-%sqHr?$lnBbgUfq|G|0f0-QU4!kzU)Ct^dBMe&A1OxhZ|G@4-~dP%2FhDy~o zWg1WtioGofmW)cSup4?V+x+qH$~pabrUO)DUtgZR21i)6Mp2pw$F=tDKEgI3L>dS z+pokVh2$Y6NS4rPTi{7 z1fK))2ZtXtbT+ZGsU}%}z_;2BBw;QlMj4egTQOr|+Helc-HTb{N zPlo7V&ZtE0PYcv=T5$nbi*qT^;f*qzvM7F3BzqcXWh3NFUSc*cufz~PwCZQOx{`gM z?~~-RW6SOfyZ4I*aEO0^z6(V|wRDND&qMo15xF80Q#gTIRTmdmN_|B4n><(|v1FcU zf4NSUs_+MS!nrOGnH1!IAn)V%f3SoK?gv2!cZCS@ysivteDE2`$=mXa;3VLHG2RWg zc{N)BXt9DRY-{JEl=?SB4#VP*ZTSd0q4pOS7%-k+Q*%*5z_1O(^_5W0{`M-;)t3)q zx~taSCx}u&ktZ21d2iF4lLV)mv6Dz0UQt-^y1UkbVIR>BTFn1{I#SnX-eF$JP6x-S zPO6!3vk-bSmZc;itZZws{}kya!9p zZdX0cSRzWm$N;;4v!;%Ga@S;$m-B=^eb$);7(bSm^eKH)6$|ctl%cIrOT+Oi9rWNUA8P5E`toWn5aG=J@*O?$;Ul1Y{ef7HNdFyFcK$L1NiOrFHA7zmD z2qSb<<#s0xICOO?D?VOQ;!5@U?a9W8KLOGWH^#0Sv!$^~Ye6_wy-7Ikd(2eV zr}r-TlKJ6(%8;5{1p$3$wioEAUMTDNA23TTAXzv7!I*KZ+Zi&xq!`1N$)_vhU|Tv+ zF^`17dK3mZY0G`8Qs-?vnC|9?fMOX%#$T`?_3?GbfHp|2;08bn(wnfh#R>SYEL<=+ zv|G?Y?GIdUl@*vPbE@PSBK%00}eM@GRu`{2( zW{CLj$M?D0y*d4S5<|HUdlpY(b(U?Nw0NNAyax~0$Qhnhvc~6kh2NTt(vuOUVZ=n@VIurPJzcz z9d$hQ0C|gyuy*h9K`vuKi<|nsKVHg_Y{1K$PqptkNHib2QH{qt#BKT`$-_@|#Ro2NJJm-7+!;ru+ih8i% z_-_9n(xxtzI`lG*{NYetX4lIyUn4aH9SvSVa}ezJDW#=< z$Sd33{orzO~mmu0~Oi@~}qqnGTKDNO+CX;mJv(_>j=doC+oV8kv zeT{cZts%K+A2_U=DZ(1$Aw^Nx~+5V%`n(_lOHhZ{RJM3aULZXeH) zd3N-6)f$VJ#?FhP$xuNE-eR7pxp|`eI2@3q{y7V1qp67WL#b8!Bxd53NY?m&hCQwS zDOP3!+FF8Pk7y6PHMeNRI`e5+Ds1oW*6aekQt>?vb?t*H*U1N*;H7Slp5CSA_cWdU zFtu^J0u9m666giLGvqqwAG2H;{qKh?3$fso%5Ntw!Hq_J1PAP8F42(9njXaaF$wk{ zNaQbxT1mIR?=cA`ivVi(w5}h231|X!1+1Dsr&ou&;LHDJKfXE}pCUI3Y@2I^Ywr8N zTxhQYKlG>g+qG)sbN&yw1>)bcjrUwS%8zJuukU>55r@(NnnLpUl7vx~=_QYP{WGct zvt=l_+f=?J2{3CCPz^L?t>R7xM!3mBo%2H%+0!1L%r>m(Nb@0?WV< z@sgHu?|sT1u|BDe?9*}3n*}kFPAxvHe=FGFrS@`{W+LP&MfGtnq!Y>~tVO2Kkc>!1 zQ7u&(dWrCoJl?Dt;;d4`twCT_lfl`;41cf~nC`EHqMh~>zN zkTy3CO>Ap!iuwFih?A**hyaC(p<~oV5(Rc4#B>Gpbdv`mkV_d9q&gu{I8MEFWyo}$ zPAPxH&}`3DOgT35?AjSnFVX@77y-BLjX71uXC_pNGUmM1Ki)Hi`h>t)F|V5f%Yant661H9oYJ z+8hc5qVbFVCM<+^MS%T7db@QMdHS$U}CkC4P-~gH_7gq5bV!4}O4n05Hqe zS$~c>PWLCtF?GtbT{_qUunD+|BK*re9bsz7b-yozF^vs>02r5bWC39Ms;~kw@1Wvgc%vD)Fo-7sDgcQZQ%^K_!3wZ% zv+wqA?!6HO4FDiHHY2i*o>i|1{l0<^5xI4Z5ti7KIGdA5No-m@K@MIoLsOla%%X2PIX1R-FP^Gu1jXgBQ9HyH7_8+j*b# zg2oS%bQkoL7Y$58pW<5kVHydp`GX?^x6uOP6`{hjf!9LCsg0Ql@cFyQvu6bGxw?p9HM zpnKGdHEts_y=M#qi$G8S(YK?mnat0i&fE1&tLix<#c}3CS$>7x;WfLulcAPa6>Jz@ z>*p~tbJg{YYi&)=NFas3uE3m-u`&oDfgx-BMoR@#V&S9?;aXL=_-D0Yl4NO#Kbhz) ztZqdFYcn-ojG<>xA3q>f<={t90y?XIG@vz3i9v`-62&9}c>_9m2X;{{{*TbHG`U?M zy9>SSNmKQ~Pvl59R!|tcBk{R`t#ue{et7)SF{Ap7J4@tQ7ThYOtDq#EuBBo;Q-1jw z&j&`?;YRidxXLpOC&+IR#=cHvSklh4ZA|rRc#n*^M!~l-#kDiL{t}Eme#u z3!A_&lD;Y#Gg%hskO+5Cjms*KL!5~YNc`mA{WFCZnLB9IgJy79ZqFaNji=-Y5i-@ zF}3fph;5aL-I-8cDWhOSJ)?d7VhgK-O5%@8Ujf}7anjEk^OWTNXALKRD*5lzrM%&u zX#$n9YO{E0{6furzE3>9CT2adB{6$fVn>vCplZP%*$yw{5UD{><&DsiqeVJ6GeXVSP4Lv~>reO85i(_MbY3$rgKpzGgb@jsmzGuR^u&LXV; zl2=vZ{#KHlq1~T6YuI#uL?pR)`tU;YO+L0L4TEX}-Gmn}lg#Z(a=+_C=tePRFCuS^sqlUH(zSNu0#BVxNNH+BDK z6|YNTl1(_7a!3F;`JbQ%|RK}=2e`A&!_l&h1u{v$x2q3ncOeHxN3HX!e=Uo=w8H=HO%pCF3`)9omG)y`oh$~$*(nv3JJS1cg4H|+fFvU~r0{7X^c^bxl?w;KF)7kEBHINN*|78f^hs9U*>ki{peivwh}hQ!(e;Q@q@T6h3pMiH|x7a2-cC z?X7)eG6Pl@Zom*ft*@6iErX}76<~6T;0)jH!|Z6mZVh+;EjcSwDu{gyvpD|5vpv`J zHQdI3cOml*oFg8eM^*2^70Z|Tzu(k3VbcpwA9(6%VlMk!U_caStAn*J5K8x?VyvJ? z)DOj7aZfaxF$V44hXIki!3Km`zilB&z(vEJcZf=0J~ohCKA#bPG;&5AZQ$3@<`X0R z`tO-vQ<27u&B0GA1?OAWr$o^uU#qDOVjVYsTz;-$ZmFdguL`&wuPTWt6G?LIn%aN(1#>O}iaoaOfHgGf*7_F#BUquntUmrrRn zYW*=aMeeXHA`>{tUz6(pDbT$A0azIa(dW6HVvK$fL}m<@IC0DD`}Bohayk)F5kG!^ zk>dSl=fec{l=c2=_Ri6#W<&h0s|3-RLfwp+=R>dOkcPWvCxmJTmFs@*uGNVP zIAe;_o1En}4v^oRfiQ0u=?fmw0Ec4h4G~;o_dv^=_JAnGhYUAoYWly`(|J zY)_q&l=nr%Y)?1_kih&KQ8>37(|JKlUQguRgX=fK7$DIf`ql}Z&V#>y0HfH#C?iQU znwI`-L3yY~`Nh#8#EH;fAq7>jaf4BGOhh;OS#BB*it-?hAJ38++B+Kqf#1F8NYKul zg!fhpBQL@H(>(+o;np0IX+QiL9#yg;^?4(xm zI?jl>h?O%fj9u^~#!^au@2H%R`yjU#8*d8}oHKL6r1%yMPyRvE%v8jP?pfZs9eo<< zBVHM&FNQI>nNel2-z8}=xY)a{Ylj7dlkGoiows=&sZ#~?@g`ga{tcM-)qBqE<3!;S zT}!p^drz0i6wJ$(WaCVluLEJuiprjQBas^4f&WWo10sw{Z~rxaLabeS-Dk`S()r8c zK<@$aAhEt#0;E#Uv~3--Eb)4W&?mufNRWhV5y`fO?mG!&3^-zD#?lEA7oE|t*f8KE zpo1B1Sw_=5{JeUHliR)EII*P0$`S|Cgk3YxOj0wz}gs$YM;OU@7@48cNf4^ zS3%S1v^t5=_~oei4fE*at$Bauie{xwP+F8Q;WBepjC~(xmyKG-mdW-2CfpIKHzxOV-jok^U%7j#S$Gx`s>D+^f*1tHn;q9i*NYTCwDSD5Sw zke0k;Q@l^x7d9brI#=Y-+v|i94ABqd42P?MXP%PQY@ic-R6^lXdnXG7{u-U-sR+FIt95Dj` z2>{Sl1poj5000000000000000000935deU@3;+NC0000000000007)c0{{|}p#c*G z!AAoC5|g0;69rof0RR${p#c*GyF~*45|g0;69pkP000t`p#c*Gmqh~r5|g0;69M^? z5j__LMo9wz5|g0;69wHx0{{|}p#c*C0+#{r2^R&Z{r~_Hlc50<1;Jqe01}g-0TTtt zM*{#7lc50<1ua7W01}g-0TTt~L<0a4lc50<1@A)x01}g-0TTs{LjwR3lc50<1zF0{{|}p#c*GnMVTv5|g0;69t7u0{{|}p#c*C zQUw0{{|}p#c*Gfx`g+5|g0;69I~oAwL%dFEjuE5|g0;69rww0RR${ zp#c*GY#IOn5|g0;69uzY000n^p#c*GRzm{-5|g0;69s=X000t`p#c*G6Gj675|g0; z69pJF000t`p#c+<$T=7VR%`(P5|g0;69unG0{{|}p#c*G{VM0{{|}p#c*Gb2I<|5|g0;69tI|000t`p#c*GwnYN~5|g0; z69qp=0{{|}p#c*G4hsPQ5|g0;69xAh0RR${p#c*G?mhzm5tE?-69rpB000t`p#c*G z!@~gp5|g0;69xQ40{{|}p#c*CC6_V62^R&WM*{#7lc50<1w2Os01}g-0TTsNMFRj5 zlc50<1%^fg01}g-0TcvC0{{|}p#c*GT1Nu_5|g0;69xB00{{|}p#c*G>qi3s5tE?- z69uth000t`p#c*GCq)AQ5|g0;69q*_0{{|}p#c*G+gAVp5|g0;69s)o0{{|}p#c*G zjzt3i5|g0;69qv@0{{|}p#c*CKa&wU7X?ru000t`p#c*G@<#&z5tE?-69rK_000t` zp#c*CDwDxD7X{=;0{{_|p#c*G3q}I~5|g0;69p1T0{{|}p#c*G?nDCs5|g0;69E{L zaW@wQrbGh(5|g0;69t<_0{{|}p#c*GU`GQ05|g0;69sie0{{|}p#c*G*+T;W5|g0; z69p6-000t`p#c*GYr_Em5|g0;69wr-0{{|}p#c*GLBs(75|g0;69xH40{{|}p#c*G zb4LRJ5|g0;69sfh0{{|}p#c*Gt@!}}5|g0;69pSd0{{|}p#c*GD@X$X5|g0;69u;# z000t`p#c*GOh*F%5|g0;69sHV0{{|}p#c*Gmq-Hu5|g0;69wg-0RR${p#c*CtCJBu z7X^7q0{{|}p#c*GW=I175|g0;69xDi000t`p#c*G9Y+HI5|g0;69qF^000t`p#c*G zB}fAR5|g0;69o-P0{{|}p#c*GU_}D}5|g0;69v9V0{{|}p#c*GX&V3l5|g0;69Fre zp*I%=r$_?;5|g0;69G??0XP>0Y)AtD5|g0;69q(t000t`p#c*GJVF2f5|g0;69FQV zaW@wQq%{Bl5|g0;69rmH0{{|}p#c+<;5--wenSHQ5|g0;69q{|0{{|}p#c*G2}A<` z5|g0;69v@l0ss<|p#c*G?N25|g0; z69tha0ss<|p#c*GpcnuE5|g0;69okv000t`p#c*CPLlyR7X?j80{{|}p#c*GfJg%X z5|g0;69rN<000t`p#c*C;g=x-3Ks<~Ndo{9lc50<1v^Ot01}g-0TTt@Mgss6lc50< z1x7Rg01}g-0TYujJ{Sdsy#N3blc50<1vE(m01}g-0TTh$lW{i}1zto001}g-0TTsM zNdo{9lc50<1=L9c01}g-0TTs7LjwR3lc50<1lW{i}1xQ2#01}g-0TTt!M*{#7lc50<1;$7N01}g-0TTt{Km!00lc50< z1)xX+01}g-0TTr!M*{#7lc50<1%1x}01}g-0TTr<8UO$ilc50<1?5Qt01}g-0TTri zMFRj5lc50<1*bv)01}g-0TTs~NCN;8lc50<0mqYZHx~sgLI3~~lc50<1;axF01}g- z0TTspBmw{ulc50<1=U3Z01}g-0TTryNdo{9lc50<1zr~b01}g-0TTtOMFRj5lc50< z1%M#{01}g-0TTtGNdN#6lc50<1$RUP01}g-0TTfkmodT#7X^((0{{|}p#c*CGn1h= z7X@u50ss<|p#c*GC`JPS5|g0;69rZp000q_p#c*G-A4le5tE?-69w5w0{{|}p#c*G zVl)5%5|g0;69q+B000t`p#c*Gphp7$5|g0;6O#}?7zHvJ000t`p#c*GTpIuY5|g0; z69rI40{{|}p#c*G!bJlB5|g0;69wW$0{{|}p#c*G&no}`5|g0;69v;m0{{|}p#c*G z%2xmY5|g0;69pa_000t`p#c*G(nbRS5|g0;69o)N0{{|}p#c*Gxkm#45|g0;69wu< z0{{|}p#c*G$3+7G5|g0;69r~K0{{_|p#c*Gutx&`5|g0;6PIwz2n3V7KokY;Ndo{9 zlc50<1%W*P01=a+0TTspJOcm{lc50<1=dFc01}g-0TYwxKo|uyL<0a4lc50<1tP=& z01}g-0TTr_Gynh+lc50<1$;#V01}g-0TTgHlL0sv1+7B^01}g-0TTg-lMy->1yn}^ z01}g-0TTtppaB39lc50<1^Pe(01}g-0TX|W%mDx*01E)5`v(930000u0000000015 ztN;Ka01E)r{RRL400013000000001?TLJ(g01E&_S_l9D0000K000000001rM*;vM z01E*8L90RSQZ3jln62LJ#7003M700000007oi001HY z3jkz>1^@s6002w?000000053M0RSQZ3jp|Q2LJ#7001Ze00000008V20RSQZ3jmB> z2LJ#7001li00000005{@0RVp@01E(sBL@Hg0000K000000001?aRC4#01E)@KnDN- z0000e000000002>ivR#301E)Hga!Zr0000q000000002fYykiw01E(Yga-fs0000K z000000002r_y7PR01E(U#RdQX0001F000000000*4FLcm01E&Z;|6~K00000JOBUy z00000)aC*JA^-~j^ppqy000006aWAK00000u@ z0000S000000002T!2tjw01E)1e+K{n0000`000000000FMF0RI01E&#UE(ibs0000$004gg000009HRgLA^-~jD9Q!^00000AOHXW z00000qbvacA^-~jm}v(900000SO5S3000003w;0pA^-~jxUU8P00000C;$Ke00000 zJIw(AA^-~j===u&000008~^|S00000=LG-&A^-~jWI_f200000JOBUy00000ydi%8 z03rYj0H{<3000000F(d#0000005S6b03rYj0K7j30000007w7;000000A_{&03rYj z0Ca%{0000003ZMW0000003+7`03rYj05By70000003-ka000000G8|m03rYj0LYgJ z0000005kvq000000L^y+03rYj033gn2LJ#7000CA00000006;g001HY3jkPZ1^@s6 z001li00000004>p0stZa3ji3M2mk;8003|R00000005{@0stZa3jkOh2mk;8000yK z00000000^q0{|ib3joBR2mk;8001Ze000000071K0RSQZ3jj1D2mk;8004g^00000 z0002~Hv#}601E(+4hR4M0000$000000000}!2tjw01E(M_6Gm}0000S0000000015 z+W-I}01E&pDF*-m0000m000000000jE&%`{01E(k4+j7M0000a000000001DB?15< z01E)TFbDtu0001-00000004ggIHUjoA^-~jP>==y00000Bme*a00000a~A*rA^-~j zOh*O)00000KmY&$00000>$v~`A^-~jn3@Iv00000C;$Ke000007L@=1A^-~jNQedi z00000AOHXW000006dV8mA^-~j>`Vp#00000Q~&?~00000Ml1pVA^?9208|JF00000 z02BZK0000007kw703rYj07Qle0000004M+e0000004w?d03rYj06ZiJ0000002}}S z000000LgFx03rYj0HB2j0000005AXm000000MM%e03rYj0G#Uw0000005|{u00000 z0LTmh03rYj0FdGa004gg002w?00000001_A0RSQZ3jna72LJ#7006uM00000000Na z001HY3jma<1^@s6000yK00000001kO001HY3jjRB1^@s6000;O00000001kT0RSQZ z3jmbm2LJ#7001BW000000068C0RSQZ3jj1%2LJ#7000;O004gg0000%$pHW&01E&B z`Ue020000W000000000t$pQc(01E*0hX?=w0000K000000000B9svL%01E(U00#g7 z0000W000000001=B?15<01E(EF$e$v0000i000000001>mH_}F01E(A;s*c#0000` z0ssI20000u9{_&<0h<0000e000000000@ zBmn>-01E&F0tWy90000;000000002x`~UzV01E)*#s&ZY0000i0000000012c>w?- z01JNr_(lf+00000AOHXW00000dNBY1A^-~juv`WJ00000FaQ7m00000!7Ks*A^-~j z{51#w00000Pyhe`00000-a!HYA^-~jBo_z(00000NB{r;00000>dpcHA^-~j?28Bh z00000WB>pF00000YS;h(A^-~j*d_-6004gg03-ka0000002crQ03rYj05Fya00000 z04M+e000000LNzl03rYj003$R0000003ZMW000000D2t(03rYj0AOMV0000005|{u z000000IxX%03rYj01&eX0000006+i$000000B~3V03rYj0Q4*e0000002BZK004gg z0080D0stZa3jjQU2mk;8001Ze00000005!r0stZa3jhd}2mk;8001xm00000002e~ z0stZa3jloX2LJ#7000yK000000013O001HY3jlOs1^@s6001BW00000008h#0stZa z3jlmp2mk;8000yK00000005zm0RVp@01E&JUIzdG0000W000000001SwE_Sl01E)5 zf(QTr0000W000000000=Z2Re000008~}d+0000007psy03rYj03?A10000005AXm000000E;vL z01^NT0Jzo#000000F(d#000000QPAD03rYj0EAx%0000003ZMW0000009Dxn03rYj z00fT+0000002}}S0000006`f503rYj0DMRW000000CWHV00000055;b0stZa3jkD! z2mk;8001xm00000004#T001HY3jlyP2LJ#7007Vc00000001HB0stZa3jhF#2mk;8 z002|~00000004N_001HY3ji1;2LJ#7000;O00000001m9001HY3jp+71^@s6005i- z00000000(9001HY3jlu*fCc~n0000u000000002MTL1te01E(Uhz0-v0000`00000 z0001AYXATu01E(Mj0OMz0000K000000000LVgUdm01E)rGzS0x0000K000000001F z0RjLb01E)r=?4G+0000W0000000007K>z?E01E(geFgvk004ggFaQ7m00000ad-d# zA^-~j45tPF00000H~;_u00000_M!m*A^-~j{OAV&00000OaK4?000004XOYDA^-~j zAm;`E00000Xc7Pb00000aVh}-A^-~jd}s#%00000FaQ7m00000O6UOqA^-~jY!?Us z00000NB{r;004gg0DX`E03rYj0Pw#C0000006YNz0000003iPY03rYj0EnFk00000 z0H^=}0000006C}v03rYj0L*0w0000002BZK000000Jxk103rYj0LbMB0000004M+e z000000DWly03rYj0EB7=0000006YKy000000GVC^03v??3jnk)2LJ#7002k;00000 z006z80RSQZ3jhq~2LJ#7000~S00000005W~0RSQZ3jnNK2LJ#7001xm00000006Y( z001HY3jmZc2LJ#7003M700000007tS0stZa3jm;)2mk;8000~S00000008cf001HY z3jmbA1^|Bm00017000000000gjQ{{501E)*ga!Zr0000K000000001z-vR(401E&Z zkq7_)0000m000000002KMFIdK01E&-LI?l=0000u000000001CVFCam01E&JTL=IE z00017000000002HZU6ux01E(^ng##>0000e004gg00000@-YJdA^-~j#Hw?-01E)p00000XaE2J00000;NAiNA^?920Q`^$ z0000002}}S000000J&8H03rYj08m&6000000B`^R000000GF)*03rYj0O0-x00000 z07w7;000000LL5x03rYj0H`hq0000004M+e000000EasR03rYj07SG10000007w7; z000000Jqx#03rYj0Ei3-004gg001Na00000003te001HY3jq8@1^@s60049V00000 z006n%0RSQZ3jp*C2mk;8001Na00000005CG0RSQZ3jnZY2LJ#7004vm000000058B z0stZa3jkz|2mk;8001li00000001?30RSQZ3jiRS2LJ#7001xm004gg00003M*;vM z01E)bL01E)P1_%HE0000K00000 z00003ssR8Z01E&_>jwY;0000S0000000015F8}}{01E){TLu6C0000W000000000s zMgRaJ01JNrbYKPm00000AOHXW00000kO2b#A^-~jc%BFV000007ytkO00000a0deb zA^-~j450`B000008~^|S00000@(cq2A^-~jw4w+A00000AOHXW00000Z72c&A^-~j zI5Y?V00000r~m)}00000Ks*BgApjHr$h`~z004gg01yBG0000002sdj03rYj0OSe> z000000N4Nk0000004zHI03rYj01$Ns0000005AXm000000LB*p03rYj0I){}00000 z04x9i000000Q71B03rYj0H8ew0000002BZK000000GQJN03rYj0B|7(0000000aR5 z004gg005vb0stZa3jjzs2mk;8000yK00000004he0RSQZ3jj!Z2LJ#7000;O00000 z001l60RSQZ3jnO92LJ#7005`~000000020Z001HY3jn~v1^@s6002Ay00000001&o z0stZa3jo9+2mk;8000;O00000004C`004g?01E&xTm}FD0000W000000000HBme*+ z01E)5Rt5k70000W000000002Jf&l;`01E(Itp@-A0001_0{{R300015oB{wM01E){ zbqD|e0000W000000002!0000Y01E&-IR*d#0000q000000001KjR62601E(c;0J#I z00000AOHXW00000YPkUbA^-~jH1P)j000008~^|S000000`LF;A^-~jv^@s^00000 zOaK4?000008T0`FA^-~jR3Hcd00000L;wH)00000X=ecdA^-~j;5i2X00000Bme*a z00000DA)i1A^-~jj3x&F00000OaOlX000000ER#T03rYj0H_)V0000002}}S00000 z08bAA03rYj0N_{$000000H6T?000000GAO003rYj00<}u0000009*h70000001Q;M2F z01E(UI0pa#0000O000000001i)c^n@01E)@A_o8f0000O0000000000aRLA$01E&N zVh8{L0000)000000001uHv<4701E(MuLuAD0001B004gg00000Y8V0lA^-~jv@Hk# z00000XaE2J00000ZiD~;A^-~j=(7d@000000096100000&^H1AA^-~jXbuPf00000 zC;$Ke00000kt6{CA^-~jC}al!00000hyVZp00000=Fb2CA^-~jTpb4h00000TmS$7 z00000)=_@~03rYj0H{|80000002BZK00000039;|03rYj09XtN0000005AXm00000 z0HZJf03rYj08m^80000003ZMW000000A5uB03rYj0Nf!60000002BZK000000Mh9K z03rYj0QiXr000000C)fZ000000Dgx703rYj0K|XF2LJ#7006uM000000055}001HY z3joMw1^@s6006`Q00000006)-0stZa3jh!~2mk;8001xn00000006b10stZa3jpMH z2mk;8003|R00000008$E001HY3jh#D1^@s6001BW00000001Uo001HY3jn~01^@s6 z004hr000000000;G6Dc101E&p3k=03rYj0O*ef z0000008{_~000000JBm603rYj0QiIk00000089V?0000007Q8J03rYj0K|0$00000 z02BZK000000Cj}`03rYj07SJ0004gg007(o00000008jX001HY3jn0H1^@s6001Ze z00000008>Q0stZa3jjcf2mk;8003M700000002`Z001HY3jpX=1^@s6001BW00000 z005H~001HY3jjoA1^@s6002+`00000003k50stZa3jlzc2mk;8000~S004gg0002( zod5tL01E*8j0OMz0001x000000001&mH+@E01E&l!v+8V0000O000000002ckpKW9 z01E&lhXw!u0000`0000000027Kmh*nn z000006aWAK00000l4bw^A^-~j+-U{?00000Bme*a00000Nl5|#A^-~j)JX^c00000 zH~;_u00000s&WAUApjHrpuG$L000005C8xG00000Vv7I(A^-~jh`N6U0000002BZK z000000Ip>L03rYj0EmDG000000CWHV0000002U(v03rYj0Dx8o0000003-ka00000 z0Cv3s03rYj0Q7|j0000004M+e000000K~8X03rYj0Nm^c0000003-ka0000007j_* z03rYj0I22$0000003?3^00000005rL0stZa3jl^A^-~jNM;5A004gg02BZK0000006H1~03rYj z03=EV000000CWHV000000D~X`03rYj07&`=0000003ZMW000000N9`b03rYj0PyDr z0000002}}S000000Hmt`03rYj01*5J0000003ZMW000000I3TD03rYj0F0st00000 z04M+e004gg001de0stZa3jico2mk;8000yK00000007%H0RSQZ3jh>t2LJ#7001xm z00000006TF0{|ib3jpk(2mk;8001BW00000003EJ0RSQZ3jpwc2LJ#7001xm00000 z008_M001HY3jmN~1^@s6006`Q00000000nM004g?01E&lWd;BM0000W000000001Y znE?PI01E)XVg~>K0000W000000000GyZ`_q01E)b1qT2C0000$0{{R30000pLIMCH z01E&tK?nc<0000)000000002|B>(^-01E)DXa)cP0001(000000001`fdT*`01E&} zYzTh<00000Bme*a00000A{YSxA^-~jTwezO00000ga7~l000005FG&kA^-~j5Ml=a z00000Pyhe`00000ByIr!A^-~js6Ph)000006aWAK00000=hXlJA^-~j1S1Ck00000 zGynhq00000v5o)$A^-~jbi4)t00000oB@9T000000AeEo03rYj0F*BX0000003ZMW z000000N-r@03rYj08nfO0000003-ka0000004Q7n03rYj04OC00000003ZMW00000 z0LmQz03rYj01#0I0000007L))000000Nt7Z03rYj0LY340000009*h7000000A+u7 z0RSQZ3jmCY2LJ#70058*00000008k00{|ib3jh$K2mk;8001xm00000006rt001HY z3jhdL1^@s6004vl000000052v001HY3jky|1^@s60049V00000001;~001HY3jnmE z1^@s6000yK000000050=0stZa3jlu<0h<0000W00000000235CH%p01E) z0RR910001h=l}pB01E)p#lIR01E*0TnGRF004ggEC2ui z00000x&{CMA^-~joI?fx00000Bme*a00000Cous4A^-~jR1pUN00000Bme*a00000 zF7p8ZA^-~j03Qed00000Q~&?~000004P*iUA^-~jxLXJS00000TmS$700000(slp< zA^-~jl%)m$00000TmS$7004gg0IZ1u03rYj0F-VB000000KfnM000000Jf9>03rYj z04RtC0000003ZMW0000003Tlh03rYj0MJ?p0000002}}S0000008R%103rYj07O&= z0000002lxO000000HG%W03rYj09Y~z000000Js1E000000KX>z03v??3jjC;2LJ#7 z002k;00000005kd0stZa3jkDa2mk;8001-q00000004c*001HY3jo9u2LJ#7002+| z00000004Ye0stZa3ji=#2mk;8002+`00000003m70stZa3jh>e2mk;8003|R00000 z004|p001HY3jhR!1^|Bm0000S000000002vdI10;01E)%^!00000KmY&$00000tEK_~A^-~jIC=;G00000 zC;$Ke00000tpI-j03rYj0N6MN0000002lxO000000QhzQ03rYj0Pv*-0000004M+e z00000022QI03rYj08GdR00000089V?000000E6%W03rYj0Nfo20000004M+e00000 z0O)iA03rYj09a=T0000008{_~000000P;uy03rYj0LXuK2LJ#7001li00000001R+ z0RSQZ3jp+o2LJ#7003+N00000006#n0stZa3jnlb2mk;8000;O000000072G0RSQZ z3jkCe2LJ#7001Ze00000003+r001HY3jlyp1^@s6002Y)00000003f|001HY3jplH z1^@s6004g+000000001a6aoMu01E(IDhL1o0001d000000002HH2?r201E&(a0UPX z0000a000000001bK>+|F01E)A^-~j07C}=00000C;$Ke00000dk+EtA^-~j zbSDS^00000C;$Ke00000SC{|*A^-~jn281e000006aWAK000000rLO=A^-~jh{6T{ z00000H~;_u00000L>>bGA^-~jB&P@f000007ytkO00000=k);qA^-~j=pcUx00000 z03ZMW000000G5CO03rYj0K}*V0000007L))000000B8;X03rYj0LVlJ0000003ZMW z0000006_!*03rYj02n_80000004M+e000000Gw<903rYj0Kk|A000000Nelo00000 z0Cold03rYj07OFu00000062dD00000005!30stZa3jjoe2mk;8001Ze00000003!m z0RSNY6aY}Y3;+NC001}u00000002J-0{|ib3jipg2mk;8001BW0000000573001HY z3jpw;1^@s6002Y)00000008)N0stZa3jjD~2mk;8004{t00000004ig$^rl)01E(A zcL)Fg0000S0RR910000DhXMd101E(UJqQ2*0000S000000000I`vCwV01E)<=m!7* z0000K000000001VCISE=01E(M0tf&A0000u000000000A-2wn201E(gkO%+(0000` z000000000}&j0`-01JNrfE)(^00000+yDRo00000SM~t_A^-~jDCGwL00000AOHXW z000009>M?sA^-~jOb-VD00000EC2ui00000K0p8fA^-~j6nX{#00000gaQBn00000 zn|}ZRA^-~j^soj100000zyJUM00000^MnEbA^-~jL~RHF004gg03-ka0000009<1M z03rYj0HA*d0000008jt`0000003dP#03rYj0LWqp0000009*h70000002-1303rYj z0CeF80000005AXm000000OITc03rYj000~a000000Gt2-0000002*Zg03rYj09a`T z0000006YKy004gg003cB001HY3jmab1^@s6001Ze000000005t0stZa3jpMi2mk;8 z007_s000000075z001HY3jm~~1^@s6003M700000001c^0{|ib3jn~W2mk;8001Ze z000000053I0stZa3joYF2mk;8002Y)000000005u004g?01E&NF9!es0000S00000 z0001hD*ynY02l!92n_%L00008000000000-mjVDH01E&hbqD|e0000S000000002d zTmb+g01E&peFp#l000220000000005b^!n)01E)rhX()v0000W000000001<6aoMu z01E)vDhPi700000Pyhe`00000)B6DcA^-~j{OAV&00000OaK4?00000Gsgk|A^-~j zoQDVi00000C;$Ke0000055NKdA^-~jtcC~x000007ytkO00000IPm}gA^-~jbUp_F z00000SO5S300000T|xr@A^-~j(6k5u000006aaq!00000055|903rYj0BEWQ00000 z0Hgo_000000KWME03rYj0L;Y(0000007L))000000J|{(03rYj0HkXN0000008{_~ z000000Iqrh03rYj05oa{0000005AXm000000It3Q03rYj0BnW`0000006+i$00000 z0ONlE0RSQZ3jkP12LJ#7000yK00000006NP0stZa3jjbV2mk;8001Na000000087p z0RSQZ3jpkR2LJ#7001xm00000002Gj0RSQZ3jlx}2mk;8002k;00000002}@0stZa z3ji!s2mk;8002+|000000059`001HY3jlw>Y6buR0000K000000000c>j3~F01E(+ z83+IX0001-000000000|Z2$lw01E&pYz6=T0000e000000001XaE2r01E(^j|Kn$0000`0000000022%>e)+01E&Z{RaR5004gg zFaQ7m00000uNVOUA^-~j;9my-00000JOBUy00000IGq3hA^-~jbc_Z700000hyVZp z00000I1&H=A^-~j2xbNV00000AOHXW00000QZ)bo5&#PTNZADd000003qX+;10000e000000001qHUR)401E(6YzF`U00017004gg000009$f+e zA^-~jbR`G?00000Pyhe`00000ZMFdbA^-~jknjfp000007ytkO00000##sOWA^-~j z@MH!600000Gynhq00000c5MIvA^-~j0Bi;T00000C;$Ke00000WGnyxA^-~jkZT42 z00000Bme*a000006LEh403rYj061<20000005kvq0000008;n>03rYj0K7s600000 z07L))000000F4;}03rYj0Mz#f0000004x9i000000OYj*03rYj03ZPe0000003ZMW z000000I+rf03rYj090uR0000004M+e000000IL5103rYj0HA;A2LJ#7001-q00000 z006RI001HY3jnN%1^@s6000yK00000008bC0stZa3jnzJ2LJ#7002k;00000000KD z0stZa3jkz+2mk;8004jh00000008Wz0stZa3jnxz2mk;8000yK00000003v_0stZa z3jhd+2mk;8004g+000000001XNC5yM01E)Db_W0e0000S00000000261pxpe01E)H zu?PSF0000q000000000td;tI=01E)To(BK`0000e000000001!Yykiw01E&Vg9iWr z000130RR910002abpik)01E(2HV6O!0000e00000004gg0b&9GA^-~jWLpRT00000 z8~^|S00000WM}{YA^-~jAZi8x00000H~;_u00000peXb(0000002BZK000000Q{=}03rYj0D$}k0000008{}0000000NASn z03rYj04#tA0000003-ka000000G?z503rYj02EvZ000000N?-s0000005lu}03rYj z0IZ=10000004M+e000000RMae03rYj00f^0004gg008s=00000007i80RSQZ3jnNa z2LJ#7000~S00000000bD0stZa3jh!!2mk;8001Na00000001?{001HY3jlZ#2LJ#7 z005K$00000008<1001HY3jn}F1^@s6001BW00000002>9001HY3jj!H1^@s6000yK z004gg00016TmS$f01E(=Wd;BM0000W000000001uw*dem01E)@@CN_@0000m00000 z0001pE&%`{01E(sY6k!S0000K000000002c-~j+401E(M69@nR0001Z000000002& zbpZe(01E&(L0000W0000000029SO9+jA^-~joMZ+700000AOHXW00000@5ulF zA^-~jSg{BI00000Gynhq00000s>%QWA^-~j2(1PH00000FaQ7m00000whjRRApjHr zAifL$000007ytkO00000Kb!ynA^-~jti%QY00000OaK4?00000ipK!}A^-~jJcfS< z000000Av9G000000BuPC03rYj0K|X>0000003ZMW000000A|tw03rYj0Q3b200000 z0H^=}000000Oe@`03rYj09b+t0000009*h7000000Cpz=03rYj02DF^0000007L)) z0000002?X-03rYj0DuPw0000007QQP00000004_i0stZa3jpL!2mk;8001}u00000 z001q_001HY3jin@2LJ#7001xm00000008B`001HY3jhEO2LJ#7001}u00000007Wh z0stZa3jiou2mk;8000~S00000006u(001HY3jp9;1^@s6000yK00000004izr2qgT z01E&}$_4-c0001J5&!@I0000XKm!0F01W`Rh6w-w0000W000000000ye*pj@01E)@ zr3U~20001N000000000xQ33!W01E&BR|o(A0001}000000002^+5rF}01E&p3#g03rYj0Q`Ig000000C)fZ0000004q%a03rYj0E~DC0000002}}S000000JXvb z03rYj004&w0000002}}S000000Pf8K03rYj0Q8Co0000003ZMW00000051su03rYj z02D+90000003ZMW004gg007G<001HY3ji=!1^@s6000~S00000000pz001HY3jmN@ z1^@s6001BW00000002(`001HY3jlCA1^@s6001Ze00000003Oq0stZa3jhp)2mk;8 z000yK00000008MC0stZa3jk~{2mk;8001Ze00000005AK0RVp@01E)XO$Pt~0000K z0000000005)dBz_01E&ZjtBq%0000S0000000011H~;`501E(was~hZ0000W00000 z0002TX#fBs01E(&jRpV!0002w000000001vwc00000Bme*a00000a})yrA^-~j7@Y_J00000 zZ~y=R00000kc|QWA^-~juy600017000000000M`2heT01E(EBM1Nh0000e00000 z000064gdfm01E)LWd;BM0000W000000002OwE+Mk01E(g@CN_@0000S004gg00000 zT>$|AA^-~jY)A(H00000EC2ui00000U$p=LA^-~jXaNTR00000FaQ7m00000;r9Xn zA^-~jSdRz*000009033T00000PUZmsA^-~jn6U={00000Bme*a00000hPnU%A^-~j z)S3nW000006aWAK00000tqXqu03rYj0CYqK0000003ZMW000000O|+;03rYj0K8-d z0000003ZMW000000NmjL03rYj0Av&h0000007L))0000004F^G03rYj061?400000 z03-ka0000000K$?03rYj00@Bw0000002}}S0000007U!%03rYj0JMKY2LJ#7000;O z00000004e*0stZa3jlax2mk;8000;O00000002El000sI3jmn&1poj50086y00000 z001~A0RSQZ3jibq2LJ#7000yK00000006!K001HY3jhc?1^@s6001-q000000030D z0stZa3joY)2mk;8004hn00000000179{>QM01W^zhY0`x00001000000000A2LJ#f z01E)%Lk0i<0000q000000000Ey#fFt01E)jg$Muu0000e000000002tB?15<01E(| zF$e$v0000u000000000+F#rG}01E(cTm}FD0000W00000004ggGa3Q_A^-~jO!x-? z00000EC2ui00000ML+`pApi{k*oFxJ000009RL6T00000nOOh;A^-~j+++p-00000 z6aWAK00000nvVhiA^-~j{BZ~X00000Q~&?~00000)`$QAA^-~j;J5|=00000Bme*a z00000t`-9TA^?920Ia150000002lxO000000PuJL03rYj0BD;B0000003ZMW00000 z06TI503rYj03>4w0000006+o&00000010pa03rYj06?4u0000002BZK000000GD_H z03rYj0N6$c0000003ZMW0000001IXS03rYj0F-G4004gg002k;00000000v8001HY z3jn-82LJ#7001xm00000006gb0RSQZ3jnBu2LJ#7001xm00000008XM0RSQZ3jq8E z2mk;8000;O00000002$n0stZa3jnl~2mk;8000;O00000004j<0RSQZ3jmm62LJ#7 z000yK004gg0002JRssMb01E(sSqK0C0000K0000000023Q2_uV01E){c?SRh0000y z000000002vZUF!y01E&Ng$Dot0000e000000001*9{>QM01W^*hY0`x0000100000 z00004y8!?q01E*0@&^C_0000e000000002u69In!A^-~jyj=$X00000EC2ui00000 zUCICeA^-~j%&Z0g00000JOBUy00000-U9;wA^-~jB%lZY00000EC2ui00000?VSMt zA^-~joMs0A000006aWAK00000m)ZaTA^-~jkhTT@000006aWAK000000}0000003ZMW000000347403rYj08nxW00000 z0Du4h000000Mq^f03rYj01PDv00000033e+00000004Rb001HY3jjPg1^@s6001Ze z000000030000O000000000JK>+|F01E){ z8V3LX0000$000000000u1^@se01JNr976^G00000AOHXW00000ZfpVoA^-~jlr9JW z000006aWAK00000E@uG%A^-~jaDfK^000007ytkO00000=bi!pA^-~jh;|4700000 z8~^|S00000ZQTI?A^-~jd<_Ty00000WB>pF00000M+yS~A^-~j)S(Cf004gg03-ka z000000PG0?03rYj0Nhmv0000003-ka000000IT8x03rYj063Hg000000DJ%d00000 z01zJl03rYj0Ps@=0000007L))0000001*=a03rYj0DMIT0000003ZMW0000004q2F z03rYj0Bmgs0000005AXm004gg000(d0RSQZ3jq9p2LJ#7003A300000003mk0stZa z3jpMH2mk;8003|R00000005G%0RSQZ3jkc~2LJ#7000~S00000004#R001HY3jiQD z2LJ#7000;O000000049a001HY3jj1i1^@s6001xm00000005g|0RVp@01E(YGY0?w z0000K000000002+i2wj101E*4xds3L000170000000003(E$J=01E(^0tf&A0000y z000000000FUH||h01E(si3R`w0000O000000000OkpTcA01E&N;RgT!0000u00000 z0001?O922P01E(o9|wN`000006aWAK00000xHkg;A^-~jV6O-O00000U;qFB00000 zbL;^CA^-~jWE%(o00000oB#j-00000(J=!6A^-~jtgHwC000007ytkO00000<~slY zA^-~jtaSze000007ytkO000004fg;5A^-~jI6(&h00000oB)3S0000007*Oo03rYj z08Bmz0000004x9i0000006iQ403rYj0PIW#0000008{_~0000002bQ-03rYj0Jtaz z000000B`^R000000K3-#03rYj0H6p60000009*h7000000HVwQ03rYj09YCa00000 z04M+e000000CIoK0stZa3jp|u2mk;8004LZ00000005s10RSQZ3jmPf1^@s6002w? z00000005DB001HY3jo-41^@s6001xm00000005LF0RSQZ3joYy2LJ#7000;O00000 z006H*0stZa3jpjD2mk;8000yK00000008KA0RSQZ3jlwti3b1x0002s000000001T z(*Xb?01E)j1_%HE0000m000000002ve*gd?01E)5eFgvk0000K000000000>%>n=- z01E(!iU31C000007y$qP00000F)jiCA^-~jbTtb%f01E)v{{{d60000)000000000PEdu}|01E)Hs|Wx90000O000000001f=>Y&D z01E(&&<6kj0000e000000002xy#W9s01E(I^alU{0001#00000004gg2yXxYA^-~j z{F(*;00000Bmn>b00000OmF}IA^-~jA^-~jWSR&7000008~^|S00000fn5OrA^-~jv@Zt$00000 zNB{r;000008|(rAA^?9204SFT0000002}}S0000005By203rYj00jL90000002BZK z0000002x;R03rYj004&u0000003-ka000000L35x03rYj0EAQq0000003-ka00000 z0IV7T03rYj0El1*0000008{_~0000001iU|03rYj09bGb004gg002M(00000005%D z0stZa3jiE+2mk;8002w?00000005cG0RSQZ3jkR82LJ#7001BW00000005tm0stZa z3jok^2mk;8002|~00000008qG001HY3jm-`1^@s6002Y)00000000Hb0RSQZ3jm1v z2LJ#7008I!004gg000215CQ-q01E(Q@dp3^0000W000000002SIsgD701E){as~hZ z0000m000000002{Spone01E&NS_l9D0000S000000001PECT={01E(^s|Wx90000O z000000002{?EnBG01E&FItKs%000170000000013qXK^bA^-~jAYTXo00000Pyhe` z00000VAKHsA^-~j6bA?Z000006aWAK00000)&>CpA^-~j;8OpF00000 zpgaKpA^-~j9B&5z000008~^|S00000@zDYRA^-~jn1BcX00000OaK4?00000R4V`g zp#T^FzzBa00000005AXm000000LKIa03rYj0C1oP0000008{_~000000OPR$03rYj z07w7_0000003ZMW0000009+>n03rYj0QjT`0000009*h70000002q$~03rYj0H|>Y z0000008{_~000000D4FO01^NT0DSfZ000000DOM}00000004(R000sI3jj3k1poj5 z003kK00000000y}0{|fa4FIr(2><{9000;O000000095M001HY3jiPv2LJ#7007Vc z00000003@G001HY3jlD01^@s6001BW00000006eG001HY3jlQg1^@s6001BW00000 z004hL1pojd01E&NK?VQ-0001#000000002ZM*#pL01E(6b_W0e00017000000000K zhyeg101E(s&j$bi0001l000000000`i~s;401E*8x&{CM0000O000000000EG6Mi2 z01E)vtOx)A0000K000000000M+5!L~01JNrAdd(D000008~^|S00000yF~y1A^-~j zRA2@G00000AOHXW00000tTX@s5&#PTOxFbf00000XaN8K00000`40mCA^-~jsG|q~ z00000U;qFB00000viAW1A^-~j2q6dn000008~^|S00000%qs!_A^-~j=rsrc004gg z02BZK000000B8#V03rYj0BBbS0000002lxO000000IDDX03rYj00d(P0000004M+e z000000HAsR03rYj0Bo!V0000003-ka0000007VJ`03rYj0AyAN000000Av6F00000 z0CcGV03rYj0Gw?H0000009*h7004gg000#{0RSQZ3jmOA2LJ#7001xm00000008DT z0{|ib3jjc{2mk;8001}u00000001)40RSQZ3jm0l2LJ#7001BW00000008~n001HY z3jkCt2LJ#7001-q000000077=001HY3jok-1^@s6001xm00000000|=0RVp@01E)T zu?GME0000W0RR910001a$N~T&01E)bhX?=w0000K000000002Z8Up|#01E)XrU(E4 z0000S000000001$asmJ%01E(QWe5NO0000`000000000-ya50r01E(w^9KL`0000W z000000002IVgLXl01E(IXa;`(00000JOBUy00000Esg;IA^-~jIN%2W00000H~;_u z00000rIi2xA^-~j_=pAo000006aWAK00000(0%{_A^-~jP_PC700000AOHXW00000 zTAKj?A^-~jKw}30000006aWAK00000H6Q>0A^-~jG*kuv00000C;)!|000000GT}i z01^NT0NmvT000000OSAw0000000Aig03rYj08Cg00000003ZMW000000KS(103rYj z093;U0000005kvq000000KD1&03rYj0Awf!0000006+i$000000P*Jn03rYj06>Tc z0000009*h7000000Iq*)0RSQZ3jhFv2LJ#7000yK00000002`z001HY3ji#51^@s6 z001Na00000005>I0stZa3jk0o2mk;8003kF00000004j_0RSQZ3jpk62LJ#7001Ze z00000004@Nra00000Z~y=R00000A65YXA^-~jv?&Jw z00000NB{r;00000Onm_WA^-~j_@4&=00000EC2ui004gg0JA6o03rYj0LWzr00000 z09*h7000000F@d503rYj0GLV!0000006+i$0000003u2LJ#7001Ze00000007^D0stZa z3jmmF2mk;8003M7000000084C0{|ib3jlPg2mpTo0000~000000002oJpceA01E(g zUj_gG0000~000000000E%mDx*01E(+`v(930000K000000000t76Jew01E&#EC>Jq z0000S000000000zmjM7G01E)50000S000000000dCISE=01E&}00;m80000O000000001q zlK}uC01E)5;RgT!0000K000000002fF9QG~01E)XsR#f70000e00000004ggn_&O| zA^-~jkY)w|00000H~;_u00000bmjp7A^-~j02T-U00000Bmn>b00000MFIf;A^-~j zxJU;800000C;$Ke00000_mctuA^-~j9CQc(00000OaK4?00000FiQadA^-~jG#>{5 z00000NB{r;00000M&<$lA^?920Gx*i0000004M+e000000D)2g03rYj0E{LF00000 z089V?0000004^^A03rYj01!9`0000005|{u00000011Qu03rYj0Fbi=0000009XJ3 z000000CR}|03rYj035jn000000Nelo000000QHOk03rYj0O(x@004gg001BW00000 z001dc0RSQZ3jlZ~2LJ#7000yK00000008dj0stZa3jjEk2mk;8003YB00000006yQ z001HY3jhp>1^@s6000yK00000007FE0stZa3jjn~2mk;8000yK00000003vH0stZa z3jm~j2mk;8001-q004gg0002mv;Y7i01E&>0S5p80000e000000001GAOHX&01E(I zR0aS50000e000000001OZvg-z01E&#g$Dot0000m000000002Sr~&{Y01E(=dJA^-~j;7A7m000002m$~A00000|40A;A^-~jNPq?a000008~^|S z00000u08+&A^-~j2zCYl0000000IC200000lLG?)A^-~j5TFPE000006aWAK00000 z`BVV_A^-~jh z03rYj0Mu^>0000002BZK000000D=Yr03rYj0N^DE0000002}}S0000004&Y|03rYj z06dEb0000004M+e000000HcBc03rYj03d$`0000003d$=000000028E0RSQZ3jlxx z2LJ#7002Y)00000006|^001HY3jm}o2LJ#7000;O00000006Jp0stZa3jnl^2mk;8 z002+`00000000UV0{|ib3jp|}2mk;8003M700000003%s001HY3jiRc1^@s6000yK z00000004iv76AYv01E)PUIzdG0000W000000002`vH}1i01E&hf(QTr0000?00000 z0002a7Xtty01E&lrU(E40000O000000002>KLG$D01E(s8V3LX0000e0000000028 zi~s;401E(|x&{CM0001B000000000K76Skx01JNrRHX<200000SO5S300000czpr@ zA^-~jIBN(100000FaQ7m00000+;IT_A^-~j6hQ|700000Bme*a00000YP$gdA^-~j z9PW^A^-~jgro=n00000 z8~^|S00000RWbtrA^-~jG_42#00000JOBUy000005f}gfA^-~j@J9v!000006aWAK z00000x2FOCA^-~jFnkCA000006aWAK00000-0T7XA^-~j{Fev-00000NC1BT00000 z0DKz&03rYj06 zA^-~jl(Gl_00000Bme*a00000GaUl}A^-~jtf2@100000C;$Ke00000`G)`iA^-~j zgtrC&00000JOKaz000004|)OsA^-~j{5S{z000006aWAK004gg0J2j603rYj07Qib z0000003ZMW000000LdBx03rYj05tgr0000003-ka0000008icm03rYj0N{`a00000 z02}}S00000089D+03rYj04PHT0000002BZK000000P#Zr03rYj004gm0000003ZMW z000000Q67+03v??3jmOL2LJ#7001xm00000008~N0stZa3ji>O2mk;8001Ze00000 z001Uc0RSQZ3jn-&2LJ#7001Na00000000W50RSQZ3jk#42LJ#7000~S000000046Y z001HY3jjbr1^@s6001xm00000003~N0stZa3jpMK2mpTo0000~000000001nI|2YA z01E)v69@nR0000K000000002uaRLA$01E(+Vh8{L0000u000000002w3IhNl01E*4 zp$Gr~0001#000000000&1pxpe01E(QQwIP50000O000000002B{r~_X01E&t$OZra z0000W004gg00000<2M5UA^-~j*sury00000fB*mh00000+(G~VA^-~j1bzkp00000 z`~Uy|00000GE)KoA^-~j5LgHR000006aWAK000001|R?cApjHrIJ^u100000C;$Ke z00000G>ZZNA^-~jh;Il000000H~;_u00000uWNq-03rYj06;DX0000006+i$00000 z0EQ9)03rYj00>h01E*8>jwY;0000K00000 z0001K0096Z01E&ZM+X1^0002c0000000000>i_^E01E&(HwOR!0000e00000004gg zuFC)bA^-~j1R4hb00000Bme*a00000B>@8fA^-~jaFz%F00000Bme*a00000*f;_J zA^-~jkPZj{00000KmY&$00000(cS?7A^-~j&<+Ry00000AOQdX00000q@(}==y00000Bme*a00000B{Km4A^?9203d7!0000005AXm0000004q@d03rYj0N{fL z0000003-ka000000LDZD03rYj0Q?sS0000007w7;000000LU!@03rYj0CYA800000 z000310000004PWT03rYj08B>+0000005|{u000000707o03rYj03?eB004gg001BW z00000007wo001HY3joAD1^@s6006K600000000w5001HY3jnlW1^@s6001li00000 z007qu0RSQZ3jlyu2LJ#7003YC00000008MG0stZa3jowH2mk;8001BW00000006O9 z001HY3jidC1^@s6002+`004gg00013vH$=g01E(U00#g70000W000000001RbOHb( z01E)bW(WWP0000S000000000vw*UYl01E&F0tWy90000;000000000a%K!i(01E&( ztp)%90000e000000000ot^xoe01E(QY6t)T00017000000001+F#vx6A^-~juv`WJ z00000FaQ7m00000nQj6AA^-~jAYljq00000C;$Ke000008_fU!A^-~jfEot?00000 zC;$Ke00000b+!NiA^-~jzySvU00000FaQ7m00000O_BfrA^-~jh=&FM000006aWAK z00000lR5wZA^-~jV03>5000000Gt2-000000E;6703rYj005~70000002lxO00000 z03_T103rYj0F)~S0000009*h7000000OC0T03rYj06cC70000003-ka0000004Fs8 z03rYj0Pt)F0000003-ka0000000vV503rYj04#b300000033e+00000008&T0RSQZ z3jjC*2mk;8001Ze00000007q1001HY3jhSO1^@s6000yK00000001j*0stZa3jkCv z2mk;8000;O00000002QG0stZa3jn112LJ#7001}u000000016D001HY3jhFM1^@s6 z001-q00000004j4SOEYc01E&JEe8Mq0000?000000000*7ytkw01E&FNCp4^0000$ z000000000`0096Z01E*4Mh5@@0000W000000001rz5xIt01E&Z^#=d|0000~00000 z00010!vO#y01E&Z_Xhv~0000O000000002EIRF4601JNrAae!)00000SO5S300000 zrDy^GA^-~j3||NU000006aWAK00000Yl8p)A^-~j7_$Zd00000U;qFB00000NM-;4 zA^-~jIE)4W00000C;$Ke00000(;xx>A^-~jX!-{L00000AOHXW00000l^y^9ApjHr zh`bB{004gg04M+e0000005gUF03rYj091hn0000003ZMW0000003bR803rYj08q0C z0000003-ka0000009!2p03rYj0F-S80000005AXm000000F%)G03rYj0303%00000 z05|{u000000I;C}03rYj0F3Ad0000009*h7004gg007Oh001HY3jnA92LJ#7001Ze z00000006sF0RSQZ3jjbU2LJ#7001Na00000001G80stZa3jlmp2mk;8000yK00000 z000yH0stZa3jk1@2mk;80077U00000000nI0stZa3jlB=2mk;8000yK00000006p2 z004g?01E)He+B>m0000?000000000kaRC4#01E)@KnDN-0000e000000000g7XSbv z01E&xM+N`@0000S000000000%t^fcc01E&p{{{d60000S000000000Sy#N3r01E(Q z3I_lH0000q000000001@xBvhm01E(=0|$Qq00000TmS$700000|A^-~jjH3ns z00000C;$Ke00000_iq6JA^-~jWQ7L+000006aWAK00000<6!{+A^-~jI5YpF00000?tuURA^-~j@UjK~000006aWAK004gg0EajO03rYj z0C=zn000000AK(B000000QZOi03rYj0Nl_A0000004M?g00000061v^03rYj0K6** z0000004x9i000000Ij z00000004F~0stZa3jpLh2mk;8001xn00000006Mf0stZa3jjEJ2mk;8001Ze00000 z004?T0{|ib3jkoU2mk;8001-q00000005(I001HY3jk!A1^|Bm0000q000000002& z@d5xM01E*0m0001Z000000002+3IYHk01E)LCI|ok0000S000000002@GXnr3 z01E&htq1@B0000K000000002^SO5Sb01E(|hXw!u0000K000000002y0s#Ob01E)< zN(TS{0002M0swyi00000F@OL7A^-~jw6O*N00000JOKaz00000{Sg8HA^-~jWGDy# z00000lmGw#00000{WJgo5&#PTz~%)200000bO!(c00000&O-tKA^-~jv=;~f00000 zNB{r;00000z3Bk}A^-~jL>LGF00000oB#j-00000$W(s<03rYj0PrCQ0000006+i$ z0000004)Ik03rYj031370000006YKy0000007Fy(03rYj0Hi1f0000002BZK00000 z06b3s03rYj090WH0000003ZMW0000002B!V03rYj04yd50000008jt`000000Pzh0 z03rYj0FZy<1^@s6002Ay00000006)E0stZa3jiFO2mk;8002|~00000004kQ001HY z3jj1=1^@s6001BW00000008|I0stZa3jio92mk;8005K#00000001}0001HY3jlAOHX&01E)9R0aS5 z0001#000000002Qg8={{01E&Bu?GME0000;000000002GBmw{;01E)1FbDtu0000S z0000000019E&~7}01E)fs|Wx90000K000000000Kb^rh(01E&Br3L^10000W00000 z004ggh3)|WA^-~jSRDue000006aWAK00000L1h5|A^-~jSbzrr00000FaQ7m00000 z00000OaK4?00000M*{!=A^-~j+&l&V00000Gynhq000002af>& zA^-~jC|(Bu00000Pyhe`00000P$>ccA^?920GKrh0000004M+e0000002Sx~03rYj z0IatM0000002BZK000000KEtS03rYj0Ju~K0000002lxO0000001|ls03rYj0H~=3 z000000Gt2-0000007Mr603rYj08B>)0000006+i$000000Fa*o03rYj0Hk&Z004gg z001BW00000001jn001HY3jj!n1^@s6001BW00000006P`0RSQZ3jkCf2mk;800001 z00000002`_0RSQZ3ji=B2LJ#7001Na00000004I=001HY3jq9A1^@s6001-q00000 z003P-0{|fa4FLFs2><{9001ih004gg0000<)B*q^01E*8jR*h$0000S000000000L zp8)_O01E)L<_7=(0000e000000001m$^ZZ&01E(+tOfu80000y000000000mKLY?E z01W`hg$V!v0000f000000001ER004Z01E&(SO@?B0000O0000000008%L0D@A^-~j z0Eq|y00000Q~&?~00000+ROm}A^-~j-1`Rr000003;_TD00000k<@03rYj0LU{40000004M+e0000001&hR03rYj02J^C0000002lxO00000 z0J!u403rYj0GJ>M0000008jt`000000QTPi03rYj0E{jN0000009=0n00000008%! z0RSQZ3jh>k2LJ#7000yK00000008%E001HY3jjcC1^@s6000yK00000008GG0stZa z3jnwV2mk;8000yK000000094(001HY3jm121^@s6000;O00000006=K001HY3jpNC z1^@s6001li00000004i7odN(N01E&(b_f6f0000m000000001>X8-^q01E&BY6buR z0000W000000000ZcLD$+01E(oX$SxS00013000000000c836zy01E&dU<0h<0000S000000000IK?49H01JNr5VHsX00000KmY&$ z00000ELj2oA^-~j@L31|000008~^|S00000e@_4aA^-~jbYTVn00000AOHXW00000 zwG;sWA^-~j2wn#O00000AOHXW00000QzQTYA^-~jq*ew100000AOHXW00000>C6HE zA^-~jaEb^3004gg02lxO000000PXGp03rYj0C3<30000003ZMW000000F%N103rYj z0Gtm80000002}}S000000L{q(03rYj03iAY0000004M+e0000004YiV03rYj05Eq4 z0000003-ka0000009ytD03rYj0I*XB0000005AXm004gg007?(0stZa3jj3k2LJ#7 z002k;00000004k(0stZa3jokA2mk;8002M$00000006ZB001HY3jpvq1^@s6000;O z00000000oS0stZa3joA|2mk;8004jh000000068^001HY3jp9?1^@s6001-q00000 z000(g0RVp@01E)9ItKs%0000K000000002V4FLcm01E(A;|2f#0000y000000000J zlK}uC01E&_Us|Wx900013000000002&asU7#01E(Up9TN`0000u z000000002kBLV;-01E)LF9-kt004ggH~;_u00000Ql0_;A^-~jXm$ty00000AOHXW z00000xatA`A^-~jSe6I?000007ytkO00000m@EJQA^-~jv}*00000L;wH)004gg0A)e} z03rYj0GM+J0000009*h70000006?Y!03rYj0L*y^0000002lxO000000L+U503rYj z0Kjhu0000005|{u000000D7nZ03rYj06gXf0000002lxO000000L*j(03rYj07Pd9 z0000002BZK0000000eFT03v??3jp|;1^@s6001Na0000000470001HY3jq9a1^@s6 z000;O000000030>001HY3jmnJ1^@s6000yK00000001K)001EX6aWys3;+NC001Ze z00000008I;0RSQZ3jj=42LJ#7000~S00000008$R0{|ib3jk=N2mpTo0000$00000 z00019+W`O~01E(E30000e000000001^8Ug?! z01E)b_y+(00000a004gg00000;zj@fA^-~jlwbw`00000AOHXW00000Cl><%A^-~j z#H9!T000007ytkO00000L@NORA^-~j$Y=)u00000L;wH)00000HSPfbA^-~jI2{N8 z00000AOHXW00000=9vNjA^-~jgmnl200000FaQ7m00000Na=q903rYj0GO2s00000 z05kvq000000FZeB03rYj0H~V>0000006+i$000000O$b#03rYj0JJ&=0000002}}S z000000O7>}03rYj0G#*-0000004M+e00000084QK03rYj08nBG0000004M+e00000 z0CsKw03rYj07QS91^@s6001BW000000042}0stZa3jjcq2mk;8004Xd00000007lL z0{|fa4FGV42><{90018V00000000;<001HY3jk1D1^@s6001BW00000001980{|fa z6aZ+x3;+NC000;O00000001210RSQZ3jiP$2mk;8004i8000000001;(f|M=01E&V zAqM~e00017000000000FOaTBQ01E |r&c0000;000000002`)d2t^01E(s2M7QF z0000)000000000PCj$T?01E)zqzC{20000S000000002jGXel201E(!300000H~;_u00000Cj|fiA^-~j+&~5Z00000FaQ7m z00000HWmN?A^-~j{6z);00000bN~PV00000*)#$GA^-~j^b80900000Bme*a00000 zo0h1^@s6 z001BW00000007$g0stZa3jlPG2mk;8002+`00000001pC0stZa3jnMP2mk;8001Na z00000004TR0RSQZ3jomP2LJ#7001BW004gg0001kGy(u301E)n3jwY;0000S000000000RMFIdK01E*4K?nc<0000)000000002+ ziva*401E)<+Xnyu0000e0ssI20001eIspJ801E(MZU+DW0000m000000000$CIf!} zA^-~j=&1+*000008~^|S00000j4c2FA^-~j#BBxu00000AOHXW00000j-vnoA^-~j z=#K^f00000Q~&?~00000->w1xA^-~je)+01JNrNc{%@00000 zm;e9(00000m`VTuA^-~jA^-~jbYKPm00000AOHXW00000mmC2AA^-~j=wSx{00000C;$Ke00000 zXTJdeA^-~jl=TMy004gg05AXm000000HQDf03rYj02C1i0000003-ka00000014Ov z03rYj03d=000000089V?000000GAg503rYj00dtL0000009XJ300000055X@03rYj z0HB`+0000008jz|000000Ii$=03rYj0NjfP0000009*h7004gg003I1001HY3jna( z1^@s6001-q000000020`001HY3jlZz2LJ#7001Na00000006F30stZa3jly22mk;8 z001Ze000000050%001HY3jiRA1^@s6003YB00000000j#0RSQZ3jiQ%2LJ#7000~S z00000001k#0RVp@01E){^alU{0000e000000002>rvd;X01E&_d00000TmS$700000upl+ z000008~}d+000000C^e!03rYj03=EV000000CWHV0000005<*t03rYj0F03c00000 z02lxO000000Km5b03rYj0DyxC00000089V?000000BBnQ03rYj0O&3U0000003-ka z0000009H8w01^NT08ju1000000Qdj^000000K9)^0RSQZ3jm0L2LJ#7001Na00000 z000e@0RSQZ3jpll2LJ#7001xm00000006HS001HY3jnZ31^@s6001li00000005ag z001HY3jjcM1^@s6002Y)00000000!q001EX6ad)03;+NC000;O00000006b>0RSQZ z3jlxg7zh9W0001-000000002&FaZD}01E(AYX<-T0000K000000002n5CZ@r01E&J zqzC{20000q000000001wmI44G01E&BbqD|e0000W000000000W3jqKk01E&NR|fz9 z0000e000000002vbO8V&01E)PhX()v004gg8~^|S00000b$J2+A^-~j%s2=D00000 zFaQ7m00000wU7Y-A^-~j=->wc00000Bme*a00000V=DpxA^-~j3Xy z03rYj0MHKy0000002lxO0000003F5x03rYj0BnZ{0000002}}S0000002s9a03rYj z09^0~0000002lxO0000008ADD03v??3jic#1^@s6001BW00000004y>0{|ib3jo}v z2mk;8001xm00000001k|0stZa3jlz01E(A5eEPO0000a00000 z0000V1ONac01E)bJ_Y~)0000~000000002Ap#T6P01E*4#|8iZ0000q000000000J z%mM%+01E&hc?bXi0001h004gg000007y|A^-~jaMcF@00000C;|Wg00000K%svD03rYj01W5{ z000000Du4h0000002yZh03rYj0NiN?0000003-ka0000004g#A03rYj0PL&?00000 z05kvq000000ENE*03rYj0K5zb0000007L))000000J5C|03rYj00>(M0000009*h7 z000000M|JH03rYj0C<0M1^@s6003M700000007U5001HY3jlPw1^@s6000yK00000 z006Es0stZa3jl;V2mk;8001xn00000005++0stZa3jp+72mk;8001li00000007oP z0stZa3jk~v2mk;8002k;00000004-T0RSQZ3jo;R2LJ#7004g!000000002e1^@se z01E(|Lk0i<0000a000000001KiU0s201E(Ax&{CM0000W000000002$%K`u*01E(| zi3k7y000170000000015R{;Pb01E(&dj|jj00017000000001U4FLcm01E&Z;|2f# z0000y00000004gg2NDASA^-~jpqmH)00000TmS$7000003_Ak=A^-~jxU&cV00000 zi~s-t00000`^o?SA^-~j2(1PH00000FaQ7m00000vf}~(A^-~j#D)j}00000C;$Ke z00000c&z~dA^-~j5bOs400000OaK4?00000Zgc?vA^?920MtPT0000003ZMW00000 z0R00103rYj0CYYE0000008jt`000000HQYn03rYj0B8;f0000004M+e0000003$>K z03rYj0JK2}0000007L))000000PLRu03rYj04V1N0000008jt`000000LhO503rYj z0My_I004gg000yK00000004bg000sI3ji>A^-~jJf{c%00000NC5x<00000Aus{}A^-~jTsQ~-00000Pyhe`00000Pfq~= zA^-~jI3ouD00000NB{r;00000NGbpTA^-~j^jHP}00000AOHXW000006pjJ_A^-~j z0C5Na00000Q~&?~00000Sfl{}A^-~jNa=qE0000002}}S000000Db}j03rYj0QBhx z0000003ZMW0000005>fG03rYj03d1y0000002}}S000000LjV%03rYj0Gx;j00000 z0Av6F000000A?8j03rYj0GOr-0000004M+e0000002So|03rYj05FFL0000004RR| z000000090y0{|fa6aY}Z3;+NC000;O00000006ok001HY3joAY1^@s6001lj00000 z005Rs0RSQZ3jkDi2LJ#70068200000008KT0RSQZ3jj#d2LJ#7001Zg000000064C z001HY3ji?u1^@s6002+`00000004hL-v9t201E)TEe8Mq0002c000000002-X955s z01E)XUI+jH0000u000000002>@BsiK01E&F9tZ#c0000q000000001==m7vC01E&( z!3O{U0000K000000000xcmMz*01E(2bOrzb0000K000000001C01E&lW(NQO0000O00000 z0000G0ssIa01E)nItBm$00008000000001JI067701E(UJqUjQ000008~^|S00000 zELi~nA^-~jG<*jD00000L;wH)00000C(r=^A^-~jU;+pL00000H~;_u000001K0000009*h70000000+_l03rYj0N5S} z0000009*h7000000M~v203rYj0BofP000000Du4h00000027e_03rYj04%`<00000 z03ZMW0000007q~F03rYj0B~Ul0000002}}S000000M37#0RSQZ3jloO2LJ#7000;O z000000020;001HY3jn~H1^@s6000yK000000002$001HY3jmBY2LJ#7005K$00000 z0075e001HY3jiRB1^@s6000;O00000006qo0RSQZ3joxI2LJ#7001BW00000000%I z0RSQZ3jlv$>IVP-0000e000000001W5&!@q01E&}W(EKN0000K000000002~E&~7} z01E&BsR#f70000O000000000pAOZj)01E&}`Ue020000W000000000{z5oCs01E)L z3I_lH0000O000000000g`2qkU01E(cn+N~^004ggFaQ7m00000V7~$YA^-~j0CWfd z000008~^|S00000T@(QTA^-~j5c~!J00000AOHXW00000OC|yUA^-~jU;qdJ00000 zH~;_u00000lBog!A^-~j*nJ2900000L;wH)00000C5Zq4A^-~j1i1zP000007ytkO z004gg01xg003rYj07RGw0000009*h7000000DXr703rYj0GMqE0000005kvq00000 z0NC3C03rYj0BnN@0000002BZK0000001qGm03rYj0N`Q=0000003-ka000000M-Qo z03rYj0DMyi0000005kvq0000004Q1j03v??3jh#^1^@s6000;O00000008v_001HY z3jmZr1^@s6001BW00000006Q80{|ib3ji>d2mk;8001Ze000000065^0RSQZ3jlN? z2LJ#7000yK00000004Dg001HY3jhda1^@s6001BW00000004Xu0{|ib3jjQ%2mpTo z0000e000000002f$^ZZ&01E)jtOfu80000y000000001{A^-p)01E)@RR#b60001# z000000001sh5`U001E&VJqQ2*0000e0000000020Q~&@X01E)Tg$4is0000a00000 z0002z)&c+`01E&-fd~Kq0000e004gg00000cOw7*A^-~j6lewj00000Gynhq00000 zGd2PMA^-~jP(26$000007ytkO00000sI&n9A^-~jEbs>a00000FaQ7m00000KraCR zA^-~j@M;GD000007ytkO00000PXGb{A^-~jC?yC000000AOHXW000004h4Sz03rYj z0JJ~`0000004M+e000000C#5s03rYj02C<*0000004x9i000000M>;703rYj03fyo z0000009*h7000000O$+=03rYj0F*=q0000005kvq000000O-2`03rYj0C4jM00000 z02BZK000000DkfS03rYj0C;~t2LJ#7001xm00000005}%001HY3jp9b2LJ#7001Na z00000002V_0{|ib3jhe32mk;8003M700000005xm0RSQZ3jhGI2LJ#7002k;00000 z000{s001HY3jq8|1^@s6008g-00000002u1001HY3jpwB1^@s6004h9000000002; zbN~P%01E(&qXqx~0000e000000002dFaQ7|01E&(ZUz7V0000q000000002=IRF46 z01E)ra|Qqa0000q000000001m@B#oL01E)vm0000S000000002CtN;Ka01E&t z{ssU50001700000004ggyBPuiA^-~j)b|Gf00000EC2ui00000>1+T1A^-~joS6my z00000TmS$700000zW@RNA^-~jpy>wy00000Gynhq00000#xwu`A^-~j1Y-sO00000 zi~s-t000001&06tA^-~j@0001F000000000TdI10;01E)-PZwA^-~jBq4tY0000009*h70000003lWa03rYj z01zVx0000003-ka000000G`MJ03rYj0C@Qa0000006+i$0000001s3F03rYj0Awf! z0000006+i$0000005re>03rYj0Oa)t0000004M+e000000EeOg03rYj08GdR00000 z08D=X00000006}V0RSQZ3jj1x2LJ#7001xo00000003(#001HY3jmN<1^@s6001Ze z00000005Ky001HY3jjDo2LJ#7001BW00000001R7001HY3jmOD1^@s6002Y)00000 z004{i001HY3jplH1^@s6000~S00000004i2JOcnC01E(&u?PSF0000a000000002} zCjkH=01E&(1qT2C0000;000000002_F#!M~01E&V76$+T0000m00000000000000L;wH)00000%^!00000 zKmY&$00000^FIIpA^-~jw0H&p004gg0AK+C0000009j}P03rYj0Qg=A0000002BZK z000000F+b#03rYj0AP9t0000004M+e000000I3N803rYj05n7f0000003ZMW00000 z0NODC03rYj0N`8(0000002BZK000000J$#!03rYj01#XT0000003ZMW004gg004m# z001HY3jio)1^@s6001BW000000010000W z000000000XUjP6i01E(^i3R`w0000K000000001ub^rh(01E&#r3QZh00000U;qFB z000005#0a)A^-~j@GA!Z000001OWg500000n7{x4A^-~j2o47T000007ytkO00000 zGED*iA^-~jq)`X}00000Pyzq|00000cMSjlA^-~j$V3JJ00000AOHXW00000SpWk7 zA^-~jV4es7000007yy3&0000003T=p03rYj0IY!r000000IUE2000000F@X603rYj z08pj~0000002BZK000000Br9703rYj0GvDr0000000aR5000000L^m(03rYj0Q6-D z0000007L))0000008ml@03rYj08oSm0000003ZMW000000FHm70stZa3jm~F2mk;8 z001Ze00000000`60RSQZ3jiGA2LJ#7001}u00000001V#001HY3jnwe2LJ#7000;O z00000003_!0{|ib3ji3Y2mk;8005`}00000002Vu0RSQZ3jiqP2LJ#7001BW00000 z000|K0RSQZ3jlwJA_o8f0000?000000000{ECB!_01E(6X$JrR0000W000000000O zzXAXv01E)*a|i$c0000S000000001Y@c{rL01E&(9tZ#c0000e000000002=0ssIa z01E&FJO%&&0000q000000001dX#oHt01E(MItKs%004ggNB{r;00000luG~rA^-~j z2!jRy00000oB#j-000003gQ9)A^-~jypsq300000d;kCd00000O8)==A^-~j*vJL| z000000096100000p{f7?A^-~ji1`Kp00000Z~_1T00000edhoGA^-~jAT$R600000 z7ytkO004gg066#o03rYj05Bp5000000N?-s000000HHGj03rYj006EC0000009XJ3 z0000007V1=03rYj04z@j0000000;sA000000Pjiy03rYj0F+D!0000008jz|00000 z0ECGF03rYj02tE;0000005AXm000000Cy+>03v??3jlxx2LJ#7002Y)00000008*T z0RSQZ3jmk^2mk;8003+O00000005s>0stZa3jpv~2mk;8001Ze00000005<;0stZa z3jlC<2mk;8003M700000000vZ0stZa3jmxa2mk;8001xm00000007%x0stZa3jpj| z2mpTo0000S000000000sT>t01E&lpa%c|0001t000000000Qq5uFQ01E(^j|Kn$0000` z000000000~SpWbc01E)TWCj2L0000W004gg00000E))O&A^-~joJ9rz00000AOHXW z00000>nQ>NA^-~jz%>W}00000C;$Ke00000!p;ByA^-~jXdDLs000007ytkO00000 zQ`P_gA^-~jkh2B=00000SO5S300000-V^`;A^-~jyhR2800000AOHXW00000C$E11 z03rYj0F?g*0000002BZK000000KWqR03rYj0Hl`)0000003-ka000000RB$_03rYj z05~HD0000007w7;0000004=Kk03rYj0Qma`0000002lxO000000H-|y03rYj0PqwD z0000005AXm000000B&Uh03rYj03d%|2mk;8001Na00000004>L001HY3jpXY2LJ#7 z001Na00000008QL0RSQZ3jnO92LJ#7005`~00000000Sw0stZa3joY)2mk;8003M7 z00000000m(0{|ib3jlDf2mk;80058x00000001-?0{|ib3jjQ(2mk;8004g!00000 z0002?2LJ#f01E)%Lk0i<0000q000000001Z5&{4s01E*4CkBA^-~jXb1=Z00000H~;_u00000@;n0oA^-~ju(5v#0000005kvq000000Pbf1 z03rYj03d1x0000005|{u000000OTeB03rYj0E|}#0000007w7;000000F*!g03rYj z0GNCR000000Av6F0000007NbT03rYj03>b(0000002BZK000000P~^(03rYj0L*v@ z00000091bf00000005m^001HY3joZB1^@s6001li00000002ZW0{|ib3jl1a2mk;8 z002M$00000000aa0stZa3jky-2mk;8002+`00000002RF0stZa3jiQ$2mk;8000yK z00000000{P001HY3jkO|2LJ#7000~U00000004jJ9smF$01E){Qw9J40000)00000 z0002$1^@se01E)XLk0i<0000W000000001n3;+Nk01E(=Wd;BM0000W000000002= z00RIb01E(EmIwd<0000O000000001<-vIz301E(ksRsZ60000`000000000lrvd;X z01JNrxO)fy00000KmY&$00000b0000W000000000`;{gC701E){6bJwS z0000m0000000022%>V!*01E&_8wUUY0000a0RR910000u1p@#g01E)bpa_2e00000 zC;$Ke00000cQ63}A^-~jJZlF4000007ytkO00000K?nf=A^-~jj8q2z00000EC2ui z00000o7?~ZA^-~j5Gn@%00005fck#`0E7Vm0000004qZR03rYj0B}JF0000007L)) z0000004&D=03rYj04RnB0000002Ba!00000007(s001HY3jhQ_1^@s60058x00000 z002dF001HY3jh$K1^@s6003M700000001w}0RSQZ3jpB#2LJ#7002Y)00000006J& z0stZa3jidD2mk;8000~S00000004H}0stZa3jlzF2mk;8002w?00000000bsr2+sV z01E)1c?bXi0000O000000002T4*>uo01E(sS_c3C0000a000000002ZumAue01E(6 z#s&ZY0001N000000001R2mk;g01E&VLA20000008jt`000000CL&@ z03rYj0DQIv0000002BZK000000JE0?03rYj0LbJA000000AK(B000000Ez$s03rYj z0NBX}0000008jt`0001g004M!001HY3jkD{1^@s6000yK00000005;1001HY3jlmW z1^@s6001BW00000001t8001HY3jq9o1^@s6000yK000000052z001HY3jjbr1^@s6 z001xm0000000026001HY3jjp_1^@s6001xm00000004=R0sta^01E&la|i$c0000m z000000002edjJ3;01E&JvIqbG0000q000000001j9{~U&01E)DVg~>K0000K00000 z0002&iU9y301E(^*9QOq0000e0ssI200027#Q*>z01E(crUn220000K000000001* z!vO#y01E&x_Xhxf00000AOHXW00000RYd^+A^-~jEOiF}00000Bme*a000006(0fs zA^-~jKraXY000006aWAK00000k>UUVA^-~jKraUX000007ytkO00000vNr$#A^-~j z6mkXt00000Bme*a00000Q9%FzA^-~jxP1ly00000OaK6X000000Q#H)03rYj01$Qv z0000004M+e0000005=x_03rYj0N7p!0000004x9i000000QH0b03rYj0O+&^00000 z09*h7000000P1T303rYj0DvwC0000002BZK000000KlgJ03rYj0L01E)XqzC{2 z0001g8~^|S000000Sf>CA^-~jbVLRK00000AOHXW00000Ih6tcA^-~j&~yj@00000 zFaQ7m00000_7DI7A^-~j)MW+$00000Gynhq00000knI2fA^-~jtT_h&00000Gynhq z00000Q}hA=A^-~jw2lY>00000Pyhe`0001g07tn103rYj02BlV0000007w7;00000 z035gg03rYj0K@_Z000000MGyc000000N;NC03rYj0BCCn0000005AXm000000G4e4 z03rYj08nfO0000003-ka000000D;v303rYj0Bi>c0000002BZK000000G$E@03rZ? z3jo-k2mk;8000~S00000006Kn0RSQZ3jhph2LJ#7001xm00000007e^001HY3jhdL z1^@s6004vl00000004dn0stZa3jh%82LJ#7002w?00000000(10stZa3jl~f2mk;8 z001-q00000008M30stZa3jj>`2LJ$n0000i000000002kegXg@01E&>ItTy&0000m z000000000yJ^%nB01E)vbp`+c0000m000000000%Y5@Qu01E)Lf(HNq0000m00000 z0001%C<6c@01E(Ast5o80000W000000002cd;tI=01E(^NCyA_0000W0001g00000 z$p-)cA^-~j+++p-000006aWAK00000nT7xWA^-~jlz|2S000007ytkO000008iN1; zA^-~jc(Voo000007ytkO000007b^n*A^-~j45tVH000007ytkO00000pUwgRA^-~j zyo(3`00000FaQ7m00000qP+os03rYj06g>u0000003ZMW0000006aAV03rYj0GO@_ z0000005|{u00000068@P01^NT0JPWz000000F(d#000000926x03rYj08GIK00000 z0C)fZ0000006nMy03rYj0Bmgs0000005AXm000000K0_&03rYj0DQcE2LJ#7006uM z0000000013001HY3jq9d1^@s6000yK00000006H8001HY3jk<61^@s6003M700000 z0012R0RSQZ3jpvW2mk;8000~S00000004-A001HY3jlPG1^@s6006uM000000014x z0RSQZ3jj3v2LJ#7001O^000000000JJOcnB02BbQy$k>V0000O000000001ou>b%f z01E&d00#g70000i000000000DC<6c@01E&Zst5o80000y0000000027hynm201E&l zZU_JX0000;000000000|?EwHH01E(|90&ja0001-000000001gsv!daA^-~jjG_nt z00000C;$Ke00000TEzhXA^-~jc=!hZ00000Bme*a00000bcO%`A^-~jkhTT@00000 z6aWAK00000RYn2;A^-~jbV3LK00000Pyzq|00000mD>OSA^-~jSSbep00000TmS$7 z00000u+jnmA^;120FaFc0000008jt`000000Nxe=03rYj0Pscz0000003ZMW00000 z02C4d03rYj0Nh*$0000004x9i000000FQ(L03rYj0PwO0000000K5bM000000Obz= z03rYj00>0}0000003ZMW000000ANr601^NT0QmR?0001g001ll00000003xP001HY z3jnx?1^@s6000yK00000004hU0RSQZ3jp+X2LJ#7000yK00000006x60stZa3jmy% z2mk;8003+N00000004Zt0stZa3jid92mk;8001Ze00000003$)0{|ib3jo}!2mk;8 z004Xd0001g0002hqyhjU01E(EU000006aWAK00000Y5@QMA^-~jm^lUj00000ga7~l00000301E(^ z0tf&A0000y000000000GPyzrV01E(rY#j&y000006aWAK00000T$}*_A^-~jwB-i? z000006aWAK00000MS=nVA^-~jY-|Vs00000FaQ7m00000KFa_AA^-~j@EQjI00000 zKmY&$00000uXh3fA^-~j)M*F+00000FaQ7m00000ryT+|F01E&x8wUUY0000K0000000023*Z=?`01E*8CIA^-~j=z<0S00000AOHY=0000000BY+03rYj z0I0MG0000004M+e000000I~@I03rYj00317000000B`^R000000K0Gi03rYj00eFZ z0000003ZMW000000BExT03rYj0Fdqn000000E7Vm0000003y8s03rYj0Q~a@00000 z06+i$0000001<9~0stZa3jhpZ2mk;8000yK00000003WO0stZa3jmy32mk;8000~S z00000001fJ0RSQZ3jq8V2mk;8002k;00000000X%001HY3jkbj1^@s6000~S00000 z005kG0stZa3jp9{2mk;8000yK00000003ej0{|ib3jm;hs0aW60000S000000002c z8UO$y01E(^N(KM`0000$000000002bN&o;N01E(|f(8Hp0000?000000000xpaB3P z01E(|=LY})0000q000000002AJp%wD01E)@vIqbG0000a000000002zIsyP901E)f zJqQ2*0001gga7~l00000K|TQhA^-~jz-|Ws00000TmS$700000r9S`wA^-~jPpF00000+qMA!A^-~jsPG2>00000L;wH)000009ykC1A^-~jRB{FY00000 zFaQ7m00000BFO*%A^-~jj28z0000007y$qP0001g0Ge000000Du4h z000000Ni;103rYj07R+=0000006+i$0000006k{{03rYj0EAu$0000002BZK00000 z08xek03rYj08GIL000000K5bM000000L;+=03rYj0FVR-0000005|{u000000OHXA z03rZ?3jll`2LJ#7003M700000003tL001HY3jo|a1^@s6001-q000000028|001HY z3jkDW1^@s6002Ay000000038R0RSQZ3jp|p2LJ#7000yK00000001=v0{|ib3jk1{ z2mk;8001BW000000021D001HY3jl~B2LJ$n0000?000000000z`2YYS01E&BLk9o= z0000e000000000$&jJ7<01E(6j0gY#000000RR910001X9RL6#01E)*PX+)00000i z0RR910002yOaTBQ01E(Icn1Ig0000m000000001rIRF4601E)5as~hZ0000?0001g z00000bAti^A^-~jv^xj@00000FaQ7m00000C|UskA^-~jsC)+i000006aWAK00000 zreXmAA^-~j*nS5900000$N&HU00000E(rkuA^-~j&{PKi00000FaQ7m00000(6;~p zA^-~jtO5rB000007ytkO00000l1%`A03rYj0FZ3#1^@s6 z001-q00000007?;0{|ib3jm;`2mk;8001BW00000006Ux001HY3jm0M1^@s6000yK z00000005yj001HY3jnBa1^@s6001BW00000002q*001HY3jjFA1^@s6000;O00000 z006Ny0stZa3jjPl2mk;8000z!000000000^umS)g01E&dfd~Kq0000W000000000) zfdK#_01E)fsRsZ60001R000000001?4FLcm01E(A;|2f#0000y000000000%IRgM8 z02Ba-y$k>V0000O000000000ieE|R>01E)PNCyA_0000e000000001g_xAt*A^-~j zSV9K?00000WB>pF000007%l(+A^-~j03rYj08sY_0000002BZK z0000007Y^D03rYj0N|Vk0000005|{u0000000%b!03rYj04#9^000000Av6F00000 z0IfFx03rYj07PvE0000004M+e000000Nob=03rYj0Nh6g0001g000yK00000000E+ z0RSQZ3joL(2mk;8005i-00000005OB001HY3jkbH1^@s6001Ze00000006&T0stZa z3jkPJ2mk;8003M700000007~_0RSQZ3joCS2LJ#7002|~00000000lp0stZa3jh?0 z2mk;8001Ze0001g00015zW@Lt01E)T3kLuI000000RR910002o0|Edd01E)*>IVP- z0000K000000002a8v+0#01E(E`3C?10000W000000002(tN{Qb01E(+ZU+DW0000m z000000000h&;kG=01E&tfCvBp0000a000000000G0{{SjA^-~jI6MXb00000bN~PV z00000m|Ow?A^-~jU?m6u000006aWAK00000v339eA^-~j@NxzK00000FaQ7m00000 zqzeK7A^-~j&?X1~000006aWAK00000wIu@pA^-~jJfsK!00000C;$Ke00000Dgyuj zA^-~jtULyP0000005AXm000000G+7-03rYj0L9001HY3jl0b1^@s6001Na00000002D^0stZa3joX~2mk;8002Ay00000 z000AjW&!{r01E&_T?haG0000e000000000W9RL6#01E)1PX+)00000)000000001v z!2$px01E)nbO-b00000mJI^{A^-~j z)S?Ig000008~^|S00000ZxaCkA^-~jlwAh^00000C;$Ke00000beRAEA^-~jpu+|L z000007ytkO00000#svZZA^-~j#3cv-000008~^|S0000096kU5A^-~j$X^Bk0001g z05|{u000000OiyH03rYj09XeI0000002BZK000000C7bC03rYj090TG0000003ZMW z000000DwLN03iSk06>Ka000000BQgL0000005OsP03rYj0Ca~20000002BZK00000 z04E9o03rYj00348000000Av6F0001g006*H001HY3jm~p1^@s6001BW0000000559 z0RSQZ3jhQH2mk;8001-q00000002_a0RSQZ3jovt2mk;8000yK00000000zZ001HY z3jkz`1^@s6004LZ00000002+n0RSQZ3jpjB2mk;8004LZ00000003}#0RSR@01E(! zn+E^@0000W000000000K(g6S>01E)f1PA~C0002+000000002N?EwHH01E&(;0FKz z0000u0000000011)&c+`01E&#jtBq%0001h000000001{L;(OI01E*4bO!(c0000q z000000002uTL1te01E*4hz0A^-~jG*kuv00000C;$Ke00000>M8;NA^-~j;1~!1000006aWB!000000MAVV z03rYj0Q6G`0000005|{u000000E|Ba03iSk04RnD0000003ZMW0000001<%#03rYj z01#{l0000005|{u0000005XCA03rYj004gm0000003ZMW000000Kyvp03rYj0MKU! z0000007L))000000GNM&0RSQZ3jkQA2LJ#7002|~00000002ia001HY3jmN^1^@s6 z001}u00000005ov001HY3jiEG2LJ#7001xm00000008Og0stZa3jlDI2mk;8001Na z00000003y>0RSQZ3jnAT2mk;8001Na00000001460stZa3jh#*SO@?B0000K00000 z0000yhX4Q~01E)5wgvzI0000e000000002qy#fFt01E&dh6n%v0000e000000002G z&jJ7<01E(6jR*h$0000K000000002H;sF3601E)j6bJwS0000a000000001|C z00000TmS$700000Df0pVA^-~jgqa8c000007ytkO0001g07WVR03rYj08D5H00000 z05AXm0000007+5;03rYj0K8WS0000006+i$000000K7c_03rYj0CZml0000008{_~ z000000Oy7Q03rYj00_nh000000K5bM00000071e503rYj0DSfb0000003ZMW00000 z00ZU$03rZ?3jmn02LJ#7001Na00000006`m001HY3jokY1^@s6001BW00000001=E z0RSQZ3jo9m2mk;8000;O00000008zF0{|ib3jk!M2mk;8001-q00000000oB001HY z3jo;21^@s60000100000006Z@0{|ib3jpM_2mkh)D01E*8!Ug~U0000e z0001g00000yA=ZfA^-~jV4es7000007ytkO00000;9~#)A^-~jB#Q000008~^|S00000OLGE$03rYj0Ms!E0000003ZMW000000Kn$~ z03rYj03;U(0000007w7;0000005+=u03rYj0DS8Q0000003ZMW000000Lj(?03rYj z01OBS0000007w7;000000E6oQ03rYj0AM!<0000000;p90000005qfm03rYj0Hj}k z2mk;8001Ze00000008OG001HY3jo+12LJ#7002Y)00000003Ek0stZa3jlCB2mk;8 z000yK00000000})001HY3jmNG2LJ#7004vm00000001j~0stZa3jkzl2mk;8003M7 z00000007qv0stZa3jho!2mk;8003xz000000002T`v3qU01E&-Lk9o=0001Z00000 z0000CI{*M801E(|Zw3GW0001R000000001(U;zLk01E*0G6w(v0000K000000001z zx&Z(p01E(w@dp3^0001R0RR910001YY61Wv01E)jUkCsI0001F000000001gJ9Gj7 zA^-~j;ARK_000006aWAK00000n*Ra-A^-~jFrEki00000FaQ7m00000ov#1@A^-~j zsQ(5400000FaQ7m00000uKfZ4A^-~jNRbEt00000C;$Ke000008*>2wA^-~jpoa$l z000007ytkO00000`ltW^A^;120957%0000008{_~000000LV)K03rYj0F;0R00000 z05AXm000000BFVm03rYj0O001Ze00000 z005l1001HY3jkaM2LJ#7000yK00000008<^001HY3jkz=1^@s6001xm00000003NT z0RSQZ3jnk|2LJ#7002z0nd^4}lep{<5-~DgOClQ(;L{LX%ClQ(;L{LX%NmD|TVe=FPH(yL*F_*AS0V@V{Gi_mTNtdx00TmllbTn*bb8|^kb462ONmDRi zNmDUjQ#D^jMMalE5djyMpgao>26QuRVQ@*8u^0gr7*ljKY-MwENmFx0Q(;L{FkeYi zF<(NmD|X@gV^v26QuRVQ@*8 zu^0gr7*ljKY-MwENmFx0Q(;L{FkeYiF<(3iQ(;L{HD5_nHeXXYUzb4<0T-8`JPQs6bTe&Xa7mZ37y%U+Q*<ClQ(;L{LSIEiL@`Bn0AE^8Q*<+J zVQ@)Pb5mbQm$4WD6_+zb0U8!EUqwYlQ#4;wVM$XpUrAFoUsE|>MVB#!0u~ExQ*<73vE+$G;m>Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQQ(;L{ zHIrfU6a_h7Oky#Y@dFJO3vE+$G;m>Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQ zQ(;L{HIrfU6a_h7Oky#YuuTCd0d1E7$N?3XLlFTL3vE+$G;m>Qa!E^VmytaI6qi)m z0T2>3Uqw@NG;C#ab4hJQQ(;L{HIrfU6ahJxErkLa3vE+$G;m>Qa!E^VmytaI6qi)m z0T2u|Uqw@NG;C#ab4hKN4LA!O3vE+$G;m>Qa!E^VmytaI6qi)m0T3lMUqw@NG;C#a zb4hJQQ(;L{HD5(VLor2m0AE^8Q*<+JVQ@)pm$B~*6fAT!Y-MwENo_?_VM$YTG;m>Q za!E^VQ!-ygMMXn0MRovRT251RGi_mTNo|+0?+g?ybTn*bb8|^;MN?r(Q*<Qa!E^V zQ!-zdK@kBL3vE+$G;m>Qa!E^VmytaI6qi)m0T2u|Uqw@NG;C#ab4hKN9G(mq0d1GD z?+g?ebTn*bb8|^;MN?r(Q*<>au;7(F*HPM zZ)Zhva&K};Zf<3AX;4dJdY6A^4H%cw>k1Q>Fckqo7GGL1Gem4}XGv~mZ%J-$WpZgy zOJjPM(0&Y6m(_j@L6;O30h*WBKn)a^;1&T4m)>#$3zvX80Uej>CIW)DlNSLV0hdrN z4Hr0Ya7A_iUs_HwXJs)kM`d(FZ*FvDcyvW}0AE^8GG}EuM@2(#ZggdMbTKklZ*pr> zbaG{3ZAoO8(d!Bne=;~nWpqVya&K}?b7wMmtb7wyF(eHcmp}CjDwoJx z3lWzN69EyI+JX%c7BMk(ZfS9KWnXM>V{1uMbTw^tbY*y#fbR?#5H&|-bVYJmk<;I6qoH70SA{w6ag?4Lor2DbTKnuNpEvsPjF>! zZEs{{mlpL4QI}R10X>&P83CD>C&d9DmybOG771{0MRovRT24!sF%tnW1T%AVa+lHT z3KSDDH%Dc3S7CB)X>MmtWpi_3XJwbs>k1T?SFj2c7yxs0WMy)40A^`yWo~Z(Us_Xi zG-GddbeDl~3=4UiVQFk-WKDBtMN*f{7Xc~-Qd2NrNtdx00TmNdGG9|+NmDalNmDdmQ$t@xMMam8 z7XdB^HDYCFX>LV!mw~_mDwkk*0S1?a)(a1pI~V~eCuC(sb^u>mF*HPMZ)ZehVs&Rp zZf<3AX;4dJdH`QqPE&L! zMVBzf0u>Web45~1Q!rluUs_I6bTe&Xa7mZ37y%WRGerR!95P=;MMXDdZE$R1V`WK7 zQd2fxQ!-ygMMYCJUzc&+3m6tRUqxa?L~u`3UjScPPE%n?Q*%W`F_(b-0V$WIIsp`y zgVYQXmk<;I36~BN0TByJQ*%W{MRr7RPgIvc+zTp~V0Zxr0&sAb;Y|S`m!&!Z6PHxl z0T2^4Uqw@NG;C#ab4gQkMN?r(Q#F%e^ArI&lMwPQm!vuY6_*u|0wR~BIsp`yRN4U$ z6E$B&Q*<0Th>1+5r$0HD5(jbTn*bb8|^kb462ONmDgnlacikm$MiF z6PGhZ0U8uCUqwYlLo!8n0AE^8Q*<+JVQ@*8u^0grmor5H8UZqskM$Lovlsyrmor5H z8Uiw3mq8H$7nh(s3l5j1Isp@xRN4U$4K-gyQ*<2pWpHnDbWL+~b#7%tZ*6dCY-L7aX>4U=O><{OQcIUG-V7xOQ!rms zb45i(myj0$E(SGaZE$pXmyQMMXt4W@&C@MN(5XUjScPPE&La zNtdx00Tq`sMFAQVGG9eSMN>3iQ(;L{HD5_nHeXXYmk<^KFb7j~Gi_mTNtdx00Tm@v zbTn*bb8|^kb462ONmDRiNmDUjQ#D^jMMXtLZe>MMOH)H%mvFueCI?e=Gi_mTNtdx0 z0TnS*bTn*bb8|^kb462ONmDRiNmDUjQ#D^jMMXtLaCAj>0AE^8Q*<+JVQ@)Pb5mbQ zm$4WD6_+zb0U9teUqwYlQ#4;wVM$XpUrAFoUsE|>MMXt7Wo>Y5VPj=UN>WocUs6*! zUqwYlQ#D_gaor0TL_uFgVnsx7PgGw3Us_HvGDUK7Z*omxZeeF-axyhXWpqt*baifJ zLvL+xX>4UiVQFk-WKDBtMN&&sb5c`uGi_mTNtdx00Tq`sMFAESQ!rmsHD5(VMF3w~ zPD@jCGi_mTNtdx00Tq`sMFAQMGG9eSMKxt@aCCW>fc*g}26QuRVQ@*8u^0grFjI6i zY-MwENmFx0Q(;L{FkeYiF<(v(RZBsH|MMXt4W@&C@MN(5XUjScPPE&Lv(RZBsIr5EcP00d1E7$N?1;WpPDPOH(#q0AE^8Q*<+J zVQ@)pm$B~*6ftx(Y-MwENo_?_VM$YTG;m>Qa!E^VQ!-ygMMXDdZE$R1V`WK7Qf*T* zUqwYlQ#D_gaor0T3O8RxVnsx7PgGx*aJ~#A0d1E7$N?1saCDc^>k1S;GBQVHZdY$| zYg2S`WnpbeWJG0VVRdYDMRovRT23-&WjRMhLvL<$Wq5QkHB)7DS8sA_Q*?4=VQood zMQxXGz6>M*ZI=Pa0TmQ(Wkpg;Q#M}!Us_I6bTe&Xa7k^KvF{8N8gw*lWpi^$ZADXI zNmFz*aA9e3NlR^0GG9fPtQ-v|0XLUX@Cy_oGC4ClQ(;L{LSL89A^{`@bTe&Xa7mZ3 z7y%U+Q*<ClQ(;L{LYDzV4HTDf zH~|Wmpgao>26QuRVQ@*8u^0gr7*ljKY-MwENmFx0Q(;L{FkeYiF<(G10Ve@%mjTED6$3>?F_%Dg3nu|>m+=D)77J}tbTn{bX>v(RZI_Wf0Th>1+5r#~ zHD5(jbTn*bb8|^;MN?r(Q#D_czw;IgZBukKaA9e3NlR^)kv#zvmsHvT5E3JJM0E`im#)(R z3YS0*0W-JmGXZA?mwM_73b&m)0a*c;&o%)Imq2m>d6%#~0n!~YF?DWfadl;1Y;R+0 zNmFz+ZFO{Ictt}pMN(5Rmk<&I6n|56HEnftWq3tUR9{k4F<$^*T251RF)?*+X>oOB zUuoOBUuV{1uMbTw^tbY*x&Hg#@nZ)0mkb^u>mPM1ao0w0%; zJpmS%xU35dm+MRn3QaX%UvF@8F*jddX>?_BUuAK1VQh0>c42HuOH*@2MNU&NUokdc zNpxj$UuAK1VQh0>c42HuR9{6!Qd2Zv0AE^DbU9yNW@&C@UukBSAW8u^ElyJ~Uo~G} zZ*X%lHeX3}WpZC-adlyAb6<90Y)MN~b45i(R9{m1+5r#~HD5(jbTn*bb8|^kb462ONmDhKL3Irim#)(R7nh_u0Th>1+5r#^HD5(j zbTn*bb8|^kbC*Go3={!jmyx^yDG)<4MRovRT2518NmFx0L^79g$^j#nZ*>6(mv_bj z76Maqm$AkIBLY)%mu$uYAp}!%MKqUiuM8BHJOK=sFvbEE0#kFBp>+Wy2SYMNQcF`X zm%&>L7$Pw_Urk?fVQyz-UukY>bZKF1X?kTzP)k#DMMZX0UsE+-m%RT08w*o(H)d~g zcVTj5Ntcm50Th=;!wegjuqF!)m+)!~8JDCw0Th>1+5r#~HD5(jbTn*bb8|^kb462O zNmDhKpGyH61TkMzG?!8N3LgqJUqxa?L~u`3Uza~r3?Y}KIsp}zG}QqRmz5&}8kSB0 zDF`)XZE$pXMRu2wBLg0mP5~*G1;GIqm!Lcg4hD2HZDDXpm$4WD6&O==G;C#ab4gQk zMN?r(Q!rmiQ!!stHD8zUgaQ-`LSIEwH(yg>NmD|XL3Irim#)(R7Y9>xGi_mTNtdx0 z0TmcibTn*bb8|^kb462ONmDRiNmDUjQ#D_g@q_{t3qoH-Q#W5zVM$X$m!LZVDhE?^ zGi_mTNtdx00TmcibTn*bb8|^kb462ONmDRiNmDUjQ#D_gFVz7Rm(Ml1+5r$0HD5(jbTn*b zb8|^kb462ONmDgnm(L;rB$uT+0TY*0+5r#~HD5(jbTn*bb8|^kb462ONmDhK0YnWH zmvA@%3YVZf3l5j1Isp@xRN4U$6E$B&Q*<VMN>Cl zQ(;L{LSIEiHDz*Pb7hwy*#Q*`ZBukKaA9e3NlR^)kv#zvmsHvT5E3j0SXIkQ*<Qa!E^VmytaI6qi)m0T2>3Uqw@N zG;C#ab4hJQQ(;L{HJ6`D0T}~rQ#6-R`3fHjHD5(yMMQ8Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQQ(;L{HJ7U# z4JZROUqzQmBnuw5CQt#*0+-4Q0uYzrjtdEwuE7ismnl;LbC>r>0T-7$?+X%_;EoFr zm!new8kdPs0XGLzbTe&Xa7mZ37y%UNmD|X5jG1Z0YaCtI}AGkZI=Pa0Tq{`Zvj35 zZI=Pa0Tq|TY6}$$ZBukKaA9e3NlR^)kv#zvmsHvT5E3pD3`!d0SpUmQ*<v(RZI_Wf0Th>1+5r#}HD5(jbTn*bb8|^;MN?r(Q#F?n zHVY;KHD8x;Ede*T?^6Lo1ecO&41N06a&%v5bY*g3bZ>G=R9{6>Q#qG>y$pjWbTTkvVPk7wX>N06a&%v5 zbY*g3bZ>G=Q$b%vMN}|fR9{m@UsFY2mLLLc1~p=3XK8MiP@N2Rmjf3IO_xi60wk9q z6#`b53vU7ymsjizW&&_`wSAhafmv`bx zKym>rmtMsI3zwB60~(hQ$pI_3>~;at0hh420t}Zxasd>Vk39hvmz#D0443On3<@MQ zUte!c42HuOH*@2Lor2CQ!-zd?AQW3mybOG7MIj14KWco zUjScPQ*=3BUuJ1;WM64!mmo?3I4(|8FkdxaUvF@8F*aXGbY*g1WpQ<3Y;#|BVQfiD zQ*%W{MO0r?LSIutUsNz(m!Vk#9+z8`3?G-!Z~+kyQ*%W{MRrhBUqo4G@1+5r#~HD5(jbTn*bb8|^k zb462ONmDhKvET|I0X3I!`vD-Ar8)rA+qB;Q=mq6GGCI?e=Gi_mTNtdx00TmcibTn*bb8|^kb462ONmDRi zNmDUjQ#D_g@q_{t3qoH-Q#W5zVM$X$mk@ISDF;(@Gi_mTNtdx00TmcibTn*bb8|^k zb462ONmDRiNmDUjQ#D_g@q_{t3qoH-Q#W5zVM$X$mrvyjC;>v3pmPB_2UB!2ZDDXp zm$4WD6&O==G;C#ab4gQkMN?r(Q!rmiQ!!stHD8zUgaQ-`LSIEwH(yg>NmD|X+?NX_ zm!N6^Aqi7+Q*<+JVQ@*8u^0gr8&h;NY-MwENmFx0Q(;L{FkeYiF<(NmD|X zfdLB^2U9U$Qd2=+myy>27Xd<-L6HF@2UB!2ZDDXpm$4WD6&O==G;C#ab4gQkMN?r( zQ!rmiQ!!stHD8zUgaQ-`LSIEwH(yg>NmD|XvET|I0YaB>`vD*ZbTe&Xa7mZ37y%U+ zQ*<ClQ(;L{LYEClQ(;L{LYHuE z0W1PYUzY(r0u%v4m*J8DDhE?^Gi_mTNtdx00Tm@vbTn*bb8|^kb462ONmE}*Q!!st zHD5(VMMXtoMME)3Q$t^3mjU?!Dwm`>0Th>1+5r$NHD5(jbTn*bb8|^kb462ONmDgn zMMXDXONmD{!MMX4oX?kTvc9%ii3n>Xxb5nFPZDDXpm$4WD z6(3V{G;C#ab4gQkMN?r(Q!rmiQ!!stHD5(VMMXtJF_&@N3mO4JmvH+5AO>_ZZDDXp zm$4WD6&O==G;C#ab4gQkMN?r(Q!rmiQ!!stHD8zUgaQ-`LSIEwH(yg>NmD|Xxh4ZI zAwpk8Q%GL`Us_I6bU0s9VqbJ}Wo1ciQ*<3vE+$G;m>Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQ zQ(;L{HJ4B23n&3Km!NY2EemZ^bTn{bX>v(RZI_Wf0Th>1+5r#}HD5(jbTn*bb8|^; zMN?r(Q#F^|mkTAAJ#+yJ2yI1UY(-K_ZI|Gq3?>0>mjTED6_>Gn4IY=kQ2`7KZBukK zaA9e3NlR^)kv#zvmsHvT5E3v(RZI_Wf0Th>1+5r#}HD5(jbTn*bb8|^;MN?r( zQ#F@xZUHO;L|>NyJpvQ~HJ9O%0Vn}&m+>Y776?T{F-cQ4Ut*Ub{tO(J&kGv?ZI=Pa z0Tl-}Urk?dbaIyw!T}`#ZI=Pa0Tlsomw{^mECFqo0muOr0z)yEaoh_U9yMP@0AE^8 zQ*=0AQet0pa%E*nZBukKaA9e3NlR^)kv#zvmsHvT5E3NmD|X@e>Ov0YaB> z`vD*ZbTe&Xa7mZ37y%U+Q*<Cl zQ(;L{LYMG70wo?oUqt|4T251RIA2m?UvzS1Wl3#QbTn{bX>v(RZI_Wf0Th>1+5r#} zHD5(jbTn*bb8|^;MN?r(Q#F_I6ALLGHD5&lUs_I6bU0s9VqbJ}Wo1ciQ*<ZtM#PmpY{j3zsnR0Y;bIRss%}MZ^IgmnHH6Q42U@VQ^t%X>@r- zc9(!s3y+uPfC5mLQML>hmquU<6b&?AMMXtZIbUs5UsFPtF%JV|mrnEn7?(NC3k#P( zasd>Vkn#*wmxy@{4iYjjVqs%zUukZ0WpZ?1X>?_Bm(jBeEtgP;0VxPYLor2CQ#W6i zF^>T>myq%dFqg2E3>KF#cLETXEm{MYCUi0|Vqs%zUukZ0WpZ?1X>?_BVRUbDNmD^z zMMYFGUsNz(Q$}Bv4+D&s8F&o~m%}6iGnZF^0$!Ik%mNaZ%;W-Hmuu4u8JFdN0#Xz; zUrk?Sa$$32Utx4#Wo~3eP*XIO5d(?^HDhdLVVAxN3wyT?w*iL*mz}-~FPBe13>%j} z?+Xr>;EoFkmre`~5hG7iFkb*)T2518NmFx0Lo!8DOH*F}Us_XiG;?=ha7j>8bC;l3 z0a^hymk(C~8X7fUMMXt5c42IFWkq&HG<11zWkpg`HD6Okml4AOM7Kb_0R;z_>sA68 zmr!W|1ebus0jHOC`vDo3V3GkrmrfoH50|jX0Wz1+7Y!ztD#iihm#mip7?w@}DYtCM z0TlvLHD6zEaC0#>UrBUja$jX}bzy9CUv^<^NlR06MME-0Qd2Tt0AE^8IbUCAZgpQ{ zcz88mUvF@8F*aXGbY*g1WpQ<3Y;#|BVQfiDQ*%XQY)O|f7XcTSKuQ4^14Tt*m+-p* zA(zl_0T7oSc>xBusLBD61((2Q0|b|_f&mM+&V>OK1h?$Z0l)*7Icot8m+y27ikFIO z0V9`SHVjF(vef~11(&~30UMXFgaT`qK5PS&mmW|I4VNHu0UDQZKMQb|&NBi+mp^I& z441&y0fv|CmkSk_ESCatmwz+@4VSil3lW!h^Z|R96g&Yp3{zoAQ*%W_F-1~KQ)X8ZewLhP)k#DmyNmtECn-PQ!`(e zp;-bRmjQMG8V68IQ*%&LbC;|30V$WHIsp`yRN4U$6E$B&Q*<0VS8DIsq04MME-4Q#M~>mjU?! zDwm`>0Th>1+5r#~HD5(jbTn*bb8|^kb462ONmDhK@e>Ov0X3I!`vD-Ar8)rA+qB;Q=mz|daCkIn>Gi_mT zNtdx00TmcibTn*bb8|^kb462ONmDRiNmDUjQ#D_g@q_{t3qoH-Q#W5zVM$X$m%zmV zLClQ(;L{LYJ|%3l^8E zxdIvnbTe&Xa7mZ37y%U+Q*<Cl zQ(;L{LYMFe4H^b9Us6*+UzhJS0vHHFUqwW4PgGx*QNIBwmw=iA90yZ$Gi_mTNtdx0 z0TmZhbTn*bb8|^kb462ONmE}*Q#D^xIbWB*5e*rauFL`rmmu8>9tLzXZDDXpm$4WD z6&h1?G;C#ab4gQkMN?r(Q!!sjQ!-yuHeW?Wmx1~LAD1s@3=Eg7`T+@-UB3YzmpUX2 z7YS2yQ*<+JVQ@*8u^0gr7gKaJY-MwENmFx0Q(;L{UrAFnUsE|>mk$;VGY3<2Gi_mT zNtdx00TmcibTn*bb8|^kb462ONmDRiNmDUjQ#D_g@q_{t3qoH-Q#W5zVM$X$mudL{ zFb7j~Gi_mTNtdx00TmcibTn*bb8|^kb462ONmDRiNmDUjQ#D_gd^rLp2UB!2ZDDXp zm$4WD6&O==G;C#ab4gQkMN?r(Q!rmiQ!!stHD8zUgaQ-`LSIEwH(yg>NmD|X4=4g6 z0YaBI`T;QqQ*<+JVQ@*8u^0gr8dG#MY-MwENmFx0Q(;L{F<(hjGG9|RUqwZif%*X- zmq7Ll4VSI@0VD@gbTe&Xa7mZ37y%VNQ*<Vr@Us_Xi zG;MEoWl2(Pmx0*}BbU%90RBL`D-Gi_mTNtdx00TmcibTn*b zb8|^kb462ONmDRiNmDUjQ#D_g@q_{t7D8V|Q#W5zVM$X$UqwYVV{Bz%az%ERfxrPO z2~%@ZbTe&Xa7mZ37y%U|Q*<ClQ(;L{LYKKF11}yzUqt|4T251RIA2m?UvzS1Wl3#QbTn{bX>v(RZI_Wf0Th>1 z+5r#}HD5(jbTn*bb8|^;MN?r(Q#F^s#Q{PAZI=Pa0Tl;hY(-K_Q#F@R{{bWcZI=Pa z0Tq{oJpv$?KvDq;3vE+$G;m>Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQQ(;L{ zHJ7oq3l^8ExdIFeZBukKaA9e3NlR^)kv#zvmsHvT5E3;j4HTEI%mNLU zAl(Za0d1E7$N?3Xg!%y-m+))?43}RW4GEWBzX2bYIwTAi0d1E7$N?3X6c!C33vE+$ zG;m>Qa!E^VmytaI6qi)m0T2>3Uqw@NG;C#ab4hJQQ(;L{HJ54m0WJY;mjTED6_=ov3mXA# zmjTED6$&?BOky#E2B z0hdgT3l|4dbTe&Xa7mZ37y%U+Q*<ClQ(;L{LYHtu4I!0K0yGCxbTe&Xa7mZ37y%U;Q*<)8x84^54hEMfnG6w@^Z`znAW;kzx7_OjA_12lQ49{35NHA!mh=Hl0YjHz z>jGt$?_2=~m*x2iQkT$w3=5YPJOL7yKyeFdm*BJlaF<#t3|ay)MVE0!17??vO$-s2 zqXz>Um%vj3c9#V%3>lV114oxmYXT1gHeXPeG0h7Tmq2m>6qk_l3{{sXMhpxTQ*<&g zVqs%zUukZ0WpZ?1X>?_Bm(jBeEtgP;0VxMXLo!8DQ#Y3o5(5;M0tF3H22fOAQd2mW z5g!c}moL%`MVH-r13#Ba^#KkPQ*<&gVqs%zUukZ0WpZ?1X>?_Bm(jBeR|Q2>UsFMs zpO^z1moR$+Ml^IXFk)e2YhP(@b7gXLUukq@a$$6Da!FG&UrAFnUsGX8Q#D^jMMXta zF<(?LUsFS0Q$m-mJ^>k*?BoJGmvEB{8@KWw13LkiK(+!^mq^bH6_-hk3x=0Xh5{v* zw>u0Rmp~y5X_upK0VJ0|Aq;7k@Z<{$w+J5sRRWj%whSAWUxN$*3mKOX$pI~w zn%oQvm%YLP7;0s4Nn=G$IbUCAZgpQ{cz7`}UteWzVPb4$UukAZSaWhybU9yNX>(s= zXkl_mR9{6mUte}%Y;|QtVnsGzUvznJWkpg;Q({R|Ghb75F)?FkVRBz|a$#w7b4gP( zUqw@4NmDalMMYCXm+`v+A(ucQ3~IN&C<2KEmu~F=3zwil4RyD`=mD+-ml{X{VwW(M z0u+~^unPyb#4ZBg1D73?3l*2FxdIoLur>m1mvATpIhT-`0tT1QgbWFnxhMl7mxjOr zC6{0}3`v$I3>UYVHUb<0w_Z2`*8!J6QUMs3u!I6@w6IALsTZ)0I}Wkpg`IA3j-0a^k%m!vuY6_+wC0}=*PGG9|QUzhNJ4HuVP)Cv}t zP$UB#m!vuY6%<89H)LgVbaHQbNmDjoMMZW}Q#hAEB?3E_qB;Q=mwjjf9G5jw3>*nl zb5nFPZDDXpm$4WD6&O==G;C#ab4gQkMN?r(Q!rmiQ!!stHD8x6)d3fmds_lD26QuR zVQ@*8u^0grE>mUvqb1 zaF=oW3?i4MIsp_2MMZW}R9{m;m(b%1AeW`W3?&CsbTe&Xa7mZ37y%VFQ*<$^uE3J#GSkmk+=J2A59E0!g=T zZvqhmmp9`ILzf*$3=6mRK>?uxm(WWKN0#3U47c8L0&fJjGk5}Y0hcGm0U(#4gAG=f zmqr1mmsw^FG`A~y0*C~ctKI?&mO=qIw<~`FSOk|UnG6q>^Z`znAW;krmkdq=SC<;p z0t}b%T?1B^kf93*mx;LxNS7aV3<{T*5epEPkZ=tSmpP0JQI{2Y100udEdxfEKNABE zmxg%*6qkSy15%e*odOn?MFU5dOIHFEmllfyD3^c`12C7MEdv&pO0xnImsKqTVVBzK z3Kf?Fo&k23fOZTEm*o`;5|?0i3j~*}xeRhCbTTkvVPk7wX>N06a&%v5bY*g3bZ>G= zQ#M~oQ#fB!VM$XsUqwYlMVBzo3LBR|wgOd`|5gJgmniZ9WtR+t3<{SiatxH0Wflx5 zmyZ4mVwa{K42PG{jSCmI9)tp_0hf2m0UeiL6%7rShIj!cmk`7O1()5>3JjO9xB@np zFgF1Px1@&xZ2^~FOadR5)Itmxw<(DNl?j)31`8gROafq+1sx1%mvCwg7MCBN3@DdN zM-7gbfc^>=m(QsJ3YUJR0%4ahPy!a0%|ZhQmu0O27Pn_k0vH09b!H4(m%z{g9k(`< z0@MSyFqi^^0hd?50V216ngXu@mn#qre3!4c3mTV5B?2>-fS3YHm)%$m8kbch4MVr? zwgNu`mkMzL4VUoL3LTfEIsp|2HeXF&aCCB)XD0$Smk><>EtjP_0Th>`hXP2KqB;Q= zmjuoN5d%{*UzhH&0xp-3O#vR4r8)r=motqE7nh&Y0t=TAO#v;Jr8)r=mnB{e5Cb@0 zZI^*~0WJn~Gi_mTNtdx00TmllbTn*bb8|^kb462ONmDUjNmDXkQ#M~kMMaldhXOvGi_mTNtdx00TmllbTn*bb8|^kb462ONmDXkNmDalQ#W5lMMamPhXP6oQ*%>v zGi_mTNtdx00Tnb;bTn*bb8|^kb462ONmDXkNmDalQ#W5lMMXtLMLA<{ZgX^Ubz^i% zQ$$}%Qd2WuQd2{hfkFZkm){Zt3zzWJ3L61!mjTED6_;Fx0zv_8mjTED6_=xj0!RUE zmjTED6_*6g0ucjkQ#O}S-wYI&^4J0um$2FjHKeQa!E^5b5nFPZDDXp zm$4WD6*W_IG;C#ab4gQkMN?r(Q(s9_Fke$NUqwYlMMN@1b^u>mPE&L=aA9e3NlR06 zQ*<+JVQ@*8u^0grEmL$fY-MwENmFx0Q(;L{UrAFiUsE(+MMXtLL@`Bn0AE^8Q*<3Gn%mQ`=m&a!dQJ0Ng4K0_YKLJCRkU0x6mml5>6_?P00aUk7 zf&r5Pmo;($AeWBz3|5wR36_=oc4Of@i ziUC!Z4U7SxmsS@6AeWHx3{{tYjR9Df@KXymx0l-j^bVJB(+fwJu=xxJm)&&(PnW81 z0UMSu14ox1bqofV6cPhsmroM|SeH4u0UDQZEdxfEu(bjdmj{6j8JGTX0~42Ei2@Us zfDi*Pm+;*R7ME8M0~iouVPk7wX>N06a&%v5bY*gv(X$IJmr#fSDIG;*Wkq%XUs_I6 zbTTkvVPk7wX>N06a&%v5bY*gv(X$IJmr#fSDIi5*Q$2C314VFfmmwAdBA1}M3uKp%gaQbcyG;Qfm%w`iFqc4n z0T-8F>jDXviemyNmk`7O6qn|R0vngGgA5?IeC+}T2$z?{3wM`_@B$B)f29IomoQKQ z7MGy23kR1NHwzZGd#wW00=IPa0tN<`<%j|tmQevYxBL?WYyp?v5(5mE@YD(&m!vuY z6_+yY0z{XhIsq4#({=+Km!&!Z6CXn{NmDalOky!bMMY9mFkeqpUjScPPE&L=aA9e3 zNtdBI0T&QNGDUU(Us_I6bTn{bX>v)Ip*jHvGi_mTNtdx00TmcibTn*bb8|^k zb462ONmDXkNmDalQ#W6ip*aH}2UB!2ZDDXpm$4WD6)#hCG;C#ab4gQkMN?r(Q(s9_ zFke$NUqwYlMME)3Qd2o!Oky!bMMY9mFkeqpUzdS+0V@G*mjTED6_+yY0z?6AmjTED z6_?X?0~rBrmytaI6bC~wNm6Z7GnV-Q6t`*>0~`vM&X@xXmq2m>6qi0I4Puw8&H_@G z7fcHhm+w{r6_?<10!WujR{{*Ta3TX(0+)5Q3Qd>3fdM(UuiF8f43|K10Tq{y_6%0H zKP3Y?3YT!x3rUwy9RmcnV@?B=0hcEh100v2y9;Z#PA~%y2Dk7F14#pyN$~;?mk>Jx zQJ1g?3@n#yN&^pQa!Hq=Isq3RLo!KI zGha+%F-1j1Qd2NrPgGw3Us_I6bTe&Xa7mZ37y%WRGerR!3^HFuMMXn0MN&&sIhWDx z3m=!IIsp@xRN4U$DK%e3Q*<Qa!E^5b5nFPZDDXpm$4WD z6+KgQG;C#ab4gQkMN?r(Q(s9_Fke$NUqwYlMME-4Qd2o!Oky!bMMY9mFkeqpUjScP zPE&L=aA9e3NlR^)kv#zv6hkseQf*T+Urb^#MMXtVR9{b2FqiQR3?i3Mkqls$4-g9u zx4%&X-~^WyJOL7yaK8*}x1d)8$pM#VF9H#l@ZSNImz#zS61Q1C0*MWmGRg`Smyc8p zjJMZX0}TV0B7F^Nw@h9GM+KMg3j-v#?@9x-0+-2v1Amv#*9#AqN$~;?mk>JxQJ1g? z3?G*++6)f2P-FvJ0+;tW0TGvgHw+7x>P!p_mpV-g6PIZ`0Y{gmQvw^8z6S##m;c8B z8kg)X3>uf^hyom!AWZ=wm$e2950?uR0}Ge#b^{)lcKZPum!&!Z6PHxl0T2{5Uqw@N zG;C#ab4gQkMN?r(Q#D_g3!?%jm!vuY6qi)m0T2^4Uqw@NG;C#ab4gQkMN?r(Q#F%e z^Ary`Urb^#MMXm~MN&&sL|>PYBLg0nq&fiFA7ni*n43xKCp91&{m!+5k6}K>Z1Em9(L|+3Gmw*rh zMg=rtVRL1d;b;tJm%wKOD3`!70~MFh9}N?i$bbW1m%wKOD3`!70~MFh9}NYU?}Gyi zmzQD#7nkse15lUn3j-vVFQ^Lz z0VKm#O~q&fi1+5r$MHD5(jbTn*bb8|^kb462ONmDgn zMMW_&UqNhaZ)0C>Z)9adGDT8TLSL7WBLg0nq&fim!&!Z6PHxl0T3cJUqw@NG;C#ab4gQkMN?r(Q#D^j zMK@nfUt@1@c}Y%FLYENf3MB|NUqw($Q$}Bx@iPJ#mm_ThAD5&$0Th>1+5r#~HD5(j zbTn*bb8|^kb462ONmDhKt8D{Bm!vuY6qi)m0T2^4Uqw@NG;C#ab4gQkMN?r(Q#F@; z1Pv>fJjwwKmq1Yi50?q`3lW#ciwqXG*^UEc0hdVe0uZ+lI|Kg&myLu2gqPnk3mLcF zKm(5nmnfP8P?wI71ND~#O#wNVr8)r=2t`9NMN&&sIhWDx3m=!IIsp@xRN4U$DK%e3 zQ*<^m!vuY6qi)m0T2^4Uqw@NG;C#ab4gQkMN?r(Q#F^_g#$vDq&fiu#c0hflt3u2eRX9Gf)&>sy3ms+(9 z3b$Nm1CRrkn+OdUm#~BaY?t3M3k|ofYXg-Cw~v$qJ^`1NBLf%lFIsp@xRN4U$6E$B&Q*<n4myy>27YH?9MMQ8T zmmik{E0>RV3lz75kpo2mmwWLH8JAEb109#7Isp}zGA#oVm+i3v2$%GL4HK9AoD2$= zFf{^^mui*+C6{^X3LBS@O#vR4r8)r=mjuoNCYM{(3K*AABm-ub?^^>Bm%7vo83r_P zVQF$nm!UcV7ZgJ>MN&&sG+zK;T251RG;m>Qa!Hq=Isq32Lor2COPBDY10k1?O#vO3 zzaRUvvD4GLp3V(2PXmVv?WM6G{bY*y7b#82LV`~6#bZByA zVPs!zb#!HTUu0C03@a%Ev;Uuth@ZUAs}XmVv?WM6G{ zbY*y7X>MtB0C03@a%Ev;Uu|`CWq4n7a(QfTV`~6#bZByAVPs!zb#!HTUu0!-bboSh zc>r*9XmVv?WM5-%Ze(F}baG#5ZfSG?aCB&LWnpArV{dL`VRUqIUvp)2V{C6@YXER` zXmVv?WM5-%Ze(F}baG#0Wpi|LZ+QT4bZByAVPs!pZ*F8?X>MtB0C03@a%Ev;UvhVB zZ)0m;X>MtB0C03@a%Ev;UvhVBZ+~NJUvgw@Z)0l!aCB&LWnpAra(8TRV{2b@a(QxO zY;R+00C03@a%Ev;UvhVBZ)0m;cXDiRV`~6#bZByAVPs!&cWiHCYhQG7d3SPbZ)0l! zaCB&LWnpAra(8TRV{2b^ZftL3YXER`XmVv?WM6W3Y;R+0Uu0!-baHQb0Do|FXmVv? zWM5-%Ze(9~VQF*#ZDnn9WprP20Ap-#V{2b$Wps3DZDjy(bZByAVPs!pZ*F8?bZKp6 zWOrd{bO3O4XmVv?WM5-%Ze(9`X=iR>Yyfa{XmVv?WM5-%Ze(9#a&KW|V_|c20C03@ za%Ev;Ut@1>WM5=ub98cVd4B+BWps3DZDns}WMO##Y;R*>Y;MtB0CQz+Uw2_?bO3W@ZC`M2b94Z6Wo=(%Wpi|LZ+QT4Z*XO9 z0B~b$Z*ye;cXDZTWdL$zVPpVvZ)0m^bO2&$Ze###X>)XCZUA9pV}E6EbO2*-Zf<2` zbO3W@Ze##+Wo~42Zvb*-V|D;?Wn*?`a&K(_WNdG6Wo`guY++<%asXs(b9rq5WNc$> zZ*ye;WNc+}a&K|~bZKp6a$jR|Wnpw>0CZ_>WpZD0Wps3DZDjy-X>Db4Uu0!$Wprf# zZEIv{asYL6Y-MF|0Dos?baiQD0C03@a%Ev;Utx4~a$jj~X>@aAXk}yoaCB&LWnpArVRUqIUu0!-baHQb0C03@a%Ev;Utx4~a$j?0 zbaP{9Wn^$~Y-wY80C03@a%Ev;Utx4~a$j?0baP{9Wn^$+a(`iM0B2=%aB^vHa%psV z0CQz@aB^vHa%psV0C03@a%Ev;UuR`>b7N>_WN=|}VQm0#bZByAVPs!(Wps06Xk}z@ zVRB(@0AXWeWpi@?Z*XO9WNC5$ZDDL|Z({&va%E)zb8c{QX>N38UvmIsY;SXAWNC5$ zb#82FZfgK?Wq)C0WNC5$a&2U3asX*>V{~i)b7gH`baHujVQF*#cXDZTWp)5*Ze?^| zVRUb90C03@a%Ev;Utx4~a$j?0bYx|8VPj}>bYXO50Bvh#X=ZN#aBpmE0CRM5WpZ+F za$j-)a%Ev`aA9<40CQtuZe(e40Bv(;XJvE%ZF6UHZhvF|ZF6UGV|D;-b7y08YyfX? zbY*gK0B>+~X>McyZ*X*PaC87~aCBjEX8>nqbZ>BU0B2=%Z*X*9Y;SI70Bmz*WorOt zbaHiWV_|e<0AzJ=G5}@RDWB_MnbYpj90CRM5bZ={4asX##bY*UK0BvP$V{mz2a{zN?bY*UK0Ay)$ZeeX@ z0AF8taA#j)VRL0}VQpmqb97;Jc4l(`aCB&LWq)C0Uvp)2ZeeX@Uv6*!aCB&LWnpAr zXJvG5VQpn!Zg2o_a$|IC0B2=%Xm4|LZeeX@0CjF*ZDjy+baG>Gd0%q?UteQ%d2nT4 zVqa`;V*qn>a&BX7Z~$|3a${k0Wn*n{0A_D+Wo`gwXJvGA0A^!sZ*ye;VRUb40BvP$ zV}EdY0A_D;YXD_J0049;k_Z3*0|1&z z0{{R3000310RYNL0{{>J00000005VfmIeR-0suNn0{{R3004ly3;+NC0009700000 z003~&1poj5004-)3;+NC0009700000001C31^@s6005A?3;+NC0009700000001a| z(FFhi0001(y9@vT000031ONa40001x6$ty9@vT000031ONa40002E6$t<{9003wJ4FCWD00097000000020M2><{9 z003|R4FCWD0009700000002mc2><{9006+d3;+NC000320015U0000000000007Yb z3;+NC000350015U00000000000079l3;+NC00032007_v000000001g0001B{|o>C z000011ONcw0{{R3000000002cy9@vT000010RRB_0{{R3000000002E{tN&B00001 z1ONc|0{{R3000000002sy9@vT000010RRC02mk;8000000002!y9@vT000010RRA< z0RR91000000002+y9@w-000000RaF2lLY_(0000000000_`3`M000000RaF28UX+R z00000000000K5zU000000RaF2;06Ey00000000002)qmc000000RaF2@&Nz<00000 z000007`zMs000000RaF2dV000010RR940RR91000000001hy$k>V z000010RR940RR91000000001JybJ&U000010RRB51^@s6000000002+{tN&B00001 z1ONc81^@s6000000001RybJ&U000010RRAe0{{R3000000002UfBp;r000000R#X5 zd;O<000000RaF2@d5w< z0000000000sJsjS000000RaF2@d5w<0000000000(7X%)000000RaF2@d5w<00000 z00000_`D1N00000e*pmi0Pz9<000000000003f{#00000009920Pz9<0000000000 z07$(I00000009920Pz9<00000000000Fb;400000009920MY^g00000000000D%7t z00000009I50MY^g00000000000GPZC00000009920Ad3Ge*gdg00000002P$3;+NC z00035003eG0000000000005x83;+NC00032003C000011ONa%2mk;8000000002UybJ&U000010RRB50{{R3 z000000002sybJ&U000010RRAg0{{R3000000002k{tN&B000011ONbj0{{R300000 z0002!ybJ&U000010RR9)0RR91000000002s{tN&Be*gdg0R#X5LjeE)0000000000 z@VpEF000000RaF2IRyX!00000000002)zsd000000RaF29RUCU000000000082=0a z000000R#X59RUCU00000000005WNfl000000RaF2!2|#R0000000000nEng^00000 z0R#X5f58L*000000000002sXt00000009920MrNo000000000005H7_0000000992 z0RIL600000000000O-9800000009920RIL60000000000006!W00000009920RIL6 z000000000002sau00000009920RIL600000e*gdg001z)3;+NC000320093600000 z00000002n73;+NC00032009360000000000000O84FCWD00032009360000000000 z0020>3;+NC00032007Yl0000000000002O}3;+NC00032002V-0000000000003CM ze+&Qs000010RRA51^@s6000000001(y$k>V000010RRA51^@s6000000001Zy$k>V z000010RRB?0ssI2000000001py$k>V000010RRB00000G0000000026y$k>V00001 z0RRB00000G000000002ky$k>V00001e*pjhsQ>@~5C8xG00000@VyKG000000RaF2 zsQ>@~5C8xG000002)+ye000000RaF2sQ>@~5C8xG00000AifL$000000RaF2sQ>@~ z5C8xG00000IKB)3000000RaF2sQ>@~5C8xG00000P`(TR000000RaF2sQ>@~e-How z000000BF7p00000009920I2`~01yBG000000Fb>5000000099205S;x0000000000 z0HD1L000000099209yb601yBG000000LZ-z000000099209yb601yBG000000D!&> z000000099209yb601yBG00000e*mbx3;+NC00032004yq0000000000006kX3;+NC z00032008s_0000000000007Xv3;+NC00032008g>0000000000007{<3;+NC00032 z002e_0000000000008*C3;+NC00032008*~0000000000000oa3;+NCe*gdh0RRA3 z1^@s6000000000ez6<~W000010RR921ONa4000000000$z6<~W000010RRAu0{{R3 z0000000013z6<~W000010RRBz0{{R3000000001Bz6<~W000010RRC00000000000 z0001Rz6<~W000010RR93e+d8p0000000000c)kn(000000RaF2YX$%S0000000000 zh`tN}000000RaF23I_lH0000000000sQwH9000000R#X5UK4H z000000R#X5kp%z%0000000000!2S#X000000R#X5kp}<(00000e*gdg0OC000011ONbM00000000000001R{|o>C000011ONbW00000000000001Z{|o>C z000011ONbZ00000000000001p{|o>C000011ONb`00000000000001x{|o>C00001 z1ONc200000e*gdg00000nEwm_000000R#X5fdT*k0000000000p#Ka2000000R#X5 zxBvhE0000000000sQ(NA000000R#X5B?bTh0000000000u>TAI000000R#X5(F6bh z0000000000xc>|Q000000R#X5e*pjh0000000000f586?00000009I50GtB=00000 z000000LcFg00000009I50O3;+NC00066002D+0000000000005A}3;+NC00066 z005~50000000000e*gfO!VCZa000021ONai1poj5000000001>!VCZa000021ONbU z1^@s6000000001}!VCZa000021ONaE000000000000026!VCZa000021ONaF00000 z000000002E!VCZa000021ONcc2mk;8000000002M!VCZae*gdg0t5g6;Q;^u00000 z00000$ifT&000000t5g6cL@Lh0000000000(83G=000000t5g61_=NF0000000000 z*uo3|000000t5g6jsgGx0000000000;KB?5000000t5g6(g6Sf0000000000=)w#D z000000t5g6f1m~c00000000000Pw;L0000000IO60Ko(R00000000000QkZT00000 z00IO60EYqq0000000000006@b0000000IO605Svs000000000000_ej0000000IO6 z05k>w000000000001(3r0000000IO60A2|I00000e*gdg000=n3;+NC00066007Je z0000000000001Dv3;+NC000660018X0000000000001b%3;+NC00066006WG00000 z00000001z<3;+NC00066005l@00000000000020{3;+NC00066001=!0000000000 z002P4e+&Qs000021ONc42LJ#7000000000;!wdib000021ONc91ONa4000000000` z!wdib000021ONat0{{R30000000013!wdib000021ONb21^@s6000000001B!wdib z000021ONbA1^@s6000000001J!wdib00002e*^#kcn1Ig0000000000aKj7$00000 z0t5g6g988n0000000000c*6_;000000t5g6tN{Q30000000000fWr&`000000t5g6 zqyzu}0000000000h{Fs3000000t5g67zF?T0000000000ki!fB000000t5g6a0vha ze*gdg000000GPuJ0000000IO601pHJ00000000000HDJR0000000IO60CoWY00000 z000000I0(Z0000000IO602~DX00000000000I0000000000IK&J9000000t5g6cnJUi00000e*gdg06@eH z0000000IO600amC000000000007%3P0000000IO60AmLL000000000008qpX00000 z00IO60FMX&000000000009eEf0000000IO607?k}00000000000AR!n0000000IO6 z05%2y00000000000BFPve*gdg00066004Cd0000000000003~r3;+NC00066001Wk z0000000000004Nz3;+NC00066000080000000000004l*3;+NC00066001Eb00000 z00000004-@3;+NC00066000gE0000000000005B03;+NC00066e*ggY1poj500000 z0001(#0&rc000021ONb~0RR91000000001>#0&rc000021ONa$2LJ#7000000001} z#0&rc000021ONa_2><{90000000026#0&rc000021ONaR0{{R3000000002E#0&rc z000021ONcG2mk;8e*gdg00000z{Csy000000t5g6#RdQX0000000000$ixf)00000 z0t5g6ItTy&0000000000(8LS?000000t5g6Dgpoi0000000000*u)F~000000t5g6 z1O)&90000000000;KU37000000t5g6ng{>@0000000000f9S*v0000000IO60L%ga z00000000000Pw^N0000000IO60M7yd00000000000QkfV0000000IO60Hy)}00000 z00000006}d0000000IO607D1>000000000000_kl0000000IO60O|t(0000000000 z01(9t00000e*gjm003SH0000000000000=p3;+NC00066003eL0000000000001Dx z3;+NC00066002k=0000000000001b(3;+NC00066000jF0000000000001z>3;+NC z00066000jO00000000000020}3;+NC00066007nle*gdg000000000$#S8!d00002 z1ONaj1poj5000000000;#S8!d000021ONby2mk;8000000000`#S8!d000021ONbq z1^@s60000000013#S8!d000021ONa82LJ#7000000001B#S8!d000021ONaG1^@s6 z00000e*gdgXvGWw000000t5g65C8xG0000000000aK#J&000000t5g68wmga00000 z00000c*P6=000000t5g6u?GME0000000000fW-^|000000t5g6`2+v}0000000000 zh{X&5000000t5g6CIbKf0000000000ki`rDe*gdg00IO60ILQ700000000000GP!L z0000000IO601*HH00000000000HDPT0000000IO60L%pd00000000000I0| z000000t5g63u`000000t5g6KL-E+0000000000Fvbi3000000t5g6 z)dm0n0000000000IK~VB00000e*y#m0Q?02000000000006@kJ0000000IO60OSGy z000000000007%9R0000000IO60F?*;000000000008qvZ0000000IO600{#C00000 z0000009eKh0000000IO60M7^j00000000000AR)p0000000IO60AvXOe*gdg00000 z003yl3;+NC00066007hk0000000000003~t3;+NC00066007Vi0000000000004N# z3;+NC00066007#tZ-e000021ONbt0ssI2000000001}#tZ-e000021ONa) z2><{90000000026#tZ-e000021ONaO00000000000002E#tZ-ee*gdg0t5g6-U0vs z0000000000z{U&!000000t5g62MGWG0000000000$i@r+000000t5g6a|Zwb00000 z00000(8de^000000t5g66#xJL0000000000*v1S1000000t5g6v;qJC0000000000 z;KmF9000000t5g6e;fh;00000000000O-aH0000000IO60Qm+000000000000Pw~P z0000000IO60C5Qb00000000000QklX0000000IO60B8vS00000000000074f00000 z00IO603-00000 z000000I3;+NC00066002`70000000000007{}3;+NC ze*gdi1ONb21ONa4000000002!#|!`f000021ONb71ONa4000000002+#|!`f00002 z1ONaw0{{R3000000002^#|!`f000021ONbh0{{R30000000000$P54g000021ONbC z1^@s60000000008$P54g000021ONbpe**vj00000000005XcMw000000t5g6c?AFf z00000000007|09&000000t5g6w*vqG0000000000Ajk{=000000t5g682|tP00000 z00000D98)|000000t5g64+j7M0000000000Fvtu5000000t5g6jRgPz00000e*gdg z0654D0000000IO608a$~000000000006@qL0000000IO602%-Q000000000007%FT z0000000IO609FA2000000000008q#b0000000IO602=@R000000000009eQj00000 z00IO607?b`00000000000AR=re*gdg00066002q?0000000000003yn3;+NC00066 z003qK0000000000003~v3;+NC00066007(p0000000000004N%3;+NC00066006ZG z0000000000004l<3;+NC00066005H)0000000000004-{3;+NC00066e*gfk2LJ#7 z000000001x$P54g000021ONc!1poj5000000001($P54g000021ONay1^@s600000 z0001>$P54g000021ONaW00000000000001}$P54g000021ONaf1ONa40000000026 z$P54g000021ONaX00000e*gdg00000xX26u000000t5g6?EwG)0000000000z{m^$ z000000t5g69smFU0000000000$jA%;000000t5g6N(2A^0000000000(8vq`00000 z0t5g69|r&c0000000000*vJe3000000t5g6rUd{10000000000f8fXr0000000IO6 z09^+F00000000000O-gJ0000000IO608Ik`00000000000Px5R0000000IO60Nnuq z00000000000QkrZ0000000IO60Br>T0000000000007Ah0000000IO60E__u00000 z0000000_wp00000e*gjm000LE0000000000000ol3;+NC00066006HD0000000000 z000=t3;+NC00066002J-0000000000001D#3;+NC00066000#M0000000000001b- z3;+NC00066007AZ0000000000001z_3;+NC00066004mre*gdg000000000u$qWDh z000021ONc61ONa4000000000$$qWDh000021ONbb2mk;8000000000;$qWDh00002 z1ONaZ00000000000000`$qWDh000021ONa+1poj50000000013$qWDh000021ONbG z1ONa400000e*gdgV95*s000000t5g6DhB`n0000000000Xvqu!000000t5g6I0FCx z0000000000aLEh+000000t5g6AOHXW0000000000c*zU^000000t5g6O9lV{00000 z00000fXNI1000000t5g65e5JN0000000000h{+59e*gdg00IO60HOu}0000000000 z0FcQH0000000IO602KoO00000000000GP=P0000000IO60GI&)00000000000HDbX z0000000IO60Fwj&00000000000I10f0000000IO602l)R00000000000I z3;+NC00066001)q0000000000e*gf8$_xMi000021ONb;1ONa4000000001x$_xMi z000021ONcv2LJ#7000000001($_xMi000021ONar2LJ#7000000001>$_xMi00002 z1ONae00000000000001}$_xMi000021ONaI1^@s60000000026$_xMie*gdg0t5g6 zY6AcO0000000000xXKIw000000t5g6e+2*l0000000000z{(5&000000t5g6vjhMD z0000000000$jS@=000000t5g6g$Dot0000000000(8>$|000000t5g6B>(^b00000 z00000*vbq5000000t5g6ejVG*00000000005X=k!000000t5g62Lb>900000000007|aX+000000t5g6^9TR{ z0000000000Aj}K^000000t5g6LjeE)0000000000D9j81000000t5g6vIYPE00000 ze*gdg05Hr90000000IO60D1uc0000000000065GH0000000IO603-we0000000000 z06@$P0000000IO60PhC?000000000007%RX0000000IO604@Lk000000000008q>f z0000000IO60CE8U000000000009ecne*gdg00066003hH0000000000003aj3;+NC z00066002G%0000000000003yr3;+NC00066000pK0000000000003~z3;+NC00066 z001}#0000000000004N*3;+NC000660024z0000000000004l@3;+NC00066e*gfp z2LJ#7000000001p%nSek000021ONaq00000000000001x%nSek000021ONa*0ssI2 z000000001(%nSek000021ONaa2LJ#7000000001>%nSek000021ONar0000000000 z0001}%nSek000021ONaN2mk;8e*gdg00000u*?hq000000t5g6!2tjO0000000000 zxXcUy000000t5g6ng##>0000000000z|0H)000000t5g6ZwCMX0000000000$jl4? z000000t5g6JOKaz0000000000(98?~000000t5g6UIqXF0000000000f7r|n00000 z00IO60IvZ600000000000N~6F0000000IO605Jmq00000000000O-sN0000000IO6 z0Qv_200000000000PxHV0000000IO605Jvt00000000000Qk%d0000000IO60Q?33 z0000000000007Ml00000e*gjm004If0000000000000Qh3;+NC00066001%o00000 z00000000op3;+NC00066000UC0000000000000=x3;+NC00066005Q&0000000000 z001D(3;+NC00066006cI0000000000001b>3;+NC00066001)pe*gdg000000000m z%?tnl000021ONcG2LJ#7000000000u%?tnl000021ONbe0{{R3000000000$%?tnl z000021ONb%1^@s6000000000;%?tnl000021ONcT1^@s6000000000`%?tnl00002 z1ONb|2mk;800000e*gdgSj`Lo000000t5g6It2g#0000000000V9g8w000000t5g6 z*8~6n0000000000Xw3`&000000t5g6-U9#t0000000000aLo(=000000t5g6B?kZi z0000000000c+Cs|000000t5g6bp!wa0000000000fXxg5e*gdg00IO60OA4w00000 z000000Eo>D0000000IO606GBx00000000000FccL0000000IO60AUFL0000000000 z0GQ1T0000000IO605kvq00000000000HDnb0000000IO60CNKX00000000000I1Cj z0000000IO6e*n+}0000000000006Mf3;+NC00066006iG0000000000006kn3;+NC z00066002b-0000000000006+v3;+NC000660021$00000000000079%3;+NC00066 z008F#0000000000007X<3;+NC00066002)000000e*gdg0002k%?tnl000021ONc3 z0RR91000000002s%?tnl000021ONbJ0RR91000000002!%?tnl000021ONbL1^@s6 z000000002+%?tnl000021ONa_0{{R3000000002^%?tnl000021ONc*2mk;800000 z00000f6fd5000000t5g6H2?qr00000000002+j-u000000t5g6`UC&~0000000000 z5Y7w$000000t5g6qXz&000000000007|sj;000000t5g6u>$}A0000000000AkGW` z000000t5g6vjzYF0000000000D9#K300000e*y#m05$*s000000000005HxB00000 z00IO6067Q%0000000000065MJ0000000IO60F49y000000000006@+R0000000IO6 z05<>t000000000007%XZ0000000IO60AT?D000000000008q{h0000000IO605k*u ze*gdg00000003Cd3;+NC00066001)w0000000000003al3;+NC00066005N-00000 z00000003yt3;+NC000660027)0000000000003~#3;+NC00066001}u0000000000 z004N-3;+NC00066004vs0000000000e*gf0&I|wm000021ONaS2LJ#7000000001p z&I|wm000021ONcj2mk;8000000001x&I|wm000021ONa!00000000000001(&I|wm z000021ONbz1poj5000000001>&I|wm000021ONa{2mk;8000000001}&I|wme*gdg z0t5g6_5lC@0000000000u+9ts000000t5g6CIkQg0000000000xXug!000000t5g6 zrv(520000000000z|IT+000000t5g6(gy$l0000000000$j%G^000000t5g6=m7u# z0000000000(9R41000000t5g6e>(sG00000000000NBn90000000IO606YKy00000 z000000N~CH0000000IO605}2w00000000000O-yP0000000IO60Kf(S0000000000 z0PxNX0000000IO60G0><00000000000Qk-f0000000IO60Nnxr00000e*gdg0002b z3;+NC00066006@S0000000000000Qj3;+NC00066004jn0000000000000or3;+NC z00066006560000000000000=z3;+NC00066005o>0000000000001D*3;+NC00066 z002Dz0000000000001b@e+&Qs000021ONcE2mk;8000000000m&kO(n000021ONcv z2mk;8000000000u&kO(n000021ONaH1poj5000000000$&kO(n000021ONa&00000 z000000000;&kO(n000021ONc+0{{R3000000000`&kO(n00002e*^#kUIhRE00000 z00000SkDXq000000t5g6p9cT{0000000000V9yKy000000t5g63pb0000000000c+U&~ z000000t5g6?E?S+e*gdg000000D#X70000000IO60ILT800000000000Eo{F00000 z00IO60162J00000000000FciN0000000IO60Cxib00000000000GQ7V0000000IO6 z0OA1v00000000000HDtd0000000IO606zc#0000000000e*mb@3;+NC000660027$ z0000000000006Mh3;+NC000660009C0000000000006kp3;+NC00066006!L00000 z00000006+x3;+NC000660055%00000000000079(3;+NC00066000~V0000000000 z007X>3;+NCe*gdi1ONcy0{{R3000000002k&kO(n000021ONa70{{R3000000002s z&kO(n000021ONb*1ONa4000000002!&kO(n000021ONaM2mk;8000000002+&kO(n z000021ONb}2mk;8000000002^&kO(n000021ONade+2*l00000000000MHBo00000 z0t5g6HUa&<{900000e*gdgP|*wk000000t5g6@&y0@0000000000SkVjs00000 z0t5g6^#K3?0000000000V9^W!000000t5g6BL@Hg0000000000XweJ+000000t5g6 zx&r_J0000000000aM26^000000t5g6M*si-0000000000c+m_1e*gdg00IO60BHvR z00000000000D#d90000000IO60009300000000000Ep2H0000000IO6089x000000 z000000FcoP0000000IO60P+F=00000000000GQDX0000000IO60Hgu{0000000000 z0HDzf0000000IO6e*hW?0000000000005}b3;+NC00066004;t0000000000006Mj z3;+NC00066005r_0000000000006kr3;+NC000660046V0000000000006+z3;+NC z00066002D&00000000000079*3;+NC00066000#U00000e*gdg0002c(F_0p00002 z1ONb60RR91000000002k(F_0p000021ONbc0ssI2000000002s(F_0p000021ONa? z00000000000002!(F_0p000021ONaa1poj5000000002+(F_0p000021ONb21poj5 z000000002^f6)v8000000t5g6dkFvl00000000000MZNq000000t5g65CH%H00000 z000002+|Ay000000t5g6jR61v00000000005Yh|)000000t5g6*a!ds0000000000 z7}5*?000000t5g6NdN!<0000000000Akqu~00000e*y#m07?J=000000000004UN7 z0000000IO6051ao000000000005H-F0000000IO605b&u0000000000065YN00000 z00IO608$13000000000006@|V0000000IO6015*D000000000007%jd0000000IO6 z0O1D!e*gdg00000002(hL9q ze*gdg0t5g6E(ibs0000000000sL~7o000000t5g6x&i0000000000$kGe|000000t5g6e@+7c00000000000MOD50000000IO60AL6J z00000000000NBzD0000000IO60EPkp00000000000N~OL0000000IO60Hg%~00000 z000000O-;T0000000IO601F8K00000000000PxZb0000000IO6022iO00000e*gdg z008*X3;+NC00066002w?00000000000002f3;+NC00066008U=0000000000000Qn z3;+NC00066001He0000000000000ov3;+NC00066002}30000000000000=%3;+NC z00066002z@0000000000001D<{9000000000;(+mIr00002e*^#kg$V!v z0000000000P}2+m000000t5g6ss#W50000000000Sknvu000000t5g6+y(#u00000 z00000VABi$000000t5g6PXGV_0000000000XwwV;000000t5g6nE?O*0000000000 zaMKI`000000t5g6FaiJoe*gdg000000C>|30000000IO60Kf$R00000000000D#jB z0000000IO60Ne-w00000000000Ep8J0000000IO60Ez?v00000000000FcuR00000 z00IO60L=#g00000000000GQJZ0000000IO603-zf0000000000e*mD<3;+NC00066 z005Z?0000000000005}d3;+NC00066008#^0000000000006Ml3;+NC00066006iK z0000000000006kt3;+NC00066003nL0000000000006+#3;+NC00066002}100000 z000000079-3;+NCe*gdi1ONca2mk;8000000002c(+mIr000021ONcz0{{R300000 z0002k(+mIr000021ONa*2LJ#7000000002s(+mIr000021ONc(2mk;8000000002! z(+mIr000021ONb12mk;8000000002+(+mIr000021ONd2e*pjh0000000000_|psk z000000t5g68wUUY00000000000MrZs000000t5g6mInX;00000000002-FM!00000 z0t5g6dIbOg00000000005Y!9+000000t5g6FbDtu00000000007}N{^000000t5g6 zGzkCz00000e*gdg03g&10000000IO600;;G000000000004UT90000000IO6096J6 z000000000005H@H0000000IO608jt`0000000000065eP0000000IO60Cold00000 z0000006^3X0000000IO6080n}000000000007%pfe*gdg00066005-|0000000000 z002Rs000021ONa#0ssI2000000001h)C>Rs00002 z1ONaK2mk;8000000001p)C>Rs000021ONco0ssI2000000001x)C>Rs000021ONc= z0RR91000000001()C>Rs000021ONaT0{{R3e*gdg00000pwtWi000000t5g6p925@ z0000000000sMHJq000000t5g6Q2+n{0000000000u+$6y000000t5g6B?15d00000 z00000xYP^)000000t5g6x&{CM0000000000z|;%?000000t5g6R0aS50000000000 zf5_Af0000000IO6038DW00000000000MOJ70000000IO606zi%00000000000NB(F z0000000IO60EPwt00000000000N~UN0000000IO608#(|00000000000O-^V00000 z00IO603Hbd00000000000Pxfd00000e*gjm002_}0000000000008*Z3;+NC00066 z000dM00000000000002h3;+NC00066002e-0000000000000Qp3;+NC00066002|~ z0000000000000ox3;+NC00066000mL0000000000000=(3;+NC00066002(|e*gdg z000000000W)eHat000021ONd00RR91000000000e)eHat000021ONcu1ONa400000 z0000m)eHat000021ONa#0RR91000000000u)eHat000021ONb400000000000000$ z)eHat000021ONb00ssI200000e*gdgNYxAg000000t5g6RsaA10000000000P}K|o z000000t5g6VgmpG0000000000Sk(*w000000t5g6!vX*R0000000000VATu&00000 z0t5g6R{#J20000000000Xw?h=000000t5g6SO5S30000000000aMcU|e*gdg00IO6 z0Q~|000000000000C?350000000IO60JQ=D00000000000D#pD0000000IO60JH=E z00000000000EpEL0000000IO60A&aO00000000000Fc!T0000000IO604oIm00000 z000000GQPb0000000IO6e*g^#0000000000005xX3;+NC00066002e?0000000000 z005}f3;+NC00066006%P0000000000006Mn3;+NC00066002!10000000000006kv z3;+NC00066001Zg0000000000006+%3;+NC00066001Hg00000e*gdg0002U)eHat z000021ONcq1ONa4000000002c)eHat000021ONb>2mk;8000000002k)eHat00002 z1ONd10RR91000000002s)eHat000021ONc-2LJ#7000000002!)eHat000021ONcN z0{{R3000000002+f7J{C000000t5g6SpWb40000000000_|*&m000000t5g6L;wP+00000000002-XY$000000t5g65C;GN00000 z000005Y`L;000000t5g6oCg2^00000000007}g8`00000e*y#m0E`C!0000000000 z03g;30000000IO604@mt000000000004UZB0000000IO600{&D000000000005H}J z0000000IO60O|n%0000000000065kR0000000IO60PzO^000000000006^9Z00000 z00IO60H*^0e*gdg00000002nV3;+NC00066009370000000000002<{9 z000000001Z)(iju000021ONc@1poj5000000001h)(iju000021ONc)1poj500000 z0001p)(iju000021ONas1^@s6000000001x)(iju000021ONbC1poj5000000001( z)(ijue*gdg0t5g6TmS$70000000000pwt<80000000000xYi5+00000 z0t5g6%?1Df0000000000z}5@^000000t5g6e^LVg00000000000La!10000000IO6 z03QPY00000000000MOP90000000IO60E7Vm00000000000NB<{9000000002!*9-sv000021ONbVe*^#k0000000000 z@Yf6g000000t5g6iv$1w0000000000_}2^o000000t5g6VgLXD00000000000N4xw z000000t5g6oCN>?00000000002-pk&000000t5g6_Xq$000000000005ZDX=00000 z0t5g66$StR00000e*gdg02tT|0000000IO607nM^000000000003g^50000000IO6 z0PO_;000000000004UfD0000000IO60Gb2<000000000005I4L0000000IO6051pt z0000000000065qT0000000IO60F?s(000000000006^Fbe*gdg00066001!p00000 z00000002nX3;+NC00066003hE0000000000002|100000000000MObD0000000IO6 z0Idc900000000000NC0L0000000IO601g8H00000000000N~mT0000000IO604N9m z00000e*gdg008LP3;+NC00066002w_0000000000008jX3;+NC00066003kI00000 z00000008*f3;+NC00066006oN00000000000002n3;+NC00066003A90000000000 z000Qv3;+NC00066001os0000000000000o%e+&Qs000021ONbo1ONa4000000000O z+YA5z000021ONbH1poj5000000000W+YA5z000021ONbU00000000000000e+YA5z z000021ONa&2><{9000000000m+YA5z000021ONcn1poj5000000000u+YA5z00002 ze*^#kKM4Q;0000000000K-&xe000000t5g6a|r+d0000000000NZSkm000000t5g6 zMF9W+0000000000P}>Xu000000t5g6nF9a-0000000000SlbK$000000t5g6r3L^1 z0000000000VA~7;000000t5g6cLV?ce*gdg000000BG9`0000000IO60678x00000 z000000C3w30000000IO60J8`H00000000000C?LB0000000IO60B`^R0000000000 z0D#*J0000000IO60P+L?00000000000EpWR0000000IO605b>x0000000000e*lo% z3;+NC00066003wM0000000000005ZV3;+NC00066009350000000000005xd3;+NC z00066005x|0000000000005}l3;+NC00066002k^0000000000006Mt3;+NC00066 z008|20000000000006k#3;+NCe*gdi1ONaz2><{9000000002M+YA5z000021ONc1 z2LJ#7000000002U+YA5z000021ONcB2mk;8000000002c+YA5z000021ONa`1ONa4 z000000002k+YA5z000021ONbX00000000000002s+YA5z000021ONaVe+B>m00000 z00000=-Uhc000000t5g6#0CHW0000000000@Y@Uk000000t5g6`vw320000000000 z_}dHs000000t5g6AOipZ00000000000Ne}!000000t5g6a{vGU00000000002;2++ z000000t5g6N&x@>00000e*gdg01(^^0000000IO60JsGJ000000000002tg100000 z00IO60LlRX000000000003h590000000IO60FDR%000000000004UrH0000000IO6 z0HOf^000000000005IGP0000000IO605%5z0000000000065$Xe*gdg00066001cm z0000000000002PT3;+NC00066005r?0000000000002nb3;+NC00066006oO00000 z00000002<{9e*gdg00000klYLa00000 z0t5g6b^rhX0000000000nA{8i000000t5g6-vj^v0000000000pxg`q000000t5g6 ziwOV#0000000000sN4(y000000t5g6ZU_JX0000000000u-ps)000000t5g6;s*c# z0000000000f4JNX0000000IO605b*v00000000000KnV~0000000IO60K^9X00000 z000000La`70000000IO60Llgc00000000000MOhF0000000IO604xRo0000000000 z0NC6N0000000IO60Hp^200000000000N~sV00000e*gjm008v`0000000000008LR z3;+NC00066003D70000000000008jZ3;+NC00066008d@0000000000008*h3;+NC z00066003bI00000000000002p3;+NC00066004IY0000000000000Qx3;+NC00066 z000&Pe*gdg000000000G-3$N#000021ONc@0ssI2000000000O-3$N#000021ONbu z0RR91000000000W-3$N#000021ONbd00000000000000e-3$N#000021ONb62LJ#7 z000000000m-3$N#000021ONcn0{{R300000e*gdgINb~Y000000t5g67YG0V00000 z00000K-~-g000000t5g6`vU*~0000000000NZkwo000000t5g6y9WRO0000000000 zP~8jw000000t5g6(+2I47)0000000000VBHJ= ze*gdg00IO60E`F#00000000000BGF|0000000IO60C58V00000000000C3$500000 z00IO60EPzu00000000000C?RD0000000IO60C@la00000000000D#>L0000000IO6 z038Sb00000000000EpcT0000000IO6e*n$|0000000000005BP3;+NC00066001uu z0000000000005ZX3;+NC00066002w~0000000000005xf3;+NC00066002J$00000 z00000005}n3;+NC00066001=u0000000000006Mv3;+NC00066006lH00000e*gdg z0002E-3$N#000021ONc%1^@s6000000002M-3$N#000021ONaF0{{R3000000002U z-3$N#000021ONbw1^@s6000000002c-3$N#000021ONbf00000000000002k-3$N# z000021ONc_1^@s6000000002sf87iK000000t5g63<&@L0000000000=-mte00000 z0t5g6>jwY;0000000000@ZAgm000000t5g6T?qgH0000000000_}vTu000000t5g6 z9|iyb00000000000NxA$000000t5g6djJ3c00000000002;K|;00000e*y#m0DJ%d z000000000001(~`0000000IO60DS-e000000000002tm30000000IO60AvCH00000 z0000003hBB0000000IO60Db@f000000000004UxJ0000000IO60Dk}g0000000000 z05IMR0000000IO606hi(e*gdg000000021N3;+NC00066002({0000000000002PV z3;+NC00066008?40000000000002nd3;+NC00066004Ue0000000000002<{9 z000000001p-V6W$e*gdg0t5g6o&x{?0000000000klqXc000000t5g6fdBvi00000 z00000nBEKk000000t5g6lK}t#0000000000pxz7s000000t5g6qy_*00000000000 zsNM_!000000t5g6cL)Fg0000000000u-*&+000000t5g6f7Jv400000000000Jz=^ z0000000IO60R9C400000000000Knc10000000IO60ObP!00000000000Lb1900000 z00IO60PF<-00000000000MOnH0000000IO60IUK400000000000NCCP0000000IO6 z0D=Gj00000e*gdg007|L3;+NC00066007wm0000000000008LT3;+NC00066004sk z0000000000008jb3;+NC00066000*P0000000000008*j3;+NC00066004&u00000 z000000002r3;+NC00066001cj0000000000000Qze+&Qs000021ONbD2LJ#700000 z0000G-wXf%000021ONbp00000000000000O-wXf%000021ONc51ONa4000000000W z-wXf%000021ONbM2><{9000000000e-wXf%000021ONaQ0RR91000000000m-wXf% z00002e*^#kS_uFE0000000000INuBa000000t5g6R09A20000000000K;H}i00000 z0t5g600#g70000000000NZ$+q000000t5g6-T?pr0000000000P~Qvy000000t5g6 zg#Z8m0000000000Slm z0000000000;NJ`Y000000t5g6=m!7*0000000000=-&(g000000t5g6(Fgzl00000 z00000@ZSso000000t5g669NDL0000000000_}>fw000000t5g6L<{9000000001B;0yo&000021ONbZ0{{R300000 z0001J;0yo&000021ONch1^@s6000000001R;0yo&000021ONcV2LJ#7000000001Z z;0yo&000021ONb<0ssI2000000001h;0yo&000021ONaQ0ssI2e*gdg00000h~NwW z000000t5g6E(QPq0000000000kl+je000000t5g6r~?210000000000nBWWm00000 z0t5g6^8o+=0000000000px_Ju000000t5g6$pQcX0000000000sNf6$000000t5g6 zI|u*(0000000000f3V;T0000000IO60Cfof00000000000Jz``0000000IO609ge9 z00000000000Kni30000000IO60Ez$r00000000000Lb7B0000000IO60OSY&00000 z000000MOtJ0000000IO60E++s00000000000NCIR00000e*gjm005>00000000000 z007|N3;+NC00066002%10000000000008LV3;+NC00066004{t0000000000008jd z3;+NC00066004~u0000000000008*l3;+NC00066005Q(00000000000002t3;+NC z00066002G&e*gdg0000000008;S2x(000021ONbd2mk;8000000000G;S2x(00002 z1ONbE1poj5000000000O;S2x(000021ONcw1ONa4000000000W;S2x(000021ONb% z0{{R3000000000e;S2x(000021ONb+1ONa400000e*gdgFyRaU000000t5g6djS9d z0000000000IN=Nc000000t5g6Tmb+80000000000K;aAk000000t5g6y8-|J00000 z00000NZ||s000000t5g6w+H|L0000000000P~i*!000000t5g6*$4mt0000000000 zSm6u+e*gdg00IO600jjA00000000000AS$^0000000IO60LBFX00000000000BGS1 z0000000IO60ImT500000000000C3?90000000IO60Nw=v00000000000C?dH00000 z00IO60FD3v00000000000D$2P0000000IO6e*l{S0000000000004;L3;+NC00066 z006ZF0000000000005BT3;+NC00066007wr0000000000005Zb3;+NC00066000sJ z0000000000005xj3;+NC00066002Y;0000000000005}r3;+NC00066002e=00000 ze*gdg00026;S2x(000021ONbq0ssI2000000002E;S2x(000021ONbP1ONa400000 z0002M;S2x(000021ONbM1poj5000000002U;S2x(000021ONcJ1ONa4000000002c z;S2x(000021ONbO1ONa4000000002kf8h)O000000t5g6(gXki0000000000;Nc7a z000000t5g6+5rFn0000000000=-~_i000000t5g6j{pDw0000000000@Zk&q00000 z0t5g6n+5;?0000000000_~8ry000000t5g6Xa)cP00000000000OAY)00000e*y#m z0HOl`000000000000`m?0000000IO60D%Jl000000000001)B~0000000IO602BxS z000000000002ty70000000IO60KEqQ000000000003hNF0000000IO60Fng&00000 z0000004U-N0000000IO60K@_Se*gdg00000001!J3;+NC000660058x0000000000 z0021R3;+NC00066006)Q0000000000002PZ3;+NC000660024$0000000000002nh z3;+NC00066000~Y0000000000002<{9000000001B;tT))000021ONaX2LJ#7000000001J;tT))00002 z1ONcm0ssI2000000001R;tT))000021ONcQ2mk;8000000001Z;tT))000021ONb$ z00000000000001h;tT))e*gdg0t5g6MFju=0000000000h~f+Y000000t5g6Py_$~ z0000000000km3vg000000t5g6k^lez0000000000nBoio000000t5g6fCK;l00000 z00000pyCVw000000t5g6BLe^c0000000000sNxI&000000t5g6f4B$$0000000000 z0I=c=0000000IO60Cxre00000000000J!1|0000000IO60Gt5;00000000000Kno5 z0000000IO60Lcdc00000000000LbDD0000000IO60G$B<00000000000MOzL00000 z00IO60Ja1G00000e*gdg007wH3;+NC00066003|W0000000000007|P3;+NC00066 z006iL0000000000008LX3;+NC00066000^W0000000000008jf3;+NC00066005E# z0000000000008*n3;+NC000660049W00000000000002ve+&Qs000021ONb&00000 z0000000008;|u@*000021ONbt2LJ#7000000000G;|u@*000021ONad1ONa400000 z0000O;|u@*000021ONcE2LJ#7000000000W;|u@*000021ONc01^@s6000000000e z;|u@*00002e*^#k%LV`d0000000000FyjmW000000t5g6Q3L=00000000000IO7Ze z000000t5g6R0RM40000000000K;sMm000000t5g6sR9510000000000NaG9u00000 z0t5g6t^@!80000000000P~!{$000000t5g6y9NLNe*gdg0000009fM;0000000IO6 z0Gk5<00000000000AS+`0000000IO60N@1x00000000000BGY30000000IO60C)ia z00000000000C3|B0000000IO60LBOa00000000000C?jJ0000000IO60F(d#00000 z00000e*l2v3;+NC00066004ag0000000000004;N3;+NC000660024%0000000000 z005BV3;+NC00066004vt0000000000005Zd3;+NC00066006fK0000000000005xl z3;+NC000660012c0000000000005}t3;+NCe*gdi1ONc&1^@s60000000026;|u@* z000021ONaR2LJ#7000000002E;|u@*000021ONc;1ONa4000000002M;|u@*00002 z1ONbs0RR91000000002U;|u@*000021ONb~1poj5000000002c;|u@*000021ONaE ze*^#k0000000000*y9WU000000t5g6)&T$j0000000000;NuJc000000t5g64+sDN z0000000000=;I6k000000t5g6!2h($00000 z00000_~Q%!000000t5g6Gywnr00000e*gdg0086+0000000IO60JZ`E0000000000 z00`s^0000000IO60M7;h000000000001)I10000000IO60MZ5k000000000002t&9 z0000000IO60QCd_000000000003hTH0000000IO60G0p%000000000004U@Pe*gdg z00066005T&0000000000001!L3;+NC00066001%r00000000000021T3;+NC00066 z003A80000000000002Pb3;+NC00066007Sc0000000000002nj3;+NC00066005u` z0000000000002*00000000000MO(N00000e*gjm002e<00000 z00000007wJ3;+NC00066005f+0000000000007|R3;+NC00066007Si0000000000 z008LZ3;+NC00066006`Y0000000000008jh3;+NC00066005l_0000000000008*p z3;+NC00066005i-e*gdg0000000000000000000000`y`0000000IO6 z0GbB?000000000001)O30000000IO604fOp000000000002t;B0000000IO608j=1 z000000000003hZJ0000000IO60I&f7e*gdg00000001cF3;+NC00066001Ha00000 z00000001!N3;+NC00066006}Z00000000000021V3;+NC00066001ij0000000000 z002Pd3;+NC000660027!0000000000002nl3;+NC00066008&_0000000000e*geb z<_rJ;000021ONb*1^@s60000000013<_rJ;000021ONaK2><{9000000001B<_rJ; z000021ONb80RR91000000001J<_rJ;000021ONc|1^@s6000000001R<_rJ;00002 z1ONbf1ONa4000000001Z<_rJ;e*gdg0t5g6W(5EM0000000000faVMU000000t5g6 z#{&QW0000000000h~^9c000000t5g6iUt4x0000000000kmd{k000000t5g6q5uE@ z0000000000nC1)s000000t5g6TL%CD0000000000pymt!000000t5g6e?SEQ00000 z000000I22+0000000IO605Amr00000000000I=o^0000000IO608s@10000000000 z0J!E10000000IO60NDos00000000000Kn!90000000IO60OGZ000000000003hfL ze*gdg00066005r^0000000000001cH3;+NC000660015b0000000000001!P3;+Ot z|9=1g000021ONc12mk;8000000000u=nMb=000021ONaI2LJ#7000000000$=nMb= z000021ONcV0{{R3000000000;=nMb=000021b+YkfC2yj0000000000Q0NQ*00000 z0t5g6f&u^l0000000000Sm+D@000000t5g6dI$gj0000000000VCW10000000t5g6 zCk6lj0000000000Xy^<8000000t5g6s09E30000000000aOeyG000000t5g6+W`Oo z0Dk}g000000C?yO0000000IO60IC2000000000000D$NW0000000IO604@gr00000 z000000Ep-e0000000IO607C)*00000000000FdYm0000000IO60J8-E0000000000 z0GQ|u0000000IO605J#v00000000000Dqw93;+NC00066004pr0000000000005}y z3;+NC00066006rP0000000000006M)3;+NC00066006oH0000000000006k?3;+NC z00066006510000000000006+~3;+NC00066003wO0000000000007A73;+NC0Dk}i z1ONa`1poj5000000002c=nMb=000021ONc600000000000002k=nMb=000021ONay z2><{9000000002s=nMb=000021ONbm2LJ#7000000002!=nMb=000021ONaO1poj5 z000000002+=nMb=000021ONc70Dk}g0000000000_~;A(000000t5g6e*^#k00000 z000000O000000t5g6uLA%800000000002000021ONa70ssI2000000001h=?nk>000021ONd21poj5000000001p z=?nk>000021ONbB0{{R3000000001x=?nk>000021ONaS0RR91000000001(=?nk> z000021ONcY1ONa40Dk}g00000py><%000000t5g690&ja0000000000sOby<00000 z0t5g6uK)l50000000000u;~l{000000t5g6S_A+90000000000xakZ4000000t5g6 z%?JPh0000000000!08MC000000t5g6umAu60000000000$bab!0000000IO607(M? z00000000000MO|S0000000IO6009U900000000000NCja0000000IO60Ad0F00000 z000000O08i0000000IO60DJ@h00000000000O;uq0000000IO60PO|<0000000000 z0PyJy000000Dl4m000vM0000000000008*u3;+NC00066001!s00000000000002$ z3;+NC00066002A%0000000000000Q;3;+NC00066004Og0000000000000o`3;+NC z000660068A0000000000000>33;+NC00066006N70Dk}g000000000W>I?t?00002 z1ONa41^@s6000000000e>I?t?000021ONc{0{{R3000000000m>I?t?000021ONbt z1ONa4000000000u>I?t?000021ONcm1ONa4000000000$>I?t?000021ONaL2><{9 z000000Dk}gNa_p#000000t5g6R0se70000000000Q0fc-000000t5g6VhI2M00000 z00000Sn3P_000000t5g6(*Xbg0000000000VCoD2000000t5g6`T+m{0000000000 zXzC0A000000t5g6rU3u|0000000000aOw;I0Dk}g00IO609FM600000000000C?&Q z0000000IO60I~-F00000000000D$TY0000000IO60LKOZ00000000000Ep@g00000 z00IO600IaA00000000000Fdeo0000000IO60I~o800000000000GR3w0000000IO6 z0Dr9o0000000000005xs3;+NC000660083z0000000000005}!3;+NC000660043X z0000000000006M+3;+NC000660049a0000000000006k^3;+NC000660006600000 z00000006-13;+NC00066002t|000000Dk}g0002U>I?t?000021ONam0{{R300000 z0002c>I?t?000021ONcD00000000000002k>I?t?000021ONcE00000000000002s z>I?t?000021ONbQ0ssI2000000002!>I?t?000021ONct0{{R3000000002+>VFIX z000000t5g62L%8C0000000000`05M*000000t5g6?gjt=00000000000P73@00000 z0t5g6j0OMz00000000002W0000000000003a?3;+NC00066008F&0000000000003y~3;+NC z00066007GY00000000000Dk~*>kI$@000021ONaD2mk;8000000001Z>kI$@00002 z1ONaU2><{9000000001h>kI$@000021ONcG00000000000001p>kI$@000021ONcJ z2mk;8000000001x>kI$@000021ONa*2><{9000000001(>kI$@0Dk}g0t5g62?YQE z0000000000pz90(000000t5g69s&RW0000000000sOt;>000000t5g6JOcm#00000 z00000u541WLs000021ONbJ1poj5000000000W>LI00000000000C?;S0000000IO60Gb5= z00000000000D$Za0000000IO60JH-D00000000000Ep}i0000000IO60F?v)00000 z000000Fdkq0000000IO603HPZ00000000000DqY53;+NC00066000vQ0000000000 z005xu3;+NC00066000;W0000000000005}$3;+NC00066001}$0000000000006M; z3;+NC00066005i>0000000000006k`3;+NC00066007Me0000000000006-33;+NC z0Dk}i1ONbk2mk;8000000002U>A000000t5g6tq1@B000000Dk}g z02u8I0000000IO60R9I6000000000003huQ0000000IO60E+_v000000000004VJY z0000000IO60KEVJ000000000005I(g0000000IO60A~aM0000000000066Uo00000 z00IO60Obe(000000000006^^w0Dk}g000660040X0000000000002ns3;+NC00066 z008|10000000000002(000000t5g6;{^Z! z0000000000Q0@!>000000t5g6z6JmQ0000000000Sndn}000000t5g6%me@c00000 z00000VD1b6000000t5g6rUw830000000000XzmOE0Dk}g00IO60KotN0000000000 z0C4UM0000000IO607wS_00000000000C?^U0000000IO60KxzO00000000000D$fc z0000000IO60Qv#|00000000000Eq4k0000000IO60K5kP00000000000Fdqs00000 z00IO60Dq1K0000000000005Zo3;+NC00066009330000000000005xw3;+NC00066 z007hh0000000000005}&3;+NC00066006@P0000000000006M=3;+NC00066003A4 z0000000000006k|3;+NC00066004;v000000Dk}g0002M?hF6`000021ONcU00000 z000000002U?hF6`000021ONar0RR91000000002c?hF6`000021ONam2mk;800000 z0002k?hF6`000021ONc70{{R3000000002s?hF6`000021ONcV00000000000002! z?tcsb000000t5g6Lj?c;0000000000@a_x%000000t5g6AprmY0000000000`0fk< z000000t5g69svLV00000000000PhR{000000t5g6L& z0000000000sP7B_000000t5g6I|Kj#0000000000u<{9000000000e@C*O|000021ONcb0000000000 z0000m@C*O|000021ONbK1^@s6000000000u@C*O|000021b+YkJO%&&0000000000 zK=2Fz000000t5g6%m4rY0000000000Nbn2*000000t5g6paK8@0000000000Q1A=@ z000000t5g6%>V!Z0000000000Snv!0000000t5g6&Hw-a0000000000VDJn800000 z0t5g6&j0`b0Dk}g000000BG000000t5g6AO-*c z00000000000Pzd}000000t5g6Q~>}000000000002=NR6000000t5g6WCQ>J00000 z0Dk}g01)vE0000000IO60Ez_w000000000002uKM0000000IO607VG^0000000000 z03h)U0000000IO609ye7000000000004VVc0000000IO60NMip000000000005I_k z0000000IO60LTRZ0000000000066gs0Dk}g00066001-x0000000000002Po3;+NC z00066006=T0000000000002nw3;+NC00066003AA0000000000002<&3;+NC00066 z005f^0000000000003C=3;+NC00066007ef0000000000003a|3;+NC000660Dk~m z0ssI2000000001J@eBX}000021ONc32mk;8000000001R@eBX}000021ONck00000 z000000001Z@eBX}000021ONcy1poj5000000001h@eBX}000021ONb&0{{R300000 z0001p@eBX}000021ONbi1^@s60Dk}g00000kns!v000000t5g6`Un630000000000 znDGn%000000t5g6*9QOq0000000000pz#a<000000t5g66$AhP0000000000sPPN{ z000000t5g6vjYGC0000000000u<;B4000000t5g6rv?B30000000000xPS2s00000 z00IO6044_j00000000000KoAK0000000IO60J;PK00000000000LbwS0000000IO6 z0HXl_00000000000MPLa0000000IO605<^u00000000000NC*i0000000IO60J{MI z00000000000O0Wq000000Dl4m002G)0000000000008Lm3;+NC00066001Ti00000 z00000008ju3;+NC00066004gn0000000000008*$3;+NC00066000FC0000000000 z0002;3;+NC000660027%0000000000000Q`3;+NC00066000~W0Dk}g000000000G z@(cg~000021ONbW0RR91000000000O@(cg~000021ONbU0RR91000000000W@(cg~ z000021ONd22LJ#7000000000e@(cg~000021ONcq0ssI2000000000m@(cg~00002 z1ONaz0{{R3000000Dk}gIPwet000000t5g6as>bY0000000000K=KR#000000t5g6 zIs^a!0000000000Nb(E-000000t5g6*8%_l0000000000Q1T1_000000t5g62?+oI z0000000000Sn>=2000000t5g6E&~7n0000000000VDbzA0Dk}g00IO60M!5h00000 z000000BG_I0000000IO6015~I00000000000C4gQ0000000IO60LTIW0000000000 z0C@5Y0000000IO60M-Bi00000000000D$rg0000000IO60Ji}E00000000000EqGo z0000000IO60Dr;=0000000000005Bk3;+NC00066008s^0000000000005Zs3;+NC z00066000C80000000000005x!3;+NC00066004Id0000000000005}+3;+NC00066 z007eh0000000000006M^3;+NC00066004jo000000Dk}g0002E@(cg~000021ONcg z2mk;8000000002M@(cg~000021ONcn00000000000002U@(cg~000021ONa>2><{9 z000000002c@(cg~000021ONbg1^@s6000000002k@(cg~000021ONbC0ssI200000 z0002s@_!5f000000t5g66axSN0000000000=<*Bz000000t5g6Tm=9C0000000000 z@bU}*000000t5g6mj?g<0000000000`0@+@000000t5g6uLl4C00000000000P_q0 z000000t5g6T>$_900000000002=fd8000000)GSm009R8000000000001)#G00000 z00IO603`?j000000000002uQO0000000IO60DTDn000000000003h=W0000000IO6 z0L=mb000000000004Vbe0000000IO60N4Nk000000000005J0m0000000IO6073%* z0Dk}g000000021i3;+NC00066006oL0000000000002Pq3;+NC00066002@100000 z00000002ny3;+NC00066007kk0000000000002<)3;+NC00066006iF0000000000 z003C?3;+NC00066006uO00000000000Dk~r^9%q0000021ONbx0ssI2000000001J z^9%q0000021ONaT0ssI2000000001R^9%q0000021ONcp00000000000001Z^9%q0 z000021ONcT2mk;8000000001h^9%q0000021ONap1^@s6000000001p^9%q00Dk}g z0t5g60s{a50000000000kn;=x000000t5g6)dc_m0000000000nDYz(000000t5g6 zjRF7w0000000000pz{m>000000t5g6*#!Uq0000000000sPhZ}000000t5g6c?kdj z0000000000u=5N6000000t5g6+J68500000000000J!rE0000000IO60P6(+00000 z000000KoGM0000000IO60MrEl00000000000Lb$U0000000IO60NVfn0000000000 z0MPRc0000000IO60B{2U00000000000NC>k0000000IO60QLd^000000Dk}g007|g z3;+NC00066002V=0000000000008Lo3;+NC00066004~x0000000000008jw3;+NC z00066002P&0000000000008*&3;+NC00066008_500000000000002=3;+NC00066 z007(o0000000000000Q|41WLs000021ONcS0RR91000000000G^b7z1000021ONa} z2mk;8000000000O^b7z1000021ONaj0{{R3000000000W^b7z1000021ONct00000 z000000000e^b7z1000021ONaQ1^@s6000000000m^b7z1000021b+Ykg9ZQq00000 z00000IP?qv000000t5g6Ne2J`0000000000K=cd%000000t5g6Bm)2d0000000000 zNc0Q<000000t5g6j0FGy0000000000Q1lD{000000t5g6Kn4H+0000000000So914 z000000t5g6G6ett0Dk}g000000ATbC0000000IO60Dc7k00000000000BH0K00000 z00IO60Nwxq00000000000C4mS0000000IO60N(%r00000000000C@Ba0000000IO6 z07(e|00000000000D$xi0000000IO6000R900000000000Dp+|3;+NC00066002S= z0000000000005Bm3;+NC00066006QC0000000000005Zu3;+NC00066002(}00000 z00000005x$3;+NC00066008F!0000000000005};3;+NC00066003bK0000000000 z006M`3;+NC0Dk}i1ONaL2mk;8000000002E^b7z1000021ONa90ssI2000000002M z^b7z1000021ONbb2><{9000000002U^b7z1000021ONc$1ONa4000000002c^b7z1 z000021ONc`1poj5000000002k^b7z1000021ONb+1AhPj0000000000;Peat00000 z0t5g6umb=90000000000==2N#000000t5g6GYJ3y0000000000@bnA-000000t5g6 z@&^C_0000000000`1A|_000000t5g6-~a#s00000000000QC$2000000t5g6vIqbG z000000Dk}g00{LA0000000IO60Q(03000000000001)*I0000000IO605<~w00000 z0000002uWQ0000000IO604)Ll000000000003h`Y0000000IO604xar0000000000 z04Vhg0000000IO60Lusf000000000005J6o0Dk}g00066008a?00000000000021k z3;+NC00066006NC0000000000002Ps3;+NC00066003tK0000000000002n!3;+NC z00066008j@0000000000002<+3;+NC00066002-20000000000003C^3;+NC00066 z0Dl0E2LJ#7000000001B^$Y+2000021ONc>2mk;8000000001J^$Y+2000021ONct z1^@s6000000001R^$Y+2000021ONc20ssI2000000001Z^$Y+2000021ONaF2LJ#7 z000000001h^$Y+2000021ONao0ssI20Dk}g00000i1iEr000000t5g6BLM&a00000 z00000ko61z000000t5g6=>Y%$0000000000nDq<*000000t5g6OaTA@0000000000 zp!Ey@000000t5g6JqG{)0000000000sPzm0000000t5g6N(BG_0000000000uz&Ro z0000000IO609FD300000000000J!xG0000000IO60Hgx|00000000000KoMO00000 z00IO60FMFy00000000000Lb+W0000000IO607wM@00000000000MPXe0000000IO6 z03`ze00000000000NC{m000000Dl4m0055$0000000000007|i3;+NC00066007Aa z0000000000008Lq3;+NC00066000pM0000000000008jy3;+NC00066003?T00000 z00000008*)3;+NC000660083#00000000000002?3;+NC00066006E90Dk}g00000 z00008_6z_3000021ONcx00000000000000G_6z_3000021ONbw0RR91000000000O z_6z_3000021ONbq0RR91000000000W_6z_3000021ONc^0{{R3000000000e_6z_3 z000021ONa*1^@s6000000Dk}gF!l@p000000t5g6;s5{u0000000000IQ9$x00000 z0t5g6Hv#|v0000000000K=up(000000t5g6(E$Je0000000000NcIc>000000t5g6 z;{X5v0000000000Q1%P}000000t5g65C#AM0000000000SoRD60Dk}g00IO609XP5 z00000000000AThE0000000IO60A2wA00000000000BH6M0000000IO60K)+Q00000 z000000C4sU0000000IO60OSAw00000000000C@Hc0000000IO6000F50000000000 z0D$%k0000000IO60Dt8G0000000000004;g3;+NC00066005E*0000000000005Bo z3;+NC00066007|x0000000000005Zw3;+NC00066003740000000000005x&3;+NC z00066000ID0000000000005}=3;+NC00066008Cy000000Dk}g00026_6z_300002 z1ONc>0{{R3000000002E_6z_3000021ONcW0{{R3000000002M_6z_3000021ONbu z2mk;8000000002U_6z_3000021ONa62LJ#7000000002c_6z_3000021ONbd0ssI2 z000000002k_J0fj000000t5g6=Kufz0000000000;Pwmv000000t5g6h6n%v00000 z00000==KZ%000000t5g6gb4ru0000000000@b(M<000000t5g6@&f<>0000000000 z`1T9{000000t5g6+6Mpt00000000000QU?4000000)GSm03ZYa000000000000{RC z0000000IO6022lP000000000001)>K0000000IO60O$Y!000000000002ucS00000 z00IO60KNwR000000000003i1a0000000IO60HXx}000000000004Vni0000000IO6 z0L}sc0Dk}g00000001!e3;+NC000660062600000000000021m3;+NC00066008R% z0000000000002Pu3;+NC00066007Gb0000000000002n$3;+NC000660009A00000 z00000002<;3;+NC00066003nI00000000000Dk~j_Y434000021ONcQ0RR9100000 z0001B_Y434000021ONaE1poj5000000001J_Y434000021ONab2><{9000000001R z_Y434000021ONbv0RR91000000001Z_Y434000021ONbP2mk;8000000001h_Y434 z0Dk}g0t5g6w*&wH0000000000i1!Qt000000t5g6>;M1&0000000000koOD#00000 z0t5g6?EnA(0000000000nD-0-000000t5g6ZU+DW0000000000p!W;_000000t5g6 zh64Zq0000000000sP_y2000000t5g6_HA0000000IO60Fws* z00000000000J!%I0000000IO60L%dZ00000000000KoSQ0000000IO60FeOz00000 z000000Lb?Y0000000IO60PX+)00000000000MPdg0000000IO60OSV%000000Dk}g z007wc3;+NC00066006)O0000000000007|k3;+NC00066007Sf0000000000008Ls z3;+NC00066000jL0000000000008j!3;+NC00066000370000000000008*+3;+NC z00066000OH00000000000002^41WLs000021ONcs1ONa40000000008_zVC500002 z1ONa61^@s6000000000G_zVC5000021ONac0RR91000000000O_zVC5000021ONb8 z1ONa4000000000W_zVC5000021ONc=00000000000000e_zVC5000021b+Yk8vy_S z0000000000F!&4r000000t5g67zqFX0000000000IQR?z000000t5g6@c;k-00000 z00000K==#*000000t5g6J_i5*0000000000Ncao@000000t5g6W&!{J0000000000 zQ1}c0000000t5g6#R32T0Dk}g0000009g180000000IO600II400000000000ATnG z0000000IO601F5J00000000000BHCO0000000IO608jz|00000000000C4yW00000 z00IO60F?y*00000000000C@Ne0000000IO60IUW800000000000Dpk^3;+NC00066 z0027&0000000000004;i3;+NC00066008m`0000000000005Bq3;+NC00066002<| z0000000000005Zy3;+NC00066008m;0000000000005x)3;+NC00066007|v00000 z00000005}?3;+NC0Dk}i1ONb_0{{R30000000026_zVC5000021ONc02mk;800000 z0002E_zVC5000021ONaG2mk;8000000002M_zVC5000021ONaM0ssI2000000002U z_zVC5000021ONbj2mk;8000000002c_zVC5000021ONb22Y&zn0000000000*!T

000000t5g6E&%`l0000000000`1lL}000000t5g6 z*9ZUr000000Dk}g008+60000000IO60P_F<000000000000{XE0000000IO60Q3L= z000000000001){M0000000IO606_%+000000000002uiU0000000IO60EYtr00000 z0000003i7c0000000IO60DA}k000000000004Vtk0Dk}g00066007+w0000000000 z001!g3;+NC00066000~T00000000000021o3;+NC00066000vK0000000000002Pw z3;+NC00066003YK0000000000002n&3;+NC00066008v>0000000000002<=3;+NC z000660Dl1X000000000000013`3wL6000021ONbQ2LJ#7000000001B`3wL600002 z1ONc}0{{R3000000001J`3wL6000021ONcM0RR91000000001R`3wL6000021ONaT z1poj5000000001Z`3wL6000021ONai1ONa40Dk}g00000fcXpn000000t5g6?gsz> z0000000000i1`cv000000t5g6%LM=c0000000000kogP%000000t5g6<_G`)00000 z00000nE4C<000000t5g6_W%F@0000000000p!o~{000000t5g6(g*+m0000000000 zsDJqk0000000IO60J{YM00000000000I>NC0000000IO60ICB300000000000J!-K z0000000IO602BrQ00000000000KoYS0000000IO60AK7>-00000 z0t5g6`2YX_0000000000Ncs!_000000t5g6j06Ax0000000000Q2Go20Dk}g00IO6 z0DuVq000000000009g7A0000000IO60HOo{00000000000ATtI0000000IO60Eh(u z00000000000BHIQ0000000IO60M!8i00000000000C4&Y0000000IO60E7Yn00000 z000000C@Tg0000000IO60Dp=C0000000000004mc3;+NC00066008;`0000000000 z004;k3;+NC00066003?Y0000000000005Bs3;+NC00066003+U0000000000005Z! z3;+NC00066001Qk0000000000005x+3;+NC00066007AY000000Dk}g0001}`V0U7 z000021ONah1poj50000000026`V0U7000021ONc(1poj5000000002E`V0U700002 z1ONcE1poj5000000002M`V0U7000021ONbR0{{R3000000002U`V0U7000021ONd0 z00000000000002c`hN@n000000t5g6E(HJp0000000000*!m0r000000t5g6r3e53 z0000000000;Q9;z000000t5g6eFy*m0000000000==ux*000000t5g6`~Uy|00000 z00000@cIk@000000t5g6ssR810000000000`1%Y0000000)GSm06+%-0000000000 z008?80000000IO60B`{S000000000000{dG0000000IO607eJ^000000000001*2O z0000000IO60CENZ000000000002uoW0000000IO60E7kr000000000003iDe00000 z00IO601W~F0Dk}g00000001ca3;+NC00066004Ug0000000000001!i3;+NC00066 z0070{{R3000000001Z z`wRd80Dk}g0t5g6aRdMW0000000000fcp#p000000t5g6VFdsH0000000000i2Dox z000000t5g6eFp#l0000000000koyb(000000t5g6odN&=0000000000nEMO>00000 z0t5g6iU$Ay0000000000p!*B}000000t5g6y?+J(00000000000I2&60000000IO6 z0003100000000000I>TE0000000IO60IC8200000000000J!@M0000000IO60ObS# z00000000000KoeU0000000IO60Eq+u00000000000Lc3c0000000IO60099200000 z0Dk}g007YY3;+NC00066005~40000000000007wg3;+NC00066001ln0000000000 z007|o3;+NC00066002h?0000000000008Lw3;+NC00066000I90000000000008j& z3;+NC00066007tn0000000000008*=41WLs000021ONa70RR910000000000{0sm9 z000021ONa}0RR910000000008{0sm9000021ONaS1^@s6000000000G{0sm900002 z1ONcg1ONa4000000000O{0sm9000021ONad2><{9000000000W{0sm9000021b+Yk z&IJGf0000000000DEtfn000000t5g6KnMT;0000000000F#HSv000000t5g6&IkYi z0000000000IQ$F%000000t5g61OWg50000000000K>Q2<000000t5g6z61aO00000 z00000Nc;={000000t5g6c?SRh0Dk}g0000008so40000000IO600ssC0000000000 z09gDC0000000IO606Yi)00000000000ATzK0000000IO6038GX00000000000BHOS z0000000IO60GkH@00000000000C4;a0000000IO60DK7m00000000000DpM=3;+NC z00066005x~0000000000004me3;+NC00066008j?0000000000004;m3;+NC00066 z000I70000000000005Bu3;+NC00066004Rk0000000000005Z$3;+NC00066003DC z0000000000005x;3;+NC0Dk}i1ONc!1^@s6000000001}{0sm9000021ONc}2LJ#7 z0000000026{0sm9000021ONcr2mk;8000000002E{0sm9000021ONaB0RR9100000 z0002M{0sm9000021ONag0ssI2000000002U{0sm9000021ONba0e=7h0000000000 z(EJPl000000t5g61p@#80000000000*!&Ct000000t5g6+Xest0000000000;QR~# z000000t5g6OacG^0000000000===--000000t5g6asmJV0000000000@caw_00000 z0t5g683+IX000000Dk}g0Qme20000000IO60C@rc0000000000008|A0000000IO6 z0Er0z000000000000{jI0000000IO600;p9000000000001*8Q0000000IO60OJS% z000000000002uuY0000000IO604f6j000000000003iJg0Dk}g00066006fF00000 z00000001cc3;+NC00066006520000000000001!k3;+NC00066007Ad0000000000 z0021s3;+NC00066000&T0000000000002P!3;+NC00066007N3j000000t5g6 zlL7z$0000000000fc*>r000000t5g6u>k-80000000000i2V!z000000t5g6cm)6e z0000000000ko^n*000000t5g65(fYP0000000000nEea@000000t5g63IPBB00000 z00000pnv@g0000000IO601E*C00000000000I2;80000000IO603`(g0000000000 z0I>ZG0000000IO608s}300000000000J!}O0000000IO603iba00000000000KokW z0000000IO60E!6!00000000000Lc9e000000Dl4m000aD0000000000007Ya3;+NC z00066000dE0000000000007wi3;+NC00066001xp0000000000007|q3;+NC00066 z006iI0000000000008Ly3;+NC00066001un0000000000008j)3;+NC00066000^S z0Dk}g000000002^{R{vA000021ONco2LJ#70000000000{tN&B000021ONaI0RR91 z0000000008{tN&B000021ONbw0ssI2000000000G{tN&B000021ONb@0RR9100000 z0000O{tN&B000021ONaZ2><{9000000Dk}gApQ&h000000t5g6#smNW0000000000 zDEiE>000000t5g6M*;u<0000000000Nd61}0Dk}g z00IO602%`T000000000008su60000000IO60Pq9=000000000009gJE0000000IO6 z0BZ;U00000000000AT(M0000000IO60FeX$00000000000BHUU0000000IO609pe8 z00000000000C4^c0000000#sB04^j30000000000004mg3;+NC000LB002$_00000 z00000008}azp4EL0FkmDmugT18-D`;@DZ9o`4GYckstye)*m1P)gK@O)gK@O)vyBq z@DZLs`4Hj+kstye*02Kr@DZXw`49pHkstye*02Kr@DZj!`4A!nkstye*02Kr@DZv& z`4B<{kstye*02Kr@DZ*+`4D0Skstye*02Kr@DZ{=`4EBykstye*02Kr@P84uK=}}& z1(6^EAJ(t~0PqpIK=}~D1(6^EAJ(t~0PqpMK=}~j1(6^EAJ(t~0PqpQK=}{?29Y2F zAJ(t~0PqpUK=}|N29Y2FAJ(t~0PqpYK=}|t29Y2FAJ(t~0PqpcK=}}229Y2FAJ(t~ z0PqpgK=}}Y29Y2FAJ(t~0Dtfi)f;s%i*0w30}0|4+5;z0Qj0tb;G0w30}0|4+5=0N!nA_tKm0w30}0|4+5>OlDr zLI;r`0w30}0|4+5?m+nvVh52R0w30}0|4+5@<90zf(MZx0w30}1AhSU5%xg&5TXZ> zAOauOumb?_5&A&+5W)wMAOauOumb?_5&l5=5aI`sAOauOumb?_5duN^5CRC1AOauO zumb?_5e7l|5F!YXAOauOumb?_5eh;15JCu%AOauOumb?_5e`B55Ml_CAOauOumb?_ z5fVZ95P}GiAOauOuzv#p@DUb4`4FNAkstye*02Kr@DUn8`4GYgkstye*02Kr@DUzC z`4Hj=kstye*02Kr@DU`4EB)k$)fpAJ(t~0PqpELHQ7(4Ur%MAJ(t~ z0PqpILHQ8E4Ur%MAJ(t~0PqpMLHQ8k4Ur%MAJ(t~0PqpQLHQ5@4v`=NAJ(t~0PqpU zLHQ6O4v`=NAJ(t~0PqpYLHQ6u4v`=NAJ(t~0PqpcLHQ734v`=NAJ(t~0PqpgLHQ7Z z4u6p#0w30}0|4+5)OuJsLJyH30w30} z0|4+5?m_twVh@oZ0w30}0|4+5@5aJJ!AOauOumb?_5duQ_5CRa9AOauOumb?_5e7o} z5F!wfAOauOumb?_5eh>25JC`40uzxS0w30}0|4+5Wkstye z*02Kr@DY|m`4FNMkstye*02Kr@DZ9q`4GYskstye*02Kr@DZLu`4Hk1kstye*02Kr z@DZXy`49pXkstye*02Kr@DZj$`4A!%kstye*02Kr@DZv)`4B=Ckstye*02Kr@DZ*; z`4D0ikstye*02Kr@P84qLirGa6_FqUAJ(t~0PqpELirG)6_FqUAJ(t~0PqpILirHF z6_FqUAJ(t~0PqpMLirHl6_FqUAJ(t~0PqpQLirE^7LgzVAJ(t~0PqpULirFP7LgzV zAJ(t~0PqpYLirFv7LgzVAJ(t~0PqpcLirG47LgzVAJ(t~0Dtfi(n9$Vf)O%PtLKl%B0w30}0|4+5?n3zx zVi%Dh0w30}1AhSU5%NO$5P}zxAOauOumb?_5%xm)5TX~6AOauOumb?_5&A;;5W*Lc zAOauOumb?_5&lB?5aJh+AOauOumb?_5duT`5CRyHAOauOumb?_5e7r~5F!|nAOauO zumb?_5eh^35JDJ{AOauOumb?_5e`H75MmgSAOauOuzv#p@DUP2`4EB_kstye*02Kr z@DUb6`4FNQkstye*02Kr&=DF#`4GYwkstye*02Kr&=DR(`4Hk5kstye*02Kr&=Dd- z`49pbkstye*02Kr&=Dp>`4A!*kstye*02Kr&=D#_`4B=Gkstye*02Kr&=D>}`4D0m zkstye)_<@A0MHRKL-`Pb8Id3YAJ(t~0MHROL-`P*8Id3YAJ(t~0MHRSL-`QG8Id3Y zAJ(t~0MHRWL-`Qm8Id3YAJ(t~0MHRaL-`N_8j&CZAJ(t~0MHReL-`OQ8j&CZAJ(t~ z0MHRiL-`Ow8j&CZAJ(t~0MHRmL-`P58j&CZAAi=c0|3wwQbYL=f*O$^0w30}0|3ww zRzvv^q8gDP0w30}0|3wwT0{8|!Wxkv0w30}0|3wwUPJj1;u?`40w30}0|3wwVng{5 z0vnMa0w30}0|3wwW<&W9A{&t)0w30}0|3wwYD4)DLK~4F0w30}0|3wwZbSJHVjGbl z0)HRYumb?l5pqNM5P}<#AOauOumb?l5q3lQ5TYBAAOauOumb?l5qd-U5W*XgAOauO zumb?l5q?AY5aJt=AOauOumb?l5rRYc5CR;LAOauOumb?l5r#wg5F#9rAOauOumb?l z5sE|k5JDW0AOauOumb?l5spLo5MmsWAb$cM*02Kr&=HbD`4EB}kstye*02Kr&=HnH z`4FNUkstye*02Kr&=HzL`4GY!kstye*02Kr&=HL-`Qm9g!dcAJ(t~0MHS_L-`N_9+4mdAJ(t~0MHS}L-`OQ9+4mdAJ(t~0MHT2 zL-`Ow9+4mdAJ(t~0MHT6L-`P59)FP_0w30}0|3ww(nI+Wf*z3|0w30}0|3ww)O=VuLLZSJ0w30}0|3ww?nC(yVt*fzAOauO zumb?l5%NR%5P~0(AOauOumb?l5%xp*5TYNEAOauOumb?l5&A><5W*jkAOauOumb?l z5&lE@5aJ(^AOauOumb?l5duW{5CR~PAOauOumb?l5e7v05F#LvAOauOumb?l5eh{4 z5JDi4AOauOumb?l5e`K85PxDIkstye*02Kr&=C?u`4EC2kstye*02Kr&=D3y`4FNY zkstye*02Kr&=DF$`4GY&kstye*02Kr&=DR)`4HkDkstye*02Kr&=Dd;`49pjkstye z*02Kr&=Dp?`4A!@kstye*02Kr&=D#``4B=Okstye*02Kr&=D>~`F{{%A(0>gAJ(t~ z0MHRKMEMYcA(0>gAJ(t~0MHROMEMY+A(0>gAJ(t~0MHRSMEMZHA(0>gAJ(t~0MHRW zMEMZnA(0>gAJ(t~0MHRaMEMW`B9R~hAJ(t~0MHReMEMXRB9R~hAJ(t~0MHRiMEMXx zB9R~hAJ(t~0MHRmM1T1ZVj__s0w30}0|3wwQbhR>f+CS10w30}0|3wwRz&#_q9TzX z0w30}0|3wwT15E}!Xl9%0w30}0|3wwUPSp2;v$hC0w30}0|3wwVnq260wa+i0w30} z0|3wwW<>cAA|sI?0w30}0|3wwYDD=ELL-qN0w30}0|3wwZhu7i5Mm>dAOauOumb?l z5pqQN5P~C-AOauOumb?l5q3oR5TYZIAOauOumb?l5qd=V5W*voAOauOumb?l5q?DZ z5aJ_|AOauOumb?l5rRbd5CSBTAOauOumb?l5r#zh5F#XzAOauOumb?l5sF0l5JDu8 zAOauOumb?l5r2+E`4D0xkstye*02Kr&=HbE`4EC6kstye*02Kr&=HnI`4FNckstye z*02Kr&=HzM`4GY+kstye*02Kr&=HuGMEMY6C6OQkAJ(t~0MHS# zMEMYcC6OQkAJ(t~0MHS(MEMY+C6OQkAJ(t~0MHS-MEMZHC6OQkAJ(t~0MHS>MEMZn zC6OQkAJ(t~0MHS_MEMW`CXpZlAJ(t~0MHS}MEMXRCXpZlAJ(t~0MHT2MEMXxCXpZl zAJ(t~0DsUC&P4eTVkVIw0w30}0|3ww(nR?Xf+mq50w30}0|3ww)O}bvLMM?R0w30}1AhR}5$;6!5Mn2hAOauOumb?l5%NU& z5P~O>AOauOumb?l5%xs+5TYlMAOauOumb?l5&A^=5W**sAOauOumb?l5&lH^5aK71 zAOauOumb?l5duZ|5CSNXAOauOumb?l5e7y15F#j%AOauOumb?l5eh~55JD)CAOauO zuzv#p&=C$r`4D0#kstye*02Kr&=C?v`4ECAkstye*02Kr&=D3z`4FNgkstye*02Kr z&=DF%`4GY=kstye*02Kr&=DR*`4HkLkstye*02Kr&=Dd<`49prkstye*02Kr&=Dp@ z`4A#0kstye*02Kr&=D#{`4B=Wkstye)_<@A0MHRGMfnh7DUl!oAJ(t~0MHRKMfnhd zDUl!oAJ(t~0MHROMfnh-DUl!oAJ(t~0MHRSMfniIDUl!oAJ(t~0MHRWMfnioDUl!o zAJ(t~0MHRaMfnf{Dv=-pAJ(t~0MHReMfngSDv=-pAJ(t~0MHRiMfngyDv=-pAAi=c z0|3wwPDS|;Vk(g!0w30}0|3wwQbqX?f+~?90w30}0|3wwRz>*`qAHOf0w30}0|3ww zT1EK~!YYv<0w30}0|3wwUPbv3;wq6K0w30}0|3wwVnz870xOXq0w30}0|3wwW<~iB zA}f&~0w30}0|3wwYDM`FLMxFV0)HRYumb?l5pG5K5MnElAOauOumb?l5pqTO5P~a_ zAOauOumb?l5q3rS5TYxQAOauOumb?l5qd@W5W*{wAOauOumb?l5q?Ga5aKJ5AOauO zumb?l5rRee5CSZbAOauOumb?l5r#$i5F#v*AOauOumb?l5sF3m5JD`GAb$cM*02Kr z&=HPB`4D0(kstye*02Kr&=HbF`4ECEkstye*02Kr&=HnJ`4FNkkstye*02Kr&=HzN z`4GY^kstye*02Kr&=HMfnioEs-DsAJ(t~ z0MHS_Mfnf{E|DMtAJ(t~0MHS}MfngSE|DMtAJ(t~0MHT2MfngyE`O0A0w30}0|3ww z&PDkUVlI&&0w30}0|3ww(na|Yf-aFD0w30}0|3ww)P7hwLVqujAOauOumb?l5$;9#5MnQpAOauOumb?l5%NX(5P~m}AOauO zumb?l5%xv-5TY-UAOauOumb?l5&A{>5W+8!AOauOumb?l5&lK_5aKV9AOauOumb?l z5duc}5CSlfAOauOumb?l5e7#25F#*{qB4;n0w30}0|3wwT1NR0!ZMK{ z0w30}0|3wwUPk#4;xdsS0w30}0|3wwVn+E80yB{y0w30}0|3wwW=8oCA~TU70w30} z0|3wwYJW!g5JEGNAOauOumb?l5pG8L5MnctAOauOumb?l5pqWP5P~z2AOauOumb?l z5q3uT5TY}YAOauOumb?l5qd`X5W+K&AOauOumb?l5q?Jb5aKhDAOauOumb?l5rRhf z5CSxjAOauOumb?l5r#(j5F#{@AOauOumb?l5r2wC`4B=hkstye*02Kr&=HPC`4D0> zkstye*02Kr&=HbG`4ECMkstye*02Kr&=HnK`4FNskstye*02Kr&=HzO`4GZ1kstye z*02Kr&=HuCM)?pzHIX0!AJ(t~0MHSxM)?q8HIX0!AJ(t~0MHS#M)?qeHIX0!AJ(t~0MHS( zM)?q;HIX0!AJ(t~0MHS-M)?rJHIX0!AJ(t~0MHS>M)?rpHIX0!AJ(t~0MHS_M)?o| zHjy9#AJ(t~0MHS}M)?pTHjy9#AJ(t~0DsUC%0~GRLN<{g0w30}0|3ww&PMqVVm6T= z0w30}0|3ww(nk3Zf;N#L0w30}0|3ww)<*ddqBfBr0w30}0|3ww+D7>h!Zwj00w30} z0|3ww-bVQl;x>^W0w30}0|3ww;zs!p0ymK$0w30}0|3ww=0^DtA~%sB0w30}1AhR} z5$Z7kstye*02Kr&=Cqi`4Bh0w30}0|3wwN0w30}0|3wwPC)q(VgivM0w30}0|3wwQb73- zf&!5s0w30}0|3wwRzUd>q5_d10w30}0|3wwT0r>_!UB;X0w30}0|3wwUO@Q};sTK% z0w30}0|3wwVnF#20t1mC0w30}0|3wwW`98W5F!JSAOauOumb?l5o$pB5JCfyAOauO zumb?l5pF>F5Ml$7AOauOumb?l5pqEJ5P}1dAOauOumb?l5q3cN5TXN-AOauOumb?l z5qd!R5W)kIAOauOumb?l5q?1V5aI)oAOauOumb?l5rRPZ5CQ~|AOauOumb?l5r2k2 z`4A!mkstye*02Kr&=HD2`4B<`kstye*02Kr&=HP6`4D0Rkstye*02Kr&=HbA`4EBx zkstye*02Kr&=HnE`4FN6kstye*02Kr&=HzI`4GYckstye*02Kr&=Hu8K=}|N1(6^EAJ(t~0MHStK=}|t1(6^EAJ(t~ z0MHSxK=}}21(6^EAJ(t~0MHS#K=}}Y1(6^EAJ(t~0MHS(K=}}&1(6^EAJ(t~0MHS- zK=}~D1(6^EAJ(t~0MHS>K=}~j1(6^EAJ(t~0MHS_K=}{?29Y2FAJ(t~0DsUC#z6TH zA_kEl0w30}0|3ww%0T%LLI#l_0w30}0|3ww&OrGPVg`{Q0w30}0|3ww(m?qTf(DTw z0w30}0|3ww)f;s%i*0w30} z0|3ww;z0Qj0tb;G0w30}1AhR}5#~Vo5F!VWAOauOumb?l5$Zts5JCr$AOauOumb?l z5$-_w5Ml?BAOauOumb?l5%NI!5P}DhAOauOumb?l5%xg&5TXZ>AOauOumb?l5&A&+ z5W)wMAOauOumb?l5&l5=5aI`sAOauOumb?l5duN^5CRC1AOauOuzv#p&=Cef`4A!q zkstye*02Kr&=Cqj`4B<~kstye*02Kr&=C$n`4D0Vkstye*02Kr&=C?r`4EB#kstye z*02Kr&=D3v`4FNAkstye*02Kr&=DFz`4GYgkstye*02Kr&=DR%`4Hj=kstye*02Kr z&=Dd*`49pLkstye)_<@A0MHR8LHQ6O36UTIAJ(t~0MHRCLHQ6u36UTIAJ(t~0MHRG zLHQ7336UTIAJ(t~0MHRKLHQ7Z36UTIAJ(t~0MHROLHQ7(36UTIAJ(t~0MHRSLHQ8E z36UTIAJ(t~0MHRWLHQ8k36UTIAJ(t~0MHRaLHQ5@3XvcJAAi=c0|3wwMnU-yA_|cp z0w30}0|3wwNLHQ8k4Ur%MAJ(t~0MHS_LHQ5@4u6p#0w30}0|3ww#zFZIA`X!t0w30} z0|3ww%0c-MLJpB20w30}0|3ww&O!MQVh)iY0w30}0|3ww(n0wUf)0@&0w30}0|3ww z)5aJJ!AOauOumb?l5duQ_5Pt#?kstye*02Kr&=Ceg`4A!ykstye*02Kr z&=Cqk`4B=7kstye*02Kr&=C$o`4D0dkstye*02Kr&=C?s`4EB-kstye*02Kr&=D3w z`4FNIkstye*02Kr&=DF!`4GYokstye*02Kr&=DR&`4Hj|kstye*02Kr&=Dd+`F{`s z5s@GQAJ(t~0MHR8LirFP5s@GQAJ(t~0MHRCLirFv5s@GQAJ(t~0MHRGLirG45s@GQ zAJ(t~0MHRKLirGa5s@GQAJ(t~0MHROLirG)5s@GQAJ(t~0MHRSLirHF5s@GQAJ(t~ z0MHRWLirHl5s@GQAJ(t~0MHRaLVx)X0uqrR0w30}0|3wwMnd@zA`+1x0w30}0|3ww zN<#S%LK2Z60w30}0|3wwPD1$*ViJ)c0w30}0|3wwQbPFkstye*02Kr&=HnG`4FNM zkstye*02Kr&=HzK`4GYskstye*02Kr&=Hu4LirE^6_FqU zAJ(t~0MHSpLirFP6_FqUAJ(t~0MHStLirFv6_FqUAJ(t~0MHSxLirG46_FqUAJ(t~ z0MHS#LirGa6_FqUAJ(t~0MHS(LirG)6_FqUAJ(t~0MHS-LirHF6_FqUAJ(t~0MHS> zLirHl6_FqUAJ(t~0DsUC!b15F0v3@V0w30}0|3ww#zOfJA{LP#0w30}0|3ww%0l@N zLKcxA0w30}0|3ww&O-SRViu7g0w30}0|3ww(n9$Vf)<5W*jkAOauOumb?F5&lE@5P#wykstye z*02Krun_`8`49pikstye*02Krun`7C`4A!?kstye*02Krun`JG`4B=Nkstye*02Kr zun`VK`4D0tkstye*02Krun`hO`4EC2kstye*02Krun`tS`4FNYkstye*02Krun`(W z`4GY&kstye*02Krun`_a`F{}NAdw&fAJ(t~0I(4vMEMW`A(0>gAJ(t~0I(4zMEMXR zA(0>gAJ(t~0I(4%MEMXxA(0>gAJ(t~0I(4*MEMY6A(0>gAJ(t~0I(4g zAJ(t~0I(4@MEMY+A(0>gAJ(t~0I(4{MEMZHA(0>gAJ(t~0I(50M1T1Z;vtbB0w30} z0|2lQLPYrx0wR$h0w30}0|2lQMnw4#A|jC>0w30}0|2lQN<{e(LL!kM0w30}0|2lQ zPDJ?-Vj__s0w30}0|2lQQbhR>f+CS10w30}0|2lQRz&#_q9TzX0w30}0|2lQT15E} z!Xl9%0w30}0|2lQUVlXS5aJ?{AOauOumb?F5n@F75CS8SAOauOumb?F5oSdB5F#Uy zAOauOumb?F5o$#F5JDr7AOauOumb?F5pG2J5Mm>dAOauOumb?F5pqQN5P~C-AOauO zumb?F5q3oR5TYZIAOauOumb?F5qd=V5W*voAOauOumb?F5r2L}`4HkGkstye*02Kr zun~ep`49pmkstye*02Krun~qt`4A!`kstye*02Krun~$x`4B=Rkstye*02Krun~?# z`4D0xkstye*02Kruo03(`4EC6kstye*02Kruo0F-`4FNckstye*02Kruo0R>`4GY+ zkstye*02KruzwMrMEMZnB#|HjAJ(t~0I(6FMEMW`C6OQkAJ(t~0I(6JMEMXRC6OQk zAJ(t~0I(6NMEMXxC6OQkAJ(t~0I(6RMEMY6C6OQkAJ(t~0I(6VMEMYcC6OQkAJ(t~ z0I(6ZMEMY+C6OQkAJ(t~0I(6dMEMZHC6OQkAJ(t~0DrI%zC`&D;w6zF0w30}0|2lQ z!bJHH0w$3l0w30}0|2lQ#zgrLA|{a_0w30}0|2lQ%0&4PLMD+Q0w30}0|2lQ&P4eT zVkVIw0w30}0|2lQ(nR?Xf+mq50w30}0|2lQ)AOauOumb?F z5%xs+5TYlMAOauOumb?F5&A^=5W**sAOauOuzv#puo3=5`4HkKkstye*02Krun_`9 z`49pqkstye*02Krun`7D`4A!~kstye*02Krun`JH`4B=Vkstye*02Krun`VL`4D0# zkstye*02Krun`hP`4ECAkstye*02Krun`tT`4FNgkstye*02Krun`(X`4GY=kstye z)_<@A0I(4rMfnioD3KrnAJ(t~0I(4vMfnf{DUl!oAJ(t~0I(4zMfngSDUl!oAJ(t~ z0I(4%MfngyDUl!oAJ(t~0I(4*Mfnh7DUl!oAJ(t~0I(4*`qAHOf0w30}0|2lQT1EK~!YYv<0)HRY zumb?F5ne_45aKG4AOauOumb?F5n@I85CSWaAOauOumb?F5oSgC5F#s)AOauOumb?F z5o$&G5JD@FAOauOumb?F5pG5K5MnElAOauOumb?F5pqTO5P~a_AOauOumb?F5q3rS z5TYxQAOauOumb?F5qd@W5W*{wAb$cM*02Krun~Sm`4HkOkstye*02Krun~eq`49pu zkstye*02Krun~qu`4A#3kstye*02Krun~$y`4B=Zkstye*02Krun~?$`4D0(kstye z*02Kruo03)`4ECEkstye*02Kruo0F;`4FNkkstye*02Kruo0R?`4GY^k$)fpAJ(t~ z0I(6BMfnioERi4rAJ(t~0I(6FMfnf{Es-DsAJ(t~0I(6JMfngSEs-DsAJ(t~0I(6N zMfngyEs-DsAJ(t~0I(6RMfnh7Es-DsAJ(t~0I(6VMfnhdEs-DsAJ(t~0I(6ZMfnh- zEs-DsAJ(t~0I(6dMfniIEq{?90w30}0|2lQzD4;E;w_ON0w30}0|2lQ!bSNI0xppt z0w30}0|2lQ#zpxMA}*020w30}0|2lQ%0>AQLN1XY0w30}0|2lQ&PDkUVlI&&0w30} z0|2lQ(na|Yf-aFD0w30}0|2lQ)5P!likstye*02Kruo3=6`4HkSkstye*02Krun_`A`49pykstye z*02Krun`7E`4A#7kstye*02Krun`JI`4B=dkstye*02Krun`VM`4D0-kstye*02Kr zun`hQ`4ECIkstye*02Krun`tU`4FNokstye*02Krun`(Y`F{|?Fp(evAJ(t~0I(4r zM)?rpFp(evAJ(t~0I(4vM)?o|F_9nwAJ(t~0I(4zM)?pTF_9nwAJ(t~0I(4%M)?pz zF_9nwAJ(t~0I(4*M)?q8F_9nwAJ(t~0I(4x0w30} z0|2lQMn?G%A~KO60w30}0|2lQN=Eq*LNbvc0w30}0|2lQPDc3{qB4;n0w30}0|2lQT7O3Q5W+H%AOauOumb?F5ne|5 z5aKeCAOauOumb?F5n@L95CSuiAOauOumb?F5oSjD5F#^?AOauOumb?F5o$*H5JEGN zAOauOumb?F5pG8L5MnctAOauOumb?F5pqWP5P~z2AOauOumb?F5q3uT5TY}YAOauO zumb?F5r29{`4GZ0kstye*02Krun~Sn`4HkWkstye*02Krun~er`49p$kstye*02Kr zun~qv`4A#Bkstye*02Krun~$z`4B=hkstye*02Krun~?%`4D0>kstye*02Kruo03* z`4ECMkstye*02Kruo0F<`4FNskstye*02KruzwMnM)?rJG?5?zAJ(t~0I(6BM)?rp zG?5?zAJ(t~0I(6FM)?o|HIX0!AJ(t~0I(6JM)?pTHIX0!AJ(t~0I(6NM)?pzHIX0! zAJ(t~0I(6RM)?q8HIX0!AJ(t~0I(6VM)?qeHIX0!AJ(t~0I(6ZM)?q;HIX0!AJ(t~ z0DrI%x<>gB!Znc~0w30}0|2lQzDD^F;x&;V0w30}0|2lQ!bbTJ0ydE#0w30}0|2lQ z#zy%NA~umA0w30}0|2lQ%0~GRLN<{g0w30}0|2lQ&PMqVVm6T=0w30}0|2lQ(nk3Z zf;N#L0w30}0|2lQ)<*ddqBfBr0w30}1AhRp5!y!i5W+T*AOauOumb?F5#C1m5aKqG zAOauOumb?F5#mPq5CS)mAOauOumb?F5#~nu5F$5`AOauOumb?F5$Zc(0w30}0|1Z_Mo0M& zB07;E0w30}0|1Z_N=Nw+LOPKk0w30}0|1Z_PDl9=Vmgr^0w30}0|1Z_Qb+j^f;y2P z0w30}0|1Z_R!8{|qB@Zv0)HRYumb>)5n4z25W+f)5nf065aK$KAOauO zumb>)5n@OA5CS`qAOauOumb>)5oSmE5F$H~AOauOumb>)5o$;I5JEeVAOauOumb>) z5pGBM5Mn!#AOauOumb>)5pqZQ5Q00AAOauOumb>)5q3xU5TZMgAb$cM*02KrkP&)E z`4GZ8kstye*02KrkP&`I`4Hkekstye*02KrkP(7M`49p;kstye*02KrkP(JQ`4A#J zkstye*02KrkP(VU`4B=pkstye*02KrkP(hY`4D0}kstye*02KrkP(tc`4ECUkstye z*02KrkP((g`49jAfd7A@JduAO0w30}0|1Z_nn(E%!aR{60w30}0|1Z_o=5o*;yjTc z0w30}0|1Z_qDT1<0zHu+0w30}0|1Z_rbqb@B0Z5H0w30}0|1Z_sz><{LOqcn0w30} z0|1Z_u1EP0Vm*-{0w30}0|1Z_vPbz4f<2KS0w30}0|1Z_wnzC8qCJ0+AOauOumb>) z5xPhD5W+o?AOauOumb>)5xz(H5aK)5yD6L5CT4tAOauOumb>)5ynUP z5F$R2AOauOumb>)5z0sT5JEnYAOauOumb>)5za^X5Mn-&AOauOumb>)5z)5!Off5TbuRkstye*02KrkP+HP`4GZBkstye*02KrkP+TT`4Hkhkstye z*02KrkP+fX`49p>kstye*02KrkP+rb`4A#Mkstye*02KrkP+%f`4B=skstye*02Kr zkP+@j`4D11kstye*02KrkP-4n`4ECXkstye*02KrkP-Gr`4E4iKan5;AJ(t~0FV*- zNBI!KKan5;AJ(t~0FV*>NBI!qKan5;AJ(t~0I(4PK=}{?0FfX9AJ(t~0I(4TK=}|N z0FfX9AJ(t~0I(4XK=}|t0FfX9AJ(t~0I(4bK=}}20FfX9AJ(t~0I(4fK=}}Y0FfX9 zAJ(t~0I(4jK>2?Vq5zQ~0w30}0|2lQ8bJ9F!T^yV0w30}0|2lQ9zgjJ;sB8#0w30} z0|2lQB0%{N0s)aA0w30}0|2lQCP4WRA_0*g0w30}0|2lQDnR)VLIIH=0w30}0|2lQ zEP0w30}0|2lQvOxI|f(4Nv0w30}0|0-p5w<}25TXT70w30}0|2lQ8bSFG!U&Nd0w30}0|2lQ9zppK;s}u-0w30}0|2lQB0>2O z0tt~I0w30}0|2lQCPDcSA_0w30}0|2lQqCxo(0u7NM z0w30}0|2lQra}1-A`Ous0w30}0|2lQszLb>LJg510w30}0|2lQu0i<_VhxcX0w30} z0|2lQvO)O}f(?I>AOauOumb?F5w=135TXr{AOauOumb?F5xPP75W)?SAOauOumb?F z5xznB5aJDyAOauOumb?F5yC`4E4C50M}OAJ(t~0I(7ELHQ7(50M}OAJ(t~0I(7ILHQ8E50M}OAJ(t~0I(7M zLHQ8k50M}OAJ(t~0I(4PLirE^5Ro7PAJ(t~0I(4TLirFP5Ro7PAJ(t~0I(4XLirFv z5Ro7PAJ(t~0I(4bLirG45Ro7PAJ(t~0I(4fLiv9Xf)J4)0w30}0|2lQ7DD+Dq7acF z0w30}0|2lQ8bbLH!Vr-l0w30}0|2lQ9zyvL;t-J_0w30}0|2lQB0~8P0uhlQ0w30} z0|2lQCPMiTA`y`w0w30}0|2lQDnj`XLJ^T50w30}0|2lQE<*VbViA!b0w30}0|2lQ zGD3g(5P}hrAOauOumb?F5jH~k5TX&0AOauOumb?F5jsNo5W*3WAOauOumb?F5k5ls z5aJP$AOauOumb?F5kf-w5CRgBAOauOumb?F5k^A!5F!$hAOauOumb?F5lTY&5JD1> zAOauOumb?F5l%w+5MmOMAOauOumb?F5mJ9b`4EB)5i&#h5P}(z zAOauOumb>)5jI2l5TY58AOauOumb>)5jsQp5W*ReAOauOumb>)5k5ot5aJn;AOauO zumb>)5kf=x5CR&JAOauOumb>)5k^D#5F#3pAOauOumb>)5lTb(5JDP}AOauOumb>) z5l%z-5MmmUAOe3M*02KrkP%Wt`4EB{kstye*02KrkP%ix`4FNSkstye*02KrkP%u# z`4GYykstye*02KrkP%)(`4Hk7kstye*02KrkP%`-`49pdkstye*02KrkP&7>`4A!- zkstye*02KrkP&J_`4B=Ikstye*02KrkP&V}`4D0oksyBpAJ(t~0FV)KL-`Pb8<8La zAJ(t~0FV)OL-`P*8<8LaAJ(t~0FV)SL-`QG8<8LaAJ(t~0FV)WL-`Qm8<8LaAJ(t~ z0FV)aL-`N_9FZUbAJ(t~0FV)eL-`OQ9FZUbAJ(t~0FV)iL-`Ow9FZUbAJ(t~0FV)m zL-`P59Fcz@0w30}0|1Z_l0*3rf*g?`0w30}0|1Z_mP7dvq8yPR0w30}0|1Z_nnU>z z!W@wx0w30}0|1Z_o)5wb)15P}_%AOauO zumb>)5w=755TYHCAOauOumb>)5xPV95W*diAOauOumb>)5xztD5aJz?AOauOumb>) z5yC_H5CR^NAOauOumb>)5ynIL5F#FtAOauOumb>)5z0gP5JDc2AOauOumb>)5za&T z5MqBGkstye*02KrkP*^D`4EC0kstye*02KrkP+5H`4FNWkstye*02KrkP+HL`4GY$ zkstye*02KrkP+TP`4HkBkstye*02KrkP+fT`49phkstye*02KrkP+rX`4A!>kstye z*02KrkP+%b`4B=Mkstye*02KrkP+@f`4E3%ACVveAJ(t~0FV*#L-`PbACVveAJ(t~ z0FV*(L-`P*ACVveAJ(t~0FV*-L-`QGACVveAJ(t~0FV*>L-`QmACVveAJ(t~0FV&^ zMEMW`Adw&fAJ(t~0FV&|MEMXRAdw&fAJ(t~0FV(1MEMXxAdw&fAJ(t~0FV(5MEQRZ zVjz(q0w30}0|1Z_5=8kBf*_F~0w30}0|1Z_7DV|Fq9BnV0w30}0|1Z_8btXJ!XS|# z0w30}0|1Z_9z^*N;vkVA0w30}0|1Z_B1HKR0wIwg0w30}0|1Z_CPeuVA|a6=0w30} z0|1Z_Dn$7ZLLreL0w30}0|1Z_E<}I%5Mm*bAOauOumb>)5i&&i5P~6*AOauOumb>) z5jI5m5TYTGAOauOumb>)5jsTq5W*pmAOauOumb>)5k5ru5aJ<`AOauOumb>)5kf@y z5CS5RAOauOumb>)5k^G$5F#RxAOauOumb>)5lTe)5JDo6AOauOumb>)5l(+Z`4D0v zkstye*02KrkP%Wu`4EC4kstye*02KrkP%iy`4FNakstye*02KrkP%u$`4GY)kstye z*02KrkP%))`4HkFkstye*02KrkP%`;`49plkstye*02KrkP&7?`4A!_kstye*02Kr zkP&J``4B=Qkstye*02KrkP&}wMEMY6Bat8iAJ(t~0FV)KMEMYcBat8iAJ(t~0FV)O zMEMY+Bat8iAJ(t~0FV)SMEMZHBat8iAJ(t~0FV)WMEMZnBat8iAJ(t~0FV)aMEMW` zB#|HjAJ(t~0FV)eMEMXRB#|HjAJ(t~0FV)iMEMXxB#|HjAJ(t~0FZwXjzswoVkD6u z0w30}0|1Z_l0^9sf+Ue30w30}0|1Z_mPGjwq9l)5wb-25P~I)5w=A6 z5TYfKAOauOumb>)5xPYA5W*#qAOauOumb>)5xzwE5aK0~AOauOumb>)5yC|I5CSHV zAOauOumb>)5ynLM5F#d#AOauOumb>)5z0jQ5JD!AAOauOumgVpkP*&A`4D0zkstye z*02KrkP*^E`4EC8kstye*02KrkP+5I`4FNekstye*02KrkP+HM`4GY;kstye*02Kr zkP+TQ`4HkJkstye*02KrkP+fU`49ppkstye*02KrkP+rY`4A!}kstye*02KrkP+%c z`4B=Ukstye*06sA0FV*xMEMY6Cy^imAJ(t~0FV*#MEMYcCy^imAJ(t~0FV*(MEMY+ zCy^imAJ(t~0FV*-MEMZHCy^imAJ(t~0FV*>MEMZnCy^imAJ(t~0FV&^Mfnf{D3Krn zAJ(t~0FV&|MfngSD3KrnAJ(t~0FV(1MfngyD3KrnAJ%`c0|1Z_4n_G8VknUy0w30} z0|1Z_5=HqCf+&$70w30}0|1Z_7Df3Gq9~Cd0w30}0|1Z_8b$dK!YGj-0w30}0|1Z_ z9!2>O;wX_I0w30}0|1Z_B1QQS0x6Lo0w30}0|1Z_CPn!WA}Ns|0w30}0|1Z_Dn)5iUjf5Mn8jAOauOumb>)5i&*j5P~U@AOauOumb>)5jI8n5TYrO zAOauOumb>)5jsWr5W*>uAOauOumb>)5k5uv5aKD3AOauOumb>)5kf`z5CSTZAOauO zumb>)5k^J%5F#p(AOauOumb>)5lTh*5JD=EAOe3M*02KrkP%Kr`4D0%kstye*02Kr zkP%Wv`4ECCkstye*02KrkP%iz`4FNikstye*02KrkP%u%`4GY?kstye*02KrkP%)* z`4HkNkstye*02KrkP%`<`49ptkstye*02KrkP&7@`4A#2kstye*02KrkP&J{`4B=Y zksyBpAJ(t~0FV)GMfnh7E0G`qAJ(t~0FV)KMfnhdE0G`qAJ(t~0FV)OMfnh-E0G`q zAJ(t~0FV)SMfniIE0G`qAJ(t~0FV)WMfnioE0G`qAJ(t~0FV)aMfnf{ERi4rAJ(t~ z0FV)eMfngSERi4rAJ(t~0FV)iMfngyERla80w30}0|1Z_jz#$pVl0s$0w30}0|1Z_ zl12Ftf-I3B0w30}0|1Z_mPPpxqAZah0w30}0|1Z_nnn2#!Yq*>0w30}0|1Z_o<;c( z;w+IM0w30}0|1Z_qDA=-0xgjs0w30}0|1Z_rbYP>A}x_10w30}0|1Z_szvz_LM?xh zAOauOumb>)5w1n~5MnKnAOauOumb>)5wb=35P~g{AOauOumb>)5w=D75TY%SAOauO zumb>)5xPbB5W+2yAOauOumb>)5xzzF5aKP7AOauOumb>)5yD0J5CSfdAOauOumb>) z5ynON5F##-AOauOumb>)5z0mR5JG=0kstye*02KrkP*&B`4D0*kstye*02KrkP*^F z`4ECGkstye*02KrkP+5J`4FNmkstye*02KrkP+HN`4GY`kstye*02KrkP+TR`4HkR zkstye*02KrkP+fV`49pxkstye*02KrkP+rZ`4A#6kstye*02KrkP+%d`4E3XFOeVu zAJ(t~0FV*xMfnh7FOeVuAJ(t~0FV*#MfnhdFOeVuAJ(t~0FV*(Mfnh-FOeVuAJ(t~ z0FV*-MfniIFOeVuAJ(t~0FV*>MfnioFOeVuAJ(t~0FV&^M)?o|Fp(evAJ(t~0FV&| zM)?pTFp(evAJ(t~0FV(1M)`jbLNJja0w30}0|1Z_4o3M9Vla^)0w30}0|1Z_5=QwD zf-sRF0w30}0|1Z_7Do9HqA-yl0w30}0|1Z_8b)5iUmg5MnWrAOauOumb>)5i&;k5P~t0AOauOumb>)5jIBo5TY@WAOauOumb>) z5jsZs5W+E$AOauOumb>)5k5xw5aKbBAOauOumb>)5kf}!5CSrhAOauOumb>)5k^M& z5F#>>AOauOumb>)5lVkX`4B=fkstye*02KrkP%Ks`4D0) z5w1r05MnivAOauOumb>)5wb@45P~(4AOauOumb>)5w=G85TZ4aAOauOumb>)5xPeC z5W+Q)AOauOumb>)5xz$G5aKnFAOauOumb>)5yD3K5CS%lAOauOumb>)5ynRO5F$2_ zAOauOumgVpkP*s8`4B=jkstye*02KrkP*&C`4D0@kstye*02KrkP*^G`4ECOkstye z*02KrkP+5K`4FNukstye*02KrkP+HO`4GZ3kstye*02KrkP+TS`4HkZkstye*02Kr zkP+fW`49p(kstye*02KrkP+ra`4A#Ekstye*06sA0FV*tM)?pzH<2I$AJ(t~0FV*x zM)?q8H<2I$AJ(t~0FV*#M)?qeH<2I$AJ(t~0FV*(M)?q;H<2I$AJ(t~0FV*-M)?rJ zH<2I$AJ(t~0FV*>M)?rpH<2I$AJ(t~0FV&^NBIx}IFTR%AJ(t~0FV&|NBIyUIFTR% zAJ%`c0|1Z_3P<@6LO78i0w30}0|1Z_4oCSAVmOf?0w30}0|1Z_5=Z$Ef;f>N0w30} z0|1Z_7DxFIqBxNt0w30p0|4+58b|pM!Z?v20w30p0|4+59!L2Q;y95Y0w30p0|4+5 zB1icU0y&W&0w30p0|4+5CP(=YA~}&D0v~_YkOKhl5h_Rd5JEYTAOauOkOKhl5iUph z5MnuzAOauOkOKhl5i&>l5P~_8AOauOkOKhl5jIEp5TZGeAOauOkOKhl5jsct5W+c; zAOauOkOKhl5k5!x5aKzJAOauOkOKhl5kg1#5CS@pAOauOkOKhl5k^P(5F$E}AOe3M z){p}L@DWN!`4B=nkstye){p}L@DWZ&`4D0{kstye){p}L@DWl+`4ECSkstye){p}L z@DWx=`4FNykstye){p}L@DW-^`4GZ7kstye){p}L@DW}|`4Hkdkstye){p}L@DXB1 z`49p-kstye){p}L@DXN5`4A#IksyBpAJ&iq0PqoNNBIy!JCPs)AJ&iq0PqoRNBIz9 zJCPs)AJ&iq0PqoVNBIzfJCPs)AJ&iq0PqoZNBIz zkstye){p}L@Db)m`4E31Kan5;AJ&iq0Pqp&NBIy!Kan5;AJ&iq0Pqp+NBIz9Kan5; zAJ&iq0Pqp=NBIzfKan5;AJ&iq0Pqp^NBIz2?VA^?#f0w30}0|1Z_ z3PAY~LI9B<0w30}0|1Z_4nX-3VgQjK0w30}0|1Z_5)5h_6W5JCZwAOauOumb>)5iUUa5Mlw5AOauO zumb>)5i&se5P|`bAOauOumb>)5jH^i5TXH*AOauOumb>)5jsHm5W)eGAOauOumb>) z5k5fq5aI!mAOauOumb>)5kf%u5CQ^`AOauOumb>)5k`MN`4A!kkstye*02KrkP%8i z`4B<^kstye*02KrkP%Km`4D0Pkstye*02KrkP%Wq`4EBvkstye*02KrkP%iu`4FN4 zkstye*02KrkP%uy`4GYakstye*02KrkP%)$`4Hj)kstye*02KrkP%`)`49pFkstye z*02KrkP&}oK=}|N1CbyCAJ(t~0FV)CK=}|t1CbyCAJ(t~0FV)GK=}}21CbyCAJ(t~ z0FV)KK=}}Y1CbyCAJ(t~0FV)OK=}}&1CbyCAJ(t~0FV)SK=}~D1CbyCAJ(t~0FV)W zK=}~j1CbyCAJ(t~0FV)aK=}{?1d$*DAJ(t~0FZwXhCulcA_S2j0w30}0|1Z_ia_}g zLIjZ@0w30}0|1Z_jzIYkVg!*O0w30}0|1Z_l0f+of&`Hu0w30}0|1Z_mO%Lsq6Cp3 z0w30}0|1Z_nn3vw!UT~Z0w30}0|1Z_o)5voA>5JCl!AOauOumb>)5w1Y_5Ml+9AOauOumb>) z5wbw}5P}7fAOauOumb>)5w<}25TXT)5xPM65W)qKAOauOumb>)5xzkA z5aI=qAOauOumb>)5yC+E5CR5~AOauOumgVpkP*f}`4A!okstye*02KrkP*s2`4B<| zkstye*02KrkP*&6`4D0Tkstye*02KrkP*^A`4EBzkstye*02KrkP+5E`4FN8kstye z*02KrkP+HI`4GYekstye*02KrkP+TM`4Hj;kstye*02KrkP+fQ`49pJkstye*06sA z0FV*pK=}|N2azBGAJ(t~0FV*tK=}|t2azBGAJ(t~0FV*xK=}}22azBGAJ(t~0FV*# zK=}}Y2azBGAJ(t~0FV*(K=}}&2azBGAJ(t~0FV*-K=}~D2azBGAJ(t~0FV*>K=}~j z2azBGAJ(t~0FV&^LHQ5@2$3KHAJ%`c0|1Z_20{4{A_$Qn0w30}0|1Z_3PJf0LI{x{ z0w30}0|1Z_4ng@4VhE8S0w30}0|1Z_5<&S8f(Vfy0w30}0|1Z_7D4$Cq6m>70w30} z0|1Z_8bSFG!U&Nd0w30}0|1Z_9zppK;s}u-0w30}0|1Z_B0>2O0tt~I0v~_Yumb>) z5hg+T5F!bYAOauOumb>)5h_9X5JCx&AOauOumb>)5iUXb5Ml|DAOauOumb>)5i&vf z5P}JjAOauOumb>)5jH{j5TXf@AOauOumb>)5jsKn5W)$OAOauOumb>)5k5ir5aJ1u zAOauOumb>)5kf)v5CRI3AOe3M*02KrkP${f`4A!skstye*02KrkP%8j`4B=1kstye z*02KrkP%Kn`4D0Xkstye*02KrkP%Wr`4EB%kstye*02KrkP%iv`4FNCkstye*02Kr zkP%uz`4GYikstye*02KrkP%)%`4Hj?kstye*02KrkP%`*`49pNksyBpAJ(t~0FV)8 zLHQ6O3y~lKAJ(t~0FV)CLHQ6u3y~lKAJ(t~0FV)GLHQ733y~lKAJ(t~0FV)KLHQ7Z z3y~lKAJ(t~0FV)OLHQ7(3y~lKAJ(t~0FV)SLHQ8E3y~lKAJ(t~0FV)WLHQ8k3y~lK zAJ(t~0FV)aLHQ5@43U2z0w30}0|1Z_hC%rdA`For0w30}0|1Z_ib44hLJW~00w30} z0|1Z_jzRelVhoWW0w30}0|1Z_l0o?pf((%$0w30}0|1Z_mO=Rtq70EB0w30}0|1Z_ znnC#x!VHlh0w30}0|1Z_o0w30}0|1Z_qCxo(0u6tWAOauOumb>)5vD=; z5F!ncAOauOumb>)5voD?5JC-+AOauOumb>)5w1b`5Mm9HAOauOumb>)5wbz~5P}Vn zAOauOumb>)5w=135TXr{AOauOumb>)5xPP75W)?SAOauOumb>)5xznB5aJDyAOauO zumb>)5yCLHQ8k50M}OAJ(t~ z0FV&^Liv9X0uYfP0w30}0|1Z_215A|A`p=v0w30}0|1Z_3PSl1LJ*N40w30}0|1Z_ z4np}5Vi1ua0w30}0|1Z_5<>Y9f)J4)0w30}0|1Z_7DD+Dq7acF0w30}0|1Z_8bbLH z!Vr-l0w30}0|1Z_9zyvL;t-J_0w30}0|1Z_B0_)p5CRdAAOauOumb>)5hg)5h_CY5JC}=AOauOumb>)5iUac5MmLLAOauOumb>)5i&yg5P}hrAOauO zumb>)5jH~k5TX&0AOauOumb>)5jsNo5W*3WAOauOumb>)5k5ls5aJP$AOauOumb>) z5kh}L`49pUkstye*02KrkP${g`4A!!kstye*02KrkP%8k`4B=9kstye*02KrkP%Ko z`4D0fkstye*02KrkP%Ws`4EB)5vD@<5F!)5voG@5JDA^AOauOumb>)5w1e{5MmXPAOauOumb>)5wb%05P}tvAOauOumb>) z5w=445TX^4AOauOumb>)5xPS85W*FaAOauOumb>)5xzqC5aJb)AOauOumgVpkP*T{ z`49pYkstye*02KrkP*g0`4A!&kstye*02KrkP*s4`4B=Dkstye*02KrkP*&8`4D0j zkstye*02KrkP*^C`4EB@kstye*02KrkP+5G`4FNOkstye*02KrkP+HK`4GYukstye z*02KrkP+TO`4Hk3kstye*06sA0FV*lLirE^7m*+WAJ(t~0FV*pLirFP7m*+WAJ(t~ z0FV*tLirFv7m*+WAJ(t~0FV*xLirG47m*+WAJ(t~0FV*#LirGa7m*+WAJ(t~0FV*( zLirG)7m*+WAJ(t~0FV*-LirHF7m*+WAJ(t~0FV*>LirHl7m*+WAJ%`c0|1Z_0z>%_ z0vM4X0w30}0|1Z_21EG}A{db%0w30}0|1Z_3Pbr2LKu-C0w30}0|1Z_4nz46Vi=Ji z0w30}0|1Z_5<~eAf*6q?0w30}0|1Z_7DM?Eq8O1N0w30p0|4+58bkRI!WfYt0w30p z0|4+59z*#M;uw)20v~_YkOKhl5h6qR5CR#IAOauOkOKhl5hg?V5F#0oAOauOkOKhl z5h_FZ5JDM|AOauOkOKhl5iUdd5MmjTAOauOkOKhl5i&#h5P}(zAOauOkOKhl5jI2l z5TY58AOauOkOKhl5jsQp5W*ReAOauOkOKhl5k5ot5aJn;AOe3M){p}L@DV~o`49pc zkstye){p}L@DWBs`4A!+kstye){p}L@DWNw`4B=Hkstye){p}L@DWZ!`4D0nkstye z){p}L@DWl&`4EB{kstye){p}L@DWx+`4FNSkstye){p}L@DW-=`4GYykstye){p}L z@DW}^`4Hk7ksyBpAJ&iq0PqoFL-`N_8<8LaAJ&iq0PqoJL-`OQ8<8LaAJ&iq0PqoN zL-`Ow8<8LaAJ&iq0PqoRL-`P58<8LaAJ&iq0PqoVL-`Pb8<8LaAJ&iq0PqoZL-`P* z8<8LaAJ&iq0PqodL-`QG8<8LaAJ&iq0PqohL-`Qm8z*0w30p0|4+5ibMGjLL8AG0w30p0|4+5jzjqnVjPhm0w30p z0|4+5l0*3rf*g?`0w30p0|4+5mP7dvq8yPR0w30p0|4+5nnU>z!W@wx0w30p0|4+5 zoMAOauOkOKhl5vD`=5F#CsAOauOkOKhl5voJ^ z5JDZ1AOauOkOKhl5w1h|5MmvXAOauOkOKhl5wb)15P}_%AOauOkOKhl5w=755TYHC zAOauOkOKhl5xPV95W*diAOauOkOKhl5xztD5aNFwkstye){p}L@Daj8`49pgkstye z){p}L@DavC`4A!=kstye){p}L@Da*G`4B=Lkstye){p}L@Da{K`4D0rkstye){p}L z@Db8O`4EC0kstye){p}L@DbKS`4FNWkstye){p}L@DbWW`4GY$kstye){p}L@Dbia z`4E5N9+4mdAJ&iq0PqpwL-`N_ACVveAJ&iq0Pqp!L-`OQACVveAJ&iq0Pqp&L-`Ow zACVveAJ&iq0Pqp+L-`P5ACVveAJ&iq0Pqp=L-`PbACVveAJ&iq0Pqp^L-`P*ACVve zAJ&iq0Pqp|L-`QGACVveAJ&iq0Pqq1L-~IY;vbP90w30p0|4+50z~-`0w9qf0w30p z0|4+521NM~A|R0<0w30p0|4+53Pkx3LLiYK0w30p0|4+54n+A7Vjz(q0w30p0|4+5 z5=8kBf*_F~0w30p0|4+57DV|Fq9BnV0w30p0|4+58btXJ!XS|#0w30p0|4+59z=in z5aJ+_AOauOkOKhl5h6tS5CS2QAOauOkOKhl5hg_W5F#OwAOauOkOKhl5h_Ia5JDl5 zAOauOkOKhl5iUge5Mm*bAOauOkOKhl5i&&i5P~6*AOauOkOKhl5jI5m5TYTGAOauO zkOKhl5jsTq5W*pmAOauOkOKhl5k7xJ`4HkEkstye){p}L@DV~p`49pkkstye){p}L z@DWBt`4A!^kstye){p}L@DWNx`4B=Pkstye){p}L@DWZ#`4D0vkstye){p}L@DWl( z`4EC4kstye){p}L@DWx-`4FNakstye){p}L@DW->`4GY)kstye){p}L@DYDrMEMZn zB9R~hAJ&iq0PqoFMEMW`Bat8iAJ&iq0PqoJMEMXRBat8iAJ&iq0PqoNMEMXxBat8i zAJ&iq0PqoRMEMY6Bat8iAJ&iq0PqoVMEMYcBat8iAJ&iq0PqoZMEMY+Bat8iAJ&iq z0PqodMEMZHBat8iAJ&iq0Pueienj~Y;v5F#a!AOauOkOKhl5voM_5JDx9AOauO zkOKhl5w1k}5Mm{fAOauOkOKhl5wb-25P~IuAOe3M){p}L@DV;m`4HkMkstye){p}L@DV~q`49pskstye){p}L@DWBu`4A#1 zkstye){p}L@DWNy`4B=Xkstye){p}L@DWZ$`4D0%kstye){p}L@DWl)`4ECCkstye z){p}L@DWx;`4FNikstye){p}L@DW-?`4GY?ksyBpAJ&iq0PqoBMfnioDv=-pAJ&iq z0PqoFMfnf{E0G`qAJ&iq0PqoJMfngSE0G`qAJ&iq0PqoNMfngyE0G`qAJ&iq0PqoR zMfnh7E0G`qAJ&iq0PqoVMfnhdE0G`qAJ&iq0PqoZMfnh-E0G`qAJ&iq0PqodMfniI zE0KR70w30p0|4+5ent5Z;wzCL0w30p0|4+5f<^fd0xXdr0w30p0|4+5hDG@hA}o<0 z0w30p0|4+5ibeSlLM)LW0w30p0|4+5jz#$pVl0s$0w30p0|4+5l12Ftf-I3B0w30p z0|4+5mPPpxqAZah0w30p0|4+5nnn2#!YqH0AOauOkOKhl5uQc)5aKM6AOauOkOKhl z5u!!;5CSccAOauOkOKhl5vE1?5F#y+AOauOkOKhl5voP`5JD}HAOauOkOKhl5w1n~ z5MnKnAOauOkOKhl5wb=35P~g{AOauOkOKhl5w=D75TY%SAOauOkOKhl5xPbB5W;^g zkstye){p}L@DaX6`4HkQkstye){p}L@DajA`49pwkstye){p}L@DavE`4A#5kstye z){p}L@Da*I`4B=bkstye){p}L@Da{M`4D0*kstye){p}L@Db8Q`4ECGkstye){p}L z@DbKU`4FNmkstye){p}L@DbWY`4E4?E|DMtAJ&iq0PqpsMfnioE|DMtAJ&iq0Pqpw zMfnf{FOeVuAJ&iq0Pqp!MfngSFOeVuAJ&iq0Pqp&MfngyFOeVuAJ&iq0Pqp+Mfnh7 zFOeVuAJ&iq0Pqp=MfnhdFOeVuAJ&iq0Pqp^Mfnh-FOeVuAJ&iq0Pqp|Mfraa!Y`2^ z0w30p0|4+5{zdr^;xCaP0w30p0|4+50!H}|0x*#v0w30p0|4+521fZ1A~2C40w30p z0|4+53P$-5LNJja0w30p0|4+54o3M9Vla^)0w30p0|4+55=QwDf-sRF0w30p0|4+5 z7Do9HqA-yl0w30p0|4+58b*Kl5W+B#AOauOkOKhl5gtbQ5aKYAAOauOkOKhl5h6zU z5CSogAOauOkOKhl5hh0Y5F#;=AOauOkOKhl5h_Oc5JEALAOauOkOKhl5iUmg5MnWr zAOauOkOKhl5i&;k5P~t0AOauOkOKhl5jIBo5TY@WAOauOkOKhl5juZH`4GY}kstye z){p}L@DV;n`4HkUkstye){p}L@DV~r`49p!kstye){p}L@DWBv`4A#9kstye){p}L z@DWNz`4B=fkstye){p}L@DWZ%`4D0H%5W+N(AOauOkOKhl5uQf*5aKkEAOauOkOKhl5u!%<5CS!k zAOauOkOKhl5vE4@5F#~^AOauOkOKhl5voS{5JEMPAOauOkOKhl5w1r05MnivAOauO zkOKhl5wb@45P~(4AOauOkOKhl5w=G85TZ4aAOauOkOO}J@DaL3`4GZ2kstye){p}L z@DaX7`4HkYkstye){p}L@DajB`49p&kstye){p}L@DavF`4A#Dkstye){p}L@Da*J z`4B=jkstye){p}L@Da{N`4D0@kstye){p}L@Db8R`4ECOkstye){p}L@DbKV`4FNu zkstye){uV#0PqpoM)?rJHjy9#AJ&iq0PqpsM)?rpHjy9#AJ&iq0PqpwM)?o|H<2I$ zAJ&iq0Pqp!M)?pTH<2I$AJ&iq0Pqp&M)?pzH<2I$AJ&iq0Pqp+M)?q8H<2I$AJ&iq z0Pqp=M)?qeH<2I$AJ&iq0Pqp^M)?q;H<2I$AJ%`60|4+5`bPN>!Z(p10w30p0|4+5 z{zmx_;x~~X0w30p0|4+50!R4}0yvQ%0w30p0|4+521of2A~=yC0w30p0|4+53P<@6 zLO78i0w30p0|4+54oCSAVmOf?0w30p0|4+55=Z$Ef;f>N0w30p0|4+57DxFIqBxNt z0v~_YkOKhF5gJGN5W+Z-AOauOkOKhF5gteR5aKwIAOauOkOKhF5h6$V5CS=oAOauO zkOKhF5hh3Z5F$B|AOauOkOKhF5h_Rd5JEYTAOauOkOKhF5iUph5MnuzAOauOkOKhF z5i&>l5P~_8AOauOkOKhF5jIEp5TZGeAOe3M*5VJpse%Il&|?Dt@InAU`D1_tkw5?+ z)*m1P)gK@O)qn#4&;am9`9J^ww2}V*7r+Bw)*m1P)qn#4@BrWek%0pM@FCy!1JtRDlBk&>`$c`9S~xv>*T<*1!W_)*m1P)qn#4@BrWek%0pM@FCyZwzyn{_-v9p>Apn3Nt{R04zpbr4~^_Q`+1QQg1002~=4?y{e=zs zfB*ngpbtR#dg=d{0ssIM004ke{d>Zwm(Z{T-~pqTv9Sb80g#umu>>EN9I^x;e-I9W z(*I*H%l&%*sr>^0k@Hglsq+H}s(=Fk&;WEt`2hex`Jp!m`2hfc(xKx3kpKVykO0sP zk9ao`7^8UP#s5+48naUcW$R6ziMQlJHZQc2?fmjE095+48naR37VR6ziM zQlJHZQUmAzmmdTGao`u98UP#se-a-60C4~U0929r|Ci$f0II+N0FVNp2$7%x0FVK| z7m=U=0FVIS7?I@z0;=Q#1FFLXfKuWE0jl8x0IHw`fKq4a|Citc6RK(M|Cf*e02H(z zK>47<0Fm+g|Cgb|0Fj`h0FmMY0jl8x6sqL$|CgY{0FmbK|CgYn0g(X!e}dBD0|BZ5 z0Dw|G=>M0XqX3ah{{NRB{6F#Fm!BE{8~_p@0040y1OQY)0Dw}U1%Of$;{TTb8~_p@ z0040S0{~P(0Dw}U1%Oh`=Kq%;1ORd17oQpc8~_p@0040S0svH7`Tv*W0|2VP0RWH! zpa_wm0RWHzz!#CA0RWHyf8ZIBPx;0K=?02}}k z9{>PxpacL^K>&bKpapPxfCB(jK>&bKpap&#fs^tR$s^kL{ssjgrQsM&vs^J3ws-OjcQUK}ym*4{vssir+mlyy56rrO5 zk)Wdhkz)4$m!P8ne~|(JfRf<_fKrzA|Ca#-0Fj`h0Fk1@0Fmee0;=Kz0jdE2fYK-X z|Cgb|0Fj`h0FnIZ|CgY{0Ff5>|CgYn0FmJX0IJ{v6RNuC|CgYn0Fe;*|CbK{02K2B z0IHzF0Fi9)|Citc6RKkS|CjRv0IHzF0Fejy|Ca&)02K2BSpce_qX3Zu`2UyS0~4xQ z`~R2V0~4x&0|3w=bVvE3H%R#*06_Uc00GKB008ko0030@Px;0K=?02}}k z9{>PxzySbMfCB*V06-p*JmLSBfCB*V0N^5#b?N_?fCB*V0ssJ!fCB*V0YDy+fCB)~ z0MtkMM)CibfCB*V06-p*{d>WvmWc)!27m(q&;WFo>aqkTPM`q*kN`jyk)Z~>f zs^J3ws-P1<`7i7Lm!Jayk>LXXs-PD@`3wF3m!LlYxu639k+Apwm!LmDxgP)kaR3AW zRGj$#m-7Pvsy6DEUb6%if9UQ1m!Jayk=peCm*WEfs=xsNkOBY+k)QzpkO9CKk)Qzp zkN|)ik>>*gss;dn66FH|s^kL`s>2F^QsM&vs^J3ws-OjcQsUqLm!Jayk&yTQmjD2O z5(NMN6rdMC`5^#+QUL$}IRF5FQh@^i&>?h3`JyL4`5^#6`9S~ym-Dj(6(WE4|Citc z6ROqv|CjRv0IHw^0g-z5|Citc6RObq|Ce{;mwJ;08%-Ag`G5le&;WEt`2hex`Jo>G z`2hfc(xAftk>~>es-^z_m!QJ{k>LXXs-PD@`CR<}m-7PvDxkvvkzx1$m*4{vDuDw4 z&>?h3`Jx|}E=~m-8p8mQRrmjw-~$t?tNQfh%ew>`e