|
|
@@ -1558,6 +1558,12 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector<std::string> &aicpu_op |
|
|
|
size_t aicpu_op_nums = aicpu_optype_list.size(); |
|
|
|
size_t tf_op_nums = aicpu_tf_optype_list.size(); |
|
|
|
size_t op_nums = aicpu_op_nums + tf_op_nums; |
|
|
|
std::function<void()> callback = [&]() { |
|
|
|
for (auto mem : allocated_mem) { |
|
|
|
GE_CHK_RT(rtFree(mem)); |
|
|
|
} |
|
|
|
}; |
|
|
|
GE_MAKE_GUARD(release, callback); |
|
|
|
// malloc sysOpInfoList in SysOpCheckInfo |
|
|
|
status = rtMalloc(&d_req_op_list, op_nums * sizeof(SysOpInfo), RT_MEMORY_HBM); |
|
|
|
if (status != RT_ERROR_NONE) { |
|
|
@@ -1637,8 +1643,8 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector<std::string> &aicpu_op |
|
|
|
return RT_ERROR_TO_GE_STATUS(status); |
|
|
|
} |
|
|
|
allocated_mem.push_back(args); |
|
|
|
GE_CHK_RT( |
|
|
|
rtMemcpy(args, sizeof(SysOpCheckInfo), reinterpret_cast<void *>(&op_check_info_req), sizeof(SysOpCheckInfo), RT_MEMCPY_HOST_TO_DEVICE)); |
|
|
|
GE_CHK_RT(rtMemcpy(args, sizeof(SysOpCheckInfo), reinterpret_cast<void *>(&op_check_info_req), sizeof(SysOpCheckInfo), |
|
|
|
RT_MEMCPY_HOST_TO_DEVICE)); |
|
|
|
GE_CHK_RT(rtMemcpy(reinterpret_cast<void *>(static_cast<uintptr_t>(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args)) + op_check_info_req.offSetLen)), |
|
|
|
sizeof(SysOpCheckResp), reinterpret_cast<void *>(&op_check_info_res), sizeof(SysOpCheckResp), RT_MEMCPY_HOST_TO_DEVICE)); |
|
|
|
GE_CHK_RT(rtStreamCreate(&stream, 0)); |
|
|
@@ -1647,24 +1653,21 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector<std::string> &aicpu_op |
|
|
|
status = rtStreamSynchronize(stream); |
|
|
|
if (status != RT_ERROR_NONE) { |
|
|
|
GELOGE(RT_FAILED, "Call rt stream sync failed, status: 0x%x", status); |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
return RT_ERROR_TO_GE_STATUS(status); |
|
|
|
} |
|
|
|
|
|
|
|
// Check the response |
|
|
|
SysOpCheckResp *d_op_check_info_res = reinterpret_cast<SysOpCheckResp *>(reinterpret_cast<void *>(static_cast<uintptr_t>(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args)) + op_check_info_req.offSetLen))); |
|
|
|
SysOpCheckResp *d_op_check_info_res = |
|
|
|
reinterpret_cast<SysOpCheckResp *>(reinterpret_cast<void *>(static_cast<uintptr_t>(static_cast<uint64_t>( |
|
|
|
reinterpret_cast<uintptr_t>(args)) + op_check_info_req.offSetLen))); |
|
|
|
(void)memset_s(&op_check_info_res, sizeof(SysOpCheckResp), 0, sizeof(SysOpCheckResp)); |
|
|
|
GE_CHK_RT(rtMemcpy(&op_check_info_res, sizeof(SysOpCheckResp), d_op_check_info_res, sizeof(SysOpCheckResp), |
|
|
|
RT_MEMCPY_DEVICE_TO_HOST)); |
|
|
|
std::function<void()> callback = [&]() { |
|
|
|
for (auto mem : allocated_mem) { |
|
|
|
GE_CHK_RT(rtFree(mem)); |
|
|
|
} |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
}; |
|
|
|
|
|
|
|
if (op_check_info_res.isWithoutJson) { |
|
|
|
GELOGI("No need to check aicpu in this scenoria."); |
|
|
|
GE_MAKE_GUARD(release, callback); |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
uint64_t res_op_nums = op_check_info_res.opListNum; |
|
|
@@ -1682,7 +1685,7 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector<std::string> &aicpu_op |
|
|
|
sizeof(SysOpInfo) * res_op_nums, RT_MEMCPY_DEVICE_TO_HOST)); |
|
|
|
if (res_ret_code_list.size() != res_aicpu_op_info_list.size() || res_ret_code_list.size() != res_op_nums) { |
|
|
|
GELOGE(FAILED, "Number of retcode is not equal to number of op type."); |
|
|
|
GE_MAKE_GUARD(release, callback); |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
std::string fail_reason; |
|
|
@@ -1705,11 +1708,11 @@ Status ModelManager::LaunchKernelCheckAicpuOp(std::vector<std::string> &aicpu_op |
|
|
|
} |
|
|
|
fail_reason += "not support."; |
|
|
|
GELOGE(FAILED, "Check aicpu op_type failed. details: %s", fail_reason.c_str()); |
|
|
|
GE_MAKE_GUARD(release, callback); |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
|
|
|
|
GE_MAKE_GUARD(release, callback); |
|
|
|
GE_CHK_RT(rtStreamDestroy(stream)); |
|
|
|
GELOGI("Cpu kernel launch check optype task success."); |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|