已合并
【PR】: fix:整改魔鬼数字 #4053
duanpengliang创建于 19 天前
【PR】: fix:整改魔鬼数字 #4053
已合并
共 85 个文件变更+2295-876
| @@ -198,6 +198,7 @@ RT_LOG_OUTER_MSG_WITH_FUNC(ErrorCode::EE1005); | |||
| 198 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | | 198 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | |
| 199 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | | 199 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | |
| 200 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | | 200 | | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | |
| 201 | +| COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC | rtError_t | 自定义条件 | 否 | 否 | 否 | 推荐 | — | | ||
| 201 | | ZERO_RETURN_AND_MSG_OUTER | rtError_t | 零值 | 否 | 否 | 否 | 推荐 | — | | 202 | | ZERO_RETURN_AND_MSG_OUTER | rtError_t | 零值 | 否 | 否 | 否 | 推荐 | — | |
| 202 | | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM | ACL错误码(rt转换) | 自定义条件 | 否 | 否 | 是 | 推荐 | — | | 203 | | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM | ACL错误码(rt转换) | 自定义条件 | 否 | 否 | 是 | 推荐 | — | |
| 203 | | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME | ACL错误码(rt转换) | 自定义条件 | 否 | 否 | 是 | 推荐 | — | | 204 | | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME | ACL错误码(rt转换) | 自定义条件 | 否 | 否 | 是 | 推荐 | — | |
| @@ -116,7 +116,7 @@ aclError CheckQueueRouteQueryInfo(const acltdtQueueRouteQueryInfo* const queryIn | |||
| 116 | break; | 116 | break; |
| 117 | } | 117 | } |
| 118 | default: { | 118 | default: { |
| 119 | - ACL_LOG_ERROR("[Check][Type]unknown mode %d.", queryInfo->mode); | 119 | + ACL_LOG_ERROR("[Check][Type]invalid mode UNKNOWN(%d).", static_cast<int32_t>(queryInfo->mode)); |
| 120 | const char_t* argList[] = {"func", "value", "param", "expect"}; | 120 | const char_t* argList[] = {"func", "value", "param", "expect"}; |
| 121 | const char_t* argVal[] = { | 121 | const char_t* argVal[] = { |
| 122 | "Checking the validity of the queue route query operation", | 122 | "Checking the validity of the queue route query operation", |
| @@ -401,7 +401,7 @@ aclError acltdtSetQueueAttr(acltdtQueueAttr* attr, acltdtQueueAttrType type, siz | |||
| 401 | case ACL_TDT_QUEUE_DEPTH_UINT32: | 401 | case ACL_TDT_QUEUE_DEPTH_UINT32: |
| 402 | return CopyParam(param, len, static_cast<void*>(&attr->depth), sizeof(uint32_t)); | 402 | return CopyParam(param, len, static_cast<void*>(&attr->depth), sizeof(uint32_t)); |
| 403 | default: { | 403 | default: { |
| 404 | - ACL_LOG_ERROR("[Check][Type]unknown acltdtQueueAttrType %d.", type); | 404 | + ACL_LOG_ERROR("[Check][Type]invalid acltdtQueueAttrType UNKNOWN(%d).", static_cast<int32_t>(type)); |
| 405 | acl::AclErrorLogManager::ReportInputError( | 405 | acl::AclErrorLogManager::ReportInputError( |
| 406 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 406 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 407 | std::vector<const char*>( | 407 | std::vector<const char*>( |
| @@ -418,7 +418,7 @@ aclError acltdtGetQueueAttr( | |||
| 418 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(attr); | 418 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(attr); |
| 419 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(param); | 419 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(param); |
| 420 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(paramRetSize); | 420 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(paramRetSize); |
| 421 | - ACL_LOG_INFO("start to get queue attr, type is %d, len is %zu", type, len); | 421 | + ACL_LOG_INFO("start to get queue attr, type is %s, len is %zu", acl::GetQueueAttrTypeDesc(type), len); |
| 422 | switch (type) { | 422 | switch (type) { |
| 423 | case ACL_TDT_QUEUE_NAME_PTR: { | 423 | case ACL_TDT_QUEUE_NAME_PTR: { |
| 424 | const char_t* tmp = &attr->name[0]; | 424 | const char_t* tmp = &attr->name[0]; |
| @@ -427,7 +427,7 @@ aclError acltdtGetQueueAttr( | |||
| 427 | case ACL_TDT_QUEUE_DEPTH_UINT32: | 427 | case ACL_TDT_QUEUE_DEPTH_UINT32: |
| 428 | return CopyParam(static_cast<const void*>(&attr->depth), sizeof(uint32_t), param, len, paramRetSize); | 428 | return CopyParam(static_cast<const void*>(&attr->depth), sizeof(uint32_t), param, len, paramRetSize); |
| 429 | default: { | 429 | default: { |
| 430 | - ACL_LOG_ERROR("[Check][Type]unknown acltdtQueueAttrType %d.", type); | 430 | + ACL_LOG_ERROR("[Check][Type]invalid acltdtQueueAttrType UNKNOWN(%d).", static_cast<int32_t>(type)); |
| 431 | acl::AclErrorLogManager::ReportInputError( | 431 | acl::AclErrorLogManager::ReportInputError( |
| 432 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 432 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 433 | std::vector<const char*>( | 433 | std::vector<const char*>( |
| @@ -465,7 +465,7 @@ aclError acltdtGetQueueRouteParam( | |||
| 465 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(route); | 465 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(route); |
| 466 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(param); | 466 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(param); |
| 467 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(paramRetSize); | 467 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(paramRetSize); |
| 468 | - ACL_LOG_INFO("get route type %d, len is %zu", type, len); | 468 | + ACL_LOG_INFO("get route type %s, len is %zu", acl::GetQueueRouteParamTypeDesc(type), len); |
| 469 | switch (type) { | 469 | switch (type) { |
| 470 | case ACL_TDT_QUEUE_ROUTE_SRC_UINT32: | 470 | case ACL_TDT_QUEUE_ROUTE_SRC_UINT32: |
| 471 | return CopyParam(static_cast<const void*>(&route->srcId), sizeof(uint32_t), param, len, paramRetSize); | 471 | return CopyParam(static_cast<const void*>(&route->srcId), sizeof(uint32_t), param, len, paramRetSize); |
| @@ -474,7 +474,7 @@ aclError acltdtGetQueueRouteParam( | |||
| 474 | case ACL_TDT_QUEUE_ROUTE_STATUS_INT32: | 474 | case ACL_TDT_QUEUE_ROUTE_STATUS_INT32: |
| 475 | return CopyParam(static_cast<const void*>(&route->status), sizeof(int32_t), param, len, paramRetSize); | 475 | return CopyParam(static_cast<const void*>(&route->status), sizeof(int32_t), param, len, paramRetSize); |
| 476 | default: { | 476 | default: { |
| 477 | - ACL_LOG_ERROR("[Check][Type]unknown acltdtQueueRouteParamType %d.", type); | 477 | + ACL_LOG_ERROR("[Check][Type]invalid acltdtQueueRouteParamType UNKNOWN(%d).", static_cast<int32_t>(type)); |
| 478 | acl::AclErrorLogManager::ReportInputError( | 478 | acl::AclErrorLogManager::ReportInputError( |
| 479 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 479 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 480 | std::vector<const char*>( | 480 | std::vector<const char*>( |
| @@ -572,7 +572,8 @@ aclError acltdtSetQueueRouteQueryInfo( | |||
| 572 | return ret; | 572 | return ret; |
| 573 | } | 573 | } |
| 574 | default: { | 574 | default: { |
| 575 | - ACL_LOG_ERROR("[Check][Type]unknown acltdtQueueRouteQueryInfoParamType %d.", type); | 575 | + ACL_LOG_ERROR( |
| 576 | + "[Check][Type]invalid acltdtQueueRouteQueryInfoParamType UNKNOWN(%d).", static_cast<int32_t>(type)); | ||
| 576 | acl::AclErrorLogManager::ReportInputError( | 577 | acl::AclErrorLogManager::ReportInputError( |
| 577 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 578 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 578 | std::vector<const char*>( | 579 | std::vector<const char*>( |
| @@ -23,7 +23,7 @@ aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream) | |||
| 23 | aclError aclrtLaunchCallback(aclrtCallback fn, void* userData, aclrtCallbackBlockType blockType, aclrtStream stream) | 23 | aclError aclrtLaunchCallback(aclrtCallback fn, void* userData, aclrtCallbackBlockType blockType, aclrtStream stream) |
| 24 | { | 24 | { |
| 25 | if ((blockType != ACL_CALLBACK_BLOCK) && (blockType != ACL_CALLBACK_NO_BLOCK)) { | 25 | if ((blockType != ACL_CALLBACK_BLOCK) && (blockType != ACL_CALLBACK_NO_BLOCK)) { |
| 26 | - ACL_LOG_INNER_ERROR("invalid block type, the current blockType = %d", blockType); | 26 | + ACL_LOG_INNER_ERROR("invalid block type, the current blockType = UNKNOWN(%d)", (int32_t)blockType); |
| 27 | return ACL_ERROR_INVALID_PARAM; | 27 | return ACL_ERROR_INVALID_PARAM; |
| 28 | } | 28 | } |
| 29 | return rtCallbackLaunch((rtCallback_t)(fn), userData, (rtStream_t)(stream), (blockType == ACL_CALLBACK_BLOCK)); | 29 | return rtCallbackLaunch((rtCallback_t)(fn), userData, (rtStream_t)(stream), (blockType == ACL_CALLBACK_BLOCK)); |
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | + | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | 15 | ||
| @@ -16,6 +17,25 @@ | |||
| 16 | extern "C" { | 17 | extern "C" { |
| 17 | 18 | ||
| 18 | 19 | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +static const char* GetRunModeDesc(const aclrtRunMode runMode, char* const unknownDesc, const size_t unknownDescLen) | ||
| 23 | +{ | ||
| 24 | + switch (runMode) { | ||
| 25 | + case ACL_DEVICE: | ||
| 26 | + return "DEVICE(0)"; | ||
| 27 | + case ACL_HOST: | ||
| 28 | + return "HOST(1)"; | ||
| 29 | + default: | ||
| 30 | + if ((unknownDesc == NULL) || (unknownDescLen == 0U)) { | ||
| 31 | + return "UNKNOWN"; | ||
| 32 | + } | ||
| 33 | + (void)snprintf_s(unknownDesc, unknownDescLen, unknownDescLen - 1U, "UNKNOWN(%d)", (int32_t)runMode); | ||
| 34 | + unknownDesc[unknownDescLen - 1U] = '\0'; | ||
| 35 | + return unknownDesc; | ||
| 36 | + } | ||
| 37 | +} | ||
| 38 | + | ||
| 19 | aclError aclrtSetDevice(int32_t deviceId) | 39 | aclError aclrtSetDevice(int32_t deviceId) |
| 20 | { | 40 | { |
| 21 | const rtError_t rtErr = rtSetDevice(deviceId); | 41 | const rtError_t rtErr = rtSetDevice(deviceId); |
| @@ -74,7 +94,8 @@ aclError aclrtGetRunMode(aclrtRunMode* runMode) | |||
| 74 | return ACL_SUCCESS; | 94 | return ACL_SUCCESS; |
| 75 | } | 95 | } |
| 76 | *runMode = ACL_HOST; | 96 | *runMode = ACL_HOST; |
| 77 | - ACL_LOG_INFO("get runMode success, runMode = %d.", (int32_t)(*runMode)); | 97 | + char runModeDesc[ACL_ENUM_DESC_LEN] = {0}; |
| 98 | + ACL_LOG_INFO("get runMode success, runMode = %s.", GetRunModeDesc(*runMode, runModeDesc, sizeof(runModeDesc))); | ||
| 78 | return ACL_SUCCESS; | 99 | return ACL_SUCCESS; |
| 79 | } | 100 | } |
| 80 | 101 | ||
| @@ -11,10 +11,35 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +static const char* GetUnsupportedMemcpyKindDesc( | ||
| 22 | + const aclrtMemcpyKind kind, char* const unknownDesc, const size_t unknownDescLen) | ||
| 23 | +{ | ||
| 24 | + switch (kind) { | ||
| 25 | + case ACL_MEMCPY_DEFAULT: | ||
| 26 | + return "MEMCPY_DEFAULT(4)"; | ||
| 27 | + case ACL_MEMCPY_HOST_TO_BUF_TO_DEVICE: | ||
| 28 | + return "MEMCPY_HOST_TO_BUF_TO_DEVICE(5)"; | ||
| 29 | + case ACL_MEMCPY_INNER_DEVICE_TO_DEVICE: | ||
| 30 | + return "MEMCPY_INNER_DEVICE_TO_DEVICE(6)"; | ||
| 31 | + case ACL_MEMCPY_INTER_DEVICE_TO_DEVICE: | ||
| 32 | + return "MEMCPY_INTER_DEVICE_TO_DEVICE(7)"; | ||
| 33 | + default: | ||
| 34 | + if ((unknownDesc == NULL) || (unknownDescLen == 0U)) { | ||
| 35 | + return "UNKNOWN"; | ||
| 36 | + } | ||
| 37 | + (void)snprintf_s(unknownDesc, unknownDescLen, unknownDescLen - 1U, "UNKNOWN(%d)", (int32_t)kind); | ||
| 38 | + unknownDesc[unknownDescLen - 1U] = '\0'; | ||
| 39 | + return unknownDesc; | ||
| 40 | + } | ||
| 41 | +} | ||
| 42 | + | ||
| 18 | static aclError GetAlignedSize(const size_t size, size_t* alignedSize) | 43 | static aclError GetAlignedSize(const size_t size, size_t* alignedSize) |
| 19 | { | 44 | { |
| 20 | const size_t DATA_MEMORY_ALIGN_SIZE = 32UL; | 45 | const size_t DATA_MEMORY_ALIGN_SIZE = 32UL; |
| @@ -88,7 +113,8 @@ aclError aclrtMemcpy(void* dst, size_t destMax, const void* src, size_t count, a | |||
| 88 | rtMemcpyKind_t rtKind = RT_MEMCPY_RESERVED; | 113 | rtMemcpyKind_t rtKind = RT_MEMCPY_RESERVED; |
| 89 | const aclError ret = MemcpyKindTranslate(kind, &rtKind); | 114 | const aclError ret = MemcpyKindTranslate(kind, &rtKind); |
| 90 | if (ret != ACL_SUCCESS) { | 115 | if (ret != ACL_SUCCESS) { |
| 91 | - ACL_LOG_INNER_ERROR("invalid kind[%d]", (int32_t)(kind)); | 116 | + char kindDesc[ACL_MEMCPY_KIND_DESC_LEN] = {0}; |
| 117 | + ACL_LOG_INNER_ERROR("invalid kind[%s]", GetUnsupportedMemcpyKindDesc(kind, kindDesc, sizeof(kindDesc))); | ||
| 92 | return ret; | 118 | return ret; |
| 93 | } | 119 | } |
| 94 | return rtMemcpy(dst, destMax, src, count, rtKind); | 120 | return rtMemcpy(dst, destMax, src, count, rtKind); |
| @@ -32,6 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | + | ||
| 35 | 36 | ||
| 36 | 37 | ||
| 37 | 38 | ||
| @@ -1344,7 +1345,7 @@ aclError aclGetCannAttributeImpl(aclCannAttr cannAttr, int32_t* value) | |||
| 1344 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); | 1345 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); |
| 1345 | const aclError ret = acl::CannInfoUtils::GetAttribute(cannAttr, value); | 1346 | const aclError ret = acl::CannInfoUtils::GetAttribute(cannAttr, value); |
| 1346 | if (ret != ACL_SUCCESS) { | 1347 | if (ret != ACL_SUCCESS) { |
| 1347 | - ACL_LOG_ERROR("Failed to check, attr value = %d, ret = %d.", static_cast<int32_t>(cannAttr), ret); | 1348 | + ACL_LOG_ERROR("Failed to check, attr value = %s, ret = %d.", acl::GetCannAttrDesc(cannAttr), ret); |
| 1348 | return ret; | 1349 | return ret; |
| 1349 | } | 1350 | } |
| 1350 | ACL_LOG_INFO("execute aclGetCannAttribute successfully."); | 1351 | ACL_LOG_INFO("execute aclGetCannAttribute successfully."); |
| @@ -1375,14 +1376,14 @@ aclError aclGetDeviceCapabilityImpl(uint32_t deviceId, aclDeviceInfo deviceInfo, | |||
| 1375 | {ACL_DEVICE_INFO_L2_SIZE, "l2_size"}}; | 1376 | {ACL_DEVICE_INFO_L2_SIZE, "l2_size"}}; |
| 1376 | const auto iter = infoTypeToKey.find(deviceInfo); | 1377 | const auto iter = infoTypeToKey.find(deviceInfo); |
| 1377 | if (iter == infoTypeToKey.end()) { | 1378 | if (iter == infoTypeToKey.end()) { |
| 1378 | - ACL_LOG_WARN("get device info failed, invalid info type = %d", static_cast<int32_t>(deviceInfo)); | 1379 | + ACL_LOG_WARN("get device info failed, invalid info type = %s", acl::GetDeviceInfoDesc(deviceInfo)); |
| 1379 | return ACL_ERROR_INVALID_PARAM; | 1380 | return ACL_ERROR_INVALID_PARAM; |
| 1380 | } | 1381 | } |
| 1381 | const auto& key = iter->second; | 1382 | const auto& key = iter->second; |
| 1382 | const aclError ret = GetPlatformInfoWithKey(key, value); | 1383 | const aclError ret = GetPlatformInfoWithKey(key, value); |
| 1383 | if (ret != ACL_SUCCESS) { | 1384 | if (ret != ACL_SUCCESS) { |
| 1384 | ACL_LOG_ERROR( | 1385 | ACL_LOG_ERROR( |
| 1385 | - "get device info failed, info type = %d, key = %s", static_cast<int32_t>(deviceInfo), key.c_str()); | 1386 | + "get device info failed, info type = %s, key = %s", acl::GetDeviceInfoDesc(deviceInfo), key.c_str()); |
| 1386 | return ret; | 1387 | return ret; |
| 1387 | } | 1388 | } |
| 1388 | ACL_LOG_INFO("execute aclGetDeviceCapability successfully."); | 1389 | ACL_LOG_INFO("execute aclGetDeviceCapability successfully."); |
| @@ -120,7 +120,9 @@ aclError aclrtGetArgsFromExceptionInfoImpl(const aclrtExceptionInfo* info, void* | |||
| 120 | *devArgsPtr = info->expandInfo.u.fusionInfo.u.aicoreCcuInfo.exceptionArgs.argAddr; | 120 | *devArgsPtr = info->expandInfo.u.fusionInfo.u.aicoreCcuInfo.exceptionArgs.argAddr; |
| 121 | *devArgsLen = info->expandInfo.u.fusionInfo.u.aicoreCcuInfo.exceptionArgs.argsize; | 121 | *devArgsLen = info->expandInfo.u.fusionInfo.u.aicoreCcuInfo.exceptionArgs.argsize; |
| 122 | } else { | 122 | } else { |
| 123 | - ACL_LOG_ERROR("exception information type = %d is invalid, get args failed.", info->expandInfo.type); | 123 | + ACL_LOG_ERROR( |
| 124 | + "exception information type = %s is invalid, get args failed.", | ||
| 125 | + acl::GetExceptionExpandTypeDesc(info->expandInfo.type)); | ||
| 124 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 126 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 125 | acl::AclErrorLogManager::ReportInputError( | 127 | acl::AclErrorLogManager::ReportInputError( |
| 126 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 128 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| @@ -107,7 +107,7 @@ static aclError GetSysParamOpt(aclSysParamOpt opt, int64_t* value, bool isCtx) | |||
| 107 | if (rtErr != RT_ERROR_NONE) { | 107 | if (rtErr != RT_ERROR_NONE) { |
| 108 | if (rtErr == ACL_ERROR_RT_SYSPARAMOPT_NOT_SET) { | 108 | if (rtErr == ACL_ERROR_RT_SYSPARAMOPT_NOT_SET) { |
| 109 | ACL_LOG_WARN( | 109 | ACL_LOG_WARN( |
| 110 | - "option %d is not set, runtime errorCode is %d", static_cast<int32_t>(opt), | 110 | + "option %s is not set, runtime errorCode is %d", acl::GetSysParamOptDesc(opt), |
| 111 | static_cast<int32_t>(rtErr)); | 111 | static_cast<int32_t>(rtErr)); |
| 112 | } | 112 | } |
| 113 | return ACL_GET_ERRCODE_RTS(rtErr); | 113 | return ACL_GET_ERRCODE_RTS(rtErr); |
| @@ -141,7 +141,8 @@ aclError aclrtCtxGetSysParamOptImpl(aclSysParamOpt opt, int64_t* value) | |||
| 141 | aclError aclrtCtxSetSysParamOptImpl(aclSysParamOpt opt, int64_t value) | 141 | aclError aclrtCtxSetSysParamOptImpl(aclSysParamOpt opt, int64_t value) |
| 142 | { | 142 | { |
| 143 | ACL_PROFILING_REG(acl::AclProfType::AclrtCtxSetSysParamOpt); | 143 | ACL_PROFILING_REG(acl::AclProfType::AclrtCtxSetSysParamOpt); |
| 144 | - ACL_LOG_INFO("start to execute aclrtCtxSetSysParamOpt, opt = %d, value = %ld.", static_cast<int32_t>(opt), value); | 144 | + ACL_LOG_INFO( |
| 145 | + "start to execute aclrtCtxSetSysParamOpt, opt = %s, value = %ld.", acl::GetSysParamOptDesc(opt), value); | ||
| 145 | return SetSysParamOpt(opt, value, true); | 146 | return SetSysParamOpt(opt, value, true); |
| 146 | } | 147 | } |
| 147 | 148 | ||
| @@ -149,13 +150,13 @@ aclError aclrtGetSysParamOptImpl(aclSysParamOpt opt, int64_t* value) { return Ge | |||
| 149 | 150 | ||
| 150 | aclError aclrtSetSysParamOptImpl(aclSysParamOpt opt, int64_t value) | 151 | aclError aclrtSetSysParamOptImpl(aclSysParamOpt opt, int64_t value) |
| 151 | { | 152 | { |
| 152 | - ACL_LOG_INFO("start to execute aclrtSetSysParamOpt, opt = %d, value = %ld.", static_cast<int32_t>(opt), value); | 153 | + ACL_LOG_INFO("start to execute aclrtSetSysParamOpt, opt = %s, value = %ld.", acl::GetSysParamOptDesc(opt), value); |
| 153 | return SetSysParamOpt(opt, value, false); | 154 | return SetSysParamOpt(opt, value, false); |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | aclError aclrtPeekAtLastErrorImpl(aclrtLastErrLevel level) | 157 | aclError aclrtPeekAtLastErrorImpl(aclrtLastErrLevel level) |
| 157 | { | 158 | { |
| 158 | - ACL_LOG_INFO("start to execute aclrtPeekAtLastError, level is %d", static_cast<int32_t>(level)); | 159 | + ACL_LOG_INFO("start to execute aclrtPeekAtLastError, level is %s", acl::GetLastErrLevelDesc(level)); |
| 159 | ACL_REQUIRES_PARAM_EQUAL_REPORT(level, ACL_RT_THREAD_LEVEL); | 160 | ACL_REQUIRES_PARAM_EQUAL_REPORT(level, ACL_RT_THREAD_LEVEL); |
| 160 | const rtLastErrLevel_t rtLevel = static_cast<rtLastErrLevel_t>(level); | 161 | const rtLastErrLevel_t rtLevel = static_cast<rtLastErrLevel_t>(level); |
| 161 | return rtPeekAtLastError(rtLevel); | 162 | return rtPeekAtLastError(rtLevel); |
| @@ -163,7 +164,7 @@ aclError aclrtPeekAtLastErrorImpl(aclrtLastErrLevel level) | |||
| 163 | 164 | ||
| 164 | aclError aclrtGetLastErrorImpl(aclrtLastErrLevel level) | 165 | aclError aclrtGetLastErrorImpl(aclrtLastErrLevel level) |
| 165 | { | 166 | { |
| 166 | - ACL_LOG_INFO("start to execute aclrtGetLastError, level is %d", static_cast<int32_t>(level)); | 167 | + ACL_LOG_INFO("start to execute aclrtGetLastError, level is %s", acl::GetLastErrLevelDesc(level)); |
| 167 | ACL_REQUIRES_PARAM_EQUAL_REPORT(level, ACL_RT_THREAD_LEVEL); | 168 | ACL_REQUIRES_PARAM_EQUAL_REPORT(level, ACL_RT_THREAD_LEVEL); |
| 168 | const rtLastErrLevel_t rtLevel = static_cast<rtLastErrLevel_t>(level); | 169 | const rtLastErrLevel_t rtLevel = static_cast<rtLastErrLevel_t>(level); |
| 169 | return rtGetLastError(rtLevel); | 170 | return rtGetLastError(rtLevel); |
| @@ -152,7 +152,7 @@ aclError aclrtGetRunModeImpl(aclrtRunMode* runMode) | |||
| 152 | return ACL_SUCCESS; | 152 | return ACL_SUCCESS; |
| 153 | } | 153 | } |
| 154 | *runMode = ACL_HOST; | 154 | *runMode = ACL_HOST; |
| 155 | - ACL_LOG_INFO("successfully execute aclrtGetRunMode, current runMode is %d.", static_cast<int32_t>(*runMode)); | 155 | + ACL_LOG_INFO("successfully execute aclrtGetRunMode, current runMode is %s.", acl::GetRunModeDesc(*runMode)); |
| 156 | return ACL_SUCCESS; | 156 | return ACL_SUCCESS; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| @@ -186,7 +186,7 @@ aclError aclrtSynchronizeDeviceWithTimeoutImpl(int32_t timeout) | |||
| 186 | aclError aclrtSetTsDeviceImpl(aclrtTsId tsId) | 186 | aclError aclrtSetTsDeviceImpl(aclrtTsId tsId) |
| 187 | { | 187 | { |
| 188 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetTsDevice); | 188 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetTsDevice); |
| 189 | - ACL_LOG_INFO("start to execute aclrtSetTsDevice, tsId = %d.", static_cast<int32_t>(tsId)); | 189 | + ACL_LOG_INFO("start to execute aclrtSetTsDevice, tsId = %s.", acl::GetTsIdDesc(tsId)); |
| 190 | if ((tsId != ACL_TS_ID_AICORE) && (tsId != ACL_TS_ID_AIVECTOR)) { | 190 | if ((tsId != ACL_TS_ID_AICORE) && (tsId != ACL_TS_ID_AIVECTOR)) { |
| 191 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 191 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 192 | acl::AclErrorLogManager::ReportInputError( | 192 | acl::AclErrorLogManager::ReportInputError( |
| @@ -196,7 +196,7 @@ aclError aclrtSetTsDeviceImpl(aclrtTsId tsId) | |||
| 196 | return ACL_ERROR_INVALID_PARAM; | 196 | return ACL_ERROR_INVALID_PARAM; |
| 197 | } | 197 | } |
| 198 | ACL_REQUIRES_RTS_OK(rtSetTSDevice(static_cast<uint32_t>(tsId))); | 198 | ACL_REQUIRES_RTS_OK(rtSetTSDevice(static_cast<uint32_t>(tsId))); |
| 199 | - ACL_LOG_INFO("successfully execute aclrtSetTsDevice, set device ts %d", static_cast<int32_t>(tsId)); | 199 | + ACL_LOG_INFO("successfully execute aclrtSetTsDevice, set device ts %s", acl::GetTsIdDesc(tsId)); |
| 200 | return ACL_SUCCESS; | 200 | return ACL_SUCCESS; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| @@ -236,15 +236,15 @@ aclError aclrtGetDeviceSatModeImpl(aclrtFloatOverflowMode* mode) | |||
| 236 | rtFloatOverflowMode_t rtMode = RT_OVERFLOW_MODE_UNDEF; | 236 | rtFloatOverflowMode_t rtMode = RT_OVERFLOW_MODE_UNDEF; |
| 237 | ACL_REQUIRES_RTS_OK(rtGetDeviceSatMode(&rtMode)); | 237 | ACL_REQUIRES_RTS_OK(rtGetDeviceSatMode(&rtMode)); |
| 238 | *mode = static_cast<aclrtFloatOverflowMode>(rtMode); | 238 | *mode = static_cast<aclrtFloatOverflowMode>(rtMode); |
| 239 | - ACL_LOG_INFO("successfully execute aclrtGetDeviceSatMode, mode is %d.", *mode); | 239 | + ACL_LOG_INFO("successfully execute aclrtGetDeviceSatMode, mode is %s.", acl::GetFloatOverflowModeDesc(*mode)); |
| 240 | return ACL_SUCCESS; | 240 | return ACL_SUCCESS; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | aclError aclrtSetDeviceSatModeImpl(aclrtFloatOverflowMode mode) | 243 | aclError aclrtSetDeviceSatModeImpl(aclrtFloatOverflowMode mode) |
| 244 | { | 244 | { |
| 245 | - ACL_LOG_INFO("start to execute aclrtSetDeviceSatMode, mode is %d", mode); | 245 | + ACL_LOG_INFO("start to execute aclrtSetDeviceSatMode, mode is %s", acl::GetFloatOverflowModeDesc(mode)); |
| 246 | ACL_REQUIRES_RTS_OK(rtSetDeviceSatMode(static_cast<rtFloatOverflowMode_t>(mode))); | 246 | ACL_REQUIRES_RTS_OK(rtSetDeviceSatMode(static_cast<rtFloatOverflowMode_t>(mode))); |
| 247 | - ACL_LOG_INFO("successfully execute aclrtSetDeviceSatMode, mode is %d", mode); | 247 | + ACL_LOG_INFO("successfully execute aclrtSetDeviceSatMode, mode is %s", acl::GetFloatOverflowModeDesc(mode)); |
| 248 | return ACL_SUCCESS; | 248 | return ACL_SUCCESS; |
| 249 | } | 249 | } |
| 250 | 250 | ||
| @@ -400,8 +400,8 @@ aclError aclrtGetDeviceResLimitImpl(int32_t deviceId, aclrtDevResLimitType type, | |||
| 400 | { | 400 | { |
| 401 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetDeviceResLimit); | 401 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetDeviceResLimit); |
| 402 | ACL_LOG_INFO( | 402 | ACL_LOG_INFO( |
| 403 | - "start to execute aclrtGetDeviceResLimit, deviceId is [%d], type is [%u]", deviceId, | 403 | + "start to execute aclrtGetDeviceResLimit, deviceId is [%d], type is [%s]", deviceId, |
| 404 | - static_cast<uint32_t>(type)); | 404 | + acl::GetDevResLimitTypeDesc(type)); |
| 405 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); | 405 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); |
| 406 | 406 | ||
| 407 | ACL_REQUIRES_RTS_OK(rtsGetDeviceResLimit(deviceId, static_cast<rtDevResLimitType_t>(type), value)); | 407 | ACL_REQUIRES_RTS_OK(rtsGetDeviceResLimit(deviceId, static_cast<rtDevResLimitType_t>(type), value)); |
| @@ -414,8 +414,8 @@ aclError aclrtSetDeviceResLimitImpl(int32_t deviceId, aclrtDevResLimitType type, | |||
| 414 | { | 414 | { |
| 415 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetDeviceResLimit); | 415 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetDeviceResLimit); |
| 416 | ACL_LOG_INFO( | 416 | ACL_LOG_INFO( |
| 417 | - "start to execute aclrtSetDeviceResLimit, deviceId is [%d], type is [%u], value is [%u]", deviceId, | 417 | + "start to execute aclrtSetDeviceResLimit, deviceId is [%d], type is [%s], value is [%u]", deviceId, |
| 418 | - static_cast<uint32_t>(type), value); | 418 | + acl::GetDevResLimitTypeDesc(type), value); |
| 419 | 419 | ||
| 420 | ACL_REQUIRES_RTS_OK(rtsSetDeviceResLimit(deviceId, static_cast<rtDevResLimitType_t>(type), value)); | 420 | ACL_REQUIRES_RTS_OK(rtsSetDeviceResLimit(deviceId, static_cast<rtDevResLimitType_t>(type), value)); |
| 421 | 421 | ||
| @@ -437,7 +437,7 @@ aclError aclrtResetDeviceResLimitImpl(int32_t deviceId) | |||
| 437 | aclError aclrtGetStreamResLimitImpl(aclrtStream stream, aclrtDevResLimitType type, uint32_t* value) | 437 | aclError aclrtGetStreamResLimitImpl(aclrtStream stream, aclrtDevResLimitType type, uint32_t* value) |
| 438 | { | 438 | { |
| 439 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetStreamResLimit); | 439 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetStreamResLimit); |
| 440 | - ACL_LOG_INFO("start to execute aclrtGetStreamResLimit, type is [%u]", static_cast<uint32_t>(type)); | 440 | + ACL_LOG_INFO("start to execute aclrtGetStreamResLimit, type is [%s]", acl::GetDevResLimitTypeDesc(type)); |
| 441 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); | 441 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); |
| 442 | ACL_REQUIRES_RTS_OK( | 442 | ACL_REQUIRES_RTS_OK( |
| 443 | rtsGetStreamResLimit(static_cast<rtStream_t>(stream), static_cast<rtDevResLimitType_t>(type), value)); | 443 | rtsGetStreamResLimit(static_cast<rtStream_t>(stream), static_cast<rtDevResLimitType_t>(type), value)); |
| @@ -450,7 +450,8 @@ aclError aclrtSetStreamResLimitImpl(aclrtStream stream, aclrtDevResLimitType typ | |||
| 450 | { | 450 | { |
| 451 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetStreamResLimit); | 451 | ACL_PROFILING_REG(acl::AclProfType::AclrtSetStreamResLimit); |
| 452 | ACL_LOG_INFO( | 452 | ACL_LOG_INFO( |
| 453 | - "start to execute aclrtSetStreamResLimit, type is [%u], value is [%u]", static_cast<uint32_t>(type), value); | 453 | + "start to execute aclrtSetStreamResLimit, type is [%s], value is [%u]", acl::GetDevResLimitTypeDesc(type), |
| 454 | + value); | ||
| 454 | ACL_REQUIRES_RTS_OK( | 455 | ACL_REQUIRES_RTS_OK( |
| 455 | rtsSetStreamResLimit(static_cast<rtStream_t>(stream), static_cast<rtDevResLimitType_t>(type), value)); | 456 | rtsSetStreamResLimit(static_cast<rtStream_t>(stream), static_cast<rtDevResLimitType_t>(type), value)); |
| 456 | 457 | ||
| @@ -618,14 +619,14 @@ aclError aclrtDeviceSetLimitImpl(aclrtDeviceLimit limit, size_t value) | |||
| 618 | { | 619 | { |
| 619 | ACL_PROFILING_REG(acl::AclProfType::AclrtDeviceSetLimit); | 620 | ACL_PROFILING_REG(acl::AclProfType::AclrtDeviceSetLimit); |
| 620 | ACL_LOG_INFO( | 621 | ACL_LOG_INFO( |
| 621 | - "start to execute aclrtDeviceSetLimit, limit is [%d], value is [%zu]", static_cast<int32_t>(limit), value); | 622 | + "start to execute aclrtDeviceSetLimit, limit is [%s], value is [%zu]", acl::GetDeviceLimitDesc(limit), value); |
| 622 | const auto rtType = AclLimitToRtLimit(limit); | 623 | const auto rtType = AclLimitToRtLimit(limit); |
| 623 | if (rtType == RT_LIMIT_TYPE_RESERVED) { | 624 | if (rtType == RT_LIMIT_TYPE_RESERVED) { |
| 624 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 625 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 625 | - std::string limitStr = std::to_string(static_cast<int32_t>(limit)); | 626 | + const char_t* const limitStr = acl::GetDeviceLimitDesc(limit); |
| 626 | acl::AclErrorLogManager::ReportInputError( | 627 | acl::AclErrorLogManager::ReportInputError( |
| 627 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 628 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 628 | - std::vector<const char*>({funcName.c_str(), limitStr.c_str(), "limit", "[0, 4]"})); | 629 | + std::vector<const char*>({funcName.c_str(), limitStr, "limit", "[0, 4]"})); |
| 629 | return ACL_ERROR_INVALID_PARAM; | 630 | return ACL_ERROR_INVALID_PARAM; |
| 630 | } | 631 | } |
| 631 | if (value > static_cast<size_t>(UINT32_MAX)) { | 632 | if (value > static_cast<size_t>(UINT32_MAX)) { |
| @@ -640,7 +641,7 @@ aclError aclrtDeviceSetLimitImpl(aclrtDeviceLimit limit, size_t value) | |||
| 640 | if (rtSetErr != RT_ERROR_NONE) { | 641 | if (rtSetErr != RT_ERROR_NONE) { |
| 641 | if (rtSetErr == ACL_ERROR_RT_FEATURE_NOT_SUPPORT) { | 642 | if (rtSetErr == ACL_ERROR_RT_FEATURE_NOT_SUPPORT) { |
| 642 | ACL_LOG_WARN( | 643 | ACL_LOG_WARN( |
| 643 | - "aclrtDeviceSetLimit not supported, limit is [%d], value is [%zu].", static_cast<int32_t>(limit), | 644 | + "aclrtDeviceSetLimit not supported, limit is [%s], value is [%zu].", acl::GetDeviceLimitDesc(limit), |
| 644 | value); | 645 | value); |
| 645 | return rtSetErr; | 646 | return rtSetErr; |
| 646 | } | 647 | } |
| @@ -648,29 +649,30 @@ aclError aclrtDeviceSetLimitImpl(aclrtDeviceLimit limit, size_t value) | |||
| 648 | return ACL_GET_ERRCODE_RTS(rtSetErr); | 649 | return ACL_GET_ERRCODE_RTS(rtSetErr); |
| 649 | } | 650 | } |
| 650 | ACL_LOG_INFO( | 651 | ACL_LOG_INFO( |
| 651 | - "successfully execute aclrtDeviceSetLimit, limit is [%d], value is [%zu]", static_cast<int32_t>(limit), value); | 652 | + "successfully execute aclrtDeviceSetLimit, limit is [%s], value is [%zu]", acl::GetDeviceLimitDesc(limit), |
| 653 | + value); | ||
| 652 | return ACL_SUCCESS; | 654 | return ACL_SUCCESS; |
| 653 | } | 655 | } |
| 654 | 656 | ||
| 655 | aclError aclrtDeviceGetLimitImpl(aclrtDeviceLimit limit, size_t* value) | 657 | aclError aclrtDeviceGetLimitImpl(aclrtDeviceLimit limit, size_t* value) |
| 656 | { | 658 | { |
| 657 | ACL_PROFILING_REG(acl::AclProfType::AclrtDeviceGetLimit); | 659 | ACL_PROFILING_REG(acl::AclProfType::AclrtDeviceGetLimit); |
| 658 | - ACL_LOG_INFO("start to execute aclrtDeviceGetLimit, limit is [%d]", static_cast<int32_t>(limit)); | 660 | + ACL_LOG_INFO("start to execute aclrtDeviceGetLimit, limit is [%s]", acl::GetDeviceLimitDesc(limit)); |
| 659 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); | 661 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(value); |
| 660 | const auto rtType = AclLimitToRtLimit(limit); | 662 | const auto rtType = AclLimitToRtLimit(limit); |
| 661 | if (rtType == RT_LIMIT_TYPE_RESERVED) { | 663 | if (rtType == RT_LIMIT_TYPE_RESERVED) { |
| 662 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 664 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 663 | - std::string limitStr = std::to_string(static_cast<int32_t>(limit)); | 665 | + const char_t* const limitStr = acl::GetDeviceLimitDesc(limit); |
| 664 | acl::AclErrorLogManager::ReportInputError( | 666 | acl::AclErrorLogManager::ReportInputError( |
| 665 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 667 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| 666 | - std::vector<const char*>({funcName.c_str(), limitStr.c_str(), "limit", "[0, 4]"})); | 668 | + std::vector<const char*>({funcName.c_str(), limitStr, "limit", "[0, 4]"})); |
| 667 | return ACL_ERROR_INVALID_PARAM; | 669 | return ACL_ERROR_INVALID_PARAM; |
| 668 | } | 670 | } |
| 669 | uint32_t rtValue = 0U; | 671 | uint32_t rtValue = 0U; |
| 670 | const rtError_t rtGetErr = rtDeviceGetLimit(rtType, &rtValue); | 672 | const rtError_t rtGetErr = rtDeviceGetLimit(rtType, &rtValue); |
| 671 | if (rtGetErr != RT_ERROR_NONE) { | 673 | if (rtGetErr != RT_ERROR_NONE) { |
| 672 | if (rtGetErr == ACL_ERROR_RT_FEATURE_NOT_SUPPORT) { | 674 | if (rtGetErr == ACL_ERROR_RT_FEATURE_NOT_SUPPORT) { |
| 673 | - ACL_LOG_WARN("aclrtDeviceGetLimit not supported, limit is [%d].", static_cast<int32_t>(limit)); | 675 | + ACL_LOG_WARN("aclrtDeviceGetLimit not supported, limit is [%s].", acl::GetDeviceLimitDesc(limit)); |
| 674 | return rtGetErr; | 676 | return rtGetErr; |
| 675 | } | 677 | } |
| 676 | ACL_LOG_CALL_ERROR("rtDeviceGetLimit failed, runtime result = %d.", static_cast<int32_t>(rtGetErr)); | 678 | ACL_LOG_CALL_ERROR("rtDeviceGetLimit failed, runtime result = %d.", static_cast<int32_t>(rtGetErr)); |
| @@ -678,7 +680,8 @@ aclError aclrtDeviceGetLimitImpl(aclrtDeviceLimit limit, size_t* value) | |||
| 678 | } | 680 | } |
| 679 | *value = static_cast<size_t>(rtValue); | 681 | *value = static_cast<size_t>(rtValue); |
| 680 | ACL_LOG_INFO( | 682 | ACL_LOG_INFO( |
| 681 | - "successfully execute aclrtDeviceGetLimit, limit is [%d], value is [%zu]", static_cast<int32_t>(limit), *value); | 683 | + "successfully execute aclrtDeviceGetLimit, limit is [%s], value is [%zu]", acl::GetDeviceLimitDesc(limit), |
| 684 | + *value); | ||
| 682 | return ACL_SUCCESS; | 685 | return ACL_SUCCESS; |
| 683 | } | 686 | } |
| 684 | 687 | ||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | extern "C" { | 25 | extern "C" { |
| @@ -413,7 +414,9 @@ aclError aclrtRepairErrorImpl(int32_t deviceId, const aclrtErrorInfo* errorInfo) | |||
| 413 | { | 414 | { |
| 414 | ACL_PROFILING_REG(acl::AclProfType::AclrtRepairError); | 415 | ACL_PROFILING_REG(acl::AclProfType::AclrtRepairError); |
| 415 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(errorInfo); | 416 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(errorInfo); |
| 416 | - ACL_LOG_INFO("start to execute aclrtRepairError with deviceId %d and errorType %d", deviceId, errorInfo->errorType); | 417 | + ACL_LOG_INFO( |
| 418 | + "start to execute aclrtRepairError with deviceId %d and errorType %s", deviceId, | ||
| 419 | + acl::GetErrorTypeDesc(errorInfo->errorType)); | ||
| 417 | 420 | ||
| 418 | // Type conversion adaptation | 421 | // Type conversion adaptation |
| 419 | const uint32_t rtsDeviceId = static_cast<uint32_t>(deviceId); | 422 | const uint32_t rtsDeviceId = static_cast<uint32_t>(deviceId); |
| @@ -191,7 +191,7 @@ aclError aclrtGetGroupInfoDetailImpl( | |||
| 191 | attrValue, valueLen, paramRetSize, __func__); | 191 | attrValue, valueLen, paramRetSize, __func__); |
| 192 | break; | 192 | break; |
| 193 | default: | 193 | default: |
| 194 | - ACL_LOG_ERROR("invalid group attribute, attribute = %d", static_cast<int32_t>(attr)); | 194 | + ACL_LOG_ERROR("invalid group attribute, attribute = UNKNOWN(%d)", static_cast<int32_t>(attr)); |
| 195 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 195 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 196 | acl::AclErrorLogManager::ReportInputError( | 196 | acl::AclErrorLogManager::ReportInputError( |
| 197 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), | 197 | acl::INVALID_VALUE_MSG, std::vector<const char*>({"func", "value", "param", "expect"}), |
| @@ -659,7 +659,7 @@ aclError aclrtRandomNumAsyncImpl(const aclrtRandomNumTaskInfo* taskInfo, const a | |||
| 659 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(taskInfo); | 659 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(taskInfo); |
| 660 | aclDataType type = taskInfo->dataType; | 660 | aclDataType type = taskInfo->dataType; |
| 661 | if (kMapDataType.count(type) == 0) { | 661 | if (kMapDataType.count(type) == 0) { |
| 662 | - ACL_LOG_ERROR("[Check][param]param dataType [%d] is invalid.", static_cast<int32_t>(type)); | 662 | + ACL_LOG_ERROR("[Check][param]param dataType [%s] is invalid.", acl::GetDataTypeDesc(type)); |
| 663 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 663 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 664 | acl::AclErrorLogManager::ReportInputError( | 664 | acl::AclErrorLogManager::ReportInputError( |
| 665 | acl::INVALID_PARAM_REASON_MSG, std::vector<const char*>({"func", "value", "param", "reason"}), | 665 | acl::INVALID_PARAM_REASON_MSG, std::vector<const char*>({"func", "value", "param", "reason"}), |
| @@ -708,8 +708,8 @@ aclError aclrtMemcpyAsyncWithConditionImpl( | |||
| 708 | { | 708 | { |
| 709 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpyAsyncWithCondition); | 709 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpyAsyncWithCondition); |
| 710 | ACL_LOG_DEBUG( | 710 | ACL_LOG_DEBUG( |
| 711 | - "start to execute aclrtMemcpyAsyncWithCondition, destMaxSize = %zu, srcSize = %zu, kind = %d", destMax, count, | 711 | + "start to execute aclrtMemcpyAsyncWithCondition, destMaxSize = %zu, srcSize = %zu, kind = %s", destMax, count, |
| 712 | - static_cast<int32_t>(kind)); | 712 | + acl::GetMemcpyKindDesc(kind)); |
| 713 | if (count == 0UL) { | 713 | if (count == 0UL) { |
| 714 | ACL_LOG_INFO("zero-size memcpy, no memory copy async will be performed"); | 714 | ACL_LOG_INFO("zero-size memcpy, no memory copy async will be performed"); |
| 715 | return ACL_SUCCESS; | 715 | return ACL_SUCCESS; |
| @@ -965,14 +965,14 @@ aclError aclrtGetMemInfoImpl(aclrtMemAttr attr, size_t* free, size_t* total) | |||
| 965 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetMemInfo); | 965 | ACL_PROFILING_REG(acl::AclProfType::AclrtGetMemInfo); |
| 966 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(free); | 966 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(free); |
| 967 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(total); | 967 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(total); |
| 968 | - ACL_LOG_DEBUG("start to execute aclrtGetMemInfo, memory attribute = %d", static_cast<int32_t>(attr)); | 968 | + ACL_LOG_DEBUG("start to execute aclrtGetMemInfo, memory attribute = %s", acl::GetMemAttrDesc(attr)); |
| 969 | 969 | ||
| 970 | ACL_REQUIRES_RTS_OK(rtMemGetInfoEx(static_cast<rtMemInfoType_t>(attr), free, total)); | 970 | ACL_REQUIRES_RTS_OK(rtMemGetInfoEx(static_cast<rtMemInfoType_t>(attr), free, total)); |
| 971 | 971 | ||
| 972 | ACL_LOG_DEBUG( | 972 | ACL_LOG_DEBUG( |
| 973 | - "successfully execute aclrtGetMemInfo, memory attribute = %d, free memory = %zu bytes, " | 973 | + "successfully execute aclrtGetMemInfo, memory attribute = %s, free memory = %zu bytes, " |
| 974 | "total memory = %zu bytes", | 974 | "total memory = %zu bytes", |
| 975 | - static_cast<int32_t>(attr), *free, *total); | 975 | + acl::GetMemAttrDesc(attr), *free, *total); |
| 976 | return ACL_SUCCESS; | 976 | return ACL_SUCCESS; |
| 977 | } | 977 | } |
| 978 | 978 | ||
| @@ -997,8 +997,8 @@ aclError aclrtMemcpy2dImpl( | |||
| 997 | { | 997 | { |
| 998 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpy2d); | 998 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpy2d); |
| 999 | ACL_LOG_DEBUG( | 999 | ACL_LOG_DEBUG( |
| 1000 | - "start to execute aclrtMemcpy2d, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, kind = %d", dpitch, | 1000 | + "start to execute aclrtMemcpy2d, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, kind = %s", dpitch, |
| 1001 | - spitch, width, height, static_cast<int32_t>(kind)); | 1001 | + spitch, width, height, acl::GetMemcpyKindDesc(kind)); |
| 1002 | 1002 | ||
| 1003 | rtMemcpyKind_t rtKind = RT_MEMCPY_RESERVED; | 1003 | rtMemcpyKind_t rtKind = RT_MEMCPY_RESERVED; |
| 1004 | const aclError ret = CheckMemcpy2dParam(dst, dpitch, src, spitch, width, height, kind, rtKind); | 1004 | const aclError ret = CheckMemcpy2dParam(dst, dpitch, src, spitch, width, height, kind, rtKind); |
| @@ -1010,8 +1010,8 @@ aclError aclrtMemcpy2dImpl( | |||
| 1010 | 1010 | ||
| 1011 | ACL_LOG_DEBUG( | 1011 | ACL_LOG_DEBUG( |
| 1012 | "Successfuly execute aclrtMemcpy2d, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, " | 1012 | "Successfuly execute aclrtMemcpy2d, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, " |
| 1013 | - "kind = %d", | 1013 | + "kind = %s", |
| 1014 | - dpitch, spitch, width, height, static_cast<int32_t>(kind)); | 1014 | + dpitch, spitch, width, height, acl::GetMemcpyKindDesc(kind)); |
| 1015 | return ACL_SUCCESS; | 1015 | return ACL_SUCCESS; |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| @@ -1022,8 +1022,8 @@ aclError aclrtMemcpy2dAsyncImpl( | |||
| 1022 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpy2dAsync); | 1022 | ACL_PROFILING_REG(acl::AclProfType::AclrtMemcpy2dAsync); |
| 1023 | ACL_LOG_DEBUG( | 1023 | ACL_LOG_DEBUG( |
| 1024 | "start to execute aclrtMemcpy2dAsync, dpitch = %zu, spitch = %zu, width = %zu, height = %zu," | 1024 | "start to execute aclrtMemcpy2dAsync, dpitch = %zu, spitch = %zu, width = %zu, height = %zu," |
| 1025 | - " kind = %d", | 1025 | + " kind = %s", |
| 1026 | - dpitch, spitch, width, height, static_cast<int32_t>(kind)); | 1026 | + dpitch, spitch, width, height, acl::GetMemcpyKindDesc(kind)); |
| 1027 | 1027 | ||
| 1028 | rtMemcpyKind_t rtKindVal = RT_MEMCPY_RESERVED; | 1028 | rtMemcpyKind_t rtKindVal = RT_MEMCPY_RESERVED; |
| 1029 | const aclError ret = CheckMemcpy2dParam(dst, dpitch, src, spitch, width, height, kind, rtKindVal); | 1029 | const aclError ret = CheckMemcpy2dParam(dst, dpitch, src, spitch, width, height, kind, rtKindVal); |
| @@ -1036,8 +1036,8 @@ aclError aclrtMemcpy2dAsyncImpl( | |||
| 1036 | 1036 | ||
| 1037 | ACL_LOG_DEBUG( | 1037 | ACL_LOG_DEBUG( |
| 1038 | "Successfuly execute aclrtMemcpy2dAsync, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, " | 1038 | "Successfuly execute aclrtMemcpy2dAsync, dpitch = %zu, spitch = %zu, width = %zu, height = %zu, " |
| 1039 | - "kind = %d", | 1039 | + "kind = %s", |
| 1040 | - dpitch, spitch, width, height, static_cast<int32_t>(kind)); | 1040 | + dpitch, spitch, width, height, acl::GetMemcpyKindDesc(kind)); |
| 1041 | return ACL_SUCCESS; | 1041 | return ACL_SUCCESS; |
| 1042 | } | 1042 | } |
| 1043 | 1043 | ||
| @@ -1464,8 +1464,8 @@ aclError aclrtReduceAsyncImpl( | |||
| 1464 | { | 1464 | { |
| 1465 | ACL_PROFILING_REG(acl::AclProfType::AclrtReduceAsync); | 1465 | ACL_PROFILING_REG(acl::AclProfType::AclrtReduceAsync); |
| 1466 | ACL_LOG_DEBUG( | 1466 | ACL_LOG_DEBUG( |
| 1467 | - "start to execute aclrtReduceAsync, count = [%lu], kind = [%u], type = [%u]", count, | 1467 | + "start to execute aclrtReduceAsync, count = [%lu], kind = [%s], type = [%s]", count, |
| 1468 | - static_cast<uint32_t>(kind), static_cast<uint32_t>(type)); | 1468 | + acl::GetReduceKindDesc(kind), acl::GetDataTypeDesc(type)); |
| 1469 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(dst); | 1469 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(dst); |
| 1470 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(src); | 1470 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(src); |
| 1471 | ACL_CHECK_INVALID_PARAM_NO_VALUE( | 1471 | ACL_CHECK_INVALID_PARAM_NO_VALUE( |
| @@ -1475,7 +1475,7 @@ aclError aclrtReduceAsyncImpl( | |||
| 1475 | if (kMapDataType.count(type) > 0) { | 1475 | if (kMapDataType.count(type) > 0) { |
| 1476 | dataType = kMapDataType.at(type); | 1476 | dataType = kMapDataType.at(type); |
| 1477 | } else { | 1477 | } else { |
| 1478 | - ACL_LOG_ERROR("[Check][param]param type [%d] is invalid.", static_cast<int32_t>(type)); | 1478 | + ACL_LOG_ERROR("[Check][param]param type [%s] is invalid.", acl::GetDataTypeDesc(type)); |
| 1479 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); | 1479 | std::string funcName = acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix(__func__); |
| 1480 | acl::AclErrorLogManager::ReportInputError( | 1480 | acl::AclErrorLogManager::ReportInputError( |
| 1481 | acl::INVALID_PARAM_REASON_MSG, std::vector<const char*>({"func", "value", "param", "reason"}), | 1481 | acl::INVALID_PARAM_REASON_MSG, std::vector<const char*>({"func", "value", "param", "reason"}), |
| @@ -1679,8 +1679,8 @@ aclError aclrtCmoAsyncWithBarrierImpl( | |||
| 1679 | { | 1679 | { |
| 1680 | ACL_PROFILING_REG(acl::AclProfType::AclrtCmoAsyncWithBarrier); | 1680 | ACL_PROFILING_REG(acl::AclProfType::AclrtCmoAsyncWithBarrier); |
| 1681 | ACL_LOG_INFO( | 1681 | ACL_LOG_INFO( |
| 1682 | - "start to execute aclrtCmoAsyncWithBarrier, size is [%zu], cmoType is [%u], barrierId is [%u]", size, | 1682 | + "start to execute aclrtCmoAsyncWithBarrier, size is [%zu], cmoType is [%s], barrierId is [%u]", size, |
| 1683 | - static_cast<uint32_t>(cmoType), barrierId); | 1683 | + acl::GetCmoTypeDesc(cmoType), barrierId); |
| 1684 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(src); | 1684 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(src); |
| 1685 | const rtCmoOpCode rtCmoType = static_cast<rtCmoOpCode>( | 1685 | const rtCmoOpCode rtCmoType = static_cast<rtCmoOpCode>( |
| 1686 | static_cast<uint32_t>(cmoType) + | 1686 | static_cast<uint32_t>(cmoType) + |
| @@ -1870,7 +1870,8 @@ aclError aclrtIpcMemSetImportPidImpl(const char* key, int32_t* pid, size_t num) | |||
| 1870 | aclError aclrtIpcMemSetAttrImpl(const char* key, aclrtIpcMemAttrType type, uint64_t attr) | 1870 | aclError aclrtIpcMemSetAttrImpl(const char* key, aclrtIpcMemAttrType type, uint64_t attr) |
| 1871 | { | 1871 | { |
| 1872 | ACL_PROFILING_REG(acl::AclProfType::AclrtIpcMemSetAttr); | 1872 | ACL_PROFILING_REG(acl::AclProfType::AclrtIpcMemSetAttr); |
| 1873 | - ACL_LOG_INFO("start to execute aclrtIpcMemSetAttr, type is [%d], attr is [%lu]", type, attr); | 1873 | + ACL_LOG_INFO( |
| 1874 | + "start to execute aclrtIpcMemSetAttr, type is [%s], attr is [%lu]", acl::GetIpcMemAttrTypeDesc(type), attr); | ||
| 1874 | const auto rtErr = rtIpcSetMemoryAttr(key, type, attr); | 1875 | const auto rtErr = rtIpcSetMemoryAttr(key, type, attr); |
| 1875 | if (rtErr == RT_ERROR_NONE) { | 1876 | if (rtErr == RT_ERROR_NONE) { |
| 1876 | ACL_LOG_INFO("successfully execute aclrtIpcMemSetAttr"); | 1877 | ACL_LOG_INFO("successfully execute aclrtIpcMemSetAttr"); |
| @@ -2086,13 +2087,13 @@ aclError aclrtMemPoolCreateImpl(aclrtMemPool* memPool, const aclrtMemPoolProps* | |||
| 2086 | 2087 | ||
| 2087 | ACL_CHECK_INVALID_VALUE_WITH_DESC( | 2088 | ACL_CHECK_INVALID_VALUE_WITH_DESC( |
| 2088 | poolProps->allocType == aclrtMemAllocationType::ACL_MEM_ALLOCATION_TYPE_PINNED, | 2089 | poolProps->allocType == aclrtMemAllocationType::ACL_MEM_ALLOCATION_TYPE_PINNED, |
| 2089 | - acl::GetMemAllocationTypeDesc(poolProps->allocType), "poolProps->allocType", "ACL_MEM_ALLOCATION_TYPE_PINNED", | 2090 | + acl::GetMemAllocationTypeDesc(poolProps->allocType), "poolProps->allocType", "MEM_ALLOCATION_TYPE_PINNED(0)", |
| 2090 | ACL_ERROR_INVALID_PARAM); | 2091 | ACL_ERROR_INVALID_PARAM); |
| 2091 | 2092 | ||
| 2092 | ACL_CHECK_INVALID_VALUE_WITH_DESC( | 2093 | ACL_CHECK_INVALID_VALUE_WITH_DESC( |
| 2093 | poolProps->location.type == aclrtMemLocationType::ACL_MEM_LOCATION_TYPE_DEVICE, | 2094 | poolProps->location.type == aclrtMemLocationType::ACL_MEM_LOCATION_TYPE_DEVICE, |
| 2094 | acl::GetMemLocationTypeDesc(poolProps->location.type), "poolProps->location.type", | 2095 | acl::GetMemLocationTypeDesc(poolProps->location.type), "poolProps->location.type", |
| 2095 | - "ACL_MEM_LOCATION_TYPE_DEVICE", ACL_ERROR_INVALID_PARAM); | 2096 | + "MEM_LOCATION_TYPE_DEVICE(1)", ACL_ERROR_INVALID_PARAM); |
| 2096 | 2097 | ||
| 2097 | rtMemPoolProps rtPoolProps; | 2098 | rtMemPoolProps rtPoolProps; |
| 2098 | rtPoolProps.side = ACL_MEM_LOCATION_TYPE_DEVICE; | 2099 | rtPoolProps.side = ACL_MEM_LOCATION_TYPE_DEVICE; |
| @@ -2478,7 +2479,7 @@ aclError aclrtMemMapSelectedLinkImpl(void* virPtrDst, size_t size, void* virPtrS | |||
| 2478 | 2479 | ||
| 2479 | aclError aclrtMemMapSetLinkImpl(aclrtDrvMemHandle handle, aclrtMemLinkType adviceLink) | 2480 | aclError aclrtMemMapSetLinkImpl(aclrtDrvMemHandle handle, aclrtMemLinkType adviceLink) |
| 2480 | { | 2481 | { |
| 2481 | - ACL_LOG_INFO("start to execute aclrtMemMapSetLink, adviceLink=%d.", static_cast<rtMemLinkType>(adviceLink)); | 2482 | + ACL_LOG_INFO("start to execute aclrtMemMapSetLink, adviceLink=%s.", acl::GetMemLinkTypeDesc(adviceLink)); |
| 2482 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(handle); | 2483 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(handle); |
| 2483 | const auto rtErr = rtMemMapSetLink(static_cast<rtDrvMemHandle>(handle), static_cast<rtMemLinkType>(adviceLink)); | 2484 | const auto rtErr = rtMemMapSetLink(static_cast<rtDrvMemHandle>(handle), static_cast<rtMemLinkType>(adviceLink)); |
| 2484 | if (rtErr == RT_ERROR_NONE) { | 2485 | if (rtErr == RT_ERROR_NONE) { |
| @@ -17,6 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | + | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | extern "C" { | 23 | extern "C" { |
| @@ -48,7 +49,7 @@ aclError aclmdlRIDestroyImpl(aclmdlRI modelRI) | |||
| 48 | aclError aclmdlRICaptureBeginImpl(aclrtStream stream, aclmdlRICaptureMode mode) | 49 | aclError aclmdlRICaptureBeginImpl(aclrtStream stream, aclmdlRICaptureMode mode) |
| 49 | { | 50 | { |
| 50 | ACL_PROFILING_REG(acl::AclProfType::AclmdlRICaptureBegin); | 51 | ACL_PROFILING_REG(acl::AclProfType::AclmdlRICaptureBegin); |
| 51 | - ACL_LOG_INFO("start to execute aclmdlRICaptureBegin, mode is %d", static_cast<int32_t>(mode)); | 52 | + ACL_LOG_INFO("start to execute aclmdlRICaptureBegin, mode is %s", acl::GetCaptureModeDesc(mode)); |
| 52 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(stream); | 53 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(stream); |
| 53 | ACL_REQUIRES_RTS_OK_WARN_NOT_SUPPORT( | 54 | ACL_REQUIRES_RTS_OK_WARN_NOT_SUPPORT( |
| 54 | rtStreamBeginCapture(static_cast<rtStream_t>(stream), static_cast<rtStreamCaptureMode>(mode)), | 55 | rtStreamBeginCapture(static_cast<rtStream_t>(stream), static_cast<rtStreamCaptureMode>(mode)), |
| @@ -137,13 +138,14 @@ aclError aclmdlRICaptureThreadExchangeModeImpl(aclmdlRICaptureMode* mode) | |||
| 137 | { | 138 | { |
| 138 | ACL_PROFILING_REG(acl::AclProfType::AclmdlRICaptureThreadExchangeMode); | 139 | ACL_PROFILING_REG(acl::AclProfType::AclmdlRICaptureThreadExchangeMode); |
| 139 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(mode); | 140 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(mode); |
| 140 | - ACL_LOG_INFO("start to execute aclmdlRICaptureThreadExchangeMode, input mode is %d", static_cast<int32_t>(*mode)); | 141 | + ACL_LOG_INFO( |
| 142 | + "start to execute aclmdlRICaptureThreadExchangeMode, input mode is %s", acl::GetCaptureModeDesc(*mode)); | ||
| 141 | rtStreamCaptureMode rtMode = static_cast<rtStreamCaptureMode>(*mode); | 143 | rtStreamCaptureMode rtMode = static_cast<rtStreamCaptureMode>(*mode); |
| 142 | ACL_REQUIRES_RTS_OK_WARN_NOT_SUPPORT(rtThreadExchangeCaptureMode(&rtMode), rtThreadExchangeCaptureMode); | 144 | ACL_REQUIRES_RTS_OK_WARN_NOT_SUPPORT(rtThreadExchangeCaptureMode(&rtMode), rtThreadExchangeCaptureMode); |
| 143 | *mode = static_cast<aclmdlRICaptureMode>(rtMode); | 145 | *mode = static_cast<aclmdlRICaptureMode>(rtMode); |
| 144 | 146 | ||
| 145 | ACL_LOG_INFO( | 147 | ACL_LOG_INFO( |
| 146 | - "successfully execute aclmdlRICaptureThreadExchangeMode, output mode is %d", static_cast<int32_t>(*mode)); | 148 | + "successfully execute aclmdlRICaptureThreadExchangeMode, output mode is %s", acl::GetCaptureModeDesc(*mode)); |
| 147 | return ACL_SUCCESS; | 149 | return ACL_SUCCESS; |
| 148 | } | 150 | } |
| 149 | 151 | ||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + | ||
| 22 | 23 | ||
| 23 | namespace { | 24 | namespace { |
| 24 | std::unordered_map<rtError_t, const char*> succStmSyncErrCodes = { | 25 | std::unordered_map<rtError_t, const char*> succStmSyncErrCodes = { |
| @@ -356,8 +357,8 @@ aclError aclrtSwitchStreamImpl( | |||
| 356 | { | 357 | { |
| 357 | ACL_PROFILING_REG(acl::AclProfType::AclrtSwitchStream); | 358 | ACL_PROFILING_REG(acl::AclProfType::AclrtSwitchStream); |
| 358 | ACL_LOG_INFO( | 359 | ACL_LOG_INFO( |
| 359 | - "start to execute aclrtSwitchStream, cond is [%u], dataType is [%u]", static_cast<uint32_t>(cond), | 360 | + "start to execute aclrtSwitchStream, cond is [%s], dataType is [%s]", acl::GetConditionDesc(cond), |
| 360 | - static_cast<uint32_t>(dataType)); | 361 | + acl::GetCompareDataTypeDesc(dataType)); |
| 361 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(leftValue); | 362 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(leftValue); |
| 362 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(rightValue); | 363 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(rightValue); |
| 363 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(trueStream); | 364 | ACL_REQUIRES_NOT_NULL_WITH_INPUT_REPORT(trueStream); |
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | + | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | 15 | ||
| @@ -109,7 +110,7 @@ aclError CannInfoUtils::GetAttribute(aclCannAttr cannAttr, int32_t* value) | |||
| 109 | 110 | ||
| 110 | auto iter = attrToCannInfo_.find(cannAttr); | 111 | auto iter = attrToCannInfo_.find(cannAttr); |
| 111 | if (iter == attrToCannInfo_.end()) { | 112 | if (iter == attrToCannInfo_.end()) { |
| 112 | - ACL_LOG_WARN("find cann attr failed, attr value = %d", static_cast<int32_t>(cannAttr)); | 113 | + ACL_LOG_WARN("find cann attr failed, attr value = %s", acl::GetCannAttrDesc(cannAttr)); |
| 113 | return ACL_ERROR_INVALID_PARAM; | 114 | return ACL_ERROR_INVALID_PARAM; |
| 114 | } | 115 | } |
| 115 | *value = iter->second.isAvailable; | 116 | *value = iter->second.isAvailable; |
| @@ -270,4 +271,364 @@ void CannInfoUtils::CheckAndUpdateAttrAvailability() | |||
| 270 | } | 271 | } |
| 271 | } | 272 | } |
| 272 | } | 273 | } |
| 274 | + | ||
| 275 | +const char* GetDataTypeDesc(aclDataType type) | ||
| 276 | +{ | ||
| 277 | + switch (type) { | ||
| 278 | + case ACL_DT_UNDEFINED: | ||
| 279 | + return "DT_UNDEFINED(-1)"; | ||
| 280 | + case ACL_FLOAT: | ||
| 281 | + return "FLOAT(0)"; | ||
| 282 | + case ACL_FLOAT16: | ||
| 283 | + return "FLOAT16(1)"; | ||
| 284 | + case ACL_INT8: | ||
| 285 | + return "INT8(2)"; | ||
| 286 | + case ACL_INT32: | ||
| 287 | + return "INT32(3)"; | ||
| 288 | + case ACL_UINT8: | ||
| 289 | + return "UINT8(4)"; | ||
| 290 | + case ACL_INT16: | ||
| 291 | + return "INT16(6)"; | ||
| 292 | + case ACL_UINT16: | ||
| 293 | + return "UINT16(7)"; | ||
| 294 | + case ACL_UINT32: | ||
| 295 | + return "UINT32(8)"; | ||
| 296 | + case ACL_INT64: | ||
| 297 | + return "INT64(9)"; | ||
| 298 | + case ACL_UINT64: | ||
| 299 | + return "UINT64(10)"; | ||
| 300 | + case ACL_DOUBLE: | ||
| 301 | + return "DOUBLE(11)"; | ||
| 302 | + case ACL_BOOL: | ||
| 303 | + return "BOOL(12)"; | ||
| 304 | + case ACL_STRING: | ||
| 305 | + return "STRING(13)"; | ||
| 306 | + case ACL_COMPLEX64: | ||
| 307 | + return "COMPLEX64(16)"; | ||
| 308 | + case ACL_COMPLEX128: | ||
| 309 | + return "COMPLEX128(17)"; | ||
| 310 | + case ACL_BF16: | ||
| 311 | + return "BF16(27)"; | ||
| 312 | + case ACL_INT4: | ||
| 313 | + return "INT4(29)"; | ||
| 314 | + case ACL_UINT1: | ||
| 315 | + return "UINT1(30)"; | ||
| 316 | + case ACL_COMPLEX32: | ||
| 317 | + return "COMPLEX32(33)"; | ||
| 318 | + case ACL_HIFLOAT8: | ||
| 319 | + return "HIFLOAT8(34)"; | ||
| 320 | + case ACL_FLOAT8_E5M2: | ||
| 321 | + return "FLOAT8_E5M2(35)"; | ||
| 322 | + case ACL_FLOAT8_E4M3FN: | ||
| 323 | + return "FLOAT8_E4M3FN(36)"; | ||
| 324 | + case ACL_FLOAT8_E8M0: | ||
| 325 | + return "FLOAT8_E8M0(37)"; | ||
| 326 | + case ACL_FLOAT6_E3M2: | ||
| 327 | + return "FLOAT6_E3M2(38)"; | ||
| 328 | + case ACL_FLOAT6_E2M3: | ||
| 329 | + return "FLOAT6_E2M3(39)"; | ||
| 330 | + case ACL_FLOAT4_E2M1: | ||
| 331 | + return "FLOAT4_E2M1(40)"; | ||
| 332 | + case ACL_FLOAT4_E1M2: | ||
| 333 | + return "FLOAT4_E1M2(41)"; | ||
| 334 | + default: | ||
| 335 | + break; | ||
| 336 | + } | ||
| 337 | + static thread_local char enumBuf[32]; | ||
| 338 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
Y | |||
| 339 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 340 | + return enumBuf; | ||
| 341 | +} | ||
| 342 | + | ||
| 343 | +const char* GetMemcpyKindDesc(aclrtMemcpyKind kind) | ||
| 344 | +{ | ||
| 345 | + switch (kind) { | ||
| 346 | + case ACL_MEMCPY_HOST_TO_HOST: | ||
| 347 | + return "MEMCPY_HOST_TO_HOST(0)"; | ||
| 348 | + case ACL_MEMCPY_HOST_TO_DEVICE: | ||
| 349 | + return "MEMCPY_HOST_TO_DEVICE(1)"; | ||
| 350 | + case ACL_MEMCPY_DEVICE_TO_HOST: | ||
| 351 | + return "MEMCPY_DEVICE_TO_HOST(2)"; | ||
| 352 | + case ACL_MEMCPY_DEVICE_TO_DEVICE: | ||
| 353 | + return "MEMCPY_DEVICE_TO_DEVICE(3)"; | ||
| 354 | + case ACL_MEMCPY_DEFAULT: | ||
| 355 | + return "MEMCPY_DEFAULT(4)"; | ||
| 356 | + case ACL_MEMCPY_HOST_TO_BUF_TO_DEVICE: | ||
| 357 | + return "MEMCPY_HOST_TO_BUF_TO_DEVICE(5)"; | ||
| 358 | + case ACL_MEMCPY_INNER_DEVICE_TO_DEVICE: | ||
| 359 | + return "MEMCPY_INNER_DEVICE_TO_DEVICE(6)"; | ||
| 360 | + case ACL_MEMCPY_INTER_DEVICE_TO_DEVICE: | ||
| 361 | + return "MEMCPY_INTER_DEVICE_TO_DEVICE(7)"; | ||
| 362 | + default: | ||
| 363 | + break; | ||
| 364 | + } | ||
| 365 | + static thread_local char enumBuf[32]; | ||
| 366 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 367 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 368 | + return enumBuf; | ||
| 369 | +} | ||
| 370 | + | ||
| 371 | +const char* GetMemAttrDesc(aclrtMemAttr attr) | ||
| 372 | +{ | ||
| 373 | + switch (attr) { | ||
| 374 | + case ACL_DDR_MEM: | ||
| 375 | + return "DDR_MEM(0)"; | ||
| 376 | + case ACL_HBM_MEM: | ||
| 377 | + return "HBM_MEM(1)"; | ||
| 378 | + case ACL_DDR_MEM_HUGE: | ||
| 379 | + return "DDR_MEM_HUGE(2)"; | ||
| 380 | + case ACL_DDR_MEM_NORMAL: | ||
| 381 | + return "DDR_MEM_NORMAL(3)"; | ||
| 382 | + case ACL_HBM_MEM_HUGE: | ||
| 383 | + return "HBM_MEM_HUGE(4)"; | ||
| 384 | + case ACL_HBM_MEM_NORMAL: | ||
| 385 | + return "HBM_MEM_NORMAL(5)"; | ||
| 386 | + case ACL_DDR_MEM_P2P_HUGE: | ||
| 387 | + return "DDR_MEM_P2P_HUGE(6)"; | ||
| 388 | + case ACL_DDR_MEM_P2P_NORMAL: | ||
| 389 | + return "DDR_MEM_P2P_NORMAL(7)"; | ||
| 390 | + case ACL_HBM_MEM_P2P_HUGE: | ||
| 391 | + return "HBM_MEM_P2P_HUGE(8)"; | ||
| 392 | + case ACL_HBM_MEM_P2P_NORMAL: | ||
| 393 | + return "HBM_MEM_P2P_NORMAL(9)"; | ||
| 394 | + case ACL_HBM_MEM_HUGE1G: | ||
| 395 | + return "HBM_MEM_HUGE1G(10)"; | ||
| 396 | + case ACL_HBM_MEM_P2P_HUGE1G: | ||
| 397 | + return "HBM_MEM_P2P_HUGE1G(11)"; | ||
| 398 | + case ACL_MEM_NORMAL: | ||
| 399 | + return "MEM_NORMAL(12)"; | ||
| 400 | + case ACL_MEM_HUGE: | ||
| 401 | + return "MEM_HUGE(13)"; | ||
| 402 | + case ACL_MEM_HUGE1G: | ||
| 403 | + return "MEM_HUGE1G(14)"; | ||
| 404 | + case ACL_MEM_P2P_NORMAL: | ||
| 405 | + return "MEM_P2P_NORMAL(15)"; | ||
| 406 | + case ACL_MEM_P2P_HUGE: | ||
| 407 | + return "MEM_P2P_HUGE(16)"; | ||
| 408 | + case ACL_MEM_P2P_HUGE1G: | ||
| 409 | + return "MEM_P2P_HUGE1G(17)"; | ||
| 410 | + default: | ||
| 411 | + break; | ||
| 412 | + } | ||
| 413 | + static thread_local char enumBuf[32]; | ||
| 414 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | ||
| 415 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 416 | + return enumBuf; | ||
| 417 | +} | ||
| 418 | + | ||
| 419 | +const char* GetCannAttrDesc(aclCannAttr attr) | ||
| 420 | +{ | ||
| 421 | + switch (attr) { | ||
| 422 | + case ACL_CANN_ATTR_UNDEFINED: | ||
| 423 | + return "CANN_ATTR_UNDEFINED(-1)"; | ||
| 424 | + case ACL_CANN_ATTR_INF_NAN: | ||
| 425 | + return "CANN_ATTR_INF_NAN(0)"; | ||
| 426 | + case ACL_CANN_ATTR_BF16: | ||
| 427 | + return "CANN_ATTR_BF16(1)"; | ||
| 428 | + case ACL_CANN_ATTR_JIT_COMPILE: | ||
| 429 | + return "CANN_ATTR_JIT_COMPILE(2)"; | ||
| 430 | + default: | ||
| 431 | + break; | ||
| 432 | + } | ||
| 433 | + static thread_local char enumBuf[32]; | ||
| 434 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | ||
| 435 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 436 | + return enumBuf; | ||
| 437 | +} | ||
| 438 | + | ||
| 439 | +const char* GetDevResLimitTypeDesc(aclrtDevResLimitType type) | ||
| 440 | +{ | ||
| 441 | + switch (type) { | ||
| 442 | + case ACL_RT_DEV_RES_CUBE_CORE: | ||
| 443 | + return "RT_DEV_RES_CUBE_CORE(0)"; | ||
| 444 | + case ACL_RT_DEV_RES_VECTOR_CORE: | ||
| 445 | + return "RT_DEV_RES_VECTOR_CORE(1)"; | ||
| 446 | + default: | ||
| 447 | + break; | ||
| 448 | + } | ||
| 449 | + static thread_local char enumBuf[32]; | ||
| 450 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 451 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 452 | + return enumBuf; | ||
| 453 | +} | ||
| 454 | + | ||
| 455 | +const char* GetReduceKindDesc(aclrtReduceKind kind) | ||
| 456 | +{ | ||
| 457 | + switch (kind) { | ||
| 458 | + case ACL_RT_MEMCPY_SDMA_AUTOMATIC_SUM: | ||
| 459 | + return "RT_MEMCPY_SDMA_AUTOMATIC_SUM(10)"; | ||
| 460 | + case ACL_RT_MEMCPY_SDMA_AUTOMATIC_MAX: | ||
| 461 | + return "RT_MEMCPY_SDMA_AUTOMATIC_MAX(11)"; | ||
| 462 | + case ACL_RT_MEMCPY_SDMA_AUTOMATIC_MIN: | ||
| 463 | + return "RT_MEMCPY_SDMA_AUTOMATIC_MIN(12)"; | ||
| 464 | + case ACL_RT_MEMCPY_SDMA_AUTOMATIC_EQUAL: | ||
| 465 | + return "RT_MEMCPY_SDMA_AUTOMATIC_EQUAL(13)"; | ||
| 466 | + default: | ||
| 467 | + break; | ||
| 468 | + } | ||
| 469 | + static thread_local char enumBuf[32]; | ||
| 470 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 471 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 472 | + return enumBuf; | ||
| 473 | +} | ||
| 474 | + | ||
| 475 | +const char* GetMemLinkTypeDesc(aclrtMemLinkType type) | ||
| 476 | +{ | ||
| 477 | + switch (type) { | ||
| 478 | + case ACL_RT_MEM_ACCESS_LINK_SIO: | ||
| 479 | + return "RT_MEM_ACCESS_LINK_SIO(0)"; | ||
| 480 | + case ACL_RT_MEM_ACCESS_LINK_HCCS: | ||
| 481 | + return "RT_MEM_ACCESS_LINK_HCCS(1)"; | ||
| 482 | + case ACL_RT_MEM_ACCESS_UB_ONE_PORT_PATH: | ||
| 483 | + return "RT_MEM_ACCESS_UB_ONE_PORT_PATH(2)"; | ||
| 484 | + case ACL_RT_MEM_ACCESS_UB_MULTI_PORT_PATH: | ||
| 485 | + return "RT_MEM_ACCESS_UB_MULTI_PORT_PATH(3)"; | ||
| 486 | + default: | ||
| 487 | + break; | ||
| 488 | + } | ||
| 489 | + static thread_local char enumBuf[32]; | ||
| 490 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 491 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 492 | + return enumBuf; | ||
| 493 | +} | ||
| 494 | + | ||
| 495 | +const char* GetErrorTypeDesc(aclrtErrorType type) | ||
| 496 | +{ | ||
| 497 | + switch (type) { | ||
| 498 | + case ACL_RT_NO_ERROR: | ||
| 499 | + return "RT_NO_ERROR(0)"; | ||
| 500 | + case ACL_RT_ERROR_MEMORY: | ||
| 501 | + return "RT_ERROR_MEMORY(1)"; | ||
| 502 | + case ACL_RT_ERROR_L2: | ||
| 503 | + return "RT_ERROR_L2(2)"; | ||
| 504 | + case ACL_RT_ERROR_AICORE: | ||
| 505 | + return "RT_ERROR_AICORE(3)"; | ||
| 506 | + case ACL_RT_ERROR_LINK: | ||
| 507 | + return "RT_ERROR_LINK(4)"; | ||
| 508 | + case ACL_RT_ERROR_L3_PORT: | ||
| 509 | + return "RT_ERROR_L3_PORT(5)"; | ||
| 510 | + case ACL_RT_ERROR_OTHERS: | ||
| 511 | + return "RT_ERROR_OTHERS(65535)"; | ||
| 512 | + default: | ||
| 513 | + break; | ||
| 514 | + } | ||
| 515 | + static thread_local char enumBuf[32]; | ||
| 516 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 517 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 518 | + return enumBuf; | ||
| 519 | +} | ||
| 520 | + | ||
| 521 | +const char* GetConditionDesc(aclrtCondition condition) | ||
| 522 | +{ | ||
| 523 | + switch (condition) { | ||
| 524 | + case ACL_RT_EQUAL: | ||
| 525 | + return "RT_EQUAL(0)"; | ||
| 526 | + case ACL_RT_NOT_EQUAL: | ||
| 527 | + return "RT_NOT_EQUAL(1)"; | ||
| 528 | + case ACL_RT_GREATER: | ||
| 529 | + return "RT_GREATER(2)"; | ||
| 530 | + case ACL_RT_GREATER_OR_EQUAL: | ||
| 531 | + return "RT_GREATER_OR_EQUAL(3)"; | ||
| 532 | + case ACL_RT_LESS: | ||
| 533 | + return "RT_LESS(4)"; | ||
| 534 | + case ACL_RT_LESS_OR_EQUAL: | ||
| 535 | + return "RT_LESS_OR_EQUAL(5)"; | ||
| 536 | + default: | ||
| 537 | + break; | ||
| 538 | + } | ||
| 539 | + static thread_local char enumBuf[32]; | ||
| 540 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(condition)); | ||
| 541 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 542 | + return enumBuf; | ||
| 543 | +} | ||
| 544 | + | ||
| 545 | +const char* GetCompareDataTypeDesc(aclrtCompareDataType type) | ||
| 546 | +{ | ||
| 547 | + switch (type) { | ||
| 548 | + case ACL_RT_SWITCH_INT32: | ||
| 549 | + return "RT_SWITCH_INT32(0)"; | ||
| 550 | + case ACL_RT_SWITCH_INT64: | ||
| 551 | + return "RT_SWITCH_INT64(1)"; | ||
| 552 | + default: | ||
| 553 | + break; | ||
| 554 | + } | ||
| 555 | + static thread_local char enumBuf[32]; | ||
| 556 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 557 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 558 | + return enumBuf; | ||
| 559 | +} | ||
| 560 | + | ||
| 561 | +const char* GetIpcMemAttrTypeDesc(aclrtIpcMemAttrType type) | ||
| 562 | +{ | ||
| 563 | + switch (type) { | ||
| 564 | + case ACL_RT_IPC_MEM_ATTR_ACCESS_LINK: | ||
| 565 | + return "RT_IPC_MEM_ATTR_ACCESS_LINK(0)"; | ||
| 566 | + default: | ||
| 567 | + break; | ||
| 568 | + } | ||
| 569 | + static thread_local char enumBuf[32]; | ||
| 570 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 571 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 572 | + return enumBuf; | ||
| 573 | +} | ||
| 574 | + | ||
| 575 | +const char* GetFloatOverflowModeDesc(aclrtFloatOverflowMode mode) | ||
| 576 | +{ | ||
| 577 | + switch (mode) { | ||
| 578 | + case ACL_RT_OVERFLOW_MODE_SATURATION: | ||
| 579 | + return "RT_OVERFLOW_MODE_SATURATION(0)"; | ||
| 580 | + case ACL_RT_OVERFLOW_MODE_INFNAN: | ||
| 581 | + return "RT_OVERFLOW_MODE_INFNAN(1)"; | ||
| 582 | + case ACL_RT_OVERFLOW_MODE_UNDEF: | ||
| 583 | + return "RT_OVERFLOW_MODE_UNDEF(2)"; | ||
| 584 | + default: | ||
| 585 | + break; | ||
| 586 | + } | ||
| 587 | + static thread_local char enumBuf[32]; | ||
| 588 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); | ||
| 589 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 590 | + return enumBuf; | ||
| 591 | +} | ||
| 592 | + | ||
| 593 | +const char* GetCmoTypeDesc(aclrtCmoType type) | ||
| 594 | +{ | ||
| 595 | + switch (type) { | ||
| 596 | + case ACL_RT_CMO_TYPE_PREFETCH: | ||
| 597 | + return "RT_CMO_TYPE_PREFETCH(0)"; | ||
| 598 | + case ACL_RT_CMO_TYPE_WRITEBACK: | ||
| 599 | + return "RT_CMO_TYPE_WRITEBACK(1)"; | ||
| 600 | + case ACL_RT_CMO_TYPE_INVALID: | ||
| 601 | + return "RT_CMO_TYPE_INVALID(2)"; | ||
| 602 | + case ACL_RT_CMO_TYPE_FLUSH: | ||
| 603 | + return "RT_CMO_TYPE_FLUSH(3)"; | ||
| 604 | + default: | ||
| 605 | + break; | ||
| 606 | + } | ||
| 607 | + static thread_local char enumBuf[32]; | ||
| 608 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 609 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 610 | + return enumBuf; | ||
| 611 | +} | ||
| 612 | + | ||
| 613 | +const char* GetDeviceLimitDesc(aclrtDeviceLimit limit) | ||
| 614 | +{ | ||
| 615 | + switch (limit) { | ||
| 616 | + case ACL_RT_DEV_LIMIT_SIMT_STACK_SIZE: | ||
| 617 | + return "RT_DEV_LIMIT_SIMT_STACK_SIZE(0)"; | ||
| 618 | + case ACL_RT_DEV_LIMIT_SIMT_DVG_WARP_STACK_SIZE: | ||
| 619 | + return "RT_DEV_LIMIT_SIMT_DVG_WARP_STACK_SIZE(1)"; | ||
| 620 | + case ACL_RT_DEV_LIMIT_SIMD_STACK_SIZE: | ||
| 621 | + return "RT_DEV_LIMIT_SIMD_STACK_SIZE(2)"; | ||
| 622 | + case ACL_RT_DEV_LIMIT_SIMD_PRINTF_FIFO_SIZE_PER_CORE: | ||
| 623 | + return "RT_DEV_LIMIT_SIMD_PRINTF_FIFO_SIZE_PER_CORE(3)"; | ||
| 624 | + case ACL_RT_DEV_LIMIT_SIMT_PRINTF_FIFO_SIZE: | ||
| 625 | + return "RT_DEV_LIMIT_SIMT_PRINTF_FIFO_SIZE(4)"; | ||
| 626 | + default: | ||
| 627 | + break; | ||
| 628 | + } | ||
| 629 | + static thread_local char enumBuf[32]; | ||
| 630 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(limit)); | ||
| 631 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 632 | + return enumBuf; | ||
| 633 | +} | ||
| 273 | } // namespace acl | 634 | } // namespace acl |
| @@ -26,69 +26,8 @@ | |||
| 26 | 26 | ||
| 27 | namespace acl { | 27 | namespace acl { |
| 28 | 28 | ||
| 29 | -inline const char* GetDataTypeDesc(aclDataType type) | 29 | +const char* GetDataTypeDesc(aclDataType type); |
| 30 | -{ | 30 | +const char* GetMemcpyKindDesc(aclrtMemcpyKind kind); |
| 31 | - static const std::unordered_map<aclDataType, const char*> dataTypeDescMap = { | ||
| 32 | - {ACL_DT_UNDEFINED, "DT_UNDEFINED(-1)"}, | ||
| 33 | - {ACL_FLOAT, "FLOAT(0)"}, | ||
| 34 | - {ACL_FLOAT16, "FLOAT16(1)"}, | ||
| 35 | - {ACL_INT8, "INT8(2)"}, | ||
| 36 | - {ACL_INT32, "INT32(3)"}, | ||
| 37 | - {ACL_UINT8, "UINT8(4)"}, | ||
| 38 | - {ACL_INT16, "INT16(6)"}, | ||
| 39 | - {ACL_UINT16, "UINT16(7)"}, | ||
| 40 | - {ACL_UINT32, "UINT32(8)"}, | ||
| 41 | - {ACL_INT64, "INT64(9)"}, | ||
| 42 | - {ACL_UINT64, "UINT64(10)"}, | ||
| 43 | - {ACL_DOUBLE, "DOUBLE(11)"}, | ||
| 44 | - {ACL_BOOL, "BOOL(12)"}, | ||
| 45 | - {ACL_STRING, "STRING(13)"}, | ||
| 46 | - {ACL_COMPLEX64, "COMPLEX64(16)"}, | ||
| 47 | - {ACL_COMPLEX128, "COMPLEX128(17)"}, | ||
| 48 | - {ACL_BF16, "BF16(27)"}, | ||
| 49 | - {ACL_INT4, "INT4(29)"}, | ||
| 50 | - {ACL_UINT1, "UINT1(30)"}, | ||
| 51 | - {ACL_COMPLEX32, "COMPLEX32(33)"}, | ||
| 52 | - {ACL_HIFLOAT8, "HIFLOAT8(34)"}, | ||
| 53 | - {ACL_FLOAT8_E5M2, "FLOAT8_E5M2(35)"}, | ||
| 54 | - {ACL_FLOAT8_E4M3FN, "FLOAT8_E4M3FN(36)"}, | ||
| 55 | - {ACL_FLOAT8_E8M0, "FLOAT8_E8M0(37)"}, | ||
| 56 | - {ACL_FLOAT6_E3M2, "FLOAT6_E3M2(38)"}, | ||
| 57 | - {ACL_FLOAT6_E2M3, "FLOAT6_E2M3(39)"}, | ||
| 58 | - {ACL_FLOAT4_E2M1, "FLOAT4_E2M1(40)"}, | ||
| 59 | - {ACL_FLOAT4_E1M2, "FLOAT4_E1M2(41)"}, | ||
| 60 | - }; | ||
| 61 | - | ||
| 62 | - auto it = dataTypeDescMap.find(type); | ||
| 63 | - if (it != dataTypeDescMap.end()) { | ||
| 64 | - return it->second; | ||
| 65 | - } | ||
| 66 | - static thread_local char enumBuf[32]; | ||
| 67 | - (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 68 | - return enumBuf; | ||
| 69 | -} | ||
| 70 | - | ||
| 71 | -inline const char* GetMemcpyKindDesc(aclrtMemcpyKind kind) | ||
| 72 | -{ | ||
| 73 | - static const std::unordered_map<aclrtMemcpyKind, const char*> memcpyKindDescMap = { | ||
| 74 | - {ACL_MEMCPY_HOST_TO_HOST, "MEMCPY_HOST_TO_HOST(0)"}, | ||
| 75 | - {ACL_MEMCPY_HOST_TO_DEVICE, "MEMCPY_HOST_TO_DEVICE(1)"}, | ||
| 76 | - {ACL_MEMCPY_DEVICE_TO_HOST, "MEMCPY_DEVICE_TO_HOST(2)"}, | ||
| 77 | - {ACL_MEMCPY_DEVICE_TO_DEVICE, "MEMCPY_DEVICE_TO_DEVICE(3)"}, | ||
| 78 | - {ACL_MEMCPY_DEFAULT, "MEMCPY_DEFAULT(4)"}, | ||
| 79 | - {ACL_MEMCPY_HOST_TO_BUF_TO_DEVICE, "MEMCPY_HOST_TO_BUF_TO_DEVICE(5)"}, | ||
| 80 | - {ACL_MEMCPY_INNER_DEVICE_TO_DEVICE, "MEMCPY_INNER_DEVICE_TO_DEVICE(6)"}, | ||
| 81 | - {ACL_MEMCPY_INTER_DEVICE_TO_DEVICE, "MEMCPY_INTER_DEVICE_TO_DEVICE(7)"}, | ||
| 82 | - }; | ||
| 83 | - | ||
| 84 | - auto it = memcpyKindDescMap.find(kind); | ||
| 85 | - if (it != memcpyKindDescMap.end()) { | ||
| 86 | - return it->second; | ||
| 87 | - } | ||
| 88 | - static thread_local char enumBuf[32]; | ||
| 89 | - (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 90 | - return enumBuf; | ||
| 91 | -} | ||
| 92 | 31 | ||
| 93 | inline const char* GetExceptionExpandTypeDesc(rtExceptionExpandType_t type) | 32 | inline const char* GetExceptionExpandTypeDesc(rtExceptionExpandType_t type) |
| 94 | { | 33 | { |
| @@ -105,6 +44,7 @@ inline const char* GetExceptionExpandTypeDesc(rtExceptionExpandType_t type) | |||
| 105 | } | 44 | } |
| 106 | static thread_local char enumBuf[32]; | 45 | static thread_local char enumBuf[32]; |
| 107 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 46 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 47 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 108 | return enumBuf; | 48 | return enumBuf; |
| 109 | } | 49 | } |
| 110 | 50 | ||
| @@ -122,6 +62,7 @@ inline const char* GetGroupAttrDesc(aclrtGroupAttr attr) | |||
| 122 | } | 62 | } |
| 123 | static thread_local char enumBuf[32]; | 63 | static thread_local char enumBuf[32]; |
| 124 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | 64 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); |
| 65 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 125 | return enumBuf; | 66 | return enumBuf; |
| 126 | } | 67 | } |
| 127 | 68 | ||
| @@ -139,6 +80,7 @@ inline const char* GetTsIdDesc(aclrtTsId tsId) | |||
| 139 | } | 80 | } |
| 140 | static thread_local char enumBuf[32]; | 81 | static thread_local char enumBuf[32]; |
| 141 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(tsId)); | 82 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(tsId)); |
| 83 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 142 | return enumBuf; | 84 | return enumBuf; |
| 143 | } | 85 | } |
| 144 | 86 | ||
| @@ -157,6 +99,7 @@ inline const char* GetQueueRouteQueryModeDesc(acltdtQueueRouteQueryMode mode) | |||
| 157 | } | 99 | } |
| 158 | static thread_local char enumBuf[32]; | 100 | static thread_local char enumBuf[32]; |
| 159 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); | 101 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); |
| 102 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 160 | return enumBuf; | 103 | return enumBuf; |
| 161 | } | 104 | } |
| 162 | 105 | ||
| @@ -173,6 +116,7 @@ inline const char* GetQueueAttrTypeDesc(acltdtQueueAttrType type) | |||
| 173 | } | 116 | } |
| 174 | static thread_local char enumBuf[32]; | 117 | static thread_local char enumBuf[32]; |
| 175 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 118 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 119 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 176 | return enumBuf; | 120 | return enumBuf; |
| 177 | } | 121 | } |
| 178 | 122 | ||
| @@ -190,6 +134,7 @@ inline const char* GetQueueRouteParamTypeDesc(acltdtQueueRouteParamType type) | |||
| 190 | } | 134 | } |
| 191 | static thread_local char enumBuf[32]; | 135 | static thread_local char enumBuf[32]; |
| 192 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 136 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 137 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 193 | return enumBuf; | 138 | return enumBuf; |
| 194 | } | 139 | } |
| 195 | 140 | ||
| @@ -208,6 +153,7 @@ inline const char* GetQueueRouteQueryInfoParamTypeDesc(acltdtQueueRouteQueryInfo | |||
| 208 | } | 153 | } |
| 209 | static thread_local char enumBuf[32]; | 154 | static thread_local char enumBuf[32]; |
| 210 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 155 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 156 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 211 | return enumBuf; | 157 | return enumBuf; |
| 212 | } | 158 | } |
| 213 | 159 | ||
| @@ -224,6 +170,7 @@ inline const char* GetAllocBufTypeDesc(acltdtAllocBufType type) | |||
| 224 | } | 170 | } |
| 225 | static thread_local char enumBuf[32]; | 171 | static thread_local char enumBuf[32]; |
| 226 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 172 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 173 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 227 | return enumBuf; | 174 | return enumBuf; |
| 228 | } | 175 | } |
| 229 | 176 | ||
| @@ -244,6 +191,7 @@ inline const char* GetTensorTypeDesc(acltdtTensorType type) | |||
| 244 | } | 191 | } |
| 245 | static thread_local char enumBuf[32]; | 192 | static thread_local char enumBuf[32]; |
| 246 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 193 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 194 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 247 | return enumBuf; | 195 | return enumBuf; |
| 248 | } | 196 | } |
| 249 | 197 | ||
| @@ -253,9 +201,9 @@ inline const char* GetSysParamOptDesc(aclSysParamOpt opt) | |||
| 253 | // Defined as static_cast to bypass the ACL_DEPRECATED_MESSAGE warning under -Werror compilation. | 201 | // Defined as static_cast to bypass the ACL_DEPRECATED_MESSAGE warning under -Werror compilation. |
| 254 | constexpr aclSysParamOpt OPT_STRONG_CONSISTENCY = static_cast<aclSysParamOpt>(2); | 202 | constexpr aclSysParamOpt OPT_STRONG_CONSISTENCY = static_cast<aclSysParamOpt>(2); |
| 255 | static const std::unordered_map<aclSysParamOpt, const char*> sysParamOptDescMap = { | 203 | static const std::unordered_map<aclSysParamOpt, const char*> sysParamOptDescMap = { |
| 256 | - {ACL_OPT_DETERMINISTIC, "ACL_OPT_DETERMINISTIC(0)"}, | 204 | + {ACL_OPT_DETERMINISTIC, "OPT_DETERMINISTIC(0)"}, |
| 257 | - {ACL_OPT_ENABLE_DEBUG_KERNEL, "ACL_OPT_ENABLE_DEBUG_KERNEL(1)"}, | 205 | + {ACL_OPT_ENABLE_DEBUG_KERNEL, "OPT_ENABLE_DEBUG_KERNEL(1)"}, |
| 258 | - {OPT_STRONG_CONSISTENCY, "ACL_OPT_STRONG_CONSISTENCY(2)"}, | 206 | + {OPT_STRONG_CONSISTENCY, "OPT_STRONG_CONSISTENCY(2)"}, |
| 259 | }; | 207 | }; |
| 260 | 208 | ||
| 261 | auto it = sysParamOptDescMap.find(opt); | 209 | auto it = sysParamOptDescMap.find(opt); |
| @@ -264,6 +212,7 @@ inline const char* GetSysParamOptDesc(aclSysParamOpt opt) | |||
| 264 | } | 212 | } |
| 265 | static thread_local char enumBuf[32]; | 213 | static thread_local char enumBuf[32]; |
| 266 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(opt)); | 214 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(opt)); |
| 215 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 267 | return enumBuf; | 216 | return enumBuf; |
| 268 | } | 217 | } |
| 269 | 218 | ||
| @@ -280,17 +229,18 @@ inline const char* GetCallbackBlockTypeDesc(aclrtCallbackBlockType type) | |||
| 280 | } | 229 | } |
| 281 | static thread_local char enumBuf[32]; | 230 | static thread_local char enumBuf[32]; |
| 282 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 231 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 232 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 283 | return enumBuf; | 233 | return enumBuf; |
| 284 | } | 234 | } |
| 285 | 235 | ||
| 286 | inline const char* GetMemLocationTypeDesc(aclrtMemLocationType type) | 236 | inline const char* GetMemLocationTypeDesc(aclrtMemLocationType type) |
| 287 | { | 237 | { |
| 288 | static const std::unordered_map<aclrtMemLocationType, const char*> memLocationTypeDescMap = { | 238 | static const std::unordered_map<aclrtMemLocationType, const char*> memLocationTypeDescMap = { |
| 289 | - {ACL_MEM_LOCATION_TYPE_HOST, "ACL_MEM_LOCATION_TYPE_HOST(0)"}, | 239 | + {ACL_MEM_LOCATION_TYPE_HOST, "MEM_LOCATION_TYPE_HOST(0)"}, |
| 290 | - {ACL_MEM_LOCATION_TYPE_DEVICE, "ACL_MEM_LOCATION_TYPE_DEVICE(1)"}, | 240 | + {ACL_MEM_LOCATION_TYPE_DEVICE, "MEM_LOCATION_TYPE_DEVICE(1)"}, |
| 291 | - {ACL_MEM_LOCATION_TYPE_UNREGISTERED, "ACL_MEM_LOCATION_TYPE_UNREGISTERED(2)"}, | 241 | + {ACL_MEM_LOCATION_TYPE_UNREGISTERED, "MEM_LOCATION_TYPE_UNREGISTERED(2)"}, |
| 292 | - {ACL_MEM_LOCATION_TYPE_MANAGED, "ACL_MEM_LOCATION_TYPE_MANAGED(3)"}, | 242 | + {ACL_MEM_LOCATION_TYPE_MANAGED, "MEM_LOCATION_TYPE_MANAGED(3)"}, |
| 293 | - {ACL_MEM_LOCATION_TYPE_HOST_NUMA, "ACL_MEM_LOCATION_TYPE_HOST_NUMA(4)"}, | 243 | + {ACL_MEM_LOCATION_TYPE_HOST_NUMA, "MEM_LOCATION_TYPE_HOST_NUMA(4)"}, |
| 294 | }; | 244 | }; |
| 295 | 245 | ||
| 296 | auto it = memLocationTypeDescMap.find(type); | 246 | auto it = memLocationTypeDescMap.find(type); |
| @@ -299,6 +249,7 @@ inline const char* GetMemLocationTypeDesc(aclrtMemLocationType type) | |||
| 299 | } | 249 | } |
| 300 | static thread_local char enumBuf[32]; | 250 | static thread_local char enumBuf[32]; |
| 301 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 251 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 252 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 302 | return enumBuf; | 253 | return enumBuf; |
| 303 | } | 254 | } |
| 304 | 255 | ||
| @@ -314,6 +265,7 @@ inline const char* GetMemAllocationTypeDesc(aclrtMemAllocationType type) | |||
| 314 | } | 265 | } |
| 315 | static thread_local char enumBuf[32]; | 266 | static thread_local char enumBuf[32]; |
| 316 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 267 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 268 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 317 | return enumBuf; | 269 | return enumBuf; |
| 318 | } | 270 | } |
| 319 | 271 | ||
| @@ -335,6 +287,7 @@ inline const char* GetTdtDataTypeDesc(tdt::TdtDataType type) | |||
| 335 | } | 287 | } |
| 336 | static thread_local char enumBuf[32]; | 288 | static thread_local char enumBuf[32]; |
| 337 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | 289 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); |
| 290 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 338 | return enumBuf; | 291 | return enumBuf; |
| 339 | } | 292 | } |
| 340 | 293 | ||
| @@ -357,6 +310,7 @@ inline const char* GetTdtDataTypeDescV2(int32_t type) | |||
| 357 | } | 310 | } |
| 358 | static thread_local char enumBuf[32]; | 311 | static thread_local char enumBuf[32]; |
| 359 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", type); | 312 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", type); |
| 313 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 360 | return enumBuf; | 314 | return enumBuf; |
| 361 | } | 315 | } |
| 362 | 316 | ||
| @@ -373,6 +327,7 @@ inline const char* GetRunModeDesc(aclrtRunMode mode) | |||
| 373 | } | 327 | } |
| 374 | static thread_local char enumBuf[32]; | 328 | static thread_local char enumBuf[32]; |
| 375 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); | 329 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); |
| 330 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 376 | return enumBuf; | 331 | return enumBuf; |
| 377 | } | 332 | } |
| 378 | 333 | ||
| @@ -390,6 +345,7 @@ inline const char* GetCaptureModeDesc(aclmdlRICaptureMode mode) | |||
| 390 | } | 345 | } |
| 391 | static thread_local char enumBuf[32]; | 346 | static thread_local char enumBuf[32]; |
| 392 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); | 347 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); |
| 348 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 393 | return enumBuf; | 349 | return enumBuf; |
| 394 | } | 350 | } |
| 395 | 351 | ||
| @@ -405,6 +361,7 @@ inline const char* GetLastErrLevelDesc(aclrtLastErrLevel level) | |||
| 405 | } | 361 | } |
| 406 | static thread_local char enumBuf[32]; | 362 | static thread_local char enumBuf[32]; |
| 407 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(level)); | 363 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(level)); |
| 364 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 408 | return enumBuf; | 365 | return enumBuf; |
| 409 | } | 366 | } |
| 410 | 367 | ||
| @@ -423,40 +380,24 @@ inline const char* GetDeviceInfoDesc(aclDeviceInfo info) | |||
| 423 | } | 380 | } |
| 424 | static thread_local char enumBuf[32]; | 381 | static thread_local char enumBuf[32]; |
| 425 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(info)); | 382 | (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(info)); |
| 383 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 426 | return enumBuf; | 384 | return enumBuf; |
| 427 | } | 385 | } |
| 428 | 386 | ||
| 429 | -inline const char* GetMemAttrDesc(aclrtMemAttr attr) | 387 | +const char* GetCannAttrDesc(aclCannAttr attr); |
| 430 | -{ | 388 | +const char* GetDevResLimitTypeDesc(aclrtDevResLimitType type); |
| 431 | - static const std::unordered_map<aclrtMemAttr, const char*> memAttrDescMap = { | 389 | +const char* GetReduceKindDesc(aclrtReduceKind kind); |
| 432 | - {ACL_DDR_MEM, "DDR_MEM(0)"}, | 390 | +const char* GetMemLinkTypeDesc(aclrtMemLinkType type); |
| 433 | - {ACL_HBM_MEM, "HBM_MEM(1)"}, | 391 | +const char* GetErrorTypeDesc(aclrtErrorType type); |
| 434 | - {ACL_DDR_MEM_HUGE, "DDR_MEM_HUGE(2)"}, | 392 | +const char* GetConditionDesc(aclrtCondition condition); |
| 435 | - {ACL_DDR_MEM_NORMAL, "DDR_MEM_NORMAL(3)"}, | 393 | +const char* GetCompareDataTypeDesc(aclrtCompareDataType type); |
| 436 | - {ACL_HBM_MEM_HUGE, "HBM_MEM_HUGE(4)"}, | ||
| 437 | - {ACL_HBM_MEM_NORMAL, "HBM_MEM_NORMAL(5)"}, | ||
| 438 | - {ACL_DDR_MEM_P2P_HUGE, "DDR_MEM_P2P_HUGE(6)"}, | ||
| 439 | - {ACL_DDR_MEM_P2P_NORMAL, "DDR_MEM_P2P_NORMAL(7)"}, | ||
| 440 | - {ACL_HBM_MEM_P2P_HUGE, "HBM_MEM_P2P_HUGE(8)"}, | ||
| 441 | - {ACL_HBM_MEM_P2P_NORMAL, "HBM_MEM_P2P_NORMAL(9)"}, | ||
| 442 | - {ACL_HBM_MEM_HUGE1G, "HBM_MEM_HUGE1G(10)"}, | ||
| 443 | - {ACL_HBM_MEM_P2P_HUGE1G, "HBM_MEM_P2P_HUGE1G(11)"}, | ||
| 444 | - {ACL_MEM_NORMAL, "MEM_NORMAL(12)"}, | ||
| 445 | - {ACL_MEM_HUGE, "MEM_HUGE(13)"}, | ||
| 446 | - {ACL_MEM_HUGE1G, "MEM_HUGE1G(14)"}, | ||
| 447 | - {ACL_MEM_P2P_NORMAL, "MEM_P2P_NORMAL(15)"}, | ||
| 448 | - {ACL_MEM_P2P_HUGE, "MEM_P2P_HUGE(16)"}, | ||
| 449 | - {ACL_MEM_P2P_HUGE1G, "MEM_P2P_HUGE1G(17)"}, | ||
| 450 | - }; | ||
| 451 | 394 | ||
| 452 | - auto it = memAttrDescMap.find(attr); | 395 | +const char* GetMemAttrDesc(aclrtMemAttr attr); |
| 453 | - if (it != memAttrDescMap.end()) { | 396 | + |
| 454 | - return it->second; | 397 | +const char* GetIpcMemAttrTypeDesc(aclrtIpcMemAttrType type); |
| 455 | - } | 398 | +const char* GetFloatOverflowModeDesc(aclrtFloatOverflowMode mode); |
| 456 | - static thread_local char enumBuf[32]; | 399 | +const char* GetCmoTypeDesc(aclrtCmoType type); |
| 457 | - (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | 400 | +const char* GetDeviceLimitDesc(aclrtDeviceLimit limit); |
| 458 | - return enumBuf; | ||
| 459 | -} | ||
| 460 | 401 | ||
| 461 | static inline std::string DatasetMemTypeToString(const datasetMemType type) | 402 | static inline std::string DatasetMemTypeToString(const datasetMemType type) |
| 462 | { | 403 | { |
| @@ -10,6 +10,16 @@ | |||
| 10 | set(RUNTIME_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/core) | 10 | set(RUNTIME_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/core) |
| 11 | set(RUNTIME_FEATURE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/feature) | 11 | set(RUNTIME_FEATURE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/feature) |
| 12 | set(RUNTIME_CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | 12 | set(RUNTIME_CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
| 13 | +set(RUNTIME_CORE_ENUM_DESC_SRC_FILES | ||
| 14 | + ${RUNTIME_CORE_DIR}/src/common/enum_desc.cc | ||
| 15 | + ${RUNTIME_CORE_DIR}/src/common/api_enum_desc.cc | ||
| 16 | +) | ||
| 17 | +set(RUNTIME_API_ENUM_DESC_SRC_FILES | ||
| 18 | + ${RUNTIME_CORE_DIR}/src/common/api_enum_desc.cc | ||
| 19 | +) | ||
| 20 | +set(RUNTIME_OPTIONAL_ENUM_DESC_SRC_FILES | ||
| 21 | + ${RUNTIME_CORE_DIR}/src/common/optional_enum_desc.cc | ||
| 22 | +) | ||
| 13 | 23 | ||
| 14 | include(${RUNTIME_DIR}/pkg_inc/runtime/runtime/runtime_headers.cmake) | 24 | include(${RUNTIME_DIR}/pkg_inc/runtime/runtime/runtime_headers.cmake) |
| 15 | include(${RUNTIME_DIR}/src/inc/runtime/runtime_inner_headers.cmake) | 25 | include(${RUNTIME_DIR}/src/inc/runtime/runtime_inner_headers.cmake) |
| @@ -1210,8 +1210,8 @@ rtError_t rtMemcpyAsyncPtr( | |||
| 1210 | GLOBAL_STATE_WAIT_IF_LOCKED(); | 1210 | GLOBAL_STATE_WAIT_IF_LOCKED(); |
| 1211 | if (kind != RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) { | 1211 | if (kind != RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) { |
| 1212 | RT_LOG( | 1212 | RT_LOG( |
| 1213 | - RT_LOG_WARNING, "rtMemcpyAsyncPtr failed, kind should be %u, but now is %u.", | 1213 | + RT_LOG_WARNING, "rtMemcpyAsyncPtr failed, kind should be %s, but now is %s.", |
| 1214 | - RT_MEMCPY_ADDR_DEVICE_TO_DEVICE, kind); | 1214 | + "MEMCPY_ADDR_DEVICE_TO_DEVICE(5)", MemcpyKindToStr(kind)); |
| 1215 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); | 1215 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); |
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| @@ -1246,8 +1246,8 @@ rtError_t rtMemcpyAsyncPtrV2( | |||
| 1246 | GLOBAL_STATE_WAIT_IF_LOCKED(); | 1246 | GLOBAL_STATE_WAIT_IF_LOCKED(); |
| 1247 | if (kind != RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) { | 1247 | if (kind != RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) { |
| 1248 | RT_LOG( | 1248 | RT_LOG( |
| 1249 | - RT_LOG_WARNING, "rtMemcpyAsyncPtrV2 failed, kind should be %u, but now is %u.", | 1249 | + RT_LOG_WARNING, "rtMemcpyAsyncPtrV2 failed, kind should be %s, but now is %s.", |
| 1250 | - RT_MEMCPY_ADDR_DEVICE_TO_DEVICE, kind); | 1250 | + "MEMCPY_ADDR_DEVICE_TO_DEVICE(5)", MemcpyKindToStr(kind)); |
| 1251 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); | 1251 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); |
| 1252 | } | 1252 | } |
| 1253 | if (cfgInfo == nullptr) { | 1253 | if (cfgInfo == nullptr) { |
| @@ -3483,9 +3483,9 @@ VISIBILITY_DEFAULT | |||
| 3483 | RTS_API rtError_t rtSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) | 3483 | RTS_API rtError_t rtSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) |
| 3484 | { | 3484 | { |
| 3485 | constexpr int64_t SYS_OPT_DETERMINISTIC_LEVEL_MAX = 4; | 3485 | constexpr int64_t SYS_OPT_DETERMINISTIC_LEVEL_MAX = 4; |
| 3486 | - COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 3486 | + COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 3487 | - (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, configOpt, | 3487 | + (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, SysParamOptToString(configOpt), |
| 3488 | - RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); | 3488 | + "configOpt", RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); |
| 3489 | const int64_t maxVal = | 3489 | const int64_t maxVal = |
| 3490 | (configOpt == SYS_OPT_DETERMINISTIC) ? SYS_OPT_DETERMINISTIC_LEVEL_MAX : static_cast<int64_t>(SYS_OPT_MAX); | 3490 | (configOpt == SYS_OPT_DETERMINISTIC) ? SYS_OPT_DETERMINISTIC_LEVEL_MAX : static_cast<int64_t>(SYS_OPT_MAX); |
| 3491 | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 3491 | COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( |
| @@ -3498,9 +3498,9 @@ RTS_API rtError_t rtSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t | |||
| 3498 | VISIBILITY_DEFAULT | 3498 | VISIBILITY_DEFAULT |
| 3499 | RTS_API rtError_t rtGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* const configVal) | 3499 | RTS_API rtError_t rtGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* const configVal) |
| 3500 | { | 3500 | { |
| 3501 | - COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 3501 | + COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 3502 | - (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, configOpt, | 3502 | + (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, SysParamOptToString(configOpt), |
| 3503 | - RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); | 3503 | + "configOpt", RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); |
| 3504 | PARAM_NULL_RETURN_ERROR_WITH_EXT_ERRCODE(configVal, RT_ERROR_INVALID_VALUE); | 3504 | PARAM_NULL_RETURN_ERROR_WITH_EXT_ERRCODE(configVal, RT_ERROR_INVALID_VALUE); |
| 3505 | *configVal = sysParamOpt_[configOpt].load(); | 3505 | *configVal = sysParamOpt_[configOpt].load(); |
| 3506 | return ACL_RT_SUCCESS; | 3506 | return ACL_RT_SUCCESS; |
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | + | ||
| 13 | 14 | ||
| 14 | 15 | ||
| 15 | 16 | ||
| @@ -51,9 +52,9 @@ rtError_t rtsCtxSetSysParamOpt(rtSysParamOpt configOpt, int64_t configVal) | |||
| 51 | { | 52 | { |
| 52 | Api* const apiInstance = Api::Instance(); | 53 | Api* const apiInstance = Api::Instance(); |
| 53 | NULL_RETURN_ERROR_WITH_EXT_ERRCODE(apiInstance); | 54 | NULL_RETURN_ERROR_WITH_EXT_ERRCODE(apiInstance); |
| 54 | - COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 55 | + COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 55 | - (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, configOpt, | 56 | + (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, SysParamOptToString(configOpt), |
| 56 | - "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); | 57 | + "configOpt", "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); |
| 57 | 58 | ||
| 58 | const rtError_t ret = apiInstance->CtxSetSysParamOpt(configOpt, configVal); | 59 | const rtError_t ret = apiInstance->CtxSetSysParamOpt(configOpt, configVal); |
| 59 | ERROR_RETURN_WITH_EXT_ERRCODE(ret); | 60 | ERROR_RETURN_WITH_EXT_ERRCODE(ret); |
| @@ -65,9 +66,9 @@ rtError_t rtsCtxGetSysParamOpt(rtSysParamOpt configOpt, int64_t* configVal) | |||
| 65 | { | 66 | { |
| 66 | Api* const apiInstance = Api::Instance(); | 67 | Api* const apiInstance = Api::Instance(); |
| 67 | NULL_RETURN_ERROR_WITH_EXT_ERRCODE(apiInstance); | 68 | NULL_RETURN_ERROR_WITH_EXT_ERRCODE(apiInstance); |
| 68 | - COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 69 | + COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 69 | - (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, configOpt, | 70 | + (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, SysParamOptToString(configOpt), |
| 70 | - "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); | 71 | + "configOpt", "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); |
| 71 | 72 | ||
| 72 | const rtError_t ret = apiInstance->CtxGetSysParamOpt(configOpt, configVal); | 73 | const rtError_t ret = apiInstance->CtxGetSysParamOpt(configOpt, configVal); |
| 73 | if (ret == RT_ERROR_NOT_SET_SYSPARAMOPT) { | 74 | if (ret == RT_ERROR_NOT_SET_SYSPARAMOPT) { |
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | ||
| @@ -349,7 +350,9 @@ rtError_t rtsGetMemcpyDescSize(rtMemcpyKind kind, size_t* descSize) | |||
| 349 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); | 350 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); |
| 350 | } | 351 | } |
| 351 | if (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE) { | 352 | if (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE) { |
| 352 | - RT_LOG(RT_LOG_WARNING, "Kind should be %u, but now is %u.", RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE, kind); | 353 | + RT_LOG( |
| 354 | + RT_LOG_WARNING, "Kind should be %s, but now is %s.", "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)", | ||
| 355 | + MemcpyNewKindToString(kind).c_str()); | ||
| 353 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); | 356 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); |
| 354 | } | 357 | } |
| 355 | PARAM_NULL_RETURN_ERROR_WITH_EXT_ERRCODE(descSize, RT_ERROR_INVALID_VALUE); | 358 | PARAM_NULL_RETURN_ERROR_WITH_EXT_ERRCODE(descSize, RT_ERROR_INVALID_VALUE); |
| @@ -691,8 +694,9 @@ rtError_t rtsCmoAsyncWithBarrier(void* srcAddrPtr, size_t srcLen, rtCmoOpCode cm | |||
| 691 | break; | 694 | break; |
| 692 | default: | 695 | default: |
| 693 | RT_LOG( | 696 | RT_LOG( |
| 694 | - RT_LOG_WARNING, "cmoType(%d) does not support, support[PREFETCH, WRITEBACK, INVALID, FLUSH]", | 697 | + RT_LOG_WARNING, "cmoType %s does not support, support[%s, %s, %s, %s]", |
| 695 | - static_cast<int32_t>(cmoType)); | 698 | + CmoOpCodeToString(cmoType).c_str(), "CMO_PREFETCH(6)", "CMO_WRITEBACK(7)", "CMO_INVALID(8)", |
| 699 | + "CMO_FLUSH(9)"); | ||
| 696 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); | 700 | return GetRtExtErrCodeAndSetGlobalErr(RT_ERROR_FEATURE_NOT_SUPPORT); |
| 697 | break; | 701 | break; |
| 698 | } | 702 | } |
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | + | ||
| 15 | 16 | ||
| 16 | 17 | ||
| 17 | 18 | ||
| @@ -843,9 +844,8 @@ rtError_t rtCmoAsync(void* srcAddrPtr, size_t srcLen, rtCmoOpCode_t cmoType, rtS | |||
| 843 | const bool isSupport = (cmoType == RT_CMO_PREFETCH) || (cmoType == RT_CMO_WRITEBACK) || | 844 | const bool isSupport = (cmoType == RT_CMO_PREFETCH) || (cmoType == RT_CMO_WRITEBACK) || |
| 844 | (cmoType == RT_CMO_INVALID) || (cmoType == RT_CMO_FLUSH); | 845 | (cmoType == RT_CMO_INVALID) || (cmoType == RT_CMO_FLUSH); |
| 845 | COND_RETURN_WARN( | 846 | COND_RETURN_WARN( |
| 846 | - !isSupport, ACL_ERROR_RT_FEATURE_NOT_SUPPORT, | 847 | + !isSupport, ACL_ERROR_RT_FEATURE_NOT_SUPPORT, "cmoType %s does not support, support[%s, %s, %s, %s], return.", |
| 847 | - "cmoType(%d) does not support, support[PREFETCH, WRITEBACK, INVALID, FLUSH], return.", | 848 | + CmoOpCodeToString(cmoType).c_str(), "CMO_PREFETCH(6)", "CMO_WRITEBACK(7)", "CMO_INVALID(8)", "CMO_FLUSH(9)"); |
| 848 | - static_cast<int32_t>(cmoType)); | ||
| 849 | 849 | ||
| 850 | NULL_PTR_RETURN_MSG_OUTER(srcAddrPtr, ACL_ERROR_RT_PARAM_INVALID); | 850 | NULL_PTR_RETURN_MSG_OUTER(srcAddrPtr, ACL_ERROR_RT_PARAM_INVALID); |
| 851 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM((srcLen == 0), ACL_ERROR_RT_PARAM_INVALID, srcLen, "greater than 0"); | 851 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM((srcLen == 0), ACL_ERROR_RT_PARAM_INVALID, srcLen, "greater than 0"); |
| @@ -960,9 +960,9 @@ rtError_t rtMemcpyAsyncWithOffset( | |||
| 960 | RT_LOG(RT_LOG_INFO, "cnt is 0, no need to copy memory async with offset, just return success."); | 960 | RT_LOG(RT_LOG_INFO, "cnt is 0, no need to copy memory async with offset, just return success."); |
| 961 | return ACL_RT_SUCCESS; | 961 | return ACL_RT_SUCCESS; |
| 962 | } | 962 | } |
| 963 | - COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM( | 963 | + COND_RETURN_EXT_ERRCODE_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 964 | - (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_INVALID_VALUE, kind, | 964 | + (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_INVALID_VALUE, MemcpyNewKindToString(kind), "kind", |
| 965 | - "RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE"); | 965 | + "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)"); |
| 966 | return rtMemcpyD2DAddrAsync( | 966 | return rtMemcpyD2DAddrAsync( |
| 967 | RtPtrToPtr<void*>(dst), dstMax, dstDataOffset, RtPtrToPtr<void*>(src), cnt, srcDataOffset, stm); | 967 | RtPtrToPtr<void*>(dst), dstMax, dstDataOffset, RtPtrToPtr<void*>(src), cnt, srcDataOffset, stm); |
| 968 | } | 968 | } |
| @@ -250,6 +250,7 @@ set(libruntime_other_files | |||
| 250 | ) | 250 | ) |
| 251 | 251 | ||
| 252 | set(libruntime_src_files | 252 | set(libruntime_src_files |
| 253 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 253 | ${runtime_src_pool_list} | 254 | ${runtime_src_pool_list} |
| 254 | ${runtime_src_ttlv_list} | 255 | ${runtime_src_ttlv_list} |
| 255 | ${libruntime_callback_files} | 256 | ${libruntime_callback_files} |
| @@ -376,6 +376,8 @@ set(xpu_tprt_api_file | |||
| 376 | ) | 376 | ) |
| 377 | 377 | ||
| 378 | set(libruntime_cmodel_src_files | 378 | set(libruntime_cmodel_src_files |
| 379 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 380 | + ${RUNTIME_OPTIONAL_ENUM_DESC_SRC_FILES} | ||
| 379 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 381 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 380 | ${RUNTIME_DIR}/src/runtime/api/api.cc | 382 | ${RUNTIME_DIR}/src/runtime/api/api.cc |
| 381 | ${RUNTIME_DIR}/src/runtime/api/api_global_err.cc | 383 | ${RUNTIME_DIR}/src/runtime/api/api_global_err.cc |
| @@ -501,6 +503,8 @@ set(libruntime_cmodel_src_files | |||
| 501 | ) | 503 | ) |
| 502 | 504 | ||
| 503 | set(libruntime_cmodel_v200_src_files | 505 | set(libruntime_cmodel_v200_src_files |
| 506 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 507 | + ${RUNTIME_OPTIONAL_ENUM_DESC_SRC_FILES} | ||
| 504 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 508 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 505 | ${RUNTIME_DIR}/src/runtime/api/api.cc | 509 | ${RUNTIME_DIR}/src/runtime/api/api.cc |
| 506 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc | 510 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc |
| @@ -84,6 +84,7 @@ set(libruntime_v100_task_src_files | |||
| 84 | ) | 84 | ) |
| 85 | 85 | ||
| 86 | set(libruntime_api_src_files | 86 | set(libruntime_api_src_files |
| 87 | + ${RUNTIME_API_ENUM_DESC_SRC_FILES} | ||
| 87 | ${RUNTIME_DIR}/src/runtime/api/api_c.cc | 88 | ${RUNTIME_DIR}/src/runtime/api/api_c.cc |
| 88 | ${RUNTIME_DIR}/src/runtime/api/api_c_context.cc | 89 | ${RUNTIME_DIR}/src/runtime/api/api_c_context.cc |
| 89 | ${RUNTIME_DIR}/src/runtime/api/api_c_device.cc | 90 | ${RUNTIME_DIR}/src/runtime/api/api_c_device.cc |
| @@ -286,6 +287,8 @@ set(xpu_tprt_src_file | |||
| 286 | ) | 287 | ) |
| 287 | 288 | ||
| 288 | set(libruntime_v100_src_files | 289 | set(libruntime_v100_src_files |
| 290 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 291 | + ${RUNTIME_OPTIONAL_ENUM_DESC_SRC_FILES} | ||
| 289 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 292 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 290 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc | 293 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc |
| 291 | ${RUNTIME_FEATURE_DIR}/aclgraph/api_decorator_aclgraph.cc | 294 | ${RUNTIME_FEATURE_DIR}/aclgraph/api_decorator_aclgraph.cc |
| @@ -77,6 +77,7 @@ set(libruntime_v100_task_src_files | |||
| 77 | ) | 77 | ) |
| 78 | 78 | ||
| 79 | set(libruntime_api_src_files | 79 | set(libruntime_api_src_files |
| 80 | + ${RUNTIME_API_ENUM_DESC_SRC_FILES} | ||
| 80 | ${RUNTIME_DIR}/src/runtime/api/api_c.cc | 81 | ${RUNTIME_DIR}/src/runtime/api/api_c.cc |
| 81 | ${RUNTIME_DIR}/src/runtime/api/api_c_context.cc | 82 | ${RUNTIME_DIR}/src/runtime/api/api_c_context.cc |
| 82 | ${RUNTIME_DIR}/src/runtime/api/api_c_device.cc | 83 | ${RUNTIME_DIR}/src/runtime/api/api_c_device.cc |
| @@ -210,6 +211,7 @@ set(libruntime_api_src_files_include_for_tiny | |||
| 210 | ) | 211 | ) |
| 211 | 212 | ||
| 212 | set(libruntime_common_src_files | 213 | set(libruntime_common_src_files |
| 214 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 213 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 215 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 214 | ${RUNTIME_DIR}/src/runtime/api/api.cc | 216 | ${RUNTIME_DIR}/src/runtime/api/api.cc |
| 215 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc | 217 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc |
| @@ -355,6 +357,7 @@ set_source_files_properties(${libruntime_aclrt_impl_src_files} | |||
| 355 | 357 | ||
| 356 | #------------------------- runtime v100 ------------------------- | 358 | #------------------------- runtime v100 ------------------------- |
| 357 | set(libruntime_v100_src_files | 359 | set(libruntime_v100_src_files |
| 360 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 358 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 361 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 359 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc | 362 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc |
| 360 | ${RUNTIME_CORE_DIR}/src/api_impl/api_impl.cc | 363 | ${RUNTIME_CORE_DIR}/src/api_impl/api_impl.cc |
| @@ -244,6 +244,8 @@ set(libruntime_v200_src_files_exclude_for_tiny | |||
| 244 | 244 | ||
| 245 | # v201 v200 common files, so please check carefully | 245 | # v201 v200 common files, so please check carefully |
| 246 | set(libruntime_v200_v201_common_src_files | 246 | set(libruntime_v200_v201_common_src_files |
| 247 | + ${RUNTIME_CORE_ENUM_DESC_SRC_FILES} | ||
| 248 | + ${RUNTIME_OPTIONAL_ENUM_DESC_SRC_FILES} | ||
| 247 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp | 249 | ${RUNTIME_CORE_DIR}/src/common/inner_thread_local.cpp |
| 248 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc | 250 | ${RUNTIME_CORE_DIR}/src/api_impl/api_decorator.cc |
| 249 | ${RUNTIME_FEATURE_DIR}/aclgraph/api_decorator_aclgraph.cc | 251 | ${RUNTIME_FEATURE_DIR}/aclgraph/api_decorator_aclgraph.cc |
| @@ -16,9 +16,12 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | + | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 23 | + | ||
| 24 | + | ||
| 22 | 25 | ||
| 23 | 26 | ||
| 24 | 27 | ||
| @@ -66,52 +69,7 @@ static inline std::string ReduceKindToString(const rtRecudeKind_t kind) | |||
| 66 | return desc; | 69 | return desc; |
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | -static inline std::string DataTypeToString(const rtDataType_t type) | 72 | +std::string DataTypeToString(const rtDataType_t type); |
| 70 | -{ | ||
| 71 | - std::string desc; | ||
| 72 | - switch (type) { | ||
| 73 | - case RT_DATA_TYPE_FP32: | ||
| 74 | - desc = "DATA_TYPE_FP32(0)"; | ||
| 75 | - break; | ||
| 76 | - case RT_DATA_TYPE_FP16: | ||
| 77 | - desc = "DATA_TYPE_FP16(1)"; | ||
| 78 | - break; | ||
| 79 | - case RT_DATA_TYPE_INT16: | ||
| 80 | - desc = "DATA_TYPE_INT16(2)"; | ||
| 81 | - break; | ||
| 82 | - case RT_DATA_TYPE_INT4: | ||
| 83 | - desc = "DATA_TYPE_INT4(3)"; | ||
| 84 | - break; | ||
| 85 | - case RT_DATA_TYPE_INT8: | ||
| 86 | - desc = "DATA_TYPE_INT8(4)"; | ||
| 87 | - break; | ||
| 88 | - case RT_DATA_TYPE_INT32: | ||
| 89 | - desc = "DATA_TYPE_INT32(5)"; | ||
| 90 | - break; | ||
| 91 | - case RT_DATA_TYPE_BFP16: | ||
| 92 | - desc = "DATA_TYPE_BFP16(6)"; | ||
| 93 | - break; | ||
| 94 | - case RT_DATA_TYPE_BFP32: | ||
| 95 | - desc = "DATA_TYPE_BFP32(7)"; | ||
| 96 | - break; | ||
| 97 | - case RT_DATA_TYPE_UINT8: | ||
| 98 | - desc = "DATA_TYPE_UINT8(8)"; | ||
| 99 | - break; | ||
| 100 | - case RT_DATA_TYPE_UINT16: | ||
| 101 | - desc = "DATA_TYPE_UINT16(9)"; | ||
| 102 | - break; | ||
| 103 | - case RT_DATA_TYPE_UINT32: | ||
| 104 | - desc = "DATA_TYPE_UINT32(10)"; | ||
| 105 | - break; | ||
| 106 | - case RT_DATA_TYPE_END: | ||
| 107 | - desc = "DATA_TYPE_END(11)"; | ||
| 108 | - break; | ||
| 109 | - default: | ||
| 110 | - desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 111 | - break; | ||
| 112 | - } | ||
| 113 | - return desc; | ||
| 114 | -} | ||
| 115 | 73 | ||
| 116 | static inline std::string KernelFlagToString(const uint32_t flag) | 74 | static inline std::string KernelFlagToString(const uint32_t flag) |
| 117 | { | 75 | { |
| @@ -171,84 +129,8 @@ static inline std::string LastErrLevelToString(const rtLastErrLevel_t level) | |||
| 171 | return desc; | 129 | return desc; |
| 172 | } | 130 | } |
| 173 | 131 | ||
| 174 | -static inline std::string MemcpyKindToString(const rtMemcpyKind_t kind) | 132 | +const char_t* MemcpyKindToStr(const rtMemcpyKind_t kind); |
| 175 | -{ | 133 | +std::string MemcpyNewKindToString(const rtMemcpyKind kind); |
| 176 | - std::string desc; | ||
| 177 | - switch (kind) { | ||
| 178 | - case RT_MEMCPY_HOST_TO_HOST: | ||
| 179 | - desc = "MEMCPY_HOST_TO_HOST(0)"; | ||
| 180 | - break; | ||
| 181 | - case RT_MEMCPY_HOST_TO_DEVICE: | ||
| 182 | - desc = "MEMCPY_HOST_TO_DEVICE(1)"; | ||
| 183 | - break; | ||
| 184 | - case RT_MEMCPY_DEVICE_TO_HOST: | ||
| 185 | - desc = "MEMCPY_DEVICE_TO_HOST(2)"; | ||
| 186 | - break; | ||
| 187 | - case RT_MEMCPY_DEVICE_TO_DEVICE: | ||
| 188 | - desc = "MEMCPY_DEVICE_TO_DEVICE(3)"; | ||
| 189 | - break; | ||
| 190 | - case RT_MEMCPY_MANAGED: | ||
| 191 | - desc = "MEMCPY_MANAGED(4)"; | ||
| 192 | - break; | ||
| 193 | - case RT_MEMCPY_ADDR_DEVICE_TO_DEVICE: | ||
| 194 | - desc = "MEMCPY_ADDR_DEVICE_TO_DEVICE(5)"; | ||
| 195 | - break; | ||
| 196 | - case RT_MEMCPY_HOST_TO_DEVICE_EX: | ||
| 197 | - desc = "MEMCPY_HOST_TO_DEVICE_EX(6)"; | ||
| 198 | - break; | ||
| 199 | - case RT_MEMCPY_DEVICE_TO_HOST_EX: | ||
| 200 | - desc = "MEMCPY_DEVICE_TO_HOST_EX(7)"; | ||
| 201 | - break; | ||
| 202 | - case RT_MEMCPY_DEFAULT: | ||
| 203 | - desc = "MEMCPY_DEFAULT(8)"; | ||
| 204 | - break; | ||
| 205 | - case RT_MEMCPY_RESERVED: | ||
| 206 | - desc = "MEMCPY_RESERVED(9)"; | ||
| 207 | - break; | ||
| 208 | - default: | ||
| 209 | - desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 210 | - break; | ||
| 211 | - } | ||
| 212 | - return desc; | ||
| 213 | -} | ||
| 214 | - | ||
| 215 | -static inline std::string MemcpyNewKindToString(const rtMemcpyKind kind) | ||
| 216 | -{ | ||
| 217 | - std::string desc; | ||
| 218 | - switch (kind) { | ||
| 219 | - case RT_MEMCPY_KIND_HOST_TO_HOST: | ||
| 220 | - desc = "MEMCPY_KIND_HOST_TO_HOST(0)"; | ||
| 221 | - break; | ||
| 222 | - case RT_MEMCPY_KIND_HOST_TO_DEVICE: | ||
| 223 | - desc = "MEMCPY_KIND_HOST_TO_DEVICE(1)"; | ||
| 224 | - break; | ||
| 225 | - case RT_MEMCPY_KIND_DEVICE_TO_HOST: | ||
| 226 | - desc = "MEMCPY_KIND_DEVICE_TO_HOST(2)"; | ||
| 227 | - break; | ||
| 228 | - case RT_MEMCPY_KIND_DEVICE_TO_DEVICE: | ||
| 229 | - desc = "MEMCPY_KIND_DEVICE_TO_DEVICE(3)"; | ||
| 230 | - break; | ||
| 231 | - case RT_MEMCPY_KIND_DEFAULT: | ||
| 232 | - desc = "MEMCPY_KIND_DEFAULT(4)"; | ||
| 233 | - break; | ||
| 234 | - case RT_MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE: | ||
| 235 | - desc = "MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE(5)"; | ||
| 236 | - break; | ||
| 237 | - case RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE: | ||
| 238 | - desc = "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)"; | ||
| 239 | - break; | ||
| 240 | - case RT_MEMCPY_KIND_INTER_DEVICE_TO_DEVICE: | ||
| 241 | - desc = "MEMCPY_KIND_INTER_DEVICE_TO_DEVICE(7)"; | ||
| 242 | - break; | ||
| 243 | - case RT_MEMCPY_KIND_MAX: | ||
| 244 | - desc = "MEMCPY_KIND_MAX(8)"; | ||
| 245 | - break; | ||
| 246 | - default: | ||
| 247 | - desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 248 | - break; | ||
| 249 | - } | ||
| 250 | - return desc; | ||
| 251 | -} | ||
| 252 | 134 | ||
| 253 | static inline std::string MemTypeToString(const rtMemType_t type) | 135 | static inline std::string MemTypeToString(const rtMemType_t type) |
| 254 | { | 136 | { |
| @@ -382,70 +264,16 @@ static inline std::string StreamTypeToString(const uint32_t streamType) | |||
| 382 | return desc; | 264 | return desc; |
| 383 | } | 265 | } |
| 384 | 266 | ||
| 385 | -static inline std::string MemInfoTypeToString(const rtMemInfoType_t memInfoType) | 267 | +std::string MemInfoTypeToString(const rtMemInfoType_t memInfoType); |
| 386 | -{ | 268 | + |
| 387 | - std::string desc; | 269 | +const char_t* DrvMemHandleTypeToString(const rtDrvMemHandleType type); |
| 388 | - switch (memInfoType) { | 270 | +const char_t* MemSharedHandleTypeToString(const rtMemSharedHandleType type); |
| 389 | - case RT_MEMORYINFO_DDR: | 271 | +std::string ManagedMemLocationTypeToString(const rtMemManagedLocationType type); |
| 390 | - desc = "MEMORYINFO_DDR(0)"; | 272 | +const char_t* MallocAttrToString(const rtMallocAttr attr); |
| 391 | - break; | 273 | +const char_t* FloatOverflowModeToString(const rtFloatOverflowMode_t mode); |
| 392 | - case RT_MEMORYINFO_HBM: | 274 | +std::string MemLocationTypeToString(const rtMemLocationType type); |
| 393 | - desc = "MEMORYINFO_HBM(1)"; | 275 | +std::string CmoOpCodeToString(const rtCmoOpCode_t opCode); |
| 394 | - break; | 276 | +std::string LimitTypeToString(const rtLimitType_t type); |
| 395 | - case RT_MEMORYINFO_DDR_HUGE: | ||
| 396 | - desc = "MEMORYINFO_DDR_HUGE(2)"; | ||
| 397 | - break; | ||
| 398 | - case RT_MEMORYINFO_DDR_NORMAL: | ||
| 399 | - desc = "MEMORYINFO_DDR_NORMAL(3)"; | ||
| 400 | - break; | ||
| 401 | - case RT_MEMORYINFO_HBM_HUGE: | ||
| 402 | - desc = "MEMORYINFO_HBM_HUGE(4)"; | ||
| 403 | - break; | ||
| 404 | - case RT_MEMORYINFO_HBM_NORMAL: | ||
| 405 | - desc = "MEMORYINFO_HBM_NORMAL(5)"; | ||
| 406 | - break; | ||
| 407 | - case RT_MEMORYINFO_DDR_P2P_HUGE: | ||
| 408 | - desc = "MEMORYINFO_DDR_P2P_HUGE(6)"; | ||
| 409 | - break; | ||
| 410 | - case RT_MEMORYINFO_DDR_P2P_NORMAL: | ||
| 411 | - desc = "MEMORYINFO_DDR_P2P_NORMAL(7)"; | ||
| 412 | - break; | ||
| 413 | - case RT_MEMORYINFO_HBM_P2P_HUGE: | ||
| 414 | - desc = "MEMORYINFO_HBM_P2P_HUGE(8)"; | ||
| 415 | - break; | ||
| 416 | - case RT_MEMORYINFO_HBM_P2P_NORMAL: | ||
| 417 | - desc = "MEMORYINFO_HBM_P2P_NORMAL(9)"; | ||
| 418 | - break; | ||
| 419 | - case RT_MEMORYINFO_HBM_HUGE1G: | ||
| 420 | - desc = "MEMORYINFO_HBM_HUGE1G(10)"; | ||
| 421 | - break; | ||
| 422 | - case RT_MEMORYINFO_HBM_P2P_HUGE1G: | ||
| 423 | - desc = "MEMORYINFO_HBM_P2P_HUGE1G(11)"; | ||
| 424 | - break; | ||
| 425 | - case RT_MEMORYINFO_NORMAL: | ||
| 426 | - desc = "MEMORYINFO_NORMAL(12)"; | ||
| 427 | - break; | ||
| 428 | - case RT_MEMORYINFO_HUGE: | ||
| 429 | - desc = "MEMORYINFO_HUGE(13)"; | ||
| 430 | - break; | ||
| 431 | - case RT_MEMORYINFO_HUGE1G: | ||
| 432 | - desc = "MEMORYINFO_HUGE1G(14)"; | ||
| 433 | - break; | ||
| 434 | - case RT_MEMORYINFO_P2P_NORMAL: | ||
| 435 | - desc = "MEMORYINFO_P2P_NORMAL(15)"; | ||
| 436 | - break; | ||
| 437 | - case RT_MEMORYINFO_P2P_HUGE: | ||
| 438 | - desc = "MEMORYINFO_P2P_HUGE(16)"; | ||
| 439 | - break; | ||
| 440 | - case RT_MEMORYINFO_P2P_HUGE1G: | ||
| 441 | - desc = "MEMORYINFO_P2P_HUGE1G(17)"; | ||
| 442 | - break; | ||
| 443 | - default: | ||
| 444 | - desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(memInfoType)); | ||
| 445 | - break; | ||
| 446 | - } | ||
| 447 | - return desc; | ||
| 448 | -} | ||
| 449 | 277 | ||
| 450 | static inline std::string SwitchDataTypeToString(const rtSwitchDataType_t dataType) | 278 | static inline std::string SwitchDataTypeToString(const rtSwitchDataType_t dataType) |
| 451 | { | 279 | { |
| @@ -489,6 +317,9 @@ static inline std::string RandomNumDataTypeToString(const rtRandomNumDataType da | |||
| 489 | case RT_RANDOM_NUM_DATATYPE_FP32: | 317 | case RT_RANDOM_NUM_DATATYPE_FP32: |
| 490 | desc = "RANDOM_NUM_DATATYPE_FP32(6)"; | 318 | desc = "RANDOM_NUM_DATATYPE_FP32(6)"; |
| 491 | break; | 319 | break; |
| 320 | + case RT_RANDOM_NUM_DATATYPE_MAX: | ||
| 321 | + desc = "RANDOM_NUM_DATATYPE_MAX(7)"; | ||
| 322 | + break; | ||
| 492 | default: | 323 | default: |
| 493 | desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(dataType)); | 324 | desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(dataType)); |
| 494 | break; | 325 | break; |
| @@ -512,6 +343,9 @@ static inline std::string RandomNumFuncTypeToString(const rtRandomNumFuncType fu | |||
| 512 | case RT_RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS: | 343 | case RT_RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS: |
| 513 | desc = "RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS(3)"; | 344 | desc = "RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS(3)"; |
| 514 | break; | 345 | break; |
| 346 | + case RT_RANDOM_NUM_FUNC_TYPE_MAX: | ||
| 347 | + desc = "RANDOM_NUM_FUNC_TYPE_MAX(4)"; | ||
| 348 | + break; | ||
| 515 | default: | 349 | default: |
| 516 | desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(funcType)); | 350 | desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(funcType)); |
| 517 | break; | 351 | break; |
| @@ -519,6 +353,17 @@ static inline std::string RandomNumFuncTypeToString(const rtRandomNumFuncType fu | |||
| 519 | return desc; | 353 | return desc; |
| 520 | } | 354 | } |
| 521 | 355 | ||
| 356 | +std::string SysParamOptToString(const rtSysParamOpt option); | ||
| 357 | +const char_t* DevResLimitTypeToString(const rtDevResLimitType_t type); | ||
| 358 | +std::string ConditionToString(const rtCondition_t condition); | ||
| 359 | +std::string KernelAttrTypeToString(const rtKernelAttrType type); | ||
| 360 | +std::string LaunchKernelAttrIdToString(const rtLaunchKernelAttrId id); | ||
| 361 | + | ||
| 362 | +const char_t* DevAttrToString(const rtDevAttr attr); | ||
| 363 | +std::string HacTypeToString(const rtHacType type); | ||
| 364 | +std::string MemPoolAttrToString(const rtMemPoolAttr attr); | ||
| 365 | +std::string DeviceStatusToString(const rtDeviceStatus status); | ||
| 366 | + | ||
| 522 | } // namespace runtime | 367 | } // namespace runtime |
| 523 | } // namespace cce | 368 | } // namespace cce |
| 524 | 369 | ||
| @@ -157,6 +157,13 @@ | |||
| 157 | return (RTERRCODE); \ | 157 | return (RTERRCODE); \ |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | +// EE1003错误码使用,带语义化函数描述,value与参数名分开传入 | ||
| 161 | + | ||
| 162 | + if (unlikely((COND))) { \ | ||
| 163 | + RT_LOG_OUTER_MSG_WITH_FUNC_DESC(ErrorCode::EE1003, (FUNC_DESC), (value), (paramName), ##__VA_ARGS__); \ | ||
| 164 | + return (RTERRCODE); \ | ||
| 165 | + } | ||
| 166 | + | ||
| 160 | // 除EE1003、EE1001之外的其他外部错误码使用 | 167 | // 除EE1003、EE1001之外的其他外部错误码使用 |
| 161 | 168 | ||
| 162 | if (unlikely(COND)) { \ | 169 | if (unlikely(COND)) { \ |
| @@ -72,6 +72,8 @@ static inline std::string StreamCaptureModeToString(const rtStreamCaptureMode mo | |||
| 72 | return desc; | 72 | return desc; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | +std::string StreamCaptureStatusToString(const rtStreamCaptureStatus status); | ||
| 76 | + | ||
| 75 | static inline std::string CaptureEventModeToString(const uint8_t mode) | 77 | static inline std::string CaptureEventModeToString(const uint8_t mode) |
| 76 | { | 78 | { |
| 77 | std::string desc; | 79 | std::string desc; |
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | namespace cce { | 21 | namespace cce { |
| @@ -60,6 +61,8 @@ static inline std::string MultipleTaskTypeToString(const rtMultipleTaskType_t ty | |||
| 60 | return desc; | 61 | return desc; |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 64 | +std::string TaskTypeToString(const rtTaskType type); | ||
| 65 | + | ||
| 63 | } // namespace runtime | 66 | } // namespace runtime |
| 64 | } // namespace cce | 67 | } // namespace cce |
| 65 | 68 | ||
| @@ -40,6 +40,8 @@ constexpr uint32_t DEVICE_TYPE = 1U; | |||
| 40 | constexpr uint32_t NUMA_TYPE = 4U; | 40 | constexpr uint32_t NUMA_TYPE = 4U; |
| 41 | constexpr uint32_t DRV_MEM_HOST_NUMA_SIDE = 2U; | 41 | constexpr uint32_t DRV_MEM_HOST_NUMA_SIDE = 2U; |
| 42 | constexpr int32_t FEATURE_SVM_VMM_NORMAL_GRANULARITY = 6; // check drv is support alloc mem via numa id | 42 | constexpr int32_t FEATURE_SVM_VMM_NORMAL_GRANULARITY = 6; // check drv is support alloc mem via numa id |
| 43 | +constexpr char_t MEM_SHARED_HANDLE_TYPE_EXPECT_DESC[] = | ||
| 44 | + "MEM_SHARE_HANDLE_TYPE_DEFAULT(1) or MEM_SHARE_HANDLE_TYPE_FABRIC(2)"; | ||
| 43 | 45 | ||
| 44 | ApiErrorDecorator::ApiErrorDecorator(Api* const impl) : ApiDecorator(impl) {} | 46 | ApiErrorDecorator::ApiErrorDecorator(Api* const impl) : ApiDecorator(impl) {} |
| 45 | 47 | ||
| @@ -2113,15 +2115,14 @@ rtError_t ApiErrorDecorator::MemCopySync( | |||
| 2113 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 2115 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| 2114 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Synchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); | 2116 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Synchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); |
| 2115 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( | 2117 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 2116 | - (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, | 2118 | + (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, MemcpyKindToStr(kind), |
| 2117 | - MemcpyKindToString(kind), "kind", | 2119 | + "kind", "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); |
| 2118 | - "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); | ||
| 2119 | COND_RETURN_WARN((dst == src), RT_ERROR_NONE, "The src and dst are the same, no need to copy, return."); | 2120 | COND_RETURN_WARN((dst == src), RT_ERROR_NONE, "The src and dst are the same, no need to copy, return."); |
| 2120 | 2121 | ||
| 2121 | const rtError_t error = impl_->MemCopySync(dst, destMax, src, cnt, kind, checkKind); | 2122 | const rtError_t error = impl_->MemCopySync(dst, destMax, src, cnt, kind, checkKind); |
| 2122 | COND_RETURN_ERROR( | 2123 | COND_RETURN_ERROR( |
| 2123 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, | 2124 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, |
| 2124 | - "Memory copy sync failed, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToString(kind).c_str()); | 2125 | + "Memory copy sync failed, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToStr(kind)); |
| 2125 | return error; | 2126 | return error; |
| 2126 | } | 2127 | } |
| 2127 | 2128 | ||
| @@ -2136,15 +2137,14 @@ rtError_t ApiErrorDecorator::MemCopySyncEx( | |||
| 2136 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 2137 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| 2137 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Synchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); | 2138 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Synchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); |
| 2138 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( | 2139 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 2139 | - (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, | 2140 | + (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, MemcpyKindToStr(kind), |
| 2140 | - MemcpyKindToString(kind), "kind", | 2141 | + "kind", "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); |
| 2141 | - "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); | ||
| 2142 | COND_RETURN_WARN((dst == src), RT_ERROR_NONE, "The src and dst are the same, no need to copy, return."); | 2142 | COND_RETURN_WARN((dst == src), RT_ERROR_NONE, "The src and dst are the same, no need to copy, return."); |
| 2143 | 2143 | ||
| 2144 | const rtError_t error = impl_->MemCopySyncEx(dst, destMax, src, cnt, kind); | 2144 | const rtError_t error = impl_->MemCopySyncEx(dst, destMax, src, cnt, kind); |
| 2145 | COND_RETURN_ERROR( | 2145 | COND_RETURN_ERROR( |
| 2146 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, | 2146 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, |
| 2147 | - "Memory copy sync failed, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToString(kind).c_str()); | 2147 | + "Memory copy sync failed, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToStr(kind)); |
| 2148 | return error; | 2148 | return error; |
| 2149 | } | 2149 | } |
| 2150 | 2150 | ||
| @@ -2159,9 +2159,8 @@ rtError_t ApiErrorDecorator::MemcpyAsync( | |||
| 2159 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 2159 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| 2160 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Asynchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); | 2160 | cnt > destMax, RT_ERROR_INVALID_VALUE, "Asynchronous memory copy", cnt, "(0, " + std::to_string(destMax) + "]"); |
| 2161 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( | 2161 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 2162 | - (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, | 2162 | + (kind >= RT_MEMCPY_RESERVED) || (kind < RT_MEMCPY_HOST_TO_HOST), RT_ERROR_INVALID_VALUE, MemcpyKindToStr(kind), |
| 2163 | - MemcpyKindToString(kind), "kind", | 2163 | + "kind", "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); |
| 2164 | - "[" + std::to_string(RT_MEMCPY_HOST_TO_HOST) + ", " + std::to_string(RT_MEMCPY_RESERVED) + ")"); | ||
| 2165 | COND_RETURN_AND_MSG_OUTER( | 2164 | COND_RETURN_AND_MSG_OUTER( |
| 2166 | ((kind == RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) && (cnt > MAX_MEMCPY_SIZE_OF_D2D)), RT_ERROR_INVALID_VALUE, | 2165 | ((kind == RT_MEMCPY_ADDR_DEVICE_TO_DEVICE) && (cnt > MAX_MEMCPY_SIZE_OF_D2D)), RT_ERROR_INVALID_VALUE, |
| 2167 | ErrorCode::EE1011, "Asynchronous memory copy", cnt, "cnt", | 2166 | ErrorCode::EE1011, "Asynchronous memory copy", cnt, "cnt", |
| @@ -2203,7 +2202,7 @@ rtError_t ApiErrorDecorator::MemcpyAsync( | |||
| 2203 | error = MemcpyAsyncCheckExLocation(checkKind, kind, src, dst); | 2202 | error = MemcpyAsyncCheckExLocation(checkKind, kind, src, dst); |
| 2204 | COND_RETURN_ERROR_MSG_INNER( | 2203 | COND_RETURN_ERROR_MSG_INNER( |
| 2205 | error != RT_ERROR_NONE, error, "MemcpyAsync EX check src or dst location failed, stream_id=%d, kind=%s", | 2204 | error != RT_ERROR_NONE, error, "MemcpyAsync EX check src or dst location failed, stream_id=%d, kind=%s", |
| 2206 | - streamId, MemcpyKindToString(kind).c_str()); | 2205 | + streamId, MemcpyKindToStr(kind)); |
| 2207 | } else { | 2206 | } else { |
| 2208 | // no operation | 2207 | // no operation |
| 2209 | } | 2208 | } |
| @@ -2215,7 +2214,7 @@ rtError_t ApiErrorDecorator::MemcpyAsync( | |||
| 2215 | COND_RETURN_ERROR_MSG_INNER( | 2214 | COND_RETURN_ERROR_MSG_INNER( |
| 2216 | error != RT_ERROR_NONE, error, | 2215 | error != RT_ERROR_NONE, error, |
| 2217 | "MemcpyAsync check src or dst location failed, stream_id=%d, checkKind=%d, copyKind=%s", streamId, | 2216 | "MemcpyAsync check src or dst location failed, stream_id=%d, checkKind=%d, copyKind=%s", streamId, |
| 2218 | - checkKind, MemcpyKindToString(copyKind).c_str()); | 2217 | + checkKind, MemcpyKindToStr(copyKind)); |
| 2219 | } | 2218 | } |
| 2220 | 2219 | ||
| 2221 | COND_RETURN_WARN( | 2220 | COND_RETURN_WARN( |
| @@ -2248,8 +2247,8 @@ rtError_t ApiErrorDecorator::MemcpyAsync( | |||
| 2248 | 2247 | ||
| 2249 | COND_RETURN_ERROR( | 2248 | COND_RETURN_ERROR( |
| 2250 | (error != RT_ERROR_NONE) && (error != RT_ERROR_FEATURE_NOT_SUPPORT), error, | 2249 | (error != RT_ERROR_NONE) && (error != RT_ERROR_FEATURE_NOT_SUPPORT), error, |
| 2251 | - "Memcpy async failed, count=%" PRIu64 ", kind=%s, isInvolvePageableMemory=%d", cnt, | 2250 | + "Memcpy async failed, count=%" PRIu64 ", kind=%s, isInvolvePageableMemory=%d", cnt, MemcpyKindToStr(copyKind), |
| 2252 | - MemcpyKindToString(copyKind).c_str(), isD2HorH2DInvolvePageableMemory); | 2251 | + isD2HorH2DInvolvePageableMemory); |
| 2253 | return error; | 2252 | return error; |
| 2254 | } | 2253 | } |
| 2255 | 2254 | ||
| @@ -2440,7 +2439,8 @@ rtError_t ApiErrorDecorator::SetMemcpyDesc( | |||
| 2440 | { | 2439 | { |
| 2441 | COND_RETURN_WARN( | 2440 | COND_RETURN_WARN( |
| 2442 | (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_FEATURE_NOT_SUPPORT, | 2441 | (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_FEATURE_NOT_SUPPORT, |
| 2443 | - "Kind should be %u, but now is %u.", RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE, kind); | 2442 | + "Kind should be %s, but now is %s.", "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)", |
| 2443 | + MemcpyNewKindToString(kind).c_str()); | ||
| 2444 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(srcAddr, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); | 2444 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(srcAddr, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); |
| 2445 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(dstAddr, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); | 2445 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(dstAddr, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); |
| 2446 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(desc, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); | 2446 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(desc, RT_ERROR_INVALID_VALUE, "Setting the memory copy descriptor"); |
| @@ -2473,18 +2473,20 @@ rtError_t ApiErrorDecorator::SetMemcpyDesc( | |||
| 2473 | 2473 | ||
| 2474 | COND_RETURN_ERROR_MSG_INNER( | 2474 | COND_RETURN_ERROR_MSG_INNER( |
| 2475 | descAttributes.location.type != RT_MEMORY_LOC_DEVICE, RT_ERROR_INVALID_VALUE, | 2475 | descAttributes.location.type != RT_MEMORY_LOC_DEVICE, RT_ERROR_INVALID_VALUE, |
| 2476 | - "rtsSetMemcpyDesc failed, desc addr type=%d is invalid!", descAttributes.location.type); | 2476 | + "rtsSetMemcpyDesc failed, desc addr type=%s is invalid!", |
| 2477 | + MemLocationTypeToString(descAttributes.location.type).c_str()); | ||
| 2477 | 2478 | ||
| 2478 | COND_RETURN_AND_MSG_OUTER( | 2479 | COND_RETURN_AND_MSG_OUTER( |
| 2479 | ((destAttributes.location.id != srcAttributes.location.id) || | 2480 | ((destAttributes.location.id != srcAttributes.location.id) || |
| 2480 | (destAttributes.location.type != RT_MEMORY_LOC_DEVICE) || | 2481 | (destAttributes.location.type != RT_MEMORY_LOC_DEVICE) || |
| 2481 | (srcAttributes.location.type != RT_MEMORY_LOC_DEVICE)), | 2482 | (srcAttributes.location.type != RT_MEMORY_LOC_DEVICE)), |
| 2482 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Setting the memory copy descriptor", "dstAddr or srcAddr", | 2483 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Setting the memory copy descriptor", "dstAddr or srcAddr", |
| 2483 | - "DstAddr and srcAddr do not match with the kind RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE, dstAddr DeviceId=" + | 2484 | + RtFmtMsg( |
| 2484 | - std::to_string(destAttributes.location.id) + | 2485 | + "DstAddr and srcAddr do not match with the kind RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE, " |
| 2485 | - ", srcAddr DeviceId=" + std::to_string(srcAttributes.location.id) + | 2486 | + "dstAddr DeviceId=%d, srcAddr DeviceId=%d, dstAddr type=%s, srcAddr type=%s", |
| 2486 | - ", dstAddr type=" + std::to_string(destAttributes.location.type) + | 2487 | + destAttributes.location.id, srcAttributes.location.id, |
| 2487 | - ", srcAddr type=" + std::to_string(srcAttributes.location.type)); | 2488 | + MemLocationTypeToString(destAttributes.location.type).c_str(), |
| 2489 | + MemLocationTypeToString(srcAttributes.location.type).c_str())); | ||
| 2488 | 2490 | ||
| 2489 | error = impl_->SetMemcpyDesc(desc, srcAddr, dstAddr, count, kind, config); | 2491 | error = impl_->SetMemcpyDesc(desc, srcAddr, dstAddr, count, kind, config); |
| 2490 | ERROR_RETURN_MSG_INNER(error, "Failed to set memcpy desc, retCode=%#x.", static_cast<uint32_t>(error)); | 2492 | ERROR_RETURN_MSG_INNER(error, "Failed to set memcpy desc, retCode=%#x.", static_cast<uint32_t>(error)); |
| @@ -2496,7 +2498,8 @@ rtError_t ApiErrorDecorator::MemcpyAsyncWithDesc( | |||
| 2496 | { | 2498 | { |
| 2497 | COND_RETURN_WARN( | 2499 | COND_RETURN_WARN( |
| 2498 | (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_FEATURE_NOT_SUPPORT, | 2500 | (kind != RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), RT_ERROR_FEATURE_NOT_SUPPORT, |
| 2499 | - "Kind should be %u, but now is %u.", RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE, kind); | 2501 | + "Kind should be %s, but now is %s.", "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)", |
| 2502 | + MemcpyNewKindToString(kind).c_str()); | ||
| 2500 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 2503 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 2501 | desc, RT_ERROR_INVALID_VALUE, "Performing asynchronous memory copy using the memory copy descriptor"); | 2504 | desc, RT_ERROR_INVALID_VALUE, "Performing asynchronous memory copy using the memory copy descriptor"); |
| 2502 | COND_RETURN_AND_MSG_RESERVED_PARAM( | 2505 | COND_RETURN_AND_MSG_RESERVED_PARAM( |
| @@ -2509,7 +2512,8 @@ rtError_t ApiErrorDecorator::MemcpyAsyncWithDesc( | |||
| 2509 | static_cast<uint32_t>(error)); | 2512 | static_cast<uint32_t>(error)); |
| 2510 | COND_RETURN_ERROR_MSG_INNER( | 2513 | COND_RETURN_ERROR_MSG_INNER( |
| 2511 | descAttributes.location.type != RT_MEMORY_LOC_DEVICE, RT_ERROR_INVALID_VALUE, | 2514 | descAttributes.location.type != RT_MEMORY_LOC_DEVICE, RT_ERROR_INVALID_VALUE, |
| 2512 | - "rtsMemcpyAsyncWithDesc failed, desc addr type=%d is invalid!", descAttributes.location.type); | 2515 | + "rtsMemcpyAsyncWithDesc failed, desc addr type=%s is invalid!", |
| 2516 | + MemLocationTypeToString(descAttributes.location.type).c_str()); | ||
| 2513 | 2517 | ||
| 2514 | rtTaskCfgInfo_t cfgInfo = {}; | 2518 | rtTaskCfgInfo_t cfgInfo = {}; |
| 2515 | (void)memset_s(&cfgInfo, sizeof(rtTaskCfgInfo_t), 0, sizeof(rtTaskCfgInfo_t)); | 2519 | (void)memset_s(&cfgInfo, sizeof(rtTaskCfgInfo_t), 0, sizeof(rtTaskCfgInfo_t)); |
| @@ -2541,8 +2545,8 @@ rtError_t ApiErrorDecorator::MemcpyAsyncCheckParam(const rtMemcpyKind_t kind, co | |||
| 2541 | "Checking asynchronous memory copy parameters", | 2545 | "Checking asynchronous memory copy parameters", |
| 2542 | RtFmtMsg( | 2546 | RtFmtMsg( |
| 2543 | "If the stream is a model stream," | 2547 | "If the stream is a model stream," |
| 2544 | - " the memcpy kind %u is not supported", | 2548 | + " the memcpy kind %s is not supported", |
| 2545 | - kind)); | 2549 | + MemcpyKindToStr(kind))); |
| 2546 | } | 2550 | } |
| 2547 | } | 2551 | } |
| 2548 | return RT_ERROR_NONE; | 2552 | return RT_ERROR_NONE; |
| @@ -2709,9 +2713,9 @@ rtError_t ApiErrorDecorator::MemcpyKindAutoCorrect( | |||
| 2709 | if (it == MemcpyKindReviseMap.end()) { | 2713 | if (it == MemcpyKindReviseMap.end()) { |
| 2710 | // Uncovered combinations: return success, kind unchanged. | 2714 | // Uncovered combinations: return success, kind unchanged. |
| 2711 | RT_LOG( | 2715 | RT_LOG( |
| 2712 | - RT_LOG_INFO, "MemcpyKindAutoCorrect: undefined memory combination src=%d(%s), dst=%d(%s), kind=%d.", | 2716 | + RT_LOG_INFO, "MemcpyKindAutoCorrect: undefined memory combination src=%s, dst=%s, kind=%s.", |
| 2713 | - srcLocationType, MemLocationTypeToStr(srcLocationType), dstLocationType, | 2717 | + MemLocationTypeToString(srcLocationType).c_str(), MemLocationTypeToString(dstLocationType).c_str(), |
| 2714 | - MemLocationTypeToStr(dstLocationType), *kind); | 2718 | + MemcpyKindToStr(*kind)); |
| 2715 | return RT_ERROR_NONE; | 2719 | return RT_ERROR_NONE; |
| 2716 | } | 2720 | } |
| 2717 | const MemcpyKindReviseRule& rule = it->second; | 2721 | const MemcpyKindReviseRule& rule = it->second; |
| @@ -2719,9 +2723,9 @@ rtError_t ApiErrorDecorator::MemcpyKindAutoCorrect( | |||
| 2719 | if (rule.expectKind != RT_MEMCPY_RESERVED) { | 2723 | if (rule.expectKind != RT_MEMCPY_RESERVED) { |
| 2720 | if (*kind != rule.expectKind) { | 2724 | if (*kind != rule.expectKind) { |
| 2721 | RT_LOG( | 2725 | RT_LOG( |
| 2722 | - RT_LOG_INFO, "MemcpyKindAutoCorrect: kind changed from %d to %d for src=%d(%s), dst=%d(%s).", *kind, | 2726 | + RT_LOG_INFO, "MemcpyKindAutoCorrect: kind changed from %s to %s for src=%s, dst=%s.", |
| 2723 | - rule.expectKind, srcLocationType, MemLocationTypeToStr(srcLocationType), dstLocationType, | 2727 | + std::string(MemcpyKindToStr(*kind)).c_str(), std::string(MemcpyKindToStr(rule.expectKind)).c_str(), |
| 2724 | - MemLocationTypeToStr(dstLocationType)); | 2728 | + MemLocationTypeToString(srcLocationType).c_str(), MemLocationTypeToString(dstLocationType).c_str()); |
| 2725 | *kind = rule.expectKind; | 2729 | *kind = rule.expectKind; |
| 2726 | } | 2730 | } |
| 2727 | return RT_ERROR_NONE; | 2731 | return RT_ERROR_NONE; |
| @@ -2729,9 +2733,9 @@ rtError_t ApiErrorDecorator::MemcpyKindAutoCorrect( | |||
| 2729 | // 2) If incoming is DEFAULT -> replace with defaultKind | 2733 | // 2) If incoming is DEFAULT -> replace with defaultKind |
| 2730 | if (*kind == RT_MEMCPY_DEFAULT) { | 2734 | if (*kind == RT_MEMCPY_DEFAULT) { |
| 2731 | RT_LOG( | 2735 | RT_LOG( |
| 2732 | - RT_LOG_INFO, "MemcpyKindAutoCorrect: kind changed from %d to %d for src=%d(%s), dst=%d(%s) (default case).", | 2736 | + RT_LOG_INFO, "MemcpyKindAutoCorrect: kind changed from %s to %s for src=%s, dst=%s (default case).", |
| 2733 | - *kind, rule.defaultKind, srcLocationType, MemLocationTypeToStr(srcLocationType), dstLocationType, | 2737 | + std::string(MemcpyKindToStr(*kind)).c_str(), std::string(MemcpyKindToStr(rule.defaultKind)).c_str(), |
| 2734 | - MemLocationTypeToStr(dstLocationType)); | 2738 | + MemLocationTypeToString(srcLocationType).c_str(), MemLocationTypeToString(dstLocationType).c_str()); |
| 2735 | *kind = rule.defaultKind; | 2739 | *kind = rule.defaultKind; |
| 2736 | return RT_ERROR_NONE; | 2740 | return RT_ERROR_NONE; |
| 2737 | } | 2741 | } |
| @@ -2742,10 +2746,9 @@ rtError_t ApiErrorDecorator::MemcpyKindAutoCorrect( | |||
| 2742 | // 4) Otherwise illegal -> log expected set and return error | 2746 | // 4) Otherwise illegal -> log expected set and return error |
| 2743 | std::string expected = allowed_list_to_string(rule.allowedKinds); | 2747 | std::string expected = allowed_list_to_string(rule.allowedKinds); |
| 2744 | RT_LOG( | 2748 | RT_LOG( |
| 2745 | - RT_LOG_ERROR, | 2749 | + RT_LOG_ERROR, "MemcpyKindAutoCorrect: invalid kind=%s for src=%s, dst=%s; expected one of [%s], actual=%s.", |
| 2746 | - "MemcpyKindAutoCorrect: invalid kind=%s for src=%d(%s), dst=%d(%s); expected one of [%s], actual=%s.", | 2750 | + MemcpyKindToStr(*kind), MemLocationTypeToString(srcLocationType).c_str(), |
| 2747 | - MemcpyKindToString(*kind).c_str(), srcLocationType, MemLocationTypeToStr(srcLocationType), dstLocationType, | 2751 | + MemLocationTypeToString(dstLocationType).c_str(), expected.c_str(), MemcpyKindToStr(*kind)); |
| 2748 | - MemLocationTypeToStr(dstLocationType), expected.c_str(), MemcpyKindToString(*kind).c_str()); | ||
| 2749 | return RT_ERROR_INVALID_VALUE; | 2752 | return RT_ERROR_INVALID_VALUE; |
| 2750 | } | 2753 | } |
| 2751 | 2754 | ||
| @@ -2808,8 +2811,9 @@ rtError_t ApiErrorDecorator::MemcpyAsyncCheckLocation( | |||
| 2808 | error = MemcpyKindAutoCorrect(srcLocationType, dstLocationType, ©Kind); | 2811 | error = MemcpyKindAutoCorrect(srcLocationType, dstLocationType, ©Kind); |
| 2809 | COND_RETURN_ERROR_MSG_CALL( | 2812 | COND_RETURN_ERROR_MSG_CALL( |
| 2810 | ERR_MODULE_GE, error != RT_ERROR_NONE, error, | 2813 | ERR_MODULE_GE, error != RT_ERROR_NONE, error, |
| 2811 | - "Memory async check kind and loc failed, retCode=%#x, copyKind=%s, srcLoc=%d, dstLoc=%d", | 2814 | + "Memory async check kind and loc failed, retCode=%#x, copyKind=%s, srcLoc=%s, dstLoc=%s", |
| 2812 | - static_cast<uint32_t>(error), MemcpyKindToString(copyKind).c_str(), srcLocationType, dstLocationType); | 2815 | + static_cast<uint32_t>(error), MemcpyKindToStr(copyKind), MemLocationTypeToString(srcLocationType).c_str(), |
| 2816 | + MemLocationTypeToString(dstLocationType).c_str()); | ||
| 2813 | } | 2817 | } |
| 2814 | 2818 | ||
| 2815 | /* 3) check whether involve pageable host memory */ | 2819 | /* 3) check whether involve pageable host memory */ |
| @@ -2818,11 +2822,12 @@ rtError_t ApiErrorDecorator::MemcpyAsyncCheckLocation( | |||
| 2818 | 2822 | ||
| 2819 | RT_LOG( | 2823 | RT_LOG( |
| 2820 | RT_LOG_INFO, | 2824 | RT_LOG_INFO, |
| 2821 | - "kind=%d, checkKind= %d, copyKind=%d, srcLocType=%d(%s), srcRealLocType=%d(%s), dstLocType=%d(%s), " | 2825 | + "kind=%s, checkKind= %d, copyKind=%s, srcLocType=%s, srcRealLocType=%s, dstLocType=%s, " |
| 2822 | - "dstRealLocType=%d(%s), isSupportUserMem=%d, isD2HorH2DInvolvePageableMemory=%d.", | 2826 | + "dstRealLocType=%s, isSupportUserMem=%d, isD2HorH2DInvolvePageableMemory=%d.", |
| 2823 | - kind, checkKind, copyKind, srcLocationType, MemLocationTypeToStr(srcLocationType), srcRealLocation, | 2827 | + std::string(MemcpyKindToStr(kind)).c_str(), checkKind, std::string(MemcpyKindToStr(copyKind)).c_str(), |
| 2824 | - MemLocationTypeToStr(srcRealLocation), dstLocationType, MemLocationTypeToStr(dstLocationType), dstRealLocation, | 2828 | + MemLocationTypeToString(srcLocationType).c_str(), MemLocationTypeToString(srcRealLocation).c_str(), |
| 2825 | - MemLocationTypeToStr(dstRealLocation), isSupportUserMem, isD2HorH2DInvolvePageableMemory); | 2829 | + MemLocationTypeToString(dstLocationType).c_str(), MemLocationTypeToString(dstRealLocation).c_str(), |
| 2830 | + isSupportUserMem, isD2HorH2DInvolvePageableMemory); | ||
| 2826 | 2831 | ||
| 2827 | return error; | 2832 | return error; |
| 2828 | } | 2833 | } |
| @@ -2844,7 +2849,9 @@ rtError_t ApiErrorDecorator::MemcpyKindAutoUpdate( | |||
| 2844 | *kind = RT_MEMCPY_DEVICE_TO_DEVICE; | 2849 | *kind = RT_MEMCPY_DEVICE_TO_DEVICE; |
| 2845 | } | 2850 | } |
| 2846 | } | 2851 | } |
| 2847 | - RT_LOG(RT_LOG_DEBUG, "auto infer copy srcType=%d, dstType=%d, dir=%d", srcType, dstType, *kind); | 2852 | + RT_LOG( |
| 2853 | + RT_LOG_DEBUG, "auto infer copy srcType=%s, dstType=%s, dir=%s", MemLocationTypeToString(srcType).c_str(), | ||
| 2854 | + MemLocationTypeToString(dstType).c_str(), MemcpyKindToStr(*kind)); | ||
| 2848 | return RT_ERROR_NONE; | 2855 | return RT_ERROR_NONE; |
| 2849 | } | 2856 | } |
| 2850 | 2857 | ||
| @@ -2997,22 +3004,19 @@ rtError_t ApiErrorDecorator::MemCopy2DSync( | |||
| 2997 | (error != RT_ERROR_NONE) || ((copyKind != RT_MEMCPY_HOST_TO_DEVICE) && (copyKind != RT_MEMCPY_DEVICE_TO_HOST)), | 3004 | (error != RT_ERROR_NONE) || ((copyKind != RT_MEMCPY_HOST_TO_DEVICE) && (copyKind != RT_MEMCPY_DEVICE_TO_HOST)), |
| 2998 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, | 3005 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, |
| 2999 | RT_LOG( | 3006 | RT_LOG( |
| 3000 | - RT_LOG_ERROR, | 3007 | + RT_LOG_ERROR, "srcLocType=%s, srcRealLocType=%s, dstLocType=%s, dstRealLocType=%s.", |
| 3001 | - "srcLocType=%d(%s), srcLocType=%d(%s), dstLocType=%d(%s), " | 3008 | + MemLocationTypeToString(srcLocationType).c_str(), MemLocationTypeToString(srcRealLocation).c_str(), |
| 3002 | - "dstRealLocType=%d(%s).", | 3009 | + MemLocationTypeToString(dstLocationType).c_str(), MemLocationTypeToString(dstRealLocation).c_str()), |
| 3003 | - srcLocationType, MemLocationTypeToStr(srcLocationType), srcRealLocation, | ||
| 3004 | - MemLocationTypeToStr(srcRealLocation), dstLocationType, MemLocationTypeToStr(dstLocationType), | ||
| 3005 | - dstRealLocation, MemLocationTypeToStr(dstRealLocation)), | ||
| 3006 | __func__, "kind or newKind", | 3010 | __func__, "kind or newKind", |
| 3007 | RtFmtMsg( | 3011 | RtFmtMsg( |
| 3008 | - "Memcpy2dSync supports only H2D or D2H. Parameter kind is %s, and newKind is %s", | 3012 | + "Memcpy2dSync supports only H2D or D2H. Parameter kind is %s, and newKind is %s", MemcpyKindToStr(kind), |
| 3009 | - MemcpyKindToString(kind).c_str(), MemcpyNewKindToString(newKind).c_str())); | 3013 | + MemcpyNewKindToString(newKind).c_str())); |
| 3010 | error = impl_->MemCopy2DSync(dst, dstPitch, src, srcPitch, width, height, copyKind); | 3014 | error = impl_->MemCopy2DSync(dst, dstPitch, src, srcPitch, width, height, copyKind); |
| 3011 | ERROR_RETURN( | 3015 | ERROR_RETURN( |
| 3012 | error, | 3016 | error, |
| 3013 | "Memcpy2d sync failed, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 | 3017 | "Memcpy2d sync failed, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 |
| 3014 | ", kind=%s", | 3018 | ", kind=%s", |
| 3015 | - dstPitch, srcPitch, width, height, MemcpyKindToString(copyKind).c_str()); | 3019 | + dstPitch, srcPitch, width, height, MemcpyKindToStr(copyKind)); |
| 3016 | return error; | 3020 | return error; |
| 3017 | } | 3021 | } |
| 3018 | 3022 | ||
| @@ -3039,7 +3043,7 @@ rtError_t ApiErrorDecorator::MemCopy2DAsync( | |||
| 3039 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Asynchronous 2D memory copy", "kind or newKind", | 3043 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Asynchronous 2D memory copy", "kind or newKind", |
| 3040 | RtFmtMsg( | 3044 | RtFmtMsg( |
| 3041 | "Memcpy2dAsync supports only H2D, D2H, or D2D. Parameter kind is %s, and reviseKind is %s", | 3045 | "Memcpy2dAsync supports only H2D, D2H, or D2D. Parameter kind is %s, and reviseKind is %s", |
| 3042 | - MemcpyKindToString(kind).c_str(), MemcpyKindToString(copyKind).c_str())); | 3046 | + std::string(MemcpyKindToStr(kind)).c_str(), std::string(MemcpyKindToStr(copyKind)).c_str())); |
| 3043 | 3047 | ||
| 3044 | COND_RETURN_WARN( | 3048 | COND_RETURN_WARN( |
| 3045 | ((copyKind != RT_MEMCPY_HOST_TO_DEVICE) && (copyKind != RT_MEMCPY_DEVICE_TO_HOST) && | 3049 | ((copyKind != RT_MEMCPY_HOST_TO_DEVICE) && (copyKind != RT_MEMCPY_DEVICE_TO_HOST) && |
| @@ -3071,7 +3075,7 @@ rtError_t ApiErrorDecorator::MemCopy2DAsync( | |||
| 3071 | error, | 3075 | error, |
| 3072 | "Memcpy2d async failed, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 | 3076 | "Memcpy2d async failed, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 |
| 3073 | ", kind=%s, isInvolvePageableMemory=%d", | 3077 | ", kind=%s, isInvolvePageableMemory=%d", |
| 3074 | - dstPitch, srcPitch, width, height, MemcpyKindToString(copyKind).c_str(), isD2HorH2DInvolvePageableMemory); | 3078 | + dstPitch, srcPitch, width, height, MemcpyKindToStr(copyKind), isD2HorH2DInvolvePageableMemory); |
| 3075 | return error; | 3079 | return error; |
| 3076 | } | 3080 | } |
| 3077 | 3081 | ||
| @@ -3149,8 +3153,8 @@ rtError_t ApiErrorDecorator::MemGetInfoEx( | |||
| 3149 | "[" + std::to_string(RT_MEMORYINFO_DDR) + ", " + std::to_string(RT_MEMORYINFO_P2P_HUGE1G) + "]"); | 3153 | "[" + std::to_string(RT_MEMORYINFO_DDR) + ", " + std::to_string(RT_MEMORYINFO_P2P_HUGE1G) + "]"); |
| 3150 | const rtError_t error = impl_->MemGetInfoEx(memInfoType, freeSize, totalSize); | 3154 | const rtError_t error = impl_->MemGetInfoEx(memInfoType, freeSize, totalSize); |
| 3151 | ERROR_RETURN( | 3155 | ERROR_RETURN( |
| 3152 | - error, "Get Memory extend info failed, memInfoType=%u, free=%zu, total=%zu.", memInfoType, *freeSize, | 3156 | + error, "Get Memory extend info failed, memInfoType=%s, free=%zu, total=%zu.", |
| 3153 | - *totalSize); | 3157 | + MemInfoTypeToString(memInfoType).c_str(), *freeSize, *totalSize); |
| 3154 | return error; | 3158 | return error; |
| 3155 | } | 3159 | } |
| 3156 | 3160 | ||
| @@ -3182,8 +3186,8 @@ rtError_t ApiErrorDecorator::PtrGetAttributes(const void* const ptr, rtPtrAttrib | |||
| 3182 | const rtError_t error = impl_->PtrGetAttributes(ptr, attributes); | 3186 | const rtError_t error = impl_->PtrGetAttributes(ptr, attributes); |
| 3183 | ERROR_RETURN(error, "Get pointer attributes failed"); | 3187 | ERROR_RETURN(error, "Get pointer attributes failed"); |
| 3184 | RT_LOG( | 3188 | RT_LOG( |
| 3185 | - RT_LOG_DEBUG, "get memory attribute locationType=%d, [0:HOST,1:DEVICE].", | 3189 | + RT_LOG_DEBUG, "get memory attribute locationType=%s.", |
| 3186 | - static_cast<int32_t>(attributes->location.type)); | 3190 | + MemLocationTypeToString(attributes->location.type).c_str()); |
| 3187 | return RT_ERROR_NONE; | 3191 | return RT_ERROR_NONE; |
| 3188 | } | 3192 | } |
| 3189 | 3193 | ||
| @@ -3416,7 +3420,8 @@ rtError_t ApiErrorDecorator::DeviceSetLimit(const int32_t devId, const rtLimitTy | |||
| 3416 | error != RT_ERROR_NONE, error, "Failed to convert the user device ID %d to driver device ID.", devId); | 3420 | error != RT_ERROR_NONE, error, "Failed to convert the user device ID %d to driver device ID.", devId); |
| 3417 | error = impl_->DeviceSetLimit(realDeviceId, type, val); | 3421 | error = impl_->DeviceSetLimit(realDeviceId, type, val); |
| 3418 | ERROR_RETURN( | 3422 | ERROR_RETURN( |
| 3419 | - error, "Device set limit failed, device_id=%d, type=%d, value=%u.", devId, static_cast<int32_t>(type), val); | 3423 | + error, "Device set limit failed, device_id=%d, type=%s, value=%u.", devId, LimitTypeToString(type).c_str(), |
| 3424 | + val); | ||
| 3420 | return error; | 3425 | return error; |
| 3421 | } | 3426 | } |
| 3422 | 3427 | ||
| @@ -3424,7 +3429,7 @@ rtError_t ApiErrorDecorator::DeviceGetLimit(const rtLimitType_t type, uint32_t* | |||
| 3424 | { | 3429 | { |
| 3425 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM(val == nullptr, RT_ERROR_INVALID_VALUE, val, "non-null"); | 3430 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM(val == nullptr, RT_ERROR_INVALID_VALUE, val, "non-null"); |
| 3426 | rtError_t error = impl_->DeviceGetLimit(type, val); | 3431 | rtError_t error = impl_->DeviceGetLimit(type, val); |
| 3427 | - ERROR_RETURN(error, "Device get limit failed, type=%d.", static_cast<int32_t>(type)); | 3432 | + ERROR_RETURN(error, "Device get limit failed, type=%s.", LimitTypeToString(type).c_str()); |
| 3428 | return error; | 3433 | return error; |
| 3429 | } | 3434 | } |
| 3430 | 3435 | ||
| @@ -4265,25 +4270,29 @@ rtError_t ApiErrorDecorator::MemcpyAsyncCheckExLocation( | |||
| 4265 | COND_RETURN_AND_MSG_OUTER( | 4270 | COND_RETURN_AND_MSG_OUTER( |
| 4266 | (srcRealLocation == RT_MEMORY_LOC_DEVICE) || (dstRealLocation != RT_MEMORY_LOC_DEVICE), | 4271 | (srcRealLocation == RT_MEMORY_LOC_DEVICE) || (dstRealLocation != RT_MEMORY_LOC_DEVICE), |
| 4267 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1011, "Checking the extended location for asynchronous memory copy", | 4272 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1011, "Checking the extended location for asynchronous memory copy", |
| 4268 | - RtFmtMsg("%s/%s", MemLocationTypeToStr(srcRealLocation), MemLocationTypeToStr(dstRealLocation)), | 4273 | + RtFmtMsg( |
| 4274 | + "%s/%s", MemLocationTypeToString(srcRealLocation).c_str(), | ||
| 4275 | + MemLocationTypeToString(dstRealLocation).c_str()), | ||
| 4269 | "src/dst address location", | 4276 | "src/dst address location", |
| 4270 | "The src address must be a host address and the dst address must be a device address"); | 4277 | "The src address must be a host address and the dst address must be a device address"); |
| 4271 | } else { | 4278 | } else { |
| 4272 | COND_RETURN_AND_MSG_OUTER( | 4279 | COND_RETURN_AND_MSG_OUTER( |
| 4273 | (srcRealLocation != RT_MEMORY_LOC_DEVICE) || (dstRealLocation == RT_MEMORY_LOC_DEVICE), | 4280 | (srcRealLocation != RT_MEMORY_LOC_DEVICE) || (dstRealLocation == RT_MEMORY_LOC_DEVICE), |
| 4274 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1011, "Checking the extended location for asynchronous memory copy", | 4281 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1011, "Checking the extended location for asynchronous memory copy", |
| 4275 | - RtFmtMsg("%s/%s", MemLocationTypeToStr(srcRealLocation), MemLocationTypeToStr(dstRealLocation)), | 4282 | + RtFmtMsg( |
| 4283 | + "%s/%s", MemLocationTypeToString(srcRealLocation).c_str(), | ||
| 4284 | + MemLocationTypeToString(dstRealLocation).c_str()), | ||
| 4276 | "src/dst address location", | 4285 | "src/dst address location", |
| 4277 | "The src address must be a device address and the dst address must be a host address"); | 4286 | "The src address must be a device address and the dst address must be a host address"); |
| 4278 | } | 4287 | } |
| 4279 | 4288 | ||
| 4280 | RT_LOG( | 4289 | RT_LOG( |
| 4281 | RT_LOG_INFO, | 4290 | RT_LOG_INFO, |
| 4282 | - "MemcpyAsync EX location check passed, kind=%d, srcLocType=%d(%s), srcRealLocType=%d(%s), " | 4291 | + "MemcpyAsync EX location check passed, kind=%s, srcLocType=%s, srcRealLocType=%s, " |
| 4283 | - "dstLocType=%d(%s), dstRealLocType=%d(%s).", | 4292 | + "dstLocType=%s, dstRealLocType=%s.", |
| 4284 | - kind, srcLocationType, MemLocationTypeToStr(srcLocationType), srcRealLocation, | 4293 | + MemcpyKindToStr(kind), MemLocationTypeToString(srcLocationType).c_str(), |
| 4285 | - MemLocationTypeToStr(srcRealLocation), dstLocationType, MemLocationTypeToStr(dstLocationType), dstRealLocation, | 4294 | + MemLocationTypeToString(srcRealLocation).c_str(), MemLocationTypeToString(dstLocationType).c_str(), |
| 4286 | - MemLocationTypeToStr(dstRealLocation)); | 4295 | + MemLocationTypeToString(dstRealLocation).c_str()); |
| 4287 | return RT_ERROR_NONE; | 4296 | return RT_ERROR_NONE; |
| 4288 | } | 4297 | } |
| 4289 | 4298 | ||
| @@ -4472,15 +4481,17 @@ rtError_t ApiErrorDecorator::StreamSwitchEx( | |||
| 4472 | trueStream, RT_ERROR_INVALID_VALUE, "Switching between streams based on conditions"); | 4481 | trueStream, RT_ERROR_INVALID_VALUE, "Switching between streams based on conditions"); |
| 4473 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 4482 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 4474 | curStm, RT_ERROR_INVALID_VALUE, "Switching between streams based on conditions"); | 4483 | curStm, RT_ERROR_INVALID_VALUE, "Switching between streams based on conditions"); |
| 4475 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 4484 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 4476 | (condition > RT_LESS_OR_EQUAL) || (condition < 0), RT_ERROR_INVALID_VALUE, | 4485 | (condition > RT_LESS_OR_EQUAL) || (condition < 0), RT_ERROR_INVALID_VALUE, |
| 4477 | - "Switching between streams based on conditions", condition, "[0, " + std::to_string(RT_LESS_OR_EQUAL) + "]"); | 4486 | + "Switching between streams based on conditions", RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(condition)), |
| 4487 | + "condition", "[0, " + std::to_string(RT_LESS_OR_EQUAL) + "]"); | ||
| 4478 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( | 4488 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 4479 | (dataType > RT_SWITCH_INT64) || (dataType < 0), RT_ERROR_INVALID_VALUE, SwitchDataTypeToString(dataType), | 4489 | (dataType > RT_SWITCH_INT64) || (dataType < 0), RT_ERROR_INVALID_VALUE, SwitchDataTypeToString(dataType), |
| 4480 | "dataType", "[0, " + std::to_string(RT_SWITCH_INT64) + "]"); | 4490 | "dataType", "[0, " + std::to_string(RT_SWITCH_INT64) + "]"); |
| 4481 | const rtError_t error = impl_->StreamSwitchEx(ptr, condition, valuePtr, trueStream, curStm, dataType); | 4491 | const rtError_t error = impl_->StreamSwitchEx(ptr, condition, valuePtr, trueStream, curStm, dataType); |
| 4482 | ERROR_RETURN( | 4492 | ERROR_RETURN( |
| 4483 | - error, "Stream switch[extend] failed, condition=%d, dataType=%d.", condition, static_cast<int32_t>(dataType)); | 4493 | + error, "Stream switch[extend] failed, condition=%s, dataType=%s.", ConditionToString(condition).c_str(), |
| 4494 | + SwitchDataTypeToString(dataType).c_str()); | ||
| 4484 | return error; | 4495 | return error; |
| 4485 | } | 4496 | } |
| 4486 | 4497 | ||
| @@ -4522,7 +4533,8 @@ rtError_t ApiErrorDecorator::StreamSwitchN( | |||
| 4522 | "dataType", "[0, " + std::to_string(RT_SWITCH_INT64) + "]"); | 4533 | "dataType", "[0, " + std::to_string(RT_SWITCH_INT64) + "]"); |
| 4523 | const rtError_t error = impl_->StreamSwitchN(ptr, size, valuePtr, trueStreamPtr, elementSize, curStm, dataType); | 4534 | const rtError_t error = impl_->StreamSwitchN(ptr, size, valuePtr, trueStreamPtr, elementSize, curStm, dataType); |
| 4524 | ERROR_RETURN( | 4535 | ERROR_RETURN( |
| 4525 | - error, "Stream switchN failed, size=%u(bytes), elementSize=%u(bytes) dataType=%d", size, elementSize, dataType); | 4536 | + error, "Stream switchN failed, size=%u(bytes), elementSize=%u(bytes) dataType=%s", size, elementSize, |
| 4537 | + SwitchDataTypeToString(dataType).c_str()); | ||
| 4526 | return error; | 4538 | return error; |
| 4527 | } | 4539 | } |
| 4528 | 4540 | ||
| @@ -5872,10 +5884,10 @@ rtError_t ApiErrorDecorator::CmoAddrTaskLaunch( | |||
| 5872 | { | 5884 | { |
| 5873 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 5885 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 5874 | cmoAddrInfo, RT_ERROR_INVALID_VALUE, "Using the memory descriptor to operate the cache memory on the device"); | 5886 | cmoAddrInfo, RT_ERROR_INVALID_VALUE, "Using the memory descriptor to operate the cache memory on the device"); |
| 5875 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 5887 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 5876 | ((cmoOpCode < RT_CMO_PREFETCH) || (cmoOpCode >= RT_CMO_RESERVED)), RT_ERROR_INVALID_VALUE, | 5888 | ((cmoOpCode < RT_CMO_PREFETCH) || (cmoOpCode >= RT_CMO_RESERVED)), RT_ERROR_INVALID_VALUE, |
| 5877 | - "Using the memory descriptor to operate the cache memory on the device", cmoOpCode, | 5889 | + "Using the memory descriptor to operate the cache memory on the device", CmoOpCodeToString(cmoOpCode), |
| 5878 | - "[" + std::to_string(RT_CMO_PREFETCH) + ", " + std::to_string(RT_CMO_RESERVED) + ")"); | 5890 | + "cmoOpCode", "[" + std::to_string(RT_CMO_PREFETCH) + ", " + std::to_string(RT_CMO_RESERVED) + ")"); |
| 5879 | rtChipType_t chipType = Runtime::Instance()->GetChipType(); | 5891 | rtChipType_t chipType = Runtime::Instance()->GetChipType(); |
| 5880 | DevProperties devProperty{}; | 5892 | DevProperties devProperty{}; |
| 5881 | rtError_t error = GET_DEV_PROPERTIES(chipType, devProperty); | 5893 | rtError_t error = GET_DEV_PROPERTIES(chipType, devProperty); |
| @@ -5924,7 +5936,8 @@ rtError_t ApiErrorDecorator::MemcpyHostTask( | |||
| 5924 | const uint32_t devRunMode = curCtx->Device_()->Driver_()->GetRunMode(); | 5936 | const uint32_t devRunMode = curCtx->Device_()->Driver_()->GetRunMode(); |
| 5925 | if ((devRunMode != RT_RUN_MODE_ONLINE) || | 5937 | if ((devRunMode != RT_RUN_MODE_ONLINE) || |
| 5926 | ((kind != RT_MEMCPY_HOST_TO_DEVICE) && (kind != RT_MEMCPY_DEVICE_TO_HOST))) { | 5938 | ((kind != RT_MEMCPY_HOST_TO_DEVICE) && (kind != RT_MEMCPY_DEVICE_TO_HOST))) { |
| 5927 | - RT_LOG(RT_LOG_INFO, "unsupported MemcpyHostTask feature, kind = %d, run mode = %u", kind, devRunMode); | 5939 | + RT_LOG( |
| 5940 | + RT_LOG_INFO, "unsupported MemcpyHostTask feature, kind=%s, run mode=%u", MemcpyKindToStr(kind), devRunMode); | ||
| 5928 | return RT_ERROR_FEATURE_NOT_SUPPORT; | 5941 | return RT_ERROR_FEATURE_NOT_SUPPORT; |
| 5929 | } | 5942 | } |
| 5930 | return impl_->MemcpyHostTask(dst, destMax, src, cnt, kind, stm); | 5943 | return impl_->MemcpyHostTask(dst, destMax, src, cnt, kind, stm); |
| @@ -5932,10 +5945,9 @@ rtError_t ApiErrorDecorator::MemcpyHostTask( | |||
| 5932 | 5945 | ||
| 5933 | rtError_t ApiErrorDecorator::SetDeviceSatMode(const rtFloatOverflowMode_t floatOverflowMode) | 5946 | rtError_t ApiErrorDecorator::SetDeviceSatMode(const rtFloatOverflowMode_t floatOverflowMode) |
| 5934 | { | 5947 | { |
| 5935 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM( | 5948 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 5936 | (floatOverflowMode >= RT_OVERFLOW_MODE_UNDEF) || (floatOverflowMode < RT_OVERFLOW_MODE_SATURATION), | 5949 | (floatOverflowMode >= RT_OVERFLOW_MODE_UNDEF) || (floatOverflowMode < RT_OVERFLOW_MODE_SATURATION), |
| 5937 | - RT_ERROR_INVALID_VALUE, floatOverflowMode, | 5950 | + RT_ERROR_INVALID_VALUE, FloatOverflowModeToString(floatOverflowMode), "floatOverflowMode", "[0, 2)"); |
| 5938 | - "[" + std::to_string(RT_OVERFLOW_MODE_SATURATION) + ", " + std::to_string(RT_OVERFLOW_MODE_UNDEF) + ")"); | ||
| 5939 | return impl_->SetDeviceSatMode(floatOverflowMode); | 5951 | return impl_->SetDeviceSatMode(floatOverflowMode); |
| 5940 | } | 5952 | } |
| 5941 | 5953 | ||
| @@ -6100,9 +6112,9 @@ rtError_t ApiErrorDecorator::GetVisibleDeviceIdByLogicDeviceId( | |||
| 6100 | rtError_t ApiErrorDecorator::CtxSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) | 6112 | rtError_t ApiErrorDecorator::CtxSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) |
| 6101 | { | 6113 | { |
| 6102 | constexpr int64_t SYS_OPT_DETERMINISTIC_LEVEL_MAX = 4; | 6114 | constexpr int64_t SYS_OPT_DETERMINISTIC_LEVEL_MAX = 4; |
| 6103 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM( | 6115 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 6104 | - (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, configOpt, | 6116 | + (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, SysParamOptToString(configOpt), |
| 6105 | - RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); | 6117 | + "configOpt", RtFmtMsg("[0, %d)", static_cast<int32_t>(SYS_OPT_RESERVED))); |
| 6106 | const int64_t maxVal = | 6118 | const int64_t maxVal = |
| 6107 | (configOpt == SYS_OPT_DETERMINISTIC) ? SYS_OPT_DETERMINISTIC_LEVEL_MAX : static_cast<int64_t>(SYS_OPT_MAX); | 6119 | (configOpt == SYS_OPT_DETERMINISTIC) ? SYS_OPT_DETERMINISTIC_LEVEL_MAX : static_cast<int64_t>(SYS_OPT_MAX); |
| 6108 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM( | 6120 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM( |
| @@ -6113,9 +6125,9 @@ rtError_t ApiErrorDecorator::CtxSetSysParamOpt(const rtSysParamOpt configOpt, co | |||
| 6113 | 6125 | ||
| 6114 | rtError_t ApiErrorDecorator::CtxGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* const configVal) | 6126 | rtError_t ApiErrorDecorator::CtxGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* const configVal) |
| 6115 | { | 6127 | { |
| 6116 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6128 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6117 | (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, | 6129 | (configOpt >= SYS_OPT_RESERVED) || (configOpt < 0), RT_ERROR_INVALID_VALUE, |
| 6118 | - "Obtaining the system parameter value in the current context", configOpt, | 6130 | + "Obtaining the system parameter value in the current context", SysParamOptToString(configOpt), "configOpt", |
| 6119 | "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); | 6131 | "[0, " + std::to_string(SYS_OPT_RESERVED) + ")"); |
| 6120 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6132 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6121 | configVal, RT_ERROR_INVALID_VALUE, "Obtaining the system parameter value in the current context"); | 6133 | configVal, RT_ERROR_INVALID_VALUE, "Obtaining the system parameter value in the current context"); |
| @@ -6358,10 +6370,10 @@ rtError_t ApiErrorDecorator::ExportToShareableHandleV2( | |||
| 6358 | { | 6370 | { |
| 6359 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6371 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6360 | shareableHandle, RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server"); | 6372 | shareableHandle, RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server"); |
| 6361 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6373 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6362 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), | 6374 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), |
| 6363 | - RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server", handleType, | 6375 | + RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server", |
| 6364 | - std::to_string(RT_MEM_SHARE_HANDLE_TYPE_DEFAULT) + " or " + std::to_string(RT_MEM_SHARE_HANDLE_TYPE_FABRIC)); | 6376 | + RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(handleType)), "handleType", MEM_SHARED_HANDLE_TYPE_EXPECT_DESC); |
| 6365 | constexpr uint64_t maxFlag = RT_VMM_EXPORT_FLAG_DISABLE_PID_VALIDATION; | 6377 | constexpr uint64_t maxFlag = RT_VMM_EXPORT_FLAG_DISABLE_PID_VALIDATION; |
| 6366 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6378 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| 6367 | (flags > maxFlag), RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server", flags, | 6379 | (flags > maxFlag), RT_ERROR_INVALID_VALUE, "Exporting the shared handle of the AI server", flags, |
| @@ -6397,11 +6409,10 @@ rtError_t ApiErrorDecorator::ImportFromShareableHandleV2( | |||
| 6397 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6409 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6398 | handle, RT_ERROR_INVALID_VALUE, | 6410 | handle, RT_ERROR_INVALID_VALUE, |
| 6399 | "Obtaining shareableHandle information and returning the handle in the current process"); | 6411 | "Obtaining shareableHandle information and returning the handle in the current process"); |
| 6400 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6412 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6401 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), | 6413 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), |
| 6402 | RT_ERROR_INVALID_VALUE, "Obtaining shareableHandle information and returning the handle in the current process", | 6414 | RT_ERROR_INVALID_VALUE, "Obtaining shareableHandle information and returning the handle in the current process", |
| 6403 | - handleType, | 6415 | + RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(handleType)), "handleType", MEM_SHARED_HANDLE_TYPE_EXPECT_DESC); |
| 6404 | - std::to_string(RT_MEM_SHARE_HANDLE_TYPE_DEFAULT) + " or " + std::to_string(RT_MEM_SHARE_HANDLE_TYPE_FABRIC)); | ||
| 6405 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6416 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| 6406 | (flags != 0U), RT_ERROR_INVALID_VALUE, | 6417 | (flags != 0U), RT_ERROR_INVALID_VALUE, |
| 6407 | "Obtaining shareableHandle information and returning the handle in the current process", flags, "0"); | 6418 | "Obtaining shareableHandle information and returning the handle in the current process", flags, "0"); |
| @@ -6427,10 +6438,10 @@ rtError_t ApiErrorDecorator::SetPidToShareableHandleV2( | |||
| 6427 | { | 6438 | { |
| 6428 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6439 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6429 | shareableHandle, RT_ERROR_INVALID_VALUE, "Setting the trustlist of processes that can share memory"); | 6440 | shareableHandle, RT_ERROR_INVALID_VALUE, "Setting the trustlist of processes that can share memory"); |
| 6430 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6441 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6431 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), | 6442 | (handleType != RT_MEM_SHARE_HANDLE_TYPE_DEFAULT && handleType != RT_MEM_SHARE_HANDLE_TYPE_FABRIC), |
| 6432 | - RT_ERROR_INVALID_VALUE, "Setting the trustlist of processes that can share memory", handleType, | 6443 | + RT_ERROR_INVALID_VALUE, "Setting the trustlist of processes that can share memory", |
| 6433 | - std::to_string(RT_MEM_SHARE_HANDLE_TYPE_DEFAULT) + " or " + std::to_string(RT_MEM_SHARE_HANDLE_TYPE_FABRIC)); | 6444 | + RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(handleType)), "handleType", MEM_SHARED_HANDLE_TYPE_EXPECT_DESC); |
| 6434 | return impl_->SetPidToShareableHandleV2(shareableHandle, handleType, pid, pidNum); | 6445 | return impl_->SetPidToShareableHandleV2(shareableHandle, handleType, pid, pidNum); |
| 6435 | } | 6446 | } |
| 6436 | 6447 | ||
| @@ -6687,9 +6698,9 @@ rtError_t ApiErrorDecorator::GetDeviceStatus(const int32_t devId, rtDevStatus_t* | |||
| 6687 | 6698 | ||
| 6688 | rtError_t ApiErrorDecorator::SetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t value) | 6699 | rtError_t ApiErrorDecorator::SetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t value) |
| 6689 | { | 6700 | { |
| 6690 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6701 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6691 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, "Setting the device resource limit", | 6702 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, "Setting the device resource limit", |
| 6692 | - type, "[0, " + std::to_string(RT_DEV_RES_TYPE_MAX) + ")"); | 6703 | + DevResLimitTypeToString(type), "type", "[0, 2)"); |
| 6693 | uint32_t drvDevId = 0; | 6704 | uint32_t drvDevId = 0; |
| 6694 | rtError_t error = Runtime::Instance()->ChgUserDevIdToDeviceId(devId, &drvDevId); | 6705 | rtError_t error = Runtime::Instance()->ChgUserDevIdToDeviceId(devId, &drvDevId); |
| 6695 | COND_RETURN_ERROR( | 6706 | COND_RETURN_ERROR( |
| @@ -6716,10 +6727,9 @@ rtError_t ApiErrorDecorator::ResetDeviceResLimit(const uint32_t devId) | |||
| 6716 | 6727 | ||
| 6717 | rtError_t ApiErrorDecorator::GetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t* value) | 6728 | rtError_t ApiErrorDecorator::GetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t* value) |
| 6718 | { | 6729 | { |
| 6719 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6730 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6720 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, | 6731 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, |
| 6721 | - "Obtaining the device resource limits of the current process", type, | 6732 | + "Obtaining the device resource limits of the current process", DevResLimitTypeToString(type), "type", "[0, 2)"); |
| 6722 | - "[0, " + std::to_string(RT_DEV_RES_TYPE_MAX) + ")"); | ||
| 6723 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6733 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6724 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resource limits of the current process"); | 6734 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resource limits of the current process"); |
| 6725 | uint32_t drvDevId = 0; | 6735 | uint32_t drvDevId = 0; |
| @@ -6735,9 +6745,9 @@ rtError_t ApiErrorDecorator::GetDeviceResLimit(const uint32_t devId, const rtDev | |||
| 6735 | 6745 | ||
| 6736 | rtError_t ApiErrorDecorator::SetStreamResLimit(Stream* const stm, const rtDevResLimitType_t type, const uint32_t value) | 6746 | rtError_t ApiErrorDecorator::SetStreamResLimit(Stream* const stm, const rtDevResLimitType_t type, const uint32_t value) |
| 6737 | { | 6747 | { |
| 6738 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM( | 6748 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME( |
| 6739 | - static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, type, | 6749 | + static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, DevResLimitTypeToString(type), |
| 6740 | - "[0, " + std::to_string(RT_DEV_RES_TYPE_MAX) + ")"); | 6750 | + "type", "[0, 2)"); |
| 6741 | return impl_->SetStreamResLimit(stm, type, value); | 6751 | return impl_->SetStreamResLimit(stm, type, value); |
| 6742 | } | 6752 | } |
| 6743 | 6753 | ||
| @@ -6746,10 +6756,9 @@ rtError_t ApiErrorDecorator::ResetStreamResLimit(Stream* const stm) { return imp | |||
| 6746 | rtError_t ApiErrorDecorator::GetStreamResLimit( | 6756 | rtError_t ApiErrorDecorator::GetStreamResLimit( |
| 6747 | const Stream* const stm, const rtDevResLimitType_t type, uint32_t* const value) | 6757 | const Stream* const stm, const rtDevResLimitType_t type, uint32_t* const value) |
| 6748 | { | 6758 | { |
| 6749 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6759 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6750 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, | 6760 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, |
| 6751 | - "Obtaining the device resource limits of a specified stream", type, | 6761 | + "Obtaining the device resource limits of a specified stream", DevResLimitTypeToString(type), "type", "[0, 2)"); |
| 6752 | - "[0, " + std::to_string(RT_DEV_RES_TYPE_MAX) + ")"); | ||
| 6753 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6762 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6754 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resource limits of a specified stream"); | 6763 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resource limits of a specified stream"); |
| 6755 | return impl_->GetStreamResLimit(stm, type, value); | 6764 | return impl_->GetStreamResLimit(stm, type, value); |
| @@ -6767,10 +6776,10 @@ rtError_t ApiErrorDecorator::NotUseStreamResInCurrentThread(const Stream* const | |||
| 6767 | 6776 | ||
| 6768 | rtError_t ApiErrorDecorator::GetResInCurrentThread(const rtDevResLimitType_t type, uint32_t* const value) | 6777 | rtError_t ApiErrorDecorator::GetResInCurrentThread(const rtDevResLimitType_t type, uint32_t* const value) |
| 6769 | { | 6778 | { |
| 6770 | - COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 6779 | + COND_RETURN_AND_MSG_OUTER_WITH_PARAM_NAME_DESC( |
| 6771 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, | 6780 | static_cast<uint32_t>(type) >= RT_DEV_RES_TYPE_MAX, RT_ERROR_INVALID_VALUE, |
| 6772 | - "Obtaining the device resources that can be used by the current thread", type, | 6781 | + "Obtaining the device resources that can be used by the current thread", DevResLimitTypeToString(type), "type", |
| 6773 | - "[0, " + std::to_string(RT_DEV_RES_TYPE_MAX) + ")"); | 6782 | + "[0, 2)"); |
| 6774 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 6783 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 6775 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resources that can be used by the current thread"); | 6784 | value, RT_ERROR_INVALID_VALUE, "Obtaining the device resources that can be used by the current thread"); |
| 6776 | return impl_->GetResInCurrentThread(type, value); | 6785 | return impl_->GetResInCurrentThread(type, value); |
| @@ -8,6 +8,7 @@ | |||
| 8 | * See LICENSE in the root of the software repository for the full text of the License. | 8 | * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | + | ||
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | 14 | ||
| @@ -114,8 +115,8 @@ rtError_t ApiErrorDecorator::MemManagedPrefetchAsync( | |||
| 114 | const rtError_t error = impl_->MemManagedPrefetchAsync(ptr, size, location, flags, curStm); | 115 | const rtError_t error = impl_->MemManagedPrefetchAsync(ptr, size, location, flags, curStm); |
| 115 | COND_RETURN_ERROR( | 116 | COND_RETURN_ERROR( |
| 116 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, | 117 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, |
| 117 | - "Memory prefetch async failed, ret=%d, size=%u, loc_type=%u, loc_id=%d.", static_cast<int32_t>(error), size, | 118 | + "Memory prefetch async failed, ret=%d, size=%u, loc_type=%s, loc_id=%d.", static_cast<int32_t>(error), size, |
| 118 | - static_cast<uint32_t>(location.type), location.id); | 119 | + ManagedMemLocationTypeToString(location.type).c_str(), location.id); |
| 119 | return error; | 120 | return error; |
| 120 | } | 121 | } |
| 121 | 122 | ||
| @@ -195,8 +196,9 @@ rtError_t ApiErrorDecorator::MemManagedPrefetchBatchAsync( | |||
| 195 | ptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, curStm); | 196 | ptrs, sizes, count, prefetchLocs, prefetchLocIdxs, numPrefetchLocs, flags, curStm); |
| 196 | COND_RETURN_ERROR( | 197 | COND_RETURN_ERROR( |
| 197 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, | 198 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, |
| 198 | - "Memory prefetch batch async failed, ret=%d, sizes[0]=%u, loc[0].type=%u, loc[0].id=%d.", | 199 | + "Memory prefetch batch async failed, ret=%d, sizes[0]=%u, loc[0].type=%s, loc[0].id=%d.", |
| 199 | - static_cast<int32_t>(error), sizes[0], static_cast<uint32_t>(prefetchLocs[0].type), prefetchLocs[0].id); | 200 | + static_cast<int32_t>(error), sizes[0], ManagedMemLocationTypeToString(prefetchLocs[0].type).c_str(), |
| 201 | + prefetchLocs[0].id); | ||
| 200 | return error; | 202 | return error; |
| 201 | } | 203 | } |
| 202 | 204 | ||
| @@ -56,6 +56,7 @@ | |||
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | 58 | ||
| 59 | + | ||
| 59 | 60 | ||
| 60 | 61 | ||
| 61 | 62 | ||
| @@ -76,6 +77,7 @@ | |||
| 76 | 77 | ||
| 77 | 78 | ||
| 78 | 79 | ||
| 80 | + | ||
| 79 | 81 | ||
| 80 | 82 | ||
| 81 | 83 | ||
| @@ -105,6 +107,7 @@ using DevInfo = struct { | |||
| 105 | namespace { | 107 | namespace { |
| 106 | constexpr uint32_t MEM_POLICY_MASK = 0xFFU; | 108 | constexpr uint32_t MEM_POLICY_MASK = 0xFFU; |
| 107 | constexpr uint32_t MEM_TYPE_MASK = 0xFF00U; | 109 | constexpr uint32_t MEM_TYPE_MASK = 0xFF00U; |
| 110 | +constexpr char_t MALLOC_ATTR_MODULE_ID_EXPECT_DESC[] = "MEM_MALLOC_ATTR_MODULE_ID(1)"; | ||
| 108 | 111 | ||
| 109 | void ResetKernelArgsParamHandles(RtArgsHandle* argsHandle, uint32_t paramCount) | 112 | void ResetKernelArgsParamHandles(RtArgsHandle* argsHandle, uint32_t paramCount) |
| 110 | { | 113 | { |
| @@ -392,9 +395,9 @@ rtError_t ApiImpl::FunctionRegister( | |||
| 392 | const uint32_t funcMode) | 395 | const uint32_t funcMode) |
| 393 | { | 396 | { |
| 394 | RT_LOG( | 397 | RT_LOG( |
| 395 | - RT_LOG_DEBUG, "register function, type=%d, stubFunc=%p, funcMode=%u, funcName=%s, kernelInfoExt=%s.", | 398 | + RT_LOG_DEBUG, "register function, type=%s, stubFunc=%p, funcMode=%u, funcName=%s, kernelInfoExt=%s.", |
| 396 | - prog->GetDefaultKernelAttrType(), stubFunc, funcMode, (stubName != nullptr) ? stubName : "(none)", | 399 | + KernelAttrTypeToString(prog->GetDefaultKernelAttrType()).c_str(), stubFunc, funcMode, |
| 397 | - kernelInfoExt); | 400 | + (stubName != nullptr) ? stubName : "(none)", kernelInfoExt); |
| 398 | return Runtime::Instance()->KernelRegister(prog, stubFunc, stubName, kernelInfoExt, funcMode); | 401 | return Runtime::Instance()->KernelRegister(prog, stubFunc, stubName, kernelInfoExt, funcMode); |
| 399 | } | 402 | } |
| 400 | 403 | ||
| @@ -2416,7 +2419,7 @@ rtError_t ApiImpl::DevDvppFree(void* const devPtr) | |||
| 2416 | static_cast<uint32_t>(error)); | 2419 | static_cast<uint32_t>(error)); |
| 2417 | COND_RETURN_AND_MSG_OUTER( | 2420 | COND_RETURN_AND_MSG_OUTER( |
| 2418 | locationType != RT_MEMORY_LOC_DEVICE && locationType != RT_MEMORY_LOC_MANAGED, RT_ERROR_INVALID_VALUE, | 2421 | locationType != RT_MEMORY_LOC_DEVICE && locationType != RT_MEMORY_LOC_MANAGED, RT_ERROR_INVALID_VALUE, |
| 2419 | - ErrorCode::EE1011, "Releasing DVPP device memory", MemLocationTypeToStr(locationType), "devPtr locationType", | 2422 | + ErrorCode::EE1011, "Releasing DVPP device memory", MemLocationTypeToString(locationType), "devPtr locationType", |
| 2420 | "The specified address must be a device address"); | 2423 | "The specified address must be a device address"); |
| 2421 | 2424 | ||
| 2422 | 2425 | ||
| @@ -2458,9 +2461,9 @@ rtError_t ApiImpl::GetMallocHostConfigAttr(rtMallocAttribute_t* attr, uint16_t* | |||
| 2458 | } | 2461 | } |
| 2459 | 2462 | ||
| 2460 | // 申请内存的接口不支持传入其他类型cfg | 2463 | // 申请内存的接口不支持传入其他类型cfg |
| 2461 | - RT_LOG_OUTER_MSG_INVALID_PARAM_WITH_DESC( | 2464 | + RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 2462 | - "Obtaining the configuration attributes of the memory allocated on the host", attr->attr, | 2465 | + ErrorCode::EE1003, "Obtaining the configuration attributes of the memory allocated on the host", |
| 2463 | - RT_MEM_MALLOC_ATTR_MODULE_ID); | 2466 | + MallocAttrToString(attr->attr), "attr->attr", MALLOC_ATTR_MODULE_ID_EXPECT_DESC); |
| 2464 | return RT_ERROR_INVALID_VALUE; | 2467 | return RT_ERROR_INVALID_VALUE; |
| 2465 | } | 2468 | } |
| 2466 | 2469 | ||
| @@ -2528,7 +2531,7 @@ rtError_t ApiImpl::HostFree(void* const hostPtr) | |||
| 2528 | static_cast<uint32_t>(error)); | 2531 | static_cast<uint32_t>(error)); |
| 2529 | COND_RETURN_AND_MSG_OUTER( | 2532 | COND_RETURN_AND_MSG_OUTER( |
| 2530 | locationType != RT_MEMORY_LOC_HOST && locationType != RT_MEMORY_LOC_UNREGISTERED, RT_ERROR_INVALID_VALUE, | 2533 | locationType != RT_MEMORY_LOC_HOST && locationType != RT_MEMORY_LOC_UNREGISTERED, RT_ERROR_INVALID_VALUE, |
| 2531 | - ErrorCode::EE1011, "Host memory release", MemLocationTypeToStr(locationType), "hostPtr locationType", | 2534 | + ErrorCode::EE1011, "Host memory release", MemLocationTypeToString(locationType), "hostPtr locationType", |
| 2532 | "The specified address must be a host address"); | 2535 | "The specified address must be a host address"); |
| 2533 | 2536 | ||
| 2534 | 2537 | ||
| @@ -2716,7 +2719,7 @@ rtError_t ApiImpl::MemCopySync( | |||
| 2716 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind, | 2719 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind, |
| 2717 | const uint32_t checkKind) | 2720 | const uint32_t checkKind) |
| 2718 | { | 2721 | { |
| 2719 | - RT_LOG(RT_LOG_DEBUG, "memcpy sync, cnt=%" PRIu64 ", kind=%d.", cnt, kind); | 2722 | + RT_LOG(RT_LOG_DEBUG, "memcpy sync, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToStr(kind)); |
| 2720 | Context* const curCtx = CurrentContext(); | 2723 | Context* const curCtx = CurrentContext(); |
| 2721 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 2724 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 2722 | Device* device = curCtx->Device_(); | 2725 | Device* device = curCtx->Device_(); |
| @@ -2746,7 +2749,7 @@ rtError_t ApiImpl::MemCopySync( | |||
| 2746 | rtError_t ApiImpl::MemCopySyncEx( | 2749 | rtError_t ApiImpl::MemCopySyncEx( |
| 2747 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind) | 2750 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind) |
| 2748 | { | 2751 | { |
| 2749 | - RT_LOG(RT_LOG_DEBUG, "memcpy sync, cnt=%" PRIu64 ", kind=%d.", cnt, kind); | 2752 | + RT_LOG(RT_LOG_DEBUG, "memcpy sync, cnt=%" PRIu64 ", kind=%s.", cnt, MemcpyKindToStr(kind)); |
| 2750 | Context* const curCtx = CurrentContext(); | 2753 | Context* const curCtx = CurrentContext(); |
| 2751 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 2754 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 2752 | Device* device = curCtx->Device_(); | 2755 | Device* device = curCtx->Device_(); |
| @@ -2839,7 +2842,7 @@ rtError_t ApiImpl::MemcpyAsync( | |||
| 2839 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo, const rtD2DAddrCfgInfo_t* const addrCfg, bool checkKind, | 2842 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo, const rtD2DAddrCfgInfo_t* const addrCfg, bool checkKind, |
| 2840 | const rtMemcpyConfig_t* const memcpyConfig) | 2843 | const rtMemcpyConfig_t* const memcpyConfig) |
| 2841 | { | 2844 | { |
| 2842 | - RT_LOG(RT_LOG_DEBUG, "async memcpy, count=%" PRIu64 ", kind=%d", cnt, kind); | 2845 | + RT_LOG(RT_LOG_DEBUG, "async memcpy, count=%" PRIu64 ", kind=%s", cnt, MemcpyKindToStr(kind)); |
| 2843 | UNUSED(memcpyConfig); | 2846 | UNUSED(memcpyConfig); |
| 2844 | Context* const curCtx = CurrentContext(); | 2847 | Context* const curCtx = CurrentContext(); |
| 2845 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 2848 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| @@ -3119,7 +3122,7 @@ rtError_t ApiImpl::ReduceAsync( | |||
| 3119 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, | 3122 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, |
| 3120 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo) | 3123 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo) |
| 3121 | { | 3124 | { |
| 3122 | - RT_LOG(RT_LOG_INFO, "ReduceAsync, count=%" PRIu64 ", kind=%d.", cnt, kind); | 3125 | + RT_LOG(RT_LOG_INFO, "ReduceAsync, count=%" PRIu64 ", kind=%s.", cnt, ReduceKindToString(kind).c_str()); |
| 3123 | Context* const curCtx = CurrentContext(); | 3126 | Context* const curCtx = CurrentContext(); |
| 3124 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 3127 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 3125 | 3128 | ||
| @@ -3137,7 +3140,7 @@ rtError_t ApiImpl::ReduceAsyncV2( | |||
| 3137 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, | 3140 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, |
| 3138 | Stream* const stm, void* const overflowAddr) | 3141 | Stream* const stm, void* const overflowAddr) |
| 3139 | { | 3142 | { |
| 3140 | - RT_LOG(RT_LOG_INFO, "ReduceAsyncV2, count=%" PRIu64 ", kind=%d.", cnt, kind); | 3143 | + RT_LOG(RT_LOG_INFO, "ReduceAsyncV2, count=%" PRIu64 ", kind=%s.", cnt, ReduceKindToString(kind).c_str()); |
| 3141 | Context* const curCtx = CurrentContext(); | 3144 | Context* const curCtx = CurrentContext(); |
| 3142 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 3145 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 3143 | 3146 | ||
| @@ -3253,7 +3256,9 @@ rtError_t ApiImpl::GetMemUsageInfo( | |||
| 3253 | 3256 | ||
| 3254 | rtError_t ApiImpl::MemGetInfoEx(const rtMemInfoType_t memInfoType, size_t* const freeSize, size_t* const totalSize) | 3257 | rtError_t ApiImpl::MemGetInfoEx(const rtMemInfoType_t memInfoType, size_t* const freeSize, size_t* const totalSize) |
| 3255 | { | 3258 | { |
| 3256 | - RT_LOG(RT_LOG_DEBUG, "mem get info memInfoType=%u, free=%zu, total=%zu.", memInfoType, *freeSize, *totalSize); | 3259 | + RT_LOG( |
| 3260 | + RT_LOG_DEBUG, "mem get info memInfoType=%s, free=%zu, total=%zu.", MemInfoTypeToString(memInfoType).c_str(), | ||
| 3261 | + *freeSize, *totalSize); | ||
| 3257 | Context* const curCtx = CurrentContext(); | 3262 | Context* const curCtx = CurrentContext(); |
| 3258 | NULL_PTR_RETURN_MSG(curCtx, RT_ERROR_CONTEXT_NULL); | 3263 | NULL_PTR_RETURN_MSG(curCtx, RT_ERROR_CONTEXT_NULL); |
| 3259 | 3264 | ||
| @@ -3734,12 +3739,13 @@ rtError_t ApiImpl::DeviceReset(const int32_t devId, const bool isForceReset) | |||
| 3734 | 3739 | ||
| 3735 | rtError_t ApiImpl::DeviceSetLimit(const int32_t devId, const rtLimitType_t type, const uint32_t val) | 3740 | rtError_t ApiImpl::DeviceSetLimit(const int32_t devId, const rtLimitType_t type, const uint32_t val) |
| 3736 | { | 3741 | { |
| 3737 | - RT_LOG(RT_LOG_INFO, "Set Limit, drv devId=%d, type=%d, value=%u.", devId, type, val); | 3742 | + RT_LOG(RT_LOG_INFO, "Set Limit, drv devId=%d, type=%s, value=%u.", devId, LimitTypeToString(type).c_str(), val); |
| 3738 | (void)devId; | 3743 | (void)devId; |
| 3739 | if (type == RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE || type == RT_LIMIT_TYPE_SIMT_STACK_SIZE || | 3744 | if (type == RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE || type == RT_LIMIT_TYPE_SIMT_STACK_SIZE || |
| 3740 | type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { | 3745 | type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { |
| 3741 | RT_LOG( | 3746 | RT_LOG( |
| 3742 | - RT_LOG_WARNING, "SIMT limit type is not supported on this platform, type=%u", static_cast<uint32_t>(type)); | 3747 | + RT_LOG_WARNING, "SIMT limit type is not supported on this platform, type=%s", |
| 3748 | + LimitTypeToString(type).c_str()); | ||
| 3743 | return RT_ERROR_FEATURE_NOT_SUPPORT; | 3749 | return RT_ERROR_FEATURE_NOT_SUPPORT; |
| 3744 | } | 3750 | } |
| 3745 | rtError_t ret = RT_ERROR_NONE; | 3751 | rtError_t ret = RT_ERROR_NONE; |
| @@ -3761,7 +3767,7 @@ rtError_t ApiImpl::DeviceSetLimit(const int32_t devId, const rtLimitType_t type, | |||
| 3761 | 3767 | ||
| 3762 | rtError_t ApiImpl::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) | 3768 | rtError_t ApiImpl::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) |
| 3763 | { | 3769 | { |
| 3764 | - RT_LOG(RT_LOG_INFO, "Get Limit, type=%d.", static_cast<int32_t>(type)); | 3770 | + RT_LOG(RT_LOG_INFO, "Get Limit, type=%s.", LimitTypeToString(type).c_str()); |
| 3765 | rtError_t ret = RT_ERROR_NONE; | 3771 | rtError_t ret = RT_ERROR_NONE; |
| 3766 | if (type == RT_LIMIT_TYPE_STACK_SIZE) { | 3772 | if (type == RT_LIMIT_TYPE_STACK_SIZE) { |
| 3767 | Runtime* rt = Runtime::Instance(); | 3773 | Runtime* rt = Runtime::Instance(); |
| @@ -3770,7 +3776,8 @@ rtError_t ApiImpl::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) | |||
| 3770 | type == RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE || type == RT_LIMIT_TYPE_SIMT_STACK_SIZE || | 3776 | type == RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE || type == RT_LIMIT_TYPE_SIMT_STACK_SIZE || |
| 3771 | type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { | 3777 | type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { |
| 3772 | RT_LOG( | 3778 | RT_LOG( |
| 3773 | - RT_LOG_WARNING, "SIMT limit type is not supported on this platform, type=%u", static_cast<uint32_t>(type)); | 3779 | + RT_LOG_WARNING, "SIMT limit type is not supported on this platform, type=%s", |
| 3780 | + LimitTypeToString(type).c_str()); | ||
| 3774 | return RT_ERROR_FEATURE_NOT_SUPPORT; | 3781 | return RT_ERROR_FEATURE_NOT_SUPPORT; |
| 3775 | } else if (type == RT_LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE) { | 3782 | } else if (type == RT_LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE) { |
| 3776 | Runtime* rt = Runtime::Instance(); | 3783 | Runtime* rt = Runtime::Instance(); |
| @@ -3778,11 +3785,11 @@ rtError_t ApiImpl::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) | |||
| 3778 | *val = rt->GetSimdPrintFifoSize(); | 3785 | *val = rt->GetSimdPrintFifoSize(); |
| 3779 | } else { | 3786 | } else { |
| 3780 | RT_LOG( | 3787 | RT_LOG( |
| 3781 | - RT_LOG_WARNING, "Limit type not supported on this platform, type=%u, returning default 0.", | 3788 | + RT_LOG_WARNING, "Limit type not supported on this platform, type=%s, returning default 0.", |
| 3782 | - static_cast<uint32_t>(type)); | 3789 | + LimitTypeToString(type).c_str()); |
| 3783 | *val = 0U; | 3790 | *val = 0U; |
| 3784 | } | 3791 | } |
| 3785 | - RT_LOG(RT_LOG_INFO, "DeviceGetLimit success, type=%d, val=%u.", static_cast<int32_t>(type), *val); | 3792 | + RT_LOG(RT_LOG_INFO, "DeviceGetLimit success, type=%s, val=%u.", LimitTypeToString(type).c_str(), *val); |
| 3786 | return ret; | 3793 | return ret; |
| 3787 | } | 3794 | } |
| 3788 | 3795 | ||
| @@ -3915,7 +3922,7 @@ rtError_t ApiImpl::GetDeviceSimtInfo(rtDevAttr attr, int64_t* val) | |||
| 3915 | break; | 3922 | break; |
| 3916 | default: | 3923 | default: |
| 3917 | error = RT_ERROR_INVALID_VALUE; | 3924 | error = RT_ERROR_INVALID_VALUE; |
| 3918 | - RT_LOG_OUTER_MSG_INVALID_PARAM(attr, "[RT_DEV_ATTR_WARP_SIZE, RT_DEV_ATTR_MAX_BLOCK_DIM_Z]"); | 3925 | + RT_LOG_OUTER_MSG_WITH_FUNC(ErrorCode::EE1003, DevAttrToString(attr), "attr", "[202, 212]"); |
| 3919 | break; | 3926 | break; |
| 3920 | } | 3927 | } |
| 3921 | 3928 | ||
| @@ -4964,7 +4971,9 @@ rtError_t ApiImpl::StreamSwitchEx( | |||
| 4964 | void* const ptr, const rtCondition_t condition, void* const valuePtr, Stream* const trueStream, Stream* const stm, | 4971 | void* const ptr, const rtCondition_t condition, void* const valuePtr, Stream* const trueStream, Stream* const stm, |
| 4965 | const rtSwitchDataType_t dataType) | 4972 | const rtSwitchDataType_t dataType) |
| 4966 | { | 4973 | { |
| 4967 | - RT_LOG(RT_LOG_DEBUG, "Switch, condition=%d, dataType=%d.", condition, dataType); | 4974 | + RT_LOG( |
| 4975 | + RT_LOG_DEBUG, "Switch, condition=%s, dataType=%s.", ConditionToString(condition).c_str(), | ||
| 4976 | + SwitchDataTypeToString(dataType).c_str()); | ||
| 4968 | COND_RETURN_AND_MSG_OUTER( | 4977 | COND_RETURN_AND_MSG_OUTER( |
| 4969 | !trueStream->IsModelStream(), RT_ERROR_STREAM_MODEL, ErrorCode::EE1011, | 4978 | !trueStream->IsModelStream(), RT_ERROR_STREAM_MODEL, ErrorCode::EE1011, |
| 4970 | "Switching between streams based on conditions", 0, "trueStream->modelNum", | 4979 | "Switching between streams based on conditions", 0, "trueStream->modelNum", |
| @@ -4984,7 +4993,9 @@ rtError_t ApiImpl::StreamSwitchN( | |||
| 4984 | void* const ptr, const uint32_t size, void* const valuePtr, Stream** const trueStreamPtr, | 4993 | void* const ptr, const uint32_t size, void* const valuePtr, Stream** const trueStreamPtr, |
| 4985 | const uint32_t elementSize, Stream* const stm, const rtSwitchDataType_t dataType) | 4994 | const uint32_t elementSize, Stream* const stm, const rtSwitchDataType_t dataType) |
| 4986 | { | 4995 | { |
| 4987 | - RT_LOG(RT_LOG_DEBUG, "SwitchN, size=%u, elementSize=%u, dataType=%d.", size, elementSize, dataType); | 4996 | + RT_LOG( |
| 4997 | + RT_LOG_DEBUG, "SwitchN, size=%u, elementSize=%u, dataType=%s.", size, elementSize, | ||
| 4998 | + SwitchDataTypeToString(dataType).c_str()); | ||
| 4988 | Context* const curCtx = CurrentContext(); | 4999 | Context* const curCtx = CurrentContext(); |
| 4989 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 5000 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 4990 | 5001 | ||
| @@ -6686,8 +6697,8 @@ rtError_t ApiImpl::MemCopy2DSync( | |||
| 6686 | (void)newKind; | 6697 | (void)newKind; |
| 6687 | RT_LOG( | 6698 | RT_LOG( |
| 6688 | RT_LOG_DEBUG, | 6699 | RT_LOG_DEBUG, |
| 6689 | - "sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%d.", | 6700 | + "sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%s.", |
| 6690 | - dstPitch, srcPitch, width, height, kind); | 6701 | + dstPitch, srcPitch, width, height, MemcpyKindToStr(kind)); |
| 6691 | Context* const curCtx = CurrentContext(); | 6702 | Context* const curCtx = CurrentContext(); |
| 6692 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 6703 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 6693 | 6704 | ||
| @@ -6708,8 +6719,8 @@ rtError_t ApiImpl::MemCopy2DAsync( | |||
| 6708 | (void)newKind; | 6719 | (void)newKind; |
| 6709 | RT_LOG( | 6720 | RT_LOG( |
| 6710 | RT_LOG_DEBUG, | 6721 | RT_LOG_DEBUG, |
| 6711 | - "sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%d.", | 6722 | + "sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%s.", |
| 6712 | - dstPitch, srcPitch, width, height, kind); | 6723 | + dstPitch, srcPitch, width, height, MemcpyKindToStr(kind)); |
| 6713 | rtError_t error = RT_ERROR_NONE; | 6724 | rtError_t error = RT_ERROR_NONE; |
| 6714 | uint64_t remainSize = width * height; | 6725 | uint64_t remainSize = width * height; |
| 6715 | uint64_t realSize = 0UL; | 6726 | uint64_t realSize = 0UL; |
| @@ -6749,7 +6760,7 @@ rtError_t ApiImpl::MemcpyHostTask( | |||
| 6749 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind, | 6760 | void* const dst, const uint64_t destMax, const void* const src, const uint64_t cnt, const rtMemcpyKind_t kind, |
| 6750 | Stream* const stm) | 6761 | Stream* const stm) |
| 6751 | { | 6762 | { |
| 6752 | - RT_LOG(RT_LOG_INFO, "memCopy for host task, kind=%d.", kind); | 6763 | + RT_LOG(RT_LOG_INFO, "memCopy for host task, kind=%s.", MemcpyKindToStr(kind)); |
| 6753 | Context* const curCtx = CurrentContext(); | 6764 | Context* const curCtx = CurrentContext(); |
| 6754 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 6765 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 6755 | CHECK_CAPTURE_MODE_SUPPORT_AND_RETURN_WITH_DESC(curCtx, "Delivering a memory copy task on the host"); | 6766 | CHECK_CAPTURE_MODE_SUPPORT_AND_RETURN_WITH_DESC(curCtx, "Delivering a memory copy task on the host"); |
| @@ -6800,7 +6811,9 @@ rtError_t ApiImpl::CmoTaskLaunch(const rtCmoTaskInfo_t* const taskInfo, Stream* | |||
| 6800 | rtError_t ApiImpl::CmoAddrTaskLaunch( | 6811 | rtError_t ApiImpl::CmoAddrTaskLaunch( |
| 6801 | void* cmoAddrInfo, const uint64_t destMax, const rtCmoOpCode_t cmoOpCode, Stream* const stm, const uint32_t flag) | 6812 | void* cmoAddrInfo, const uint64_t destMax, const rtCmoOpCode_t cmoOpCode, Stream* const stm, const uint32_t flag) |
| 6802 | { | 6813 | { |
| 6803 | - RT_LOG(RT_LOG_DEBUG, "CmoAddr Task launch. opCode=%d, destMax is %" PRIu64 "(bytes)", cmoOpCode, destMax); | 6814 | + RT_LOG( |
| 6815 | + RT_LOG_DEBUG, "CmoAddr Task launch. opCode=%s, destMax is %" PRIu64 "(bytes)", | ||
| 6816 | + CmoOpCodeToString(cmoOpCode).c_str(), destMax); | ||
| 6804 | Context* const curCtx = CurrentContext(); | 6817 | Context* const curCtx = CurrentContext(); |
| 6805 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 6818 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 6806 | 6819 | ||
| @@ -6835,10 +6848,12 @@ rtError_t ApiImpl::SetDeviceSatMode(const rtFloatOverflowMode_t floatOverflowMod | |||
| 6835 | const bool isValidFlag = ContextManage::CheckContextIsValid((curCtx)); | 6848 | const bool isValidFlag = ContextManage::CheckContextIsValid((curCtx)); |
| 6836 | if (isValidFlag) { | 6849 | if (isValidFlag) { |
| 6837 | curCtx->Device_()->SetSatMode(floatOverflowMode); | 6850 | curCtx->Device_()->SetSatMode(floatOverflowMode); |
| 6838 | - RT_LOG(RT_LOG_INFO, "Set saturation mode to %u for device %u", floatOverflowMode, curCtx->Device_()->Id_()); | 6851 | + RT_LOG( |
| 6852 | + RT_LOG_INFO, "Set saturation mode to %s for device %u", FloatOverflowModeToString(floatOverflowMode), | ||
| 6853 | + curCtx->Device_()->Id_()); | ||
| 6839 | } | 6854 | } |
| 6840 | Runtime::Instance()->SetSatMode(floatOverflowMode); | 6855 | Runtime::Instance()->SetSatMode(floatOverflowMode); |
| 6841 | - RT_LOG(RT_LOG_INFO, "Set saturation mode to %u for runtime process.", floatOverflowMode); | 6856 | + RT_LOG(RT_LOG_INFO, "Set saturation mode to %s for runtime process.", FloatOverflowModeToString(floatOverflowMode)); |
| 6842 | return RT_ERROR_NONE; | 6857 | return RT_ERROR_NONE; |
| 6843 | } | 6858 | } |
| 6844 | 6859 | ||
| @@ -6964,10 +6979,12 @@ rtError_t ApiImpl::GetVisibleDeviceIdByLogicDeviceId(const int32_t logicDeviceId | |||
| 6964 | rtError_t ApiImpl::CtxSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) | 6979 | rtError_t ApiImpl::CtxSetSysParamOpt(const rtSysParamOpt configOpt, const int64_t configVal) |
| 6965 | { | 6980 | { |
| 6966 | rtError_t error = RT_ERROR_NONE; | 6981 | rtError_t error = RT_ERROR_NONE; |
| 6967 | - RT_LOG(RT_LOG_DEBUG, "Start to set sys param opt, opt=%d.", configOpt); | 6982 | + RT_LOG(RT_LOG_DEBUG, "Start to set sys param opt, opt=%s.", SysParamOptToString(configOpt).c_str()); |
| 6968 | Context* const curCtx = CurrentContext(); | 6983 | Context* const curCtx = CurrentContext(); |
| 6969 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 6984 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 6970 | - RT_LOG(RT_LOG_INFO, "curCtx = %p, configOpt=%d, configVal=%lld.", curCtx, configOpt, configVal); | 6985 | + RT_LOG( |
| 6986 | + RT_LOG_INFO, "curCtx = %p, configOpt=%s, configVal=%lld.", curCtx, SysParamOptToString(configOpt).c_str(), | ||
| 6987 | + configVal); | ||
| 6971 | 6988 | ||
| 6972 | error = curCtx->CtxSetSysParamOpt(configOpt, configVal); | 6989 | error = curCtx->CtxSetSysParamOpt(configOpt, configVal); |
| 6973 | ERROR_RETURN(error, "Set sys param opt failed, retCode=%#x.", error); | 6990 | ERROR_RETURN(error, "Set sys param opt failed, retCode=%#x.", error); |
| @@ -6980,7 +6997,9 @@ rtError_t ApiImpl::CtxGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* con | |||
| 6980 | Context* const curCtx = CurrentContext(); | 6997 | Context* const curCtx = CurrentContext(); |
| 6981 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 6998 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 6982 | const rtError_t ret = curCtx->CtxGetSysParamOpt(configOpt, configVal); | 6999 | const rtError_t ret = curCtx->CtxGetSysParamOpt(configOpt, configVal); |
| 6983 | - RT_LOG(RT_LOG_INFO, "ret=%#x, curCtx = %p, configOpt=%d, *configVal=%lld.", ret, curCtx, configOpt, (*configVal)); | 7000 | + RT_LOG( |
| 7001 | + RT_LOG_INFO, "ret=%#x, curCtx = %p, configOpt=%s, *configVal=%lld.", ret, curCtx, | ||
| 7002 | + SysParamOptToString(configOpt).c_str(), (*configVal)); | ||
| 6984 | return ret; | 7003 | return ret; |
| 6985 | } | 7004 | } |
| 6986 | 7005 | ||
| @@ -7266,8 +7285,8 @@ rtError_t ApiImpl::ExportToShareableHandle( | |||
| 7266 | error = NpuDriver::SetMemShareHandleDisablePidVerify(*shareableHandle); | 7285 | error = NpuDriver::SetMemShareHandleDisablePidVerify(*shareableHandle); |
| 7267 | } | 7286 | } |
| 7268 | RT_LOG( | 7287 | RT_LOG( |
| 7269 | - RT_LOG_INFO, "handleType=%d, flags=%#" PRIx64 ", shareableHandle=%" PRIu64 ".", handleType, flags, | 7288 | + RT_LOG_INFO, "handleType=%s, flags=%#" PRIx64 ", shareableHandle=%" PRIu64 ".", |
| 7270 | - *shareableHandle); | 7289 | + DrvMemHandleTypeToString(handleType), flags, *shareableHandle); |
| 7271 | return error; | 7290 | return error; |
| 7272 | } | 7291 | } |
| 7273 | 7292 | ||
| @@ -7297,7 +7316,7 @@ rtError_t ApiImpl::ExportToShareableHandleV2( | |||
| 7297 | COND_RETURN_WITH_NOLOG(error != RT_ERROR_NONE, error); | 7316 | COND_RETURN_WITH_NOLOG(error != RT_ERROR_NONE, error); |
| 7298 | error = NpuDriver::SetMemShareHandleDisablePidVerify(shareableHandleU64); | 7317 | error = NpuDriver::SetMemShareHandleDisablePidVerify(shareableHandleU64); |
| 7299 | } | 7318 | } |
| 7300 | - RT_LOG(RT_LOG_INFO, "handleType=%d, flags=%#" PRIu64 "", handleType, flags); | 7319 | + RT_LOG(RT_LOG_INFO, "handleType=%s, flags=%#" PRIu64 "", MemSharedHandleTypeToString(handleType), flags); |
| 7301 | return error; | 7320 | return error; |
| 7302 | } | 7321 | } |
| 7303 | 7322 | ||
| @@ -7380,7 +7399,7 @@ rtError_t ApiImpl::SetPidToShareableHandleV2( | |||
| 7380 | error = NpuDriver::GetServerIdAndshareableHandle(handleType, shareableHandle, &serverId, &shareableHandleU64); | 7399 | error = NpuDriver::GetServerIdAndshareableHandle(handleType, shareableHandle, &serverId, &shareableHandleU64); |
| 7381 | COND_RETURN_WITH_NOLOG(error != RT_ERROR_NONE, error); | 7400 | COND_RETURN_WITH_NOLOG(error != RT_ERROR_NONE, error); |
| 7382 | error = NpuDriver::SetPidToShareableHandle(shareableHandleU64, pid, pidNum); | 7401 | error = NpuDriver::SetPidToShareableHandle(shareableHandleU64, pid, pidNum); |
| 7383 | - RT_LOG(RT_LOG_DEBUG, "handleType = %d pidNum = %d.", handleType, pidNum); | 7402 | + RT_LOG(RT_LOG_DEBUG, "handleType = %s pidNum = %d.", MemSharedHandleTypeToString(handleType), pidNum); |
| 7384 | return error; | 7403 | return error; |
| 7385 | } | 7404 | } |
| 7386 | 7405 | ||
| @@ -7621,7 +7640,7 @@ rtError_t ApiImpl::GetLastErr(rtLastErrLevel_t level) | |||
| 7621 | } else { | 7640 | } else { |
| 7622 | // do nothing | 7641 | // do nothing |
| 7623 | } | 7642 | } |
| 7624 | - RT_LOG(RT_LOG_EVENT, "level=%d err=%d.", level, ret); | 7643 | + RT_LOG(RT_LOG_EVENT, "level=%s err=%d.", LastErrLevelToString(level).c_str(), ret); |
| 7625 | return ret; | 7644 | return ret; |
| 7626 | } | 7645 | } |
| 7627 | 7646 | ||
| @@ -7637,7 +7656,7 @@ rtError_t ApiImpl::PeekLastErr(rtLastErrLevel_t level) | |||
| 7637 | } else { | 7656 | } else { |
| 7638 | // do nothing | 7657 | // do nothing |
| 7639 | } | 7658 | } |
| 7640 | - RT_LOG(RT_LOG_EVENT, "level=%d err=%u.", level, ret); | 7659 | + RT_LOG(RT_LOG_EVENT, "level=%s err=%u.", LastErrLevelToString(level).c_str(), ret); |
| 7641 | return ret; | 7660 | return ret; |
| 7642 | } | 7661 | } |
| 7643 | 7662 | ||
| @@ -7669,7 +7688,7 @@ static rtError_t UpdatePlatformRes( | |||
| 7669 | res["vector_core_cnt"] = std::to_string(value); | 7688 | res["vector_core_cnt"] = std::to_string(value); |
| 7670 | break; | 7689 | break; |
| 7671 | default: | 7690 | default: |
| 7672 | - RT_LOG(RT_LOG_ERROR, "Unsupported resource type: %d", type); | 7691 | + RT_LOG(RT_LOG_ERROR, "Unsupported resource type: %s", DevResLimitTypeToString(type)); |
| 7673 | return RT_ERROR_INVALID_VALUE; | 7692 | return RT_ERROR_INVALID_VALUE; |
| 7674 | } | 7693 | } |
| 7675 | 7694 | ||
| @@ -7714,7 +7733,7 @@ static rtError_t SetDeviceResLimitByFe(const uint32_t devId, const rtDevResLimit | |||
| 7714 | 7733 | ||
| 7715 | rtError_t ApiImpl::SetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t value) | 7734 | rtError_t ApiImpl::SetDeviceResLimit(const uint32_t devId, const rtDevResLimitType_t type, uint32_t value) |
| 7716 | { | 7735 | { |
| 7717 | - RT_LOG(RT_LOG_INFO, "drv devId=%u, type=%d, value=%u.", devId, type, value); | 7736 | + RT_LOG(RT_LOG_INFO, "drv devId=%u, type=%s, value=%u.", devId, DevResLimitTypeToString(type), value); |
| 7718 | Runtime* const rt = Runtime::Instance(); | 7737 | Runtime* const rt = Runtime::Instance(); |
| 7719 | Device* const dev = rt->GetDevice(devId, static_cast<uint32_t>(RT_TSC_ID)); | 7738 | Device* const dev = rt->GetDevice(devId, static_cast<uint32_t>(RT_TSC_ID)); |
| 7720 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); | 7739 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); |
| @@ -7724,8 +7743,8 @@ rtError_t ApiImpl::SetDeviceResLimit(const uint32_t devId, const rtDevResLimitTy | |||
| 7724 | RT_LOG( | 7743 | RT_LOG( |
| 7725 | RT_LOG_ERROR, | 7744 | RT_LOG_ERROR, |
| 7726 | "The value exceeds the total number of cores." | 7745 | "The value exceeds the total number of cores." |
| 7727 | - " drv devId=%u, type=%d, value=%u, total number of cores=%u.", | 7746 | + " drv devId=%u, type=%s, value=%u, total number of cores=%u.", |
| 7728 | - devId, type, value, initValue), | 7747 | + devId, DevResLimitTypeToString(type), value, initValue), |
| 7729 | "Setting the device resource limit", value, "value", RtFmtMsg("must be less than or equal to %u", initValue)); | 7748 | "Setting the device resource limit", value, "value", RtFmtMsg("must be less than or equal to %u", initValue)); |
| 7730 | 7749 | ||
| 7731 | const auto error = SetDeviceResLimitByFe(devId, type, value); | 7750 | const auto error = SetDeviceResLimitByFe(devId, type, value); |
| @@ -7757,7 +7776,7 @@ rtError_t ApiImpl::GetDeviceResLimit(const uint32_t devId, const rtDevResLimitTy | |||
| 7757 | Device* const dev = rt->GetDevice(devId, static_cast<uint32_t>(RT_TSC_ID)); | 7776 | Device* const dev = rt->GetDevice(devId, static_cast<uint32_t>(RT_TSC_ID)); |
| 7758 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); | 7777 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); |
| 7759 | *value = dev->GetResValue(type); | 7778 | *value = dev->GetResValue(type); |
| 7760 | - RT_LOG(RT_LOG_INFO, "type=%d, value=%u.", type, *value); | 7779 | + RT_LOG(RT_LOG_INFO, "type=%s, value=%u.", DevResLimitTypeToString(type), *value); |
| 7761 | return RT_ERROR_NONE; | 7780 | return RT_ERROR_NONE; |
| 7762 | } | 7781 | } |
| 7763 | 7782 | ||
| @@ -7825,13 +7844,15 @@ static rtError_t SetStreamResLimitByType(Stream* const stm, const rtDevResLimitT | |||
| 7825 | RT_LOG( | 7844 | RT_LOG( |
| 7826 | RT_LOG_ERROR, | 7845 | RT_LOG_ERROR, |
| 7827 | "The value exceeds the total number of cores." | 7846 | "The value exceeds the total number of cores." |
| 7828 | - " drv devId=%u, type=%d, value=%u, total number of cores=%u.", | 7847 | + " drv devId=%u, type=%s, value=%u, total number of cores=%u.", |
| 7829 | - dev->Id_(), type, value, initValue), | 7848 | + dev->Id_(), DevResLimitTypeToString(type), value, initValue), |
| 7830 | __func__, value, "value", RtFmtMsg("must be less than or equal to %u", initValue)); | 7849 | __func__, value, "value", RtFmtMsg("must be less than or equal to %u", initValue)); |
| 7831 | 7850 | ||
| 7832 | // There is no restriction that it must be less than the SetDeviceResLimit setting | 7851 | // There is no restriction that it must be less than the SetDeviceResLimit setting |
| 7833 | stm->InsertResLimit(type, value); | 7852 | stm->InsertResLimit(type, value); |
| 7834 | - RT_LOG(RT_LOG_INFO, "drv devId=%u, stream_id=%d, type=%d, value=%u.", dev->Id_(), stm->Id_(), type, value); | 7853 | + RT_LOG( |
| 7854 | + RT_LOG_INFO, "drv devId=%u, stream_id=%d, type=%s, value=%u.", dev->Id_(), stm->Id_(), | ||
| 7855 | + DevResLimitTypeToString(type), value); | ||
| 7835 | return RT_ERROR_NONE; | 7856 | return RT_ERROR_NONE; |
| 7836 | } | 7857 | } |
| 7837 | 7858 | ||
| @@ -7876,7 +7897,9 @@ static rtError_t GetStreamResLimitByType(const Stream* const stm, const rtDevRes | |||
| 7876 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); | 7897 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); |
| 7877 | *value = dev->GetResValue(type); | 7898 | *value = dev->GetResValue(type); |
| 7878 | } | 7899 | } |
| 7879 | - RT_LOG(RT_LOG_INFO, "stream_id=%d, resLimitFlag=%d, type=%d, value=%u.", stm->Id_(), resLimitFlag, type, *value); | 7900 | + RT_LOG( |
| 7901 | + RT_LOG_INFO, "stream_id=%d, resLimitFlag=%d, type=%s, value=%u.", stm->Id_(), resLimitFlag, | ||
| 7902 | + DevResLimitTypeToString(type), *value); | ||
| 7880 | return RT_ERROR_NONE; | 7903 | return RT_ERROR_NONE; |
| 7881 | } | 7904 | } |
| 7882 | 7905 | ||
| @@ -7932,7 +7955,9 @@ rtError_t ApiImpl::GetResInCurrentThread(const rtDevResLimitType_t type, uint32_ | |||
| 7932 | const auto curResLimitStream = InnerThreadLocalContainer::GetCurrentResLimitStream(); | 7955 | const auto curResLimitStream = InnerThreadLocalContainer::GetCurrentResLimitStream(); |
| 7933 | if (curResLimitStream != nullptr && curResLimitStream->GetResLimitFlag(type)) { | 7956 | if (curResLimitStream != nullptr && curResLimitStream->GetResLimitFlag(type)) { |
| 7934 | *value = curResLimitStream->GetResValue(type); | 7957 | *value = curResLimitStream->GetResValue(type); |
| 7935 | - RT_LOG(RT_LOG_INFO, "stream_id=%d, type=%d, value=%u.", curResLimitStream->Id_(), type, *value); | 7958 | + RT_LOG( |
| 7959 | + RT_LOG_INFO, "stream_id=%d, type=%s, value=%u.", curResLimitStream->Id_(), DevResLimitTypeToString(type), | ||
| 7960 | + *value); | ||
| 7936 | } else { | 7961 | } else { |
| 7937 | Device* dev = InnerThreadLocalContainer::GetDevice(); | 7962 | Device* dev = InnerThreadLocalContainer::GetDevice(); |
| 7938 | if (dev == nullptr) { | 7963 | if (dev == nullptr) { |
| @@ -7942,7 +7967,7 @@ rtError_t ApiImpl::GetResInCurrentThread(const rtDevResLimitType_t type, uint32_ | |||
| 7942 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); | 7967 | NULL_PTR_RETURN_MSG(dev, RT_ERROR_DEVICE_NULL); |
| 7943 | } | 7968 | } |
| 7944 | *value = dev->GetResValue(type); | 7969 | *value = dev->GetResValue(type); |
| 7945 | - RT_LOG(RT_LOG_INFO, "drv devId=%u, type=%d, value=%u.", dev->Id_(), type, *value); | 7970 | + RT_LOG(RT_LOG_INFO, "drv devId=%u, type=%s, value=%u.", dev->Id_(), DevResLimitTypeToString(type), *value); |
| 7946 | } | 7971 | } |
| 7947 | return RT_ERROR_NONE; | 7972 | return RT_ERROR_NONE; |
| 7948 | } | 7973 | } |
| @@ -8053,10 +8078,9 @@ rtError_t ApiImpl::ParseMallocCfg(const rtMallocConfig_t* const cfg, rtConfigVal | |||
| 8053 | cfgVal->deviceId = cfg->attrs[i].value.deviceId; | 8078 | cfgVal->deviceId = cfg->attrs[i].value.deviceId; |
| 8054 | break; | 8079 | break; |
| 8055 | default: | 8080 | default: |
| 8056 | - RT_LOG(RT_LOG_ERROR, "invalid attribute %d", cfg->attrs[i].attr); | 8081 | + RT_LOG(RT_LOG_ERROR, "invalid attribute %s", MallocAttrToString(cfg->attrs[i].attr)); |
| 8057 | - RT_LOG_OUTER_MSG_INVALID_PARAM( | 8082 | + RT_LOG_OUTER_MSG_WITH_FUNC( |
| 8058 | - cfg->attrs[i].attr, "[" + std::to_string(RT_MEM_MALLOC_ATTR_RSV) + ", " + | 8083 | + ErrorCode::EE1003, MallocAttrToString(cfg->attrs[i].attr), "cfg->attrs[i].attr", "[0, 2]"); |
| 8059 | - std::to_string(RT_MEM_MALLOC_ATTR_DEVICE_ID) + "]"); | ||
| 8060 | return RT_ERROR_INVALID_VALUE; | 8084 | return RT_ERROR_INVALID_VALUE; |
| 8061 | } | 8085 | } |
| 8062 | } | 8086 | } |
| @@ -8663,9 +8687,9 @@ rtError_t ApiImpl::MemcpyBatch( | |||
| 8663 | (realDstLoc == realSrcLoc), RT_ERROR_INVALID_VALUE, ErrorCode::EE1016, SetFailIndex(failIdx, i), | 8687 | (realDstLoc == realSrcLoc), RT_ERROR_INVALID_VALUE, ErrorCode::EE1016, SetFailIndex(failIdx, i), |
| 8664 | "Batch synchronous memory copy", | 8688 | "Batch synchronous memory copy", |
| 8665 | RtFmtMsg( | 8689 | RtFmtMsg( |
| 8666 | - "Only H2D and D2H copy directions are supported. The destination location type is %s(%d)," | 8690 | + "Only H2D and D2H copy directions are supported. The destination location type is %s," |
| 8667 | - " and the source location type is %s(%d)", | 8691 | + " and the source location type is %s", |
| 8668 | - MemLocationTypeToStr(realDstLoc), realDstLoc, MemLocationTypeToStr(realSrcLoc), realSrcLoc)); | 8692 | + MemLocationTypeToString(realDstLoc).c_str(), MemLocationTypeToString(realSrcLoc).c_str())); |
| 8669 | } | 8693 | } |
| 8670 | return NpuDriver::MemcpyBatch(reinterpret_cast<uint64_t*>(dsts), reinterpret_cast<uint64_t*>(srcs), sizes, count); | 8694 | return NpuDriver::MemcpyBatch(reinterpret_cast<uint64_t*>(dsts), reinterpret_cast<uint64_t*>(srcs), sizes, count); |
| 8671 | } | 8695 | } |
| @@ -8685,10 +8709,10 @@ rtError_t ApiImpl::CheckMemCpyAttr( | |||
| 8685 | ((memType == RT_MEMORY_LOC_DEVICE) && (dstAttr.location.id != memAttr.dstLoc.id))), | 8709 | ((memType == RT_MEMORY_LOC_DEVICE) && (dstAttr.location.id != memAttr.dstLoc.id))), |
| 8686 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Checking memory copy attributes", "dst", | 8710 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Checking memory copy attributes", "dst", |
| 8687 | RtFmtMsg( | 8711 | RtFmtMsg( |
| 8688 | - "The input memory type %s(%d) and the actual memory type %s(%d) do not match," | 8712 | + "The input memory type %s and the actual memory type %s do not match," |
| 8689 | " or the input device ID (device_id=%d) and the actual device ID (device_id=%d) do not match", | 8713 | " or the input device ID (device_id=%d) and the actual device ID (device_id=%d) do not match", |
| 8690 | - MemLocationTypeToStr(memAttr.dstLoc.type), memAttr.dstLoc.type, MemLocationTypeToStr(dstAttr.location.type), | 8714 | + MemLocationTypeToString(memAttr.dstLoc.type).c_str(), |
| 8691 | - dstAttr.location.type, memAttr.dstLoc.id, dstAttr.location.id)); | 8715 | + MemLocationTypeToString(dstAttr.location.type).c_str(), memAttr.dstLoc.id, dstAttr.location.id)); |
| 8692 | 8716 | ||
| 8693 | error = PtrGetAttributes(src, &srcAttr); | 8717 | error = PtrGetAttributes(src, &srcAttr); |
| 8694 | ERROR_RETURN(error, "get src attribute failed, error=%#x.", error); | 8718 | ERROR_RETURN(error, "get src attribute failed, error=%#x.", error); |
| @@ -8700,10 +8724,10 @@ rtError_t ApiImpl::CheckMemCpyAttr( | |||
| 8700 | ((memType == RT_MEMORY_LOC_DEVICE) && (srcAttr.location.id != memAttr.srcLoc.id))), | 8724 | ((memType == RT_MEMORY_LOC_DEVICE) && (srcAttr.location.id != memAttr.srcLoc.id))), |
| 8701 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Checking memory copy attributes", "src", | 8725 | RT_ERROR_INVALID_VALUE, ErrorCode::EE1017, "Checking memory copy attributes", "src", |
| 8702 | RtFmtMsg( | 8726 | RtFmtMsg( |
| 8703 | - "The input memory type %s(%d) and the actual memory type %s(%d) do not match," | 8727 | + "The input memory type %s and the actual memory type %s do not match," |
| 8704 | " or the input device ID (device_id=%d) and the actual device ID (device_id=%d) do not match", | 8728 | " or the input device ID (device_id=%d) and the actual device ID (device_id=%d) do not match", |
| 8705 | - MemLocationTypeToStr(memAttr.srcLoc.type), memAttr.srcLoc.type, MemLocationTypeToStr(srcAttr.location.type), | 8729 | + MemLocationTypeToString(memAttr.srcLoc.type).c_str(), |
| 8706 | - srcAttr.location.type, memAttr.srcLoc.id, srcAttr.location.id)); | 8730 | + MemLocationTypeToString(srcAttr.location.type).c_str(), memAttr.srcLoc.id, srcAttr.location.id)); |
| 8707 | 8731 | ||
| 8708 | return RT_ERROR_NONE; | 8732 | return RT_ERROR_NONE; |
| 8709 | } | 8733 | } |
| @@ -8730,17 +8754,17 @@ rtError_t ApiImpl::ValidateMemCpyParamsAndAttributes( | |||
| 8730 | realSrcLoc = (srcAttr.location.type == RT_MEMORY_LOC_UNREGISTERED) ? RT_MEMORY_LOC_HOST : srcAttr.location.type; | 8754 | realSrcLoc = (srcAttr.location.type == RT_MEMORY_LOC_UNREGISTERED) ? RT_MEMORY_LOC_HOST : srcAttr.location.type; |
| 8731 | COND_RETURN_ERROR_MSG_INNER( | 8755 | COND_RETURN_ERROR_MSG_INNER( |
| 8732 | error != RT_ERROR_NONE, error, | 8756 | error != RT_ERROR_NONE, error, |
| 8733 | - "check attributes failed, attributes of src locationType=%d, dst locationType=%d, " | 8757 | + "check attributes failed, attributes of src locationType=%s, dst locationType=%s, " |
| 8734 | - "actually dst locationType=%d(%s), src locationType=%d(%s).", | 8758 | + "actually dst locationType=%s, src locationType=%s.", |
| 8735 | - memAttr.srcLoc.type, memAttr.dstLoc.type, realDstLoc, MemLocationTypeToStr(realDstLoc), realSrcLoc, | 8759 | + MemLocationTypeToString(memAttr.srcLoc.type).c_str(), MemLocationTypeToString(memAttr.dstLoc.type).c_str(), |
| 8736 | - MemLocationTypeToStr(realSrcLoc)); | 8760 | + MemLocationTypeToString(realDstLoc).c_str(), MemLocationTypeToString(realSrcLoc).c_str()); |
| 8737 | 8761 | ||
| 8738 | COND_RETURN_AND_MSG_OUTER( | 8762 | COND_RETURN_AND_MSG_OUTER( |
| 8739 | (realDstLoc == realSrcLoc), RT_ERROR_INVALID_VALUE, ErrorCode::EE1016, "Checking memory copy params", | 8763 | (realDstLoc == realSrcLoc), RT_ERROR_INVALID_VALUE, ErrorCode::EE1016, "Checking memory copy params", |
| 8740 | RtFmtMsg( | 8764 | RtFmtMsg( |
| 8741 | - "Only H2D and D2H copy directions are supported. The destination location type is %s(%d)," | 8765 | + "Only H2D and D2H copy directions are supported. The destination location type is %s," |
| 8742 | - " and the source location type is %s(%d)", | 8766 | + " and the source location type is %s", |
| 8743 | - MemLocationTypeToStr(realDstLoc), realDstLoc, MemLocationTypeToStr(realSrcLoc), realSrcLoc)); | 8767 | + MemLocationTypeToString(realDstLoc).c_str(), MemLocationTypeToString(realSrcLoc).c_str())); |
| 8744 | return error; | 8768 | return error; |
| 8745 | } | 8769 | } |
| 8746 | 8770 | ||
| @@ -8810,8 +8834,8 @@ rtError_t ApiImpl::LoopMemcpyAsync( | |||
| 8810 | 8834 | ||
| 8811 | COND_RETURN_AND_MSG_INNER( | 8835 | COND_RETURN_AND_MSG_INNER( |
| 8812 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, | 8836 | (error != RT_ERROR_NONE) && (error != RT_ERROR_DRV_NOT_SUPPORT), error, |
| 8813 | - "Failed to copy memory asynchronously, count=%zu, kind=%s, retCode=%#x.", sizes[i], | 8837 | + "Failed to copy memory asynchronously, count=%zu, kind=%s, retCode=%#x.", sizes[i], MemcpyKindToStr(kind), |
| 8814 | - MemcpyKindToString(kind).c_str(), static_cast<uint32_t>(error)); | 8838 | + static_cast<uint32_t>(error)); |
| 8815 | } | 8839 | } |
| 8816 | 8840 | ||
| 8817 | return error; | 8841 | return error; |
| @@ -9172,7 +9196,11 @@ rtError_t ApiImpl::FunctionGetAttribute(rtFuncHandle funcHandle, rtFuncAttribute | |||
| 9172 | break; | 9196 | break; |
| 9173 | } | 9197 | } |
| 9174 | default: { | 9198 | default: { |
| 9175 | - RT_LOG(RT_LOG_WARNING, "Invalid attrType attrType=%d", attrType); | 9199 | + if (attrType == RT_FUNCTION_ATTR_MAX) { |
| 9200 | + RT_LOG(RT_LOG_WARNING, "Invalid attrType=FUNCTION_ATTR_MAX(4)"); | ||
| 9201 | + } else { | ||
| 9202 | + RT_LOG(RT_LOG_WARNING, "Invalid attrType=UNKNOWN(%d)", static_cast<int32_t>(attrType)); | ||
| 9203 | + } | ||
| 9176 | break; | 9204 | break; |
| 9177 | } | 9205 | } |
| 9178 | } | 9206 | } |
| @@ -9512,8 +9540,9 @@ rtError_t ApiImpl::TaskSetParams(rtTask_t task, rtTaskParams* const params) | |||
| 9512 | case RT_TASK_EVENT_RECORD: | 9540 | case RT_TASK_EVENT_RECORD: |
| 9513 | case RT_TASK_EVENT_WAIT: | 9541 | case RT_TASK_EVENT_WAIT: |
| 9514 | case RT_TASK_EVENT_RESET: | 9542 | case RT_TASK_EVENT_RESET: |
| 9515 | - RT_LOG_OUTER_MSG_INVALID_PARAM_WITH_DESC( | 9543 | + RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 9516 | - "Setting task parameters", params->type, "RT_TASK_KERNEL or RT_TASK_VALUE_WRITE or RT_TASK_VALUE_WAIT"); | 9544 | + ErrorCode::EE1003, "Setting task parameters", TaskTypeToString(params->type), "params->type", |
| 9545 | + "TASK_KERNEL(1) or TASK_VALUE_WRITE(5) or TASK_VALUE_WAIT(6)"); | ||
| 9517 | error = RT_ERROR_INVALID_VALUE; | 9546 | error = RT_ERROR_INVALID_VALUE; |
| 9518 | break; | 9547 | break; |
| 9519 | case RT_TASK_VALUE_WRITE: | 9548 | case RT_TASK_VALUE_WRITE: |
| @@ -9523,8 +9552,9 @@ rtError_t ApiImpl::TaskSetParams(rtTask_t task, rtTaskParams* const params) | |||
| 9523 | error = UpdateWaitValueTaskParams(taskInfo, params); | 9552 | error = UpdateWaitValueTaskParams(taskInfo, params); |
| 9524 | break; | 9553 | break; |
| 9525 | default: | 9554 | default: |
| 9526 | - RT_LOG_OUTER_MSG_INVALID_PARAM_WITH_DESC( | 9555 | + RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 9527 | - "Setting task parameters", params->type, "[1, " + std::to_string(RT_TASK_VALUE_WAIT) + "]"); | 9556 | + ErrorCode::EE1003, "Setting task parameters", TaskTypeToString(params->type), "params->type", |
| 9557 | + "TASK_KERNEL(1) or TASK_VALUE_WRITE(5) or TASK_VALUE_WAIT(6)"); | ||
| 9528 | error = RT_ERROR_INVALID_VALUE; | 9558 | error = RT_ERROR_INVALID_VALUE; |
| 9529 | break; | 9559 | break; |
| 9530 | } | 9560 | } |
| @@ -9532,8 +9562,8 @@ rtError_t ApiImpl::TaskSetParams(rtTask_t task, rtTaskParams* const params) | |||
| 9532 | , "task set params failed"); | 9562 | , "task set params failed"); |
| 9533 | taskInfo->updateFlag = static_cast<uint8_t>(TaskUpdateFlag::RT_TASK_UPDATE); | 9563 | taskInfo->updateFlag = static_cast<uint8_t>(TaskUpdateFlag::RT_TASK_UPDATE); |
| 9534 | RT_LOG( | 9564 | RT_LOG( |
| 9535 | - RT_LOG_INFO, "stream_id=%d, task_id=%hu, typeName=%s, task type=%d, target type=%d", taskInfo->stream->Id_(), | 9565 | + RT_LOG_INFO, "stream_id=%d, task_id=%hu, typeName=%s, task type=%d, target type=%s", taskInfo->stream->Id_(), |
| 9536 | - taskInfo->id, taskInfo->typeName, taskInfo->type, params->type); | 9566 | + taskInfo->id, taskInfo->typeName, taskInfo->type, TaskTypeToString(params->type).c_str()); |
| 9537 | return RT_ERROR_NONE; | 9567 | return RT_ERROR_NONE; |
| 9538 | } | 9568 | } |
| 9539 | 9569 | ||
| @@ -9558,8 +9588,8 @@ rtError_t ApiImpl::ModelUpdate(Model* mdl) | |||
| 9558 | 9588 | ||
| 9559 | if (captureModel->GetCaptureModelStatus() != RtCaptureModelStatus::UPDATING) { | 9589 | if (captureModel->GetCaptureModelStatus() != RtCaptureModelStatus::UPDATING) { |
| 9560 | RT_LOG( | 9590 | RT_LOG( |
| 9561 | - RT_LOG_ERROR, "model is not ready for update, model_id=%u, current status=%d", captureModel->Id_(), | 9591 | + RT_LOG_ERROR, "model is not ready for update, model_id=%u, current status=%s", captureModel->Id_(), |
| 9562 | - captureModel->GetCaptureModelStatus()); | 9592 | + CaptureModelStatusToString(captureModel->GetCaptureModelStatus()).c_str()); |
| 9563 | return RT_ERROR_MODEL_UPDATE_FAILED; | 9593 | return RT_ERROR_MODEL_UPDATE_FAILED; |
| 9564 | } | 9594 | } |
| 9565 | 9595 | ||
| @@ -9795,7 +9825,7 @@ rtError_t ApiImpl::GetDeviceInfoByAttrMisc(uint32_t deviceId, rtDevAttr attr, in | |||
| 9795 | size_t freeSize = 0UL; | 9825 | size_t freeSize = 0UL; |
| 9796 | size_t totalSize = 0UL; | 9826 | size_t totalSize = 0UL; |
| 9797 | 9827 | ||
| 9798 | - RT_LOG(RT_LOG_INFO, "get device info by attr misc, deviceId=%u attr=%d", deviceId, attr); | 9828 | + RT_LOG(RT_LOG_INFO, "get device info by attr misc, deviceId=%u attr=%s", deviceId, DevAttrToString(attr)); |
| 9799 | 9829 | ||
| 9800 | uint32_t userDeviceId = 0U; | 9830 | uint32_t userDeviceId = 0U; |
| 9801 | rtError_t error = Runtime::Instance()->GetUserDevIdByDeviceId(static_cast<uint32_t>(deviceId), &userDeviceId); | 9831 | rtError_t error = Runtime::Instance()->GetUserDevIdByDeviceId(static_cast<uint32_t>(deviceId), &userDeviceId); |
| @@ -9845,17 +9875,15 @@ rtError_t ApiImpl::GetDeviceInfoByAttrMisc(uint32_t deviceId, rtDevAttr attr, in | |||
| 9845 | error = GetDeviceVirtualInfo(deviceId, val); | 9875 | error = GetDeviceVirtualInfo(deviceId, val); |
| 9846 | break; | 9876 | break; |
| 9847 | default: | 9877 | default: |
| 9848 | - RT_LOG_OUTER_MSG_INVALID_PARAM( | 9878 | + RT_LOG_OUTER_MSG_WITH_FUNC( |
| 9849 | - attr, "RT_DEV_ATTR_CUBE_CORE_NUM(102), RT_DEV_ATTR_WARP_SIZE(202)," | 9879 | + ErrorCode::EE1003, DevAttrToString(attr), "attr", |
| 9850 | - " RT_DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE(203), RT_DEV_ATTR_UBUF_PER_VECTOR_CORE(204), " | 9880 | + "DEV_ATTR_CUBE_CORE_NUM(102), DEV_ATTR_WARP_SIZE(202), " |
| 9851 | - "RT_DEV_ATTR_MAX_GRID_DIM_X(205)," | 9881 | + "DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE(203), DEV_ATTR_UBUF_PER_VECTOR_CORE(204), " |
| 9852 | - " RT_DEV_ATTR_MAX_GRID_DIM_Y(206), RT_DEV_ATTR_MAX_GRID_DIM_Z(207), " | 9882 | + "DEV_ATTR_MAX_GRID_DIM_X(205), DEV_ATTR_MAX_GRID_DIM_Y(206), DEV_ATTR_MAX_GRID_DIM_Z(207), " |
| 9853 | - "RT_DEV_ATTR_MAX_BLOCK_PER_GRID(208)," | 9883 | + "DEV_ATTR_MAX_BLOCK_PER_GRID(208), DEV_ATTR_MAX_THREADS_PER_BLOCK(209), " |
| 9854 | - " RT_DEV_ATTR_MAX_THREADS_PER_BLOCK(209), RT_DEV_ATTR_MAX_BLOCK_DIM_X(210), " | 9884 | + "DEV_ATTR_MAX_BLOCK_DIM_X(210), DEV_ATTR_MAX_BLOCK_DIM_Y(211), DEV_ATTR_MAX_BLOCK_DIM_Z(212), " |
| 9855 | - "RT_DEV_ATTR_MAX_BLOCK_DIM_Y(211)," | 9885 | + "DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE(301), DEV_ATTR_L2_CACHE_SIZE(302), DEV_ATTR_NPU_ARCH(601), or " |
| 9856 | - " RT_DEV_ATTR_MAX_BLOCK_DIM_Z(212), RT_DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE(301), " | 9886 | + "DEV_ATTR_IS_VIRTUAL(501)"); |
| 9857 | - "RT_DEV_ATTR_L2_CACHE_SIZE(302)," | ||
| 9858 | - " RT_DEV_ATTR_NPU_ARCH(601), or RT_DEV_ATTR_IS_VIRTUAL(501)"); | ||
| 9859 | error = RT_ERROR_INVALID_VALUE; | 9887 | error = RT_ERROR_INVALID_VALUE; |
| 9860 | break; | 9888 | break; |
| 9861 | } | 9889 | } |
| @@ -29,6 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | + | ||
| 32 | 33 | ||
| 33 | 34 | ||
| 34 | 35 | ||
| @@ -56,6 +57,7 @@ | |||
| 56 | 57 | ||
| 57 | 58 | ||
| 58 | 59 | ||
| 60 | + | ||
| 59 | 61 | ||
| 60 | namespace cce { | 62 | namespace cce { |
| 61 | namespace runtime { | 63 | namespace runtime { |
| @@ -397,7 +399,7 @@ rtError_t ApiImplDavid::CmoAddrTaskLaunch( | |||
| 397 | { | 399 | { |
| 398 | UNUSED(destMax); | 400 | UNUSED(destMax); |
| 399 | UNUSED(flag); | 401 | UNUSED(flag); |
| 400 | - RT_LOG(RT_LOG_DEBUG, "Cmo addr task launch, opCode=%d.", cmoOpCode); | 402 | + RT_LOG(RT_LOG_DEBUG, "Cmo addr task launch, opCode=%s.", CmoOpCodeToString(cmoOpCode).c_str()); |
| 401 | 403 | ||
| 402 | Context* const curCtx = CurrentContext(); | 404 | Context* const curCtx = CurrentContext(); |
| 403 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 405 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| @@ -698,8 +700,8 @@ rtError_t ApiImplDavid::SetMemcpyDesc( | |||
| 698 | const rtMemcpyKind kind, rtMemcpyConfig_t* const config) | 700 | const rtMemcpyKind kind, rtMemcpyConfig_t* const config) |
| 699 | { | 701 | { |
| 700 | RT_LOG( | 702 | RT_LOG( |
| 701 | - RT_LOG_INFO, "SetMemcpyDesc called, desc=%p, srcAddr=%p, dstAddr=%p, count=%zu, kind=%d, config=%p", desc, | 703 | + RT_LOG_INFO, "SetMemcpyDesc called, desc=%p, srcAddr=%p, dstAddr=%p, count=%zu, kind=%s, config=%p", desc, |
| 702 | - srcAddr, dstAddr, count, kind, config); | 704 | + srcAddr, dstAddr, count, MemcpyNewKindToString(kind).c_str(), config); |
| 703 | UNUSED(kind); | 705 | UNUSED(kind); |
| 704 | UNUSED(config); | 706 | UNUSED(config); |
| 705 | 707 | ||
| @@ -740,8 +742,8 @@ rtError_t ApiImplDavid::MemCopy2DAsync( | |||
| 740 | UNUSED(newKind); | 742 | UNUSED(newKind); |
| 741 | RT_LOG( | 743 | RT_LOG( |
| 742 | RT_LOG_DEBUG, | 744 | RT_LOG_DEBUG, |
| 743 | - "Sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%d.", | 745 | + "Sync memcpy2d, dstPitch=%" PRIu64 ", srcPitch=%" PRIu64 ", width=%" PRIu64 ", height=%" PRIu64 ", kind=%s.", |
| 744 | - dstPitch, srcPitch, width, height, kind); | 746 | + dstPitch, srcPitch, width, height, MemcpyKindToStr(kind)); |
| 745 | 747 | ||
| 746 | rtError_t error = RT_ERROR_NONE; | 748 | rtError_t error = RT_ERROR_NONE; |
| 747 | uint64_t remainSize = width * height; | 749 | uint64_t remainSize = width * height; |
| @@ -895,7 +897,7 @@ rtError_t ApiImplDavid::MemcpyAsync( | |||
| 895 | { | 897 | { |
| 896 | UNUSED(checkKind); | 898 | UNUSED(checkKind); |
| 897 | UNUSED(memcpyConfig); | 899 | UNUSED(memcpyConfig); |
| 898 | - RT_LOG(RT_LOG_DEBUG, "Async memcpy, count=%" PRIu64 ", kind=%d", cnt, kind); | 900 | + RT_LOG(RT_LOG_DEBUG, "Async memcpy, count=%" PRIu64 ", kind=%s", cnt, MemcpyKindToStr(kind)); |
| 899 | 901 | ||
| 900 | Context* const curCtx = CurrentContext(); | 902 | Context* const curCtx = CurrentContext(); |
| 901 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 903 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| @@ -941,7 +943,7 @@ rtError_t ApiImplDavid::ReduceAsync( | |||
| 941 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, | 943 | void* const dst, const void* const src, const uint64_t cnt, const rtRecudeKind_t kind, const rtDataType_t type, |
| 942 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo) | 944 | Stream* const stm, const rtTaskCfgInfo_t* const cfgInfo) |
| 943 | { | 945 | { |
| 944 | - RT_LOG(RT_LOG_INFO, "ReduceAsync, count=%" PRIu64 ", kind=%d.", cnt, kind); | 946 | + RT_LOG(RT_LOG_INFO, "ReduceAsync, count=%" PRIu64 ", kind=%s.", cnt, ReduceKindToString(kind).c_str()); |
| 945 | Context* const curCtx = CurrentContext(); | 947 | Context* const curCtx = CurrentContext(); |
| 946 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 948 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 947 | 949 | ||
| @@ -1593,7 +1595,9 @@ rtError_t ApiImplDavid::StreamSwitchEx( | |||
| 1593 | void* const ptr, const rtCondition_t condition, void* const valuePtr, Stream* const trueStream, Stream* const stm, | 1595 | void* const ptr, const rtCondition_t condition, void* const valuePtr, Stream* const trueStream, Stream* const stm, |
| 1594 | const rtSwitchDataType_t dataType) | 1596 | const rtSwitchDataType_t dataType) |
| 1595 | { | 1597 | { |
| 1596 | - RT_LOG(RT_LOG_DEBUG, "Stream switch, condition=%d, dataType=%d.", condition, dataType); | 1598 | + RT_LOG( |
| 1599 | + RT_LOG_DEBUG, "Stream switch, condition=%s, dataType=%s.", ConditionToString(condition).c_str(), | ||
| 1600 | + SwitchDataTypeToString(dataType).c_str()); | ||
| 1597 | Context* const curCtx = CurrentContext(); | 1601 | Context* const curCtx = CurrentContext(); |
| 1598 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 1602 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 1599 | COND_RETURN_AND_MSG_INVALID_CONTEXT_STREAM(stm, curCtx, RT_ERROR_STREAM_CONTEXT); | 1603 | COND_RETURN_AND_MSG_INVALID_CONTEXT_STREAM(stm, curCtx, RT_ERROR_STREAM_CONTEXT); |
| @@ -1791,9 +1795,10 @@ static rtError_t SetLimitSizeByType(const rtLimitType_t type, const uint32_t val | |||
| 1791 | rt->SetSimtDvgWarpStkSize(alignVal); | 1795 | rt->SetSimtDvgWarpStkSize(alignVal); |
| 1792 | break; | 1796 | break; |
| 1793 | default: | 1797 | default: |
| 1794 | - RT_LOG_OUTER_MSG_INVALID_PARAM( | 1798 | + RT_LOG_OUTER_MSG_WITH_FUNC( |
| 1795 | - type, std::to_string(RT_LIMIT_TYPE_SIMT_STACK_SIZE) + " or " + | 1799 | + ErrorCode::EE1003, LimitTypeToString(type), "type", |
| 1796 | - std::to_string(RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE)); | 1800 | + LimitTypeToString(RT_LIMIT_TYPE_SIMT_STACK_SIZE) + " or " + |
| 1801 | + LimitTypeToString(RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE)); | ||
| 1797 | return RT_ERROR_DEVICE_LIMIT; | 1802 | return RT_ERROR_DEVICE_LIMIT; |
| 1798 | } | 1803 | } |
| 1799 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM( | 1804 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM( |
| @@ -1805,7 +1810,7 @@ static rtError_t SetLimitSizeByType(const rtLimitType_t type, const uint32_t val | |||
| 1805 | rtError_t ApiImplDavid::DeviceSetLimit(const int32_t devId, const rtLimitType_t type, const uint32_t val) | 1810 | rtError_t ApiImplDavid::DeviceSetLimit(const int32_t devId, const rtLimitType_t type, const uint32_t val) |
| 1806 | { | 1811 | { |
| 1807 | RT_LOG( | 1812 | RT_LOG( |
| 1808 | - RT_LOG_DEBUG, "drv devId=%u, type=%u, value=%u.", static_cast<uint32_t>(devId), static_cast<uint32_t>(type), | 1813 | + RT_LOG_DEBUG, "drv devId=%u, type=%s, value=%u.", static_cast<uint32_t>(devId), LimitTypeToString(type).c_str(), |
| 1809 | val); | 1814 | val); |
| 1810 | rtError_t error = RT_ERROR_NONE; | 1815 | rtError_t error = RT_ERROR_NONE; |
| 1811 | Runtime* rt = Runtime::Instance(); | 1816 | Runtime* rt = Runtime::Instance(); |
| @@ -1814,8 +1819,8 @@ rtError_t ApiImplDavid::DeviceSetLimit(const int32_t devId, const rtLimitType_t | |||
| 1814 | Context* const curCtx = CurrentContext(); | 1819 | Context* const curCtx = CurrentContext(); |
| 1815 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 1820 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 1816 | RT_LOG( | 1821 | RT_LOG( |
| 1817 | - RT_LOG_WARNING, "DeviceSetLimit, drv devId=%u, type=%u, value=%u.", static_cast<uint32_t>(devId), | 1822 | + RT_LOG_WARNING, "DeviceSetLimit, drv devId=%u, type=%s, value=%u.", static_cast<uint32_t>(devId), |
| 1818 | - static_cast<uint32_t>(type), val); | 1823 | + LimitTypeToString(type).c_str(), val); |
| 1819 | return error; | 1824 | return error; |
| 1820 | } else if (type == RT_LIMIT_TYPE_STACK_SIZE) { | 1825 | } else if (type == RT_LIMIT_TYPE_STACK_SIZE) { |
| 1821 | std::unique_lock<std::mutex> lock(rt->GetSimtStackMutex()); | 1826 | std::unique_lock<std::mutex> lock(rt->GetSimtStackMutex()); |
| @@ -1840,13 +1845,13 @@ rtError_t ApiImplDavid::DeviceSetLimit(const int32_t devId, const rtLimitType_t | |||
| 1840 | 1845 | ||
| 1841 | rtError_t ApiImplDavid::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) | 1846 | rtError_t ApiImplDavid::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) |
| 1842 | { | 1847 | { |
| 1843 | - RT_LOG(RT_LOG_DEBUG, "type=%u.", static_cast<uint32_t>(type)); | 1848 | + RT_LOG(RT_LOG_DEBUG, "type=%s.", LimitTypeToString(type).c_str()); |
| 1844 | Runtime* rt = Runtime::Instance(); | 1849 | Runtime* rt = Runtime::Instance(); |
| 1845 | COND_RETURN_ERROR_MSG_INNER(rt == nullptr, RT_ERROR_INSTANCE_NULL, "Runtime instance is null."); | 1850 | COND_RETURN_ERROR_MSG_INNER(rt == nullptr, RT_ERROR_INSTANCE_NULL, "Runtime instance is null."); |
| 1846 | if (type == RT_LIMIT_TYPE_LOW_POWER_TIMEOUT) { | 1851 | if (type == RT_LIMIT_TYPE_LOW_POWER_TIMEOUT) { |
| 1847 | Context* const curCtx = CurrentContext(); | 1852 | Context* const curCtx = CurrentContext(); |
| 1848 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 1853 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 1849 | - RT_LOG(RT_LOG_WARNING, "DeviceGetLimit, type=%u.", static_cast<uint32_t>(type)); | 1854 | + RT_LOG(RT_LOG_WARNING, "DeviceGetLimit, type=%s.", LimitTypeToString(type).c_str()); |
| 1850 | *val = 0; | 1855 | *val = 0; |
| 1851 | } else if (type == RT_LIMIT_TYPE_STACK_SIZE) { | 1856 | } else if (type == RT_LIMIT_TYPE_STACK_SIZE) { |
| 1852 | *val = rt->GetDeviceCustomerStackSize(); | 1857 | *val = rt->GetDeviceCustomerStackSize(); |
| @@ -1861,10 +1866,10 @@ rtError_t ApiImplDavid::DeviceGetLimit(const rtLimitType_t type, uint32_t* val) | |||
| 1861 | } else if (type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { | 1866 | } else if (type == RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE) { |
| 1862 | *val = rt->GetSimtDvgWarpStkSize(); | 1867 | *val = rt->GetSimtDvgWarpStkSize(); |
| 1863 | } else { | 1868 | } else { |
| 1864 | - RT_LOG(RT_LOG_WARNING, "Limit type is not supported, type=%u", static_cast<uint32_t>(type)); | 1869 | + RT_LOG(RT_LOG_WARNING, "Limit type is not supported, type=%s", LimitTypeToString(type).c_str()); |
| 1865 | return RT_ERROR_FEATURE_NOT_SUPPORT; | 1870 | return RT_ERROR_FEATURE_NOT_SUPPORT; |
| 1866 | } | 1871 | } |
| 1867 | - RT_LOG(RT_LOG_INFO, "DeviceGetLimit success, type=%u, val=%u.", static_cast<uint32_t>(type), *val); | 1872 | + RT_LOG(RT_LOG_INFO, "DeviceGetLimit success, type=%s, val=%u.", LimitTypeToString(type).c_str(), *val); |
| 1868 | return RT_ERROR_NONE; | 1873 | return RT_ERROR_NONE; |
| 1869 | } | 1874 | } |
| 1870 | 1875 | ||
| @@ -2262,8 +2267,8 @@ rtError_t ApiImplDavid::StreamAddCondTask(rtCondTaskParams params, Stream* const | |||
| 2262 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 2267 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 2263 | error = curCtx->CreateSubCaptureModels(realHandle, params, stm); | 2268 | error = curCtx->CreateSubCaptureModels(realHandle, params, stm); |
| 2264 | ERROR_RETURN_MSG_INNER( | 2269 | ERROR_RETURN_MSG_INNER( |
| 2265 | - error, "Create sub capture model failed, condition type=%u, condition size=%u, retCode=%#x.", params.type, | 2270 | + error, "Create sub capture model failed, condition type=%s, condition size=%u, retCode=%#x.", |
| 2266 | - params.size, static_cast<uint32_t>(error)); | 2271 | + CondTaskTypeToString(params.type).c_str(), params.size, static_cast<uint32_t>(error)); |
| 2267 | 2272 | ||
| 2268 | return cce::runtime::StreamAddCondTask(realHandle, params, stm, flags); | 2273 | return cce::runtime::StreamAddCondTask(realHandle, params, stm, flags); |
| 2269 | } | 2274 | } |
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | + | ||
| 19 | 20 | ||
| 20 | namespace cce { | 21 | namespace cce { |
| 21 | namespace runtime { | 22 | namespace runtime { |
| @@ -42,8 +43,8 @@ rtError_t ApiImplSoma::StreamMemPoolSetAttr(rtMemPool_t memPool, rtMemPoolAttr a | |||
| 42 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 43 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 43 | value, RT_ERROR_INVALID_VALUE, "Setting the attribute value of a memory pool"); | 44 | value, RT_ERROR_INVALID_VALUE, "Setting the attribute value of a memory pool"); |
| 44 | RT_LOG( | 45 | RT_LOG( |
| 45 | - RT_LOG_DEBUG, "Stream memory pool set attribute, poolId=%#" PRIx64 ", attr=%u.", RtPtrToValue(memPool), | 46 | + RT_LOG_DEBUG, "Stream memory pool set attribute, poolId=%#" PRIx64 ", attr=%s.", RtPtrToValue(memPool), |
| 46 | - static_cast<uint32_t>(attr)); | 47 | + MemPoolAttrToString(attr).c_str()); |
| 47 | return SomaApi::StreamMemPoolSetAttr(memPool, attr, value); | 48 | return SomaApi::StreamMemPoolSetAttr(memPool, attr, value); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| @@ -54,8 +55,8 @@ rtError_t ApiImplSoma::StreamMemPoolGetAttr(rtMemPool_t memPool, rtMemPoolAttr a | |||
| 54 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 55 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 55 | value, RT_ERROR_INVALID_VALUE, "Obtaining the specified attribute value of a memory pool"); | 56 | value, RT_ERROR_INVALID_VALUE, "Obtaining the specified attribute value of a memory pool"); |
| 56 | RT_LOG( | 57 | RT_LOG( |
| 57 | - RT_LOG_DEBUG, "Stream memory pool get attribute, poolId=%#" PRIx64 ", attr=%u.", RtPtrToValue(memPool), | 58 | + RT_LOG_DEBUG, "Stream memory pool get attribute, poolId=%#" PRIx64 ", attr=%s.", RtPtrToValue(memPool), |
| 58 | - static_cast<uint32_t>(attr)); | 59 | + MemPoolAttrToString(attr).c_str()); |
| 59 | return SomaApi::StreamMemPoolGetAttr(memPool, attr, value); | 60 | return SomaApi::StreamMemPoolGetAttr(memPool, attr, value); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| @@ -0,0 +1,110 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +namespace cce { | ||
| 15 | +namespace runtime { | ||
| 16 | + | ||
| 17 | +const char_t* MemcpyKindToStr(const rtMemcpyKind_t kind) | ||
| 18 | +{ | ||
| 19 | + switch (kind) { | ||
| 20 | + case RT_MEMCPY_HOST_TO_HOST: | ||
| 21 | + return "MEMCPY_HOST_TO_HOST(0)"; | ||
| 22 | + case RT_MEMCPY_HOST_TO_DEVICE: | ||
| 23 | + return "MEMCPY_HOST_TO_DEVICE(1)"; | ||
| 24 | + case RT_MEMCPY_DEVICE_TO_HOST: | ||
| 25 | + return "MEMCPY_DEVICE_TO_HOST(2)"; | ||
| 26 | + case RT_MEMCPY_DEVICE_TO_DEVICE: | ||
| 27 | + return "MEMCPY_DEVICE_TO_DEVICE(3)"; | ||
| 28 | + case RT_MEMCPY_MANAGED: | ||
| 29 | + return "MEMCPY_MANAGED(4)"; | ||
| 30 | + case RT_MEMCPY_ADDR_DEVICE_TO_DEVICE: | ||
| 31 | + return "MEMCPY_ADDR_DEVICE_TO_DEVICE(5)"; | ||
| 32 | + case RT_MEMCPY_HOST_TO_DEVICE_EX: | ||
| 33 | + return "MEMCPY_HOST_TO_DEVICE_EX(6)"; | ||
| 34 | + case RT_MEMCPY_DEVICE_TO_HOST_EX: | ||
| 35 | + return "MEMCPY_DEVICE_TO_HOST_EX(7)"; | ||
| 36 | + case RT_MEMCPY_DEFAULT: | ||
| 37 | + return "MEMCPY_DEFAULT(8)"; | ||
| 38 | + case RT_MEMCPY_RESERVED: | ||
| 39 | + return "MEMCPY_RESERVED(9)"; | ||
| 40 | + default: | ||
| 41 | + break; | ||
| 42 | + } | ||
| 43 | + static thread_local char enumBuf[32]; | ||
| 44 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 45 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 46 | + return enumBuf; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +std::string MemcpyNewKindToString(const rtMemcpyKind kind) | ||
| 50 | +{ | ||
| 51 | + switch (kind) { | ||
| 52 | + case RT_MEMCPY_KIND_HOST_TO_HOST: | ||
| 53 | + return "MEMCPY_KIND_HOST_TO_HOST(0)"; | ||
| 54 | + case RT_MEMCPY_KIND_HOST_TO_DEVICE: | ||
| 55 | + return "MEMCPY_KIND_HOST_TO_DEVICE(1)"; | ||
| 56 | + case RT_MEMCPY_KIND_DEVICE_TO_HOST: | ||
| 57 | + return "MEMCPY_KIND_DEVICE_TO_HOST(2)"; | ||
| 58 | + case RT_MEMCPY_KIND_DEVICE_TO_DEVICE: | ||
| 59 | + return "MEMCPY_KIND_DEVICE_TO_DEVICE(3)"; | ||
| 60 | + case RT_MEMCPY_KIND_DEFAULT: | ||
| 61 | + return "MEMCPY_KIND_DEFAULT(4)"; | ||
| 62 | + case RT_MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE: | ||
| 63 | + return "MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE(5)"; | ||
| 64 | + case RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE: | ||
| 65 | + return "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)"; | ||
| 66 | + case RT_MEMCPY_KIND_INTER_DEVICE_TO_DEVICE: | ||
| 67 | + return "MEMCPY_KIND_INTER_DEVICE_TO_DEVICE(7)"; | ||
| 68 | + case RT_MEMCPY_KIND_MAX: | ||
| 69 | + return "MEMCPY_KIND_MAX(8)"; | ||
| 70 | + default: | ||
| 71 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(kind)); | ||
| 72 | + } | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +std::string CmoOpCodeToString(const rtCmoOpCode_t opCode) | ||
| 76 | +{ | ||
| 77 | + switch (opCode) { | ||
| 78 | + case RT_CMO_PREFETCH: | ||
| 79 | + return "CMO_PREFETCH(6)"; | ||
| 80 | + case RT_CMO_WRITEBACK: | ||
| 81 | + return "CMO_WRITEBACK(7)"; | ||
| 82 | + case RT_CMO_INVALID: | ||
| 83 | + return "CMO_INVALID(8)"; | ||
| 84 | + case RT_CMO_FLUSH: | ||
| 85 | + return "CMO_FLUSH(9)"; | ||
| 86 | + case RT_CMO_RESERVED: | ||
| 87 | + return "CMO_RESERVED(10)"; | ||
| 88 | + default: | ||
| 89 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(opCode)); | ||
| 90 | + } | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +std::string SysParamOptToString(const rtSysParamOpt option) | ||
| 94 | +{ | ||
| 95 | + switch (option) { | ||
| 96 | + case SYS_OPT_DETERMINISTIC: | ||
| 97 | + return "SYS_OPT_DETERMINISTIC(0)"; | ||
| 98 | + case SYS_OPT_ENABLE_DEBUG_KERNEL: | ||
| 99 | + return "SYS_OPT_ENABLE_DEBUG_KERNEL(1)"; | ||
| 100 | + case SYS_OPT_STRONG_CONSISTENCY: | ||
| 101 | + return "SYS_OPT_STRONG_CONSISTENCY(2)"; | ||
| 102 | + case SYS_OPT_RESERVED: | ||
| 103 | + return "SYS_OPT_RESERVED(3)"; | ||
| 104 | + default: | ||
| 105 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(option)); | ||
| 106 | + } | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +} // namespace runtime | ||
| 110 | +} // namespace cce | ||
| @@ -0,0 +1,450 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +namespace cce { | ||
| 17 | +namespace runtime { | ||
| 18 | + | ||
| 19 | +std::string DataTypeToString(const rtDataType_t type) | ||
| 20 | +{ | ||
| 21 | + std::string desc; | ||
| 22 | + switch (type) { | ||
| 23 | + case RT_DATA_TYPE_FP32: | ||
| 24 | + desc = "DATA_TYPE_FP32(0)"; | ||
| 25 | + break; | ||
| 26 | + case RT_DATA_TYPE_FP16: | ||
| 27 | + desc = "DATA_TYPE_FP16(1)"; | ||
| 28 | + break; | ||
| 29 | + case RT_DATA_TYPE_INT16: | ||
| 30 | + desc = "DATA_TYPE_INT16(2)"; | ||
| 31 | + break; | ||
| 32 | + case RT_DATA_TYPE_INT4: | ||
| 33 | + desc = "DATA_TYPE_INT4(3)"; | ||
| 34 | + break; | ||
| 35 | + case RT_DATA_TYPE_INT8: | ||
| 36 | + desc = "DATA_TYPE_INT8(4)"; | ||
| 37 | + break; | ||
| 38 | + case RT_DATA_TYPE_INT32: | ||
| 39 | + desc = "DATA_TYPE_INT32(5)"; | ||
| 40 | + break; | ||
| 41 | + case RT_DATA_TYPE_BFP16: | ||
| 42 | + desc = "DATA_TYPE_BFP16(6)"; | ||
| 43 | + break; | ||
| 44 | + case RT_DATA_TYPE_BFP32: | ||
| 45 | + desc = "DATA_TYPE_BFP32(7)"; | ||
| 46 | + break; | ||
| 47 | + case RT_DATA_TYPE_UINT8: | ||
| 48 | + desc = "DATA_TYPE_UINT8(8)"; | ||
| 49 | + break; | ||
| 50 | + case RT_DATA_TYPE_UINT16: | ||
| 51 | + desc = "DATA_TYPE_UINT16(9)"; | ||
| 52 | + break; | ||
| 53 | + case RT_DATA_TYPE_UINT32: | ||
| 54 | + desc = "DATA_TYPE_UINT32(10)"; | ||
| 55 | + break; | ||
| 56 | + case RT_DATA_TYPE_END: | ||
| 57 | + desc = "DATA_TYPE_END(11)"; | ||
| 58 | + break; | ||
| 59 | + default: | ||
| 60 | + desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 61 | + break; | ||
| 62 | + } | ||
| 63 | + return desc; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +std::string MemInfoTypeToString(const rtMemInfoType_t memInfoType) | ||
| 67 | +{ | ||
| 68 | + std::string desc; | ||
| 69 | + switch (memInfoType) { | ||
| 70 | + case RT_MEMORYINFO_DDR: | ||
| 71 | + desc = "MEMORYINFO_DDR(0)"; | ||
| 72 | + break; | ||
| 73 | + case RT_MEMORYINFO_HBM: | ||
| 74 | + desc = "MEMORYINFO_HBM(1)"; | ||
| 75 | + break; | ||
| 76 | + case RT_MEMORYINFO_DDR_HUGE: | ||
| 77 | + desc = "MEMORYINFO_DDR_HUGE(2)"; | ||
| 78 | + break; | ||
| 79 | + case RT_MEMORYINFO_DDR_NORMAL: | ||
| 80 | + desc = "MEMORYINFO_DDR_NORMAL(3)"; | ||
| 81 | + break; | ||
| 82 | + case RT_MEMORYINFO_HBM_HUGE: | ||
| 83 | + desc = "MEMORYINFO_HBM_HUGE(4)"; | ||
| 84 | + break; | ||
| 85 | + case RT_MEMORYINFO_HBM_NORMAL: | ||
| 86 | + desc = "MEMORYINFO_HBM_NORMAL(5)"; | ||
| 87 | + break; | ||
| 88 | + case RT_MEMORYINFO_DDR_P2P_HUGE: | ||
| 89 | + desc = "MEMORYINFO_DDR_P2P_HUGE(6)"; | ||
| 90 | + break; | ||
| 91 | + case RT_MEMORYINFO_DDR_P2P_NORMAL: | ||
| 92 | + desc = "MEMORYINFO_DDR_P2P_NORMAL(7)"; | ||
| 93 | + break; | ||
| 94 | + case RT_MEMORYINFO_HBM_P2P_HUGE: | ||
| 95 | + desc = "MEMORYINFO_HBM_P2P_HUGE(8)"; | ||
| 96 | + break; | ||
| 97 | + case RT_MEMORYINFO_HBM_P2P_NORMAL: | ||
| 98 | + desc = "MEMORYINFO_HBM_P2P_NORMAL(9)"; | ||
| 99 | + break; | ||
| 100 | + case RT_MEMORYINFO_HBM_HUGE1G: | ||
| 101 | + desc = "MEMORYINFO_HBM_HUGE1G(10)"; | ||
| 102 | + break; | ||
| 103 | + case RT_MEMORYINFO_HBM_P2P_HUGE1G: | ||
| 104 | + desc = "MEMORYINFO_HBM_P2P_HUGE1G(11)"; | ||
| 105 | + break; | ||
| 106 | + case RT_MEMORYINFO_NORMAL: | ||
| 107 | + desc = "MEMORYINFO_NORMAL(12)"; | ||
| 108 | + break; | ||
| 109 | + case RT_MEMORYINFO_HUGE: | ||
| 110 | + desc = "MEMORYINFO_HUGE(13)"; | ||
| 111 | + break; | ||
| 112 | + case RT_MEMORYINFO_HUGE1G: | ||
| 113 | + desc = "MEMORYINFO_HUGE1G(14)"; | ||
| 114 | + break; | ||
| 115 | + case RT_MEMORYINFO_P2P_NORMAL: | ||
| 116 | + desc = "MEMORYINFO_P2P_NORMAL(15)"; | ||
| 117 | + break; | ||
| 118 | + case RT_MEMORYINFO_P2P_HUGE: | ||
| 119 | + desc = "MEMORYINFO_P2P_HUGE(16)"; | ||
| 120 | + break; | ||
| 121 | + case RT_MEMORYINFO_P2P_HUGE1G: | ||
| 122 | + desc = "MEMORYINFO_P2P_HUGE1G(17)"; | ||
| 123 | + break; | ||
| 124 | + default: | ||
| 125 | + desc = RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(memInfoType)); | ||
| 126 | + break; | ||
| 127 | + } | ||
| 128 | + return desc; | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +const char_t* DrvMemHandleTypeToString(const rtDrvMemHandleType type) | ||
| 132 | +{ | ||
| 133 | + switch (type) { | ||
| 134 | + case RT_MEM_HANDLE_TYPE_NONE: | ||
| 135 | + return "MEM_HANDLE_TYPE_NONE(0)"; | ||
| 136 | + case RT_MEM_HANDLE_TYPE_POSIX: | ||
| 137 | + return "MEM_HANDLE_TYPE_POSIX(2)"; | ||
| 138 | + default: | ||
| 139 | + break; | ||
| 140 | + } | ||
| 141 | + static thread_local char enumBuf[32]; | ||
| 142 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 143 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 144 | + return enumBuf; | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +const char_t* MemSharedHandleTypeToString(const rtMemSharedHandleType type) | ||
| 148 | +{ | ||
| 149 | + switch (type) { | ||
| 150 | + case RT_MEM_SHARE_HANDLE_TYPE_DEFAULT: | ||
| 151 | + return "MEM_SHARE_HANDLE_TYPE_DEFAULT(1)"; | ||
| 152 | + case RT_MEM_SHARE_HANDLE_TYPE_FABRIC: | ||
| 153 | + return "MEM_SHARE_HANDLE_TYPE_FABRIC(2)"; | ||
| 154 | + default: | ||
| 155 | + break; | ||
| 156 | + } | ||
| 157 | + static thread_local char enumBuf[32]; | ||
| 158 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 159 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 160 | + return enumBuf; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +const char_t* MallocAttrToString(const rtMallocAttr attr) | ||
| 164 | +{ | ||
| 165 | + switch (attr) { | ||
| 166 | + case RT_MEM_MALLOC_ATTR_RSV: | ||
| 167 | + return "MEM_MALLOC_ATTR_RSV(0)"; | ||
| 168 | + case RT_MEM_MALLOC_ATTR_MODULE_ID: | ||
| 169 | + return "MEM_MALLOC_ATTR_MODULE_ID(1)"; | ||
| 170 | + case RT_MEM_MALLOC_ATTR_DEVICE_ID: | ||
| 171 | + return "MEM_MALLOC_ATTR_DEVICE_ID(2)"; | ||
| 172 | + case RT_MEM_MALLOC_ATTR_VA_FLAG: | ||
| 173 | + return "MEM_MALLOC_ATTR_VA_FLAG(3)"; | ||
| 174 | + case RT_MEM_MALLOC_ATTR_MAX: | ||
| 175 | + return "MEM_MALLOC_ATTR_MAX(4)"; | ||
| 176 | + default: | ||
| 177 | + break; | ||
| 178 | + } | ||
| 179 | + static thread_local char enumBuf[32]; | ||
| 180 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | ||
| 181 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 182 | + return enumBuf; | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +const char_t* FloatOverflowModeToString(const rtFloatOverflowMode_t mode) | ||
| 186 | +{ | ||
| 187 | + switch (mode) { | ||
| 188 | + case RT_OVERFLOW_MODE_SATURATION: | ||
| 189 | + return "OVERFLOW_MODE_SATURATION(0)"; | ||
| 190 | + case RT_OVERFLOW_MODE_INFNAN: | ||
| 191 | + return "OVERFLOW_MODE_INFNAN(1)"; | ||
| 192 | + case RT_OVERFLOW_MODE_UNDEF: | ||
| 193 | + return "OVERFLOW_MODE_UNDEF(2)"; | ||
| 194 | + default: | ||
| 195 | + break; | ||
| 196 | + } | ||
| 197 | + static thread_local char enumBuf[32]; | ||
| 198 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(mode)); | ||
| 199 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 200 | + return enumBuf; | ||
| 201 | +} | ||
| 202 | + | ||
| 203 | +std::string MemLocationTypeToString(const rtMemLocationType type) { return MemLocationTypeToStr(type); } | ||
| 204 | + | ||
| 205 | +std::string LimitTypeToString(const rtLimitType_t type) | ||
| 206 | +{ | ||
| 207 | + switch (type) { | ||
| 208 | + case RT_LIMIT_TYPE_LOW_POWER_TIMEOUT: | ||
| 209 | + return "LIMIT_TYPE_LOW_POWER_TIMEOUT(0)"; | ||
| 210 | + case RT_LIMIT_TYPE_SIMT_STACK_SIZE: | ||
| 211 | + return "LIMIT_TYPE_SIMT_STACK_SIZE(1)"; | ||
| 212 | + case RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE: | ||
| 213 | + return "LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE(2)"; | ||
| 214 | + case RT_LIMIT_TYPE_STACK_SIZE: | ||
| 215 | + return "LIMIT_TYPE_STACK_SIZE(3)"; | ||
| 216 | + case RT_LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE: | ||
| 217 | + return "LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE(4)"; | ||
| 218 | + case RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE: | ||
| 219 | + return "LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE(5)"; | ||
| 220 | + case RT_LIMIT_TYPE_RESERVED: | ||
| 221 | + return "LIMIT_TYPE_RESERVED(6)"; | ||
| 222 | + default: | ||
| 223 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 224 | + } | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | +const char_t* DevResLimitTypeToString(const rtDevResLimitType_t type) | ||
| 228 | +{ | ||
| 229 | + switch (type) { | ||
| 230 | + case RT_DEV_RES_CUBE_CORE: | ||
| 231 | + return "DEV_RES_CUBE_CORE(0)"; | ||
| 232 | + case RT_DEV_RES_VECTOR_CORE: | ||
| 233 | + return "DEV_RES_VECTOR_CORE(1)"; | ||
| 234 | + case RT_DEV_RES_TYPE_MAX: | ||
| 235 | + return "DEV_RES_TYPE_MAX(2)"; | ||
| 236 | + default: | ||
| 237 | + break; | ||
| 238 | + } | ||
| 239 | + static thread_local char enumBuf[32]; | ||
| 240 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 241 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 242 | + return enumBuf; | ||
| 243 | +} | ||
| 244 | + | ||
| 245 | +std::string ConditionToString(const rtCondition_t condition) | ||
| 246 | +{ | ||
| 247 | + switch (condition) { | ||
| 248 | + case RT_EQUAL: | ||
| 249 | + return "EQUAL(0)"; | ||
| 250 | + case RT_NOT_EQUAL: | ||
| 251 | + return "NOT_EQUAL(1)"; | ||
| 252 | + case RT_GREATER: | ||
| 253 | + return "GREATER(2)"; | ||
| 254 | + case RT_GREATER_OR_EQUAL: | ||
| 255 | + return "GREATER_OR_EQUAL(3)"; | ||
| 256 | + case RT_LESS: | ||
| 257 | + return "LESS(4)"; | ||
| 258 | + case RT_LESS_OR_EQUAL: | ||
| 259 | + return "LESS_OR_EQUAL(5)"; | ||
| 260 | + default: | ||
| 261 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(condition)); | ||
| 262 | + } | ||
| 263 | +} | ||
| 264 | + | ||
| 265 | +std::string KernelAttrTypeToString(const rtKernelAttrType type) | ||
| 266 | +{ | ||
| 267 | + switch (type) { | ||
| 268 | + case RT_KERNEL_ATTR_TYPE_AICORE: | ||
| 269 | + return "KERNEL_ATTR_TYPE_AICORE(0)"; | ||
| 270 | + case RT_KERNEL_ATTR_TYPE_CUBE: | ||
| 271 | + return "KERNEL_ATTR_TYPE_CUBE(1)"; | ||
| 272 | + case RT_KERNEL_ATTR_TYPE_VECTOR: | ||
| 273 | + return "KERNEL_ATTR_TYPE_VECTOR(2)"; | ||
| 274 | + case RT_KERNEL_ATTR_TYPE_MIX: | ||
| 275 | + return "KERNEL_ATTR_TYPE_MIX(3)"; | ||
| 276 | + case RT_KERNEL_ATTR_TYPE_AICPU: | ||
| 277 | + return "KERNEL_ATTR_TYPE_AICPU(100)"; | ||
| 278 | + default: | ||
| 279 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 280 | + } | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +std::string LaunchKernelAttrIdToString(const rtLaunchKernelAttrId id) | ||
| 284 | +{ | ||
| 285 | + switch (id) { | ||
| 286 | + case RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE: | ||
| 287 | + return "LAUNCH_KERNEL_ATTR_SCHEM_MODE(1)"; | ||
| 288 | + case RT_LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE: | ||
| 289 | + return "LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE(2)"; | ||
| 290 | + case RT_LAUNCH_KERNEL_ATTR_ENGINE_TYPE: | ||
| 291 | + return "LAUNCH_KERNEL_ATTR_ENGINE_TYPE(3)"; | ||
| 292 | + case RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET: | ||
| 293 | + return "LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET(4)"; | ||
| 294 | + case RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH: | ||
| 295 | + return "LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH(5)"; | ||
| 296 | + case RT_LAUNCH_KERNEL_ATTR_DATA_DUMP: | ||
| 297 | + return "LAUNCH_KERNEL_ATTR_DATA_DUMP(6)"; | ||
| 298 | + case RT_LAUNCH_KERNEL_ATTR_TIMEOUT: | ||
| 299 | + return "LAUNCH_KERNEL_ATTR_TIMEOUT(7)"; | ||
| 300 | + case RT_LAUNCH_KERNEL_ATTR_TIMEOUT_US: | ||
| 301 | + return "LAUNCH_KERNEL_ATTR_TIMEOUT_US(8)"; | ||
| 302 | + case RT_LAUNCH_KERNEL_ATTR_MAX: | ||
| 303 | + return "LAUNCH_KERNEL_ATTR_MAX(9)"; | ||
| 304 | + default: | ||
| 305 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(id)); | ||
| 306 | + } | ||
| 307 | +} | ||
| 308 | + | ||
| 309 | +const char_t* DevAttrToString(const rtDevAttr attr) | ||
| 310 | +{ | ||
| 311 | + static thread_local char enumBuf[32]; | ||
| 312 | + switch (attr) { | ||
| 313 | + case RT_DEV_ATTR_AICPU_CORE_NUM: | ||
| 314 | + return "DEV_ATTR_AICPU_CORE_NUM(1)"; | ||
| 315 | + case RT_DEV_ATTR_AICORE_CORE_NUM: | ||
| 316 | + return "DEV_ATTR_AICORE_CORE_NUM(101)"; | ||
| 317 | + case RT_DEV_ATTR_CUBE_CORE_NUM: | ||
| 318 | + return "DEV_ATTR_CUBE_CORE_NUM(102)"; | ||
| 319 | + case RT_DEV_ATTR_VECTOR_CORE_NUM: | ||
| 320 | + return "DEV_ATTR_VECTOR_CORE_NUM(201)"; | ||
| 321 | + case RT_DEV_ATTR_WARP_SIZE: | ||
| 322 | + return "DEV_ATTR_WARP_SIZE(202)"; | ||
| 323 | + case RT_DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE: | ||
| 324 | + return "DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE(203)"; | ||
| 325 | + case RT_DEV_ATTR_UBUF_PER_VECTOR_CORE: | ||
| 326 | + return "DEV_ATTR_UBUF_PER_VECTOR_CORE(204)"; | ||
| 327 | + case RT_DEV_ATTR_MAX_GRID_DIM_X: | ||
| 328 | + return "DEV_ATTR_MAX_GRID_DIM_X(205)"; | ||
| 329 | + case RT_DEV_ATTR_MAX_GRID_DIM_Y: | ||
| 330 | + return "DEV_ATTR_MAX_GRID_DIM_Y(206)"; | ||
| 331 | + case RT_DEV_ATTR_MAX_GRID_DIM_Z: | ||
| 332 | + return "DEV_ATTR_MAX_GRID_DIM_Z(207)"; | ||
| 333 | + case RT_DEV_ATTR_MAX_BLOCK_PER_GRID: | ||
| 334 | + return "DEV_ATTR_MAX_BLOCK_PER_GRID(208)"; | ||
| 335 | + case RT_DEV_ATTR_MAX_THREADS_PER_BLOCK: | ||
| 336 | + return "DEV_ATTR_MAX_THREADS_PER_BLOCK(209)"; | ||
| 337 | + case RT_DEV_ATTR_MAX_BLOCK_DIM_X: | ||
| 338 | + return "DEV_ATTR_MAX_BLOCK_DIM_X(210)"; | ||
| 339 | + case RT_DEV_ATTR_MAX_BLOCK_DIM_Y: | ||
| 340 | + return "DEV_ATTR_MAX_BLOCK_DIM_Y(211)"; | ||
| 341 | + case RT_DEV_ATTR_MAX_BLOCK_DIM_Z: | ||
| 342 | + return "DEV_ATTR_MAX_BLOCK_DIM_Z(212)"; | ||
| 343 | + case RT_DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE: | ||
| 344 | + return "DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE(301)"; | ||
| 345 | + case RT_DEV_ATTR_L2_CACHE_SIZE: | ||
| 346 | + return "DEV_ATTR_L2_CACHE_SIZE(302)"; | ||
| 347 | + case RT_DEV_ATTR_SMP_ID: | ||
| 348 | + return "DEV_ATTR_SMP_ID(401)"; | ||
| 349 | + case RT_DEV_ATTR_PHY_CHIP_ID: | ||
| 350 | + return "DEV_ATTR_PHY_CHIP_ID(402)"; | ||
| 351 | + case RT_DEV_ATTR_SUPER_POD_DEVICE_ID: | ||
| 352 | + return "DEV_ATTR_SUPER_POD_DEVICE_ID(403)"; | ||
| 353 | + case RT_DEV_ATTR_SUPER_POD_SERVER_ID: | ||
| 354 | + return "DEV_ATTR_SUPER_POD_SERVER_ID(404)"; | ||
| 355 | + case RT_DEV_ATTR_SUPER_POD_ID: | ||
| 356 | + return "DEV_ATTR_SUPER_POD_ID(405)"; | ||
| 357 | + case RT_DEV_ATTR_CUST_OP_PRIVILEGE: | ||
| 358 | + return "DEV_ATTR_CUST_OP_PRIVILEGE(406)"; | ||
| 359 | + case RT_DEV_ATTR_MAINBOARD_ID: | ||
| 360 | + return "DEV_ATTR_MAINBOARD_ID(407)"; | ||
| 361 | + case RT_DEV_ATTR_HD_CONNECT_TYPE: | ||
| 362 | + return "DEV_ATTR_HD_CONNECT_TYPE(408)"; | ||
| 363 | + case RT_DEV_ATTR_DEVICE_FORM_FACTOR: | ||
| 364 | + return "DEV_ATTR_DEVICE_FORM_FACTOR(409)"; | ||
| 365 | + case RT_DEV_ATTR_IS_VIRTUAL: | ||
| 366 | + return "DEV_ATTR_IS_VIRTUAL(501)"; | ||
| 367 | + case RT_DEV_ATTR_NPU_ARCH: | ||
| 368 | + return "DEV_ATTR_NPU_ARCH(601)"; | ||
| 369 | + case RT_DEV_ATTR_MAX: | ||
| 370 | + (void)snprintf_s( | ||
| 371 | + enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "DEV_ATTR_MAX(%d)", | ||
| 372 | + static_cast<int32_t>(RT_DEV_ATTR_MAX)); | ||
| 373 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 374 | + return enumBuf; | ||
| 375 | + default: | ||
| 376 | + break; | ||
| 377 | + } | ||
| 378 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(attr)); | ||
| 379 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 380 | + return enumBuf; | ||
| 381 | +} | ||
| 382 | + | ||
| 383 | +std::string HacTypeToString(const rtHacType type) | ||
| 384 | +{ | ||
| 385 | + switch (type) { | ||
| 386 | + case RT_HAC_TYPE_STARS: | ||
| 387 | + return "HAC_TYPE_STARS(0)"; | ||
| 388 | + case RT_HAC_TYPE_AICPU: | ||
| 389 | + return "HAC_TYPE_AICPU(1)"; | ||
| 390 | + case RT_HAC_TYPE_AIC: | ||
| 391 | + return "HAC_TYPE_AIC(2)"; | ||
| 392 | + case RT_HAC_TYPE_AIV: | ||
| 393 | + return "HAC_TYPE_AIV(3)"; | ||
| 394 | + case RT_HAC_TYPE_PCIEDMA: | ||
| 395 | + return "HAC_TYPE_PCIEDMA(4)"; | ||
| 396 | + case RT_HAC_TYPE_RDMA: | ||
| 397 | + return "HAC_TYPE_RDMA(5)"; | ||
| 398 | + case RT_HAC_TYPE_SDMA: | ||
| 399 | + return "HAC_TYPE_SDMA(6)"; | ||
| 400 | + case RT_HAC_TYPE_DVPP: | ||
| 401 | + return "HAC_TYPE_DVPP(7)"; | ||
| 402 | + case RT_HAC_TYPE_UDMA: | ||
| 403 | + return "HAC_TYPE_UDMA(8)"; | ||
| 404 | + case RT_HAC_TYPE_CCU: | ||
| 405 | + return "HAC_TYPE_CCU(9)"; | ||
| 406 | + case RT_HAC_TYPE_MAX: | ||
| 407 | + return "HAC_TYPE_MAX(10)"; | ||
| 408 | + default: | ||
| 409 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 410 | + } | ||
| 411 | +} | ||
| 412 | + | ||
| 413 | +std::string DeviceStatusToString(const rtDeviceStatus status) | ||
| 414 | +{ | ||
| 415 | + switch (status) { | ||
| 416 | + case RT_DEVICE_STATUS_NORMAL: | ||
| 417 | + return "DEVICE_STATUS_NORMAL(0)"; | ||
| 418 | + case RT_DEVICE_STATUS_ABNORMAL: | ||
| 419 | + return "DEVICE_STATUS_ABNORMAL(1)"; | ||
| 420 | + case RT_DEVICE_STATUS_END: | ||
| 421 | + return "DEVICE_STATUS_END(65535)"; | ||
| 422 | + default: | ||
| 423 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(status)); | ||
| 424 | + } | ||
| 425 | +} | ||
| 426 | + | ||
| 427 | +std::string TaskTypeToString(const rtTaskType type) | ||
| 428 | +{ | ||
| 429 | + switch (type) { | ||
| 430 | + case RT_TASK_DEFAULT: | ||
| 431 | + return "TASK_DEFAULT(0)"; | ||
| 432 | + case RT_TASK_KERNEL: | ||
| 433 | + return "TASK_KERNEL(1)"; | ||
| 434 | + case RT_TASK_EVENT_RECORD: | ||
| 435 | + return "TASK_EVENT_RECORD(2)"; | ||
| 436 | + case RT_TASK_EVENT_WAIT: | ||
| 437 | + return "TASK_EVENT_WAIT(3)"; | ||
| 438 | + case RT_TASK_EVENT_RESET: | ||
| 439 | + return "TASK_EVENT_RESET(4)"; | ||
| 440 | + case RT_TASK_VALUE_WRITE: | ||
| 441 | + return "TASK_VALUE_WRITE(5)"; | ||
| 442 | + case RT_TASK_VALUE_WAIT: | ||
| 443 | + return "TASK_VALUE_WAIT(6)"; | ||
| 444 | + default: | ||
| 445 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 446 | + } | ||
| 447 | +} | ||
| 448 | + | ||
| 449 | +} // namespace runtime | ||
| 450 | +} // namespace cce | ||
| @@ -0,0 +1,76 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +namespace cce { | ||
| 15 | +namespace runtime { | ||
| 16 | + | ||
| 17 | +std::string ManagedMemLocationTypeToString(const rtMemManagedLocationType type) | ||
| 18 | +{ | ||
| 19 | + switch (type) { | ||
| 20 | + case rtMemLocationTypeInvalid: | ||
| 21 | + return "MEM_LOCATION_TYPE_INVALID(0)"; | ||
| 22 | + case rtMemLocationTypeDevice: | ||
| 23 | + return "MEM_LOCATION_TYPE_DEVICE(1)"; | ||
| 24 | + case rtMemLocationTypeHost: | ||
| 25 | + return "MEM_LOCATION_TYPE_HOST(2)"; | ||
| 26 | + case rtMemLocationTypeHostNuma: | ||
| 27 | + return "MEM_LOCATION_TYPE_HOST_NUMA(3)"; | ||
| 28 | + case rtMemLocationTypeHostNumaCurrent: | ||
| 29 | + return "MEM_LOCATION_TYPE_HOST_NUMA_CURRENT(4)"; | ||
| 30 | + default: | ||
| 31 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 32 | + } | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +std::string MemPoolAttrToString(const rtMemPoolAttr attr) | ||
| 36 | +{ | ||
| 37 | + switch (attr) { | ||
| 38 | + case rtMemPoolReuseFollowEventDependencies: | ||
| 39 | + return "rtMemPoolReuseFollowEventDependencies(1)"; | ||
| 40 | + case rtMemPoolReuseAllowOpportunistic: | ||
| 41 | + return "rtMemPoolReuseAllowOpportunistic(2)"; | ||
| 42 | + case rtMemPoolReuseAllowInternalDependencies: | ||
| 43 | + return "rtMemPoolReuseAllowInternalDependencies(3)"; | ||
| 44 | + case rtMemPoolAttrReleaseThreshold: | ||
| 45 | + return "rtMemPoolAttrReleaseThreshold(4)"; | ||
| 46 | + case rtMemPoolAttrReservedMemCurrent: | ||
| 47 | + return "rtMemPoolAttrReservedMemCurrent(5)"; | ||
| 48 | + case rtMemPoolAttrReservedMemHigh: | ||
| 49 | + return "rtMemPoolAttrReservedMemHigh(6)"; | ||
| 50 | + case rtMemPoolAttrUsedMemCurrent: | ||
| 51 | + return "rtMemPoolAttrUsedMemCurrent(7)"; | ||
| 52 | + case rtMemPoolAttrUsedMemHigh: | ||
| 53 | + return "rtMemPoolAttrUsedMemHigh(8)"; | ||
| 54 | + default: | ||
| 55 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(attr)); | ||
| 56 | + } | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +std::string StreamCaptureStatusToString(const rtStreamCaptureStatus status) | ||
| 60 | +{ | ||
| 61 | + switch (status) { | ||
| 62 | + case RT_STREAM_CAPTURE_STATUS_NONE: | ||
| 63 | + return "STREAM_CAPTURE_STATUS_NONE(0)"; | ||
| 64 | + case RT_STREAM_CAPTURE_STATUS_ACTIVE: | ||
| 65 | + return "STREAM_CAPTURE_STATUS_ACTIVE(1)"; | ||
| 66 | + case RT_STREAM_CAPTURE_STATUS_INVALIDATED: | ||
| 67 | + return "STREAM_CAPTURE_STATUS_INVALIDATED(2)"; | ||
| 68 | + case RT_STREAM_CAPTURE_STATUS_MAX: | ||
| 69 | + return "STREAM_CAPTURE_STATUS_MAX(3)"; | ||
| 70 | + default: | ||
| 71 | + return RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(status)); | ||
| 72 | + } | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +} // namespace runtime | ||
| 76 | +} // namespace cce | ||
| @@ -32,6 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | + | ||
| 35 | 36 | ||
| 36 | 37 | ||
| 37 | 38 | ||
| @@ -3216,8 +3217,8 @@ rtError_t Context::CmoAddrTaskLaunch( | |||
| 3216 | // fill in head args | 3217 | // fill in head args |
| 3217 | InitStarsSdmaCmoSqe(&sdmaCmoSqe, stm, cmoOpCode); | 3218 | InitStarsSdmaCmoSqe(&sdmaCmoSqe, stm, cmoOpCode); |
| 3218 | RT_LOG( | 3219 | RT_LOG( |
| 3219 | - RT_LOG_DEBUG, "cmoAddrInfo=0x%llx, cmoOpCode=%d, device_id=%u, stream_id=%d", | 3220 | + RT_LOG_DEBUG, "cmoAddrInfo=0x%llx, cmoOpCode=%s, device_id=%u, stream_id=%d", |
| 3220 | - RtPtrToValue<rtCmoAddrInfo*>(cmoAddrInfo), cmoOpCode, device_->Id_(), streamId); | 3221 | + RtPtrToValue<rtCmoAddrInfo*>(cmoAddrInfo), CmoOpCodeToString(cmoOpCode).c_str(), device_->Id_(), streamId); |
| 3221 | 3222 | ||
| 3222 | Driver* const devDrv = device_->Driver_(); | 3223 | Driver* const devDrv = device_->Driver_(); |
| 3223 | if (devDrv != nullptr) { | 3224 | if (devDrv != nullptr) { |
| @@ -3406,7 +3407,7 @@ rtError_t Context::CtxGetSysParamOpt(const rtSysParamOpt configOpt, int64_t* con | |||
| 3406 | { | 3407 | { |
| 3407 | const std::unique_lock<std::mutex> mutexLock(sysParamOptLock_); | 3408 | const std::unique_lock<std::mutex> mutexLock(sysParamOptLock_); |
| 3408 | if (!sysParamOpt_[configOpt].first) { | 3409 | if (!sysParamOpt_[configOpt].first) { |
| 3409 | - RT_LOG(RT_LOG_WARNING, "SYS Config Opt(%u) did not set", configOpt); | 3410 | + RT_LOG(RT_LOG_WARNING, "SYS Config Opt(%s) did not set", SysParamOptToString(configOpt).c_str()); |
| 3410 | return RT_ERROR_NOT_SET_SYSPARAMOPT; | 3411 | return RT_ERROR_NOT_SET_SYSPARAMOPT; |
| 3411 | } | 3412 | } |
| 3412 | *configVal = sysParamOpt_[configOpt].second; | 3413 | *configVal = sysParamOpt_[configOpt].second; |
| @@ -1626,11 +1626,11 @@ bool RawDevice::ModuleRelease(Module* mdl) | |||
| 1626 | 1626 | ||
| 1627 | rtError_t RawDevice::DevSetLimit(const rtLimitType_t type, const uint32_t val) | 1627 | rtError_t RawDevice::DevSetLimit(const rtLimitType_t type, const uint32_t val) |
| 1628 | { | 1628 | { |
| 1629 | - RT_LOG(RT_LOG_WARNING, "DevSetLimit,type=%u, value=%u", static_cast<uint32_t>(type), val); | 1629 | + RT_LOG(RT_LOG_WARNING, "DevSetLimit,type=%s, value=%u", LimitTypeToString(type).c_str(), val); |
| 1630 | if (type == RT_LIMIT_TYPE_LOW_POWER_TIMEOUT) { | 1630 | if (type == RT_LIMIT_TYPE_LOW_POWER_TIMEOUT) { |
| 1631 | return RT_ERROR_NONE; | 1631 | return RT_ERROR_NONE; |
| 1632 | } | 1632 | } |
| 1633 | - RT_LOG(RT_LOG_WARNING, "limit type wrong!,type=%u", static_cast<uint32_t>(type)); | 1633 | + RT_LOG(RT_LOG_WARNING, "limit type wrong!,type=%s", LimitTypeToString(type).c_str()); |
| 1634 | return RT_ERROR_NONE; | 1634 | return RT_ERROR_NONE; |
| 1635 | } | 1635 | } |
| 1636 | 1636 | ||
| @@ -2226,7 +2226,7 @@ rtError_t RawDevice::WriteDevString(void* const dest, const size_t max, const ch | |||
| 2226 | dest, static_cast<uint64_t>(devStrLen), str, static_cast<uint64_t>(devStrLen), RT_MEMCPY_HOST_TO_DEVICE); | 2226 | dest, static_cast<uint64_t>(devStrLen), str, static_cast<uint64_t>(devStrLen), RT_MEMCPY_HOST_TO_DEVICE); |
| 2227 | ERROR_RETURN( | 2227 | ERROR_RETURN( |
| 2228 | error, "Failed to copy memory for string, size=%zu(bytes), kind=%s, retCode=%#x.", devStrLen, | 2228 | error, "Failed to copy memory for string, size=%zu(bytes), kind=%s, retCode=%#x.", devStrLen, |
| 2229 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 2229 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 2230 | return RT_ERROR_NONE; | 2230 | return RT_ERROR_NONE; |
| 2231 | } | 2231 | } |
| 2232 | 2232 | ||
| @@ -2242,7 +2242,7 @@ rtError_t RawDevice::WriteDevValue(void* const dest, const size_t size, const vo | |||
| 2242 | dest, static_cast<uint64_t>(size), data, static_cast<uint64_t>(size), RT_MEMCPY_HOST_TO_DEVICE); | 2242 | dest, static_cast<uint64_t>(size), data, static_cast<uint64_t>(size), RT_MEMCPY_HOST_TO_DEVICE); |
| 2243 | ERROR_RETURN( | 2243 | ERROR_RETURN( |
| 2244 | error, "Failed to copy memory value, size=%zu(bytes), kind=%s, retCode=%#x.", size, | 2244 | error, "Failed to copy memory value, size=%zu(bytes), kind=%s, retCode=%#x.", size, |
| 2245 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 2245 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 2246 | return RT_ERROR_NONE; | 2246 | return RT_ERROR_NONE; |
| 2247 | } | 2247 | } |
| 2248 | 2248 | ||
| @@ -106,8 +106,7 @@ rtError_t PcieArgManage::H2DArgCopy(const StarsArgLoaderResult* const result, vo | |||
| 106 | } | 106 | } |
| 107 | error = handle->argsAlloc->H2DMemCopy(dst, args, static_cast<uint64_t>(size)); | 107 | error = handle->argsAlloc->H2DMemCopy(dst, args, static_cast<uint64_t>(size)); |
| 108 | ERROR_RETURN( | 108 | ERROR_RETURN( |
| 109 | - error, "H2DMemCopy failed, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), | 109 | + error, "H2DMemCopy failed, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), error); |
| 110 | - error); | ||
| 111 | } else { | 110 | } else { |
| 112 | const errno_t ret = memcpy_s(result->kerArgs, static_cast<uint64_t>(size), args, static_cast<uint64_t>(size)); | 111 | const errno_t ret = memcpy_s(result->kerArgs, static_cast<uint64_t>(size), args, static_cast<uint64_t>(size)); |
| 113 | COND_RETURN_ERROR_MSG_CALL( | 112 | COND_RETURN_ERROR_MSG_CALL( |
| @@ -177,7 +177,7 @@ rtError_t UmaArgLoader::LoadInputOutputArgsHuge( | |||
| 177 | const uint64_t cpySize = static_cast<uint64_t>(size); | 177 | const uint64_t cpySize = static_cast<uint64_t>(size); |
| 178 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); | 178 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); |
| 179 | ERROR_RETURN( | 179 | ERROR_RETURN( |
| 180 | - error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), | 180 | + error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), |
| 181 | static_cast<uint32_t>(error)); | 181 | static_cast<uint32_t>(error)); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| @@ -205,7 +205,7 @@ rtError_t UmaArgLoader::LoadInputOutputArgs( | |||
| 205 | ((argItemSize > size) ? static_cast<uint64_t>(size) : static_cast<uint64_t>(argItemSize)); | 205 | ((argItemSize > size) ? static_cast<uint64_t>(size) : static_cast<uint64_t>(argItemSize)); |
| 206 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); | 206 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); |
| 207 | ERROR_RETURN( | 207 | ERROR_RETURN( |
| 208 | - error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), | 208 | + error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), |
| 209 | static_cast<uint32_t>(error)); | 209 | static_cast<uint32_t>(error)); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| @@ -225,7 +225,7 @@ rtError_t UmaArgLoader::LoadInputOutputArgsForMix( | |||
| 225 | UpdateArgsAddr(devAddr, argsInfo); | 225 | UpdateArgsAddr(devAddr, argsInfo); |
| 226 | error = umaArgAllocator->H2DMemCopy(devAddr, args, size); | 226 | error = umaArgAllocator->H2DMemCopy(devAddr, args, size); |
| 227 | ERROR_RETURN( | 227 | ERROR_RETURN( |
| 228 | - error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), | 228 | + error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), |
| 229 | static_cast<uint32_t>(error)); | 229 | static_cast<uint32_t>(error)); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -405,8 +405,7 @@ rtError_t UmaArgLoader::PureLoad(const uint32_t size, const void* const args, Ar | |||
| 405 | const uint32_t argItemSize = (size > itemSize_) ? maxItemSize_ : itemSize_; | 405 | const uint32_t argItemSize = (size > itemSize_) ? maxItemSize_ : itemSize_; |
| 406 | const uint64_t cpySize = ((argItemSize > size) ? static_cast<uint64_t>(size) : static_cast<uint64_t>(argItemSize)); | 406 | const uint64_t cpySize = ((argItemSize > size) ? static_cast<uint64_t>(size) : static_cast<uint64_t>(argItemSize)); |
| 407 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); | 407 | error = umaArgAllocator->H2DMemCopy(kerArgs, args, cpySize); |
| 408 | - ERROR_RETURN( | 408 | + ERROR_RETURN(error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), error); |
| 409 | - error, "H2DMemCopy, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), error); | ||
| 410 | 409 | ||
| 411 | argHandle->kerArgs = kerArgs; | 410 | argHandle->kerArgs = kerArgs; |
| 412 | argHandle->freeArgs = true; | 411 | argHandle->freeArgs = true; |
| @@ -454,7 +453,7 @@ rtError_t UmaArgLoader::LoadCpuKernelArgs( | |||
| 454 | error = umaArgAllocator->H2DMemCopy(kerArgs, argsInfo->args, cpySize); | 453 | error = umaArgAllocator->H2DMemCopy(kerArgs, argsInfo->args, cpySize); |
| 455 | ERROR_GOTO( | 454 | ERROR_GOTO( |
| 456 | error, RECYCLE, "Synchronize memcpy failed, kind=%s, retCode=%#x.", | 455 | error, RECYCLE, "Synchronize memcpy failed, kind=%s, retCode=%#x.", |
| 457 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 456 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 458 | } | 457 | } |
| 459 | 458 | ||
| 460 | result->kerArgs = (copyArgs ? umaArgAllocator->GetDevAddr(kerArgs) : argsInfo->args); | 459 | result->kerArgs = (copyArgs ? umaArgAllocator->GetDevAddr(kerArgs) : argsInfo->args); |
| @@ -530,7 +529,7 @@ rtError_t UmaArgLoader::LoadCpuKernelArgsEx( | |||
| 530 | error = umaArgAllocator->H2DMemCopy(kerArgs, argsInfo->args, cpySize); | 529 | error = umaArgAllocator->H2DMemCopy(kerArgs, argsInfo->args, cpySize); |
| 531 | ERROR_GOTO( | 530 | ERROR_GOTO( |
| 532 | error, RECYCLE, "Load cpu kernel args failed, kind=%s, retCode=%#x.", | 531 | error, RECYCLE, "Load cpu kernel args failed, kind=%s, retCode=%#x.", |
| 533 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 532 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 534 | } | 533 | } |
| 535 | 534 | ||
| 536 | result->kerArgs = (copyArgs ? umaArgAllocator->GetDevAddr(kerArgs) : argsInfo->args); | 535 | result->kerArgs = (copyArgs ? umaArgAllocator->GetDevAddr(kerArgs) : argsInfo->args); |
| @@ -684,7 +683,7 @@ rtError_t UmaArgLoader::LoadStreamSwitchNArgs( | |||
| 684 | (void)drv_->DevMemFree(valueDevAddr, device_->Id_()); | 683 | (void)drv_->DevMemFree(valueDevAddr, device_->Id_()); |
| 685 | RT_LOG( | 684 | RT_LOG( |
| 686 | RT_LOG_ERROR, "Failed to copy value to device when load stream switchN args, kind=%s, retCode=%#x", | 685 | RT_LOG_ERROR, "Failed to copy value to device when load stream switchN args, kind=%s, retCode=%#x", |
| 687 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 686 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 688 | return error; | 687 | return error; |
| 689 | } | 688 | } |
| 690 | stm->PushbackSwitchNArgs(valueDevAddr); | 689 | stm->PushbackSwitchNArgs(valueDevAddr); |
| @@ -706,7 +705,7 @@ rtError_t UmaArgLoader::LoadStreamSwitchNArgs( | |||
| 706 | (void)drv_->DevMemFree(streamIdDevAddr, device_->Id_()); | 705 | (void)drv_->DevMemFree(streamIdDevAddr, device_->Id_()); |
| 707 | RT_LOG( | 706 | RT_LOG( |
| 708 | RT_LOG_ERROR, "Failed to copy true stream ID to device, kind=%s, retCode=%#x", | 707 | RT_LOG_ERROR, "Failed to copy true stream ID to device, kind=%s, retCode=%#x", |
| 709 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 708 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 710 | return error; | 709 | return error; |
| 711 | } | 710 | } |
| 712 | 711 | ||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | namespace cce { | 20 | namespace cce { |
| 20 | namespace runtime { | 21 | namespace runtime { |
| @@ -198,7 +199,8 @@ rtError_t ConvertLaunchCfgToTaskCfg(TaskCfg& taskCfg, const rtKernelLaunchCfg_t* | |||
| 198 | break; | 199 | break; |
| 199 | default: | 200 | default: |
| 200 | RT_LOG( | 201 | RT_LOG( |
| 201 | - RT_LOG_ERROR, "Launch kernel attr type[%u] is invalid, should be [1, %u)", cfg->attrs[idx].id, | 202 | + RT_LOG_ERROR, "Launch kernel attr type[%s] is invalid, should be [%u, %u)", |
| 203 | + LaunchKernelAttrIdToString(cfg->attrs[idx].id).c_str(), RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE, | ||
| 202 | RT_LAUNCH_KERNEL_ATTR_MAX); | 204 | RT_LAUNCH_KERNEL_ATTR_MAX); |
| 203 | return RT_ERROR_INVALID_VALUE; | 205 | return RT_ERROR_INVALID_VALUE; |
| 204 | } | 206 | } |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -145,7 +146,13 @@ rtError_t BinaryLoader::ParseLoadOptions() | |||
| 145 | const rtError_t ret = SetCpuBinInfo(loadOptions_->options[idx].value); | 146 | const rtError_t ret = SetCpuBinInfo(loadOptions_->options[idx].value); |
| 146 | ERROR_RETURN(ret, "set cpu bin info failed! ret=%#x", ret); | 147 | ERROR_RETURN(ret, "set cpu bin info failed! ret=%#x", ret); |
| 147 | } else { | 148 | } else { |
| 148 | - RT_LOG_OUTER_MSG_INVALID_PARAM(optionId, "[1, " + std::to_string(RT_LOAD_BINARY_OPT_MAX) + ")"); | 149 | + RT_LOG_OUTER_MSG_WITH_FUNC( |
| 150 | + ErrorCode::EE1003, | ||
| 151 | + (optionId == RT_LOAD_BINARY_OPT_MAX) ? "LOAD_BINARY_OPT_MAX(4)" : | ||
| 152 | + RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(optionId)), | ||
| 153 | + "optionId", | ||
| 154 | + "[" + std::to_string(RT_LOAD_BINARY_OPT_LAZY_LOAD) + ", " + std::to_string(RT_LOAD_BINARY_OPT_MAX) + | ||
| 155 | + ")"); | ||
| 149 | return RT_ERROR_INVALID_VALUE; | 156 | return RT_ERROR_INVALID_VALUE; |
| 150 | } | 157 | } |
| 151 | } | 158 | } |
| @@ -254,7 +261,9 @@ rtError_t BinaryLoader::ParseKernelJsonFile(ElfProgram* const prog) const | |||
| 254 | if (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)) { | 261 | if (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)) { |
| 255 | prog->SetElfMagic(jsonMagic); | 262 | prog->SetElfMagic(jsonMagic); |
| 256 | prog->SetDefaultKernelAttrType(kernelAttrType); | 263 | prog->SetDefaultKernelAttrType(kernelAttrType); |
| 257 | - RT_LOG(RT_LOG_INFO, "Load binary from file, jsonMagic=%u, kernelAttrType=%d", jsonMagic, kernelAttrType); | 264 | + RT_LOG( |
| 265 | + RT_LOG_INFO, "Load binary from file, jsonMagic=%u, kernelAttrType=%s", jsonMagic, | ||
| 266 | + KernelAttrTypeToString(kernelAttrType).c_str()); | ||
| 258 | return RT_ERROR_NONE; | 267 | return RT_ERROR_NONE; |
| 259 | } | 268 | } |
| 260 | } | 269 | } |
| @@ -263,11 +272,13 @@ rtError_t BinaryLoader::ParseKernelJsonFile(ElfProgram* const prog) const | |||
| 263 | if (optionMagic == 0U) { | 272 | if (optionMagic == 0U) { |
| 264 | kernelAttrType = Runtime::Instance()->GetDefaultKernelAttrType(); | 273 | kernelAttrType = Runtime::Instance()->GetDefaultKernelAttrType(); |
| 265 | prog->SetDefaultKernelAttrType(kernelAttrType); | 274 | prog->SetDefaultKernelAttrType(kernelAttrType); |
| 266 | - RT_LOG(RT_LOG_INFO, "Load binary from file, kernelAttrType=%d", kernelAttrType); | 275 | + RT_LOG(RT_LOG_INFO, "Load binary from file, kernelAttrType=%s", KernelAttrTypeToString(kernelAttrType).c_str()); |
| 267 | return RT_ERROR_NONE; | 276 | return RT_ERROR_NONE; |
| 268 | } | 277 | } |
| 269 | 278 | ||
| 270 | - RT_LOG(RT_LOG_INFO, "Load binary from file, optionMagic=%u, kernelAttrType=%d", optionMagic, kernelAttrType); | 279 | + RT_LOG( |
| 280 | + RT_LOG_INFO, "Load binary from file, optionMagic=%u, kernelAttrType=%s", optionMagic, | ||
| 281 | + KernelAttrTypeToString(kernelAttrType).c_str()); | ||
| 271 | 282 | ||
| 272 | prog->SetElfMagic(optionMagic); | 283 | prog->SetElfMagic(optionMagic); |
| 273 | return RT_ERROR_NONE; | 284 | return RT_ERROR_NONE; |
| @@ -365,8 +376,8 @@ ElfProgram* BinaryLoader::LoadFromData() const | |||
| 365 | return nullptr; | 376 | return nullptr; |
| 366 | } | 377 | } |
| 367 | RT_LOG( | 378 | RT_LOG( |
| 368 | - RT_LOG_INFO, "New ElfProgram ok, magic=%u, kernelAttrType=%d, Runtime_alloc_size=%zu", magic_, kernelAttrType, | 379 | + RT_LOG_INFO, "New ElfProgram ok, magic=%u, kernelAttrType=%s, Runtime_alloc_size=%zu", magic_, |
| 369 | - sizeof(ElfProgram)); | 380 | + KernelAttrTypeToString(kernelAttrType).c_str(), sizeof(ElfProgram)); |
| 370 | 381 | ||
| 371 | if (magic_ != 0) { | 382 | if (magic_ != 0) { |
| 372 | prog->SetElfMagic(magic_); | 383 | prog->SetElfMagic(magic_); |
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | namespace cce { | 20 | namespace cce { |
| 20 | namespace runtime { | 21 | namespace runtime { |
| @@ -399,7 +400,9 @@ rtError_t GetPrefetchCntAndMixTypeWithKernel( | |||
| 399 | prefetchMaxSize2 = aivectorIcachePrefetchSizeMax; | 400 | prefetchMaxSize2 = aivectorIcachePrefetchSizeMax; |
| 400 | break; | 401 | break; |
| 401 | default: | 402 | default: |
| 402 | - RT_LOG(RT_LOG_ERROR, "get prefetch cnt failed, kernelAttrType=%d.", kernelPtr->GetKernelAttrType()); | 403 | + RT_LOG( |
| 404 | + RT_LOG_ERROR, "get prefetch cnt failed, kernelAttrType=UNKNOWN(%d).", | ||
| 405 | + static_cast<int32_t>(kernelPtr->GetKernelAttrType())); | ||
| 403 | return RT_ERROR_INVALID_VALUE; | 406 | return RT_ERROR_INVALID_VALUE; |
| 404 | } | 407 | } |
| 405 | // Icache_prefetch_cnt:aic aiv prefetch instruction length, the unit is 2KB, K=1024 | 408 | // Icache_prefetch_cnt:aic aiv prefetch instruction length, the unit is 2KB, K=1024 |
| @@ -17,6 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | + | ||
| 21 | + | ||
| 20 | 22 | ||
| 21 | namespace cce { | 23 | namespace cce { |
| 22 | namespace runtime { | 24 | namespace runtime { |
| @@ -75,8 +77,9 @@ rtError_t ConvertTaskType(const TaskInfo* const task, rtTaskType* type) | |||
| 75 | RT_LOG( | 77 | RT_LOG( |
| 76 | RT_LOG_INFO, | 78 | RT_LOG_INFO, |
| 77 | "end to get task type, streamId=%d, taskId=%u, alloc taskType=%d, taskName=%s, taskOwner=%d, convert to " | 79 | "end to get task type, streamId=%d, taskId=%u, alloc taskType=%d, taskName=%s, taskOwner=%d, convert to " |
| 78 | - "rtTaskType=%d.", | 80 | + "rtTaskType=%s.", |
| 79 | - task->stream->Id_(), task->id, task->type, task->typeName, static_cast<int32_t>(task->taskOwner), *type); | 81 | + task->stream->Id_(), task->id, task->type, task->typeName, static_cast<int32_t>(task->taskOwner), |
| 82 | + TaskTypeToString(*type).c_str()); | ||
| 80 | return RT_ERROR_NONE; | 83 | return RT_ERROR_NONE; |
| 81 | } | 84 | } |
| 82 | 85 | ||
| @@ -111,8 +114,8 @@ rtError_t ConvertTaskType(const TaskInfo* const task, rtTaskType* type) | |||
| 111 | *type = taskType; | 114 | *type = taskType; |
| 112 | RT_LOG( | 115 | RT_LOG( |
| 113 | RT_LOG_INFO, | 116 | RT_LOG_INFO, |
| 114 | - "end to get task type, streamId=%d, taskId=%u, alloc taskType=%d, taskName=%s, convert to rtTaskType=%d.", | 117 | + "end to get task type, streamId=%d, taskId=%u, alloc taskType=%d, taskName=%s, convert to rtTaskType=%s.", |
| 115 | - task->stream->Id_(), task->id, task->type, task->typeName, taskType); | 118 | + task->stream->Id_(), task->id, task->type, task->typeName, TaskTypeToString(taskType).c_str()); |
| 116 | return RT_ERROR_NONE; | 119 | return RT_ERROR_NONE; |
| 117 | } | 120 | } |
| 118 | 121 | ||
| @@ -198,13 +201,13 @@ static rtError_t UpdateKernelTaskInfoWithArgsAndCfg( | |||
| 198 | 201 | ||
| 199 | RT_LOG( | 202 | RT_LOG( |
| 200 | RT_LOG_INFO, | 203 | RT_LOG_INFO, |
| 201 | - "device_id=%u, stream_id=%d, task_id=%hu, kernelAttrType=%d, kernel_name=%s, arg_size=%u, " | 204 | + "device_id=%u, stream_id=%d, task_id=%hu, kernelAttrType=%s, kernel_name=%s, arg_size=%u, " |
| 202 | "blockDim=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " | 205 | "blockDim=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " |
| 203 | "mixType=%u, kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, " | 206 | "mixType=%u, kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, " |
| 204 | "shareMemSize=%u, kernelVfType=%u, dynamicShareMemSize=%u, simtDcuSmSize=%u.", | 207 | "shareMemSize=%u, kernelVfType=%u, dynamicShareMemSize=%u, simtDcuSmSize=%u.", |
| 205 | - dev->Id_(), stm->Id_(), taskInfo->id, kernelAttrType, kernel->Name_().c_str(), argsInfo->argsSize, blockDim, | 208 | + dev->Id_(), stm->Id_(), taskInfo->id, KernelAttrTypeToString(kernelAttrType).c_str(), kernel->Name_().c_str(), |
| 206 | - kernel->GetTaskRation(), kernel->GetFuncType(), kernelPc1, kernelPc2, mixType, aicTask->comm.kernelFlag, | 209 | + argsInfo->argsSize, blockDim, kernel->GetTaskRation(), kernel->GetFuncType(), kernelPc1, kernelPc2, mixType, |
| 207 | - aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, | 210 | + aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, |
| 208 | aicTask->inputArgsSize.atomicIndex, kernel->ShareMemSize_(), kernel->KernelVfType_(), | 211 | aicTask->inputArgsSize.atomicIndex, kernel->ShareMemSize_(), kernel->KernelVfType_(), |
| 209 | aicTask->dynamicShareMemSize, aicTask->simtDcuSmSize); | 212 | aicTask->dynamicShareMemSize, aicTask->simtDcuSmSize); |
| 210 | 213 | ||
| @@ -315,7 +318,7 @@ rtError_t GetKernelAttribute( | |||
| 315 | return RT_ERROR_INVALID_VALUE; | 318 | return RT_ERROR_INVALID_VALUE; |
| 316 | } | 319 | } |
| 317 | 320 | ||
| 318 | - RT_LOG(RT_LOG_INFO, "get kernel attrId=%d", attrId); | 321 | + RT_LOG(RT_LOG_INFO, "get kernel attrId=%s", LaunchKernelAttrIdToString(attrId).c_str()); |
| 319 | const AicTaskInfo* aicTaskInfo = &(taskInfo->u.aicTaskInfo); | 322 | const AicTaskInfo* aicTaskInfo = &(taskInfo->u.aicTaskInfo); |
| 320 | rtError_t ret = RT_ERROR_NONE; | 323 | rtError_t ret = RT_ERROR_NONE; |
| 321 | switch (attrId) { | 324 | switch (attrId) { |
| @@ -345,16 +348,16 @@ rtError_t GetKernelAttribute( | |||
| 345 | case RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET: | 348 | case RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET: |
| 346 | case RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH: | 349 | case RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH: |
| 347 | RT_LOG_OUTER_MSG_WITH_FUNC_DESC( | 350 | RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 348 | - ErrorCode::EE1003, "Obtaining kernel function attributes", attrId, "attrId", | 351 | + ErrorCode::EE1003, "Obtaining kernel function attributes", LaunchKernelAttrIdToString(attrId), "attrId", |
| 349 | - "not equal (" + std::to_string(RT_LAUNCH_KERNEL_ATTR_ENGINE_TYPE) + ", " + | 352 | + "not equal (" + LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_ENGINE_TYPE) + ", " + |
| 350 | - std::to_string(RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET) + ", " + | 353 | + LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET) + ", " + |
| 351 | - std::to_string(RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH) + ")"); | 354 | + LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH) + ")"); |
| 352 | ret = RT_ERROR_INVALID_VALUE; | 355 | ret = RT_ERROR_INVALID_VALUE; |
| 353 | break; | 356 | break; |
| 354 | default: | 357 | default: |
| 355 | RT_LOG_OUTER_MSG_WITH_FUNC_DESC( | 358 | RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 356 | - ErrorCode::EE1003, "Obtaining kernel function attributes", attrId, "attrId", | 359 | + ErrorCode::EE1003, "Obtaining kernel function attributes", LaunchKernelAttrIdToString(attrId), "attrId", |
| 357 | - "[ " + std::to_string(RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE) + ", " + | 360 | + "[" + std::to_string(RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE) + ", " + |
| 358 | std::to_string(RT_LAUNCH_KERNEL_ATTR_MAX) + ")"); | 361 | std::to_string(RT_LAUNCH_KERNEL_ATTR_MAX) + ")"); |
| 359 | ret = RT_ERROR_INVALID_VALUE; | 362 | ret = RT_ERROR_INVALID_VALUE; |
| 360 | break; | 363 | break; |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | namespace cce { | 19 | namespace cce { |
| 19 | namespace runtime { | 20 | namespace runtime { |
| @@ -116,8 +117,8 @@ rtError_t Module::Load(Program* const prog) | |||
| 116 | ERROR_GOTO( | 117 | ERROR_GOTO( |
| 117 | error, FAIL_FREE, | 118 | error, FAIL_FREE, |
| 118 | "Memcpy so names failed, size=%zu(bytes), " | 119 | "Memcpy so names failed, size=%zu(bytes), " |
| 119 | - "type=%d(RT_MEMCPY_HOST_TO_DEVICE), retCode=%#x.", | 120 | + "type=%s, retCode=%#x.", |
| 120 | - prog->GetSoName().size(), static_cast<int32_t>(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); | 121 | + prog->GetSoName().size(), MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 121 | kernelNamesSize_ = progKernelName.size() + 1U; | 122 | kernelNamesSize_ = progKernelName.size() + 1U; |
| 122 | soNamesSize_ = prog->GetSoName().size(); | 123 | soNamesSize_ = prog->GetSoName().size(); |
| 123 | } | 124 | } |
| @@ -183,8 +184,8 @@ rtError_t Module::Load(Program* const prog) | |||
| 183 | ERROR_GOTO( | 184 | ERROR_GOTO( |
| 184 | error, FAIL_FREE, | 185 | error, FAIL_FREE, |
| 185 | "Memcpy failed, size=%u(bytes)," | 186 | "Memcpy failed, size=%u(bytes)," |
| 186 | - "type=%d(RT_MEMCPY_HOST_TO_DEVICE), retCode=%#x", | 187 | + "type=%s, retCode=%#x", |
| 187 | - size, static_cast<int32_t>(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); | 188 | + size, MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 188 | } | 189 | } |
| 189 | RT_LOG(RT_LOG_DEBUG, "Load on device addr=%p, size=%u(bytes), program id=%u.", baseAddrAlign_, size, prog->Id_()); | 190 | RT_LOG(RT_LOG_DEBUG, "Load on device addr=%p, size=%u(bytes), program id=%u.", baseAddrAlign_, size, prog->Id_()); |
| 190 | programId_ = prog->Id_(); | 191 | programId_ = prog->Id_(); |
| @@ -245,8 +246,8 @@ rtError_t Module::CalModuleHash(std::size_t& hash) const | |||
| 245 | RT_MEMCPY_DEVICE_TO_HOST); | 246 | RT_MEMCPY_DEVICE_TO_HOST); |
| 246 | 247 | ||
| 247 | COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, (void)deviceDrv->HostMemFree(hostMem); | 248 | COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, (void)deviceDrv->HostMemFree(hostMem); |
| 248 | - , "Memcpy failed, size=%u(bytes), type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x.", dataSize, | 249 | + , "Memcpy failed, size=%u(bytes), type=%s, retCode=%#x.", dataSize, |
| 249 | - static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); | 250 | + MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); |
| 250 | // calculate hash | 251 | // calculate hash |
| 251 | const std::string hashStr(RtPtrToPtr<const char_t*>(hostMem), static_cast<uint64_t>(dataSize)); | 252 | const std::string hashStr(RtPtrToPtr<const char_t*>(hostMem), static_cast<uint64_t>(dataSize)); |
| 252 | hash = std::hash<std::string>{}(hashStr); | 253 | hash = std::hash<std::string>{}(hashStr); |
| @@ -304,7 +305,8 @@ rtError_t Module::GetPrefetchCnt(const Kernel* const kernelIn, uint32_t& icacheP | |||
| 304 | break; | 305 | break; |
| 305 | default: | 306 | default: |
| 306 | RT_LOG_INNER_MSG( | 307 | RT_LOG_INNER_MSG( |
| 307 | - RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=%d.", kernelIn->GetKernelAttrType()); | 308 | + RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=UNKNOWN(%d).", |
| 309 | + static_cast<int32_t>(kernelIn->GetKernelAttrType())); | ||
| 308 | return RT_ERROR_INVALID_VALUE; | 310 | return RT_ERROR_INVALID_VALUE; |
| 309 | } | 311 | } |
| 310 | 312 | ||
| @@ -360,7 +362,8 @@ rtError_t Module::GetPrefetchCnt( | |||
| 360 | break; | 362 | break; |
| 361 | default: | 363 | default: |
| 362 | RT_LOG_INNER_MSG( | 364 | RT_LOG_INNER_MSG( |
| 363 | - RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=%d.", kernelIn->GetKernelAttrType()); | 365 | + RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=UNKNOWN(%d).", |
| 366 | + static_cast<int32_t>(kernelIn->GetKernelAttrType())); | ||
| 364 | return RT_ERROR_INVALID_VALUE; | 367 | return RT_ERROR_INVALID_VALUE; |
| 365 | } | 368 | } |
| 366 | 369 | ||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | + | ||
| 25 | 26 | ||
| 26 | namespace cce { | 27 | namespace cce { |
| 27 | namespace runtime { | 28 | namespace runtime { |
| @@ -1117,10 +1118,11 @@ void ElfProgram::SetKernelAttribute(const RtKernel* const kernel, Kernel* const | |||
| 1117 | kernelObj->SetSystemParaNum(sysParamNum); | 1118 | kernelObj->SetSystemParaNum(sysParamNum); |
| 1118 | RT_LOG( | 1119 | RT_LOG( |
| 1119 | RT_LOG_INFO, | 1120 | RT_LOG_INFO, |
| 1120 | - "kernel_name=%s, kernelAttrType=%d, userParamNum=%hu, sysParamNum=%hu, " | 1121 | + "kernel_name=%s, kernelAttrType=%s, userParamNum=%hu, sysParamNum=%hu, " |
| 1121 | "IsNeedSetFftsAddrInArg=%u, isSupportOverFlow=%u, elfDataFlag=%d", | 1122 | "IsNeedSetFftsAddrInArg=%u, isSupportOverFlow=%u, elfDataFlag=%d", |
| 1122 | - kernel->name, kernelObj->GetKernelAttrType(), kernelObj->GetUserParaNum(), kernelObj->GetSystemParaNum(), | 1123 | + kernel->name, KernelAttrTypeToString(kernelObj->GetKernelAttrType()).c_str(), kernelObj->GetUserParaNum(), |
| 1123 | - kernelObj->IsNeedSetFftsAddrInArg(), kernelObj->IsSupportOverFlow(), kernelObj->ElfDataFlag()); | 1124 | + kernelObj->GetSystemParaNum(), kernelObj->IsNeedSetFftsAddrInArg(), kernelObj->IsSupportOverFlow(), |
| 1125 | + kernelObj->ElfDataFlag()); | ||
| 1124 | return; | 1126 | return; |
| 1125 | } | 1127 | } |
| 1126 | 1128 | ||
| @@ -1467,8 +1469,8 @@ rtError_t Program::BinaryMemCopySync( | |||
| 1467 | ERROR_RETURN( | 1469 | ERROR_RETURN( |
| 1468 | error, | 1470 | error, |
| 1469 | "advise dev_mem failed, adviseSize=%u(bytes)," | 1471 | "advise dev_mem failed, adviseSize=%u(bytes)," |
| 1470 | - "type=%d(RT_ADVISE_ACCESS_READWRITE), retCode=%#x, device_id=%u.", | 1472 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1471 | - adviseSize, static_cast<int32_t>(RT_ADVISE_ACCESS_READWRITE), static_cast<uint32_t>(error), devId); | 1473 | + adviseSize, "ADVISE_ACCESS_READWRITE(3)", static_cast<uint32_t>(error), devId); |
| 1472 | 1474 | ||
| 1473 | TIMESTAMP_BEGIN(BinaryMemCpy); | 1475 | TIMESTAMP_BEGIN(BinaryMemCpy); |
| 1474 | error = curDrv->MemCopySync( | 1476 | error = curDrv->MemCopySync( |
| @@ -1476,8 +1478,8 @@ rtError_t Program::BinaryMemCopySync( | |||
| 1476 | ERROR_RETURN_MSG_INNER( | 1478 | ERROR_RETURN_MSG_INNER( |
| 1477 | error, | 1479 | error, |
| 1478 | "Memcpy failed, size=%u(bytes)," | 1480 | "Memcpy failed, size=%u(bytes)," |
| 1479 | - "type=%d(RT_MEMCPY_HOST_TO_DEVICE), retCode=%#x, device_id=%u.", | 1481 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1480 | - size, static_cast<int32_t>(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error), devId); | 1482 | + size, MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error), devId); |
| 1481 | TIMESTAMP_END(BinaryMemCpy); | 1483 | TIMESTAMP_END(BinaryMemCpy); |
| 1482 | 1484 | ||
| 1483 | // after the host-to-device (H2D) transfer is completed, the memory needs to be set as read-only. | 1485 | // after the host-to-device (H2D) transfer is completed, the memory needs to be set as read-only. |
| @@ -1485,8 +1487,8 @@ rtError_t Program::BinaryMemCopySync( | |||
| 1485 | ERROR_RETURN( | 1487 | ERROR_RETURN( |
| 1486 | error, | 1488 | error, |
| 1487 | "advise dev_mem failed, adviseSize=%u(bytes)," | 1489 | "advise dev_mem failed, adviseSize=%u(bytes)," |
| 1488 | - "type=%d(RT_ADVISE_ACCESS_READONLY), retCode=%#x, device_id=%u.", | 1490 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1489 | - adviseSize, static_cast<int32_t>(RT_ADVISE_ACCESS_READONLY), static_cast<uint32_t>(error), devId); | 1491 | + adviseSize, "ADVISE_ACCESS_READONLY(2)", static_cast<uint32_t>(error), devId); |
| 1490 | 1492 | ||
| 1491 | return RT_ERROR_NONE; | 1493 | return RT_ERROR_NONE; |
| 1492 | } | 1494 | } |
| @@ -1512,8 +1514,8 @@ rtError_t Program::BinaryPoolMemCopySync( | |||
| 1512 | ERROR_RETURN( | 1514 | ERROR_RETURN( |
| 1513 | error, | 1515 | error, |
| 1514 | "advise pool_mem failed, size=%u(bytes)," | 1516 | "advise pool_mem failed, size=%u(bytes)," |
| 1515 | - "type=%d(RT_ADVISE_ACCESS_READWRITE), retCode=%#x, device_id=%u.", | 1517 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1516 | - size, static_cast<int32_t>(RT_ADVISE_ACCESS_READWRITE), static_cast<uint32_t>(error), devId); | 1518 | + size, "ADVISE_ACCESS_READWRITE(3)", static_cast<uint32_t>(error), devId); |
| 1517 | 1519 | ||
| 1518 | TIMESTAMP_BEGIN(BinaryMemCpy); | 1520 | TIMESTAMP_BEGIN(BinaryMemCpy); |
| 1519 | error = curDrv->MemCopySync( | 1521 | error = curDrv->MemCopySync( |
| @@ -1521,8 +1523,8 @@ rtError_t Program::BinaryPoolMemCopySync( | |||
| 1521 | ERROR_RETURN_MSG_INNER( | 1523 | ERROR_RETURN_MSG_INNER( |
| 1522 | error, | 1524 | error, |
| 1523 | "memcpy failed, size=%u(bytes)," | 1525 | "memcpy failed, size=%u(bytes)," |
| 1524 | - "type=%d(RT_MEMCPY_HOST_TO_DEVICE), retCode=%#x, device_id=%u.", | 1526 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1525 | - size, static_cast<int32_t>(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error), devId); | 1527 | + size, MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error), devId); |
| 1526 | TIMESTAMP_END(BinaryMemCpy); | 1528 | TIMESTAMP_END(BinaryMemCpy); |
| 1527 | 1529 | ||
| 1528 | // after the host-to-device (H2D) transfer is completed, the memory needs to be set as read-only. | 1530 | // after the host-to-device (H2D) transfer is completed, the memory needs to be set as read-only. |
| @@ -1530,8 +1532,8 @@ rtError_t Program::BinaryPoolMemCopySync( | |||
| 1530 | ERROR_RETURN( | 1532 | ERROR_RETURN( |
| 1531 | error, | 1533 | error, |
| 1532 | "advise pool_mem failed, size=%u(bytes)," | 1534 | "advise pool_mem failed, size=%u(bytes)," |
| 1533 | - "type=%d(RT_ADVISE_ACCESS_READONLY), retCode=%#x, device_id=%u.", | 1535 | + "type=%s, retCode=%#x, device_id=%u.", |
| 1534 | - size, static_cast<int32_t>(RT_ADVISE_ACCESS_READONLY), static_cast<uint32_t>(error), devId); | 1536 | + size, "ADVISE_ACCESS_READONLY(2)", static_cast<uint32_t>(error), devId); |
| 1535 | 1537 | ||
| 1536 | return RT_ERROR_NONE; | 1538 | return RT_ERROR_NONE; |
| 1537 | } | 1539 | } |
| @@ -1669,20 +1671,20 @@ rtError_t ElfProgram::GetKernelTypeAndMixType( | |||
| 1669 | 1671 | ||
| 1670 | COND_RETURN_INFO( | 1672 | COND_RETURN_INFO( |
| 1671 | (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)), RT_ERROR_NONE, | 1673 | (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)), RT_ERROR_NONE, |
| 1672 | - "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%d, mixType=%hhu", elfkernelInfo->name, | 1674 | + "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%s, mixType=%hhu", elfkernelInfo->name, |
| 1673 | - metaInfo->funcType, kernelAttrType, mixType); | 1675 | + metaInfo->funcType, KernelAttrTypeToString(kernelAttrType).c_str(), mixType); |
| 1674 | 1676 | ||
| 1675 | GetKernelTypeAndMixTypeByName(elfkernelInfo->name, kernelAttrType, mixType); | 1677 | GetKernelTypeAndMixTypeByName(elfkernelInfo->name, kernelAttrType, mixType); |
| 1676 | COND_RETURN_INFO( | 1678 | COND_RETURN_INFO( |
| 1677 | (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)), RT_ERROR_NONE, | 1679 | (kernelAttrType != static_cast<rtKernelAttrType>(RT_KERNEL_ATTR_TYPE_INVALID)), RT_ERROR_NONE, |
| 1678 | - "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%d, mixType=%hhu", elfkernelInfo->name, | 1680 | + "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%s, mixType=%hhu", elfkernelInfo->name, |
| 1679 | - metaInfo->funcType, kernelAttrType, mixType); | 1681 | + metaInfo->funcType, KernelAttrTypeToString(kernelAttrType).c_str(), mixType); |
| 1680 | 1682 | ||
| 1681 | kernelAttrType = GetDefaultKernelAttrType(); | 1683 | kernelAttrType = GetDefaultKernelAttrType(); |
| 1682 | 1684 | ||
| 1683 | RT_LOG( | 1685 | RT_LOG( |
| 1684 | - RT_LOG_INFO, "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%d, mixType=%hhu", | 1686 | + RT_LOG_INFO, "Get kernel type success, kernelName=%s, funcType=%u, kernelAttrType=%s, mixType=%hhu", |
| 1685 | - elfkernelInfo->name, metaInfo->funcType, kernelAttrType, mixType); | 1687 | + elfkernelInfo->name, metaInfo->funcType, KernelAttrTypeToString(kernelAttrType).c_str(), mixType); |
| 1686 | 1688 | ||
| 1687 | return RT_ERROR_NONE; | 1689 | return RT_ERROR_NONE; |
| 1688 | } | 1690 | } |
| @@ -1720,11 +1722,12 @@ rtError_t ElfProgram::BuildNewKernel( | |||
| 1720 | RT_LOG( | 1722 | RT_LOG( |
| 1721 | RT_LOG_INFO, | 1723 | RT_LOG_INFO, |
| 1722 | "new kernel success, size=%zu, programId=%u, original kernel_name=%s, register kernel_name=%s, " | 1724 | "new kernel success, size=%zu, programId=%u, original kernel_name=%s, register kernel_name=%s, " |
| 1723 | - "tilingKey=%llu, functionEntry=%llu, funcType=%u, kernelAttrType=%d, mixType=%hu, taskRation=%u, " | 1725 | + "tilingKey=%llu, functionEntry=%llu, funcType=%u, kernelAttrType=%s, mixType=%hu, taskRation=%u, " |
| 1724 | "offset=%u, dfxAddr=%#" PRIu64 ", dfxSize=%u", | 1726 | "offset=%u, dfxAddr=%#" PRIu64 ", dfxSize=%u", |
| 1725 | sizeof(Kernel), Id_(), elfkernelInfo->name, tripKernelName.c_str(), tilingKey, metaInfo->functionEntry, | 1727 | sizeof(Kernel), Id_(), elfkernelInfo->name, tripKernelName.c_str(), tilingKey, metaInfo->functionEntry, |
| 1726 | - metaInfo->funcType, kernelAttrType, mixType, metaInfo->taskRation, static_cast<uint32_t>(elfkernelInfo->offset), | 1728 | + metaInfo->funcType, KernelAttrTypeToString(kernelAttrType).c_str(), mixType, metaInfo->taskRation, |
| 1727 | - static_cast<uint64_t>(RtPtrToPtr<uintptr_t>(metaInfo->dfxAddr)), metaInfo->dfxSize); | 1729 | + static_cast<uint32_t>(elfkernelInfo->offset), static_cast<uint64_t>(RtPtrToPtr<uintptr_t>(metaInfo->dfxAddr)), |
| 1730 | + metaInfo->dfxSize); | ||
| 1728 | kernel = kernelObj; | 1731 | kernel = kernelObj; |
| 1729 | return RT_ERROR_NONE; | 1732 | return RT_ERROR_NONE; |
| 1730 | } | 1733 | } |
| @@ -1749,10 +1752,10 @@ rtError_t ElfProgram::MergeKernel(const RtKernel* const elfkernelInfo, Kernel* o | |||
| 1749 | RT_LOG( | 1752 | RT_LOG( |
| 1750 | RT_LOG_ERROR, | 1753 | RT_LOG_ERROR, |
| 1751 | "found the previous mix kernel but conflict. " | 1754 | "found the previous mix kernel but conflict. " |
| 1752 | - "found kernel name=[%s], kernelAttrType=%d, mixType=%hu, offset2=%u, " | 1755 | + "found kernel name=[%s], kernelAttrType=%s, mixType=%hu, offset2=%u, " |
| 1753 | - "current kernel name=[%s], kernelAttrType=%d, mixType=%hu", | 1756 | + "current kernel name=[%s], kernelAttrType=%s, mixType=%hu", |
| 1754 | - oldKernel->Name_().c_str(), oldKernelAttrType, oldMixType, oldKernel->Offset2_(), elfkernelInfo->name, | 1757 | + oldKernel->Name_().c_str(), KernelAttrTypeToString(oldKernelAttrType).c_str(), oldMixType, |
| 1755 | - kernelAttrType, mixType); | 1758 | + oldKernel->Offset2_(), elfkernelInfo->name, KernelAttrTypeToString(kernelAttrType).c_str(), mixType); |
| 1756 | return RT_ERROR_INVALID_VALUE; | 1759 | return RT_ERROR_INVALID_VALUE; |
| 1757 | } | 1760 | } |
| 1758 | 1761 | ||
| @@ -1799,10 +1802,10 @@ rtError_t ElfProgram::MergeKernel(const RtKernel* const elfkernelInfo, Kernel* o | |||
| 1799 | RT_LOG( | 1802 | RT_LOG( |
| 1800 | RT_LOG_INFO, | 1803 | RT_LOG_INFO, |
| 1801 | "merge kernel success, programId=%u, kernel name=[%s], offset1=%u, offset2=%u, " | 1804 | "merge kernel success, programId=%u, kernel name=[%s], offset1=%u, offset2=%u, " |
| 1802 | - "mixType1=%hu, mixType2=%hu, final mixType=%hu, final kernelAttrType=%d, kernelVfType=%u, shareMemSize=%u", | 1805 | + "mixType1=%hu, mixType2=%hu, final mixType=%hu, final kernelAttrType=%s, kernelVfType=%u, shareMemSize=%u", |
| 1803 | Id_(), oldKernel->Name_().c_str(), oldKernel->Offset_(), oldKernel->Offset2_(), kernelTmpMixType, mixType, | 1806 | Id_(), oldKernel->Name_().c_str(), oldKernel->Offset_(), oldKernel->Offset2_(), kernelTmpMixType, mixType, |
| 1804 | - oldKernel->GetMixType(), oldKernel->GetKernelAttrType(), oldKernel->KernelVfType_(), | 1807 | + oldKernel->GetMixType(), KernelAttrTypeToString(oldKernel->GetKernelAttrType()).c_str(), |
| 1805 | - oldKernel->ShareMemSize_()); | 1808 | + oldKernel->KernelVfType_(), oldKernel->ShareMemSize_()); |
| 1806 | return RT_ERROR_NONE; | 1809 | return RT_ERROR_NONE; |
| 1807 | } | 1810 | } |
| 1808 | 1811 | ||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | namespace cce { | 20 | namespace cce { |
| 20 | namespace runtime { | 21 | namespace runtime { |
| @@ -53,7 +54,9 @@ rtError_t GetPrefetchCnt(Kernel* const kernel) | |||
| 53 | prefetchMaxSize2 = aivectorIcachePrefetchSizeMax; | 54 | prefetchMaxSize2 = aivectorIcachePrefetchSizeMax; |
| 54 | break; | 55 | break; |
| 55 | default: | 56 | default: |
| 56 | - RT_LOG_INNER_MSG(RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=%d.", kernel->GetKernelAttrType()); | 57 | + RT_LOG_INNER_MSG( |
| 58 | + RT_LOG_ERROR, "Get prefetch cnt failed, kernelAttrType=%s.", | ||
| 59 | + KernelAttrTypeToString(kernel->GetKernelAttrType()).c_str()); | ||
| 57 | return RT_ERROR_INVALID_VALUE; | 60 | return RT_ERROR_INVALID_VALUE; |
| 58 | } | 61 | } |
| 59 | 62 | ||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | + | ||
| 29 | 30 | ||
| 30 | namespace cce { | 31 | namespace cce { |
| 31 | namespace runtime { | 32 | namespace runtime { |
| @@ -80,7 +81,8 @@ rtError_t InternalLaunchKernelPrepare( | |||
| 80 | (tsId == 1U)) || | 81 | (tsId == 1U)) || |
| 81 | ((kernelAttrType == RT_KERNEL_ATTR_TYPE_VECTOR) && (tsId == 0U)), | 82 | ((kernelAttrType == RT_KERNEL_ATTR_TYPE_VECTOR) && (tsId == 0U)), |
| 82 | RT_ERROR_PROGRAM_MACHINE_TYPE, | 83 | RT_ERROR_PROGRAM_MACHINE_TYPE, |
| 83 | - "Launch kernel failed, current ts doesn't support the task! type=%d, tsid=%u.", kernelAttrType, tsId); | 84 | + "Launch kernel failed, current ts doesn't support the task! type=%s, tsid=%u.", |
| 85 | + KernelAttrTypeToString(kernelAttrType).c_str(), tsId); | ||
| 84 | } | 86 | } |
| 85 | addr1 = 0ULL; | 87 | addr1 = 0ULL; |
| 86 | addr2 = 0ULL; | 88 | addr2 = 0ULL; |
| @@ -105,12 +107,13 @@ rtError_t InternalLaunchKernelPrepare( | |||
| 105 | kernelAttrType = registeredKernel->GetKernelAttrType(); | 107 | kernelAttrType = registeredKernel->GetKernelAttrType(); |
| 106 | COND_RETURN_ERROR_MSG_INNER( | 108 | COND_RETURN_ERROR_MSG_INNER( |
| 107 | static_cast<uint32_t>(kernelAttrType) == RT_KERNEL_ATTR_TYPE_INVALID, RT_ERROR_PROGRAM_MACHINE_TYPE, | 109 | static_cast<uint32_t>(kernelAttrType) == RT_KERNEL_ATTR_TYPE_INVALID, RT_ERROR_PROGRAM_MACHINE_TYPE, |
| 108 | - "Launch kernel failed, kernelAttrType failed! invalid type, current kernelAttrType=%d," | 110 | + "Launch kernel failed, kernelAttrType failed! invalid type, current kernelAttrType=%s," |
| 109 | - " valid kernelAttrType range is [%u, %u].", | 111 | + " valid kernelAttrType range is [%d, %d].", |
| 110 | - kernelAttrType, RT_KERNEL_ATTR_TYPE_AICORE, RT_KERNEL_ATTR_TYPE_MIX); | 112 | + KernelAttrTypeToString(kernelAttrType).c_str(), RT_KERNEL_ATTR_TYPE_AICORE, RT_KERNEL_ATTR_TYPE_MIX); |
| 111 | COND_RETURN_ERROR_MSG_INNER( | 113 | COND_RETURN_ERROR_MSG_INNER( |
| 112 | kernelAttrType == RT_KERNEL_ATTR_TYPE_AICPU, RT_ERROR_FEATURE_NOT_SUPPORT, | 114 | kernelAttrType == RT_KERNEL_ATTR_TYPE_AICPU, RT_ERROR_FEATURE_NOT_SUPPORT, |
| 113 | - "Launch kernel failed, not support CCE Aicpu kernel task, kernelAttrType=%d.", kernelAttrType); | 115 | + "Launch kernel failed, not support CCE Aicpu kernel task, kernelAttrType=%s.", |
| 116 | + KernelAttrTypeToString(kernelAttrType).c_str()); | ||
| 114 | 117 | ||
| 115 | if (device->GetDevProperties().enabledTSNum == ENABLED_TS_NUM_2) { | 118 | if (device->GetDevProperties().enabledTSNum == ENABLED_TS_NUM_2) { |
| 116 | const uint32_t tsId = device->DevGetTsId(); | 119 | const uint32_t tsId = device->DevGetTsId(); |
| @@ -119,7 +122,8 @@ rtError_t InternalLaunchKernelPrepare( | |||
| 119 | (tsId == 1U)) || | 122 | (tsId == 1U)) || |
| 120 | ((kernelAttrType == RT_KERNEL_ATTR_TYPE_VECTOR) && (tsId == 0U)), | 123 | ((kernelAttrType == RT_KERNEL_ATTR_TYPE_VECTOR) && (tsId == 0U)), |
| 121 | RT_ERROR_PROGRAM_MACHINE_TYPE, | 124 | RT_ERROR_PROGRAM_MACHINE_TYPE, |
| 122 | - "Launch kernel failed, current ts doesn't support the task! type=%d, tsid=%u.", kernelAttrType, tsId); | 125 | + "Launch kernel failed, current ts doesn't support the task! type=%s, tsid=%u.", |
| 126 | + KernelAttrTypeToString(kernelAttrType).c_str(), tsId); | ||
| 123 | } | 127 | } |
| 124 | mdl = ctx->GetModule(prog); | 128 | mdl = ctx->GetModule(prog); |
| 125 | TIMESTAMP_END(rtKernelLaunch_GetModule); | 129 | TIMESTAMP_END(rtKernelLaunch_GetModule); |
| @@ -163,11 +167,12 @@ rtError_t InternalUpdateTaskPrepare( | |||
| 163 | RT_LOG( | 167 | RT_LOG( |
| 164 | RT_LOG_ERROR, | 168 | RT_LOG_ERROR, |
| 165 | "check kernel type failed, device_id=%u, stream_id=%d, task_id=%hu, " | 169 | "check kernel type failed, device_id=%u, stream_id=%d, task_id=%hu, " |
| 166 | - "old mixType=%u, funcType=%u, kernelAttrType=%d, " | 170 | + "old mixType=%u, funcType=%u, kernelAttrType=%s, " |
| 167 | - "new mixType=%u, funcType=%u, kernelAttrType=%d.", | 171 | + "new mixType=%u, funcType=%u, kernelAttrType=%s.", |
| 168 | device->Id_(), updateTask->stream->Id_(), updateTask->id, updateTask->u.aicTaskInfo.kernel->GetMixType(), | 172 | device->Id_(), updateTask->stream->Id_(), updateTask->id, updateTask->u.aicTaskInfo.kernel->GetMixType(), |
| 169 | - updateTask->u.aicTaskInfo.kernel->GetFuncType(), updateTask->u.aicTaskInfo.kernel->GetKernelAttrType(), | 173 | + updateTask->u.aicTaskInfo.kernel->GetFuncType(), |
| 170 | - kernel->GetMixType(), kernel->GetFuncType(), kernel->GetKernelAttrType()); | 174 | + KernelAttrTypeToString(updateTask->u.aicTaskInfo.kernel->GetKernelAttrType()).c_str(), kernel->GetMixType(), |
| 175 | + kernel->GetFuncType(), KernelAttrTypeToString(kernel->GetKernelAttrType()).c_str()); | ||
| 171 | return RT_ERROR_KERNEL_TYPE; | 176 | return RT_ERROR_KERNEL_TYPE; |
| 172 | } | 177 | } |
| 173 | 178 | ||
| @@ -616,8 +621,8 @@ rtError_t StreamLaunchKernelV2( | |||
| 616 | } | 621 | } |
| 617 | error = CheckMixKernelValid(mixType, kernelPc2); | 622 | error = CheckMixKernelValid(mixType, kernelPc2); |
| 618 | ERROR_GOTO_MSG_INNER( | 623 | ERROR_GOTO_MSG_INNER( |
| 619 | - error, ERROR_FREE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%d, retCode=%#x.", | 624 | + error, ERROR_FREE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%s, retCode=%#x.", |
| 620 | - stm->Id_(), kernTask->id, kernelAttrType, error); | 625 | + stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), error); |
| 621 | 626 | ||
| 622 | COND_PROC( | 627 | COND_PROC( |
| 623 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), | 628 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), |
| @@ -626,8 +631,8 @@ rtError_t StreamLaunchKernelV2( | |||
| 626 | AicTaskInit( | 631 | AicTaskInit( |
| 627 | kernTask, kernel, kernelAttrType, static_cast<uint16_t>(coreDim), extendAgrs->taskCfg, isNeedAllocSqeDevBuf); | 632 | kernTask, kernel, kernelAttrType, static_cast<uint16_t>(coreDim), extendAgrs->taskCfg, isNeedAllocSqeDevBuf); |
| 628 | ERROR_GOTO_MSG_INNER( | 633 | ERROR_GOTO_MSG_INNER( |
| 629 | - error, ERROR_FREE, "Init kernel task failed, stream_id=%d, task_id=%hu, kernelAttrType=%d, retCode=%#x.", | 634 | + error, ERROR_FREE, "Init kernel task failed, stream_id=%d, task_id=%hu, kernelAttrType=%s, retCode=%#x.", |
| 630 | - stm->Id_(), kernTask->id, kernelAttrType, error); | 635 | + stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), error); |
| 631 | 636 | ||
| 632 | aicTask = &kernTask->u.aicTaskInfo; | 637 | aicTask = &kernTask->u.aicTaskInfo; |
| 633 | if (copyFlag) { | 638 | if (copyFlag) { |
| @@ -644,14 +649,15 @@ rtError_t StreamLaunchKernelV2( | |||
| 644 | 649 | ||
| 645 | RT_LOG( | 650 | RT_LOG( |
| 646 | RT_LOG_INFO, | 651 | RT_LOG_INFO, |
| 647 | - "kernel info : device_id=%u, stream_id=%d, task_id=%hu, kernelAttrType=%d, kernel_name=%s, " | 652 | + "kernel info : device_id=%u, stream_id=%d, task_id=%hu, kernelAttrType=%s, kernel_name=%s, " |
| 648 | "arg_size=%u, coreDim=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " | 653 | "arg_size=%u, coreDim=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " |
| 649 | "mixType=%u, kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, " | 654 | "mixType=%u, kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, " |
| 650 | "prefetchCnt1=%u, prefetchCnt2=%u, isNoNeedH2DCopy=%u.", | 655 | "prefetchCnt1=%u, prefetchCnt2=%u, isNoNeedH2DCopy=%u.", |
| 651 | - device->Id_(), stm->Id_(), kernTask->id, kernelAttrType, kernel->Name_().c_str(), argsInfo->argsSize, coreDim, | 656 | + device->Id_(), stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), |
| 652 | - kernel->GetTaskRation(), kernel->GetFuncType(), kernelPc1, kernelPc2, mixType, aicTask->comm.kernelFlag, | 657 | + kernel->Name_().c_str(), argsInfo->argsSize, coreDim, kernel->GetTaskRation(), kernel->GetFuncType(), kernelPc1, |
| 653 | - aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, | 658 | + kernelPc2, mixType, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, aicTask->schemMode, |
| 654 | - aicTask->inputArgsSize.atomicIndex, prefetchCnt1, prefetchCnt2, argsInfo->isNoNeedH2DCopy); | 659 | + aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex, prefetchCnt1, prefetchCnt2, |
| 660 | + argsInfo->isNoNeedH2DCopy); | ||
| 655 | 661 | ||
| 656 | TIMESTAMP_BEGIN(rtLaunchKernel_SubMit); | 662 | TIMESTAMP_BEGIN(rtLaunchKernel_SubMit); |
| 657 | error = InternalLaunchKernelSubmit(ctx, kernTask, stm, argsInfo, result, nullptr); | 663 | error = InternalLaunchKernelSubmit(ctx, kernTask, stm, argsInfo, result, nullptr); |
| @@ -758,8 +764,8 @@ rtError_t StreamLaunchKernelV1( | |||
| 758 | } | 764 | } |
| 759 | error = CheckMixKernelValid(mixType, addr2); | 765 | error = CheckMixKernelValid(mixType, addr2); |
| 760 | ERROR_GOTO_MSG_INNER( | 766 | ERROR_GOTO_MSG_INNER( |
| 761 | - error, ERROR_RECYCLE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%d, retCode=%#x.", | 767 | + error, ERROR_RECYCLE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%s, retCode=%#x.", |
| 762 | - stm->Id_(), kernTask->id, kernelAttrType, error); | 768 | + stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), error); |
| 763 | 769 | ||
| 764 | COND_PROC( | 770 | COND_PROC( |
| 765 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), | 771 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), |
| @@ -784,13 +790,14 @@ rtError_t StreamLaunchKernelV1( | |||
| 784 | 790 | ||
| 785 | RT_LOG( | 791 | RT_LOG( |
| 786 | RT_LOG_INFO, | 792 | RT_LOG_INFO, |
| 787 | - "device_id=%lu, stream_id=%d, task_id=%hu, kernelAttrType=%d, kernel_name=%s, arg_size=%u, " | 793 | + "device_id=%lu, stream_id=%d, task_id=%hu, kernelAttrType=%s, kernel_name=%s, arg_size=%u, " |
| 788 | "taskRation=%u, funcType=%u, coreDim=%u, mixType=%hhu, addr1=0x%llx, addr2=0x%llx, stubFunc=%p, " | 794 | "taskRation=%u, funcType=%u, coreDim=%u, mixType=%hhu, addr1=0x%llx, addr2=0x%llx, stubFunc=%p, " |
| 789 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, isNoNeedH2DCopy=%u, " | 795 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%lu, isNoNeedH2DCopy=%u, " |
| 790 | "isUpdateSinkSqe=%u.", | 796 | "isUpdateSinkSqe=%u.", |
| 791 | - device->Id_(), stm->Id_(), kernTask->id, kernelAttrType, registeredKernel->Name_().c_str(), argsInfo->argsSize, | 797 | + device->Id_(), stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), |
| 792 | - registeredKernel->GetTaskRation(), registeredKernel->GetFuncType(), coreDim, mixType, addr1, addr2, stubFunc, | 798 | + registeredKernel->Name_().c_str(), argsInfo->argsSize, registeredKernel->GetTaskRation(), |
| 793 | - aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, | 799 | + registeredKernel->GetFuncType(), coreDim, mixType, addr1, addr2, stubFunc, aicTask->comm.kernelFlag, |
| 800 | + aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, | ||
| 794 | aicTask->inputArgsSize.atomicIndex, argsInfo->isNoNeedH2DCopy, kernTask->isUpdateSinkSqe); | 801 | aicTask->inputArgsSize.atomicIndex, argsInfo->isNoNeedH2DCopy, kernTask->isUpdateSinkSqe); |
| 795 | 802 | ||
| 796 | error = InternalLaunchKernelSubmit(ctx, kernTask, stm, argsInfo, result, prog); | 803 | error = InternalLaunchKernelSubmit(ctx, kernTask, stm, argsInfo, result, prog); |
| @@ -901,8 +908,8 @@ rtError_t StreamLaunchKernelWithHandle( | |||
| 901 | 908 | ||
| 902 | error = CheckMixKernelValid(mixType, addr2); | 909 | error = CheckMixKernelValid(mixType, addr2); |
| 903 | ERROR_GOTO_MSG_INNER( | 910 | ERROR_GOTO_MSG_INNER( |
| 904 | - error, ERROR_FREE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%d, retCode=%#x.", | 911 | + error, ERROR_FREE, "Mix kernel check failed, stream_id=%d, task_id=%hu, kernelAttrType=%s, retCode=%#x.", |
| 905 | - stm->Id_(), kernTask->id, kernelAttrType, error); | 912 | + stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), error); |
| 906 | 913 | ||
| 907 | COND_PROC( | 914 | COND_PROC( |
| 908 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), | 915 | ((kernTask->isUpdateSinkSqe == 1U) && (!(kernTask->stream->IsSoftwareSqEnable()))), |
| @@ -935,11 +942,11 @@ rtError_t StreamLaunchKernelWithHandle( | |||
| 935 | 942 | ||
| 936 | RT_LOG( | 943 | RT_LOG( |
| 937 | RT_LOG_INFO, | 944 | RT_LOG_INFO, |
| 938 | - "kernel info : device_id=%lu, stream_id=%d, task_id=%hu, kernelAttrType=%d, kernel_name=%s, " | 945 | + "kernel info : device_id=%lu, stream_id=%d, task_id=%hu, kernelAttrType=%s, kernel_name=%s, " |
| 939 | "arg_size=%u, coreDim=%u, mixType=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " | 946 | "arg_size=%u, coreDim=%u, mixType=%u, taskRation=%u, funcType=%u, addr1=0x%llx, addr2=0x%llx, " |
| 940 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u, " | 947 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u, " |
| 941 | "isNoNeedH2DCopy=%u, isUpdateSinkSqe=%u.", | 948 | "isNoNeedH2DCopy=%u, isUpdateSinkSqe=%u.", |
| 942 | - device->Id_(), stm->Id_(), kernTask->id, kernelAttrType, | 949 | + device->Id_(), stm->Id_(), kernTask->id, KernelAttrTypeToString(kernelAttrType).c_str(), |
| 943 | (tilingKey == DEFAULT_TILING_KEY) ? "" : registeredKernel->Name_().c_str(), argsInfo->argsSize, coreDim, | 950 | (tilingKey == DEFAULT_TILING_KEY) ? "" : registeredKernel->Name_().c_str(), argsInfo->argsSize, coreDim, |
| 944 | mixType, taskRation, funcType, addr1, addr2, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, | 951 | mixType, taskRation, funcType, addr1, addr2, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, |
| 945 | aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex, | 952 | aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex, |
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | + | ||
| 24 | 25 | ||
| 25 | namespace cce { | 26 | namespace cce { |
| 26 | namespace runtime { | 27 | namespace runtime { |
| @@ -290,11 +291,12 @@ static rtError_t CheckUpdateDavidTaskInfo( | |||
| 290 | RT_LOG_INNER_MSG( | 291 | RT_LOG_INNER_MSG( |
| 291 | RT_LOG_ERROR, | 292 | RT_LOG_ERROR, |
| 292 | "check kernel type failed, stream_id=%d, task_id=%hu, " | 293 | "check kernel type failed, stream_id=%d, task_id=%hu, " |
| 293 | - "old mixType=%u, funcType=%u, kernelAttrType=%d, " | 294 | + "old mixType=%u, funcType=%u, kernelAttrType=%s, " |
| 294 | - "new mixType=%u, funcType=%u, kernelAttrType=%d.", | 295 | + "new mixType=%u, funcType=%u, kernelAttrType=%s.", |
| 295 | updateTask->stream->Id_(), updateTask->id, updateTask->u.aicTaskInfo.kernel->GetMixType(), | 296 | updateTask->stream->Id_(), updateTask->id, updateTask->u.aicTaskInfo.kernel->GetMixType(), |
| 296 | - updateTask->u.aicTaskInfo.kernel->GetFuncType(), updateTask->u.aicTaskInfo.kernel->GetKernelAttrType(), | 297 | + updateTask->u.aicTaskInfo.kernel->GetFuncType(), |
| 297 | - kernel->GetMixType(), kernel->GetFuncType(), kernel->GetKernelAttrType()); | 298 | + KernelAttrTypeToString(updateTask->u.aicTaskInfo.kernel->GetKernelAttrType()).c_str(), kernel->GetMixType(), |
| 299 | + kernel->GetFuncType(), KernelAttrTypeToString(kernel->GetKernelAttrType()).c_str()); | ||
| 298 | return RT_ERROR_KERNEL_TYPE; | 300 | return RT_ERROR_KERNEL_TYPE; |
| 299 | } | 301 | } |
| 300 | 302 | ||
| @@ -329,8 +331,9 @@ rtError_t StreamLaunchKernelV1( | |||
| 329 | mixType = registeredKernel->GetMixType(); | 331 | mixType = registeredKernel->GetMixType(); |
| 330 | error = CheckMixKernelValid(mixType, addr2); | 332 | error = CheckMixKernelValid(mixType, addr2); |
| 331 | ERROR_PROC_RETURN_MSG_INNER(error, rt->PutProgram(prog); | 333 | ERROR_PROC_RETURN_MSG_INNER(error, rt->PutProgram(prog); |
| 332 | - , "Failed to check mix kernel, stream_id=%d, kernelAttrType=%d, retCode=%#x.", | 334 | + , "Failed to check mix kernel, stream_id=%d, kernelAttrType=%s, retCode=%#x.", |
| 333 | - stm->Id_(), kernelAttrType, static_cast<uint32_t>(error)); | 335 | + stm->Id_(), KernelAttrTypeToString(kernelAttrType).c_str(), |
| 336 | + static_cast<uint32_t>(error)); | ||
| 334 | 337 | ||
| 335 | DavidStream* davidStm = static_cast<DavidStream*>(stm); | 338 | DavidStream* davidStm = static_cast<DavidStream*>(stm); |
| 336 | bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); | 339 | bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); |
| @@ -351,8 +354,8 @@ rtError_t StreamLaunchKernelV1( | |||
| 351 | if (kernelTask->isUpdateSinkSqe == 1U) { // 此处失败,仅本次任务不更新,但继续保留老任务 | 354 | if (kernelTask->isUpdateSinkSqe == 1U) { // 此处失败,仅本次任务不更新,但继续保留老任务 |
| 352 | error = CheckUpdateDavidTaskInfo(kernelTask, registeredKernel, stm); | 355 | error = CheckUpdateDavidTaskInfo(kernelTask, registeredKernel, stm); |
| 353 | ERROR_RETURN_MSG_INNER( | 356 | ERROR_RETURN_MSG_INNER( |
| 354 | - error, "stream_id=%d, kernelAttrType=%d, retCode=%#x.", stm->Id_(), kernelAttrType, | 357 | + error, "stream_id=%d, kernelAttrType=%s, retCode=%#x.", stm->Id_(), |
| 355 | - static_cast<uint32_t>(error)); | 358 | + KernelAttrTypeToString(kernelAttrType).c_str(), static_cast<uint32_t>(error)); |
| 356 | } else { | 359 | } else { |
| 357 | SaveTaskCommonInfo(kernelTask, dstStm, pos); | 360 | SaveTaskCommonInfo(kernelTask, dstStm, pos); |
| 358 | } | 361 | } |
| @@ -375,13 +378,14 @@ rtError_t StreamLaunchKernelV1( | |||
| 375 | aicTask->progHandle = prog; | 378 | aicTask->progHandle = prog; |
| 376 | RT_LOG( | 379 | RT_LOG( |
| 377 | RT_LOG_INFO, | 380 | RT_LOG_INFO, |
| 378 | - "stream_id=%d, kernel_name=%s, kernelAttrType=%d, funcType=%u, arg_size=%u, taskRation=%u, " | 381 | + "stream_id=%d, kernel_name=%s, kernelAttrType=%s, funcType=%u, arg_size=%u, taskRation=%u, " |
| 379 | "mixType=%hhu, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " | 382 | "mixType=%hhu, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " |
| 380 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u.", | 383 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u.", |
| 381 | - stm->Id_(), registeredKernel->Name_().c_str(), kernelAttrType, registeredKernel->GetFuncType(), | 384 | + stm->Id_(), registeredKernel->Name_().c_str(), KernelAttrTypeToString(kernelAttrType).c_str(), |
| 382 | - argsInfo->argsSize, registeredKernel->GetTaskRation(), mixType, registeredKernel->KernelVfType_(), | 385 | + registeredKernel->GetFuncType(), argsInfo->argsSize, registeredKernel->GetTaskRation(), mixType, |
| 383 | - aicTask->dynamicShareMemSize, addr1, addr2, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, | 386 | + registeredKernel->KernelVfType_(), aicTask->dynamicShareMemSize, addr1, addr2, aicTask->comm.kernelFlag, |
| 384 | - aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex); | 387 | + aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, |
| 388 | + aicTask->inputArgsSize.atomicIndex); | ||
| 385 | 389 | ||
| 386 | if (kernelTask->isUpdateSinkSqe == 1U) { | 390 | if (kernelTask->isUpdateSinkSqe == 1U) { |
| 387 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); | 391 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); |
| @@ -448,8 +452,9 @@ rtError_t StreamLaunchKernelWithHandle( | |||
| 448 | } | 452 | } |
| 449 | error = CheckMixKernelValid(mixType, addr2); | 453 | error = CheckMixKernelValid(mixType, addr2); |
| 450 | ERROR_PROC_RETURN_MSG_INNER(error, rt->PutProgram(prog); | 454 | ERROR_PROC_RETURN_MSG_INNER(error, rt->PutProgram(prog); |
| 451 | - , "Failed to check mix kernel, stream_id=%d, kernelAttrType=%d, retCode=%#x.", | 455 | + , "Failed to check mix kernel, stream_id=%d, kernelAttrType=%s, retCode=%#x.", |
| 452 | - stm->Id_(), kernelAttrType, static_cast<uint32_t>(error)); | 456 | + stm->Id_(), KernelAttrTypeToString(kernelAttrType).c_str(), |
| 457 | + static_cast<uint32_t>(error)); | ||
| 453 | DavidStream* davidStm = static_cast<DavidStream*>(stm); | 458 | DavidStream* davidStm = static_cast<DavidStream*>(stm); |
| 454 | const bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); | 459 | const bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); |
| 455 | uint32_t pos = 0xFFFFU; | 460 | uint32_t pos = 0xFFFFU; |
| @@ -492,12 +497,12 @@ rtError_t StreamLaunchKernelWithHandle( | |||
| 492 | aicTask->funcAddr1 = addr2; | 497 | aicTask->funcAddr1 = addr2; |
| 493 | RT_LOG( | 498 | RT_LOG( |
| 494 | RT_LOG_INFO, | 499 | RT_LOG_INFO, |
| 495 | - "stream_id=%d, kernel_name=%s, kernelAttrType=%d, funcType=%u, " | 500 | + "stream_id=%d, kernel_name=%s, kernelAttrType=%s, funcType=%u, " |
| 496 | "arg_size=%u, mixType=%hhu, taskRation=%u, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " | 501 | "arg_size=%u, mixType=%hhu, taskRation=%u, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " |
| 497 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u.", | 502 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u.", |
| 498 | - stm->Id_(), name.c_str(), kernelAttrType, funcType, argsInfo->argsSize, mixType, taskRation, kernelVfType, | 503 | + stm->Id_(), name.c_str(), KernelAttrTypeToString(kernelAttrType).c_str(), funcType, argsInfo->argsSize, mixType, |
| 499 | - aicTask->dynamicShareMemSize, addr1, addr2, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, | 504 | + taskRation, kernelVfType, aicTask->dynamicShareMemSize, addr1, addr2, aicTask->comm.kernelFlag, aicTask->qos, |
| 500 | - aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex); | 505 | + aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex); |
| 501 | if (kernelTask->isUpdateSinkSqe == 1U) { | 506 | if (kernelTask->isUpdateSinkSqe == 1U) { |
| 502 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); | 507 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); |
| 503 | if ((error != RT_ERROR_NONE) && (kernelTask->u.aicTaskInfo.oldArgHandle != nullptr)) { | 508 | if ((error != RT_ERROR_NONE) && (kernelTask->u.aicTaskInfo.oldArgHandle != nullptr)) { |
| @@ -573,8 +578,8 @@ rtError_t StreamLaunchKernelV2( | |||
| 573 | 578 | ||
| 574 | error = CheckMixKernelValid(mixType, kernelPc2); | 579 | error = CheckMixKernelValid(mixType, kernelPc2); |
| 575 | ERROR_RETURN_MSG_INNER( | 580 | ERROR_RETURN_MSG_INNER( |
| 576 | - error, "Failed to check mix kernel, stream_id=%d, kernelAttrType=%d, retCode=%#x.", stm->Id_(), kernelAttrType, | 581 | + error, "Failed to check mix kernel, stream_id=%d, kernelAttrType=%s, retCode=%#x.", stm->Id_(), |
| 577 | - static_cast<uint32_t>(error)); | 582 | + KernelAttrTypeToString(kernelAttrType).c_str(), static_cast<uint32_t>(error)); |
| 578 | DavidStream* davidStm = static_cast<DavidStream*>(stm); | 583 | DavidStream* davidStm = static_cast<DavidStream*>(stm); |
| 579 | bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); | 584 | bool useArgPool = UseArgsPool(davidStm, argsInfo, stm->IsTaskGroupUpdate()); |
| 580 | 585 | ||
| @@ -593,8 +598,8 @@ rtError_t StreamLaunchKernelV2( | |||
| 593 | if (kernelTask->isUpdateSinkSqe == 1U) { | 598 | if (kernelTask->isUpdateSinkSqe == 1U) { |
| 594 | error = CheckUpdateDavidTaskInfo(kernelTask, kernel, stm); | 599 | error = CheckUpdateDavidTaskInfo(kernelTask, kernel, stm); |
| 595 | ERROR_RETURN_MSG_INNER( | 600 | ERROR_RETURN_MSG_INNER( |
| 596 | - error, "Failed to check update task info, stream_id=%d, kernelAttrType=%d, retCode=%#x.", stm->Id_(), | 601 | + error, "Failed to check update task info, stream_id=%d, kernelAttrType=%s, retCode=%#x.", stm->Id_(), |
| 597 | - kernelAttrType, static_cast<uint32_t>(error)); | 602 | + KernelAttrTypeToString(kernelAttrType).c_str(), static_cast<uint32_t>(error)); |
| 598 | } else { | 603 | } else { |
| 599 | SaveTaskCommonInfo(kernelTask, dstStm, pos); | 604 | SaveTaskCommonInfo(kernelTask, dstStm, pos); |
| 600 | } | 605 | } |
| @@ -619,14 +624,15 @@ rtError_t StreamLaunchKernelV2( | |||
| 619 | SetSimtTaskParams(aicTask, extendAgrs); | 624 | SetSimtTaskParams(aicTask, extendAgrs); |
| 620 | RT_LOG( | 625 | RT_LOG( |
| 621 | RT_LOG_INFO, | 626 | RT_LOG_INFO, |
| 622 | - "stream_id=%d, kernel_name=%s, kernelAttrType=%d, funcType=%u, arg_size=%u, mixType=%hhu, " | 627 | + "stream_id=%d, kernel_name=%s, kernelAttrType=%s, funcType=%u, arg_size=%u, mixType=%hhu, " |
| 623 | "coreDim=%u, taskRation=%u, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " | 628 | "coreDim=%u, taskRation=%u, kernelVfType=%u, dynamicSmSize=%u, addr1=0x%llx, addr2=0x%llx, " |
| 624 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u, " | 629 | "kernelFlag=0x%x, qos=%u, partId=%u, schemMode=%u, infoAddr=%p, atomicIndex=%u, " |
| 625 | "groupDim=%u, groupBlockDim=%u.", | 630 | "groupDim=%u, groupBlockDim=%u.", |
| 626 | - stm->Id_(), kernel->Name_().c_str(), kernelAttrType, kernel->GetFuncType(), argsInfo->argsSize, mixType, | 631 | + stm->Id_(), kernel->Name_().c_str(), KernelAttrTypeToString(kernelAttrType).c_str(), kernel->GetFuncType(), |
| 627 | - coreDim, kernel->GetTaskRation(), kernel->KernelVfType_(), aicTask->dynamicShareMemSize, kernelPc1, kernelPc2, | 632 | + argsInfo->argsSize, mixType, coreDim, kernel->GetTaskRation(), kernel->KernelVfType_(), |
| 628 | - aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, aicTask->schemMode, aicTask->inputArgsSize.infoAddr, | 633 | + aicTask->dynamicShareMemSize, kernelPc1, kernelPc2, aicTask->comm.kernelFlag, aicTask->qos, aicTask->partId, |
| 629 | - aicTask->inputArgsSize.atomicIndex, aicTask->groupDim, aicTask->groupBlockDim); | 634 | + aicTask->schemMode, aicTask->inputArgsSize.infoAddr, aicTask->inputArgsSize.atomicIndex, aicTask->groupDim, |
| 635 | + aicTask->groupBlockDim); | ||
| 630 | 636 | ||
| 631 | if (kernelTask->isUpdateSinkSqe == 1U) { | 637 | if (kernelTask->isUpdateSinkSqe == 1U) { |
| 632 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); | 638 | error = UpdateDavidKernelTaskSubmit(kernelTask, stm); |
| @@ -96,8 +96,8 @@ rtError_t MemSetAsync( | |||
| 96 | const rtError_t error = stm->Device_()->Driver_()->PtrGetAttributes(ptr, &attributes); | 96 | const rtError_t error = stm->Device_()->Driver_()->PtrGetAttributes(ptr, &attributes); |
| 97 | ERROR_RETURN_MSG_INNER(error, "get pointer attribute failed, retCode=%#x.", error); | 97 | ERROR_RETURN_MSG_INNER(error, "get pointer attribute failed, retCode=%#x.", error); |
| 98 | RT_LOG( | 98 | RT_LOG( |
| 99 | - RT_LOG_DEBUG, "memset memory type is %u, fillVal=%u, fillCount=%" PRIu64 ", destMax=%" PRIu64 ".", | 99 | + RT_LOG_DEBUG, "memset memory type is %s, fillVal=%u, fillCount=%" PRIu64 ", destMax=%" PRIu64 ".", |
| 100 | - attributes.location.type, fillVal, fillCount, destMax); | 100 | + MemLocationTypeToString(attributes.location.type).c_str(), fillVal, fillCount, destMax); |
| 101 | 101 | ||
| 102 | if ((attributes.location.type == RT_MEMORY_LOC_HOST) || (attributes.location.type == RT_MEMORY_LOC_UNREGISTERED)) { | 102 | if ((attributes.location.type == RT_MEMORY_LOC_HOST) || (attributes.location.type == RT_MEMORY_LOC_UNREGISTERED)) { |
| 103 | const errno_t ret = memset_s(ptr, destMax, static_cast<int32_t>(fillVal), fillCount); | 103 | const errno_t ret = memset_s(ptr, destMax, static_cast<int32_t>(fillVal), fillCount); |
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | + | ||
| 12 | 13 | ||
| 13 | namespace cce { | 14 | namespace cce { |
| 14 | namespace runtime { | 15 | namespace runtime { |
| @@ -18,18 +19,24 @@ const char_t* MemLocationTypeToStr(const rtMemLocationType type) | |||
| 18 | { | 19 | { |
| 19 | switch (type) { | 20 | switch (type) { |
| 20 | case RT_MEMORY_LOC_HOST: | 21 | case RT_MEMORY_LOC_HOST: |
| 21 | - return "RT_MEMORY_LOCATION_HOST"; | 22 | + return "MEMORY_LOC_HOST(0)"; |
| 22 | case RT_MEMORY_LOC_DEVICE: | 23 | case RT_MEMORY_LOC_DEVICE: |
| 23 | - return "RT_MEMORY_LOCATION_DEVICE"; | 24 | + return "MEMORY_LOC_DEVICE(1)"; |
| 24 | case RT_MEMORY_LOC_UNREGISTERED: | 25 | case RT_MEMORY_LOC_UNREGISTERED: |
| 25 | - return "RT_MEMORY_LOCATION_UNREGISTERED"; | 26 | + return "MEMORY_LOC_UNREGISTERED(2)"; |
| 26 | case RT_MEMORY_LOC_MANAGED: | 27 | case RT_MEMORY_LOC_MANAGED: |
| 27 | - return "RT_MEMORY_LOCATION_MANAGED"; | 28 | + return "MEMORY_LOC_MANAGED(3)"; |
| 28 | case RT_MEMORY_LOC_HOST_NUMA: | 29 | case RT_MEMORY_LOC_HOST_NUMA: |
| 29 | - return "RT_MEMORY_LOC_HOST_NUMA"; | 30 | + return "MEMORY_LOC_HOST_NUMA(4)"; |
| 31 | + case RT_MEMORY_LOC_MAX: | ||
| 32 | + return "MEMORY_LOC_MAX(5)"; | ||
| 30 | default: | 33 | default: |
| 31 | - return "RT_MEMORY_LOCATION_MAX"; | 34 | + break; |
| 32 | } | 35 | } |
| 36 | + static thread_local char enumBuf[32]; | ||
| 37 | + (void)snprintf_s(enumBuf, sizeof(enumBuf), sizeof(enumBuf) - 1, "UNKNOWN(%d)", static_cast<int32_t>(type)); | ||
| 38 | + enumBuf[sizeof(enumBuf) - 1U] = '\0'; | ||
| 39 | + return enumBuf; | ||
| 33 | } | 40 | } |
| 34 | 41 | ||
| 35 | uint16_t GetMemcpyBatchCopyKind(const rtMemcpyBatchAttr& attr) | 42 | uint16_t GetMemcpyBatchCopyKind(const rtMemcpyBatchAttr& attr) |
| @@ -91,7 +91,7 @@ rtError_t H2HCopyMgr::H2DMemCopy(void* dst, const void* const src, const uint32_ | |||
| 91 | COND_RETURN_ERROR_MSG_CALL( | 91 | COND_RETURN_ERROR_MSG_CALL( |
| 92 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_INVALID_VALUE, | 92 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_INVALID_VALUE, |
| 93 | "%s failed. Reason: Standard function memcpy_s failed. [Errno %d] %s. size=%u, offset=%u, kind=%s.", | 93 | "%s failed. Reason: Standard function memcpy_s failed. [Errno %d] %s. size=%u, offset=%u, kind=%s.", |
| 94 | - __func__, ret, strerror(ret), size, offset, MemcpyKindToString(RT_MEMCPY_HOST_TO_HOST).c_str()); | 94 | + __func__, ret, strerror(ret), size, offset, MemcpyKindToStr(RT_MEMCPY_HOST_TO_HOST)); |
| 95 | offset += curSize; | 95 | offset += curSize; |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| @@ -184,7 +184,7 @@ rtError_t OnlineProf::GetOnlineProfilingData( | |||
| 184 | error, | 184 | error, |
| 185 | "Copy memory from ts to runtime failed, size=%u, kind=%s, " | 185 | "Copy memory from ts to runtime failed, size=%u, kind=%s, " |
| 186 | "retCode=%#x.", | 186 | "retCode=%#x.", |
| 187 | - ONLINEPROF_MEM_SIZE, MemcpyKindToString(RT_MEMCPY_DEVICE_TO_HOST).c_str(), static_cast<uint32_t>(error)); | 187 | + ONLINEPROF_MEM_SIZE, MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); |
| 188 | 188 | ||
| 189 | onlineProfAddr = RtPtrToValue(hostTsMem); | 189 | onlineProfAddr = RtPtrToValue(hostTsMem); |
| 190 | rtProfDataInfo_t* const profTsSourceData = RtValueToPtr<rtProfDataInfo_t*>(onlineProfAddr + ONLINEPROF_HEAD_SIZE); | 190 | rtProfDataInfo_t* const profTsSourceData = RtValueToPtr<rtProfDataInfo_t*>(onlineProfAddr + ONLINEPROF_HEAD_SIZE); |
| @@ -59,6 +59,7 @@ | |||
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | + | ||
| 62 | 63 | ||
| 63 | 64 | ||
| 64 | 65 | ||
| @@ -1650,8 +1651,8 @@ rtError_t Runtime::MallocProgramAndReg(const rtDevBinary_t* const bin, Program** | |||
| 1650 | case RT_DEV_BINARY_MAGIC_PLAIN_AIVEC: | 1651 | case RT_DEV_BINARY_MAGIC_PLAIN_AIVEC: |
| 1651 | prog = new (std::nothrow) PlainProgram(kernelAttrType); | 1652 | prog = new (std::nothrow) PlainProgram(kernelAttrType); |
| 1652 | RT_LOG( | 1653 | RT_LOG( |
| 1653 | - RT_LOG_INFO, "new PlainProgram ok, magic=%#x, kernelAttrType=%d, Runtime_alloc_size=%zu", bin->magic, | 1654 | + RT_LOG_INFO, "new PlainProgram ok, magic=%#x, kernelAttrType=%s, Runtime_alloc_size=%zu", bin->magic, |
| 1654 | - kernelAttrType, sizeof(PlainProgram)); | 1655 | + KernelAttrTypeToString(kernelAttrType).c_str(), sizeof(PlainProgram)); |
| 1655 | break; | 1656 | break; |
| 1656 | case RT_DEV_BINARY_MAGIC_ELF: | 1657 | case RT_DEV_BINARY_MAGIC_ELF: |
| 1657 | case RT_DEV_BINARY_MAGIC_ELF_AICUBE: | 1658 | case RT_DEV_BINARY_MAGIC_ELF_AICUBE: |
| @@ -1659,8 +1660,8 @@ rtError_t Runtime::MallocProgramAndReg(const rtDevBinary_t* const bin, Program** | |||
| 1659 | case RT_DEV_BINARY_MAGIC_ELF_AIVEC: | 1660 | case RT_DEV_BINARY_MAGIC_ELF_AIVEC: |
| 1660 | prog = new (std::nothrow) ElfProgram(kernelAttrType); | 1661 | prog = new (std::nothrow) ElfProgram(kernelAttrType); |
| 1661 | RT_LOG( | 1662 | RT_LOG( |
| 1662 | - RT_LOG_INFO, "new ElfProgram ok, magic=%#x, kernelAttrType=%d, Runtime_alloc_size=%zu", bin->magic, | 1663 | + RT_LOG_INFO, "new ElfProgram ok, magic=%#x, kernelAttrType=%s, Runtime_alloc_size=%zu", bin->magic, |
| 1663 | - kernelAttrType, sizeof(ElfProgram)); | 1664 | + KernelAttrTypeToString(kernelAttrType).c_str(), sizeof(ElfProgram)); |
| 1664 | break; | 1665 | break; |
| 1665 | default: | 1666 | default: |
| 1666 | RT_LOG_CALL_MSG(ERR_MODULE_GE, "Program register failed, magic error, magic: %#x.", bin->magic); | 1667 | RT_LOG_CALL_MSG(ERR_MODULE_GE, "Program register failed, magic error, magic: %#x.", bin->magic); |
| @@ -4937,8 +4938,8 @@ rtError_t Runtime::BinaryLoad(const Device* const device, Program* const prog) | |||
| 4937 | 4938 | ||
| 4938 | if (error != RT_ERROR_NONE) { | 4939 | if (error != RT_ERROR_NONE) { |
| 4939 | RT_LOG( | 4940 | RT_LOG( |
| 4940 | - RT_LOG_ERROR, "Memcpy failed, size=%u(bytes), type=%d(RT_MEMCPY_HOST_TO_DEVICE), retCode=%#x", size, | 4941 | + RT_LOG_ERROR, "Memcpy failed, size=%u(bytes), type=%s, retCode=%#x", size, |
| 4941 | - static_cast<int32_t>(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); | 4942 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 4942 | BinaryMemFree(device, prog, alignSize); | 4943 | BinaryMemFree(device, prog, alignSize); |
| 4943 | return error; | 4944 | return error; |
| 4944 | } | 4945 | } |
| @@ -5551,7 +5552,7 @@ void Runtime::ProcHBMRas(const uint32_t devId) | |||
| 5551 | // wait next cycle, check cqe error | 5552 | // wait next cycle, check cqe error |
| 5552 | rtDeviceStatus deviceStatus = RT_DEVICE_STATUS_NORMAL; | 5553 | rtDeviceStatus deviceStatus = RT_DEVICE_STATUS_NORMAL; |
| 5553 | rtError_t error = GetWatchDogDevStatus(devId, &deviceStatus); | 5554 | rtError_t error = GetWatchDogDevStatus(devId, &deviceStatus); |
| 5554 | - RT_LOG(RT_LOG_ERROR, "get WatchDogDevStatus, ret=%u.", deviceStatus); | 5555 | + RT_LOG(RT_LOG_ERROR, "get WatchDogDevStatus, ret=%s.", DeviceStatusToString(deviceStatus).c_str()); |
| 5555 | if (error == RT_ERROR_NONE && deviceStatus == RT_DEVICE_STATUS_NORMAL) { | 5556 | if (error == RT_ERROR_NONE && deviceStatus == RT_DEVICE_STATUS_NORMAL) { |
| 5556 | RtHbmRasInfo rasInfo = {}; | 5557 | RtHbmRasInfo rasInfo = {}; |
| 5557 | rasInfo.eventId = HBM_ECC_EVENT_ID; | 5558 | rasInfo.eventId = HBM_ECC_EVENT_ID; |
| @@ -5736,7 +5737,9 @@ void Runtime::ProcPageFault(Device* const device, const uint32_t value) | |||
| 5736 | const uint32_t devId = device->Id_(); | 5737 | const uint32_t devId = device->Id_(); |
| 5737 | rtDeviceStatus deviceStatus = RT_DEVICE_STATUS_NORMAL; | 5738 | rtDeviceStatus deviceStatus = RT_DEVICE_STATUS_NORMAL; |
| 5738 | const rtError_t error = GetWatchDogDevStatus(devId, &deviceStatus); | 5739 | const rtError_t error = GetWatchDogDevStatus(devId, &deviceStatus); |
| 5739 | - RT_LOG(RT_LOG_ERROR, "ProcPageFault start, drv devId=%u, get WatchDogDevStatus, ret=%u.", devId, deviceStatus); | 5740 | + RT_LOG( |
| 5741 | + RT_LOG_ERROR, "ProcPageFault start, drv devId=%u, get WatchDogDevStatus, ret=%s.", devId, | ||
| 5742 | + DeviceStatusToString(deviceStatus).c_str()); | ||
| 5740 | if (error == RT_ERROR_NONE && deviceStatus == RT_DEVICE_STATUS_NORMAL) { | 5743 | if (error == RT_ERROR_NONE && deviceStatus == RT_DEVICE_STATUS_NORMAL) { |
| 5741 | device->SetDevicePageFault(true); | 5744 | device->SetDevicePageFault(true); |
| 5742 | RT_LOG(RT_LOG_ERROR, "PageFault occurred, drv devId=%u, current page fault count=%u.", devId, value); | 5745 | RT_LOG(RT_LOG_ERROR, "PageFault occurred, drv devId=%u, current page fault count=%u.", devId, value); |
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | + | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -83,7 +84,8 @@ rtError_t StreamLaunchKernelPrepare( | |||
| 83 | kernelAttrType = registeredKernel->GetKernelAttrType(); | 84 | kernelAttrType = registeredKernel->GetKernelAttrType(); |
| 84 | COND_RETURN_ERROR_MSG_INNER( | 85 | COND_RETURN_ERROR_MSG_INNER( |
| 85 | kernelAttrType == RT_KERNEL_ATTR_TYPE_AICPU, RT_ERROR_FEATURE_NOT_SUPPORT, | 86 | kernelAttrType == RT_KERNEL_ATTR_TYPE_AICPU, RT_ERROR_FEATURE_NOT_SUPPORT, |
| 86 | - "Launch kernel failed, not support CCE Aicpu kernel task, kernelAttrType=%d.", kernelAttrType); | 87 | + "Launch kernel failed, not support CCE Aicpu kernel task, kernelAttrType=%s.", |
| 88 | + KernelAttrTypeToString(kernelAttrType).c_str()); | ||
| 87 | 89 | ||
| 88 | mdl = stm->Context_()->GetModule(prog); | 90 | mdl = stm->Context_()->GetModule(prog); |
| 89 | TIMESTAMP_END(rtKernelLaunch_GetModule); | 91 | TIMESTAMP_END(rtKernelLaunch_GetModule); |
| @@ -175,8 +177,8 @@ rtError_t CmoAddrTaskLaunchForDavid( | |||
| 175 | // fill in head args | 177 | // fill in head args |
| 176 | InitStarsCmoSqeForDavid(&sdmaCmoSqe, dstStm, cmoOpCode); | 178 | InitStarsCmoSqeForDavid(&sdmaCmoSqe, dstStm, cmoOpCode); |
| 177 | RT_LOG( | 179 | RT_LOG( |
| 178 | - RT_LOG_DEBUG, "cmoAddrInfo=0x%llx, cmoOpCode=%d, device_id=%u, stream_id=%d.", RtPtrToValue(cmoAddrInfo), | 180 | + RT_LOG_DEBUG, "cmoAddrInfo=0x%llx, cmoOpCode=%s, device_id=%u, stream_id=%d.", RtPtrToValue(cmoAddrInfo), |
| 179 | - cmoOpCode, dev->Id_(), streamId); | 181 | + CmoOpCodeToString(cmoOpCode).c_str(), dev->Id_(), streamId); |
| 180 | Driver* const devDrv = dev->Driver_(); | 182 | Driver* const devDrv = dev->Driver_(); |
| 181 | if (devDrv != nullptr) { | 183 | if (devDrv != nullptr) { |
| 182 | constexpr uint64_t dstMax = 28ULL; | 184 | constexpr uint64_t dstMax = 28ULL; |
| @@ -22,12 +22,12 @@ rtError_t HostTaskMemCpy::AsyncCall() | |||
| 22 | const rtError_t retCode = drv_->MemCopyAsync(dst_, destMax_, src_, cnt_, kind_, copyFd_); | 22 | const rtError_t retCode = drv_->MemCopyAsync(dst_, destMax_, src_, cnt_, kind_, copyFd_); |
| 23 | TIMESTAMP_END(rtMemcpyHostTask_MemCopyAsync); | 23 | TIMESTAMP_END(rtMemcpyHostTask_MemCopyAsync); |
| 24 | COND_RETURN_ERROR( | 24 | COND_RETURN_ERROR( |
| 25 | - retCode != RT_ERROR_NONE, retCode, "MemCopyAsync failed, kind=%s, retCode=%#x.", | 25 | + retCode != RT_ERROR_NONE, retCode, "MemCopyAsync failed, kind=%s, retCode=%#x.", MemcpyKindToStr(kind_), |
| 26 | - MemcpyKindToString(kind_).c_str(), static_cast<uint32_t>(retCode)); | 26 | + static_cast<uint32_t>(retCode)); |
| 27 | RT_LOG( | 27 | RT_LOG( |
| 28 | RT_LOG_INFO, | 28 | RT_LOG_INFO, |
| 29 | - "HostTaskMemCpy AsyncCall success. destMax=%" PRIu64 ", size=%" PRIu64 ", kind=%u copyFd_=%" PRIu64, destMax_, | 29 | + "HostTaskMemCpy AsyncCall success. destMax=%" PRIu64 ", size=%" PRIu64 ", kind=%s copyFd_=%" PRIu64, destMax_, |
| 30 | - cnt_, static_cast<uint32_t>(kind_), copyFd_); | 30 | + cnt_, MemcpyKindToStr(kind_), copyFd_); |
| 31 | 31 | ||
| 32 | return RT_ERROR_NONE; | 32 | return RT_ERROR_NONE; |
| 33 | } | 33 | } |
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | + | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | 15 | ||
| @@ -65,7 +66,9 @@ void ConvertConditionToBranchFunc3( | |||
| 65 | isNeedReverseCmpReg = true; | 66 | isNeedReverseCmpReg = true; |
| 66 | break; | 67 | break; |
| 67 | default: | 68 | default: |
| 68 | - RT_LOG(RT_LOG_WARNING, "condition=%d does not support, use equal instead.", condition); | 69 | + RT_LOG( |
| 70 | + RT_LOG_WARNING, "condition=UNKNOWN(%d) does not support, use equal instead.", | ||
| 71 | + static_cast<int32_t>(condition)); | ||
| 69 | func3 = RT_STARS_COND_ISA_BRANCH_FUNC3_BEQ; | 72 | func3 = RT_STARS_COND_ISA_BRANCH_FUNC3_BEQ; |
| 70 | isNeedReverseCmpReg = false; | 73 | isNeedReverseCmpReg = false; |
| 71 | break; | 74 | break; |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | namespace cce { | 19 | namespace cce { |
| 19 | namespace runtime { | 20 | namespace runtime { |
| @@ -192,8 +193,8 @@ void PrintErrorInfoForCmoTask(TaskInfo* taskInfo, const uint32_t devId) | |||
| 192 | if (error != RT_ERROR_NONE) { | 193 | if (error != RT_ERROR_NONE) { |
| 193 | (void)dev->Driver_()->HostMemFree(hostMemSrc); | 194 | (void)dev->Driver_()->HostMemFree(hostMemSrc); |
| 194 | RT_LOG( | 195 | RT_LOG( |
| 195 | - RT_LOG_ERROR, "Memcpy failed, size=%lu(bytes), type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x", | 196 | + RT_LOG_ERROR, "Memcpy failed, size=%lu(bytes), type=%s, retCode=%#x", rtCmoAddrInfoSize, |
| 196 | - rtCmoAddrInfoSize, static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); | 197 | + MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); |
| 197 | return; | 198 | return; |
| 198 | } | 199 | } |
| 199 | 200 | ||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | namespace cce { | 16 | namespace cce { |
| 16 | namespace runtime { | 17 | namespace runtime { |
| @@ -132,8 +133,8 @@ void PrintErrorInfoForDavidCmoTask(TaskInfo* taskInfo, const uint32_t devId) | |||
| 132 | sizeof(rtDavidCmoAddrInfo), RT_MEMCPY_DEVICE_TO_HOST); | 133 | sizeof(rtDavidCmoAddrInfo), RT_MEMCPY_DEVICE_TO_HOST); |
| 133 | if (error != RT_ERROR_NONE) { | 134 | if (error != RT_ERROR_NONE) { |
| 134 | RT_LOG( | 135 | RT_LOG( |
| 135 | - RT_LOG_ERROR, "Memcpy failed, size=%lu(Bytes), type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x", | 136 | + RT_LOG_ERROR, "Memcpy failed, size=%lu(Bytes), type=%s, retCode=%#x", sizeof(rtDavidCmoAddrInfo), |
| 136 | - sizeof(rtDavidCmoAddrInfo), static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); | 137 | + MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); |
| 137 | return; | 138 | return; |
| 138 | } | 139 | } |
| 139 | 140 | ||
| @@ -135,7 +135,7 @@ uint64_t GetFuncCallMemSizeForCaptureCondTask(rtCondTaskType_t type) | |||
| 135 | return sizeof(RtStarsCaptureWhileCondFc); | 135 | return sizeof(RtStarsCaptureWhileCondFc); |
| 136 | 136 | ||
| 137 | default: | 137 | default: |
| 138 | - RT_LOG(RT_LOG_ERROR, "Invalid cond type, cond type=%d", type); | 138 | + RT_LOG(RT_LOG_ERROR, "Invalid cond type=%s", CondTaskTypeToString(type).c_str()); |
| 139 | return 0U; | 139 | return 0U; |
| 140 | } | 140 | } |
| 141 | } | 141 | } |
| @@ -254,7 +254,8 @@ void CaptureConditionTaskUnInit(TaskInfo* const taskInfo) | |||
| 254 | 254 | ||
| 255 | rtError_t CheckCondTaskParamsSize(rtCondTaskParams params) | 255 | rtError_t CheckCondTaskParamsSize(rtCondTaskParams params) |
| 256 | { | 256 | { |
| 257 | - RT_LOG(RT_LOG_DEBUG, "condition type=%u, condition size=%u", params.type, params.size); | 257 | + RT_LOG( |
| 258 | + RT_LOG_DEBUG, "condition type=%s, condition size=%u", CondTaskTypeToString(params.type).c_str(), params.size); | ||
| 258 | switch (params.type) { | 259 | switch (params.type) { |
| 259 | case RT_COND_TASK_TYPE_IF: | 260 | case RT_COND_TASK_TYPE_IF: |
| 260 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( | 261 | COND_RETURN_AND_MSG_OUTER_WITH_PARAM_DESC( |
| @@ -375,7 +376,9 @@ static rtError_t ConstructCaptureCondTaskFc(CaptureConditionTaskInfo* condTaskIn | |||
| 375 | COND_RETURN_ERROR(ret != EOK, RT_ERROR_SEC_HANDLE, "memcpy fcSwitch failed."); | 376 | COND_RETURN_ERROR(ret != EOK, RT_ERROR_SEC_HANDLE, "memcpy fcSwitch failed."); |
| 376 | } break; | 377 | } break; |
| 377 | default: | 378 | default: |
| 378 | - RT_LOG(RT_LOG_ERROR, "unsupported condType=%d.", condTaskInfo->condHandle->GetCondType()); | 379 | + RT_LOG( |
| 380 | + RT_LOG_ERROR, "unsupported condType=%s.", | ||
| 381 | + CondTaskTypeToString(condTaskInfo->condHandle->GetCondType()).c_str()); | ||
| 379 | return RT_ERROR_INVALID_VALUE; | 382 | return RT_ERROR_INVALID_VALUE; |
| 380 | } | 383 | } |
| 381 | 384 | ||
| @@ -395,7 +398,7 @@ void ConstructCaptureCondTaskDeltaOffset(rtCondTaskType_t condType, rtStarsCaptu | |||
| 395 | para.deltaOffset = offsetof(RtStarsCaptureSwitchCondFc, modelExe) / sizeof(uint32_t); | 398 | para.deltaOffset = offsetof(RtStarsCaptureSwitchCondFc, modelExe) / sizeof(uint32_t); |
| 396 | break; | 399 | break; |
| 397 | default: | 400 | default: |
| 398 | - RT_LOG(RT_LOG_EVENT, "unsupported condType=%d.", condType); | 401 | + RT_LOG(RT_LOG_EVENT, "unsupported condType=%s.", CondTaskTypeToString(condType).c_str()); |
| 399 | } | 402 | } |
| 400 | } | 403 | } |
| 401 | 404 | ||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + | ||
| 22 | 23 | ||
| 23 | namespace cce { | 24 | namespace cce { |
| 24 | namespace runtime { | 25 | namespace runtime { |
| @@ -108,10 +109,12 @@ void ConstructSqeForStreamSwitchTask(TaskInfo* taskInfo, rtStarsSqe_t* const com | |||
| 108 | RT_LOG( | 109 | RT_LOG( |
| 109 | RT_LOG_INFO, | 110 | RT_LOG_INFO, |
| 110 | "StreamSwitchTask current streamId=%d, taskId=%hu, trueStreamId=%u, type=%u, sqeSubType=%" PRIu16 | 111 | "StreamSwitchTask current streamId=%d, taskId=%hu, trueStreamId=%u, type=%u, sqeSubType=%" PRIu16 |
| 111 | - ", preP=%u, condition=%d, dataType=%d, leftPtr=%" PRIu64 ", rightPtr=%" PRIu64 ".", | 112 | + ", preP=%u, condition=%s, dataType=%s, leftPtr=%" PRIu64 ", rightPtr=%" PRIu64 ".", |
| 112 | stm->Id_(), taskInfo->id, streamSwitchTask->trueStreamId, static_cast<unsigned int>(sqe->header.type), | 113 | stm->Id_(), taskInfo->id, streamSwitchTask->trueStreamId, static_cast<unsigned int>(sqe->header.type), |
| 113 | - sqe->header.u.sqeSubType, static_cast<unsigned int>(sqe->header.preP), sqe->u.streamSwitchExInfo.condition, | 114 | + sqe->header.u.sqeSubType, static_cast<unsigned int>(sqe->header.preP), |
| 114 | - sqe->u.streamSwitchExInfo.dataType, sqe->u.streamSwitchExInfo.varPtr, sqe->u.streamSwitchExInfo.valPtr); | 115 | + ConditionToString(streamSwitchTask->condition).c_str(), |
| 116 | + SwitchDataTypeToString(streamSwitchTask->dataType).c_str(), sqe->u.streamSwitchExInfo.varPtr, | ||
| 117 | + sqe->u.streamSwitchExInfo.valPtr); | ||
| 115 | 118 | ||
| 116 | return; | 119 | return; |
| 117 | } | 120 | } |
| @@ -30,6 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | + | ||
| 33 | 34 | ||
| 34 | 35 | ||
| 35 | 36 | ||
| @@ -794,8 +795,8 @@ rtError_t GetArgsInfo(TaskInfo* taskInfo) | |||
| 794 | RT_MEMCPY_DEVICE_TO_HOST); | 795 | RT_MEMCPY_DEVICE_TO_HOST); |
| 795 | COND_PROC_RETURN_ERROR( | 796 | COND_PROC_RETURN_ERROR( |
| 796 | error != RT_ERROR_NONE, error, (void)dev->Driver_()->HostMemFree(hostMem), | 797 | error != RT_ERROR_NONE, error, (void)dev->Driver_()->HostMemFree(hostMem), |
| 797 | - "Memcpy failed, size=%u, type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x.", argSize, | 798 | + "Memcpy failed, size=%u, type=%s, retCode=%#x.", argSize, MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), |
| 798 | - static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); | 799 | + static_cast<uint32_t>(error)); |
| 799 | // args info | 800 | // args info |
| 800 | const uint32_t totalLen = argSize / static_cast<uint32_t>(sizeof(void*)); | 801 | const uint32_t totalLen = argSize / static_cast<uint32_t>(sizeof(void*)); |
| 801 | const uint32_t argsTimes = (totalLen % ARGS_PER_STRING_MAX_LEN > 0) ? ((totalLen / ARGS_PER_STRING_MAX_LEN) + 1U) : | 802 | const uint32_t argsTimes = (totalLen % ARGS_PER_STRING_MAX_LEN > 0) ? ((totalLen / ARGS_PER_STRING_MAX_LEN) + 1U) : |
| @@ -847,9 +848,9 @@ void HandleSimtPrintErrorInfo(Device* const dev) | |||
| 847 | (void)dev->Driver_()->HostMemFree(hostBlockSrc); | 848 | (void)dev->Driver_()->HostMemFree(hostBlockSrc); |
| 848 | RT_LOG( | 849 | RT_LOG( |
| 849 | RT_LOG_ERROR, | 850 | RT_LOG_ERROR, |
| 850 | - "Memcpy failed, size=%lu(bytes), type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x," | 851 | + "Memcpy failed, size=%lu(bytes), type=%s, retCode=%#x," |
| 851 | " device_id=%u", | 852 | " device_id=%u", |
| 852 | - fifoSize, static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error), dev->Id_()); | 853 | + fifoSize, MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error), dev->Id_()); |
| 853 | return; | 854 | return; |
| 854 | } | 855 | } |
| 855 | 856 | ||
| @@ -33,6 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | + | ||
| 36 | 37 | ||
| 37 | namespace cce { | 38 | namespace cce { |
| 38 | namespace runtime { | 39 | namespace runtime { |
| @@ -883,12 +884,12 @@ void ConstructAICoreSqeForDavinciTask(TaskInfo* const taskInfo, rtStarsSqe_t* co | |||
| 883 | RT_LOG( | 884 | RT_LOG( |
| 884 | RT_LOG_INFO, | 885 | RT_LOG_INFO, |
| 885 | "bindFlag=%d, biuperfProfFla=%d, fftsType=%u, funcType=%u, prefetchCnt1=%u, chipType=%u, " | 886 | "bindFlag=%d, biuperfProfFla=%d, fftsType=%u, funcType=%u, prefetchCnt1=%u, chipType=%u, " |
| 886 | - "cfgInfo schemMode=%u, taskType=%u, kernelFlag=%u, l2CacheProfFlag=%u, kernelCredit=%u, kernelAttrType=%d, " | 887 | + "cfgInfo schemMode=%u, taskType=%u, kernelFlag=%u, l2CacheProfFlag=%u, kernelCredit=%u, kernelAttrType=%s, " |
| 887 | "minStackSize=%u(bytes), stackSize=%u(bytes), stackPhyBase=%#llx.", | 888 | "minStackSize=%u(bytes), stackSize=%u(bytes), stackPhyBase=%#llx.", |
| 888 | stm->GetBindFlag(), Runtime::Instance()->GetBiuperfProfFlag(), sqe->fftsType, funcType, prefetchCnt1, | 889 | stm->GetBindFlag(), Runtime::Instance()->GetBiuperfProfFlag(), sqe->fftsType, funcType, prefetchCnt1, |
| 889 | Runtime::Instance()->GetChipType(), aicTaskInfo->schemMode, taskInfo->type, aicTaskInfo->comm.kernelFlag, | 890 | Runtime::Instance()->GetChipType(), aicTaskInfo->schemMode, taskInfo->type, aicTaskInfo->comm.kernelFlag, |
| 890 | - Runtime::Instance()->GetL2CacheProfFlag(), sqe->kernel_credit, kernelAttrType, minStackSize, stackSize, | 891 | + Runtime::Instance()->GetL2CacheProfFlag(), sqe->kernel_credit, KernelAttrTypeToString(kernelAttrType).c_str(), |
| 891 | - stackPhyBase); | 892 | + minStackSize, stackSize, stackPhyBase); |
| 892 | if (IS_SUPPORT_CHIP_FEATURE(Runtime::Instance()->GetChipType(), RtOptionalFeatureType::RT_FEATURE_TASK_FFTS_PLUS)) { | 893 | if (IS_SUPPORT_CHIP_FEATURE(Runtime::Instance()->GetChipType(), RtOptionalFeatureType::RT_FEATURE_TASK_FFTS_PLUS)) { |
| 893 | if ((taskInfo->type == TS_TASK_TYPE_KERNEL_AICORE) || (taskInfo->type == TS_TASK_TYPE_KERNEL_AIVEC)) { | 894 | if ((taskInfo->type == TS_TASK_TYPE_KERNEL_AICORE) || (taskInfo->type == TS_TASK_TYPE_KERNEL_AIVEC)) { |
| 894 | CheckBlockDim(taskInfo, sqe, nullptr); | 895 | CheckBlockDim(taskInfo, sqe, nullptr); |
| @@ -471,7 +471,7 @@ rtError_t MemcpyAsyncTaskInitV2( | |||
| 471 | error = ConvertCpyType(taskInfo, kind, srcAddr, dst); | 471 | error = ConvertCpyType(taskInfo, kind, srcAddr, dst); |
| 472 | ERROR_RETURN_MSG_INNER( | 472 | ERROR_RETURN_MSG_INNER( |
| 473 | error, "Failed to convert the D2D asynchronous copy typeD2D, retCode=%#x, kind=%s.", error, | 473 | error, "Failed to convert the D2D asynchronous copy typeD2D, retCode=%#x, kind=%s.", error, |
| 474 | - MemcpyKindToString(static_cast<rtMemcpyKind_t>(kind)).c_str()); | 474 | + MemcpyKindToStr(static_cast<rtMemcpyKind_t>(kind))); |
| 475 | } else { | 475 | } else { |
| 476 | // reserve | 476 | // reserve |
| 477 | } | 477 | } |
| @@ -102,16 +102,16 @@ static rtError_t CheckUniDisTaskInfo(const rtRandomNumTaskInfo_t* taskInfo, cons | |||
| 102 | rtError_t error = CheckRandomParam(min, "min", realDataSize); | 102 | rtError_t error = CheckRandomParam(min, "min", realDataSize); |
| 103 | COND_RETURN_ERROR_MSG_INNER( | 103 | COND_RETURN_ERROR_MSG_INNER( |
| 104 | error != RT_ERROR_NONE, error, | 104 | error != RT_ERROR_NONE, error, |
| 105 | - "CheckRandomParam call failed for the min parameter, dataType=%u, dataSize=%zu, isAddr=%hhu.", | 105 | + "CheckRandomParam call failed for the min parameter, dataType=%s, dataSize=%zu, isAddr=%hhu.", |
| 106 | - static_cast<uint32_t>(taskInfo->dataType), dataSize, min.isAddr); | 106 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), dataSize, min.isAddr); |
| 107 | 107 | ||
| 108 | const rtRandomParaInfo_t max = uniDisParam.max; | 108 | const rtRandomParaInfo_t max = uniDisParam.max; |
| 109 | realDataSize = (max.isAddr == RANDOM_ADDR_FLAG) ? sizeof(uint64_t) : dataSize; | 109 | realDataSize = (max.isAddr == RANDOM_ADDR_FLAG) ? sizeof(uint64_t) : dataSize; |
| 110 | error = CheckRandomParam(max, "max", realDataSize); | 110 | error = CheckRandomParam(max, "max", realDataSize); |
| 111 | COND_RETURN_ERROR_MSG_INNER( | 111 | COND_RETURN_ERROR_MSG_INNER( |
| 112 | error != RT_ERROR_NONE, error, | 112 | error != RT_ERROR_NONE, error, |
| 113 | - "CheckRandomParam call failed for the max parameter, dataType=%u, dataSize=%zu, isAddr=%hhu.", | 113 | + "CheckRandomParam call failed for the max parameter, dataType=%s, dataSize=%zu, isAddr=%hhu.", |
| 114 | - static_cast<uint32_t>(taskInfo->dataType), dataSize, max.isAddr); | 114 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), dataSize, max.isAddr); |
| 115 | 115 | ||
| 116 | return RT_ERROR_NONE; | 116 | return RT_ERROR_NONE; |
| 117 | } | 117 | } |
| @@ -125,8 +125,8 @@ static rtError_t CheckoutDropoutBitmaskTaskInfo(const rtRandomNumTaskInfo_t* tas | |||
| 125 | const rtError_t error = CheckRandomParam(ration, "dropoutRation", realDataSize); | 125 | const rtError_t error = CheckRandomParam(ration, "dropoutRation", realDataSize); |
| 126 | COND_RETURN_ERROR_MSG_INNER( | 126 | COND_RETURN_ERROR_MSG_INNER( |
| 127 | error != RT_ERROR_NONE, error, | 127 | error != RT_ERROR_NONE, error, |
| 128 | - "CheckRandomParam call failed for the dropoutRation parameter, dataType=%u, dataSize=%zu, isAddr=%hhu.", | 128 | + "CheckRandomParam call failed for the dropoutRation parameter, dataType=%s, dataSize=%zu, isAddr=%hhu.", |
| 129 | - static_cast<uint32_t>(taskInfo->dataType), dataSize, ration.isAddr); | 129 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), dataSize, ration.isAddr); |
| 130 | 130 | ||
| 131 | return RT_ERROR_NONE; | 131 | return RT_ERROR_NONE; |
| 132 | } | 132 | } |
| @@ -139,16 +139,16 @@ static rtError_t CheckNorDisTaskInfo(const rtRandomNumTaskInfo_t* taskInfo, cons | |||
| 139 | rtError_t error = CheckRandomParam(mean, "mean", realDataSize); | 139 | rtError_t error = CheckRandomParam(mean, "mean", realDataSize); |
| 140 | COND_RETURN_ERROR_MSG_INNER( | 140 | COND_RETURN_ERROR_MSG_INNER( |
| 141 | error != RT_ERROR_NONE, error, | 141 | error != RT_ERROR_NONE, error, |
| 142 | - "CheckRandomParam call failed for the mean parameter, dataType=%u, dataSize=%zu, isAddr=%hhu.", | 142 | + "CheckRandomParam call failed for the mean parameter, dataType=%s, dataSize=%zu, isAddr=%hhu.", |
| 143 | - static_cast<uint32_t>(taskInfo->dataType), dataSize, mean.isAddr); | 143 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), dataSize, mean.isAddr); |
| 144 | 144 | ||
| 145 | const rtRandomParaInfo_t stddev = norDisParam.stddev; | 145 | const rtRandomParaInfo_t stddev = norDisParam.stddev; |
| 146 | realDataSize = (stddev.isAddr == RANDOM_ADDR_FLAG) ? sizeof(uint64_t) : dataSize; | 146 | realDataSize = (stddev.isAddr == RANDOM_ADDR_FLAG) ? sizeof(uint64_t) : dataSize; |
| 147 | error = CheckRandomParam(stddev, "stddev", realDataSize); | 147 | error = CheckRandomParam(stddev, "stddev", realDataSize); |
| 148 | COND_RETURN_ERROR_MSG_INNER( | 148 | COND_RETURN_ERROR_MSG_INNER( |
| 149 | error != RT_ERROR_NONE, error, | 149 | error != RT_ERROR_NONE, error, |
| 150 | - "CheckRandomParam call failed for the stddev parameter, dataType=%u, dataSize=%zu, isAddr=%hhu.", | 150 | + "CheckRandomParam call failed for the stddev parameter, dataType=%s, dataSize=%zu, isAddr=%hhu.", |
| 151 | - static_cast<uint32_t>(taskInfo->dataType), dataSize, stddev.isAddr); | 151 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), dataSize, stddev.isAddr); |
| 152 | 152 | ||
| 153 | return RT_ERROR_NONE; | 153 | return RT_ERROR_NONE; |
| 154 | } | 154 | } |
| @@ -415,14 +415,15 @@ rtError_t CheckRandomNumTaskInfo(const rtRandomNumTaskInfo_t* taskInfo) | |||
| 415 | const rtRandomNumFuncType funcType = taskInfo->randomNumFuncParaInfo.funcType; | 415 | const rtRandomNumFuncType funcType = taskInfo->randomNumFuncParaInfo.funcType; |
| 416 | rtError_t error = CheckDataTypeByFuncType(taskInfo->dataType, funcType); | 416 | rtError_t error = CheckDataTypeByFuncType(taskInfo->dataType, funcType); |
| 417 | COND_RETURN_ERROR( | 417 | COND_RETURN_ERROR( |
| 418 | - error != RT_ERROR_NONE, error, "Failed to check data type by funcType, dataType=%d, funcType=%d, retCode=%#x", | 418 | + error != RT_ERROR_NONE, error, "Failed to check data type by funcType, dataType=%s, funcType=%s, retCode=%#x", |
| 419 | - taskInfo->dataType, funcType, static_cast<uint32_t>(error)); | 419 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), RandomNumFuncTypeToString(funcType).c_str(), |
| 420 | + static_cast<uint32_t>(error)); | ||
| 420 | 421 | ||
| 421 | size_t dataSize = 0U; | 422 | size_t dataSize = 0U; |
| 422 | error = GetRandomNumDataSize(taskInfo->dataType, dataSize); | 423 | error = GetRandomNumDataSize(taskInfo->dataType, dataSize); |
| 423 | COND_RETURN_ERROR( | 424 | COND_RETURN_ERROR( |
| 424 | - error != RT_ERROR_NONE, error, "Failed to get random num data size, dataType=%d, retCode=%d.", | 425 | + error != RT_ERROR_NONE, error, "Failed to get random num data size, dataType=%s, retCode=%d.", |
| 425 | - taskInfo->dataType, error); | 426 | + RandomNumDataTypeToString(taskInfo->dataType).c_str(), error); |
| 426 | 427 | ||
| 427 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( | 428 | NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( |
| 428 | taskInfo->randomCounterAddr, RT_ERROR_INVALID_VALUE, | 429 | taskInfo->randomCounterAddr, RT_ERROR_INVALID_VALUE, |
| @@ -40,7 +40,7 @@ rtError_t TaskResManage::LoadInputOutputArgs( | |||
| 40 | COND_RETURN_ERROR_MSG_CALL( | 40 | COND_RETURN_ERROR_MSG_CALL( |
| 41 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_DRV_MEMORY, | 41 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_DRV_MEMORY, |
| 42 | "Failed to call memcpy_s to copy args, src=%p, dest=%p, dest_max=%u, count=%u, kind=%s, retCode=%#x.", args, | 42 | "Failed to call memcpy_s to copy args, src=%p, dest=%p, dest_max=%u, count=%u, kind=%s, retCode=%#x.", args, |
| 43 | - kerArgs, size, size, MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(ret)); | 43 | + kerArgs, size, size, MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(ret)); |
| 44 | } | 44 | } |
| 45 | return RT_ERROR_NONE; | 45 | return RT_ERROR_NONE; |
| 46 | } | 46 | } |
| @@ -61,7 +61,7 @@ rtError_t TaskResManage::LoadInputOutputArgs( | |||
| 61 | COND_RETURN_ERROR_MSG_CALL( | 61 | COND_RETURN_ERROR_MSG_CALL( |
| 62 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_DRV_MEMORY, | 62 | ERR_MODULE_SYSTEM, ret != EOK, RT_ERROR_DRV_MEMORY, |
| 63 | "Failed to call memcpy_s to copy args, src=%p, dest=%p, dest_max=%u, count=%u, kind=%s, retCode=%#x.", args, | 63 | "Failed to call memcpy_s to copy args, src=%p, dest=%p, dest_max=%u, count=%u, kind=%s, retCode=%#x.", args, |
| 64 | - kerArgs, size, size, MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(ret)); | 64 | + kerArgs, size, size, MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(ret)); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | return RT_ERROR_NONE; | 67 | return RT_ERROR_NONE; |
| @@ -53,7 +53,7 @@ void UvmCallback::MemcpyAsyncCallback(void* userData) | |||
| 53 | RT_LOG( | 53 | RT_LOG( |
| 54 | RT_LOG_ERROR, "Memcopy sync failed with code=%u dst=%p destMax=%u src=%p cnt=%u kind=%s", | 54 | RT_LOG_ERROR, "Memcopy sync failed with code=%u dst=%p destMax=%u src=%p cnt=%u kind=%s", |
| 55 | static_cast<uint32_t>(error), params->dst, params->destMax, params->src, params->cnt, | 55 | static_cast<uint32_t>(error), params->dst, params->destMax, params->src, params->cnt, |
| 56 | - MemcpyKindToString(kindCov).c_str()); | 56 | + MemcpyKindToStr(kindCov)); |
| 57 | } | 57 | } |
| 58 | delete params; | 58 | delete params; |
| 59 | } | 59 | } |
| @@ -300,15 +300,15 @@ rtError_t NpuDriver::HostMemMapCapabilities(uint32_t deviceId, rtHacType hacType | |||
| 300 | drvRet = halHostRegisterCapabilities(deviceId, static_cast<UINT32>(hacType), &drv_capabilities); | 300 | drvRet = halHostRegisterCapabilities(deviceId, static_cast<UINT32>(hacType), &drv_capabilities); |
| 301 | if (drvRet != DRV_ERROR_NONE) { | 301 | if (drvRet != DRV_ERROR_NONE) { |
| 302 | DRV_ERROR_PROCESS( | 302 | DRV_ERROR_PROCESS( |
| 303 | - drvRet, "Call driver api halHostRegisterCapabilities failed, drvRetCode=%d, drvDevId=%u, hacType=%d.", | 303 | + drvRet, "Call driver api halHostRegisterCapabilities failed, drvRetCode=%d, drvDevId=%u, hacType=%s.", |
| 304 | - static_cast<int32_t>(drvRet), deviceId, static_cast<UINT32>(hacType)); | 304 | + static_cast<int32_t>(drvRet), deviceId, HacTypeToString(hacType).c_str()); |
| 305 | return RT_GET_DRV_ERRCODE(drvRet); | 305 | return RT_GET_DRV_ERRCODE(drvRet); |
| 306 | } | 306 | } |
| 307 | // 将drv_capabilities的值传递给capabilities | 307 | // 将drv_capabilities的值传递给capabilities |
| 308 | *capabilities = static_cast<rtHostMemMapCapability>(drv_capabilities); | 308 | *capabilities = static_cast<rtHostMemMapCapability>(drv_capabilities); |
| 309 | RT_LOG( | 309 | RT_LOG( |
| 310 | - RT_LOG_DEBUG, "halHostRegisterCapabilities: device_id=%u, hacType=%d, capabilities=%d!", deviceId, hacType, | 310 | + RT_LOG_DEBUG, "halHostRegisterCapabilities: device_id=%u, hacType=%s, capabilities=%d!", deviceId, |
| 311 | - *capabilities); | 311 | + HacTypeToString(hacType).c_str(), *capabilities); |
| 312 | return RT_ERROR_NONE; | 312 | return RT_ERROR_NONE; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| @@ -568,8 +568,8 @@ rtError_t NpuDriver::ExportToShareableHandleV2( | |||
| 568 | } | 568 | } |
| 569 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; | 569 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; |
| 570 | COND_RETURN_ERROR( | 570 | COND_RETURN_ERROR( |
| 571 | - !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, "Invalid handle type: %d", | 571 | + !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, "Invalid handle type: UNKNOWN(%d)", |
| 572 | - handleType); | 572 | + static_cast<int32_t>(handleType)); |
| 573 | COND_RETURN_WARN( | 573 | COND_RETURN_WARN( |
| 574 | &halMemExportToShareableHandleV2 == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, | 574 | &halMemExportToShareableHandleV2 == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, |
| 575 | "[drv api] halMemExportToShareableHandleV2 does not exist"); | 575 | "[drv api] halMemExportToShareableHandleV2 does not exist"); |
| @@ -616,8 +616,8 @@ rtError_t NpuDriver::ImportFromShareableHandleV2( | |||
| 616 | } | 616 | } |
| 617 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; | 617 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; |
| 618 | COND_RETURN_ERROR( | 618 | COND_RETURN_ERROR( |
| 619 | - !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, "Invalid handle type: %d", | 619 | + !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, "Invalid handle type: UNKNOWN(%d)", |
| 620 | - handleType); | 620 | + static_cast<int32_t>(handleType)); |
| 621 | COND_RETURN_WARN( | 621 | COND_RETURN_WARN( |
| 622 | &halMemImportFromShareableHandleV2 == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, | 622 | &halMemImportFromShareableHandleV2 == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, |
| 623 | "[drv api] halMemImportFromShareableHandleV2 does not exist"); | 623 | "[drv api] halMemImportFromShareableHandleV2 does not exist"); |
| @@ -664,8 +664,8 @@ rtError_t NpuDriver::GetServerIdAndshareableHandle( | |||
| 664 | "[drv api] halMemTransShareableHandle does not exist"); | 664 | "[drv api] halMemTransShareableHandle does not exist"); |
| 665 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; | 665 | drv_mem_handle_type drvHandleType = MEM_HANDLE_TYPE_NONE; |
| 666 | COND_RETURN_ERROR( | 666 | COND_RETURN_ERROR( |
| 667 | - !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, "Invalid handle type: %d", | 667 | + !TransSharedHandleType(handleType, drvHandleType), RT_ERROR_INVALID_VALUE, |
| 668 | - handleType); | 668 | + "Invalid handle type: UNKNOWN(%d)", static_cast<int32_t>(handleType)); |
| 669 | const drvError_t drvRet = halMemTransShareableHandle( | 669 | const drvError_t drvRet = halMemTransShareableHandle( |
| 670 | drvHandleType, RtPtrToPtr<struct MemShareHandle*>(RtPtrToUnConstPtr<void*>(sharehandle)), serverId, | 670 | drvHandleType, RtPtrToPtr<struct MemShareHandle*>(RtPtrToUnConstPtr<void*>(sharehandle)), serverId, |
| 671 | shareableHandle); | 671 | shareableHandle); |
| @@ -679,7 +679,7 @@ rtError_t NpuDriver::GetServerIdAndshareableHandle( | |||
| 679 | *shareableHandle = *RtPtrToPtr<uint64_t*>(RtPtrToUnConstPtr<void*>(sharehandle)); | 679 | *shareableHandle = *RtPtrToPtr<uint64_t*>(RtPtrToUnConstPtr<void*>(sharehandle)); |
| 680 | return RT_ERROR_NONE; | 680 | return RT_ERROR_NONE; |
| 681 | } else { | 681 | } else { |
| 682 | - RT_LOG(RT_LOG_ERROR, "Invalid handle type: %d.", handleType); | 682 | + RT_LOG(RT_LOG_ERROR, "Invalid handle type: UNKNOWN(%d).", static_cast<int32_t>(handleType)); |
| 683 | return RT_ERROR_INVALID_VALUE; | 683 | return RT_ERROR_INVALID_VALUE; |
| 684 | } | 684 | } |
| 685 | } | 685 | } |
| @@ -1877,13 +1877,17 @@ rtError_t NpuDriver::MemGetInfoEx( | |||
| 1877 | rtMemInfoType_t curMemInfoType = memInfoType; | 1877 | rtMemInfoType_t curMemInfoType = memInfoType; |
| 1878 | if ((GetDevProperties().memInfoMapType & MAP_WHEN_GET_INFO) != 0) { | 1878 | if ((GetDevProperties().memInfoMapType & MAP_WHEN_GET_INFO) != 0) { |
| 1879 | curMemInfoType = g_memInfoTypeMap[memInfoType]; | 1879 | curMemInfoType = g_memInfoTypeMap[memInfoType]; |
| 1880 | - RT_LOG(RT_LOG_INFO, "memInfoType convert %d to %d.", memInfoType, curMemInfoType); | 1880 | + RT_LOG( |
| 1881 | + RT_LOG_INFO, "memInfoType convert %s to %s.", MemInfoTypeToString(memInfoType).c_str(), | ||
| 1882 | + MemInfoTypeToString(curMemInfoType).c_str()); | ||
| 1881 | } | 1883 | } |
| 1882 | const rtError_t error = GetMemInfoType(curMemInfoType, &type); | 1884 | const rtError_t error = GetMemInfoType(curMemInfoType, &type); |
| 1883 | if (error != RT_ERROR_NONE) { | 1885 | if (error != RT_ERROR_NONE) { |
| 1884 | - RT_LOG_OUTER_MSG_INVALID_PARAM_WITH_DESC( | 1886 | + RT_LOG_OUTER_MSG_WITH_FUNC_DESC( |
| 1885 | - "Obtaining the memory information of the current device", static_cast<int32_t>(curMemInfoType), | 1887 | + ErrorCode::EE1003, "Obtaining the memory information of the current device", |
| 1886 | - "[" + std::to_string(RT_MEMORYINFO_DDR) + ", " + std::to_string(RT_MEMORYINFO_HBM_P2P_NORMAL) + "]"); | 1888 | + RtFmtMsg("UNKNOWN(%d)", static_cast<int32_t>(curMemInfoType)), "curMemInfoType", |
| 1889 | + RtFmtMsg( | ||
| 1890 | + "[%d, %d]", static_cast<int32_t>(RT_MEMORYINFO_DDR), static_cast<int32_t>(RT_MEMORYINFO_P2P_HUGE1G))); | ||
| 1887 | return error; | 1891 | return error; |
| 1888 | } | 1892 | } |
| 1889 | 1893 | ||
| @@ -1897,8 +1901,8 @@ rtError_t NpuDriver::MemGetInfoEx( | |||
| 1897 | } | 1901 | } |
| 1898 | 1902 | ||
| 1899 | RT_LOG( | 1903 | RT_LOG( |
| 1900 | - RT_LOG_INFO, "curMemInfoType=%u, drvMemType=%u, free=%" PRIu64 ", hug_free=%" PRIu64, | 1904 | + RT_LOG_INFO, "curMemInfoType=%s, drvMemType=%u, free=%" PRIu64 ", hug_free=%" PRIu64, |
| 1901 | - static_cast<uint32_t>(curMemInfoType), type, static_cast<uint64_t>(info.phy_info.free), | 1905 | + MemInfoTypeToString(curMemInfoType).c_str(), type, static_cast<uint64_t>(info.phy_info.free), |
| 1902 | static_cast<uint64_t>(info.phy_info.huge_free)); | 1906 | static_cast<uint64_t>(info.phy_info.huge_free)); |
| 1903 | 1907 | ||
| 1904 | if ((curMemInfoType == RT_MEMORYINFO_DDR) || (curMemInfoType == RT_MEMORYINFO_HBM)) { | 1908 | if ((curMemInfoType == RT_MEMORYINFO_DDR) || (curMemInfoType == RT_MEMORYINFO_HBM)) { |
| @@ -1910,7 +1914,9 @@ rtError_t NpuDriver::MemGetInfoEx( | |||
| 1910 | } else if (Is1GHugePageMem(curMemInfoType)) { | 1914 | } else if (Is1GHugePageMem(curMemInfoType)) { |
| 1911 | const rtError_t ret = CheckIfSupport1GHugePage(); | 1915 | const rtError_t ret = CheckIfSupport1GHugePage(); |
| 1912 | if (ret != RT_ERROR_NONE) { | 1916 | if (ret != RT_ERROR_NONE) { |
| 1913 | - RT_LOG(RT_LOG_ERROR, "this feature is not supported on current version, memory policy=%u.", curMemInfoType); | 1917 | + RT_LOG( |
| 1918 | + RT_LOG_ERROR, "this feature is not supported on current version, memory policy=%s.", | ||
| 1919 | + MemInfoTypeToString(curMemInfoType).c_str()); | ||
| 1914 | return ret; | 1920 | return ret; |
| 1915 | } | 1921 | } |
| 1916 | *freeSize = static_cast<size_t>(info.phy_info.giant_free); | 1922 | *freeSize = static_cast<size_t>(info.phy_info.giant_free); |
| @@ -2116,8 +2122,8 @@ rtError_t NpuDriver::PtrGetRealLocation( | |||
| 2116 | } | 2122 | } |
| 2117 | 2123 | ||
| 2118 | RT_LOG( | 2124 | RT_LOG( |
| 2119 | - RT_LOG_DEBUG, "PtrGetRealLocation memType=%u, devId=%u, realLoc=%d(%s)", dvAttributes.memType, | 2125 | + RT_LOG_DEBUG, "PtrGetRealLocation memType=%u, devId=%u, realLoc=%s", dvAttributes.memType, dvAttributes.devId, |
| 2120 | - dvAttributes.devId, realLocation, MemLocationTypeToStr(realLocation)); | 2126 | + MemLocationTypeToString(realLocation).c_str()); |
| 2121 | 2127 | ||
| 2122 | return RT_ERROR_NONE; | 2128 | return RT_ERROR_NONE; |
| 2123 | } | 2129 | } |
| @@ -2186,7 +2192,7 @@ rtError_t NpuDriver::MemCopySync( | |||
| 2186 | drvRet, | 2192 | drvRet, |
| 2187 | "Call driver api drvMemcpy failed, drvRetCode=%d, destMax=%" PRIu64 ", " | 2193 | "Call driver api drvMemcpy failed, drvRetCode=%d, destMax=%" PRIu64 ", " |
| 2188 | "size=%" PRIu64 "(bytes), kind=%s.", | 2194 | "size=%" PRIu64 "(bytes), kind=%s.", |
| 2189 | - static_cast<int32_t>(drvRet), destMax, size, MemcpyKindToString(kind).c_str()); | 2195 | + static_cast<int32_t>(drvRet), destMax, size, MemcpyKindToStr(kind)); |
| 2190 | } | 2196 | } |
| 2191 | return RT_GET_DRV_ERRCODE(drvRet); | 2197 | return RT_GET_DRV_ERRCODE(drvRet); |
| 2192 | } | 2198 | } |
| @@ -2221,8 +2227,8 @@ rtError_t NpuDriver::MemCopyAsync( | |||
| 2221 | RT_LOG( | 2227 | RT_LOG( |
| 2222 | RT_LOG_INFO, | 2228 | RT_LOG_INFO, |
| 2223 | "call halMemCpyAsync success, destMax=%" PRIu64 "," | 2229 | "call halMemCpyAsync success, destMax=%" PRIu64 "," |
| 2224 | - " size=%" PRIu64 "(bytes), kind=%d.", | 2230 | + " size=%" PRIu64 "(bytes), kind=%s.", |
| 2225 | - destMax, size, static_cast<int32_t>(kind)); | 2231 | + destMax, size, MemcpyKindToStr(kind)); |
| 2226 | } | 2232 | } |
| 2227 | 2233 | ||
| 2228 | drvError_t drvRet = cmodelDrvMemcpy( | 2234 | drvError_t drvRet = cmodelDrvMemcpy( |
| @@ -2236,7 +2242,7 @@ rtError_t NpuDriver::MemCopyAsync( | |||
| 2236 | drvRet, | 2242 | drvRet, |
| 2237 | "Call driver api drvAsyncMemcpy failed, drvRetCode=%d, destMax=%" PRIu64 ", size=%" PRIu64 | 2243 | "Call driver api drvAsyncMemcpy failed, drvRetCode=%d, destMax=%" PRIu64 ", size=%" PRIu64 |
| 2238 | "(bytes), kind=%s.", | 2244 | "(bytes), kind=%s.", |
| 2239 | - static_cast<int32_t>(drvRet), destMax, size, MemcpyKindToString(kind).c_str()); | 2245 | + static_cast<int32_t>(drvRet), destMax, size, MemcpyKindToStr(kind)); |
| 2240 | return RT_GET_DRV_ERRCODE(drvRet); | 2246 | return RT_GET_DRV_ERRCODE(drvRet); |
| 2241 | } | 2247 | } |
| 2242 | 2248 | ||
| @@ -737,9 +737,9 @@ rtError_t CaptureModel::AddStreamToCaptureModel(Stream* const stm) | |||
| 737 | RT_LOG( | 737 | RT_LOG( |
| 738 | RT_LOG_INFO, | 738 | RT_LOG_INFO, |
| 739 | "add stream to capture model, device_id=%u, model_id=%u, " | 739 | "add stream to capture model, device_id=%u, model_id=%u, " |
| 740 | - "add stream_id=%d, stream_status=%d, capture stream_id=%d, retCode=%#x.", | 740 | + "add stream_id=%d, stream_status=%s, capture stream_id=%d, retCode=%#x.", |
| 741 | - Context_()->Device_()->Id_(), Id_(), streamId, stm->GetCaptureStatus(), stm->GetCaptureStream()->Id_(), | 741 | + Context_()->Device_()->Id_(), Id_(), streamId, StreamCaptureStatusToString(stm->GetCaptureStatus()).c_str(), |
| 742 | - error); | 742 | + stm->GetCaptureStream()->Id_(), error); |
| 743 | } else { | 743 | } else { |
| 744 | RT_LOG( | 744 | RT_LOG( |
| 745 | RT_LOG_WARNING, "already add stream_id=%d to capture model, device_id=%u, model_id=%u.", streamId, | 745 | RT_LOG_WARNING, "already add stream_id=%d to capture model, device_id=%u, model_id=%u.", streamId, |
| @@ -446,7 +446,7 @@ bool IsUbDma(Stream* const stm, const uint32_t kind, const void* const srcAddr, | |||
| 446 | const rtError_t error = ConvertCpyType(&taskInfo, kind, srcAddr, RtPtrToUnConstPtr<void*>(desAddr)); | 446 | const rtError_t error = ConvertCpyType(&taskInfo, kind, srcAddr, RtPtrToUnConstPtr<void*>(desAddr)); |
| 447 | COND_RETURN_ERROR( | 447 | COND_RETURN_ERROR( |
| 448 | error != RT_ERROR_NONE, false, "Failed to convert copy type, kind=%s.", | 448 | error != RT_ERROR_NONE, false, "Failed to convert copy type, kind=%s.", |
| 449 | - MemcpyKindToString(static_cast<rtMemcpyKind_t>(kind)).c_str()); | 449 | + MemcpyKindToStr(static_cast<rtMemcpyKind_t>(kind))); |
| 450 | 450 | ||
| 451 | MemcpyAsyncTaskInfo memcpyAsyncTaskInfo = taskInfo.u.memcpyAsyncTaskInfo; | 451 | MemcpyAsyncTaskInfo memcpyAsyncTaskInfo = taskInfo.u.memcpyAsyncTaskInfo; |
| 452 | if (IsDavidUbDma(memcpyAsyncTaskInfo.copyType)) { | 452 | if (IsDavidUbDma(memcpyAsyncTaskInfo.copyType)) { |
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | + | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -94,8 +95,8 @@ rtError_t CondHandle::Setup(Context* ctx) | |||
| 94 | ERROR_RETURN(error, "Failed to memset devAddr, retCode=%#x.", static_cast<uint32_t>(error)); | 95 | ERROR_RETURN(error, "Failed to memset devAddr, retCode=%#x.", static_cast<uint32_t>(error)); |
| 95 | 96 | ||
| 96 | RT_LOG( | 97 | RT_LOG( |
| 97 | - RT_LOG_DEBUG, "CondHandle setup success, model_id=%u, default_value=%u, flag=%d, dev_addr=%p.", model_->Id_(), | 98 | + RT_LOG_DEBUG, "CondHandle setup success, model_id=%u, default_value=%u, flag=%s, dev_addr=%p.", model_->Id_(), |
| 98 | - defaultValue_, static_cast<int32_t>(flag_), devAddr_); | 99 | + defaultValue_, CondHandleFlagToString(flag_).c_str(), devAddr_); |
| 99 | 100 | ||
| 100 | InitEmbeddedInnerHandle(this); | 101 | InitEmbeddedInnerHandle(this); |
| 101 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(model_); | 102 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(model_); |
| @@ -140,9 +141,10 @@ rtError_t CondHandle::InitCondTaskByDefValue() | |||
| 140 | rtError_t error = | 141 | rtError_t error = |
| 141 | driver->MemCopySync(devAddr_, sizeof(uint64_t), &defValue, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); | 142 | driver->MemCopySync(devAddr_, sizeof(uint64_t), &defValue, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); |
| 142 | ERROR_RETURN( | 143 | ERROR_RETURN( |
| 143 | - error, "Failed to init cond default value, condFlag=%u, condType=%d, condSize=%u, defValue=%u retCode=%#x.", | 144 | + error, "Failed to init cond default value, condFlag=%s, condType=%s, condSize=%u, defValue=%u retCode=%#x.", |
| 144 | - flag_, condType_, condSize_, defaultValue_, static_cast<uint32_t>(error)); | 145 | + CondHandleFlagToString(flag_).c_str(), CondTaskTypeToString(condType_).c_str(), condSize_, defaultValue_, |
| 145 | - RT_LOG(RT_LOG_DEBUG, "defValue=%u, condType=%d", defValue, condType_); | 146 | + static_cast<uint32_t>(error)); |
| 147 | + RT_LOG(RT_LOG_DEBUG, "defValue=%u, condType=%s", defValue, CondTaskTypeToString(condType_).c_str()); | ||
| 146 | 148 | ||
| 147 | return RT_ERROR_NONE; | 149 | return RT_ERROR_NONE; |
| 148 | } | 150 | } |
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | + | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | 26 | ||
| @@ -336,9 +337,9 @@ rtError_t Context::StreamBeginCapture(Stream* const stm, const rtStreamCaptureMo | |||
| 336 | RT_LOG( | 337 | RT_LOG( |
| 337 | RT_LOG_EVENT, | 338 | RT_LOG_EVENT, |
| 338 | "capture begin success, device_id=%u, model_id=%u" | 339 | "capture begin success, device_id=%u, model_id=%u" |
| 339 | - " original stream_id=%d, capture stream_id=%d, stream_status=%d, isSubmodel=%u, parent model_id=%u.", | 340 | + " original stream_id=%d, capture stream_id=%d, stream_status=%s, isSubmodel=%u, parent model_id=%u.", |
| 340 | - device_->Id_(), captureMdl->Id_(), streamId, stm->GetCaptureStream()->Id_(), stm->GetCaptureStatus(), | 341 | + device_->Id_(), captureMdl->Id_(), streamId, stm->GetCaptureStream()->Id_(), |
| 341 | - captureMdl->IsSubCaptureModel(), | 342 | + StreamCaptureStatusToString(stm->GetCaptureStatus()).c_str(), captureMdl->IsSubCaptureModel(), |
| 342 | (condHandle != nullptr) ? condHandle->GetParentModel()->Id_() : MAX_UINT32_NUM); | 343 | (condHandle != nullptr) ? condHandle->GetParentModel()->Id_() : MAX_UINT32_NUM); |
| 343 | 344 | ||
| 344 | return RT_ERROR_NONE; | 345 | return RT_ERROR_NONE; |
| @@ -680,8 +681,8 @@ rtError_t Context::StreamGetCaptureInfo( | |||
| 680 | } | 681 | } |
| 681 | 682 | ||
| 682 | RT_LOG( | 683 | RT_LOG( |
| 683 | - RT_LOG_INFO, "device_id=%u, model_id=%u, original stream_id=%d, stream_status=%d", device_->Id_(), modelId, | 684 | + RT_LOG_INFO, "device_id=%u, model_id=%u, original stream_id=%d, stream_status=%s", device_->Id_(), modelId, |
| 684 | - stm->Id_(), statusTmp); | 685 | + stm->Id_(), StreamCaptureStatusToString(statusTmp).c_str()); |
| 685 | 686 | ||
| 686 | return RT_ERROR_NONE; | 687 | return RT_ERROR_NONE; |
| 687 | } | 688 | } |
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | + | ||
| 23 | 24 | ||
| 24 | namespace cce { | 25 | namespace cce { |
| 25 | namespace runtime { | 26 | namespace runtime { |
| @@ -171,10 +172,10 @@ static rtError_t PreProcAicAivTaskForFusion( | |||
| 171 | aicAivInfo->program = (prog != nullptr) ? prog : realProgram; | 172 | aicAivInfo->program = (prog != nullptr) ? prog : realProgram; |
| 172 | RT_LOG( | 173 | RT_LOG( |
| 173 | RT_LOG_INFO, | 174 | RT_LOG_INFO, |
| 174 | - "kernel info: stream_id=%d, kernelAttrType=%d, kernel_name=%s," | 175 | + "kernel info: stream_id=%d, kernelAttrType=%s, kernel_name=%s," |
| 175 | "mixType=%u, taskRation=%u, tilingKey=%llu.", | 176 | "mixType=%u, taskRation=%u, tilingKey=%llu.", |
| 176 | - stm->Id_(), kernelAttrType, registeredKernel->Name_().c_str(), mixType, registeredKernel->GetTaskRation(), | 177 | + stm->Id_(), KernelAttrTypeToString(kernelAttrType).c_str(), registeredKernel->Name_().c_str(), mixType, |
| 177 | - tilingKey); | 178 | + registeredKernel->GetTaskRation(), tilingKey); |
| 178 | return RT_ERROR_NONE; | 179 | return RT_ERROR_NONE; |
| 179 | } | 180 | } |
| 180 | 181 | ||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | + | ||
| 28 | 29 | ||
| 29 | namespace cce { | 30 | namespace cce { |
| 30 | namespace runtime { | 31 | namespace runtime { |
| @@ -359,9 +360,8 @@ static rtError_t GetArgsInfoForFusionKernelTask(TaskInfo* taskInfo) | |||
| 359 | hostMem, static_cast<uint64_t>(fusionKernelTask->argsSize) + 1U, fusionKernelTask->args, | 360 | hostMem, static_cast<uint64_t>(fusionKernelTask->argsSize) + 1U, fusionKernelTask->args, |
| 360 | static_cast<uint64_t>(fusionKernelTask->argsSize), RT_MEMCPY_DEVICE_TO_HOST); | 361 | static_cast<uint64_t>(fusionKernelTask->argsSize), RT_MEMCPY_DEVICE_TO_HOST); |
| 361 | COND_PROC_RETURN_ERROR_MSG_INNER(error != RT_ERROR_NONE, error, (void)dev->Driver_()->HostMemFree(hostMem); | 362 | COND_PROC_RETURN_ERROR_MSG_INNER(error != RT_ERROR_NONE, error, (void)dev->Driver_()->HostMemFree(hostMem); |
| 362 | - , "Memcpy failed, size=%u, type=%d(RT_MEMCPY_DEVICE_TO_HOST), retCode=%#x", | 363 | + , "Memcpy failed, size=%u, type=%s, retCode=%#x", fusionKernelTask->argsSize, |
| 363 | - fusionKernelTask->argsSize, static_cast<int32_t>(RT_MEMCPY_DEVICE_TO_HOST), | 364 | + MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), static_cast<uint32_t>(error)); |
| 364 | - static_cast<uint32_t>(error)); | ||
| 365 | const uint32_t totalLen = fusionKernelTask->argsSize / static_cast<uint32_t>(sizeof(void*)); | 365 | const uint32_t totalLen = fusionKernelTask->argsSize / static_cast<uint32_t>(sizeof(void*)); |
| 366 | const uint32_t argsTimes = (totalLen % ARGS_PER_STRING_MAX_LEN > 0) ? | 366 | const uint32_t argsTimes = (totalLen % ARGS_PER_STRING_MAX_LEN > 0) ? |
| 367 | static_cast<uint32_t>((totalLen / ARGS_PER_STRING_MAX_LEN) + 1) : | 367 | static_cast<uint32_t>((totalLen / ARGS_PER_STRING_MAX_LEN) + 1) : |
| @@ -2068,7 +2068,7 @@ rtError_t Model::MallocDevValue(const void* const data, const uint32_t size, voi | |||
| 2068 | if (error != RT_ERROR_NONE) { | 2068 | if (error != RT_ERROR_NONE) { |
| 2069 | ERROR_GOTO( | 2069 | ERROR_GOTO( |
| 2070 | error, FAIL_ALLOC, "Memory copy value failed, size=%u(bytes), kind=%s, retCode=%#x.", size, | 2070 | error, FAIL_ALLOC, "Memory copy value failed, size=%u(bytes), kind=%s, retCode=%#x.", size, |
| 2071 | - MemcpyKindToString(RT_MEMCPY_HOST_TO_DEVICE).c_str(), static_cast<uint32_t>(error)); | 2071 | + MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), static_cast<uint32_t>(error)); |
| 2072 | } | 2072 | } |
| 2073 | 2073 | ||
| 2074 | return RT_ERROR_NONE; | 2074 | return RT_ERROR_NONE; |
| @@ -97,7 +97,7 @@ rtError_t XpuArgManage::H2DArgCopy(const StarsArgLoaderResult* const result, voi | |||
| 97 | if (handle != nullptr) { | 97 | if (handle != nullptr) { |
| 98 | error = handle->argsAlloc->H2DMemCopy(result->kerArgs, args, size); | 98 | error = handle->argsAlloc->H2DMemCopy(result->kerArgs, args, size); |
| 99 | ERROR_RETURN_MSG_INNER( | 99 | ERROR_RETURN_MSG_INNER( |
| 100 | - error, "H2DMemCopy failed, kind=%s, retCode=%#x.", MemcpyKindToString(RT_MEMCPY_HOST_TO_HOST).c_str(), | 100 | + error, "H2DMemCopy failed, kind=%s, retCode=%#x.", MemcpyKindToStr(RT_MEMCPY_HOST_TO_HOST), |
| 101 | static_cast<uint32_t>(error)); | 101 | static_cast<uint32_t>(error)); |
| 102 | } else { | 102 | } else { |
| 103 | const errno_t ret = memcpy_s(result->kerArgs, static_cast<uint64_t>(size), args, static_cast<uint64_t>(size)); | 103 | const errno_t ret = memcpy_s(result->kerArgs, static_cast<uint64_t>(size), args, static_cast<uint64_t>(size)); |
| @@ -36,6 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | + | ||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | 42 | ||
| @@ -2909,3 +2910,132 @@ TEST_F(UTEST_ACL_Common, GetFuncNameWithoutImplSuffix_multiple_calls) | |||
| 2909 | EXPECT_EQ("aclBar", acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix("aclBarImpl")); | 2910 | EXPECT_EQ("aclBar", acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix("aclBarImpl")); |
| 2910 | EXPECT_EQ("noChange", acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix("noChange")); | 2911 | EXPECT_EQ("noChange", acl::AclErrorLogManager::GetFuncNameWithoutImplSuffix("noChange")); |
| 2911 | } | 2912 | } |
| 2913 | + | ||
| 2914 | +TEST_F(UTEST_ACL_Common, EnumDescUsesNameWithoutAclPrefixAndNumericValue) | ||
| 2915 | +{ | ||
| 2916 | + EXPECT_STREQ(GetCaptureModeDesc(ACL_MODEL_RI_CAPTURE_MODE_GLOBAL), "MODEL_RI_CAPTURE_MODE_GLOBAL(0)"); | ||
| 2917 | + EXPECT_STREQ(GetSysParamOptDesc(ACL_OPT_DETERMINISTIC), "OPT_DETERMINISTIC(0)"); | ||
| 2918 | + EXPECT_STREQ(GetMemLocationTypeDesc(ACL_MEM_LOCATION_TYPE_DEVICE), "MEM_LOCATION_TYPE_DEVICE(1)"); | ||
| 2919 | + EXPECT_STREQ(GetDeviceInfoDesc(ACL_DEVICE_INFO_UNDEFINED), "DEVICE_INFO_UNDEFINED(-1)"); | ||
| 2920 | + | ||
| 2921 | + EXPECT_STREQ(GetDataTypeDesc(ACL_DT_UNDEFINED), "DT_UNDEFINED(-1)"); | ||
| 2922 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT), "FLOAT(0)"); | ||
| 2923 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT16), "FLOAT16(1)"); | ||
| 2924 | + EXPECT_STREQ(GetDataTypeDesc(ACL_INT8), "INT8(2)"); | ||
| 2925 | + EXPECT_STREQ(GetDataTypeDesc(ACL_INT32), "INT32(3)"); | ||
| 2926 | + EXPECT_STREQ(GetDataTypeDesc(ACL_UINT8), "UINT8(4)"); | ||
| 2927 | + EXPECT_STREQ(GetDataTypeDesc(ACL_INT16), "INT16(6)"); | ||
| 2928 | + EXPECT_STREQ(GetDataTypeDesc(ACL_UINT16), "UINT16(7)"); | ||
| 2929 | + EXPECT_STREQ(GetDataTypeDesc(ACL_UINT32), "UINT32(8)"); | ||
| 2930 | + EXPECT_STREQ(GetDataTypeDesc(ACL_INT64), "INT64(9)"); | ||
| 2931 | + EXPECT_STREQ(GetDataTypeDesc(ACL_UINT64), "UINT64(10)"); | ||
| 2932 | + EXPECT_STREQ(GetDataTypeDesc(ACL_DOUBLE), "DOUBLE(11)"); | ||
| 2933 | + EXPECT_STREQ(GetDataTypeDesc(ACL_BOOL), "BOOL(12)"); | ||
| 2934 | + EXPECT_STREQ(GetDataTypeDesc(ACL_STRING), "STRING(13)"); | ||
| 2935 | + EXPECT_STREQ(GetDataTypeDesc(ACL_COMPLEX64), "COMPLEX64(16)"); | ||
| 2936 | + EXPECT_STREQ(GetDataTypeDesc(ACL_COMPLEX128), "COMPLEX128(17)"); | ||
| 2937 | + EXPECT_STREQ(GetDataTypeDesc(ACL_BF16), "BF16(27)"); | ||
| 2938 | + EXPECT_STREQ(GetDataTypeDesc(ACL_INT4), "INT4(29)"); | ||
| 2939 | + EXPECT_STREQ(GetDataTypeDesc(ACL_UINT1), "UINT1(30)"); | ||
| 2940 | + EXPECT_STREQ(GetDataTypeDesc(ACL_COMPLEX32), "COMPLEX32(33)"); | ||
| 2941 | + EXPECT_STREQ(GetDataTypeDesc(ACL_HIFLOAT8), "HIFLOAT8(34)"); | ||
| 2942 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT8_E5M2), "FLOAT8_E5M2(35)"); | ||
| 2943 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT8_E4M3FN), "FLOAT8_E4M3FN(36)"); | ||
| 2944 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT8_E8M0), "FLOAT8_E8M0(37)"); | ||
| 2945 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT6_E3M2), "FLOAT6_E3M2(38)"); | ||
| 2946 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT6_E2M3), "FLOAT6_E2M3(39)"); | ||
| 2947 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT4_E2M1), "FLOAT4_E2M1(40)"); | ||
| 2948 | + EXPECT_STREQ(GetDataTypeDesc(ACL_FLOAT4_E1M2), "FLOAT4_E1M2(41)"); | ||
| 2949 | + | ||
| 2950 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_HOST_TO_HOST), "MEMCPY_HOST_TO_HOST(0)"); | ||
| 2951 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_HOST_TO_DEVICE), "MEMCPY_HOST_TO_DEVICE(1)"); | ||
| 2952 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_DEVICE_TO_HOST), "MEMCPY_DEVICE_TO_HOST(2)"); | ||
| 2953 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_DEVICE_TO_DEVICE), "MEMCPY_DEVICE_TO_DEVICE(3)"); | ||
| 2954 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_DEFAULT), "MEMCPY_DEFAULT(4)"); | ||
| 2955 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_HOST_TO_BUF_TO_DEVICE), "MEMCPY_HOST_TO_BUF_TO_DEVICE(5)"); | ||
| 2956 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_INNER_DEVICE_TO_DEVICE), "MEMCPY_INNER_DEVICE_TO_DEVICE(6)"); | ||
| 2957 | + EXPECT_STREQ(GetMemcpyKindDesc(ACL_MEMCPY_INTER_DEVICE_TO_DEVICE), "MEMCPY_INTER_DEVICE_TO_DEVICE(7)"); | ||
| 2958 | + | ||
| 2959 | + EXPECT_STREQ(GetMemAttrDesc(ACL_DDR_MEM), "DDR_MEM(0)"); | ||
| 2960 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM), "HBM_MEM(1)"); | ||
| 2961 | + EXPECT_STREQ(GetMemAttrDesc(ACL_DDR_MEM_HUGE), "DDR_MEM_HUGE(2)"); | ||
| 2962 | + EXPECT_STREQ(GetMemAttrDesc(ACL_DDR_MEM_NORMAL), "DDR_MEM_NORMAL(3)"); | ||
| 2963 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_HUGE), "HBM_MEM_HUGE(4)"); | ||
| 2964 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_NORMAL), "HBM_MEM_NORMAL(5)"); | ||
| 2965 | + EXPECT_STREQ(GetMemAttrDesc(ACL_DDR_MEM_P2P_HUGE), "DDR_MEM_P2P_HUGE(6)"); | ||
| 2966 | + EXPECT_STREQ(GetMemAttrDesc(ACL_DDR_MEM_P2P_NORMAL), "DDR_MEM_P2P_NORMAL(7)"); | ||
| 2967 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_P2P_HUGE), "HBM_MEM_P2P_HUGE(8)"); | ||
| 2968 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_P2P_NORMAL), "HBM_MEM_P2P_NORMAL(9)"); | ||
| 2969 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_HUGE1G), "HBM_MEM_HUGE1G(10)"); | ||
| 2970 | + EXPECT_STREQ(GetMemAttrDesc(ACL_HBM_MEM_P2P_HUGE1G), "HBM_MEM_P2P_HUGE1G(11)"); | ||
| 2971 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_NORMAL), "MEM_NORMAL(12)"); | ||
| 2972 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_HUGE), "MEM_HUGE(13)"); | ||
| 2973 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_HUGE1G), "MEM_HUGE1G(14)"); | ||
| 2974 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_P2P_NORMAL), "MEM_P2P_NORMAL(15)"); | ||
| 2975 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_P2P_HUGE), "MEM_P2P_HUGE(16)"); | ||
| 2976 | + EXPECT_STREQ(GetMemAttrDesc(ACL_MEM_P2P_HUGE1G), "MEM_P2P_HUGE1G(17)"); | ||
| 2977 | + | ||
| 2978 | + EXPECT_STREQ(GetCannAttrDesc(ACL_CANN_ATTR_UNDEFINED), "CANN_ATTR_UNDEFINED(-1)"); | ||
| 2979 | + EXPECT_STREQ(GetCannAttrDesc(ACL_CANN_ATTR_INF_NAN), "CANN_ATTR_INF_NAN(0)"); | ||
| 2980 | + EXPECT_STREQ(GetCannAttrDesc(ACL_CANN_ATTR_BF16), "CANN_ATTR_BF16(1)"); | ||
| 2981 | + EXPECT_STREQ(GetCannAttrDesc(ACL_CANN_ATTR_JIT_COMPILE), "CANN_ATTR_JIT_COMPILE(2)"); | ||
| 2982 | + EXPECT_STREQ(GetDevResLimitTypeDesc(ACL_RT_DEV_RES_CUBE_CORE), "RT_DEV_RES_CUBE_CORE(0)"); | ||
| 2983 | + EXPECT_STREQ(GetDevResLimitTypeDesc(ACL_RT_DEV_RES_VECTOR_CORE), "RT_DEV_RES_VECTOR_CORE(1)"); | ||
| 2984 | + EXPECT_STREQ(GetReduceKindDesc(ACL_RT_MEMCPY_SDMA_AUTOMATIC_SUM), "RT_MEMCPY_SDMA_AUTOMATIC_SUM(10)"); | ||
| 2985 | + EXPECT_STREQ(GetReduceKindDesc(ACL_RT_MEMCPY_SDMA_AUTOMATIC_MAX), "RT_MEMCPY_SDMA_AUTOMATIC_MAX(11)"); | ||
| 2986 | + EXPECT_STREQ(GetReduceKindDesc(ACL_RT_MEMCPY_SDMA_AUTOMATIC_MIN), "RT_MEMCPY_SDMA_AUTOMATIC_MIN(12)"); | ||
| 2987 | + EXPECT_STREQ(GetReduceKindDesc(ACL_RT_MEMCPY_SDMA_AUTOMATIC_EQUAL), "RT_MEMCPY_SDMA_AUTOMATIC_EQUAL(13)"); | ||
| 2988 | + EXPECT_STREQ(GetMemLinkTypeDesc(ACL_RT_MEM_ACCESS_LINK_SIO), "RT_MEM_ACCESS_LINK_SIO(0)"); | ||
| 2989 | + EXPECT_STREQ(GetMemLinkTypeDesc(ACL_RT_MEM_ACCESS_LINK_HCCS), "RT_MEM_ACCESS_LINK_HCCS(1)"); | ||
| 2990 | + EXPECT_STREQ(GetMemLinkTypeDesc(ACL_RT_MEM_ACCESS_UB_ONE_PORT_PATH), "RT_MEM_ACCESS_UB_ONE_PORT_PATH(2)"); | ||
| 2991 | + EXPECT_STREQ(GetMemLinkTypeDesc(ACL_RT_MEM_ACCESS_UB_MULTI_PORT_PATH), "RT_MEM_ACCESS_UB_MULTI_PORT_PATH(3)"); | ||
| 2992 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_NO_ERROR), "RT_NO_ERROR(0)"); | ||
| 2993 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_MEMORY), "RT_ERROR_MEMORY(1)"); | ||
| 2994 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_L2), "RT_ERROR_L2(2)"); | ||
| 2995 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_AICORE), "RT_ERROR_AICORE(3)"); | ||
| 2996 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_LINK), "RT_ERROR_LINK(4)"); | ||
| 2997 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_L3_PORT), "RT_ERROR_L3_PORT(5)"); | ||
| 2998 | + EXPECT_STREQ(GetErrorTypeDesc(ACL_RT_ERROR_OTHERS), "RT_ERROR_OTHERS(65535)"); | ||
| 2999 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_EQUAL), "RT_EQUAL(0)"); | ||
| 3000 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_NOT_EQUAL), "RT_NOT_EQUAL(1)"); | ||
| 3001 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_GREATER), "RT_GREATER(2)"); | ||
| 3002 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_GREATER_OR_EQUAL), "RT_GREATER_OR_EQUAL(3)"); | ||
| 3003 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_LESS), "RT_LESS(4)"); | ||
| 3004 | + EXPECT_STREQ(GetConditionDesc(ACL_RT_LESS_OR_EQUAL), "RT_LESS_OR_EQUAL(5)"); | ||
| 3005 | + EXPECT_STREQ(GetCompareDataTypeDesc(ACL_RT_SWITCH_INT32), "RT_SWITCH_INT32(0)"); | ||
| 3006 | + EXPECT_STREQ(GetCompareDataTypeDesc(ACL_RT_SWITCH_INT64), "RT_SWITCH_INT64(1)"); | ||
| 3007 | + EXPECT_STREQ(GetIpcMemAttrTypeDesc(ACL_RT_IPC_MEM_ATTR_ACCESS_LINK), "RT_IPC_MEM_ATTR_ACCESS_LINK(0)"); | ||
| 3008 | + EXPECT_STREQ(GetFloatOverflowModeDesc(ACL_RT_OVERFLOW_MODE_SATURATION), "RT_OVERFLOW_MODE_SATURATION(0)"); | ||
| 3009 | + EXPECT_STREQ(GetFloatOverflowModeDesc(ACL_RT_OVERFLOW_MODE_INFNAN), "RT_OVERFLOW_MODE_INFNAN(1)"); | ||
| 3010 | + EXPECT_STREQ(GetFloatOverflowModeDesc(ACL_RT_OVERFLOW_MODE_UNDEF), "RT_OVERFLOW_MODE_UNDEF(2)"); | ||
| 3011 | + EXPECT_STREQ(GetCmoTypeDesc(ACL_RT_CMO_TYPE_PREFETCH), "RT_CMO_TYPE_PREFETCH(0)"); | ||
| 3012 | + EXPECT_STREQ(GetCmoTypeDesc(ACL_RT_CMO_TYPE_WRITEBACK), "RT_CMO_TYPE_WRITEBACK(1)"); | ||
| 3013 | + EXPECT_STREQ(GetCmoTypeDesc(ACL_RT_CMO_TYPE_INVALID), "RT_CMO_TYPE_INVALID(2)"); | ||
| 3014 | + EXPECT_STREQ(GetCmoTypeDesc(ACL_RT_CMO_TYPE_FLUSH), "RT_CMO_TYPE_FLUSH(3)"); | ||
| 3015 | + EXPECT_STREQ(GetDeviceLimitDesc(ACL_RT_DEV_LIMIT_SIMT_STACK_SIZE), "RT_DEV_LIMIT_SIMT_STACK_SIZE(0)"); | ||
| 3016 | + EXPECT_STREQ( | ||
| 3017 | + GetDeviceLimitDesc(ACL_RT_DEV_LIMIT_SIMT_DVG_WARP_STACK_SIZE), "RT_DEV_LIMIT_SIMT_DVG_WARP_STACK_SIZE(1)"); | ||
| 3018 | + EXPECT_STREQ(GetDeviceLimitDesc(ACL_RT_DEV_LIMIT_SIMD_STACK_SIZE), "RT_DEV_LIMIT_SIMD_STACK_SIZE(2)"); | ||
| 3019 | + EXPECT_STREQ( | ||
| 3020 | + GetDeviceLimitDesc(ACL_RT_DEV_LIMIT_SIMD_PRINTF_FIFO_SIZE_PER_CORE), | ||
| 3021 | + "RT_DEV_LIMIT_SIMD_PRINTF_FIFO_SIZE_PER_CORE(3)"); | ||
| 3022 | + EXPECT_STREQ(GetDeviceLimitDesc(ACL_RT_DEV_LIMIT_SIMT_PRINTF_FIFO_SIZE), "RT_DEV_LIMIT_SIMT_PRINTF_FIFO_SIZE(4)"); | ||
| 3023 | +} | ||
| 3024 | + | ||
| 3025 | +TEST_F(UTEST_ACL_Common, EnumDescPreservesUnknownNumericValue) | ||
| 3026 | +{ | ||
| 3027 | + EXPECT_STREQ(GetDataTypeDesc(static_cast<aclDataType>(97)), "UNKNOWN(97)"); | ||
| 3028 | + EXPECT_STREQ(GetMemcpyKindDesc(static_cast<aclrtMemcpyKind>(98)), "UNKNOWN(98)"); | ||
| 3029 | + EXPECT_STREQ(GetMemAttrDesc(static_cast<aclrtMemAttr>(99)), "UNKNOWN(99)"); | ||
| 3030 | + EXPECT_STREQ(GetCannAttrDesc(static_cast<aclCannAttr>(90)), "UNKNOWN(90)"); | ||
| 3031 | + EXPECT_STREQ(GetDevResLimitTypeDesc(static_cast<aclrtDevResLimitType>(91)), "UNKNOWN(91)"); | ||
| 3032 | + EXPECT_STREQ(GetReduceKindDesc(static_cast<aclrtReduceKind>(92)), "UNKNOWN(92)"); | ||
| 3033 | + EXPECT_STREQ(GetMemLinkTypeDesc(static_cast<aclrtMemLinkType>(93)), "UNKNOWN(93)"); | ||
| 3034 | + EXPECT_STREQ(GetErrorTypeDesc(static_cast<aclrtErrorType>(94)), "UNKNOWN(94)"); | ||
| 3035 | + EXPECT_STREQ(GetConditionDesc(static_cast<aclrtCondition>(95)), "UNKNOWN(95)"); | ||
| 3036 | + EXPECT_STREQ(GetCompareDataTypeDesc(static_cast<aclrtCompareDataType>(96)), "UNKNOWN(96)"); | ||
| 3037 | + EXPECT_STREQ(GetIpcMemAttrTypeDesc(static_cast<aclrtIpcMemAttrType>(100)), "UNKNOWN(100)"); | ||
| 3038 | + EXPECT_STREQ(GetFloatOverflowModeDesc(static_cast<aclrtFloatOverflowMode>(101)), "UNKNOWN(101)"); | ||
| 3039 | + EXPECT_STREQ(GetCmoTypeDesc(static_cast<aclrtCmoType>(102)), "UNKNOWN(102)"); | ||
| 3040 | + EXPECT_STREQ(GetDeviceLimitDesc(static_cast<aclrtDeviceLimit>(103)), "UNKNOWN(103)"); | ||
| 3041 | +} | ||
| @@ -213,6 +213,9 @@ set(runtimeut_src_v201_c_list | |||
| 213 | ) | 213 | ) |
| 214 | 214 | ||
| 215 | set(runtimeut_src_common_list | 215 | set(runtimeut_src_common_list |
| 216 | + ${TOP_DIR}/src/runtime/core/src/common/enum_desc.cc | ||
| 217 | + ${TOP_DIR}/src/runtime/core/src/common/api_enum_desc.cc | ||
| 218 | + ${TOP_DIR}/src/runtime/core/src/common/optional_enum_desc.cc | ||
| 216 | ${TOP_DIR}/src/runtime/core/src/common/error_code.cc | 219 | ${TOP_DIR}/src/runtime/core/src/common/error_code.cc |
| 217 | ${TOP_DIR}/src/runtime/core/src/common/thread_local_container.cc | 220 | ${TOP_DIR}/src/runtime/core/src/common/thread_local_container.cc |
| 218 | ${TOP_DIR}/src/runtime/core/src/common/utils.cc | 221 | ${TOP_DIR}/src/runtime/core/src/common/utils.cc |
| @@ -196,6 +196,9 @@ set(runtimeut_src_callback_list | |||
| 196 | ) | 196 | ) |
| 197 | 197 | ||
| 198 | set(runtimeut_src_common_list | 198 | set(runtimeut_src_common_list |
| 199 | + ${TOP_DIR}/src/runtime/core/src/common/enum_desc.cc | ||
| 200 | + ${TOP_DIR}/src/runtime/core/src/common/api_enum_desc.cc | ||
| 201 | + ${TOP_DIR}/src/runtime/core/src/common/optional_enum_desc.cc | ||
| 199 | ${TOP_DIR}/src/runtime/core/src/common/error_code.cc | 202 | ${TOP_DIR}/src/runtime/core/src/common/error_code.cc |
| 200 | ${TOP_DIR}/src/runtime/core/src/common/thread_local_container.cc | 203 | ${TOP_DIR}/src/runtime/core/src/common/thread_local_container.cc |
| 201 | ${TOP_DIR}/src/runtime/core/src/common/utils.cc | 204 | ${TOP_DIR}/src/runtime/core/src/common/utils.cc |
| @@ -30,20 +30,23 @@ protected: | |||
| 30 | TEST_F(MemoryTypeManagerTest, memory_type_test) | 30 | TEST_F(MemoryTypeManagerTest, memory_type_test) |
| 31 | { | 31 | { |
| 32 | rtMemLocationType type = RT_MEMORY_LOC_HOST; | 32 | rtMemLocationType type = RT_MEMORY_LOC_HOST; |
| 33 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOCATION_HOST"); | 33 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_HOST(0)"); |
| 34 | 34 | ||
| 35 | type = RT_MEMORY_LOC_DEVICE; | 35 | type = RT_MEMORY_LOC_DEVICE; |
| 36 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOCATION_DEVICE"); | 36 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_DEVICE(1)"); |
| 37 | 37 | ||
| 38 | type = RT_MEMORY_LOC_UNREGISTERED; | 38 | type = RT_MEMORY_LOC_UNREGISTERED; |
| 39 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOCATION_UNREGISTERED"); | 39 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_UNREGISTERED(2)"); |
| 40 | 40 | ||
| 41 | type = RT_MEMORY_LOC_MANAGED; | 41 | type = RT_MEMORY_LOC_MANAGED; |
| 42 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOCATION_MANAGED"); | 42 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_MANAGED(3)"); |
| 43 | 43 | ||
| 44 | type = RT_MEMORY_LOC_HOST_NUMA; | 44 | type = RT_MEMORY_LOC_HOST_NUMA; |
| 45 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOC_HOST_NUMA"); | 45 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_HOST_NUMA(4)"); |
| 46 | 46 | ||
| 47 | type = RT_MEMORY_LOC_MAX; | 47 | type = RT_MEMORY_LOC_MAX; |
| 48 | - EXPECT_STREQ(MemLocationTypeToStr(type), "RT_MEMORY_LOCATION_MAX"); | 48 | + EXPECT_STREQ(MemLocationTypeToStr(type), "MEMORY_LOC_MAX(5)"); |
| 49 | + | ||
| 50 | + type = static_cast<rtMemLocationType>(100); | ||
| 51 | + EXPECT_STREQ(MemLocationTypeToStr(type), "UNKNOWN(100)"); | ||
| 49 | } | 52 | } |
| @@ -106,6 +106,9 @@ set(runtimeut_src_api_impl_list | |||
| 106 | ) | 106 | ) |
| 107 | 107 | ||
| 108 | set(runtimeut_src_common_list | 108 | set(runtimeut_src_common_list |
| 109 | + ${TOP_DIR}/src/runtime/core/src/common/enum_desc.cc | ||
| 110 | + ${TOP_DIR}/src/runtime/core/src/common/api_enum_desc.cc | ||
| 111 | + ${TOP_DIR}/src/runtime/core/src/common/optional_enum_desc.cc | ||
| 109 | ${TOP_DIR}/src/runtime/core/src/common/args_buffer_guard.cc | 112 | ${TOP_DIR}/src/runtime/core/src/common/args_buffer_guard.cc |
| 110 | ${TOP_DIR}/src/runtime/core/src/common/context_data_manage.cc | 113 | ${TOP_DIR}/src/runtime/core/src/common/context_data_manage.cc |
| 111 | ${TOP_DIR}/src/runtime/core/src/common/dev_info_manage.cc | 114 | ${TOP_DIR}/src/runtime/core/src/common/dev_info_manage.cc |
| @@ -72,15 +72,15 @@ TEST(EnumToStringUtilsTest, ModuleTypeToStringKnownValue) | |||
| 72 | 72 | ||
| 73 | TEST(EnumToStringUtilsTest, ModuleTypeToStringUnknownValue) { EXPECT_EQ(ModuleTypeToString(-1), "UNKNOWN(-1)"); } | 73 | TEST(EnumToStringUtilsTest, ModuleTypeToStringUnknownValue) { EXPECT_EQ(ModuleTypeToString(-1), "UNKNOWN(-1)"); } |
| 74 | 74 | ||
| 75 | -TEST(EnumToStringUtilsTest, MemcpyKindToStringKnownValue) | 75 | +TEST(EnumToStringUtilsTest, MemcpyKindToStrKnownValue) |
| 76 | { | 76 | { |
| 77 | - EXPECT_EQ(MemcpyKindToString(RT_MEMCPY_HOST_TO_HOST), "MEMCPY_HOST_TO_HOST(0)"); | 77 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_HOST_TO_HOST), "MEMCPY_HOST_TO_HOST(0)"); |
| 78 | - EXPECT_EQ(MemcpyKindToString(RT_MEMCPY_DEFAULT), "MEMCPY_DEFAULT(8)"); | 78 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_DEFAULT), "MEMCPY_DEFAULT(8)"); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | -TEST(EnumToStringUtilsTest, MemcpyKindToStringUnknownValue) | 81 | +TEST(EnumToStringUtilsTest, MemcpyKindToStrUnknownValue) |
| 82 | { | 82 | { |
| 83 | - EXPECT_EQ(MemcpyKindToString(static_cast<rtMemcpyKind_t>(100)), "UNKNOWN(100)"); | 83 | + EXPECT_STREQ(MemcpyKindToStr(static_cast<rtMemcpyKind_t>(100)), "UNKNOWN(100)"); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | TEST(EnumToStringUtilsTest, MemcpyNewKindToStringKnownValue) | 86 | TEST(EnumToStringUtilsTest, MemcpyNewKindToStringKnownValue) |
| @@ -118,6 +118,7 @@ TEST(EnumToStringUtilsTest, CondTaskTypeToStringKnownValue) | |||
| 118 | { | 118 | { |
| 119 | EXPECT_EQ(CondTaskTypeToString(RT_COND_TASK_TYPE_IF), "COND_TASK_TYPE_IF(0)"); | 119 | EXPECT_EQ(CondTaskTypeToString(RT_COND_TASK_TYPE_IF), "COND_TASK_TYPE_IF(0)"); |
| 120 | EXPECT_EQ(CondTaskTypeToString(RT_COND_TASK_TYPE_SWITCH), "COND_TASK_TYPE_SWITCH(2)"); | 120 | EXPECT_EQ(CondTaskTypeToString(RT_COND_TASK_TYPE_SWITCH), "COND_TASK_TYPE_SWITCH(2)"); |
| 121 | + EXPECT_EQ(CondTaskTypeToString(RT_COND_TASK_TYPE_MAX), "COND_TASK_TYPE_MAX(3)"); | ||
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | TEST(EnumToStringUtilsTest, CondTaskTypeToStringUnknownValue) | 124 | TEST(EnumToStringUtilsTest, CondTaskTypeToStringUnknownValue) |
| @@ -223,6 +224,64 @@ TEST(EnumToStringUtilsTest, MemInfoTypeToStringUnknownValue) | |||
| 223 | EXPECT_EQ(MemInfoTypeToString(static_cast<rtMemInfoType_t>(100)), "UNKNOWN(100)"); | 224 | EXPECT_EQ(MemInfoTypeToString(static_cast<rtMemInfoType_t>(100)), "UNKNOWN(100)"); |
| 224 | } | 225 | } |
| 225 | 226 | ||
| 227 | +TEST(EnumToStringUtilsTest, RemediatedEnumToStringKnownValue) | ||
| 228 | +{ | ||
| 229 | + EXPECT_EQ( | ||
| 230 | + ManagedMemLocationTypeToString(rtMemLocationTypeHostNumaCurrent), "MEM_LOCATION_TYPE_HOST_NUMA_CURRENT(4)"); | ||
| 231 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_VA_FLAG), "MEM_MALLOC_ATTR_VA_FLAG(3)"); | ||
| 232 | + EXPECT_STREQ(FloatOverflowModeToString(RT_OVERFLOW_MODE_INFNAN), "OVERFLOW_MODE_INFNAN(1)"); | ||
| 233 | + EXPECT_STREQ(FloatOverflowModeToString(RT_OVERFLOW_MODE_UNDEF), "OVERFLOW_MODE_UNDEF(2)"); | ||
| 234 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_FLUSH), "CMO_FLUSH(9)"); | ||
| 235 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_RESERVED), "CMO_RESERVED(10)"); | ||
| 236 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE), "LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE(5)"); | ||
| 237 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_STRONG_CONSISTENCY), "SYS_OPT_STRONG_CONSISTENCY(2)"); | ||
| 238 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_RESERVED), "SYS_OPT_RESERVED(3)"); | ||
| 239 | + EXPECT_STREQ(DevResLimitTypeToString(RT_DEV_RES_VECTOR_CORE), "DEV_RES_VECTOR_CORE(1)"); | ||
| 240 | + EXPECT_STREQ(DevResLimitTypeToString(RT_DEV_RES_TYPE_MAX), "DEV_RES_TYPE_MAX(2)"); | ||
| 241 | + EXPECT_EQ(ConditionToString(RT_GREATER_OR_EQUAL), "GREATER_OR_EQUAL(3)"); | ||
| 242 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_AICPU), "KERNEL_ATTR_TYPE_AICPU(100)"); | ||
| 243 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_TIMEOUT_US), "LAUNCH_KERNEL_ATTR_TIMEOUT_US(8)"); | ||
| 244 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_MAX), "LAUNCH_KERNEL_ATTR_MAX(9)"); | ||
| 245 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_NPU_ARCH), "DEV_ATTR_NPU_ARCH(601)"); | ||
| 246 | + EXPECT_STREQ( | ||
| 247 | + DevAttrToString(RT_DEV_ATTR_MAX), RtFmtMsg("DEV_ATTR_MAX(%d)", static_cast<int32_t>(RT_DEV_ATTR_MAX)).c_str()); | ||
| 248 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_CCU), "HAC_TYPE_CCU(9)"); | ||
| 249 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrUsedMemHigh), "rtMemPoolAttrUsedMemHigh(8)"); | ||
| 250 | + EXPECT_EQ(DeviceStatusToString(RT_DEVICE_STATUS_END), "DEVICE_STATUS_END(65535)"); | ||
| 251 | + EXPECT_STREQ(DrvMemHandleTypeToString(RT_MEM_HANDLE_TYPE_POSIX), "MEM_HANDLE_TYPE_POSIX(2)"); | ||
| 252 | + EXPECT_STREQ(MemSharedHandleTypeToString(RT_MEM_SHARE_HANDLE_TYPE_FABRIC), "MEM_SHARE_HANDLE_TYPE_FABRIC(2)"); | ||
| 253 | + EXPECT_EQ(TaskTypeToString(RT_TASK_VALUE_WAIT), "TASK_VALUE_WAIT(6)"); | ||
| 254 | + EXPECT_EQ( | ||
| 255 | + StreamCaptureStatusToString(RT_STREAM_CAPTURE_STATUS_INVALIDATED), "STREAM_CAPTURE_STATUS_INVALIDATED(2)"); | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +TEST(EnumToStringUtilsTest, RemediatedEnumToStringUnknownValue) | ||
| 259 | +{ | ||
| 260 | + EXPECT_EQ(ManagedMemLocationTypeToString(static_cast<rtMemManagedLocationType>(100)), "UNKNOWN(100)"); | ||
| 261 | + EXPECT_STREQ(MallocAttrToString(static_cast<rtMallocAttr>(101)), "UNKNOWN(101)"); | ||
| 262 | + EXPECT_STREQ(FloatOverflowModeToString(static_cast<rtFloatOverflowMode_t>(102)), "UNKNOWN(102)"); | ||
| 263 | + EXPECT_EQ(CmoOpCodeToString(static_cast<rtCmoOpCode_t>(104)), "UNKNOWN(104)"); | ||
| 264 | + EXPECT_EQ(LimitTypeToString(static_cast<rtLimitType_t>(106)), "UNKNOWN(106)"); | ||
| 265 | + EXPECT_EQ(SysParamOptToString(static_cast<rtSysParamOpt>(107)), "UNKNOWN(107)"); | ||
| 266 | + EXPECT_STREQ(DevResLimitTypeToString(static_cast<rtDevResLimitType_t>(108)), "UNKNOWN(108)"); | ||
| 267 | + EXPECT_EQ(ConditionToString(static_cast<rtCondition_t>(109)), "UNKNOWN(109)"); | ||
| 268 | + EXPECT_EQ(KernelAttrTypeToString(static_cast<rtKernelAttrType>(110)), "UNKNOWN(110)"); | ||
| 269 | + EXPECT_EQ(LaunchKernelAttrIdToString(static_cast<rtLaunchKernelAttrId>(111)), "UNKNOWN(111)"); | ||
| 270 | + EXPECT_STREQ(DevAttrToString(static_cast<rtDevAttr>(113)), "UNKNOWN(113)"); | ||
| 271 | + EXPECT_EQ(HacTypeToString(static_cast<rtHacType>(115)), "UNKNOWN(115)"); | ||
| 272 | + EXPECT_EQ(MemPoolAttrToString(static_cast<rtMemPoolAttr>(116)), "UNKNOWN(116)"); | ||
| 273 | + EXPECT_EQ(DeviceStatusToString(static_cast<rtDeviceStatus>(117)), "UNKNOWN(117)"); | ||
| 274 | + EXPECT_STREQ(DrvMemHandleTypeToString(static_cast<rtDrvMemHandleType>(118)), "UNKNOWN(118)"); | ||
| 275 | + EXPECT_STREQ(MemSharedHandleTypeToString(static_cast<rtMemSharedHandleType>(119)), "UNKNOWN(119)"); | ||
| 276 | + EXPECT_EQ( | ||
| 277 | + RtFmtMsg( | ||
| 278 | + "%s,%s", MallocAttrToString(static_cast<rtMallocAttr>(101)), | ||
| 279 | + FloatOverflowModeToString(static_cast<rtFloatOverflowMode_t>(102))), | ||
| 280 | + "UNKNOWN(101),UNKNOWN(102)"); | ||
| 281 | + EXPECT_EQ(TaskTypeToString(static_cast<rtTaskType>(120)), "UNKNOWN(120)"); | ||
| 282 | + EXPECT_EQ(StreamCaptureStatusToString(static_cast<rtStreamCaptureStatus>(121)), "UNKNOWN(121)"); | ||
| 283 | +} | ||
| 284 | + | ||
| 226 | TEST(EnumToStringUtilsTest, SwitchDataTypeToStringKnownValue) | 285 | TEST(EnumToStringUtilsTest, SwitchDataTypeToStringKnownValue) |
| 227 | { | 286 | { |
| 228 | EXPECT_EQ(SwitchDataTypeToString(RT_SWITCH_INT32), "SWITCH_INT32(0)"); | 287 | EXPECT_EQ(SwitchDataTypeToString(RT_SWITCH_INT32), "SWITCH_INT32(0)"); |
| @@ -238,6 +297,7 @@ TEST(EnumToStringUtilsTest, RandomNumDataTypeToStringKnownValue) | |||
| 238 | { | 297 | { |
| 239 | EXPECT_EQ(RandomNumDataTypeToString(RT_RANDOM_NUM_DATATYPE_INT32), "RANDOM_NUM_DATATYPE_INT32(0)"); | 298 | EXPECT_EQ(RandomNumDataTypeToString(RT_RANDOM_NUM_DATATYPE_INT32), "RANDOM_NUM_DATATYPE_INT32(0)"); |
| 240 | EXPECT_EQ(RandomNumDataTypeToString(RT_RANDOM_NUM_DATATYPE_FP32), "RANDOM_NUM_DATATYPE_FP32(6)"); | 299 | EXPECT_EQ(RandomNumDataTypeToString(RT_RANDOM_NUM_DATATYPE_FP32), "RANDOM_NUM_DATATYPE_FP32(6)"); |
| 300 | + EXPECT_EQ(RandomNumDataTypeToString(RT_RANDOM_NUM_DATATYPE_MAX), "RANDOM_NUM_DATATYPE_MAX(7)"); | ||
| 241 | } | 301 | } |
| 242 | 302 | ||
| 243 | TEST(EnumToStringUtilsTest, RandomNumDataTypeToStringUnknownValue) | 303 | TEST(EnumToStringUtilsTest, RandomNumDataTypeToStringUnknownValue) |
| @@ -252,9 +312,219 @@ TEST(EnumToStringUtilsTest, RandomNumFuncTypeToStringKnownValue) | |||
| 252 | EXPECT_EQ( | 312 | EXPECT_EQ( |
| 253 | RandomNumFuncTypeToString(RT_RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS), | 313 | RandomNumFuncTypeToString(RT_RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS), |
| 254 | "RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS(3)"); | 314 | "RANDOM_NUM_FUNC_TYPE_TRUNCATED_NORMAL_DIS(3)"); |
| 315 | + EXPECT_EQ(RandomNumFuncTypeToString(RT_RANDOM_NUM_FUNC_TYPE_MAX), "RANDOM_NUM_FUNC_TYPE_MAX(4)"); | ||
| 255 | } | 316 | } |
| 256 | 317 | ||
| 257 | TEST(EnumToStringUtilsTest, RandomNumFuncTypeToStringUnknownValue) | 318 | TEST(EnumToStringUtilsTest, RandomNumFuncTypeToStringUnknownValue) |
| 258 | { | 319 | { |
| 259 | EXPECT_EQ(RandomNumFuncTypeToString(static_cast<rtRandomNumFuncType>(100)), "UNKNOWN(100)"); | 320 | EXPECT_EQ(RandomNumFuncTypeToString(static_cast<rtRandomNumFuncType>(100)), "UNKNOWN(100)"); |
| 260 | } | 321 | } |
| 322 | + | ||
| 323 | +TEST(EnumToStringUtilsTest, CommonDataAndMemoryEnumsAllKnownValues) | ||
| 324 | +{ | ||
| 325 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_FP32), "DATA_TYPE_FP32(0)"); | ||
| 326 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_FP16), "DATA_TYPE_FP16(1)"); | ||
| 327 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_INT16), "DATA_TYPE_INT16(2)"); | ||
| 328 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_INT4), "DATA_TYPE_INT4(3)"); | ||
| 329 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_INT8), "DATA_TYPE_INT8(4)"); | ||
| 330 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_INT32), "DATA_TYPE_INT32(5)"); | ||
| 331 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_BFP16), "DATA_TYPE_BFP16(6)"); | ||
| 332 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_BFP32), "DATA_TYPE_BFP32(7)"); | ||
| 333 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_UINT8), "DATA_TYPE_UINT8(8)"); | ||
| 334 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_UINT16), "DATA_TYPE_UINT16(9)"); | ||
| 335 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_UINT32), "DATA_TYPE_UINT32(10)"); | ||
| 336 | + EXPECT_EQ(DataTypeToString(RT_DATA_TYPE_END), "DATA_TYPE_END(11)"); | ||
| 337 | + | ||
| 338 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_DDR), "MEMORYINFO_DDR(0)"); | ||
| 339 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM), "MEMORYINFO_HBM(1)"); | ||
| 340 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_DDR_HUGE), "MEMORYINFO_DDR_HUGE(2)"); | ||
| 341 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_DDR_NORMAL), "MEMORYINFO_DDR_NORMAL(3)"); | ||
| 342 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_HUGE), "MEMORYINFO_HBM_HUGE(4)"); | ||
| 343 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_NORMAL), "MEMORYINFO_HBM_NORMAL(5)"); | ||
| 344 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_DDR_P2P_HUGE), "MEMORYINFO_DDR_P2P_HUGE(6)"); | ||
| 345 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_DDR_P2P_NORMAL), "MEMORYINFO_DDR_P2P_NORMAL(7)"); | ||
| 346 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_P2P_HUGE), "MEMORYINFO_HBM_P2P_HUGE(8)"); | ||
| 347 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_P2P_NORMAL), "MEMORYINFO_HBM_P2P_NORMAL(9)"); | ||
| 348 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_HUGE1G), "MEMORYINFO_HBM_HUGE1G(10)"); | ||
| 349 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HBM_P2P_HUGE1G), "MEMORYINFO_HBM_P2P_HUGE1G(11)"); | ||
| 350 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_NORMAL), "MEMORYINFO_NORMAL(12)"); | ||
| 351 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HUGE), "MEMORYINFO_HUGE(13)"); | ||
| 352 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_HUGE1G), "MEMORYINFO_HUGE1G(14)"); | ||
| 353 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_P2P_NORMAL), "MEMORYINFO_P2P_NORMAL(15)"); | ||
| 354 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_P2P_HUGE), "MEMORYINFO_P2P_HUGE(16)"); | ||
| 355 | + EXPECT_EQ(MemInfoTypeToString(RT_MEMORYINFO_P2P_HUGE1G), "MEMORYINFO_P2P_HUGE1G(17)"); | ||
| 356 | + | ||
| 357 | + EXPECT_STREQ(DrvMemHandleTypeToString(RT_MEM_HANDLE_TYPE_NONE), "MEM_HANDLE_TYPE_NONE(0)"); | ||
| 358 | + EXPECT_STREQ(DrvMemHandleTypeToString(RT_MEM_HANDLE_TYPE_POSIX), "MEM_HANDLE_TYPE_POSIX(2)"); | ||
| 359 | + EXPECT_STREQ(MemSharedHandleTypeToString(RT_MEM_SHARE_HANDLE_TYPE_DEFAULT), "MEM_SHARE_HANDLE_TYPE_DEFAULT(1)"); | ||
| 360 | + EXPECT_STREQ(MemSharedHandleTypeToString(RT_MEM_SHARE_HANDLE_TYPE_FABRIC), "MEM_SHARE_HANDLE_TYPE_FABRIC(2)"); | ||
| 361 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_RSV), "MEM_MALLOC_ATTR_RSV(0)"); | ||
| 362 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_MODULE_ID), "MEM_MALLOC_ATTR_MODULE_ID(1)"); | ||
| 363 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_DEVICE_ID), "MEM_MALLOC_ATTR_DEVICE_ID(2)"); | ||
| 364 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_VA_FLAG), "MEM_MALLOC_ATTR_VA_FLAG(3)"); | ||
| 365 | + EXPECT_STREQ(MallocAttrToString(RT_MEM_MALLOC_ATTR_MAX), "MEM_MALLOC_ATTR_MAX(4)"); | ||
| 366 | + EXPECT_STREQ(FloatOverflowModeToString(RT_OVERFLOW_MODE_SATURATION), "OVERFLOW_MODE_SATURATION(0)"); | ||
| 367 | + EXPECT_STREQ(FloatOverflowModeToString(RT_OVERFLOW_MODE_INFNAN), "OVERFLOW_MODE_INFNAN(1)"); | ||
| 368 | + EXPECT_STREQ(FloatOverflowModeToString(RT_OVERFLOW_MODE_UNDEF), "OVERFLOW_MODE_UNDEF(2)"); | ||
| 369 | + | ||
| 370 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_HOST), "MEMORY_LOC_HOST(0)"); | ||
| 371 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_DEVICE), "MEMORY_LOC_DEVICE(1)"); | ||
| 372 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_UNREGISTERED), "MEMORY_LOC_UNREGISTERED(2)"); | ||
| 373 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_MANAGED), "MEMORY_LOC_MANAGED(3)"); | ||
| 374 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_HOST_NUMA), "MEMORY_LOC_HOST_NUMA(4)"); | ||
| 375 | + EXPECT_EQ(MemLocationTypeToString(RT_MEMORY_LOC_MAX), "MEMORY_LOC_MAX(5)"); | ||
| 376 | + EXPECT_EQ(MemLocationTypeToString(static_cast<rtMemLocationType>(100)), "UNKNOWN(100)"); | ||
| 377 | +} | ||
| 378 | + | ||
| 379 | +TEST(EnumToStringUtilsTest, CommonExecutionEnumsAllKnownValues) | ||
| 380 | +{ | ||
| 381 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_LOW_POWER_TIMEOUT), "LIMIT_TYPE_LOW_POWER_TIMEOUT(0)"); | ||
| 382 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_SIMT_STACK_SIZE), "LIMIT_TYPE_SIMT_STACK_SIZE(1)"); | ||
| 383 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE), "LIMIT_TYPE_SIMT_DVG_WARP_STACK_SIZE(2)"); | ||
| 384 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_STACK_SIZE), "LIMIT_TYPE_STACK_SIZE(3)"); | ||
| 385 | + EXPECT_EQ( | ||
| 386 | + LimitTypeToString(RT_LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE), | ||
| 387 | + "LIMIT_TYPE_SIMD_PRINTF_FIFO_SIZE_PER_CORE(4)"); | ||
| 388 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE), "LIMIT_TYPE_SIMT_PRINTF_FIFO_SIZE(5)"); | ||
| 389 | + EXPECT_EQ(LimitTypeToString(RT_LIMIT_TYPE_RESERVED), "LIMIT_TYPE_RESERVED(6)"); | ||
| 390 | + | ||
| 391 | + EXPECT_STREQ(DevResLimitTypeToString(RT_DEV_RES_CUBE_CORE), "DEV_RES_CUBE_CORE(0)"); | ||
| 392 | + EXPECT_STREQ(DevResLimitTypeToString(RT_DEV_RES_VECTOR_CORE), "DEV_RES_VECTOR_CORE(1)"); | ||
| 393 | + EXPECT_STREQ(DevResLimitTypeToString(RT_DEV_RES_TYPE_MAX), "DEV_RES_TYPE_MAX(2)"); | ||
| 394 | + EXPECT_EQ(ConditionToString(RT_EQUAL), "EQUAL(0)"); | ||
| 395 | + EXPECT_EQ(ConditionToString(RT_NOT_EQUAL), "NOT_EQUAL(1)"); | ||
| 396 | + EXPECT_EQ(ConditionToString(RT_GREATER), "GREATER(2)"); | ||
| 397 | + EXPECT_EQ(ConditionToString(RT_GREATER_OR_EQUAL), "GREATER_OR_EQUAL(3)"); | ||
| 398 | + EXPECT_EQ(ConditionToString(RT_LESS), "LESS(4)"); | ||
| 399 | + EXPECT_EQ(ConditionToString(RT_LESS_OR_EQUAL), "LESS_OR_EQUAL(5)"); | ||
| 400 | + | ||
| 401 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_AICORE), "KERNEL_ATTR_TYPE_AICORE(0)"); | ||
| 402 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_CUBE), "KERNEL_ATTR_TYPE_CUBE(1)"); | ||
| 403 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_VECTOR), "KERNEL_ATTR_TYPE_VECTOR(2)"); | ||
| 404 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_MIX), "KERNEL_ATTR_TYPE_MIX(3)"); | ||
| 405 | + EXPECT_EQ(KernelAttrTypeToString(RT_KERNEL_ATTR_TYPE_AICPU), "KERNEL_ATTR_TYPE_AICPU(100)"); | ||
| 406 | + | ||
| 407 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE), "LAUNCH_KERNEL_ATTR_SCHEM_MODE(1)"); | ||
| 408 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE), "LAUNCH_KERNEL_ATTR_DYN_UBUF_SIZE(2)"); | ||
| 409 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_ENGINE_TYPE), "LAUNCH_KERNEL_ATTR_ENGINE_TYPE(3)"); | ||
| 410 | + EXPECT_EQ( | ||
| 411 | + LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET), "LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET(4)"); | ||
| 412 | + EXPECT_EQ( | ||
| 413 | + LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH), | ||
| 414 | + "LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH(5)"); | ||
| 415 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_DATA_DUMP), "LAUNCH_KERNEL_ATTR_DATA_DUMP(6)"); | ||
| 416 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_TIMEOUT), "LAUNCH_KERNEL_ATTR_TIMEOUT(7)"); | ||
| 417 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_TIMEOUT_US), "LAUNCH_KERNEL_ATTR_TIMEOUT_US(8)"); | ||
| 418 | + EXPECT_EQ(LaunchKernelAttrIdToString(RT_LAUNCH_KERNEL_ATTR_MAX), "LAUNCH_KERNEL_ATTR_MAX(9)"); | ||
| 419 | + | ||
| 420 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_AICPU_CORE_NUM), "DEV_ATTR_AICPU_CORE_NUM(1)"); | ||
| 421 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_AICORE_CORE_NUM), "DEV_ATTR_AICORE_CORE_NUM(101)"); | ||
| 422 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_CUBE_CORE_NUM), "DEV_ATTR_CUBE_CORE_NUM(102)"); | ||
| 423 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_VECTOR_CORE_NUM), "DEV_ATTR_VECTOR_CORE_NUM(201)"); | ||
| 424 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_WARP_SIZE), "DEV_ATTR_WARP_SIZE(202)"); | ||
| 425 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE), "DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE(203)"); | ||
| 426 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_UBUF_PER_VECTOR_CORE), "DEV_ATTR_UBUF_PER_VECTOR_CORE(204)"); | ||
| 427 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_GRID_DIM_X), "DEV_ATTR_MAX_GRID_DIM_X(205)"); | ||
| 428 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_GRID_DIM_Y), "DEV_ATTR_MAX_GRID_DIM_Y(206)"); | ||
| 429 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_GRID_DIM_Z), "DEV_ATTR_MAX_GRID_DIM_Z(207)"); | ||
| 430 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_BLOCK_PER_GRID), "DEV_ATTR_MAX_BLOCK_PER_GRID(208)"); | ||
| 431 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_THREADS_PER_BLOCK), "DEV_ATTR_MAX_THREADS_PER_BLOCK(209)"); | ||
| 432 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_BLOCK_DIM_X), "DEV_ATTR_MAX_BLOCK_DIM_X(210)"); | ||
| 433 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_BLOCK_DIM_Y), "DEV_ATTR_MAX_BLOCK_DIM_Y(211)"); | ||
| 434 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAX_BLOCK_DIM_Z), "DEV_ATTR_MAX_BLOCK_DIM_Z(212)"); | ||
| 435 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE), "DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE(301)"); | ||
| 436 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_L2_CACHE_SIZE), "DEV_ATTR_L2_CACHE_SIZE(302)"); | ||
| 437 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_SMP_ID), "DEV_ATTR_SMP_ID(401)"); | ||
| 438 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_PHY_CHIP_ID), "DEV_ATTR_PHY_CHIP_ID(402)"); | ||
| 439 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_SUPER_POD_DEVICE_ID), "DEV_ATTR_SUPER_POD_DEVICE_ID(403)"); | ||
| 440 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_SUPER_POD_SERVER_ID), "DEV_ATTR_SUPER_POD_SERVER_ID(404)"); | ||
| 441 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_SUPER_POD_ID), "DEV_ATTR_SUPER_POD_ID(405)"); | ||
| 442 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_CUST_OP_PRIVILEGE), "DEV_ATTR_CUST_OP_PRIVILEGE(406)"); | ||
| 443 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_MAINBOARD_ID), "DEV_ATTR_MAINBOARD_ID(407)"); | ||
| 444 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_HD_CONNECT_TYPE), "DEV_ATTR_HD_CONNECT_TYPE(408)"); | ||
| 445 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_DEVICE_FORM_FACTOR), "DEV_ATTR_DEVICE_FORM_FACTOR(409)"); | ||
| 446 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_IS_VIRTUAL), "DEV_ATTR_IS_VIRTUAL(501)"); | ||
| 447 | + EXPECT_STREQ(DevAttrToString(RT_DEV_ATTR_NPU_ARCH), "DEV_ATTR_NPU_ARCH(601)"); | ||
| 448 | + | ||
| 449 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_STARS), "HAC_TYPE_STARS(0)"); | ||
| 450 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_AICPU), "HAC_TYPE_AICPU(1)"); | ||
| 451 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_AIC), "HAC_TYPE_AIC(2)"); | ||
| 452 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_AIV), "HAC_TYPE_AIV(3)"); | ||
| 453 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_PCIEDMA), "HAC_TYPE_PCIEDMA(4)"); | ||
| 454 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_RDMA), "HAC_TYPE_RDMA(5)"); | ||
| 455 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_SDMA), "HAC_TYPE_SDMA(6)"); | ||
| 456 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_DVPP), "HAC_TYPE_DVPP(7)"); | ||
| 457 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_UDMA), "HAC_TYPE_UDMA(8)"); | ||
| 458 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_CCU), "HAC_TYPE_CCU(9)"); | ||
| 459 | + EXPECT_EQ(HacTypeToString(RT_HAC_TYPE_MAX), "HAC_TYPE_MAX(10)"); | ||
| 460 | + EXPECT_EQ(DeviceStatusToString(RT_DEVICE_STATUS_NORMAL), "DEVICE_STATUS_NORMAL(0)"); | ||
| 461 | + EXPECT_EQ(DeviceStatusToString(RT_DEVICE_STATUS_ABNORMAL), "DEVICE_STATUS_ABNORMAL(1)"); | ||
| 462 | + EXPECT_EQ(DeviceStatusToString(RT_DEVICE_STATUS_END), "DEVICE_STATUS_END(65535)"); | ||
| 463 | + EXPECT_EQ(TaskTypeToString(RT_TASK_DEFAULT), "TASK_DEFAULT(0)"); | ||
| 464 | + EXPECT_EQ(TaskTypeToString(RT_TASK_KERNEL), "TASK_KERNEL(1)"); | ||
| 465 | + EXPECT_EQ(TaskTypeToString(RT_TASK_EVENT_RECORD), "TASK_EVENT_RECORD(2)"); | ||
| 466 | + EXPECT_EQ(TaskTypeToString(RT_TASK_EVENT_WAIT), "TASK_EVENT_WAIT(3)"); | ||
| 467 | + EXPECT_EQ(TaskTypeToString(RT_TASK_EVENT_RESET), "TASK_EVENT_RESET(4)"); | ||
| 468 | + EXPECT_EQ(TaskTypeToString(RT_TASK_VALUE_WRITE), "TASK_VALUE_WRITE(5)"); | ||
| 469 | + EXPECT_EQ(TaskTypeToString(RT_TASK_VALUE_WAIT), "TASK_VALUE_WAIT(6)"); | ||
| 470 | +} | ||
| 471 | + | ||
| 472 | +TEST(EnumToStringUtilsTest, CommonApiEnumsAllKnownValues) | ||
| 473 | +{ | ||
| 474 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_HOST_TO_HOST), "MEMCPY_HOST_TO_HOST(0)"); | ||
| 475 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE), "MEMCPY_HOST_TO_DEVICE(1)"); | ||
| 476 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST), "MEMCPY_DEVICE_TO_HOST(2)"); | ||
| 477 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_DEVICE), "MEMCPY_DEVICE_TO_DEVICE(3)"); | ||
| 478 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_MANAGED), "MEMCPY_MANAGED(4)"); | ||
| 479 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_ADDR_DEVICE_TO_DEVICE), "MEMCPY_ADDR_DEVICE_TO_DEVICE(5)"); | ||
| 480 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_HOST_TO_DEVICE_EX), "MEMCPY_HOST_TO_DEVICE_EX(6)"); | ||
| 481 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_DEVICE_TO_HOST_EX), "MEMCPY_DEVICE_TO_HOST_EX(7)"); | ||
| 482 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_DEFAULT), "MEMCPY_DEFAULT(8)"); | ||
| 483 | + EXPECT_STREQ(MemcpyKindToStr(RT_MEMCPY_RESERVED), "MEMCPY_RESERVED(9)"); | ||
| 484 | + | ||
| 485 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_HOST_TO_HOST), "MEMCPY_KIND_HOST_TO_HOST(0)"); | ||
| 486 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_HOST_TO_DEVICE), "MEMCPY_KIND_HOST_TO_DEVICE(1)"); | ||
| 487 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_DEVICE_TO_HOST), "MEMCPY_KIND_DEVICE_TO_HOST(2)"); | ||
| 488 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_DEVICE_TO_DEVICE), "MEMCPY_KIND_DEVICE_TO_DEVICE(3)"); | ||
| 489 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_DEFAULT), "MEMCPY_KIND_DEFAULT(4)"); | ||
| 490 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE), "MEMCPY_KIND_HOST_TO_BUF_TO_DEVICE(5)"); | ||
| 491 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_INNER_DEVICE_TO_DEVICE), "MEMCPY_KIND_INNER_DEVICE_TO_DEVICE(6)"); | ||
| 492 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_INTER_DEVICE_TO_DEVICE), "MEMCPY_KIND_INTER_DEVICE_TO_DEVICE(7)"); | ||
| 493 | + EXPECT_EQ(MemcpyNewKindToString(RT_MEMCPY_KIND_MAX), "MEMCPY_KIND_MAX(8)"); | ||
| 494 | + | ||
| 495 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_PREFETCH), "CMO_PREFETCH(6)"); | ||
| 496 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_WRITEBACK), "CMO_WRITEBACK(7)"); | ||
| 497 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_INVALID), "CMO_INVALID(8)"); | ||
| 498 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_FLUSH), "CMO_FLUSH(9)"); | ||
| 499 | + EXPECT_EQ(CmoOpCodeToString(RT_CMO_RESERVED), "CMO_RESERVED(10)"); | ||
| 500 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_DETERMINISTIC), "SYS_OPT_DETERMINISTIC(0)"); | ||
| 501 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_ENABLE_DEBUG_KERNEL), "SYS_OPT_ENABLE_DEBUG_KERNEL(1)"); | ||
| 502 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_STRONG_CONSISTENCY), "SYS_OPT_STRONG_CONSISTENCY(2)"); | ||
| 503 | + EXPECT_EQ(SysParamOptToString(SYS_OPT_RESERVED), "SYS_OPT_RESERVED(3)"); | ||
| 504 | +} | ||
| 505 | + | ||
| 506 | +TEST(EnumToStringUtilsTest, CommonOptionalEnumsAllKnownValues) | ||
| 507 | +{ | ||
| 508 | + EXPECT_EQ(ManagedMemLocationTypeToString(rtMemLocationTypeInvalid), "MEM_LOCATION_TYPE_INVALID(0)"); | ||
| 509 | + EXPECT_EQ(ManagedMemLocationTypeToString(rtMemLocationTypeDevice), "MEM_LOCATION_TYPE_DEVICE(1)"); | ||
| 510 | + EXPECT_EQ(ManagedMemLocationTypeToString(rtMemLocationTypeHost), "MEM_LOCATION_TYPE_HOST(2)"); | ||
| 511 | + EXPECT_EQ(ManagedMemLocationTypeToString(rtMemLocationTypeHostNuma), "MEM_LOCATION_TYPE_HOST_NUMA(3)"); | ||
| 512 | + EXPECT_EQ( | ||
| 513 | + ManagedMemLocationTypeToString(rtMemLocationTypeHostNumaCurrent), "MEM_LOCATION_TYPE_HOST_NUMA_CURRENT(4)"); | ||
| 514 | + | ||
| 515 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolReuseFollowEventDependencies), "rtMemPoolReuseFollowEventDependencies(1)"); | ||
| 516 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolReuseAllowOpportunistic), "rtMemPoolReuseAllowOpportunistic(2)"); | ||
| 517 | + EXPECT_EQ( | ||
| 518 | + MemPoolAttrToString(rtMemPoolReuseAllowInternalDependencies), "rtMemPoolReuseAllowInternalDependencies(3)"); | ||
| 519 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrReleaseThreshold), "rtMemPoolAttrReleaseThreshold(4)"); | ||
| 520 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrReservedMemCurrent), "rtMemPoolAttrReservedMemCurrent(5)"); | ||
| 521 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrReservedMemHigh), "rtMemPoolAttrReservedMemHigh(6)"); | ||
| 522 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrUsedMemCurrent), "rtMemPoolAttrUsedMemCurrent(7)"); | ||
| 523 | + EXPECT_EQ(MemPoolAttrToString(rtMemPoolAttrUsedMemHigh), "rtMemPoolAttrUsedMemHigh(8)"); | ||
| 524 | + | ||
| 525 | + EXPECT_EQ(StreamCaptureStatusToString(RT_STREAM_CAPTURE_STATUS_NONE), "STREAM_CAPTURE_STATUS_NONE(0)"); | ||
| 526 | + EXPECT_EQ(StreamCaptureStatusToString(RT_STREAM_CAPTURE_STATUS_ACTIVE), "STREAM_CAPTURE_STATUS_ACTIVE(1)"); | ||
| 527 | + EXPECT_EQ( | ||
| 528 | + StreamCaptureStatusToString(RT_STREAM_CAPTURE_STATUS_INVALIDATED), "STREAM_CAPTURE_STATUS_INVALIDATED(2)"); | ||
| 529 | + EXPECT_EQ(StreamCaptureStatusToString(RT_STREAM_CAPTURE_STATUS_MAX), "STREAM_CAPTURE_STATUS_MAX(3)"); | ||
| 530 | +} | ||
安全函数要判断返回值,不判断的话至少要在最后一位赋值成'\0'结束符,防止访问越界 统一整改一下