| @@ -97,9 +97,10 @@ Status KernelExTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davin | |||||
| return FAILED;) | return FAILED;) | ||||
| // 2.3 Create session | // 2.3 Create session | ||||
| GE_CHECK_NOTNULL(ModelManager::GetInstance()); | GE_CHECK_NOTNULL(ModelManager::GetInstance()); | ||||
| GE_IF_BOOL_EXEC(ModelManager::GetInstance()->CreateAicpuSession(session_id) != SUCCESS, | |||||
| GELOGE(FAILED, "CreateAicpuSession error. session id: %lu", session_id); | |||||
| return FAILED;) | |||||
| ret = ModelManager::GetInstance()->CreateAicpuSession(session_id); | |||||
| GE_IF_BOOL_EXEC(ret != SUCCESS, | |||||
| GELOGE(ret, "CreateAicpuSession error. session id: %lu", session_id); | |||||
| return ret;) | |||||
| kernel_buf_size_ = sizeof(STR_FWK_OP_KERNEL); | kernel_buf_size_ = sizeof(STR_FWK_OP_KERNEL); | ||||
| if (davinci_model_->IsKnownNode()) { | if (davinci_model_->IsKnownNode()) { | ||||
| @@ -128,6 +129,7 @@ Status KernelExTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davin | |||||
| return RT_ERROR_TO_GE_STATUS(rt_ret);) | return RT_ERROR_TO_GE_STATUS(rt_ret);) | ||||
| SetIoAddrs(op_desc); | SetIoAddrs(op_desc); | ||||
| InitDumpTask(input_output_addr, op_desc); | |||||
| GELOGI("KernelExTaskInfo knonw node Init Success."); | GELOGI("KernelExTaskInfo knonw node Init Success."); | ||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -162,11 +164,7 @@ Status KernelExTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davin | |||||
| GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMemcpy to input_output_addr_ error: 0x%X", rt_ret); | GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMemcpy to input_output_addr_ error: 0x%X", rt_ret); | ||||
| return RT_ERROR_TO_GE_STATUS(rt_ret);) | return RT_ERROR_TO_GE_STATUS(rt_ret);) | ||||
| if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), | |||||
| op_desc->GetName())) { | |||||
| dump_flag_ = RT_KERNEL_DUMPFLAG; | |||||
| dump_args_ = input_output_addr_; | |||||
| } | |||||
| InitDumpTask(input_output_addr_, op_desc); | |||||
| if (davinci_model_->GetOpDugReg()) { | if (davinci_model_->GetOpDugReg()) { | ||||
| GELOGI("Op debug is open in kernel ex task info"); | GELOGI("Op debug is open in kernel ex task info"); | ||||
| dump_args_ = input_output_addr_; | dump_args_ = input_output_addr_; | ||||
| @@ -196,6 +194,14 @@ Status KernelExTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davin | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| void KernelExTaskInfo::InitDumpTask(void *addr, const OpDescPtr &op_desc) { | |||||
| if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), | |||||
| op_desc->GetName())) { | |||||
| dump_flag_ = RT_KERNEL_DUMPFLAG; | |||||
| dump_args_ = input_output_addr_; | |||||
| } | |||||
| } | |||||
| Status KernelExTaskInfo::CalculateArgs(const domi::TaskDef &task_def, DavinciModel *davinci_model) { | Status KernelExTaskInfo::CalculateArgs(const domi::TaskDef &task_def, DavinciModel *davinci_model) { | ||||
| auto kernel_ex_def = task_def.kernel_ex(); | auto kernel_ex_def = task_def.kernel_ex(); | ||||
| uint32_t op_index = kernel_ex_def.op_index(); | uint32_t op_index = kernel_ex_def.op_index(); | ||||
| @@ -61,6 +61,8 @@ class KernelExTaskInfo : public TaskInfo { | |||||
| Status CopyTaskInfo(const domi::KernelExDef &kernel_def, const RuntimeParam &rts_param, const OpDescPtr &op_desc); | Status CopyTaskInfo(const domi::KernelExDef &kernel_def, const RuntimeParam &rts_param, const OpDescPtr &op_desc); | ||||
| void SetIoAddrs(const OpDescPtr &op_desc); | void SetIoAddrs(const OpDescPtr &op_desc); | ||||
| void InitDumpTask(void *addr, const OpDescPtr &op_desc); | |||||
| uint32_t task_id_; | uint32_t task_id_; | ||||
| uint32_t stream_id_; | uint32_t stream_id_; | ||||
| uint32_t dump_flag_; | uint32_t dump_flag_; | ||||
| @@ -566,6 +566,8 @@ Status KernelTaskInfo::InitTVMTask(uint16_t offset, const domi::KernelDef &kerne | |||||
| OpDescPtr op_desc = davinci_model_->GetOpByIndex(ctx_.opIndex); | OpDescPtr op_desc = davinci_model_->GetOpByIndex(ctx_.opIndex); | ||||
| GE_CHECK_NOTNULL(op_desc); | GE_CHECK_NOTNULL(op_desc); | ||||
| if (davinci_model_->IsKnownNode()) { | if (davinci_model_->IsKnownNode()) { | ||||
| args_ = davinci_model_->GetCurrentArgsAddr(args_offset_); | |||||
| InitDumpTask(offset); | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| @@ -630,15 +632,7 @@ Status KernelTaskInfo::InitTVMTask(uint16_t offset, const domi::KernelDef &kerne | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| skt_dump_args_ = static_cast<char *>(args_) + offset; | skt_dump_args_ = static_cast<char *>(args_) + offset; | ||||
| if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), | |||||
| op_desc->GetName())) { | |||||
| if (IsL1FusionOp(op_desc)) { | |||||
| dump_flag_ = RT_FUSION_KERNEL_DUMPFLAG; | |||||
| } else { | |||||
| dump_flag_ = RT_KERNEL_DUMPFLAG; | |||||
| } | |||||
| dump_args_ = static_cast<char *>(args_) + offset; | |||||
| } | |||||
| InitDumpTask(offset); | |||||
| GE_CHK_BOOL_TRUE_EXEC_INFO(davinci_model_->GetOpDugReg(), dump_args_ = static_cast<char *>(args_) + offset, | GE_CHK_BOOL_TRUE_EXEC_INFO(davinci_model_->GetOpDugReg(), dump_args_ = static_cast<char *>(args_) + offset, | ||||
| "Op debug is open in TVM task info"); | "Op debug is open in TVM task info"); | ||||
| @@ -904,6 +898,8 @@ Status KernelTaskInfo::InitAicpuTask(uint32_t op_index, const domi::KernelDef &k | |||||
| aicpu_param_head->extInfoLength = static_cast<uintptr_t>(ext_info.size()); | aicpu_param_head->extInfoLength = static_cast<uintptr_t>(ext_info.size()); | ||||
| if (davinci_model_->IsKnownNode()) { | if (davinci_model_->IsKnownNode()) { | ||||
| args_ = davinci_model_->GetCurrentHybridArgsAddr(hybrid_args_offset_); | |||||
| InitDumpTask(sizeof(aicpu::AicpuParamHead)); | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| const RuntimeParam &rts_param = davinci_model_->GetRuntimeParam(); | const RuntimeParam &rts_param = davinci_model_->GetRuntimeParam(); | ||||
| @@ -937,16 +933,7 @@ Status KernelTaskInfo::InitAicpuTask(uint32_t op_index, const domi::KernelDef &k | |||||
| GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X", rt_ret); | GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X", rt_ret); | ||||
| return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
| } | } | ||||
| if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), | |||||
| op_desc->GetName())) { | |||||
| if (IsL1FusionOp(op_desc)) { | |||||
| dump_flag_ = RT_FUSION_KERNEL_DUMPFLAG; | |||||
| } else { | |||||
| dump_flag_ = RT_KERNEL_DUMPFLAG; | |||||
| } | |||||
| dump_args_ = static_cast<char *>(args_) + sizeof(aicpu::AicpuParamHead); | |||||
| } | |||||
| InitDumpTask(sizeof(aicpu::AicpuParamHead)); | |||||
| if (davinci_model_->GetOpDugReg()) { | if (davinci_model_->GetOpDugReg()) { | ||||
| GELOGI("Op debug is open in aicpu task info"); | GELOGI("Op debug is open in aicpu task info"); | ||||
| dump_args_ = static_cast<char *>(args_) + sizeof(aicpu::AicpuParamHead); | dump_args_ = static_cast<char *>(args_) + sizeof(aicpu::AicpuParamHead); | ||||
| @@ -960,6 +947,18 @@ Status KernelTaskInfo::InitAicpuTask(uint32_t op_index, const domi::KernelDef &k | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| void KernelTaskInfo::InitDumpTask(uint32_t offset) { | |||||
| if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), | |||||
| op_desc_->GetName())) { | |||||
| if (IsL1FusionOp(op_desc_)) { | |||||
| dump_flag_ = RT_FUSION_KERNEL_DUMPFLAG; | |||||
| } else { | |||||
| dump_flag_ = RT_KERNEL_DUMPFLAG; | |||||
| } | |||||
| dump_args_ = static_cast<char *>(args_) + offset; | |||||
| } | |||||
| } | |||||
| Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { | Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { | ||||
| if (ext_info.empty()) { | if (ext_info.empty()) { | ||||
| return SUCCESS; | return SUCCESS; | ||||
| @@ -128,6 +128,7 @@ class KernelTaskInfo : public TaskInfo { | |||||
| Status SuperKernelDistribute(); | Status SuperKernelDistribute(); | ||||
| bool IsL1FusionOp(const OpDescPtr &op_desc); | bool IsL1FusionOp(const OpDescPtr &op_desc); | ||||
| void SetIoAddrs(const OpDescPtr &op_desc); | void SetIoAddrs(const OpDescPtr &op_desc); | ||||
| void InitDumpTask(uint32_t offset); | |||||
| // For super kernel | // For super kernel | ||||
| Status SaveSKTDumpInfo(); | Status SaveSKTDumpInfo(); | ||||
| @@ -123,6 +123,10 @@ Status KnownNodeTask::Init(TaskContext &context) { | |||||
| davinci_model_->GetRuntimeParam().mem_base, davinci_model_->GetRuntimeParam().mem_size); | davinci_model_->GetRuntimeParam().mem_base, davinci_model_->GetRuntimeParam().mem_size); | ||||
| } | } | ||||
| if (!load_flag_) { | if (!load_flag_) { | ||||
| auto dump_properties = context.GetDumpProperties(); | |||||
| if (dump_properties.IsDumpOpen()) { | |||||
| davinci_model_->SetDumpProperties(dump_properties); | |||||
| } | |||||
| GE_CHK_STATUS_RET(davinci_model_->Init(), "KnownNodeExecutor::InitDavinciModel failed."); | GE_CHK_STATUS_RET(davinci_model_->Init(), "KnownNodeExecutor::InitDavinciModel failed."); | ||||
| load_flag_ = true; | load_flag_ = true; | ||||
| } else { | } else { | ||||
| @@ -36,6 +36,9 @@ | |||||
| #include "graph/load/new_model_manager/davinci_model.h" | #include "graph/load/new_model_manager/davinci_model.h" | ||||
| #include "graph/load/new_model_manager/davinci_model_parser.h" | #include "graph/load/new_model_manager/davinci_model_parser.h" | ||||
| #include "graph/load/new_model_manager/model_manager.h" | #include "graph/load/new_model_manager/model_manager.h" | ||||
| #include "graph/load/new_model_manager/task_info/kernel_task_info.h" | |||||
| #include "graph/load/new_model_manager/task_info/kernel_ex_task_info.h" | |||||
| #include "ge/common/dump/dump_properties.h" | |||||
| #include "graph/manager/graph_mem_allocator.h" | #include "graph/manager/graph_mem_allocator.h" | ||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| #include "proto/ge_ir.pb.h" | #include "proto/ge_ir.pb.h" | ||||
| @@ -79,6 +82,33 @@ class DModelListener : public ge::ModelListener { | |||||
| shared_ptr<ge::ModelListener> g_label_call_back(new DModelListener()); | shared_ptr<ge::ModelListener> g_label_call_back(new DModelListener()); | ||||
| static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { | |||||
| auto op_desc = std::make_shared<ge::OpDesc>(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); | |||||
| return op_desc; | |||||
| } | |||||
| /* | /* | ||||
| TEST_F(UtestGeExecutor, fail_UnloadModel_model_manager_stop_unload_error) { | TEST_F(UtestGeExecutor, fail_UnloadModel_model_manager_stop_unload_error) { | ||||
| uint32_t model_id = 1; | uint32_t model_id = 1; | ||||
| @@ -104,4 +134,41 @@ TEST_F(UtestGeExecutor, InitFeatureMapAndP2PMem_failed) { | |||||
| model.is_feature_map_mem_has_inited_ = true; | model.is_feature_map_mem_has_inited_ = true; | ||||
| EXPECT_EQ(model.InitFeatureMapAndP2PMem(nullptr, 0), PARAM_INVALID); | EXPECT_EQ(model.InitFeatureMapAndP2PMem(nullptr, 0), PARAM_INVALID); | ||||
| } | } | ||||
| TEST_F(UtestGeExecutor, kernel_InitDumpTask) { | |||||
| DavinciModel model(0, g_label_call_back); | |||||
| model.om_name_ = "testom"; | |||||
| model.name_ = "test"; | |||||
| OpDescPtr op_desc = CreateOpDesc("test", "test"); | |||||
| std::map<std::string, std::set<std::string>> model_dump_properties_map; | |||||
| std::set<std::string> s; | |||||
| model_dump_properties_map[DUMP_ALL_MODEL] = s; | |||||
| DumpProperties dp; | |||||
| dp.model_dump_properties_map_ = model_dump_properties_map; | |||||
| model.SetDumpProperties(dp); | |||||
| KernelTaskInfo kernel_task_info; | |||||
| kernel_task_info.davinci_model_ = &model; | |||||
| kernel_task_info.op_desc_ = op_desc; | |||||
| kernel_task_info.InitDumpTask(0); | |||||
| } | |||||
| TEST_F(UtestGeExecutor, kernel_ex_InitDumpTask) { | |||||
| DavinciModel model(0, g_label_call_back); | |||||
| model.om_name_ = "testom"; | |||||
| model.name_ = "test"; | |||||
| OpDescPtr op_desc = CreateOpDesc("test", "test"); | |||||
| std::map<std::string, std::set<std::string>> model_dump_properties_map; | |||||
| std::set<std::string> s; | |||||
| model_dump_properties_map[DUMP_ALL_MODEL] = s; | |||||
| DumpProperties dp; | |||||
| dp.model_dump_properties_map_ = model_dump_properties_map; | |||||
| model.SetDumpProperties(dp); | |||||
| KernelExTaskInfo kernel_ex_task_info; | |||||
| kernel_ex_task_info.davinci_model_ = &model; | |||||
| kernel_ex_task_info.InitDumpTask(nullptr, op_desc); | |||||
| } | |||||
| } | } | ||||