@@ -171,9 +171,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status SingleOp::ExecuteAsync(c | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
return ret; | return ret; | ||||
} | } | ||||
if (ProfilingManager::Instance().ProfilingModelExecuteOn()) { | |||||
GE_CHK_STATUS_RET_NOLOG(ProfilingTaskInfo(index)); | |||||
} | |||||
GE_CHK_STATUS_RET_NOLOG(ProfilingTaskInfo(index)); | |||||
index++; | index++; | ||||
} | } | ||||
@@ -181,6 +179,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status SingleOp::ExecuteAsync(c | |||||
} | } | ||||
Status SingleOp::ProfilingTaskInfo(uint32_t index) { | Status SingleOp::ProfilingTaskInfo(uint32_t index) { | ||||
if (!ProfilingManager::Instance().ProfilingModelExecuteOn()) { | |||||
return SUCCESS; | |||||
} | |||||
if (op_name_.size() <= index) { | if (op_name_.size() <= index) { | ||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "index[%d] is out of range of op_name_ size[%d].", index, op_name_.size()); | GELOGE(ACL_ERROR_GE_PARAM_INVALID, "index[%d] is out of range of op_name_ size[%d].", index, op_name_.size()); | ||||
return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
@@ -300,6 +301,36 @@ Status DynamicSingleOp::ExecuteTbeTask(const vector<GeTensorDesc> &input_desc, | |||||
return op_task_->LaunchKernel(inputs, outputs, workspace_buffers, stream_); | return op_task_->LaunchKernel(inputs, outputs, workspace_buffers, stream_); | ||||
} | } | ||||
Status DynamicSingleOp::ProfilingTaskInfo() { | |||||
if (!ProfilingManager::Instance().ProfilingModelExecuteOn()) { | |||||
return SUCCESS; | |||||
} | |||||
GELOGD("ProfilingReport of op[%s] model[%s] start.", op_name_.c_str(), model_name_.c_str()); | |||||
std::vector<TaskDescInfo> task_desc_info; | |||||
uint32_t task_id = 0; | |||||
uint32_t stream_id = 0; | |||||
if (rtGetTaskIdAndStreamID(&task_id, &stream_id) != RT_ERROR_NONE) { | |||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Get task_id and stream_id failed."); | |||||
return ACL_ERROR_GE_PARAM_INVALID; | |||||
} | |||||
TaskDescInfo tmp_task_desc_info; | |||||
tmp_task_desc_info.model_name = model_name_; | |||||
tmp_task_desc_info.op_name = op_name_; | |||||
tmp_task_desc_info.block_dim = 0; | |||||
tmp_task_desc_info.task_id = task_id; | |||||
tmp_task_desc_info.stream_id = stream_id; | |||||
GELOGD("GetTaskDescInfo of op [%s] end, task_id[%u], stream_id[%u]", op_name_.c_str(), task_id, stream_id); | |||||
task_desc_info.emplace_back(tmp_task_desc_info); | |||||
std::vector<ComputeGraphDescInfo> compute_graph_info; | |||||
auto &profiling_manager = ProfilingManager::Instance(); | |||||
profiling_manager.ReportProfilingData(model_id_, task_desc_info, compute_graph_info, | |||||
!profiling_manager.IsAclApiMode()); | |||||
return SUCCESS; | |||||
} | |||||
Status DynamicSingleOp::ExecuteAsync(const vector<GeTensorDesc> &input_desc, | Status DynamicSingleOp::ExecuteAsync(const vector<GeTensorDesc> &input_desc, | ||||
const vector<DataBuffer> &input_buffers, | const vector<DataBuffer> &input_buffers, | ||||
vector<GeTensorDesc> &output_desc, | vector<GeTensorDesc> &output_desc, | ||||
@@ -91,6 +91,8 @@ class DynamicSingleOp { | |||||
size_t num_inputs_ = 0; | size_t num_inputs_ = 0; | ||||
size_t num_outputs_ = 0; | size_t num_outputs_ = 0; | ||||
std::string model_name_; | std::string model_name_; | ||||
std::string op_name_; | |||||
uint32_t model_id_ = 0; | |||||
}; | }; | ||||
} // namespace ge | } // namespace ge | ||||
#endif // GE_SINGLE_OP_SINGLE_OP_H_ | #endif // GE_SINGLE_OP_SINGLE_OP_H_ |
@@ -401,6 +401,8 @@ Status SingleOpModel::BuildModelTaskKernel(const TaskDef &task_def, DynamicSingl | |||||
GELOGD("Building TBE task"); | GELOGD("Building TBE task"); | ||||
TbeOpTask *tbe_task = nullptr; | TbeOpTask *tbe_task = nullptr; | ||||
GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def.kernel(), &tbe_task)); | GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def.kernel(), &tbe_task)); | ||||
string te_op_name = op_list_[context.op_index()]->GetName(); | |||||
single_op.op_name_ = te_op_name; | |||||
single_op.op_task_.reset(tbe_task); | single_op.op_task_.reset(tbe_task); | ||||
} else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { | } else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { | ||||
GELOGD("Building AICPU_CC task"); | GELOGD("Building AICPU_CC task"); | ||||
@@ -408,6 +410,8 @@ Status SingleOpModel::BuildModelTaskKernel(const TaskDef &task_def, DynamicSingl | |||||
uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; | uint64_t dynamic_singleop_kernel_id = aicpu_kernel_id++; | ||||
GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); | GELOGI("Build dynamic singleOp CCTask, kernel_id = %lu", dynamic_singleop_kernel_id); | ||||
GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); | GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task, dynamic_singleop_kernel_id)); | ||||
string aicpu_op_name = op_list_[context.op_index()]->GetName(); | |||||
single_op.op_name_ = aicpu_op_name; | |||||
single_op.op_task_.reset(task); | single_op.op_task_.reset(task); | ||||
} else { | } else { | ||||
GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, | GELOGE(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, | ||||
@@ -454,6 +458,8 @@ Status SingleOpModel::BuildTaskListForDynamicOp(DynamicSingleOp &single_op) { | |||||
const TaskDef ©_task_def = tasks[i]; | const TaskDef ©_task_def = tasks[i]; | ||||
GE_CHK_STATUS_RET_NOLOG(aicpu_task->SetMemCopyTask(copy_task_def.kernel_ex())); | GE_CHK_STATUS_RET_NOLOG(aicpu_task->SetMemCopyTask(copy_task_def.kernel_ex())); | ||||
} | } | ||||
string op_name = op_list_[task_def.kernel_ex().op_index()]->GetName(); | |||||
single_op.op_name_ = op_name; | |||||
single_op.op_task_.reset(aicpu_task); | single_op.op_task_.reset(aicpu_task); | ||||
} else { | } else { | ||||
// skip | // skip | ||||
@@ -466,6 +472,8 @@ Status SingleOpModel::BuildTaskListForDynamicOp(DynamicSingleOp &single_op) { | |||||
Status SingleOpModel::BuildDynamicOp(DynamicSingleOp &single_op) { | Status SingleOpModel::BuildDynamicOp(DynamicSingleOp &single_op) { | ||||
single_op.num_inputs_ = data_ops_.size(); | single_op.num_inputs_ = data_ops_.size(); | ||||
single_op.num_outputs_ = netoutput_op_->GetAllInputsSize(); | single_op.num_outputs_ = netoutput_op_->GetAllInputsSize(); | ||||
single_op.model_name_ = model_name_; | |||||
single_op.model_id_ = model_id_; | |||||
ParseOpModelParams(model_helper_, model_params_); | ParseOpModelParams(model_helper_, model_params_); | ||||
return BuildTaskListForDynamicOp(single_op); | return BuildTaskListForDynamicOp(single_op); | ||||
} | } | ||||