已合并
FE Log Rectification #4482
李颜戎创建于 16 天前
FE Log Rectification #4482
已合并
共 32 个文件变更+532-59
| @@ -96,7 +96,7 @@ Status ConcatTileFusionPass::GetShapeLimited(const ge::DataType &data_type) { | |||
| 96 | } | 96 | } |
| 97 | FE_MUL_OVERFLOW(val_size, val_core, shape_limited_); | 97 | FE_MUL_OVERFLOW(val_size, val_core, shape_limited_); |
| 98 | shape_limited_ /= data_type_size; | 98 | shape_limited_ /= data_type_size; |
| 99 | - FE_LOGD("Current soc has vecor_core_num is [%s], vector_calculate_size is [%s], shape_limited_size is [%lu].", | 99 | + FE_LOGD("Current soc has vector_core_num is [%s], vector_calculate_size is [%s], shape_limited_size is [%lu].", |
| 100 | val_core_str.c_str(), val_size_str.c_str(), shape_limited_); | 100 | val_core_str.c_str(), val_size_str.c_str(), shape_limited_); |
| 101 | return SUCCESS; | 101 | return SUCCESS; |
| 102 | } | 102 | } |
| @@ -745,7 +745,7 @@ Status ConcatTileFusionPass::ParseConcatNode(const ge::NodePtr &concat_node) { | |||
| 745 | FE_CHECK(!GetConcatV2ConstantNode(concat_node, indx), FE_LOGW("Can't find const node"), return NOT_CHANGED); | 745 | FE_CHECK(!GetConcatV2ConstantNode(concat_node, indx), FE_LOGW("Can't find const node"), return NOT_CHANGED); |
| 746 | } | 746 | } |
| 747 | FE_CHECK(CheckControlEdge(concat_dim_input_node_), | 747 | FE_CHECK(CheckControlEdge(concat_dim_input_node_), |
| 748 | - FE_LOGW("Concat node's concat_dim with conctrl edges, Couldn't be supported."), return NOT_CHANGED); | 748 | + FE_LOGW("Concat node's concat_dim with control edges, Couldn't be supported."), return NOT_CHANGED); |
| 749 | if (!GetConcatDim(concat_node, indx)) { | 749 | if (!GetConcatDim(concat_node, indx)) { |
| 750 | return NOT_CHANGED; | 750 | return NOT_CHANGED; |
| 751 | } | 751 | } |
| @@ -26,14 +26,14 @@ L2Optimizer::~L2Optimizer() {} | |||
| 26 | 26 | ||
| 27 | Status L2Optimizer::UpdateInputForL2Fusion(const ge::ComputeGraph &stream_graph) const { | 27 | Status L2Optimizer::UpdateInputForL2Fusion(const ge::ComputeGraph &stream_graph) const { |
| 28 | for (auto &node : stream_graph.GetDirectNode()) { | 28 | for (auto &node : stream_graph.GetDirectNode()) { |
| 29 | - FE_LOGD("update input for node:%s.", node->GetName().c_str()); | 29 | + FE_LOGD("update input for node: %s.", node->GetName().c_str()); |
| 30 | uint64_t input_idx = 0; | 30 | uint64_t input_idx = 0; |
| 31 | for (uint8_t i = 0; i < node->GetAllInDataAnchors().size(); ++i) { | 31 | for (uint8_t i = 0; i < node->GetAllInDataAnchors().size(); ++i) { |
| 32 | auto in_anchor = node->GetInDataAnchor(i); | 32 | auto in_anchor = node->GetInDataAnchor(i); |
| 33 | FE_CHECK_NOTNULL(in_anchor); | 33 | FE_CHECK_NOTNULL(in_anchor); |
| 34 | auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); | 34 | auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); |
| 35 | if (peer_out_anchor == nullptr) { | 35 | if (peer_out_anchor == nullptr) { |
| 36 | - FE_LOGD("peer_out_anchor is empty."); | 36 | + FE_LOGD("peer_out_anchor is nullptr."); |
| 37 | continue; | 37 | continue; |
| 38 | } | 38 | } |
| 39 | auto input_node = peer_out_anchor->GetOwnerNode(); | 39 | auto input_node = peer_out_anchor->GetOwnerNode(); |
| @@ -93,7 +93,7 @@ Status L2Optimizer::UpdateInputForL2Fusion(const ge::ComputeGraph &stream_graph) | |||
| 93 | } | 93 | } |
| 94 | ge::OpDescPtr node_desc = node->GetOpDesc(); | 94 | ge::OpDescPtr node_desc = node->GetOpDesc(); |
| 95 | L2FusionInfoPtr l2_info = GetL2FusionInfoFromJson(node_desc); | 95 | L2FusionInfoPtr l2_info = GetL2FusionInfoFromJson(node_desc); |
| 96 | - FE_LOGD("Set all l2fusion information to node: [%s].", node_desc->GetName().c_str()); | 96 | + FE_LOGD("Set all l2fusion information to node [%s].", node_desc->GetName().c_str()); |
| 97 | SetL2FusionInfoToNode(node_desc, l2_info); | 97 | SetL2FusionInfoToNode(node_desc, l2_info); |
| 98 | } | 98 | } |
| 99 | return SUCCESS; | 99 | return SUCCESS; |
| @@ -171,24 +171,24 @@ Status L2Optimizer::GetL2DataAlloc(ge::ComputeGraph &stream_graph, uint64_t mem_ | |||
| 171 | // l2 buffer | 171 | // l2 buffer |
| 172 | if ((CheckL2BufferFusionStrategy(stream_graph) && Configuration::Instance(engine_name_).IsEnableL2Buffer() && | 172 | if ((CheckL2BufferFusionStrategy(stream_graph) && Configuration::Instance(engine_name_).IsEnableL2Buffer() && |
| 173 | build_mode_value != ge::BUILD_MODE_TUNING)) { | 173 | build_mode_value != ge::BUILD_MODE_TUNING)) { |
| 174 | - FE_LOGD("L2 buffer enabled. Build mode is %s, graph name: %s.", build_mode_value.c_str(), | 174 | + FE_LOGD("L2 buffer enabled. Build mode is %s, graph name: %s", build_mode_value.c_str(), |
| 175 | stream_graph.GetName().c_str()); | 175 | stream_graph.GetName().c_str()); |
| 176 | TaskL2InfoMap l2_info_map; | 176 | TaskL2InfoMap l2_info_map; |
| 177 | FE_CHECK(L2FusionHandler::GetL2DataAlloc(mem_base, stream_graph, l2_info_map) != fe::SUCCESS, | 177 | FE_CHECK(L2FusionHandler::GetL2DataAlloc(mem_base, stream_graph, l2_info_map) != fe::SUCCESS, |
| 178 | REPORT_FE_ERROR("[StreamOpt][L2Opt][GetL2DataAlloc] Allocate L2 Buffer Address failed!"), | 178 | REPORT_FE_ERROR("[StreamOpt][L2Opt][GetL2DataAlloc] Allocate L2 Buffer Address failed!"), |
| 179 | return fe::FAILED); | 179 | return fe::FAILED); |
| 180 | - FE_LOGD("Allocate L2 Buffer Address for stream graph successfully."); | 180 | + FE_LOGD("Allocate L2 Buffer Address for stream graph successfully"); |
| 181 | 181 | ||
| 182 | FE_CHECK(!SetFunctionState(fe::FuncParamType::FUSION_L2, true), | 182 | FE_CHECK(!SetFunctionState(fe::FuncParamType::FUSION_L2, true), |
| 183 | REPORT_FE_ERROR("[StreamOpt][L2Opt][GetL2DataAlloc] Failed to set Func State to true!"), | 183 | REPORT_FE_ERROR("[StreamOpt][L2Opt][GetL2DataAlloc] Failed to set Func State to true!"), |
| 184 | return fe::FAILED); | 184 | return fe::FAILED); |
| 185 | 185 | ||
| 186 | - FE_LOGD("Set function state successfully."); | 186 | + FE_LOGD("Set function state successfully"); |
| 187 | std::string batch_label = "Batch_-1"; | 187 | std::string batch_label = "Batch_-1"; |
| 188 | (void)ge::AttrUtils::GetStr(stream_graph, ge::ATTR_NAME_BATCH_LABEL, batch_label); | 188 | (void)ge::AttrUtils::GetStr(stream_graph, ge::ATTR_NAME_BATCH_LABEL, batch_label); |
| 189 | FE_CHECK(StreamL2Info::Instance().SetStreamL2Info(stream_id, l2_info_map, batch_label) != fe::SUCCESS, | 189 | FE_CHECK(StreamL2Info::Instance().SetStreamL2Info(stream_id, l2_info_map, batch_label) != fe::SUCCESS, |
| 190 | REPORT_FE_ERROR("[StreamOpt][L2Opt][UpdL2FusIn] Failed to set Stream L2 Map!"), return fe::FAILED); | 190 | REPORT_FE_ERROR("[StreamOpt][L2Opt][UpdL2FusIn] Failed to set Stream L2 Map!"), return fe::FAILED); |
| 191 | - FE_LOGD("Set stream L2 map successfully."); | 191 | + FE_LOGD("Set stream L2 map successfully"); |
| 192 | } | 192 | } |
| 193 | if (build_mode_value == ge::BUILD_MODE_TUNING || | 193 | if (build_mode_value == ge::BUILD_MODE_TUNING || |
| 194 | (Configuration::Instance(engine_name_).EnableL2Fusion() && CheckL2FusionFusionStrategy(stream_graph))) { | 194 | (Configuration::Instance(engine_name_).EnableL2Fusion() && CheckL2FusionFusionStrategy(stream_graph))) { |
| @@ -47,7 +47,7 @@ Status TbeKernelLaunch::DealKernelLaunch(const ge::Node &node, const void *args, | |||
| 47 | return TASK_BUILDER_STATUS_INTERNAL_ERROR; | 47 | return TASK_BUILDER_STATUS_INTERNAL_ERROR; |
| 48 | } | 48 | } |
| 49 | // 5. call KernelLaunch | 49 | // 5. call KernelLaunch |
| 50 | - FE_LOGD("Op[name=%s,type=%s]: args_size:%u bytes, append_args_size:%zu bytes, total_args_size:%u bytes.", | 50 | + FE_LOGD("Op[name=%s, type=%s]: args_size: %u bytes, append_args_size: %zu bytes, total_args_size: %u bytes.", |
| 51 | op_name.c_str(), op_type.c_str(), args_size, append_args_size, total_args_size); | 51 | op_name.c_str(), op_type.c_str(), args_size, append_args_size, total_args_size); |
| 52 | if (append_args_size > 0) { | 52 | if (append_args_size > 0) { |
| 53 | PrintAllArgs(op_name, op_type, args_buff.data(), args_size); | 53 | PrintAllArgs(op_name, op_type, args_buff.data(), args_size); |
| @@ -56,7 +56,7 @@ Status TbeKernelLaunch::DealKernelLaunch(const ge::Node &node, const void *args, | |||
| 56 | bool ret = false; | 56 | bool ret = false; |
| 57 | std::string first_kernel_name; | 57 | std::string first_kernel_name; |
| 58 | if (ge::AttrUtils::GetStr(op_desc, ATTR_NAME_KERNEL_LIST_FIRST_NAME, first_kernel_name)) { | 58 | if (ge::AttrUtils::GetStr(op_desc, ATTR_NAME_KERNEL_LIST_FIRST_NAME, first_kernel_name)) { |
| 59 | - FE_LOGD("Node name is[%s], first kernel name is[%s].", op_name.c_str(), first_kernel_name.c_str()); | 59 | + FE_LOGD("Node name is [%s], first kernel name is [%s].", op_name.c_str(), first_kernel_name.c_str()); |
| 60 | ret = KernelLaunchWithHandle(core_dim, args_buff.data(), total_args_size, nullptr, task_def); | 60 | ret = KernelLaunchWithHandle(core_dim, args_buff.data(), total_args_size, nullptr, task_def); |
| 61 | } else { | 61 | } else { |
| 62 | ret = KernelLaunch(stub_func, core_dim, args_buff.data(), total_args_size, nullptr, task_def); | 62 | ret = KernelLaunch(stub_func, core_dim, args_buff.data(), total_args_size, nullptr, task_def); |
| @@ -72,13 +72,13 @@ void TbeKernelLaunch::PrintAllArgs(const string &op_name, const string &op_type, | |||
| 72 | uint32_t args_size) { | 72 | uint32_t args_size) { |
| 73 | for (size_t i = 0; i != args_size / sizeof(uint64_t); ++i) { | 73 | for (size_t i = 0; i != args_size / sizeof(uint64_t); ++i) { |
| 74 | uint64_t value = *(reinterpret_cast<uint64_t *>(reinterpret_cast<uintptr_t>(all_args_buff) + i * sizeof(uint64_t))); | 74 | uint64_t value = *(reinterpret_cast<uint64_t *>(reinterpret_cast<uintptr_t>(all_args_buff) + i * sizeof(uint64_t))); |
| 75 | - FE_LOGD("Op[name=%s,type=%s]: args[%zu]=[%lu].", op_name.c_str(), op_type.c_str(), i, value); | 75 | + FE_LOGD("Op[name=%s, type=%s]: args[%zu]=[%lu].", op_name.c_str(), op_type.c_str(), i, value); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | for (size_t i = 0; i != GetAppendArgsNum(); ++i) { | 78 | for (size_t i = 0; i != GetAppendArgsNum(); ++i) { |
| 79 | uint64_t value = *(reinterpret_cast<uint64_t *>(reinterpret_cast<uintptr_t>(all_args_buff) + args_size + | 79 | uint64_t value = *(reinterpret_cast<uint64_t *>(reinterpret_cast<uintptr_t>(all_args_buff) + args_size + |
| 80 | i * GetAppendArgsSizeOf())); | 80 | i * GetAppendArgsSizeOf())); |
| 81 | - FE_LOGD("Op[name=%s,type=%s]: append_args[%zu]=[%lu].", op_name.c_str(), op_type.c_str(), i, value); | 81 | + FE_LOGD("Op[name=%s, type=%s]: append_args[%zu]=[%lu].", op_name.c_str(), op_type.c_str(), i, value); |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -104,7 +104,7 @@ bool TbeKernelLaunch::KernelLaunch(const std::string &stub_func, const uint32_t | |||
| 104 | return false; | 104 | return false; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - FE_LOGD("[GenTask][KernelLaunch] stub_func_name is [%s].", stub_func.c_str()); | 107 | + FE_LOGD("[GenTask][KernelLaunch] stub_func_name is [%s]", stub_func.c_str()); |
| 108 | kernel_def->set_stub_func(stub_func); | 108 | kernel_def->set_stub_func(stub_func); |
| 109 | if (sm_desc != nullptr) { | 109 | if (sm_desc != nullptr) { |
| 110 | uintptr_t sm_desc_data = reinterpret_cast<uintptr_t>(sm_desc); | 110 | uintptr_t sm_desc_data = reinterpret_cast<uintptr_t>(sm_desc); |
| @@ -130,10 +130,10 @@ void SetSgtSliceShaeForEachTensor(size_t tensor_idx, int32_t thread_idx, const g | |||
| 130 | slice_dims_head_tail.emplace_back(slice_shape.GetDims()); | 130 | slice_dims_head_tail.emplace_back(slice_shape.GetDims()); |
| 131 | auto tensor = tensors.at(tensor_idx); | 131 | auto tensor = tensors.at(tensor_idx); |
| 132 | (void)ge::AttrUtils::SetListListInt(tensor, attr_name, slice_dims_head_tail); | 132 | (void)ge::AttrUtils::SetListListInt(tensor, attr_name, slice_dims_head_tail); |
| 133 | - FE_LOGD("Optype:%s, opname:%s, set thread %d's slice shape %s for tensor %s, tensor index %zu.", | 133 | + FE_LOGD("Optype: %s, opname: %s, set thread %d's slice shape %s for tensor %s, tensor index %zu.", |
| 134 | node->GetType().c_str(), node->GetName().c_str(), thread_idx, | 134 | node->GetType().c_str(), node->GetName().c_str(), thread_idx, |
| 135 | StringUtils::IntegerVecToString(slice_shape.GetDims()).c_str(), tensor->GetName().c_str(), tensor_idx); | 135 | StringUtils::IntegerVecToString(slice_shape.GetDims()).c_str(), tensor->GetName().c_str(), tensor_idx); |
| 136 | - FE_LOGD("Original shape is %s, shape is %s.", | 136 | + FE_LOGD("Original shape is %s, shape is %s", |
| 137 | StringUtils::IntegerVecToString(tensor->GetOriginShape().GetDims()).c_str(), | 137 | StringUtils::IntegerVecToString(tensor->GetOriginShape().GetDims()).c_str(), |
| 138 | StringUtils::IntegerVecToString(tensor->MutableShape().GetDims()).c_str()); | 138 | StringUtils::IntegerVecToString(tensor->MutableShape().GetDims()).c_str()); |
| 139 | } | 139 | } |
| @@ -196,7 +196,7 @@ Status TbeOpStoreAdapter::SerialPreCompileOp(vector<PreCompileNodePara> &compile | |||
| 196 | for (auto &comp_para : compile_para_vec) { | 196 | for (auto &comp_para : compile_para_vec) { |
| 197 | FE_CHECK(comp_para.node == nullptr, | 197 | FE_CHECK(comp_para.node == nullptr, |
| 198 | REPORT_FE_ERROR("[SubGraphOpt][Compile][SerialPreComOp] compPara.node is nullptr."), return FAILED); | 198 | REPORT_FE_ERROR("[SubGraphOpt][Compile][SerialPreComOp] compPara.node is nullptr."), return FAILED); |
| 199 | - FE_LOGD("TbeOpStoreAdapter::PreCompile Op begin, node name: %s, node type %s.", | 199 | + FE_LOGD("TbeOpStoreAdapter::PreCompile Op begin, node name: %s, node type: %s.", |
| 200 | comp_para.node->GetOpDesc()->GetName().c_str(), comp_para.node->GetOpDesc()->GetType().c_str()); | 200 | comp_para.node->GetOpDesc()->GetName().c_str(), comp_para.node->GetOpDesc()->GetType().c_str()); |
| 201 | 201 | ||
| 202 | TbeOpInfoPtr tbe_op_info_ptr = PreCompSetTbeOpInfo(comp_para); | 202 | TbeOpInfoPtr tbe_op_info_ptr = PreCompSetTbeOpInfo(comp_para); |
| @@ -59,7 +59,7 @@ bool NeedDisableVector(const ge::NodePtr node_ptr) { | |||
| 59 | return true; | 59 | return true; |
| 60 | } | 60 | } |
| 61 | if (ge::AttrUtils::HasAttr(node_ptr->GetOpDesc(), ge::ATTR_NAME_DISABLE_ATTACHED_RESOURCE)) { | 61 | if (ge::AttrUtils::HasAttr(node_ptr->GetOpDesc(), ge::ATTR_NAME_DISABLE_ATTACHED_RESOURCE)) { |
| 62 | - FE_LOGD("Node [%s] has been set to disabled.", node_ptr->GetNamePtr()); | 62 | + FE_LOGD("Node [%s] has been set to disabled", node_ptr->GetNamePtr()); |
| 63 | return true; | 63 | return true; |
| 64 | } | 64 | } |
| 65 | return false; | 65 | return false; |
| @@ -172,9 +172,9 @@ Status FEGraphOptimizer::Initialize(const std::map<string, string> &options, | |||
| 172 | 172 | ||
| 173 | init_flag_ = true; | 173 | init_flag_ = true; |
| 174 | optimize_utility_ = optimize_utility; | 174 | optimize_utility_ = optimize_utility; |
| 175 | - FE_LOGD("Begin to init FEGraphOptimizer in engine[%s].", graph_optimizer_attr_.engineName.c_str()); | 175 | + FE_LOGD("Begin to init FEGraphOptimizer in engine [%s].", graph_optimizer_attr_.engineName.c_str()); |
| 176 | // initialize op compiler | 176 | // initialize op compiler |
| 177 | - FE_CHECK(ops_kernel_info_store_ptr_ == nullptr, FE_LOGE("[GraphOpt][Init] opsKernelInfoStorePtr_ is NULL."), | 177 | + FE_CHECK(ops_kernel_info_store_ptr_ == nullptr, FE_LOGE("[GraphOpt][Init] opsKernelInfoStorePtr_ is nullptr."), |
| 178 | return FAILED); | 178 | return FAILED); |
| 179 | ops_kernel_info_store_ptr_->SetGeneralizeRelatedParam(optimize_utility, fusion_priority_mgr_ptr_); | 179 | ops_kernel_info_store_ptr_->SetGeneralizeRelatedParam(optimize_utility, fusion_priority_mgr_ptr_); |
| 180 | 180 | ||
| @@ -338,7 +338,7 @@ Status FEGraphOptimizer::OptimizeOriginalGraph(ge::ComputeGraph &graph) { | |||
| 338 | op_setter_ptr_->SetOpImplMode(graph); | 338 | op_setter_ptr_->SetOpImplMode(graph); |
| 339 | } | 339 | } |
| 340 | FE_TIMECOST_START(OptimizeOriginalGraph); | 340 | FE_TIMECOST_START(OptimizeOriginalGraph); |
| 341 | - FE_LOGD("Begin to optimize the original graph [%s] in engine [%s], with node size: %zu.", graph.GetName().c_str(), | 341 | + FE_LOGD("Begin to optimize the original graph [%s] in engine [%s], with node size [%zu].", graph.GetName().c_str(), |
| 342 | graph_optimizer_attr_.engineName.c_str(), graph.GetAllNodesSize()); | 342 | graph_optimizer_attr_.engineName.c_str(), graph.GetAllNodesSize()); |
| 343 | 343 | ||
| 344 | FE_TIMECOST_START(PruningPassFusion); | 344 | FE_TIMECOST_START(PruningPassFusion); |
| @@ -599,7 +599,7 @@ Status TbeJsonFileParseImpl::ParseFatbin(const ge::OpKernelBinPtr &fatbin, | |||
| 599 | } | 599 | } |
| 600 | if (fatbin_header_info.tilingKeyList.size() != tiling_key_num || | 600 | if (fatbin_header_info.tilingKeyList.size() != tiling_key_num || |
| 601 | fatbin_header_info.binOffsets.size() != tiling_key_num) { | 601 | fatbin_header_info.binOffsets.size() != tiling_key_num) { |
| 602 | - FE_LOGE("Tiling key list size %zu or bin offset list size %zu is not equal to tiling key num.", | 602 | + FE_LOGE("Tiling key list size %zu or bin offset list size %zu is not equal to tiling key num %zu.", |
| 603 | fatbin_header_info.tilingKeyList.size(), fatbin_header_info.binOffsets.size(), tiling_key_num); | 603 | fatbin_header_info.tilingKeyList.size(), fatbin_header_info.binOffsets.size(), tiling_key_num); |
| 604 | return FAILED; | 604 | return FAILED; |
| 605 | } | 605 | } |
| @@ -189,7 +189,7 @@ ge::GeShape OpAxisUpdateDesc::GetFractalZNewShape(const ge::GeShape &origin_shap | |||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | if (CheckInt64MulOverflow(axis_value[AXIS_W], axis_value[AXIS_H]) != SUCCESS) { | 191 | if (CheckInt64MulOverflow(axis_value[AXIS_W], axis_value[AXIS_H]) != SUCCESS) { |
| 192 | - FE_LOGW("Int64 addition of %ld and %ld can result in overflow!", axis_value[AXIS_W], axis_value[AXIS_H]); | 192 | + FE_LOGW("Int64 multiplication of %ld and %ld can result in overflow!", axis_value[AXIS_W], axis_value[AXIS_H]); |
| 193 | return origin_shape; | 193 | return origin_shape; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| @@ -197,7 +197,7 @@ ge::GeShape OpAxisUpdateDesc::GetFractalZNewShape(const ge::GeShape &origin_shap | |||
| 197 | int64_t axis_dhw = axis_value[AXIS_W] * axis_value[AXIS_H]; | 197 | int64_t axis_dhw = axis_value[AXIS_W] * axis_value[AXIS_H]; |
| 198 | if (primary_format == ge::FORMAT_FRACTAL_Z_3D) { | 198 | if (primary_format == ge::FORMAT_FRACTAL_Z_3D) { |
| 199 | if (CheckInt64MulOverflow(axis_dhw, axis_value[AXIS_D]) != SUCCESS) { | 199 | if (CheckInt64MulOverflow(axis_dhw, axis_value[AXIS_D]) != SUCCESS) { |
| 200 | - FE_LOGW("Int64 addition of %ld and %ld can result in overflow!", axis_dhw, axis_value[AXIS_D]); | 200 | + FE_LOGW("Int64 multiplication of %ld and %ld can result in overflow!", axis_dhw, axis_value[AXIS_D]); |
| 201 | return origin_shape; | 201 | return origin_shape; |
| 202 | } | 202 | } |
| 203 | axis_dhw *= axis_value[AXIS_D]; | 203 | axis_dhw *= axis_value[AXIS_D]; |
| @@ -47,7 +47,7 @@ Status GenerateCMOInvalidTask::GenerateTask(std::vector<domi::TaskDef> &task_def | |||
| 47 | cmo_id = static_cast<uint32_t>(CMOIdGenStrategy::Instance().GenerateCMOId(node_)); | 47 | cmo_id = static_cast<uint32_t>(CMOIdGenStrategy::Instance().GenerateCMOId(node_)); |
| 48 | } | 48 | } |
| 49 | if (cmo_id == 0) { | 49 | if (cmo_id == 0) { |
| 50 | - FE_LOGW("Failed to generate cmo id for mode [%s], cmo task not launched.", node_.GetName().c_str()); | 50 | + FE_LOGW("Failed to generate cmo id for node [%s], cmo task not launched.", node_.GetName().c_str()); |
| 51 | return FAILED; | 51 | return FAILED; |
| 52 | } | 52 | } |
| 53 | cmo_task_def->set_logic_id(cmo_id); | 53 | cmo_task_def->set_logic_id(cmo_id); |
| @@ -43,7 +43,7 @@ Status GenerateCMOPrefetchTask::GenerateTask(std::vector<domi::TaskDef> &task_de | |||
| 43 | // gen cmo id | 43 | // gen cmo id |
| 44 | uint32_t cmo_id = static_cast<uint32_t>(CMOIdGenStrategy::Instance().GenerateCMOId(node_)); | 44 | uint32_t cmo_id = static_cast<uint32_t>(CMOIdGenStrategy::Instance().GenerateCMOId(node_)); |
| 45 | if (cmo_id == 0) { | 45 | if (cmo_id == 0) { |
| 46 | - FE_LOGW("Failed to generate cmo id for mode [%s], cmo task not launched.", node_.GetName().c_str()); | 46 | + FE_LOGW("Failed to generate cmo id for node [%s], cmo task not launched.", node_.GetName().c_str()); |
| 47 | return FAILED; | 47 | return FAILED; |
| 48 | } | 48 | } |
| 49 | FE_LOGD("Generate prefetch cmo task id[%u] for node[%s] success.", cmo_id, node_.GetName().c_str()); | 49 | FE_LOGD("Generate prefetch cmo task id[%u] for node[%s] success.", cmo_id, node_.GetName().c_str()); |
| @@ -144,7 +144,7 @@ Status FftsTaskBuilder::GenCtxParamAndCtxType(const ge::Node &node, ffts::TaskBu | |||
| 144 | FE_CHECK_NOTNULL(ffts_task_builder_adapter_ptr); | 144 | FE_CHECK_NOTNULL(ffts_task_builder_adapter_ptr); |
| 145 | Status status = ffts_task_builder_adapter_ptr->Init(); | 145 | Status status = ffts_task_builder_adapter_ptr->Init(); |
| 146 | if (status != SUCCESS) { | 146 | if (status != SUCCESS) { |
| 147 | - REPORT_FE_ERROR("[FFTSPlusTaskBuidler][GenContextArgs][Node %s] Ffts plus Init ffts task builder adapter failed.", | 147 | + REPORT_FE_ERROR("[FFTSPlusTaskBuilder][GenContextArgs][Node %s] Ffts plus Init ffts task builder adapter failed.", |
| 148 | node.GetOpDesc()->GetName().c_str()); | 148 | node.GetOpDesc()->GetName().c_str()); |
| 149 | return status; | 149 | return status; |
| 150 | } | 150 | } |
| @@ -156,7 +156,7 @@ Status FftsTaskBuilder::GenCtxParamAndCtxType(const ge::Node &node, ffts::TaskBu | |||
| 156 | FE_CHECK_NOTNULL(task_builder_adapter_ptr); | 156 | FE_CHECK_NOTNULL(task_builder_adapter_ptr); |
| 157 | Status status = task_builder_adapter_ptr->Init(); | 157 | Status status = task_builder_adapter_ptr->Init(); |
| 158 | if (status != SUCCESS) { | 158 | if (status != SUCCESS) { |
| 159 | - REPORT_FE_ERROR("[FFTSPlusTaskBuidler][GenContextArgs][Node %s] Ffts plus init tbe task builder adapter failed.", | 159 | + REPORT_FE_ERROR("[FFTSPlusTaskBuilder][GenContextArgs][Node %s] Ffts plus init tbe task builder adapter failed.", |
| 160 | node.GetOpDesc()->GetName().c_str()); | 160 | node.GetOpDesc()->GetName().c_str()); |
| 161 | return status; | 161 | return status; |
| 162 | } | 162 | } |
| @@ -139,7 +139,8 @@ Status FeGraphUtils::GetNextInAnchorsOfSubNetOutput(const ge::NodePtr &net_outpu | |||
| 139 | auto input_desc = op_desc_ptr->GetInputDescPtr(input_index); | 139 | auto input_desc = op_desc_ptr->GetInputDescPtr(input_index); |
| 140 | uint32_t parent_index = -1; | 140 | uint32_t parent_index = -1; |
| 141 | if (!ge::AttrUtils::GetInt(input_desc, ge::ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { | 141 | if (!ge::AttrUtils::GetInt(input_desc, ge::ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { |
| 142 | - FE_LOGE(""); | 142 | + FE_LOGE("Node[%s] failed to get attr %s for input index %d.", op_desc_ptr->GetName().c_str(), |
| 143 | + ge::ATTR_NAME_PARENT_NODE_INDEX.c_str(), input_index); | ||
| 143 | return FAILED; | 144 | return FAILED; |
| 144 | } | 145 | } |
| 145 | 146 | ||
| @@ -379,10 +379,9 @@ Status OpSliceUtil::FillupReduceSliceInfo(ge::OpDescPtr op_desc_ptr, OpCalcInfo | |||
| 379 | 379 | ||
| 380 | Status OpSliceUtil::FillupResizeSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, | 380 | Status OpSliceUtil::FillupResizeSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, |
| 381 | const bool &sup_sw) { | 381 | const bool &sup_sw) { |
| 382 | - (void)op_desc_ptr; | ||
| 383 | (void)op_calc_info; | 382 | (void)op_calc_info; |
| 384 | (void)sup_sw; | 383 | (void)sup_sw; |
| 385 | - FE_LOGI("Does not support this slice pattern yet."); | 384 | + FE_LOGI("Does not support resize slice pattern yet, node[%s].", op_desc_ptr->GetName().c_str()); |
| 386 | return SUCCESS; | 385 | return SUCCESS; |
| 387 | } | 386 | } |
| 388 | 387 | ||
| @@ -394,10 +393,9 @@ Status OpSliceUtil::FillupResizeSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCal | |||
| 394 | */ | 393 | */ |
| 395 | Status OpSliceUtil::FillupScatterSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, | 394 | Status OpSliceUtil::FillupScatterSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, |
| 396 | const bool &sup_sw) { | 395 | const bool &sup_sw) { |
| 397 | - (void)op_desc_ptr; | ||
| 398 | (void)op_calc_info; | 396 | (void)op_calc_info; |
| 399 | (void)sup_sw; | 397 | (void)sup_sw; |
| 400 | - FE_LOGI("Does not support this slice pattern yet."); | 398 | + FE_LOGI("Does not support scatter slice pattern yet, node[%s].", op_desc_ptr->GetName().c_str()); |
| 401 | return SUCCESS; | 399 | return SUCCESS; |
| 402 | } | 400 | } |
| 403 | 401 | ||
| @@ -409,10 +407,9 @@ Status OpSliceUtil::FillupScatterSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCa | |||
| 409 | */ | 407 | */ |
| 410 | Status OpSliceUtil::FillupSegmentSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, | 408 | Status OpSliceUtil::FillupSegmentSliceInfo(ge::OpDescPtr op_desc_ptr, const OpCalcInfo &op_calc_info, |
| 411 | const bool &sup_sw) { | 409 | const bool &sup_sw) { |
| 412 | - (void)op_desc_ptr; | ||
| 413 | (void)op_calc_info; | 410 | (void)op_calc_info; |
| 414 | (void)sup_sw; | 411 | (void)sup_sw; |
| 415 | - FE_LOGI("Does not support this slice pattern yet."); | 412 | + FE_LOGI("Does not support segment slice pattern yet, node[%s].", op_desc_ptr->GetName().c_str()); |
| 416 | return SUCCESS; | 413 | return SUCCESS; |
| 417 | } | 414 | } |
| 418 | 415 | ||
| @@ -1422,7 +1422,7 @@ bool AssembleOpPrivateAttrs(const TbeOpInfo &opInfo, PyObject *&pyPrivateAttrs, | |||
| 1422 | int32_t index = 0; | 1422 | int32_t index = 0; |
| 1423 | bool result = AddAttrArgs(privateAttrs, pyPrivateAttrs, index, isSingleOpBuild, variableAttrs); | 1423 | bool result = AddAttrArgs(privateAttrs, pyPrivateAttrs, index, isSingleOpBuild, variableAttrs); |
| 1424 | TE_FUSION_CHECK((!result), { | 1424 | TE_FUSION_CHECK((!result), { |
| 1425 | - TE_FUSION_LOG_EXEC(TE_FUSION_LOG_ERROR, "Failed to add op pirvate attrs."); | 1425 | + TE_FUSION_LOG_EXEC(TE_FUSION_LOG_ERROR, "Failed to add op private attrs."); |
| 1426 | return false; | 1426 | return false; |
| 1427 | }); | 1427 | }); |
| 1428 | return true; | 1428 | return true; |
| @@ -1086,7 +1086,7 @@ Status QuantUtilImpl::SetAttrForRequantHostCpuOp(ge::OpDescPtr &req_host_op_desc | |||
| 1086 | const uint64_t *req_scale_data_int = reinterpret_cast<const uint64_t *>(req_scale_data_tmp); | 1086 | const uint64_t *req_scale_data_int = reinterpret_cast<const uint64_t *>(req_scale_data_tmp); |
| 1087 | for (int64_t i = 0; i < req_co; i++) { | 1087 | for (int64_t i = 0; i < req_co; i++) { |
| 1088 | const int8_t req_n = static_cast<int8_t>(GET_REQUANT_N(req_scale_data_int[i])); | 1088 | const int8_t req_n = static_cast<int8_t>(GET_REQUANT_N(req_scale_data_int[i])); |
| 1089 | - GELOGD("Qeq_scale N value[%ld] is %d", i, req_n); | 1089 | + GELOGD("Req_scale N value[%ld] is %d", i, req_n); |
| 1090 | if (req_n != 0) { | 1090 | if (req_n != 0) { |
| 1091 | (void)ge::AttrUtils::SetStr(req_host_op_desc, kAttrQuantMode, kQuantHighPerformance); | 1091 | (void)ge::AttrUtils::SetStr(req_host_op_desc, kAttrQuantMode, kQuantHighPerformance); |
| 1092 | break; | 1092 | break; |
| @@ -73,15 +73,15 @@ bool BuildOpInputTensors(const ge::NodePtr &node, const LowerInput &lower_input, | |||
| 73 | op_desc->GetTypePtr(), index); | 73 | op_desc->GetTypePtr(), index); |
| 74 | return false; | 74 | return false; |
| 75 | } | 75 | } |
| 76 | - GELOGD("ir input index of node [%s, %s]'s input[%zu] is [%zu].", op_desc->GetNamePtr(), op_desc->GetTypePtr(), | 76 | + GELOGD("ir input index of node[%s, %s]'s input[%zu] is [%zu]", op_desc->GetNamePtr(), op_desc->GetTypePtr(), index, |
| 77 | - index, ir_input_index); | 77 | + ir_input_index); |
| 78 | int32_t input_placement = functions->IsHostInput(ir_input_index) ? kOnHost : kOnDeviceHbm; | 78 | int32_t input_placement = functions->IsHostInput(ir_input_index) ? kOnHost : kOnDeviceHbm; |
| 79 | // remove last true | 79 | // remove last true |
| 80 | const OutputLowerResult *result = lower_result->GetOutputTensorResult( | 80 | const OutputLowerResult *result = lower_result->GetOutputTensorResult( |
| 81 | *lower_input.global_data, out_data_anchor->GetIdx(), {input_placement, node->GetOpDesc()->GetStreamId()}); | 81 | *lower_input.global_data, out_data_anchor->GetIdx(), {input_placement, node->GetOpDesc()->GetStreamId()}); |
| 82 | if (result == nullptr || result->shape == nullptr) { | 82 | if (result == nullptr || result->shape == nullptr) { |
| 83 | - GELOGE(ge::FAILED, "Lowering result or its shape of node [%s, %s] output[%d] is not null.", | 83 | + GELOGE(ge::FAILED, "Lowering result or its shape of node[%s, %s] output[%d] is null.", peer_node->GetNamePtr(), |
| 84 | - peer_node->GetNamePtr(), peer_node->GetTypePtr(), out_data_anchor->GetIdx()); | 84 | + peer_node->GetTypePtr(), out_data_anchor->GetIdx()); |
| 85 | return false; | 85 | return false; |
| 86 | } | 86 | } |
| 87 | op_exe_tensors.emplace_back(result->shape); | 87 | op_exe_tensors.emplace_back(result->shape); |
| @@ -203,7 +203,7 @@ bg::ValueHolderPtr CreateOpExecuteOption(const ge::NodePtr &node) { | |||
| 203 | // precision_mode | 203 | // precision_mode |
| 204 | execute_option.precision_mode = 0; | 204 | execute_option.precision_mode = 0; |
| 205 | if (!ge::AttrUtils::GetInt(node->GetOpDesc(), kAttrPrecisionModeEnum, execute_option.precision_mode)) { | 205 | if (!ge::AttrUtils::GetInt(node->GetOpDesc(), kAttrPrecisionModeEnum, execute_option.precision_mode)) { |
| 206 | - GELOGD("Do not get attr precision_mode_enum from node[%s, %s].", node->GetNamePtr(), node->GetTypePtr()); | 206 | + GELOGD("Do not get attr precision_mode_enum from node [%s, %s].", node->GetNamePtr(), node->GetTypePtr()); |
| 207 | } | 207 | } |
| 208 | GELOGD("Precision mode is [%d]", execute_option.precision_mode); | 208 | GELOGD("Precision mode is [%d]", execute_option.precision_mode); |
| 209 | 209 | ||
| @@ -215,7 +215,7 @@ bg::ValueHolderPtr CreateOpExecuteOption(const ge::NodePtr &node) { | |||
| 215 | execute_option.deterministic = attr_value == "1" ? 1 : 0; | 215 | execute_option.deterministic = attr_value == "1" ? 1 : 0; |
| 216 | attr_value.clear(); | 216 | attr_value.clear(); |
| 217 | } | 217 | } |
| 218 | - GELOGD("Deterministic is [%d]!", execute_option.deterministic); | 218 | + GELOGD("Deterministic is [%d]", execute_option.deterministic); |
| 219 | 219 | ||
| 220 | // allow_hf32 | 220 | // allow_hf32 |
| 221 | if (ge::AttrUtils::GetStr(node->GetOpDesc(), ge::ALLOW_HF32, attr_value) && !attr_value.empty()) { | 221 | if (ge::AttrUtils::GetStr(node->GetOpDesc(), ge::ALLOW_HF32, attr_value) && !attr_value.empty()) { |
| @@ -231,7 +231,7 @@ bg::ValueHolderPtr CreateOpExecuteOption(const ge::NodePtr &node) { | |||
| 231 | 231 | ||
| 232 | bg::ValueHolderPtr OpExecute(const ge::NodePtr &node, const LowerInput &lower_input, | 232 | bg::ValueHolderPtr OpExecute(const ge::NodePtr &node, const LowerInput &lower_input, |
| 233 | const std::vector<bg::ValueHolderPtr> &op_exe_tensors) { | 233 | const std::vector<bg::ValueHolderPtr> &op_exe_tensors) { |
| 234 | - GELOGI("Begin to do lowering for aclnn node[%s, %s], enter OpExecute.", node->GetNamePtr(), node->GetTypePtr()); | 234 | + GELOGI("Begin to do lowering for aclnn node[%s, %s], enter OpExecute", node->GetNamePtr(), node->GetTypePtr()); |
| 235 | // Allocate | 235 | // Allocate |
| 236 | auto allocator_holder = | 236 | auto allocator_holder = |
| 237 | lower_input.global_data->GetOrCreateAllocator({kOnDeviceHbm, AllocatorUsage::kAllocNodeWorkspace}); | 237 | lower_input.global_data->GetOrCreateAllocator({kOnDeviceHbm, AllocatorUsage::kAllocNodeWorkspace}); |
| @@ -267,7 +267,7 @@ bg::ValueHolderPtr OpExecute(const ge::NodePtr &node, const LowerInput &lower_in | |||
| 267 | 267 | ||
| 268 | bg::ValueHolderPtr Op2PhaseExecute(const ge::NodePtr &node, const LowerInput &lower_input, | 268 | bg::ValueHolderPtr Op2PhaseExecute(const ge::NodePtr &node, const LowerInput &lower_input, |
| 269 | const std::vector<bg::ValueHolderPtr> &op_exe_tensors) { | 269 | const std::vector<bg::ValueHolderPtr> &op_exe_tensors) { |
| 270 | - GELOGI("Begin to do lowering for aclnn node[%s, %s], enter Op2PhaseExecute.", node->GetNamePtr(), node->GetTypePtr()); | 270 | + GELOGI("Begin to do lowering for aclnn node[%s, %s], enter Op2PhaseExecute", node->GetNamePtr(), node->GetTypePtr()); |
| 271 | // Allocate | 271 | // Allocate |
| 272 | auto allocator_holder = | 272 | auto allocator_holder = |
| 273 | lower_input.global_data->GetOrCreateAllocator({kOnDeviceHbm, AllocatorUsage::kAllocNodeWorkspace}); | 273 | lower_input.global_data->GetOrCreateAllocator({kOnDeviceHbm, AllocatorUsage::kAllocNodeWorkspace}); |
| @@ -322,7 +322,7 @@ bg::ValueHolderPtr Op2PhaseExecute(const ge::NodePtr &node, const LowerInput &lo | |||
| 322 | } // namespace | 322 | } // namespace |
| 323 | 323 | ||
| 324 | LowerResult LoweringAclnnNode(const ge::NodePtr &node, const LowerInput &lower_input) { | 324 | LowerResult LoweringAclnnNode(const ge::NodePtr &node, const LowerInput &lower_input) { |
| 325 | - GELOGI("Begin to do lowering for aclnn node[%s, %s].", node->GetNamePtr(), node->GetTypePtr()); | 325 | + GELOGI("Begin to do lowering for aclnn node[%s, %s]", node->GetNamePtr(), node->GetTypePtr()); |
| 326 | HyperStatus ret = CheckLowerInput(lower_input); | 326 | HyperStatus ret = CheckLowerInput(lower_input); |
| 327 | if (!ret.IsSuccess()) { | 327 | if (!ret.IsSuccess()) { |
| 328 | return {ret, {}, {}, {}}; | 328 | return {ret, {}, {}, {}}; |
| @@ -342,7 +342,7 @@ LowerResult LoweringAclnnNode(const ge::NodePtr &node, const LowerInput &lower_i | |||
| 342 | std::vector<bg::ValueHolderPtr> op_exe_tensors; | 342 | std::vector<bg::ValueHolderPtr> op_exe_tensors; |
| 343 | std::vector<bg::ValueHolderPtr> op_exe_input_output_addrs; | 343 | std::vector<bg::ValueHolderPtr> op_exe_input_output_addrs; |
| 344 | if (!BuildOpInputTensors(node, lower_input, functions, op_exe_tensors, op_exe_input_output_addrs)) { | 344 | if (!BuildOpInputTensors(node, lower_input, functions, op_exe_tensors, op_exe_input_output_addrs)) { |
| 345 | - GELOGE(ge::FAILED, "Failed to build input tensors for node[%s, %s].", node->GetNamePtr(), node->GetTypePtr()); | 345 | + GELOGE(ge::FAILED, "Failed to build input tensors for node[%s, %s]!", node->GetNamePtr(), node->GetTypePtr()); |
| 346 | return {HyperStatus::ErrorStatus(static_cast<const char *>("Failed to build op input tensor.")), {}, {}, {}}; | 346 | return {HyperStatus::ErrorStatus(static_cast<const char *>("Failed to build op input tensor.")), {}, {}, {}}; |
| 347 | } | 347 | } |
| 348 | if (!BuildOpOutputTensors(node, output_shapes, output_addrs, op_exe_tensors, op_exe_input_output_addrs)) { | 348 | if (!BuildOpOutputTensors(node, output_shapes, output_addrs, op_exe_tensors, op_exe_input_output_addrs)) { |
| @@ -76,7 +76,7 @@ ge::ComputeGraphPtr GetOriginGraphFromUbNode(const ge::NodePtr &node) { | |||
| 76 | 76 | ||
| 77 | inline bool NodeSupportRollback(const ge::NodePtr &node) { | 77 | inline bool NodeSupportRollback(const ge::NodePtr &node) { |
| 78 | if (IsThirdClassOp(node->GetOpDesc())) { | 78 | if (IsThirdClassOp(node->GetOpDesc())) { |
| 79 | - GELOGD("Node[%s] is third class op, jump rollback aicpu.", node->GetName().c_str()); | 79 | + GELOGD("Node [%s] is third class op, jump rollback aicpu.", node->GetName().c_str()); |
| 80 | return false; | 80 | return false; |
| 81 | } | 81 | } |
| 82 | if (!node->GetOpDesc()->HasAttr(optiling::COMPILE_INFO_JSON)) { | 82 | if (!node->GetOpDesc()->HasAttr(optiling::COMPILE_INFO_JSON)) { |
| @@ -169,7 +169,7 @@ bool IsSingleOpScene(const ge::NodePtr &node) { | |||
| 169 | (void)ge::AttrUtils::GetBool(root_graph, ge::ATTR_SINGLE_OP_SCENE, is_single_op_scene); | 169 | (void)ge::AttrUtils::GetBool(root_graph, ge::ATTR_SINGLE_OP_SCENE, is_single_op_scene); |
| 170 | bool is_single_op_graph = false; | 170 | bool is_single_op_graph = false; |
| 171 | (void)ge::AttrUtils::GetBool(owner_graph, kFESingleOpScene, is_single_op_graph); | 171 | (void)ge::AttrUtils::GetBool(owner_graph, kFESingleOpScene, is_single_op_graph); |
| 172 | - GELOGD("Node[%s] single op flag %d, single op graph flag %d.", node->GetName().c_str(), is_single_op_scene, | 172 | + GELOGD("Node [%s] single op flag %d, single op graph flag %d", node->GetName().c_str(), is_single_op_scene, |
| 173 | is_single_op_graph); | 173 | is_single_op_graph); |
| 174 | return (is_single_op_scene && is_single_op_graph); | 174 | return (is_single_op_scene && is_single_op_graph); |
| 175 | } | 175 | } |
| @@ -484,7 +484,7 @@ ge::NodePtr BuildAtomicNode(const ge::NodePtr &origin_node, const bg::AtomicLowe | |||
| 484 | for (const auto &clean_size : output_clean_sizes) { | 484 | for (const auto &clean_size : output_clean_sizes) { |
| 485 | ss << clean_size << ","; | 485 | ss << clean_size << ","; |
| 486 | } | 486 | } |
| 487 | - GELOGI("[AIC_INFO] atomic node %s", ss.str().c_str()); | 487 | + GELOGI("[AIC_INFO] atomic node %s.", ss.str().c_str()); |
| 488 | return clean_node; | 488 | return clean_node; |
| 489 | } | 489 | } |
| 490 | 490 | ||
| @@ -684,10 +684,10 @@ bg::ValueHolderPtr LaunchAtomicByType(const ge::NodePtr &node, const LowerInput | |||
| 684 | std::shared_ptr<optiling::utils::OpRunInfo> tiling_info = nullptr; | 684 | std::shared_ptr<optiling::utils::OpRunInfo> tiling_info = nullptr; |
| 685 | tiling_info = node->GetOpDesc()->TryGetExtAttr(ge::ATTR_NAME_OP_RUN_INFO, tiling_info); | 685 | tiling_info = node->GetOpDesc()->TryGetExtAttr(ge::ATTR_NAME_OP_RUN_INFO, tiling_info); |
| 686 | if (!ge::AttrUtils::HasAttr(node->GetOpDesc(), optiling::ATOMIC_COMPILE_INFO_JSON) && tiling_info != nullptr) { | 686 | if (!ge::AttrUtils::HasAttr(node->GetOpDesc(), optiling::ATOMIC_COMPILE_INFO_JSON) && tiling_info != nullptr) { |
| 687 | - GELOGD("Node %s has no ATOMIC_COMPILE_INFO_JSON.", node->GetName().c_str()); | 687 | + GELOGD("Node %s has no ATOMIC_COMPILE_INFO_JSON", node->GetName().c_str()); |
| 688 | atomic_launch_holder = LaunchStaticAtomic(node, lower_input, compile_result, atomic_lowering_arg); | 688 | atomic_launch_holder = LaunchStaticAtomic(node, lower_input, compile_result, atomic_lowering_arg); |
| 689 | } else { | 689 | } else { |
| 690 | - GELOGD("Node %s has an ATOMIC_COMPILE_INFO_JSON.", node->GetNamePtr()); | 690 | + GELOGD("Node %s has an ATOMIC_COMPILE_INFO_JSON", node->GetNamePtr()); |
| 691 | atomic_launch_holder = LaunchAtomic(node, lower_input, compile_result, atomic_lowering_arg); | 691 | atomic_launch_holder = LaunchAtomic(node, lower_input, compile_result, atomic_lowering_arg); |
| 692 | } | 692 | } |
| 693 | return atomic_launch_holder; | 693 | return atomic_launch_holder; |
| @@ -92,7 +92,7 @@ ge::Status FFTSCalcAtomicOutputShapeSize(KernelContext *context) { | |||
| 92 | for (size_t i = 0; i < out_clean_size; ++i) { | 92 | for (size_t i = 0; i < out_clean_size; ++i) { |
| 93 | auto output_index = out_clean_vec[i]; | 93 | auto output_index = out_clean_vec[i]; |
| 94 | if (static_cast<size_t>(output_index) >= out_size) { | 94 | if (static_cast<size_t>(output_index) >= out_size) { |
| 95 | - KLOGE("Output index (%ld) is over then slice size(%zu).", output_index, out_size); | 95 | + KLOGE("Output index (%ld) exceeds slice size (%zu).", output_index, out_size); |
| 96 | return ge::GRAPH_FAILED; | 96 | return ge::GRAPH_FAILED; |
| 97 | } | 97 | } |
| 98 | auto tensor = compute_node_info->GetOutputTdInfo(output_index); | 98 | auto tensor = compute_node_info->GetOutputTdInfo(output_index); |
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | 25 | ||
| @@ -28,6 +29,100 @@ | |||
| 28 | 29 | ||
| 29 | using namespace fe; | 30 | using namespace fe; |
| 30 | using namespace ge; | 31 | using namespace ge; |
| 32 | + | ||
| 33 | +struct CmoGraphCtx { | ||
| 34 | + ge::ComputeGraphPtr graph; | ||
| 35 | + ge::OpDescPtr data; | ||
| 36 | + ge::OpDescPtr const1; | ||
| 37 | + ge::OpDescPtr add1; | ||
| 38 | + ge::OpDescPtr const2; | ||
| 39 | + ge::OpDescPtr mul1; | ||
| 40 | + ge::OpDescPtr const3; | ||
| 41 | + ge::OpDescPtr add2; | ||
| 42 | + ge::OpDescPtr const4; | ||
| 43 | + ge::OpDescPtr mul2; | ||
| 44 | + ge::OpDescPtr netoutput; | ||
| 45 | + ge::NodePtr data_node; | ||
| 46 | + ge::NodePtr const1_node; | ||
| 47 | + ge::NodePtr add1_node; | ||
| 48 | + ge::NodePtr const2_node; | ||
| 49 | + ge::NodePtr mul1_node; | ||
| 50 | + ge::NodePtr const3_node; | ||
| 51 | + ge::NodePtr add2_node; | ||
| 52 | + ge::NodePtr const4_node; | ||
| 53 | + ge::NodePtr mul2_node; | ||
| 54 | + ge::NodePtr netoutput_node; | ||
| 55 | +}; | ||
| 56 | + | ||
| 57 | +static void InitCmoOpDescs(CmoGraphCtx &ctx, const std::vector<int64_t> &dim, int64_t tensor_size) { | ||
| 58 | + ctx.data = std::make_shared<ge::OpDesc>("data1", "Data"); | ||
| 59 | + ctx.const1 = std::make_shared<ge::OpDesc>("const1", "Const"); | ||
| 60 | + ctx.add1 = std::make_shared<ge::OpDesc>("add1", "Add"); | ||
| 61 | + ctx.const2 = std::make_shared<ge::OpDesc>("const2", "Const"); | ||
| 62 | + ctx.mul1 = std::make_shared<ge::OpDesc>("mul1", "Mul"); | ||
| 63 | + ctx.const3 = std::make_shared<ge::OpDesc>("const3", "Const"); | ||
| 64 | + ctx.add2 = std::make_shared<ge::OpDesc>("add2", "Add"); | ||
| 65 | + ctx.const4 = std::make_shared<ge::OpDesc>("const4", "Const"); | ||
| 66 | + ctx.mul2 = std::make_shared<ge::OpDesc>("mul2", "Mul"); | ||
| 67 | + ctx.netoutput = std::make_shared<ge::OpDesc>("netoutput", "NetOutput"); | ||
| 68 | + GeShape shape(dim); | ||
| 69 | + GeTensorDesc out_desc(shape); | ||
| 70 | + ge::TensorUtils::SetSize(out_desc, tensor_size); | ||
| 71 | + ctx.data->AddOutputDesc(out_desc); | ||
| 72 | + ctx.const1->AddOutputDesc(out_desc); | ||
| 73 | + ctx.const2->AddOutputDesc(out_desc); | ||
| 74 | + ctx.const3->AddOutputDesc(out_desc); | ||
| 75 | + ctx.const4->AddOutputDesc(out_desc); | ||
| 76 | + ctx.add1->AddInputDesc(out_desc); | ||
| 77 | + ctx.add1->AddInputDesc(out_desc); | ||
| 78 | + ctx.add1->AddOutputDesc(out_desc); | ||
| 79 | + ctx.mul1->AddInputDesc(out_desc); | ||
| 80 | + ctx.mul1->AddInputDesc(out_desc); | ||
| 81 | + ctx.mul1->AddOutputDesc(out_desc); | ||
| 82 | + ctx.add2->AddInputDesc(out_desc); | ||
| 83 | + ctx.add2->AddInputDesc(out_desc); | ||
| 84 | + ctx.add2->AddOutputDesc(out_desc); | ||
| 85 | + ctx.mul2->AddInputDesc(out_desc); | ||
| 86 | + ctx.mul2->AddInputDesc(out_desc); | ||
| 87 | + ctx.mul2->AddOutputDesc(out_desc); | ||
| 88 | + ctx.netoutput->AddInputDesc(out_desc); | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +static CmoGraphCtx BuildCmoTestGraph(const std::vector<int64_t> &dim, int64_t tensor_size, bool magic_on_mul1) { | ||
| 92 | + CmoGraphCtx ctx; | ||
| 93 | + ctx.graph = std::make_shared<ge::ComputeGraph>("test"); | ||
| 94 | + InitCmoOpDescs(ctx, dim, tensor_size); | ||
| 95 | + ctx.data_node = ctx.graph->AddNode(ctx.data); | ||
| 96 | + ctx.const1_node = ctx.graph->AddNode(ctx.const1); | ||
| 97 | + ctx.const2_node = ctx.graph->AddNode(ctx.const2); | ||
| 98 | + ctx.const3_node = ctx.graph->AddNode(ctx.const3); | ||
| 99 | + ctx.const4_node = ctx.graph->AddNode(ctx.const4); | ||
| 100 | + ctx.add1_node = ctx.graph->AddNode(ctx.add1); | ||
| 101 | + ctx.mul1_node = ctx.graph->AddNode(ctx.mul1); | ||
| 102 | + ctx.add2_node = ctx.graph->AddNode(ctx.add2); | ||
| 103 | + ctx.mul2_node = ctx.graph->AddNode(ctx.mul2); | ||
| 104 | + ctx.netoutput_node = ctx.graph->AddNode(ctx.netoutput); | ||
| 105 | + if (magic_on_mul1) { | ||
| 106 | + (void)ge::AttrUtils::SetStr(ctx.mul1, "tvm_magic", "RT_DEV_BINARY_MAGIC_ELF"); | ||
| 107 | + ge::AnchorUtils::SetStatus(ctx.mul1_node->GetInDataAnchor(0), ge::ANCHOR_DATA); | ||
| 108 | + ge::AnchorUtils::SetStatus(ctx.mul1_node->GetInDataAnchor(1), ge::ANCHOR_DATA); | ||
| 109 | + } else { | ||
| 110 | + (void)ge::AttrUtils::SetStr(ctx.add1, "tvm_magic", "RT_DEV_BINARY_MAGIC_ELF"); | ||
| 111 | + ge::AnchorUtils::SetStatus(ctx.add1_node->GetInDataAnchor(0), ge::ANCHOR_DATA); | ||
| 112 | + ge::AnchorUtils::SetStatus(ctx.add1_node->GetInDataAnchor(1), ge::ANCHOR_DATA); | ||
| 113 | + } | ||
| 114 | + (void)ge::GraphUtils::AddEdge(ctx.data_node->GetOutDataAnchor(0), ctx.add1_node->GetInDataAnchor(0)); | ||
| 115 | + (void)ge::GraphUtils::AddEdge(ctx.const1_node->GetOutDataAnchor(0), ctx.add1_node->GetInDataAnchor(1)); | ||
| 116 | + (void)ge::GraphUtils::AddEdge(ctx.add1_node->GetOutDataAnchor(0), ctx.mul1_node->GetInDataAnchor(0)); | ||
| 117 | + (void)ge::GraphUtils::AddEdge(ctx.const2_node->GetOutDataAnchor(0), ctx.mul1_node->GetInDataAnchor(1)); | ||
| 118 | + (void)ge::GraphUtils::AddEdge(ctx.mul1_node->GetOutDataAnchor(0), ctx.add2_node->GetInDataAnchor(0)); | ||
| 119 | + (void)ge::GraphUtils::AddEdge(ctx.const3_node->GetOutDataAnchor(0), ctx.add2_node->GetInDataAnchor(1)); | ||
| 120 | + (void)ge::GraphUtils::AddEdge(ctx.add2_node->GetOutDataAnchor(0), ctx.mul2_node->GetInDataAnchor(0)); | ||
| 121 | + (void)ge::GraphUtils::AddEdge(ctx.const4_node->GetOutDataAnchor(0), ctx.mul2_node->GetInDataAnchor(1)); | ||
| 122 | + (void)ge::GraphUtils::AddEdge(ctx.mul2_node->GetOutDataAnchor(0), ctx.netoutput_node->GetInDataAnchor(0)); | ||
| 123 | + return ctx; | ||
| 124 | +} | ||
| 125 | + | ||
| 31 | class CMOTaskBuilderSTest : public testing::Test { | 126 | class CMOTaskBuilderSTest : public testing::Test { |
| 32 | protected: | 127 | protected: |
| 33 | void SetUp() {} | 128 | void SetUp() {} |
| @@ -107,6 +202,39 @@ TEST_F(CMOTaskBuilderSTest, cmo_task_builder_prefetch) { | |||
| 107 | EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*add1_node, task_defs, context, true), SUCCESS); | 202 | EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*add1_node, task_defs, context, true), SUCCESS); |
| 108 | } | 203 | } |
| 109 | 204 | ||
| 205 | +TEST_F(CMOTaskBuilderSTest, cmo_task_builder_prefetch_cmo_id_exhausted) { | ||
| 206 | + auto ctx = BuildCmoTestGraph({16, 16, 16, 16}, 262176, true); | ||
| 207 | + CmoExtraAttr add1_cmo_ext_attr = {{kCmoPrefetch, {{ctx.mul1_node, CmoTypeObject::INPUT, 1}}}}; | ||
| 208 | + ctx.add1->SetExtAttr("cmo_", add1_cmo_ext_attr); | ||
| 209 | + ctx.mul1->SetInputOffset({256, 512}); | ||
| 210 | + ctx.mul1->SetOutputOffset({1024}); | ||
| 211 | + ctx.mul1->SetWorkspaceBytes({256}); | ||
| 212 | + ctx.mul1->SetWorkspace({2048}); | ||
| 213 | + CMOIdGenStrategy::Instance().UpdateReuseMap(-1, 0); | ||
| 214 | + std::vector<domi::TaskDef> task_defs; | ||
| 215 | + TaskBuilderContext context; | ||
| 216 | + context.dataMemSize = 2048 * 1000; | ||
| 217 | + CMOTaskBuilderPtr cmo_task_builder_ptr = std::make_shared<CMOTaskBuilder>(); | ||
| 218 | + EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*ctx.add1_node, task_defs, context, true), FAILED); | ||
| 219 | + (void)CMOIdGenStrategy::Instance().Finalize(); | ||
| 220 | +} | ||
| 221 | + | ||
| 222 | +TEST_F(CMOTaskBuilderSTest, cmo_task_builder_invalid_cmo_id_zero) { | ||
| 223 | + auto ctx = BuildCmoTestGraph(std::vector<int64_t>(4, 4), 1056, false); | ||
| 224 | + CmoExtraAttr mul1_cmo_ext_attr = {{kCmoInvalid, {{ctx.add1_node, CmoTypeObject::INPUT, 1}}}}; | ||
| 225 | + ctx.mul1->SetExtAttr("cmo_", mul1_cmo_ext_attr); | ||
| 226 | + ctx.add1->SetInputOffset({256, 512}); | ||
| 227 | + ctx.add1->SetOutputOffset({1024}); | ||
| 228 | + ctx.add1->SetWorkspaceBytes({256}); | ||
| 229 | + ctx.add1->SetWorkspace({2048}); | ||
| 230 | + (void)ge::AttrUtils::SetInt(ctx.add1->MutableInputDesc(1), "_complex_cmo_id", static_cast<int64_t>(0x100000000)); | ||
| 231 | + std::vector<domi::TaskDef> task_defs; | ||
| 232 | + TaskBuilderContext context; | ||
| 233 | + context.dataMemSize = 2048 * 1000; | ||
| 234 | + CMOTaskBuilderPtr cmo_task_builder_ptr = std::make_shared<CMOTaskBuilder>(); | ||
| 235 | + EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*ctx.mul1_node, task_defs, context, false), FAILED); | ||
| 236 | +} | ||
| 237 | + | ||
| 110 | TEST_F(CMOTaskBuilderSTest, cmo_task_builder_invalid) { | 238 | TEST_F(CMOTaskBuilderSTest, cmo_task_builder_invalid) { |
| 111 | ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); | 239 | ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); |
| 112 | ge::OpDescPtr data = std::make_shared<ge::OpDesc>("data1", "Data"); | 240 | ge::OpDescPtr data = std::make_shared<ge::OpDesc>("data1", "Data"); |
| @@ -289,7 +289,7 @@ TEST_F(STEST_fusion_engine_dsa_graph_optimizer, optimize_original_graph) { | |||
| 289 | EXPECT_EQ(fe_impl_type, static_cast<OpImplType>(EN_IMPL_HW_DSA)); | 289 | EXPECT_EQ(fe_impl_type, static_cast<OpImplType>(EN_IMPL_HW_DSA)); |
| 290 | std::string op_slice_info; | 290 | std::string op_slice_info; |
| 291 | (void)ge::AttrUtils::GetStr(node->GetOpDesc(), OP_SLICE_INFO, op_slice_info); | 291 | (void)ge::AttrUtils::GetStr(node->GetOpDesc(), OP_SLICE_INFO, op_slice_info); |
| 292 | - std::cout << "Node DSAGenBitMask slice info is:" << op_slice_info << endl; | 292 | + std::cout << "Node DSAGenBitMask slice info is: " << op_slice_info << endl; |
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| 295 | } | 295 | } |
| @@ -335,7 +335,7 @@ TEST_F(STEST_fusion_engine_dsa_graph_optimizer, optimize_original_graph1) { | |||
| 335 | EXPECT_EQ(fe_impl_type, static_cast<OpImplType>(EN_IMPL_HW_DSA)); | 335 | EXPECT_EQ(fe_impl_type, static_cast<OpImplType>(EN_IMPL_HW_DSA)); |
| 336 | std::string op_slice_info; | 336 | std::string op_slice_info; |
| 337 | (void)ge::AttrUtils::GetStr(node->GetOpDesc(), OP_SLICE_INFO, op_slice_info); | 337 | (void)ge::AttrUtils::GetStr(node->GetOpDesc(), OP_SLICE_INFO, op_slice_info); |
| 338 | - std::cout << "Node DSAGenBitMask slice info is:" << op_slice_info << endl; | 338 | + std::cout << "Node DSAGenBitMask slice info is: " << op_slice_info << endl; |
| 339 | } | 339 | } |
| 340 | } | 340 | } |
| 341 | } | 341 | } |
| @@ -411,3 +411,33 @@ TEST_F(FFTSTaskBuilderAdapterSTest, gen_dyn_and_opt_mix_l2_taskdef1) { | |||
| 411 | EXPECT_STRNE(args_str.c_str(), | 411 | EXPECT_STRNE(args_str.c_str(), |
| 412 | "{i_desc0}{i1*}{i2*}{i_desc3}{i4*}{i5*}{i6*}{o_desc0}{o1*}{o_desc2}{ws*}{t_ffts.tail}"); | 412 | "{i_desc0}{i1*}{i2*}{i_desc3}{i4*}{i5*}{i6*}{o_desc0}{o1*}{o_desc2}{ws*}{t_ffts.tail}"); |
| 413 | } | 413 | } |
| 414 | + | ||
| 415 | +TEST_F(FFTSTaskBuilderAdapterSTest, GenCtxParamAndCtxType_AutoModeInitFailed) { | ||
| 416 | + auto node = CreateNode(); | ||
| 417 | + ffts::ThreadSliceMapPtr slice_info_ptr; | ||
| 418 | + slice_info_ptr = node->GetOpDesc()->TryGetExtAttr(ffts::kAttrSgtStructInfo, slice_info_ptr); | ||
| 419 | + ASSERT_NE(slice_info_ptr, nullptr); | ||
| 420 | + slice_info_ptr->thread_mode = static_cast<uint32_t>(ffts::ThreadMode::AUTO_THREAD); | ||
| 421 | + (void)ge::AttrUtils::SetInt(node->GetOpDesc(), fe::NON_TAIL_WORKSPACE_SIZE, 10); | ||
| 422 | + node->GetOpDesc()->SetWorkspaceBytes({100000}); | ||
| 423 | + | ||
| 424 | + FftsTaskBuilderPtr ffts_task_builder = std::make_shared<FftsTaskBuilder>(); | ||
| 425 | + ffts_task_builder->context_ = context_; | ||
| 426 | + | ||
| 427 | + ffts::TaskBuilderType ctx_type; | ||
| 428 | + Status ret = ffts_task_builder->GenCtxParamAndCtxType(*node, ctx_type); | ||
| 429 | + EXPECT_NE(fe::SUCCESS, ret); | ||
| 430 | +} | ||
| 431 | + | ||
| 432 | +TEST_F(FFTSTaskBuilderAdapterSTest, GenCtxParamAndCtxType_ManualModeInitFailed) { | ||
| 433 | + auto node = CreateNode(); | ||
| 434 | + (void)ge::AttrUtils::SetInt(node->GetOpDesc(), fe::NON_TAIL_WORKSPACE_SIZE, 10); | ||
| 435 | + node->GetOpDesc()->SetWorkspaceBytes({100000}); | ||
| 436 | + | ||
| 437 | + FftsTaskBuilderPtr ffts_task_builder = std::make_shared<FftsTaskBuilder>(); | ||
| 438 | + ffts_task_builder->context_ = context_; | ||
| 439 | + | ||
| 440 | + ffts::TaskBuilderType ctx_type; | ||
| 441 | + Status ret = ffts_task_builder->GenCtxParamAndCtxType(*node, ctx_type); | ||
| 442 | + EXPECT_NE(fe::SUCCESS, ret); | ||
| 443 | +} | ||
| @@ -674,4 +674,16 @@ TEST_F(GRAPH_FUSION_ST, converage_20) { | |||
| 674 | } | 674 | } |
| 675 | system(("rm -rf " + current_dir + "plugin").c_str()); | 675 | system(("rm -rf " + current_dir + "plugin").c_str()); |
| 676 | } | 676 | } |
| 677 | + | ||
| 678 | +TEST_F(GRAPH_FUSION_ST, GetNextInAnchorsOfSubNetOutput_NoParentNodeIndex) { | ||
| 679 | + ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); | ||
| 680 | + ge::OpDescPtr netoutput_op = std::make_shared<ge::OpDesc>("netoutput", "NetOutput"); | ||
| 681 | + GeTensorDesc tensor_desc(GeShape({1}), ge::FORMAT_NCHW, ge::DT_FLOAT); | ||
| 682 | + netoutput_op->AddInputDesc(tensor_desc); | ||
| 683 | + ge::NodePtr netoutput_node = graph->AddNode(netoutput_op); | ||
| 684 | + | ||
| 685 | + std::vector<ge::InDataAnchorPtr> next_in_data_anchors; | ||
| 686 | + Status ret = FeGraphUtils::GetNextInAnchorsOfSubNetOutput(netoutput_node, 0, next_in_data_anchors); | ||
| 687 | + EXPECT_EQ(ret, FAILED); | ||
| 688 | +} | ||
| 677 | } // namespace fe | 689 | } // namespace fe |
| @@ -87,7 +87,7 @@ void CreateDir(const std::string &kernelMetaTempDir) { | |||
| 87 | if (realPath.empty()) { | 87 | if (realPath.empty()) { |
| 88 | int32_t ret = mkdir(const_cast<char *>(kernelMetaTempDir.c_str()), S_IRWXU | S_IRGRP | S_IXGRP); | 88 | int32_t ret = mkdir(const_cast<char *>(kernelMetaTempDir.c_str()), S_IRWXU | S_IRGRP | S_IXGRP); |
| 89 | if (ret != 0) { | 89 | if (ret != 0) { |
| 90 | - printf("Creat dir[%s] failed, %s.", kernelMetaTempDir.c_str(), strerror(errno)); | 90 | + printf("Create dir[%s] failed, %s.", kernelMetaTempDir.c_str(), strerror(errno)); |
| 91 | return; | 91 | return; |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| @@ -374,7 +374,7 @@ TEST(TEST_TEFUSION_ST, OpSetArgsToNode) { | |||
| 374 | std::string jsonPath = currentFilePath + "/test_files/kernel_meta/accumulate.json"; | 374 | std::string jsonPath = currentFilePath + "/test_files/kernel_meta/accumulate.json"; |
| 375 | 375 | ||
| 376 | if (te::fusion::RealPath(jsonPath).empty()) { | 376 | if (te::fusion::RealPath(jsonPath).empty()) { |
| 377 | - printf("jsonPath=%s is not exist!\n", jsonPath.c_str()); | 377 | + printf("jsonPath=%s does not exist!\n", jsonPath.c_str()); |
| 378 | } else { | 378 | } else { |
| 379 | std::ifstream ifs(jsonPath); | 379 | std::ifstream ifs(jsonPath); |
| 380 | if (!ifs.is_open()) { | 380 | if (!ifs.is_open()) { |
Mtests/engines/nn_engine/ut/testcase/fusion_engine/cmo_task_builder/cmo_task_builder_unittest.cc+128-0
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | 25 | ||
| @@ -28,6 +29,100 @@ | |||
| 28 | 29 | ||
| 29 | using namespace fe; | 30 | using namespace fe; |
| 30 | using namespace ge; | 31 | using namespace ge; |
| 32 | + | ||
| 33 | +struct CmoGraphCtx { | ||
| 34 | + ge::ComputeGraphPtr graph; | ||
| 35 | + ge::OpDescPtr data; | ||
| 36 | + ge::OpDescPtr const1; | ||
| 37 | + ge::OpDescPtr add1; | ||
| 38 | + ge::OpDescPtr const2; | ||
| 39 | + ge::OpDescPtr mul1; | ||
| 40 | + ge::OpDescPtr const3; | ||
| 41 | + ge::OpDescPtr add2; | ||
| 42 | + ge::OpDescPtr const4; | ||
| 43 | + ge::OpDescPtr mul2; | ||
| 44 | + ge::OpDescPtr netoutput; | ||
| 45 | + ge::NodePtr data_node; | ||
| 46 | + ge::NodePtr const1_node; | ||
| 47 | + ge::NodePtr add1_node; | ||
| 48 | + ge::NodePtr const2_node; | ||
| 49 | + ge::NodePtr mul1_node; | ||
| 50 | + ge::NodePtr const3_node; | ||
| 51 | + ge::NodePtr add2_node; | ||
| 52 | + ge::NodePtr const4_node; | ||
| 53 | + ge::NodePtr mul2_node; | ||
| 54 | + ge::NodePtr netoutput_node; | ||
| 55 | +}; | ||
| 56 | + | ||
| 57 | +static void InitCmoOpDescs(CmoGraphCtx &ctx, const std::vector<int64_t> &dim, int64_t tensor_size) { | ||
| 58 | + ctx.data = std::make_shared<ge::OpDesc>("data1", "Data"); | ||
| 59 | + ctx.const1 = std::make_shared<ge::OpDesc>("const1", "Const"); | ||
| 60 | + ctx.add1 = std::make_shared<ge::OpDesc>("add1", "Add"); | ||
| 61 | + ctx.const2 = std::make_shared<ge::OpDesc>("const2", "Const"); | ||
| 62 | + ctx.mul1 = std::make_shared<ge::OpDesc>("mul1", "Mul"); | ||
| 63 | + ctx.const3 = std::make_shared<ge::OpDesc>("const3", "Const"); | ||
| 64 | + ctx.add2 = std::make_shared<ge::OpDesc>("add2", "Add"); | ||
| 65 | + ctx.const4 = std::make_shared<ge::OpDesc>("const4", "Const"); | ||
| 66 | + ctx.mul2 = std::make_shared<ge::OpDesc>("mul2", "Mul"); | ||
| 67 | + ctx.netoutput = std::make_shared<ge::OpDesc>("netoutput", "NetOutput"); | ||
| 68 | + GeShape shape(dim); | ||
| 69 | + GeTensorDesc out_desc(shape); | ||
| 70 | + ge::TensorUtils::SetSize(out_desc, tensor_size); | ||
| 71 | + ctx.data->AddOutputDesc(out_desc); | ||
| 72 | + ctx.const1->AddOutputDesc(out_desc); | ||
| 73 | + ctx.const2->AddOutputDesc(out_desc); | ||
| 74 | + ctx.const3->AddOutputDesc(out_desc); | ||
| 75 | + ctx.const4->AddOutputDesc(out_desc); | ||
| 76 | + ctx.add1->AddInputDesc(out_desc); | ||
| 77 | + ctx.add1->AddInputDesc(out_desc); | ||
| 78 | + ctx.add1->AddOutputDesc(out_desc); | ||
| 79 | + ctx.mul1->AddInputDesc(out_desc); | ||
| 80 | + ctx.mul1->AddInputDesc(out_desc); | ||
| 81 | + ctx.mul1->AddOutputDesc(out_desc); | ||
| 82 | + ctx.add2->AddInputDesc(out_desc); | ||
| 83 | + ctx.add2->AddInputDesc(out_desc); | ||
| 84 | + ctx.add2->AddOutputDesc(out_desc); | ||
| 85 | + ctx.mul2->AddInputDesc(out_desc); | ||
| 86 | + ctx.mul2->AddInputDesc(out_desc); | ||
| 87 | + ctx.mul2->AddOutputDesc(out_desc); | ||
| 88 | + ctx.netoutput->AddInputDesc(out_desc); | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +static CmoGraphCtx BuildCmoTestGraph(const std::vector<int64_t> &dim, int64_t tensor_size, bool magic_on_mul1) { | ||
| 92 | + CmoGraphCtx ctx; | ||
| 93 | + ctx.graph = std::make_shared<ge::ComputeGraph>("test"); | ||
| 94 | + InitCmoOpDescs(ctx, dim, tensor_size); | ||
| 95 | + ctx.data_node = ctx.graph->AddNode(ctx.data); | ||
| 96 | + ctx.const1_node = ctx.graph->AddNode(ctx.const1); | ||
| 97 | + ctx.const2_node = ctx.graph->AddNode(ctx.const2); | ||
| 98 | + ctx.const3_node = ctx.graph->AddNode(ctx.const3); | ||
| 99 | + ctx.const4_node = ctx.graph->AddNode(ctx.const4); | ||
| 100 | + ctx.add1_node = ctx.graph->AddNode(ctx.add1); | ||
| 101 | + ctx.mul1_node = ctx.graph->AddNode(ctx.mul1); | ||
| 102 | + ctx.add2_node = ctx.graph->AddNode(ctx.add2); | ||
| 103 | + ctx.mul2_node = ctx.graph->AddNode(ctx.mul2); | ||
| 104 | + ctx.netoutput_node = ctx.graph->AddNode(ctx.netoutput); | ||
| 105 | + if (magic_on_mul1) { | ||
| 106 | + (void)ge::AttrUtils::SetStr(ctx.mul1, "tvm_magic", "RT_DEV_BINARY_MAGIC_ELF"); | ||
| 107 | + ge::AnchorUtils::SetStatus(ctx.mul1_node->GetInDataAnchor(0), ge::ANCHOR_DATA); | ||
| 108 | + ge::AnchorUtils::SetStatus(ctx.mul1_node->GetInDataAnchor(1), ge::ANCHOR_DATA); | ||
| 109 | + } else { | ||
| 110 | + (void)ge::AttrUtils::SetStr(ctx.add1, "tvm_magic", "RT_DEV_BINARY_MAGIC_ELF"); | ||
| 111 | + ge::AnchorUtils::SetStatus(ctx.add1_node->GetInDataAnchor(0), ge::ANCHOR_DATA); | ||
| 112 | + ge::AnchorUtils::SetStatus(ctx.add1_node->GetInDataAnchor(1), ge::ANCHOR_DATA); | ||
| 113 | + } | ||
| 114 | + (void)ge::GraphUtils::AddEdge(ctx.data_node->GetOutDataAnchor(0), ctx.add1_node->GetInDataAnchor(0)); | ||
| 115 | + (void)ge::GraphUtils::AddEdge(ctx.const1_node->GetOutDataAnchor(0), ctx.add1_node->GetInDataAnchor(1)); | ||
| 116 | + (void)ge::GraphUtils::AddEdge(ctx.add1_node->GetOutDataAnchor(0), ctx.mul1_node->GetInDataAnchor(0)); | ||
| 117 | + (void)ge::GraphUtils::AddEdge(ctx.const2_node->GetOutDataAnchor(0), ctx.mul1_node->GetInDataAnchor(1)); | ||
| 118 | + (void)ge::GraphUtils::AddEdge(ctx.mul1_node->GetOutDataAnchor(0), ctx.add2_node->GetInDataAnchor(0)); | ||
| 119 | + (void)ge::GraphUtils::AddEdge(ctx.const3_node->GetOutDataAnchor(0), ctx.add2_node->GetInDataAnchor(1)); | ||
| 120 | + (void)ge::GraphUtils::AddEdge(ctx.add2_node->GetOutDataAnchor(0), ctx.mul2_node->GetInDataAnchor(0)); | ||
| 121 | + (void)ge::GraphUtils::AddEdge(ctx.const4_node->GetOutDataAnchor(0), ctx.mul2_node->GetInDataAnchor(1)); | ||
| 122 | + (void)ge::GraphUtils::AddEdge(ctx.mul2_node->GetOutDataAnchor(0), ctx.netoutput_node->GetInDataAnchor(0)); | ||
| 123 | + return ctx; | ||
| 124 | +} | ||
| 125 | + | ||
| 31 | class CMOTaskBuilderTest : public testing::Test { | 126 | class CMOTaskBuilderTest : public testing::Test { |
| 32 | protected: | 127 | protected: |
| 33 | void SetUp() {} | 128 | void SetUp() {} |
| @@ -107,6 +202,39 @@ TEST_F(CMOTaskBuilderTest, cmo_task_builder_prefetch) { | |||
| 107 | EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*add1_node, task_defs, context, true), SUCCESS); | 202 | EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*add1_node, task_defs, context, true), SUCCESS); |
| 108 | } | 203 | } |
| 109 | 204 | ||
| 205 | +TEST_F(CMOTaskBuilderTest, cmo_task_builder_prefetch_cmo_id_exhausted) { | ||
| 206 | + auto ctx = BuildCmoTestGraph({16, 16, 16, 16}, 262176, true); | ||
| 207 | + CmoExtraAttr add1_cmo_ext_attr = {{kCmoPrefetch, {{ctx.mul1_node, CmoTypeObject::INPUT, 1}}}}; | ||
| 208 | + ctx.add1->SetExtAttr("cmo_", add1_cmo_ext_attr); | ||
| 209 | + ctx.mul1->SetInputOffset({256, 512}); | ||
| 210 | + ctx.mul1->SetOutputOffset({1024}); | ||
| 211 | + ctx.mul1->SetWorkspaceBytes({256}); | ||
| 212 | + ctx.mul1->SetWorkspace({2048}); | ||
| 213 | + CMOIdGenStrategy::Instance().UpdateReuseMap(-1, 0); | ||
| 214 | + std::vector<domi::TaskDef> task_defs; | ||
| 215 | + TaskBuilderContext context; | ||
| 216 | + context.dataMemSize = 2048 * 1000; | ||
| 217 | + CMOTaskBuilderPtr cmo_task_builder_ptr = std::make_shared<CMOTaskBuilder>(); | ||
| 218 | + EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*ctx.add1_node, task_defs, context, true), FAILED); | ||
| 219 | + (void)CMOIdGenStrategy::Instance().Finalize(); | ||
| 220 | +} | ||
| 221 | + | ||
| 222 | +TEST_F(CMOTaskBuilderTest, cmo_task_builder_invalid_cmo_id_zero) { | ||
| 223 | + auto ctx = BuildCmoTestGraph(std::vector<int64_t>(4, 4), 1056, false); | ||
| 224 | + CmoExtraAttr mul1_cmo_ext_attr = {{kCmoInvalid, {{ctx.add1_node, CmoTypeObject::INPUT, 1}}}}; | ||
| 225 | + ctx.mul1->SetExtAttr("cmo_", mul1_cmo_ext_attr); | ||
| 226 | + ctx.add1->SetInputOffset({256, 512}); | ||
| 227 | + ctx.add1->SetOutputOffset({1024}); | ||
| 228 | + ctx.add1->SetWorkspaceBytes({256}); | ||
| 229 | + ctx.add1->SetWorkspace({2048}); | ||
| 230 | + (void)ge::AttrUtils::SetInt(ctx.add1->MutableInputDesc(1), "_complex_cmo_id", static_cast<int64_t>(0x100000000)); | ||
| 231 | + std::vector<domi::TaskDef> task_defs; | ||
| 232 | + TaskBuilderContext context; | ||
| 233 | + context.dataMemSize = 2048 * 1000; | ||
| 234 | + CMOTaskBuilderPtr cmo_task_builder_ptr = std::make_shared<CMOTaskBuilder>(); | ||
| 235 | + EXPECT_EQ(cmo_task_builder_ptr->GenerateCMOTask(*ctx.mul1_node, task_defs, context, false), FAILED); | ||
| 236 | +} | ||
| 237 | + | ||
| 110 | TEST_F(CMOTaskBuilderTest, cmo_task_builder_invalid) { | 238 | TEST_F(CMOTaskBuilderTest, cmo_task_builder_invalid) { |
| 111 | ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); | 239 | ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); |
| 112 | ge::OpDescPtr data = std::make_shared<ge::OpDesc>("data1", "Data"); | 240 | ge::OpDescPtr data = std::make_shared<ge::OpDesc>("data1", "Data"); |
| @@ -595,3 +595,33 @@ TEST_F(FFTSTaskBuilderAdapterUTest, gen_dyn_and_opt_mix_l2_taskdef_exception) { | |||
| 595 | ret = ffts_task_builder->GenMixL2CtxDef(node->GetOpDesc(), ctx); | 595 | ret = ffts_task_builder->GenMixL2CtxDef(node->GetOpDesc(), ctx); |
| 596 | EXPECT_EQ(ret, fe::SUCCESS); | 596 | EXPECT_EQ(ret, fe::SUCCESS); |
| 597 | } | 597 | } |
| 598 | + | ||
| 599 | +TEST_F(FFTSTaskBuilderAdapterUTest, GenCtxParamAndCtxType_AutoModeInitFailed) { | ||
| 600 | + auto node = CreateNode(); | ||
| 601 | + ffts::ThreadSliceMapPtr slice_info_ptr; | ||
| 602 | + slice_info_ptr = node->GetOpDesc()->TryGetExtAttr(ffts::kAttrSgtStructInfo, slice_info_ptr); | ||
| 603 | + ASSERT_NE(slice_info_ptr, nullptr); | ||
| 604 | + slice_info_ptr->thread_mode = static_cast<uint32_t>(ffts::ThreadMode::AUTO_THREAD); | ||
| 605 | + (void)ge::AttrUtils::SetInt(node->GetOpDesc(), fe::NON_TAIL_WORKSPACE_SIZE, 10); | ||
| 606 | + node->GetOpDesc()->SetWorkspaceBytes({100000}); | ||
| 607 | + | ||
| 608 | + FftsTaskBuilderPtr ffts_task_builder = std::make_shared<FftsTaskBuilder>(); | ||
| 609 | + ffts_task_builder->context_ = context_; | ||
| 610 | + | ||
| 611 | + ffts::TaskBuilderType ctx_type; | ||
| 612 | + Status ret = ffts_task_builder->GenCtxParamAndCtxType(*node, ctx_type); | ||
| 613 | + EXPECT_NE(fe::SUCCESS, ret); | ||
| 614 | +} | ||
| 615 | + | ||
| 616 | +TEST_F(FFTSTaskBuilderAdapterUTest, GenCtxParamAndCtxType_ManualModeInitFailed) { | ||
| 617 | + auto node = CreateNode(); | ||
| 618 | + (void)ge::AttrUtils::SetInt(node->GetOpDesc(), fe::NON_TAIL_WORKSPACE_SIZE, 10); | ||
| 619 | + node->GetOpDesc()->SetWorkspaceBytes({100000}); | ||
| 620 | + | ||
| 621 | + FftsTaskBuilderPtr ffts_task_builder = std::make_shared<FftsTaskBuilder>(); | ||
| 622 | + ffts_task_builder->context_ = context_; | ||
| 623 | + | ||
| 624 | + ffts::TaskBuilderType ctx_type; | ||
| 625 | + Status ret = ffts_task_builder->GenCtxParamAndCtxType(*node, ctx_type); | ||
| 626 | + EXPECT_NE(fe::SUCCESS, ret); | ||
| 627 | +} | ||
| @@ -816,4 +816,16 @@ TEST_F(GRAPH_FUSION_UT, converage_20) { | |||
| 816 | // EXPECT_EQ(fusion_priority_mgr_->sorted_graph_fusion_map_[hash_key].size(), 528); | 816 | // EXPECT_EQ(fusion_priority_mgr_->sorted_graph_fusion_map_[hash_key].size(), 528); |
| 817 | system(("rm -rf " + current_dir + "plugin").c_str()); | 817 | system(("rm -rf " + current_dir + "plugin").c_str()); |
| 818 | } | 818 | } |
| 819 | + | ||
| 820 | +TEST_F(GRAPH_FUSION_UT, GetNextInAnchorsOfSubNetOutput_NoParentNodeIndex) { | ||
| 821 | + ge::ComputeGraphPtr graph = std::make_shared<ge::ComputeGraph>("test"); | ||
| 822 | + ge::OpDescPtr netoutput_op = std::make_shared<ge::OpDesc>("netoutput", "NetOutput"); | ||
| 823 | + GeTensorDesc tensor_desc(GeShape({1}), ge::FORMAT_NCHW, ge::DT_FLOAT); | ||
| 824 | + netoutput_op->AddInputDesc(tensor_desc); | ||
| 825 | + ge::NodePtr netoutput_node = graph->AddNode(netoutput_op); | ||
| 826 | + | ||
| 827 | + std::vector<ge::InDataAnchorPtr> next_in_data_anchors; | ||
| 828 | + Status ret = FeGraphUtils::GetNextInAnchorsOfSubNetOutput(netoutput_node, 0, next_in_data_anchors); | ||
| 829 | + EXPECT_EQ(ret, FAILED); | ||
| 830 | +} | ||
| 819 | } // namespace fe | 831 | } // namespace fe |
| @@ -33,7 +33,7 @@ class ut_expand_dims : public testing::Test { | |||
| 33 | Status RunExpandDimsCase(const ge::Format &origin_format, const ge::Format &format, const string &reshape_type, | 33 | Status RunExpandDimsCase(const ge::Format &origin_format, const ge::Format &format, const string &reshape_type, |
| 34 | const vector<int64_t> &dims, const vector<int64_t> &expect_dims) { | 34 | const vector<int64_t> &dims, const vector<int64_t> &expect_dims) { |
| 35 | std::cout << "RunExpandDimsCase: origin_format=" << origin_format << ", format=" << format | 35 | std::cout << "RunExpandDimsCase: origin_format=" << origin_format << ", format=" << format |
| 36 | - << ", reahpe type=" << reshape_type << ", dim size=" << dims.size() << std::endl; | 36 | + << ", reshape type=" << reshape_type << ", dim size=" << dims.size() << std::endl; |
| 37 | ge::GeShape new_shape(dims); | 37 | ge::GeShape new_shape(dims); |
| 38 | ExpandDimension(origin_format, format, reshape_type, new_shape); | 38 | ExpandDimension(origin_format, format, reshape_type, new_shape); |
| 39 | EXPECT_EQ(new_shape.GetDims(), expect_dims); | 39 | EXPECT_EQ(new_shape.GetDims(), expect_dims); |
| @@ -1655,7 +1655,7 @@ TEST_F(UBFUSION_UT, fusion_test_tefusion_bifurcated_with_circle_nesting2) { | |||
| 1655 | uint32_t id = 0; | 1655 | uint32_t id = 0; |
| 1656 | 1656 | ||
| 1657 | cerr << endl; | 1657 | cerr << endl; |
| 1658 | - cerr << "UB fusion befre" << endl; | 1658 | + cerr << "UB fusion before" << endl; |
| 1659 | for (auto node : model_graph->GetDirectNode()) { | 1659 | for (auto node : model_graph->GetDirectNode()) { |
| 1660 | cerr << " id:" << id << endl; | 1660 | cerr << " id:" << id << endl; |
| 1661 | uint32_t scope_id = 0; | 1661 | uint32_t scope_id = 0; |
| @@ -232,4 +232,39 @@ TEST_F(AclnnNodeConverterST, LoweringWithDeterministicLevelAttr) { | |||
| 232 | auto add_ret = LoweringAclnnNode(add_node, add_input); | 232 | auto add_ret = LoweringAclnnNode(add_node, add_input); |
| 233 | ASSERT_TRUE(add_ret.result.IsSuccess()); | 233 | ASSERT_TRUE(add_ret.result.IsSuccess()); |
| 234 | } | 234 | } |
| 235 | + | ||
| 236 | +TEST_F(AclnnNodeConverterST, TestBuildOpInputTensors_LoweringResultShapeIsNull) { | ||
| 237 | + auto graph = ShareGraph::AicoreGraph(); | ||
| 238 | + auto add_node = graph->FindNode("add1"); | ||
| 239 | + auto root_model = GeModelBuilder(graph).BuildGeRootModel(); | ||
| 240 | + auto global_data = GlobalDataFaker(root_model).FakeWithHandleAiCore("Add", false).Build(); | ||
| 241 | + bg::LowerConstDataNode(global_data); | ||
| 242 | + LowerInput data_input = {{}, {}, &global_data}; | ||
| 243 | + | ||
| 244 | + auto data1_ret = LoweringDataNode(graph->FindNode("data1"), data_input); | ||
| 245 | + auto data2_ret = LoweringDataNode(graph->FindNode("data2"), data_input); | ||
| 246 | + | ||
| 247 | + ASSERT_TRUE(data1_ret.result.IsSuccess()); | ||
| 248 | + ASSERT_TRUE(data2_ret.result.IsSuccess()); | ||
| 249 | + | ||
| 250 | + LowerInput add_input = {{data1_ret.out_shapes[0], data2_ret.out_shapes[0]}, | ||
| 251 | + {data1_ret.out_addrs[0], data2_ret.out_addrs[0]}, | ||
| 252 | + &global_data}; | ||
| 253 | + | ||
| 254 | + data1_ret.out_shapes.clear(); | ||
| 255 | + graph->FindNode("data1")->GetOpDesc()->SetExtAttr( | ||
| 256 | + "_lowering_result", gert::PlacedLoweringResult(graph->FindNode("data1"), std::move(data1_ret))); | ||
| 257 | + graph->FindNode("data2")->GetOpDesc()->SetExtAttr( | ||
| 258 | + "_lowering_result", gert::PlacedLoweringResult(graph->FindNode("data2"), std::move(data2_ret))); | ||
| 259 | + | ||
| 260 | + gert::OpImplSpaceRegistryV2Ptr space_registry_stub = std::make_shared<gert::OpImplSpaceRegistryV2>(); | ||
| 261 | + auto op_impl_func = space_registry_stub->CreateOrGetOpImpl("Add"); | ||
| 262 | + op_impl_func->op_execute_func = OpExecuteFuncStub; | ||
| 263 | + | ||
| 264 | + auto space_registry_array = ge::MakeShared<gert::OpImplSpaceRegistryV2Array>(); | ||
| 265 | + space_registry_array->at(static_cast<size_t>(ge::OppImplVersion::kOpp)) = space_registry_stub; | ||
| 266 | + global_data.SetSpaceRegistriesV2(*space_registry_array); | ||
| 267 | + auto add_ret = LoweringAclnnNode(add_node, add_input); | ||
| 268 | + ASSERT_FALSE(add_ret.result.IsSuccess()); | ||
| 269 | +} | ||
| 235 | } // namespace gert | 270 | } // namespace gert |
| @@ -591,4 +591,37 @@ TEST_F(FFTSAICoreKernelTestST, test_atomic_aicore_update_context) { | |||
| 591 | ge::GRAPH_SUCCESS); | 591 | ge::GRAPH_SUCCESS); |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | +TEST_F(FFTSAICoreKernelTestST, test_calc_atomic_out_shape_size_output_index_exceeds_slice_size) { | ||
| 595 | + auto run_context = KernelRunContextFaker() | ||
| 596 | + .KernelIONum(2, 2) | ||
| 597 | + .NodeIoNum(2, 3) | ||
| 598 | + .IrInputNum(2) | ||
| 599 | + .NodeInputTd(0, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 600 | + .NodeInputTd(1, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 601 | + .NodeOutputTd(0, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 602 | + .NodeOutputTd(1, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 603 | + .NodeOutputTd(2, ge::DT_FLOAT, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 604 | + .Build(); | ||
| 605 | + | ||
| 606 | + auto clear_index = ContinuousVector::Create<int64_t>(2); | ||
| 607 | + auto clear_index_vec = reinterpret_cast<ContinuousVector *>(clear_index.get()); | ||
| 608 | + clear_index_vec->SetSize(2); | ||
| 609 | + auto clear_index_ptr = reinterpret_cast<int64_t *>(clear_index_vec->MutableData()); | ||
| 610 | + clear_index_ptr[0] = 0; | ||
| 611 | + clear_index_ptr[1] = 5; | ||
| 612 | + | ||
| 613 | + auto slice_shape = ContinuousVector::Create<Shape>(3); | ||
| 614 | + auto slice_shape_vec = reinterpret_cast<ContinuousVector *>(slice_shape.get()); | ||
| 615 | + slice_shape_vec->SetSize(3); | ||
| 616 | + auto slice_shape_ptr = reinterpret_cast<Shape *>(slice_shape_vec->MutableData()); | ||
| 617 | + Shape shape({3, 2, 2}); | ||
| 618 | + slice_shape_ptr[0] = shape; | ||
| 619 | + slice_shape_ptr[1] = shape; | ||
| 620 | + slice_shape_ptr[2] = shape; | ||
| 621 | + run_context.value_holder[0].Set(clear_index_vec, nullptr); | ||
| 622 | + run_context.value_holder[1].Set(slice_shape_vec, nullptr); | ||
| 623 | + | ||
| 624 | + ASSERT_EQ(registry.FindKernelFuncs("FFTSCalcAtomicOutputShapeSize")->run_func(run_context), ge::GRAPH_FAILED); | ||
| 625 | +} | ||
| 626 | + | ||
| 594 | } // namespace gert | 627 | } // namespace gert |
| @@ -347,4 +347,38 @@ TEST_F(AclnnNodeConverterUT, LoweringWithDeterministicLevelAttr) { | |||
| 347 | auto add_ret = LoweringAclnnNode(add_node, add_input); | 347 | auto add_ret = LoweringAclnnNode(add_node, add_input); |
| 348 | ASSERT_TRUE(add_ret.result.IsSuccess()); | 348 | ASSERT_TRUE(add_ret.result.IsSuccess()); |
| 349 | } | 349 | } |
| 350 | + | ||
| 351 | +TEST_F(AclnnNodeConverterUT, TestBuildOpInputTensors_LoweringResultShapeIsNull) { | ||
| 352 | + auto graph = ShareGraph::AicoreGraph(); | ||
| 353 | + auto add_node = graph->FindNode("add1"); | ||
| 354 | + auto root_model = GeModelBuilder(graph).BuildGeRootModel(); | ||
| 355 | + auto global_data = GlobalDataFaker(root_model).FakeWithHandleAiCore("Add", false).Build(); | ||
| 356 | + bg::LowerConstDataNode(global_data); | ||
| 357 | + LowerInput data_input = {{}, {}, &global_data}; | ||
| 358 | + | ||
| 359 | + auto data1_ret = LoweringDataNode(graph->FindNode("data1"), data_input); | ||
| 360 | + auto data2_ret = LoweringDataNode(graph->FindNode("data2"), data_input); | ||
| 361 | + | ||
| 362 | + ASSERT_TRUE(data1_ret.result.IsSuccess()); | ||
| 363 | + ASSERT_TRUE(data2_ret.result.IsSuccess()); | ||
| 364 | + | ||
| 365 | + LowerInput add_input = {{data1_ret.out_shapes[0], data2_ret.out_shapes[0]}, | ||
| 366 | + {data1_ret.out_addrs[0], data2_ret.out_addrs[0]}, | ||
| 367 | + &global_data}; | ||
| 368 | + | ||
| 369 | + data1_ret.out_shapes.clear(); | ||
| 370 | + graph->FindNode("data1")->GetOpDesc()->SetExtAttr( | ||
| 371 | + "_lowering_result", gert::PlacedLoweringResult(graph->FindNode("data1"), std::move(data1_ret))); | ||
| 372 | + graph->FindNode("data2")->GetOpDesc()->SetExtAttr( | ||
| 373 | + "_lowering_result", gert::PlacedLoweringResult(graph->FindNode("data2"), std::move(data2_ret))); | ||
| 374 | + | ||
| 375 | + gert::OpImplSpaceRegistryV2Ptr space_registry_stub = std::make_shared<gert::OpImplSpaceRegistryV2>(); | ||
| 376 | + auto op_impl_func = space_registry_stub->CreateOrGetOpImpl("Add"); | ||
| 377 | + op_impl_func->op_execute_func = OpExecuteFuncStub; | ||
| 378 | + auto space_registry_array = ge::MakeShared<gert::OpImplSpaceRegistryV2Array>(); | ||
| 379 | + space_registry_array->at(static_cast<size_t>(ge::OppImplVersion::kOpp)) = space_registry_stub; | ||
| 380 | + global_data.SetSpaceRegistriesV2(*space_registry_array); | ||
| 381 | + auto add_ret = LoweringAclnnNode(add_node, add_input); | ||
| 382 | + ASSERT_FALSE(add_ret.result.IsSuccess()); | ||
| 383 | +} | ||
| 350 | } // namespace gert | 384 | } // namespace gert |
| @@ -278,4 +278,37 @@ TEST_F(FFTSAtomicKernelTestUT, test_calc_atomic_out_shape_size) { | |||
| 278 | tensor_size_ptr = context->GetOutputPointer<uint64_t>(1); | 278 | tensor_size_ptr = context->GetOutputPointer<uint64_t>(1); |
| 279 | ASSERT_EQ(*tensor_size_ptr, 352); | 279 | ASSERT_EQ(*tensor_size_ptr, 352); |
| 280 | } | 280 | } |
| 281 | + | ||
| 282 | +TEST_F(FFTSAtomicKernelTestUT, test_calc_atomic_out_shape_size_output_index_exceeds_slice_size) { | ||
| 283 | + auto run_context = KernelRunContextFaker() | ||
| 284 | + .KernelIONum(2, 2) | ||
| 285 | + .NodeIoNum(2, 3) | ||
| 286 | + .IrInputNum(2) | ||
| 287 | + .NodeInputTd(0, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 288 | + .NodeInputTd(1, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 289 | + .NodeOutputTd(0, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 290 | + .NodeOutputTd(1, ge::DT_FLOAT16, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 291 | + .NodeOutputTd(2, ge::DT_FLOAT, ge::FORMAT_NCHW, ge::FORMAT_NC1HWC0) | ||
| 292 | + .Build(); | ||
| 293 | + | ||
| 294 | + auto clear_index = ContinuousVector::Create<int64_t>(2); | ||
| 295 | + auto clear_index_vec = reinterpret_cast<ContinuousVector *>(clear_index.get()); | ||
| 296 | + clear_index_vec->SetSize(2); | ||
| 297 | + auto clear_index_ptr = reinterpret_cast<int64_t *>(clear_index_vec->MutableData()); | ||
| 298 | + clear_index_ptr[0] = 0; | ||
| 299 | + clear_index_ptr[1] = 5; | ||
| 300 | + | ||
| 301 | + auto slice_shape = ContinuousVector::Create<Shape>(3); | ||
| 302 | + auto slice_shape_vec = reinterpret_cast<ContinuousVector *>(slice_shape.get()); | ||
| 303 | + slice_shape_vec->SetSize(3); | ||
| 304 | + auto slice_shape_ptr = reinterpret_cast<Shape *>(slice_shape_vec->MutableData()); | ||
| 305 | + Shape shape({3, 2, 2}); | ||
| 306 | + slice_shape_ptr[0] = shape; | ||
| 307 | + slice_shape_ptr[1] = shape; | ||
| 308 | + slice_shape_ptr[2] = shape; | ||
| 309 | + run_context.value_holder[0].Set(clear_index_vec, nullptr); | ||
| 310 | + run_context.value_holder[1].Set(slice_shape_vec, nullptr); | ||
| 311 | + | ||
| 312 | + ASSERT_EQ(registry.FindKernelFuncs("FFTSCalcAtomicOutputShapeSize")->run_func(run_context), ge::GRAPH_FAILED); | ||
| 313 | +} | ||
| 281 | } // namespace gert | 314 | } // namespace gert |