已合并
CleanCode #1554
leihuan1创建于 4月14日
CleanCode #1554
已合并
共 17 个文件变更+60-60
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | - | ||
| 14 | 13 | ||
| 15 | 14 | ||
| 16 | 15 | ||
| @@ -20,13 +20,13 @@ namespace cce { | |||
| 20 | namespace runtime { | 20 | namespace runtime { |
| 21 | class Event; | 21 | class Event; |
| 22 | 22 | ||
| 23 | -enum RtCaptureModelStatus { | 23 | +enum class RtCaptureModelStatus { |
| 24 | - RT_CAPTURE_MODEL_STATUS_NONE = 0, // init status | 24 | + NONE = 0, // init status |
| 25 | - RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE, // capture status | 25 | + CAPTURE_ACTIVE, // capture status |
| 26 | - RT_CAPTURE_MODEL_STATUS_CAPTURE_INVALIDATED, // capture invalidated status | 26 | + CAPTURE_INVALIDATED, // capture invalidated status |
| 27 | - RT_CAPTURE_MODEL_STATUS_UPDATING, // updating status | 27 | + UPDATING, // updating status |
| 28 | - RT_CAPTURE_MODEL_STATUS_FAULT, // fault status | 28 | + FAULT, // fault status |
| 29 | - RT_CAPTURE_MODEL_STATUS_READY, // capture or updating finish | 29 | + READY, // capture or updating finish |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | struct MsprofShapeHeader { | 32 | struct MsprofShapeHeader { |
| @@ -68,42 +68,42 @@ public: | |||
| 68 | 68 | ||
| 69 | void TerminateCapture() | 69 | void TerminateCapture() |
| 70 | { | 70 | { |
| 71 | - if (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE) { | 71 | + if (captureModelStatus_ == RtCaptureModelStatus::CAPTURE_ACTIVE) { |
| 72 | - captureModelStatus_ = RT_CAPTURE_MODEL_STATUS_CAPTURE_INVALIDATED; | 72 | + captureModelStatus_ = RtCaptureModelStatus::CAPTURE_INVALIDATED; |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | bool IsCaptureReady() const | 76 | bool IsCaptureReady() const |
| 77 | { | 77 | { |
| 78 | - return (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_READY); | 78 | + return (captureModelStatus_ == RtCaptureModelStatus::READY); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | bool IsCaptureFinish() const | 81 | bool IsCaptureFinish() const |
| 82 | { | 82 | { |
| 83 | - return (captureModelStatus_ > RT_CAPTURE_MODEL_STATUS_CAPTURE_INVALIDATED); | 83 | + return (captureModelStatus_ > RtCaptureModelStatus::CAPTURE_INVALIDATED); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | bool IsCapturing() const | 86 | bool IsCapturing() const |
| 87 | { | 87 | { |
| 88 | - return ((captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE) || | 88 | + return ((captureModelStatus_ == RtCaptureModelStatus::CAPTURE_ACTIVE) || |
| 89 | - (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_CAPTURE_INVALIDATED)); | 89 | + (captureModelStatus_ == RtCaptureModelStatus::CAPTURE_INVALIDATED)); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | bool IsCaptureInvalid() const | 92 | bool IsCaptureInvalid() const |
| 93 | { | 93 | { |
| 94 | - return (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_CAPTURE_INVALIDATED); | 94 | + return (captureModelStatus_ == RtCaptureModelStatus::CAPTURE_INVALIDATED); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | bool IsUpdating() const | 97 | bool IsUpdating() const |
| 98 | { | 98 | { |
| 99 | - return (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_UPDATING); | 99 | + return (captureModelStatus_ == RtCaptureModelStatus::UPDATING); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | bool CanUpdate() const | 102 | bool CanUpdate() const |
| 103 | { | 103 | { |
| 104 | return ((!IsCaptureModelRunning()) && | 104 | return ((!IsCaptureModelRunning()) && |
| 105 | - (captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_READY || | 105 | + (captureModelStatus_ == RtCaptureModelStatus::READY || |
| 106 | - captureModelStatus_ == RT_CAPTURE_MODEL_STATUS_UPDATING)); | 106 | + captureModelStatus_ == RtCaptureModelStatus::UPDATING)); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void InsertSingleOperStmIdAndCaptureStmId(const int32_t singleOperStmId, const int32_t captureStmId) | 109 | void InsertSingleOperStmIdAndCaptureStmId(const int32_t singleOperStmId, const int32_t captureStmId) |
| @@ -292,7 +292,7 @@ private: | |||
| 292 | rtError_t BindStreamToModel(void); | 292 | rtError_t BindStreamToModel(void); |
| 293 | void ReportCacheTrackData(); | 293 | void ReportCacheTrackData(); |
| 294 | 294 | ||
| 295 | - RtCaptureModelStatus captureModelStatus_{RT_CAPTURE_MODEL_STATUS_NONE}; | 295 | + RtCaptureModelStatus captureModelStatus_{RtCaptureModelStatus::NONE}; |
| 296 | mutable uint32_t cacheOpInfoSwitch_{0U}; // aclgraph stream status: 0: false, 1:true | 296 | mutable uint32_t cacheOpInfoSwitch_{0U}; // aclgraph stream status: 0: false, 1:true |
| 297 | std::map<int32_t, std::map<uint32_t, std::unique_ptr<uint8_t []>>> shapeInfos_; | 297 | std::map<int32_t, std::map<uint32_t, std::unique_ptr<uint8_t []>>> shapeInfos_; |
| 298 | std::unordered_map<int32_t, std::unordered_set<int32_t>> singleOperStmIdAndCaptureStmIdMap_; | 298 | std::unordered_map<int32_t, std::unordered_set<int32_t>> singleOperStmIdAndCaptureStmIdMap_; |
| @@ -24,7 +24,7 @@ bool IsCapturedTask(const Stream * const launchStm, const TaskInfo *submitTask); | |||
| 24 | rtError_t GetCaptureStream(Context * const ctx, Stream * const stm, const Event * const evt, Stream ** const captureStm); | 24 | rtError_t GetCaptureStream(Context * const ctx, Stream * const stm, const Event * const evt, Stream ** const captureStm); |
| 25 | rtError_t CheckCaptureStreamThreadIsMatch(const Stream * const stm); | 25 | rtError_t CheckCaptureStreamThreadIsMatch(const Stream * const stm); |
| 26 | rtError_t CheckCaptureModelSupportSoftwareSq(Device* const dev); | 26 | rtError_t CheckCaptureModelSupportSoftwareSq(Device* const dev); |
| 27 | -rtError_t CheckCaptureModelForUpdate(Stream* stm); | 27 | +rtError_t CheckCaptureModelForUpdate(const Stream* stm); |
| 28 | bool IsSoftwareSqCaptureModel(Model * const mdl); | 28 | bool IsSoftwareSqCaptureModel(Model * const mdl); |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| @@ -268,7 +268,7 @@ rtError_t ApiDecorator::FuncGetAddr(const Kernel * const funcHandle, void ** con | |||
| 268 | return impl_->FuncGetAddr(funcHandle, aicAddr, aivAddr); | 268 | return impl_->FuncGetAddr(funcHandle, aicAddr, aivAddr); |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | -rtError_t ApiDecorator::FuncGetSize(const Kernel * const funcHandle, size_t *aicSize, size_t *aivSize) | 271 | +rtError_t ApiDecorator::FuncGetSize(const Kernel * const funcHandle, size_t * const aicSize, size_t * const aivSize) |
| 272 | { | 272 | { |
| 273 | return impl_->FuncGetSize(funcHandle, aicSize, aivSize); | 273 | return impl_->FuncGetSize(funcHandle, aicSize, aivSize); |
| 274 | } | 274 | } |
| @@ -454,7 +454,7 @@ public: | |||
| 454 | rtError_t RegProfCtrlCallback(const uint32_t moduleId, const rtProfCtrlHandle callback) override; | 454 | rtError_t RegProfCtrlCallback(const uint32_t moduleId, const rtProfCtrlHandle callback) override; |
| 455 | rtError_t RegStreamStateCallback(const char_t *regName, void *callback, void *args, | 455 | rtError_t RegStreamStateCallback(const char_t *regName, void *callback, void *args, |
| 456 | StreamStateCallback type) override; | 456 | StreamStateCallback type) override; |
| 457 | - rtError_t XpuSetTaskFailCallback(const rtXpuDevType devType, const char_t *regName, void *callback) override; | 457 | + rtError_t XpuSetTaskFailCallback(const rtXpuDevType devType, const char_t *modelName, void *callback) override; |
| 458 | // IPC API | 458 | // IPC API |
| 459 | rtError_t IpcSetMemoryName(const void * const ptr, const uint64_t byteCount, char_t * const name, | 459 | rtError_t IpcSetMemoryName(const void * const ptr, const uint64_t byteCount, char_t * const name, |
| 460 | const uint32_t len, const uint64_t flags) override; | 460 | const uint32_t len, const uint64_t flags) override; |
| @@ -600,7 +600,7 @@ rtError_t ApiErrorDecorator::FuncGetAddr(const Kernel * const funcHandle, void * | |||
| 600 | return error; | 600 | return error; |
| 601 | } | 601 | } |
| 602 | 602 | ||
| 603 | -rtError_t ApiErrorDecorator::FuncGetSize(const Kernel * const funcHandle, size_t *aicSize, size_t *aivSize) | 603 | +rtError_t ApiErrorDecorator::FuncGetSize(const Kernel * const funcHandle, size_t * const aicSize, size_t * const aivSize) |
| 604 | { | 604 | { |
| 605 | NULL_PTR_RETURN_MSG_OUTER(funcHandle, RT_ERROR_INVALID_VALUE); | 605 | NULL_PTR_RETURN_MSG_OUTER(funcHandle, RT_ERROR_INVALID_VALUE); |
| 606 | NULL_PTR_RETURN_MSG_OUTER(aicSize, RT_ERROR_INVALID_VALUE); | 606 | NULL_PTR_RETURN_MSG_OUTER(aicSize, RT_ERROR_INVALID_VALUE); |
| @@ -1697,7 +1697,7 @@ rtError_t ApiImpl::GetMaxStreamAndTask(const uint32_t streamType, uint32_t * con | |||
| 1697 | return RT_ERROR_FEATURE_NOT_SUPPORT; | 1697 | return RT_ERROR_FEATURE_NOT_SUPPORT; |
| 1698 | } | 1698 | } |
| 1699 | 1699 | ||
| 1700 | - const DevProperties &props = rt->GetCurChipProperties(); | 1700 | + const DevProperties &props = rt->GetCurChipProperties(); |
| 1701 | if (streamType == RT_HUGE_STREAM) { | 1701 | if (streamType == RT_HUGE_STREAM) { |
| 1702 | if (props.maxAllocHugeStreamNum == 0U) { | 1702 | if (props.maxAllocHugeStreamNum == 0U) { |
| 1703 | RT_LOG(RT_LOG_WARNING, "Get max stream and task failed, unsupported huge stream mode in chipType=%d, " | 1703 | RT_LOG(RT_LOG_WARNING, "Get max stream and task failed, unsupported huge stream mode in chipType=%d, " |
| @@ -1721,9 +1721,9 @@ rtError_t ApiImpl::GetAvailStreamNum(const uint32_t streamType, uint32_t * const | |||
| 1721 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 1721 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 1722 | const uint32_t deviceId = curCtx->Device_()->Id_(); | 1722 | const uint32_t deviceId = curCtx->Device_()->Id_(); |
| 1723 | const uint32_t tsId = curCtx->Device_()->DevGetTsId(); | 1723 | const uint32_t tsId = curCtx->Device_()->DevGetTsId(); |
| 1724 | - const Runtime * const rt = Runtime::Instance(); | 1724 | + const Runtime * const rt = Runtime::Instance(); |
| 1725 | - const rtChipType_t chipType = rt->GetChipType(); | 1725 | + const rtChipType_t chipType = rt->GetChipType(); |
| 1726 | - const DevProperties &props = rt->GetCurChipProperties(); | 1726 | + const DevProperties &props = rt->GetCurChipProperties(); |
| 1727 | if (streamType == RT_HUGE_STREAM) { | 1727 | if (streamType == RT_HUGE_STREAM) { |
| 1728 | COND_RETURN_ERROR_MSG_INNER(props.maxAllocHugeStreamNum == 0U, | 1728 | COND_RETURN_ERROR_MSG_INNER(props.maxAllocHugeStreamNum == 0U, |
| 1729 | RT_ERROR_FEATURE_NOT_SUPPORT, | 1729 | RT_ERROR_FEATURE_NOT_SUPPORT, |
| @@ -1757,9 +1757,9 @@ rtError_t ApiImpl::GetAvailEventNum(uint32_t * const eventCount) | |||
| 1757 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); | 1757 | CHECK_CONTEXT_VALID_WITH_RETURN(curCtx, RT_ERROR_CONTEXT_NULL); |
| 1758 | const uint32_t deviceId = curCtx->Device_()->Id_(); | 1758 | const uint32_t deviceId = curCtx->Device_()->Id_(); |
| 1759 | const uint32_t tsId = curCtx->Device_()->DevGetTsId(); | 1759 | const uint32_t tsId = curCtx->Device_()->DevGetTsId(); |
| 1760 | - const Runtime * const rt = Runtime::Instance(); | 1760 | + const Runtime * const rt = Runtime::Instance(); |
| 1761 | - const rtChipType_t chipType = rt->GetChipType(); | 1761 | + const rtChipType_t chipType = rt->GetChipType(); |
| 1762 | - const DevProperties &eventProps = rt->GetCurChipProperties(); | 1762 | + const DevProperties &eventProps = rt->GetCurChipProperties(); |
| 1763 | *eventCount = eventProps.stubEventCount; | 1763 | *eventCount = eventProps.stubEventCount; |
| 1764 | if (IS_SUPPORT_CHIP_FEATURE(chipType, RtOptionalFeatureType::RT_FEATURE_DEVICE_GET_RESOURCE_NUM_DYNAMIC)) { | 1764 | if (IS_SUPPORT_CHIP_FEATURE(chipType, RtOptionalFeatureType::RT_FEATURE_DEVICE_GET_RESOURCE_NUM_DYNAMIC)) { |
| 1765 | Driver* driver = curCtx->Device_()->Driver_(); | 1765 | Driver* driver = curCtx->Device_()->Driver_(); |
| @@ -2387,10 +2387,10 @@ rtError_t ApiImpl::HostRegisterV2(void *ptr, uint64_t size, uint32_t flag) | |||
| 2387 | if ((flag & (RT_MEM_HOST_REGISTER_MAPPED | RT_MEM_HOST_REGISTER_IOMEMORY | RT_MEM_HOST_REGISTER_READONLY)) != 0U) { | 2387 | if ((flag & (RT_MEM_HOST_REGISTER_MAPPED | RT_MEM_HOST_REGISTER_IOMEMORY | RT_MEM_HOST_REGISTER_READONLY)) != 0U) { |
| 2388 | uint32_t typeMask = static_cast<uint32_t>(RT_HOST_REGISTER_MAPPED); | 2388 | uint32_t typeMask = static_cast<uint32_t>(RT_HOST_REGISTER_MAPPED); |
| 2389 | if ((flag & RT_MEM_HOST_REGISTER_IOMEMORY) != 0U) { | 2389 | if ((flag & RT_MEM_HOST_REGISTER_IOMEMORY) != 0U) { |
| 2390 | - typeMask |= RT_HOST_REGISTER_IOMEMORY; | 2390 | + typeMask |= static_cast<uint32_t>(RT_HOST_REGISTER_IOMEMORY); |
| 2391 | } | 2391 | } |
| 2392 | if ((flag & RT_MEM_HOST_REGISTER_READONLY) != 0U) { | 2392 | if ((flag & RT_MEM_HOST_REGISTER_READONLY) != 0U) { |
| 2393 | - typeMask |= RT_HOST_REGISTER_READONLY; | 2393 | + typeMask |= static_cast<uint32_t>(RT_HOST_REGISTER_READONLY); |
| 2394 | } | 2394 | } |
| 2395 | error = dev->Driver_()->HostRegister(ptr, size, static_cast<rtHostRegisterType>(typeMask), pDevice, | 2395 | error = dev->Driver_()->HostRegister(ptr, size, static_cast<rtHostRegisterType>(typeMask), pDevice, |
| 2396 | deviceId); | 2396 | deviceId); |
| @@ -8718,7 +8718,7 @@ rtError_t ApiImpl::TaskSetParams(rtTask_t task, rtTaskParams* const params) | |||
| 8718 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(taskInfo->stream->Model_()); | 8718 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(taskInfo->stream->Model_()); |
| 8719 | NULL_PTR_RETURN(captureModel, RT_ERROR_MODEL_NULL); | 8719 | NULL_PTR_RETURN(captureModel, RT_ERROR_MODEL_NULL); |
| 8720 | 8720 | ||
| 8721 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_UPDATING); | 8721 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::UPDATING); |
| 8722 | 8722 | ||
| 8723 | switch (params->type) { | 8723 | switch (params->type) { |
| 8724 | case RT_TASK_KERNEL: | 8724 | case RT_TASK_KERNEL: |
| @@ -8741,7 +8741,7 @@ rtError_t ApiImpl::TaskSetParams(rtTask_t task, rtTaskParams* const params) | |||
| 8741 | error = RT_ERROR_INVALID_VALUE; | 8741 | error = RT_ERROR_INVALID_VALUE; |
| 8742 | break; | 8742 | break; |
| 8743 | } | 8743 | } |
| 8744 | - ERROR_PROC_RETURN_MSG_INNER(error, captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_FAULT);, | 8744 | + ERROR_PROC_RETURN_MSG_INNER(error, captureModel->SetCaptureModelStatus(RtCaptureModelStatus::FAULT);, |
| 8745 | "task set params failed"); | 8745 | "task set params failed"); |
| 8746 | taskInfo->updateFlag = RT_TASK_UPDATE; | 8746 | taskInfo->updateFlag = RT_TASK_UPDATE; |
| 8747 | RT_LOG( | 8747 | RT_LOG( |
| @@ -8758,11 +8758,11 @@ rtError_t ApiImpl::ModelUpdate(Model* mdl) | |||
| 8758 | COND_RETURN_WITH_NOLOG((error != RT_ERROR_NONE), error); | 8758 | COND_RETURN_WITH_NOLOG((error != RT_ERROR_NONE), error); |
| 8759 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(mdl); | 8759 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(mdl); |
| 8760 | 8760 | ||
| 8761 | - if (captureModel->GetCaptureModelStatus() == RT_CAPTURE_MODEL_STATUS_READY) { | 8761 | + if (captureModel->GetCaptureModelStatus() == RtCaptureModelStatus::READY) { |
| 8762 | return RT_ERROR_NONE; | 8762 | return RT_ERROR_NONE; |
| 8763 | } | 8763 | } |
| 8764 | 8764 | ||
| 8765 | - if (captureModel->GetCaptureModelStatus() != RT_CAPTURE_MODEL_STATUS_UPDATING) { | 8765 | + if (captureModel->GetCaptureModelStatus() != RtCaptureModelStatus::UPDATING) { |
| 8766 | RT_LOG( | 8766 | RT_LOG( |
| 8767 | RT_LOG_ERROR, "model is not ready for update, model_id=%u, current status=%d", captureModel->Id_(), | 8767 | RT_LOG_ERROR, "model is not ready for update, model_id=%u, current status=%d", captureModel->Id_(), |
| 8768 | captureModel->GetCaptureModelStatus()); | 8768 | captureModel->GetCaptureModelStatus()); |
| @@ -8771,9 +8771,9 @@ rtError_t ApiImpl::ModelUpdate(Model* mdl) | |||
| 8771 | 8771 | ||
| 8772 | rtError_t ret = captureModel->Update(); | 8772 | rtError_t ret = captureModel->Update(); |
| 8773 | if (ret == RT_ERROR_NONE) { | 8773 | if (ret == RT_ERROR_NONE) { |
| 8774 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_READY); | 8774 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::READY); |
| 8775 | } else { | 8775 | } else { |
| 8776 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_FAULT); | 8776 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::FAULT); |
| 8777 | } | 8777 | } |
| 8778 | return ret; | 8778 | return ret; |
| 8779 | } | 8779 | } |
| @@ -8823,14 +8823,14 @@ rtError_t ApiImpl::ModelTaskDisable(rtTask_t task) | |||
| 8823 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(taskInfo->stream->Model_()); | 8823 | CaptureModel* captureModel = dynamic_cast<CaptureModel*>(taskInfo->stream->Model_()); |
| 8824 | NULL_PTR_RETURN(captureModel, RT_ERROR_MODEL_NULL); | 8824 | NULL_PTR_RETURN(captureModel, RT_ERROR_MODEL_NULL); |
| 8825 | 8825 | ||
| 8826 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_UPDATING); | 8826 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::UPDATING); |
| 8827 | 8827 | ||
| 8828 | rtTaskType taskType = RT_TASK_DEFAULT; | 8828 | rtTaskType taskType = RT_TASK_DEFAULT; |
| 8829 | error = ConvertTaskType(taskInfo, &taskType); | 8829 | error = ConvertTaskType(taskInfo, &taskType); |
| 8830 | ERROR_PROC_RETURN_MSG_INNER(error, | 8830 | ERROR_PROC_RETURN_MSG_INNER(error, |
| 8831 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_FAULT);, | 8831 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::FAULT);, |
| 8832 | "get task type failed, retCode=%#x.", error); | 8832 | "get task type failed, retCode=%#x.", error); |
| 8833 | - COND_PROC(taskType == RT_TASK_DEFAULT, captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_FAULT)); | 8833 | + COND_PROC(taskType == RT_TASK_DEFAULT, captureModel->SetCaptureModelStatus(RtCaptureModelStatus::FAULT)); |
| 8834 | COND_RETURN_AND_MSG_OUTER((taskType == RT_TASK_DEFAULT), RT_ERROR_INVALID_VALUE, | 8834 | COND_RETURN_AND_MSG_OUTER((taskType == RT_TASK_DEFAULT), RT_ERROR_INVALID_VALUE, |
| 8835 | ErrorCode::EE1001, "current task type can not be RT_TASK_DEFAULT."); | 8835 | ErrorCode::EE1001, "current task type can not be RT_TASK_DEFAULT."); |
| 8836 | 8836 | ||
| @@ -73,7 +73,7 @@ rtError_t ApiImpl::MemManagedPrefetchAsync(const void* ptr, size_t size, rtMemMa | |||
| 73 | COND_PROC_RETURN_ERROR_MSG_INNER((ret != RT_ERROR_NONE), ret, DELETE_O(params), | 73 | COND_PROC_RETURN_ERROR_MSG_INNER((ret != RT_ERROR_NONE), ret, DELETE_O(params), |
| 74 | "ConvertUvmLocationStruct failed, retCode=%#x", static_cast<uint32_t>(ret)); | 74 | "ConvertUvmLocationStruct failed, retCode=%#x", static_cast<uint32_t>(ret)); |
| 75 | 75 | ||
| 76 | - params->ptr = reinterpret_cast<DVdeviceptr>(ptr); | 76 | + params->ptr = RtPtrToPtr<DVdeviceptr>(ptr); |
| 77 | params->size = size; | 77 | params->size = size; |
| 78 | params->flags = flags; | 78 | params->flags = flags; |
| 79 | 79 | ||
| @@ -120,7 +120,7 @@ rtError_t ApiImpl::MemManagedPrefetchBatchAsync(const void** ptrs, size_t* sizes | |||
| 120 | tmpOffset += arrSize; | 120 | tmpOffset += arrSize; |
| 121 | 121 | ||
| 122 | // copy array prefetchLocs | 122 | // copy array prefetchLocs |
| 123 | - drv_uvm_location* drvUvmLocArr = reinterpret_cast<drv_uvm_location *>(memBuffer + tmpOffset); | 123 | + drv_uvm_location* drvUvmLocArr = RtPtrToPtr<drv_uvm_location *>(memBuffer + tmpOffset); |
| 124 | for (size_t index = 0; index < numPrefetchLocs; index++) { | 124 | for (size_t index = 0; index < numPrefetchLocs; index++) { |
| 125 | ret = UvmCallback::ConvertUvmLocationStruct(drvUvmLocArr[index], prefetchLocs[index]); | 125 | ret = UvmCallback::ConvertUvmLocationStruct(drvUvmLocArr[index], prefetchLocs[index]); |
| 126 | COND_PROC((ret == RT_ERROR_DRV_NOT_SUPPORT), DELETE_A(memBuffer)); | 126 | COND_PROC((ret == RT_ERROR_DRV_NOT_SUPPORT), DELETE_A(memBuffer)); |
| @@ -1065,7 +1065,7 @@ void Runtime::ParseHostCpuModelInfo() | |||
| 1065 | static rtError_t GetDcacheLockMixPath(std::string& binaryPath, string binaryName) | 1065 | static rtError_t GetDcacheLockMixPath(std::string& binaryPath, string binaryName) |
| 1066 | { | 1066 | { |
| 1067 | Dl_info info; | 1067 | Dl_info info; |
| 1068 | - if (dladdr(reinterpret_cast<void*>(GetDcacheLockMixPath), &info) != 0 && info.dli_fname != nullptr) { | 1068 | + if (dladdr(RtPtrToPtr<void*>(GetDcacheLockMixPath), &info) != 0 && info.dli_fname != nullptr) { |
| 1069 | std::string soPath = info.dli_fname; | 1069 | std::string soPath = info.dli_fname; |
| 1070 | auto pos = soPath.find_last_of('/'); | 1070 | auto pos = soPath.find_last_of('/'); |
| 1071 | if (pos != std::string::npos) { | 1071 | if (pos != std::string::npos) { |
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | - | ||
| 17 | 16 | ||
| 18 | namespace cce { | 17 | namespace cce { |
| 19 | namespace runtime { | 18 | namespace runtime { |
| @@ -184,7 +184,7 @@ rtError_t CaptureModel::ExecuteCommon(Stream * const stm, int32_t timeout, const | |||
| 184 | return RT_ERROR_MODEL_CAPTURED; | 184 | return RT_ERROR_MODEL_CAPTURED; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | - if (captureModelStatus_ != RT_CAPTURE_MODEL_STATUS_READY) { | 187 | + if (captureModelStatus_ != RtCaptureModelStatus::READY) { |
| 188 | RT_LOG(RT_LOG_ERROR, "model is not ready, can't execute, model_id=%u, status=%d", Id_(), captureModelStatus_); | 188 | RT_LOG(RT_LOG_ERROR, "model is not ready, can't execute, model_id=%u, status=%d", Id_(), captureModelStatus_); |
| 189 | return RT_ERROR_MODEL_EXE_FAILED; | 189 | return RT_ERROR_MODEL_EXE_FAILED; |
| 190 | } | 190 | } |
| @@ -265,12 +265,13 @@ rtError_t CaptureModel::AddStreamToCaptureModel(Stream * const stm) | |||
| 265 | 265 | ||
| 266 | void CaptureModel::EnterCaptureNotify(const int32_t singleOperStmId, const int32_t captureStmId) | 266 | void CaptureModel::EnterCaptureNotify(const int32_t singleOperStmId, const int32_t captureStmId) |
| 267 | { | 267 | { |
| 268 | - SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE); | 268 | + SetCaptureModelStatus(RtCaptureModelStatus::CAPTURE_ACTIVE); |
| 269 | InsertSingleOperStmIdAndCaptureStmId(singleOperStmId, captureStmId); | 269 | InsertSingleOperStmIdAndCaptureStmId(singleOperStmId, captureStmId); |
| 270 | } | 270 | } |
| 271 | + | ||
| 271 | void CaptureModel::ExitCaptureNotify() | 272 | void CaptureModel::ExitCaptureNotify() |
| 272 | { | 273 | { |
| 273 | - SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_READY); | 274 | + SetCaptureModelStatus(RtCaptureModelStatus::READY); |
| 274 | 275 | ||
| 275 | Device * const dev = Context_()->Device_(); | 276 | Device * const dev = Context_()->Device_(); |
| 276 | for (const auto& iter: singleOperStmIdAndCaptureStmIdMap_) { | 277 | for (const auto& iter: singleOperStmIdAndCaptureStmIdMap_) { |
| @@ -154,7 +154,7 @@ rtError_t CheckCaptureModelSupportSoftwareSq(Device* const dev) | |||
| 154 | 154 | ||
| 155 | return RT_ERROR_NONE; | 155 | return RT_ERROR_NONE; |
| 156 | } | 156 | } |
| 157 | -rtError_t CheckCaptureModelForUpdate(Stream* stm) { | 157 | +rtError_t CheckCaptureModelForUpdate(const Stream* stm) { |
| 158 | NULL_PTR_RETURN(stm, RT_ERROR_STREAM_NULL); | 158 | NULL_PTR_RETURN(stm, RT_ERROR_STREAM_NULL); |
| 159 | Device* dev = stm->Device_(); | 159 | Device* dev = stm->Device_(); |
| 160 | static rtError_t isSupportResult = CheckCaptureModelSupportSoftwareSq(dev); | 160 | static rtError_t isSupportResult = CheckCaptureModelSupportSoftwareSq(dev); |
| @@ -18,7 +18,7 @@ void CcuLaunchTaskInit(TaskInfo *taskInfo, rtCcuTaskInfo_t *const ccuInfo) | |||
| 18 | { | 18 | { |
| 19 | TaskCommonInfoInit(taskInfo); | 19 | TaskCommonInfoInit(taskInfo); |
| 20 | taskInfo->type = TS_TASK_TYPE_CCU_LAUNCH; | 20 | taskInfo->type = TS_TASK_TYPE_CCU_LAUNCH; |
| 21 | - taskInfo->typeName = const_cast<char_t*>("CCU"); | 21 | + taskInfo->typeName = RtPtrToUnConstPtr<char_t*>("CCU"); |
| 22 | 22 | ||
| 23 | CcuLaunchTaskInfo *ccuLaunchTsk = &(taskInfo->u.ccuLaunchTask); | 23 | CcuLaunchTaskInfo *ccuLaunchTsk = &(taskInfo->u.ccuLaunchTask); |
| 24 | ccuLaunchTsk->errInfo.err = 0U; | 24 | ccuLaunchTsk->errInfo.err = 0U; |
| @@ -18,16 +18,18 @@ namespace cce { | |||
| 18 | namespace runtime { | 18 | namespace runtime { |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | -typedef struct StreamList { | 21 | +struct StreamList { |
| 22 | uint32_t stmNum; | 22 | uint32_t stmNum; |
| 23 | rtStream_t stms[RT_MAX_STREAM_NUM]; | 23 | rtStream_t stms[RT_MAX_STREAM_NUM]; |
| 24 | -} StreamList_t; | 24 | +}; |
| 25 | +using StreamList_t = StreamList; | ||
| 25 | 26 | ||
| 26 | 27 | ||
| 27 | -typedef struct ModelList { | 28 | +struct ModelList { |
| 28 | uint32_t mdlNum; | 29 | uint32_t mdlNum; |
| 29 | rtModel_t mdls[RT_MAX_MODEL_NUM]; | 30 | rtModel_t mdls[RT_MAX_MODEL_NUM]; |
| 30 | -} ModelList_t; | 31 | +}; |
| 32 | +using ModelList_t = ModelList; | ||
| 31 | 33 | ||
| 32 | class Device; | 34 | class Device; |
| 33 | class Stream; | 35 | class Stream; |
| @@ -22,7 +22,6 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | - | ||
| 26 | 25 | ||
| 27 | 26 | ||
| 28 | 27 | ||
| @@ -424,7 +424,7 @@ TEST_F(SnapshotTest, SnapShotProcessRestore3) | |||
| 424 | captureModel->context_ = curCtx; | 424 | captureModel->context_ = curCtx; |
| 425 | captureModel->isSoftwareSqEnable_ = true; | 425 | captureModel->isSoftwareSqEnable_ = true; |
| 426 | captureModel->modelType_ = ModelType::RT_MODEL_CAPTURE_MODEL; | 426 | captureModel->modelType_ = ModelType::RT_MODEL_CAPTURE_MODEL; |
| 427 | - captureModel->captureModelStatus_ = RtCaptureModelStatus::RT_CAPTURE_MODEL_STATUS_READY; | 427 | + captureModel->captureModelStatus_ = RtCaptureModelStatus::READY; |
| 428 | captureModel1->modelType_ = ModelType::RT_MODEL_NORMAL; | 428 | captureModel1->modelType_ = ModelType::RT_MODEL_NORMAL; |
| 429 | captureModel1->context_ = curCtx; | 429 | captureModel1->context_ = curCtx; |
| 430 | curCtx->models_.push_back(captureModel1); | 430 | curCtx->models_.push_back(captureModel1); |
| @@ -7696,7 +7696,7 @@ TEST_F(ApiDavidTest, captureEvent4) | |||
| 7696 | EXPECT_EQ(error, ACL_RT_SUCCESS); | 7696 | EXPECT_EQ(error, ACL_RT_SUCCESS); |
| 7697 | 7697 | ||
| 7698 | ((Stream *)stream1)->SetModel(static_cast<Model *>(captureModel)); | 7698 | ((Stream *)stream1)->SetModel(static_cast<Model *>(captureModel)); |
| 7699 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE); | 7699 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::CAPTURE_ACTIVE); |
| 7700 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); | 7700 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); |
| 7701 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); | 7701 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); |
| 7702 | 7702 | ||
| @@ -7735,7 +7735,7 @@ TEST_F(ApiDavidTest, captureEvent6) | |||
| 7735 | EXPECT_EQ(error, ACL_RT_SUCCESS); | 7735 | EXPECT_EQ(error, ACL_RT_SUCCESS); |
| 7736 | 7736 | ||
| 7737 | ((Stream *)stream1)->SetModel(static_cast<Model *>(captureModel)); | 7737 | ((Stream *)stream1)->SetModel(static_cast<Model *>(captureModel)); |
| 7738 | - captureModel->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE); | 7738 | + captureModel->SetCaptureModelStatus(RtCaptureModelStatus::CAPTURE_ACTIVE); |
| 7739 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); | 7739 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); |
| 7740 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); | 7740 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); |
| 7741 | 7741 | ||
| @@ -7912,7 +7912,7 @@ TEST_F(ApiDavidTest, captureStreamCascade) | |||
| 7912 | 7912 | ||
| 7913 | CaptureModel *mdl = dynamic_cast<CaptureModel *>(model); | 7913 | CaptureModel *mdl = dynamic_cast<CaptureModel *>(model); |
| 7914 | ((Stream *)stream1)->SetModel(model); | 7914 | ((Stream *)stream1)->SetModel(model); |
| 7915 | - mdl->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_CAPTURE_ACTIVE); | 7915 | + mdl->SetCaptureModelStatus(RtCaptureModelStatus::CAPTURE_ACTIVE); |
| 7916 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); | 7916 | ((Stream *)stream)->UpdateCaptureStream((Stream *)stream1); |
| 7917 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); | 7917 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_ACTIVE); |
| 7918 | 7918 | ||
| @@ -7933,7 +7933,7 @@ TEST_F(ApiDavidTest, captureStreamCascade) | |||
| 7933 | ((Event *)event)->SetCaptureEvent(nullptr); | 7933 | ((Event *)event)->SetCaptureEvent(nullptr); |
| 7934 | ((Stream *)stream)->UpdateCaptureStream(nullptr); | 7934 | ((Stream *)stream)->UpdateCaptureStream(nullptr); |
| 7935 | ((Stream *)stream1)->DelModel(mdl); | 7935 | ((Stream *)stream1)->DelModel(mdl); |
| 7936 | - mdl->SetCaptureModelStatus(RT_CAPTURE_MODEL_STATUS_NONE); | 7936 | + mdl->SetCaptureModelStatus(RtCaptureModelStatus::NONE); |
| 7937 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_NONE); | 7937 | ((Stream *)stream)->SetCaptureStatus(RT_STREAM_CAPTURE_STATUS_NONE); |
| 7938 | error = ctx->ModelDestroy(model); | 7938 | error = ctx->ModelDestroy(model); |
| 7939 | EXPECT_EQ(error, RT_ERROR_NONE); | 7939 | EXPECT_EQ(error, RT_ERROR_NONE); |