[INFO] Initializing environment for https://gitcode.com/pre-commit-clang/mirrors-clang-format. [INFO] Installing environment for https://gitcode.com/pre-commit-clang/mirrors-clang-format. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... clang-format.............................................................Failed - hook id: clang-format - files were modified by this hook All changes made by hooks: diff --git a/src/runtime/core/src/common/errcode_manage.cc b/src/runtime/core/src/common/errcode_manage.cc index e8722f1..05c3190 100644 --- a/src/runtime/core/src/common/errcode_manage.cc +++ b/src/runtime/core/src/common/errcode_manage.cc @@ -34,7 +34,8 @@ void ErrorcodeManage::InitRtErrCodeMap() // device error rtErrMap_[RT_ERROR_DEVICE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "device base error"}; rtErrMap_[RT_ERROR_DEVICE_NULL] = {ACL_ERROR_RT_DEV_SETUP_ERROR, "device pointer null"}; - rtErrMap_[RT_ERROR_DEVICE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the device object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_DEVICE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the device object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_DEVICE_ID] = {ACL_ERROR_RT_INVALID_DEVICEID, "device id error"}; rtErrMap_[RT_ERROR_DEVICE_CHIPTYPE] = {ACL_ERROR_RT_INTERNAL_ERROR, "device chiptype error"}; rtErrMap_[RT_ERROR_DEVICE_DEPLOY] = {ACL_ERROR_RT_INTERNAL_ERROR, "device deploy error"}; @@ -56,7 +57,8 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_DRV_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "driver base error"}; rtErrMap_[RT_ERROR_DRV_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "driver pointer null"}; - rtErrMap_[RT_ERROR_DRV_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the driver object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_DRV_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the driver object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_DRV_MEMORY] = {ACL_ERROR_RT_INTERNAL_ERROR, "driver handle memory error"}; rtErrMap_[RT_ERROR_DRV_PTRNULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "parameter pointer null"}; rtErrMap_[RT_ERROR_DRV_OPEN_AICPU] = {ACL_ERROR_RT_INTERNAL_ERROR, "open aicpu error"}; @@ -83,8 +85,8 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_DRV_INVALID_DEVICE] = {ACL_ERROR_RT_INVALID_DEVICEID, "driver error:invalid device"}; rtErrMap_[RT_ERROR_DRV_INPUT] = {ACL_ERROR_RT_PARAM_INVALID, "driver error:invalid value"}; rtErrMap_[RT_ERROR_DRV_INVALID_HANDLE] = {ACL_ERROR_RT_INVALID_HANDLE, "driver error:invalid handle"}; - rtErrMap_[RT_ERROR_DRV_INVALID_MALLOC_TYPE] = {ACL_ERROR_RT_INVALID_MALLOC_TYPE, - "driver error:invalid malloc type"}; + rtErrMap_[RT_ERROR_DRV_INVALID_MALLOC_TYPE] = { + ACL_ERROR_RT_INVALID_MALLOC_TYPE, "driver error:invalid malloc type"}; rtErrMap_[RT_ERROR_DRV_OUT_MEMORY] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "driver error:out of memory"}; rtErrMap_[RT_ERROR_DRV_MALLOC_FAIL] = {ACL_ERROR_RT_RESOURCE_ALLOC_FAIL, "driver error:resource alloc fail"}; rtErrMap_[RT_ERROR_DRV_OPER_NOT_PERMITTED] = {ACL_ERROR_RT_NO_PERMISSION, "driver error:operation no permitted"}; @@ -94,7 +96,8 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_DRV_NO_NOTIFY_RESOURCES] = {ACL_ERROR_RT_NO_NOTIFY_RESOURCE, "driver error:no notify resource"}; rtErrMap_[RT_ERROR_DRV_NO_MODEL_RESOURCES] = {ACL_ERROR_RT_NO_MODEL_RESOURCE, "driver error:no model resource"}; rtErrMap_[RT_ERROR_DRV_NOT_SUPPORT] = {ACL_ERROR_RT_FEATURE_NOT_SUPPORT, "driver error:feature not support"}; - rtErrMap_[RT_ERROR_DRV_NOT_SUPPORT_UPDATE_OP] = {ACL_ERROR_RT_FEATURE_NOT_SUPPORT_UPDATE_OP, + rtErrMap_[RT_ERROR_DRV_NOT_SUPPORT_UPDATE_OP] = { + ACL_ERROR_RT_FEATURE_NOT_SUPPORT_UPDATE_OP, "driver error:current driver version does not support to update this op, please upgrade the driver"}; rtErrMap_[RT_ERROR_DRV_NO_RESOURCES] = {ACL_ERROR_RT_RESOURCE_ALLOC_FAIL, "driver error:resource alloc fail"}; rtErrMap_[RT_ERROR_DRV_COPY_USER_FAIL] = {ACL_ERROR_RT_COPY_DATA, "driver error:copy data fail"}; @@ -104,8 +107,10 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_SDMA_POISON_ERROR] = {ACL_ERROR_RT_DEVICE_MEM_ERROR, "device mem error"}; rtErrMap_[RT_ERROR_LOCAL_MEM_ERROR] = {ACL_ERROR_RT_DEVICE_MEM_ERROR, "device local mem error"}; rtErrMap_[RT_ERROR_REMOTE_MEM_ERROR] = {ACL_ERROR_RT_SUSPECT_REMOTE_ERROR, "device remote mem error"}; - rtErrMap_[RT_ERROR_CCU_HCCL_MEM_ERROR] = {ACL_ERROR_RT_DEVICE_MEM_ERROR, "hccl ccu task error: device local mem error"}; - rtErrMap_[RT_ERROR_CCU_HCCL_REMOTE_ERROR] = {ACL_ERROR_RT_SUSPECT_REMOTE_ERROR, "hccl ccu task error: device remote mem error"}; + rtErrMap_[RT_ERROR_CCU_HCCL_MEM_ERROR] = { + ACL_ERROR_RT_DEVICE_MEM_ERROR, "hccl ccu task error: device local mem error"}; + rtErrMap_[RT_ERROR_CCU_HCCL_REMOTE_ERROR] = { + ACL_ERROR_RT_SUSPECT_REMOTE_ERROR, "hccl ccu task error: device remote mem error"}; rtErrMap_[RT_ERROR_MEM_RAS_ERROR] = {ACL_ERROR_RT_HBM_MULTI_BIT_ECC_ERROR, "hbm Multi-bit ECC error"}; rtErrMap_[RT_ERROR_SUSPECT_DEVICE_MEM_ERROR] = {ACL_ERROR_RT_SUSPECT_DEVICE_MEM_ERROR, "suspect device mem error"}; rtErrMap_[RT_ERROR_SUSPECT_REMOTE_ERROR] = {ACL_ERROR_RT_SUSPECT_REMOTE_ERROR, "suspect remote error"}; @@ -114,11 +119,12 @@ void ErrorcodeManage::InitRtErrCodeMap() // stream error rtErrMap_[RT_ERROR_STREAM_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "stream base error"}; rtErrMap_[RT_ERROR_STREAM_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "stream pointer null"}; - rtErrMap_[RT_ERROR_STREAM_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the stream object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_STREAM_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the stream object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_STREAM_CONTEXT] = {ACL_ERROR_RT_STREAM_CONTEXT, "stream not in current context"}; rtErrMap_[RT_ERROR_STREAM_INVALID] = {ACL_ERROR_RT_INTERNAL_ERROR, "stream invalid"}; - rtErrMap_[RT_ERROR_STREAM_MODEL] = {ACL_ERROR_RT_STREAM_MODEL, - "the relationship between the model and stream is incorrect."}; + rtErrMap_[RT_ERROR_STREAM_MODEL] = { + ACL_ERROR_RT_STREAM_MODEL, "the relationship between the model and stream is incorrect."}; rtErrMap_[RT_ERROR_STREAM_FUSION] = {ACL_ERROR_RT_INTERNAL_ERROR, "stream fusion error"}; rtErrMap_[RT_ERROR_STREAM_FULL] = {ACL_ERROR_RT_STREAM_TASK_FULL, "stream task buffer full"}; rtErrMap_[RT_ERROR_STREAM_EMPTY] = {ACL_ERROR_RT_STREAM_TASK_EMPTY, "stream task buffer empty"}; @@ -133,39 +139,42 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_DVPP_GRP_NEW] = {ACL_ERROR_RT_INTERNAL_ERROR, "create dvpp grp fail"}; rtErrMap_[RT_ERROR_STREAM_BIND_GRP] = {ACL_ERROR_RT_PARAM_INVALID, "stream bind to dvpp grp"}; rtErrMap_[RT_ERROR_REMOTE_SQID_DUPLICATE] = {ACL_ERROR_RT_INTERNAL_ERROR, "remote sq id repeatedly"}; - rtErrMap_[RT_ERROR_STREAM_REUSE_LIMIT_MODEL_NUM] = {ACL_ERROR_RT_STREAM_MODEL, - "models number exceeds the upper limit 256"}; - rtErrMap_[RT_ERROR_STREAM_ABORT] = {ACL_ERROR_RT_STREAM_ABORT,"stream abort"}; + rtErrMap_[RT_ERROR_STREAM_REUSE_LIMIT_MODEL_NUM] = { + ACL_ERROR_RT_STREAM_MODEL, "models number exceeds the upper limit 256"}; + rtErrMap_[RT_ERROR_STREAM_ABORT] = {ACL_ERROR_RT_STREAM_ABORT, "stream abort"}; rtErrMap_[RT_ERROR_STREAM_ABORT_SEND_TASK_FAIL] = {ACL_ERROR_RT_STREAM_ABORT, "stream abort"}; rtErrMap_[RT_ERROR_STREAM_ABORT_SYNC_TASK_FAIL] = {ACL_ERROR_RT_STREAM_ABORT, "stream abort"}; rtErrMap_[RT_ERROR_STREAM_CAPTURED] = {ACL_ERROR_RT_STREAM_CAPTURED, "stream is captured"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_INVALIDATED] = {ACL_ERROR_RT_STREAM_CAPTURE_INVALIDATED, - "an error has invalidated the stream capture sequence"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_INVALIDATED] = { + ACL_ERROR_RT_STREAM_CAPTURE_INVALIDATED, "an error has invalidated the stream capture sequence"}; rtErrMap_[RT_ERROR_STREAM_NOT_CAPTURED] = {ACL_ERROR_RT_STREAM_NOT_CAPTURED, "stream is not in capture status"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_MODE_NOT_SUPPORT] = {ACL_ERROR_RT_CAPTURE_MODE_NOT_SUPPORT, - "operation not permitted when a stream is capturing and the specified capture mode is not relaxed"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_MODE_BLOCK_ASYNC] = {ACL_ERROR_RT_CAPTURE_MODE_BLOCK_ASYNC, + rtErrMap_[RT_ERROR_STREAM_CAPTURE_MODE_NOT_SUPPORT] = { + ACL_ERROR_RT_CAPTURE_MODE_NOT_SUPPORT, + "operation not permitted when a stream is capturing and the specified capture mode is not relaxed"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_MODE_BLOCK_ASYNC] = { + ACL_ERROR_RT_CAPTURE_MODE_BLOCK_ASYNC, "the operation has been converted to a synchronous operation. " "operation not permitted when a stream is capturing and the specified capture mode is not relaxed"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_IMPLICIT] = {ACL_ERROR_RT_STREAM_CAPTURE_IMPLICIT, - "a disallowed implicit dependency from default stream"}; - rtErrMap_[RT_ERROR_STREAM_AICPU_ALLOC_FAIL] = {ACL_ERROR_RT_RESOURCE_ALLOC_FAIL, - "aicpu id alloc failed"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_IMPLICIT] = { + ACL_ERROR_RT_STREAM_CAPTURE_IMPLICIT, "a disallowed implicit dependency from default stream"}; + rtErrMap_[RT_ERROR_STREAM_AICPU_ALLOC_FAIL] = {ACL_ERROR_RT_RESOURCE_ALLOC_FAIL, "aicpu id alloc failed"}; rtErrMap_[RT_ERROR_STREAM_CAPTURE_CONFLICT] = {ACL_ERROR_STREAM_CAPTURE_CONFLICT, "stream begin capture conflict"}; rtErrMap_[RT_ERROR_STREAM_TASKGRP_STATUS] = {ACL_ERROR_STREAM_TASK_GROUP_STATUS, "task group status error"}; rtErrMap_[RT_ERROR_STREAM_TASKGRP_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "task group handle null"}; rtErrMap_[RT_ERROR_STREAM_TASKGRP_INTR] = {ACL_ERROR_STREAM_TASK_GROUP_INTR, "task group interrupted"}; rtErrMap_[RT_ERROR_STREAM_TASKGRP_UPDATE] = {ACL_ERROR_RT_INTERNAL_ERROR, "task group update error"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_UNMATCHED] = {ACL_ERROR_RT_STREAM_CAPTURE_UNMATCHED, - "the capture was not initiated in this stream"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_WRONG_THREAD] = {ACL_ERROR_RT_STREAM_CAPTURE_WRONG_THREAD, - "end capture in the wrong thread"}; - rtErrMap_[RT_ERROR_STREAM_SUB_ACLGRAPH_IS_CAPTURING] = {ACL_ERROR_RT_SUB_ACLGRAPH_IS_CAPTURING, "the sub ACL Graph is capturing"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_UNMATCHED] = { + ACL_ERROR_RT_STREAM_CAPTURE_UNMATCHED, "the capture was not initiated in this stream"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_WRONG_THREAD] = { + ACL_ERROR_RT_STREAM_CAPTURE_WRONG_THREAD, "end capture in the wrong thread"}; + rtErrMap_[RT_ERROR_STREAM_SUB_ACLGRAPH_IS_CAPTURING] = { + ACL_ERROR_RT_SUB_ACLGRAPH_IS_CAPTURING, "the sub ACL Graph is capturing"}; // model error rtErrMap_[RT_ERROR_MODEL_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "model base error"}; rtErrMap_[RT_ERROR_MODEL_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "model pointer null"}; - rtErrMap_[RT_ERROR_MODEL_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the model object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_MODEL_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the model object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_MODEL_CONTEXT] = {ACL_ERROR_RT_MODEL_CONTEXT, "model not in current ctx"}; rtErrMap_[RT_ERROR_MODEL_ENDGRAPH] = {ACL_ERROR_RT_INTERNAL_ERROR, "model endgraph num error"}; rtErrMap_[RT_ERROR_MODEL_STREAM] = {ACL_ERROR_RT_STREAM_MODEL, "model empty"}; @@ -183,39 +192,43 @@ void ErrorcodeManage::InitRtErrCodeMap() // event error rtErrMap_[RT_ERROR_EVENT_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "event base error"}; rtErrMap_[RT_ERROR_EVENT_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "event pointer null"}; - rtErrMap_[RT_ERROR_EVENT_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the event object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_EVENT_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the event object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_EVENT_RECORDER_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "event recorder null"}; rtErrMap_[RT_ERROR_EVENT_TIMESTAMP_INVALID] = {ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID, "event timestamp invalid"}; - rtErrMap_[RT_ERROR_EVENT_TIMESTAMP_REVERSAL] = {ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL, - "event timestamp reversal"}; + rtErrMap_[RT_ERROR_EVENT_TIMESTAMP_REVERSAL] = {ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL, "event timestamp reversal"}; rtErrMap_[RT_ERROR_EVENT_NOT_COMPLETE] = {ACL_ERROR_RT_EVENT_NOT_COMPLETE, "event not complete"}; rtErrMap_[RT_ERROR_EVENT_SYNC_TIMEOUT] = {ACL_ERROR_RT_EVENT_SYNC_TIMEOUT, "event sync timeout"}; rtErrMap_[RT_ERROR_EVENT_CAPTURED] = {ACL_ERROR_RT_EVENT_CAPTURED, "event is captured"}; - rtErrMap_[RT_ERROR_CAPTURE_DEPENDENCY] = {ACL_ERROR_RT_CAPTURE_DEPENDENCY, - "dependency created on uncaptured work in another stream"}; - rtErrMap_[RT_ERROR_STREAM_CAPTURE_ISOLATION] = {ACL_ERROR_RT_CAPTURE_DEPENDENCY, - "in the model capture scenario, the event wait task has no corresponding event record task"}; + rtErrMap_[RT_ERROR_CAPTURE_DEPENDENCY] = { + ACL_ERROR_RT_CAPTURE_DEPENDENCY, "dependency created on uncaptured work in another stream"}; + rtErrMap_[RT_ERROR_STREAM_CAPTURE_ISOLATION] = { + ACL_ERROR_RT_CAPTURE_DEPENDENCY, + "in the model capture scenario, the event wait task has no corresponding event record task"}; // notify error rtErrMap_[RT_ERROR_NOTIFY_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "notify base error"}; rtErrMap_[RT_ERROR_NOTIFY_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "notify pointer null"}; - rtErrMap_[RT_ERROR_NOTIFY_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the notify object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_NOTIFY_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the notify object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_NOTIFY_TYPE] = {ACL_ERROR_RT_INTERNAL_ERROR, "notify type error"}; rtErrMap_[RT_ERROR_NOTIFY_NOT_COMPLETE] = {ACL_ERROR_RT_INTERNAL_ERROR, "notify not complete"}; // context error rtErrMap_[RT_ERROR_CONTEXT_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "context base error"}; rtErrMap_[RT_ERROR_CONTEXT_NULL] = {ACL_ERROR_RT_CONTEXT_NULL, "the context is a null pointer"}; - rtErrMap_[RT_ERROR_CONTEXT_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the context object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_CONTEXT_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the context object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_CONTEXT_DEL] = {ACL_ERROR_RT_CONTEXT_RELEASE_ERROR, "context release error"}; - rtErrMap_[RT_ERROR_CONTEXT_DEFAULT_STREAM_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, - "default stream in current context is null"}; + rtErrMap_[RT_ERROR_CONTEXT_DEFAULT_STREAM_NULL] = { + ACL_ERROR_RT_INTERNAL_ERROR, "default stream in current context is null"}; rtErrMap_[RT_ERROR_CONTEXT_ONLINE_STREAM_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "online stream is null"}; rtErrMap_[RT_ERROR_CONTEXT_MODE] = {ACL_ERROR_RT_INTERNAL_ERROR, "the current context mode is incorrect"}; // kernel error rtErrMap_[RT_ERROR_KERNEL_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "kernel base error"}; rtErrMap_[RT_ERROR_KERNEL_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "kernel pointer null"}; - rtErrMap_[RT_ERROR_KERNEL_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the kernel object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_KERNEL_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the kernel object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_KERNEL_LOOKUP] = {ACL_ERROR_RT_KERNEL_LOOKUP, "kernel lookup error"}; rtErrMap_[RT_ERROR_KERNEL_NAME] = {ACL_ERROR_RT_INTERNAL_ERROR, "kernel name error"}; rtErrMap_[RT_ERROR_KERNEL_TYPE] = {ACL_ERROR_RT_INTERNAL_ERROR, "kernel type error"}; @@ -230,7 +243,8 @@ void ErrorcodeManage::InitRtErrCodeMap() // program error rtErrMap_[RT_ERROR_PROGRAM_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "program base error"}; rtErrMap_[RT_ERROR_PROGRAM_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "program pointer null"}; - rtErrMap_[RT_ERROR_PROGRAM_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the program object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_PROGRAM_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the program object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_PROGRAM_DATA] = {ACL_ERROR_RT_INTERNAL_ERROR, "program data error"}; rtErrMap_[RT_ERROR_PROGRAM_SIZE] = {ACL_ERROR_RT_INTERNAL_ERROR, "program size error"}; rtErrMap_[RT_ERROR_PROGRAM_MEM_TYPE] = {ACL_ERROR_RT_INTERNAL_ERROR, "program mem type error"}; @@ -240,30 +254,34 @@ void ErrorcodeManage::InitRtErrCodeMap() // module error rtErrMap_[RT_ERROR_MODULE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "module error base"}; rtErrMap_[RT_ERROR_MODULE_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "module pointer null"}; - rtErrMap_[RT_ERROR_MODULE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the module object. The host memory has been exhausted."}; - rtErrMap_[RT_ERROR_STREAM_UNJOINED] = {ACL_ERROR_RT_STREAM_UNJOINED, - "capture model contains a stream that was not joined to the origin stream"}; + rtErrMap_[RT_ERROR_MODULE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the module object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_STREAM_UNJOINED] = { + ACL_ERROR_RT_STREAM_UNJOINED, "capture model contains a stream that was not joined to the origin stream"}; rtErrMap_[RT_ERROR_MODEL_CAPTURED] = {ACL_ERROR_RT_MODEL_CAPTURED, "model is captured"}; rtErrMap_[RT_ERROR_MODEL_CAPTURE_STATUS] = {ACL_ERROR_RT_INTERNAL_ERROR, "model status error"}; rtErrMap_[RT_ERROR_MODEL_RUNNING] = {ACL_ERROR_RT_MODEL_RUNNING, "model is running"}; rtErrMap_[RT_ERROR_MODEL_OP_CACHE_CLOSED] = {ACL_ERROR_RT_INTERNAL_ERROR, "model cache op info switch is closed"}; rtErrMap_[RT_ERROR_MODEL_UPDATE_FAILED] = {ACL_ERROR_RT_MODEL_UPDATE_FAILED, "model update failed"}; - + // instance error rtErrMap_[RT_ERROR_INSTANCE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "instance base error"}; rtErrMap_[RT_ERROR_INSTANCE_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "instance pointer null"}; - rtErrMap_[RT_ERROR_INSTANCE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the instance object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_INSTANCE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the instance object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_INSTANCE_VERSION] = {ACL_ERROR_RT_SOC_VERSION, "soc version error"}; // api error rtErrMap_[RT_ERROR_API_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "api error base"}; rtErrMap_[RT_ERROR_API_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "api pointer null"}; - rtErrMap_[RT_ERROR_API_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the api object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_API_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the api object. The host memory has been exhausted."}; // datadump error rtErrMap_[RT_ERROR_DATADUMP_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "datadump base error"}; rtErrMap_[RT_ERROR_DATADUMP_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "datadump pointer null"}; - rtErrMap_[RT_ERROR_DATADUMP_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the datadump object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_DATADUMP_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the datadump object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_DATADUMP_TIME] = {ACL_ERROR_RT_INTERNAL_ERROR, "datadump time error"}; rtErrMap_[RT_ERROR_DATADUMP_FILE] = {ACL_ERROR_RT_FILE_WRITE, "datadump file error"}; rtErrMap_[RT_ERROR_DATADUMP_ADDRESS] = {ACL_ERROR_RT_INTERNAL_ERROR, "datadump address error"}; @@ -273,7 +291,8 @@ void ErrorcodeManage::InitRtErrCodeMap() // prof error rtErrMap_[RT_ERROR_PROF_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "profiler base error"}; rtErrMap_[RT_ERROR_PROF_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "profiler pointer null"}; - rtErrMap_[RT_ERROR_PROF_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the profiler object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_PROF_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the profiler object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_PROF_START] = {ACL_ERROR_RT_INTERNAL_ERROR, "profiler start error"}; rtErrMap_[RT_ERROR_PROF_DEVICE_MEM] = {ACL_ERROR_RT_INTERNAL_ERROR, "profiler device memory error"}; rtErrMap_[RT_ERROR_PROF_HOST_MEM] = {ACL_ERROR_RT_INTERNAL_ERROR, "profiler host memory error"}; @@ -285,14 +304,16 @@ void ErrorcodeManage::InitRtErrCodeMap() // pctrace error rtErrMap_[RT_ERROR_PCTRACE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "pctrace base error"}; rtErrMap_[RT_ERROR_PCTRACE_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "pctrace pointer null"}; - rtErrMap_[RT_ERROR_PCTRACE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the pctrace object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_PCTRACE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the pctrace object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_PCTRACE_TIME] = {ACL_ERROR_RT_INTERNAL_ERROR, "pctrace time error"}; rtErrMap_[RT_ERROR_PCTRACE_FILE] = {ACL_ERROR_RT_INTERNAL_ERROR, "pctrace file error"}; // task error rtErrMap_[RT_ERROR_TASK_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "task base error"}; rtErrMap_[RT_ERROR_TASK_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "task pointer null"}; - rtErrMap_[RT_ERROR_TASK_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the task object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_TASK_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the task object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_TASK_NOT_SUPPORT] = {ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT, "task not supported"}; rtErrMap_[RT_ERROR_TASK_ALLOCATOR] = {ACL_ERROR_RT_INTERNAL_ERROR, "task allocator error"}; @@ -316,13 +337,15 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_MEMORY_FREE] = {ACL_ERROR_RT_MEMORY_FREE, "free memory error"}; rtErrMap_[RT_ERROR_INVALID_MEMORY_TYPE] = {ACL_ERROR_RT_INVALID_MEMORY_TYPE, "invalid memory type"}; rtErrMap_[RT_ERROR_NOT_SET_SYSPARAMOPT] = {ACL_ERROR_RT_SYSPARAMOPT_NOT_SET, "not set sysparamopt"}; - rtErrMap_[RT_ERROR_INSUFFICIENT_INPUT_ARRAY] = {ACL_ERROR_RT_INSUFFICIENT_INPUT_ARRAY, "The array space is insufficient."}; + rtErrMap_[RT_ERROR_INSUFFICIENT_INPUT_ARRAY] = { + ACL_ERROR_RT_INSUFFICIENT_INPUT_ARRAY, "The array space is insufficient."}; rtErrMap_[RT_ERROR_INVALID_HANDLE] = {ACL_ERROR_RT_INVALID_HANDLE, "invalid handle"}; // debug error rtErrMap_[RT_ERROR_DEBUG_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "debug base error"}; rtErrMap_[RT_ERROR_DEBUG_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "debug pointer null"}; - rtErrMap_[RT_ERROR_DEBUG_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the debug object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_DEBUG_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the debug object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_DEBUG_SIGNAL] = {ACL_ERROR_RT_INTERNAL_ERROR, "debug signal error"}; rtErrMap_[RT_ERROR_DEBUG_OPEN] = {ACL_ERROR_RT_FILE_OPEN, "open file failed"}; rtErrMap_[RT_ERROR_DEBUG_WRITE] = {ACL_ERROR_RT_FILE_WRITE, "write file failed"}; @@ -332,13 +355,15 @@ void ErrorcodeManage::InitRtErrCodeMap() // engine error rtErrMap_[RT_ERROR_ENGINE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "engine base error"}; rtErrMap_[RT_ERROR_ENGINE_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "engine pointer null"}; - rtErrMap_[RT_ERROR_ENGINE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the engine object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_ENGINE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the engine object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_ENGINE_THREAD] = {ACL_ERROR_RT_INTERNAL_ERROR, "error engine thread"}; // label error rtErrMap_[RT_ERROR_LABEL_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "label base error"}; rtErrMap_[RT_ERROR_LABEL_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "label pointer null"}; - rtErrMap_[RT_ERROR_LABEL_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the label object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_LABEL_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the label object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_LABEL_CONTEXT] = {ACL_ERROR_RT_LABEL_CONTEXT, "label not in current ctx"}; rtErrMap_[RT_ERROR_LABEL_STREAM] = {ACL_ERROR_RT_INTERNAL_ERROR, "label stream error"}; rtErrMap_[RT_ERROR_LABEL_MODEL] = {ACL_ERROR_RT_INTERNAL_ERROR, "label not in current model"}; @@ -360,12 +385,12 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_TSFW_TASK_CMD_QUEUE_EMPTY] = {ACL_ERROR_RT_TS_ERROR, "tsfw task command queue is empty"}; rtErrMap_[RT_ERROR_TSFW_TASK_REPORT_QUEUE_FULL] = {ACL_ERROR_RT_TS_ERROR, "tsfw task report queue is full"}; rtErrMap_[RT_ERROR_TSFW_TASK_REPORT_QUEUE_EMPTY] = {ACL_ERROR_RT_TS_ERROR, "tsfw task report queue is empty"}; - rtErrMap_[RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, - "all the nodes of public task buff are occupied"}; - rtErrMap_[RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_FREED] = {ACL_ERROR_RT_TS_ERROR, - "all the node of public task buff are free"}; - rtErrMap_[RT_ERROR_TSFW_L2_MEM_INSUFFICIENT_SPACE] = {ACL_ERROR_RT_TS_ERROR, - "there is not enough space on l2 memory"}; + rtErrMap_[RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_OCCUPIED] = { + ACL_ERROR_RT_TS_ERROR, "all the nodes of public task buff are occupied"}; + rtErrMap_[RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_FREED] = { + ACL_ERROR_RT_TS_ERROR, "all the node of public task buff are free"}; + rtErrMap_[RT_ERROR_TSFW_L2_MEM_INSUFFICIENT_SPACE] = { + ACL_ERROR_RT_TS_ERROR, "there is not enough space on l2 memory"}; rtErrMap_[RT_ERROR_TSFW_L2_MALLOC_FAILED] = {ACL_ERROR_RT_TS_ERROR, "malloc l2 memory failed"}; rtErrMap_[RT_ERROR_TSFW_DMA_CHANNEL_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, "all the DMA channel are occupied"}; rtErrMap_[RT_ERROR_TSFW_MEMCPY_OP_FAILED] = {ACL_ERROR_RT_TS_ERROR, "memcpy failed"}; @@ -373,17 +398,16 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_TSFW_TBS_SLOT_REPEAT_FREE] = {ACL_ERROR_RT_TS_ERROR, "bs slot cannot be freed again"}; rtErrMap_[RT_ERROR_TSFW_PRIORITY_TASK_LIST_FULL] = {ACL_ERROR_RT_TS_ERROR, "the priority list is full"}; rtErrMap_[RT_ERROR_TSFW_PRIORITY_TASK_LIST_EMPTY] = {ACL_ERROR_RT_TS_ERROR, "the priority list is empty"}; - rtErrMap_[RT_ERROR_TSFW_NO_STREAM_LIST_NEED_TO_BE_PROCESSED] = {ACL_ERROR_RT_TS_ERROR, - "there is no stream list need service"}; - rtErrMap_[RT_ERROR_TSFW_REPEAT_MARK_STREAM_NEED_SERVICE] = {ACL_ERROR_RT_TS_ERROR, - "repeat mark the stream list need service"}; - rtErrMap_[RT_ERROR_TSFW_SYS_DMA_CHANNEL_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, - "system dma channel all occupied"}; + rtErrMap_[RT_ERROR_TSFW_NO_STREAM_LIST_NEED_TO_BE_PROCESSED] = { + ACL_ERROR_RT_TS_ERROR, "there is no stream list need service"}; + rtErrMap_[RT_ERROR_TSFW_REPEAT_MARK_STREAM_NEED_SERVICE] = { + ACL_ERROR_RT_TS_ERROR, "repeat mark the stream list need service"}; + rtErrMap_[RT_ERROR_TSFW_SYS_DMA_CHANNEL_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, "system dma channel all occupied"}; rtErrMap_[RT_ERROR_TSFW_NO_HBML2TASKNODE_FOUND] = {ACL_ERROR_RT_TS_ERROR, "no hbm l2 task node found"}; - rtErrMap_[RT_ERROR_TSFW_SQNODE_NODE_SLOT_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, - "all the node of the current sq are occupied"}; - rtErrMap_[RT_ERROR_TSFW_CQNODE_NODE_SLOT_ALL_OCCUPIED] = {ACL_ERROR_RT_TS_ERROR, - "all the node of the current cq are occupied"}; + rtErrMap_[RT_ERROR_TSFW_SQNODE_NODE_SLOT_ALL_OCCUPIED] = { + ACL_ERROR_RT_TS_ERROR, "all the node of the current sq are occupied"}; + rtErrMap_[RT_ERROR_TSFW_CQNODE_NODE_SLOT_ALL_OCCUPIED] = { + ACL_ERROR_RT_TS_ERROR, "all the node of the current cq are occupied"}; rtErrMap_[RT_ERROR_TSFW_SQNODE_NOT_ENOUGH] = {ACL_ERROR_RT_TS_ERROR, "the sq node is not enough for data transfer"}; rtErrMap_[RT_ERROR_TSFW_SQNODE_SLOT_REPEAT_FREE] = {ACL_ERROR_RT_TS_ERROR, "sq node slot repeat free"}; rtErrMap_[RT_ERROR_TSFW_CQNODE_SLOT_REPEAT_FREE] = {ACL_ERROR_RT_TS_ERROR, "cq node slot repeat free"}; @@ -403,17 +427,17 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_TSFW_AICORE_TRAP_EXCEPTION] = {ACL_ERROR_RT_AICORE_TRAP_EXCEPTION, "aicore trap exception"}; rtErrMap_[RT_ERROR_TSFW_VECTOR_CORE_TIMEOUT] = {ACL_ERROR_RT_VECTOR_CORE_TIMEOUT, "vector core timeout"}; rtErrMap_[RT_ERROR_TSFW_VECTOR_CORE_EXCEPTION] = {ACL_ERROR_RT_VECTOR_CORE_EXCEPTION, "vector core exception"}; - rtErrMap_[RT_ERROR_TSFW_VECTOR_CORE_TRAP_EXCEPTION] = {ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION, - "vector core trap exception"}; + rtErrMap_[RT_ERROR_TSFW_VECTOR_CORE_TRAP_EXCEPTION] = { + ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION, "vector core trap exception"}; rtErrMap_[RT_ERROR_TSFW_AICPU_TIMEOUT] = {ACL_ERROR_RT_AICPU_TIMEOUT, "aicpu timeout"}; rtErrMap_[RT_ERROR_TSFW_SDMA_L2_TO_DDR_MALLOC_FAIL] = {ACL_ERROR_RT_TS_ERROR, "sdma move l2 to ddr malloc failed"}; rtErrMap_[RT_ERROR_TSFW_AICPU_EXCEPTION] = {ACL_ERROR_RT_AICPU_EXCEPTION, "aicpu exception"}; - rtErrMap_[RT_ERROR_TSFW_AICPU_DATADUMP_RSP_ERR] = {ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR, - "aicpu datadump response error"}; - rtErrMap_[RT_ERROR_TSFW_AICPU_INFO_LOAD_RSP_ERR] = {ACL_ERROR_RT_AICPU_INFO_LOAD_RSP_ERR, - "aicpu info load response error"}; - rtErrMap_[RT_ERROR_TSFW_AICPU_MODEL_RSP_ERR] = {ACL_ERROR_RT_AICPU_MODEL_RSP_ERR, - "aicpu model operate response error"}; + rtErrMap_[RT_ERROR_TSFW_AICPU_DATADUMP_RSP_ERR] = { + ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR, "aicpu datadump response error"}; + rtErrMap_[RT_ERROR_TSFW_AICPU_INFO_LOAD_RSP_ERR] = { + ACL_ERROR_RT_AICPU_INFO_LOAD_RSP_ERR, "aicpu info load response error"}; + rtErrMap_[RT_ERROR_TSFW_AICPU_MODEL_RSP_ERR] = { + ACL_ERROR_RT_AICPU_MODEL_RSP_ERR, "aicpu model operate response error"}; rtErrMap_[RT_ERROR_TSFW_REPEAT_ACTIVE_MODEL_STREAM] = {ACL_ERROR_RT_TS_ERROR, "active stream already in running"}; rtErrMap_[RT_ERROR_TSFW_REPEAT_NOTIFY_WAIT] = {ACL_ERROR_RT_TS_ERROR, "repeat stream notify wait"}; rtErrMap_[RT_ERROR_TSFW_DEBUG_INVALID_SQCQ] = {ACL_ERROR_RT_TS_ERROR, "debug invalid sqcq"}; @@ -432,8 +456,8 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_TSFW_DEBUG_BREAKPOINT_FULL] = {ACL_ERROR_RT_TS_ERROR, "debug breakpoint full"}; rtErrMap_[RT_ERROR_TSFW_DEBUG_READ_ERROR] = {ACL_ERROR_RT_TS_ERROR, "debug read error"}; rtErrMap_[RT_ERROR_TSFW_DEBUG_WRITE_FAIL] = {ACL_ERROR_RT_TS_ERROR, "debug write fail"}; - rtErrMap_[RT_ERROR_TSFW_DEBUG_REGISTER_CONFLICT] = {ACL_ERROR_RT_TS_ERROR, - "debug register conflict, only one pid can be registered at the same time"}; + rtErrMap_[RT_ERROR_TSFW_DEBUG_REGISTER_CONFLICT] = { + ACL_ERROR_RT_TS_ERROR, "debug register conflict, only one pid can be registered at the same time"}; rtErrMap_[RT_ERROR_TSFW_QUEUE_FULL] = {ACL_ERROR_RT_TS_ERROR, "ts queue full"}; rtErrMap_[RT_ERROR_TSFW_QUEUE_EMPTY] = {ACL_ERROR_RT_TS_ERROR, "ts queue empty"}; rtErrMap_[RT_ERROR_TSFW_QUEUE_ALLOC_MEM_FAIL] = {ACL_ERROR_RT_TS_ERROR, "ts queue alloc mem fail"}; @@ -472,24 +496,25 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_TSFW_RESERVED] = {ACL_ERROR_RT_TS_ERROR, "tsfw unknown error"}; rtErrMap_[RT_ERROR_TSFW_SDMA_COPY_ERROR] = {ACL_ERROR_RT_SYS_DMA, "sdma copy error"}; rtErrMap_[RT_ERROR_TSFW_SDMA_REDUCE_ERROR] = {ACL_ERROR_RT_SYS_DMA, "sdma reduce error"}; - rtErrMap_[RT_ERROR_TSFW_AIC_TRAP_RD_OVERFLOW] = {ACL_ERROR_RT_AICORE_TRAP_READ_OVERFLOW, - "aicore trap read overflow"}; - rtErrMap_[RT_ERROR_TSFW_AIC_TRAP_WR_OVERFLOW] = {ACL_ERROR_RT_AICORE_TRAP_WRITE_OVERFLOW, - "aicore trap write overflow"}; - rtErrMap_[RT_ERROR_TSFW_AIV_TRAP_RD_OVERFLOW] = {ACL_ERROR_RT_VECTOR_CORE_TRAP_READ_OVERFLOW, - "vector core trap read overflow"}; - rtErrMap_[RT_ERROR_TSFW_AIV_TRAP_WR_OVERFLOW] = {ACL_ERROR_RT_VECTOR_CORE_TRAP_WRITE_OVERFLOW, - "vector core trap write overflow"}; + rtErrMap_[RT_ERROR_TSFW_AIC_TRAP_RD_OVERFLOW] = { + ACL_ERROR_RT_AICORE_TRAP_READ_OVERFLOW, "aicore trap read overflow"}; + rtErrMap_[RT_ERROR_TSFW_AIC_TRAP_WR_OVERFLOW] = { + ACL_ERROR_RT_AICORE_TRAP_WRITE_OVERFLOW, "aicore trap write overflow"}; + rtErrMap_[RT_ERROR_TSFW_AIV_TRAP_RD_OVERFLOW] = { + ACL_ERROR_RT_VECTOR_CORE_TRAP_READ_OVERFLOW, "vector core trap read overflow"}; + rtErrMap_[RT_ERROR_TSFW_AIV_TRAP_WR_OVERFLOW] = { + ACL_ERROR_RT_VECTOR_CORE_TRAP_WRITE_OVERFLOW, "vector core trap write overflow"}; rtErrMap_[RT_ERROR_TSFW_FFTS_PLUS_TIMEOUT] = {ACL_ERROR_RT_FFTS_PLUS_TIMEOUT, "fftsplus timeout"}; rtErrMap_[RT_ERROR_TSFW_FFTS_PLUS_EXCEPTION] = {ACL_ERROR_RT_FFTS_PLUS_EXCEPTION, "fftsplus exception"}; - rtErrMap_[RT_ERROR_TSFW_FFTS_PLUS_TRAP_EXCEPTION] = {ACL_ERROR_RT_FFTS_PLUS_TRAP_EXCEPTION, - "fftsplus trap exception"}; + rtErrMap_[RT_ERROR_TSFW_FFTS_PLUS_TRAP_EXCEPTION] = { + ACL_ERROR_RT_FFTS_PLUS_TRAP_EXCEPTION, "fftsplus trap exception"}; rtErrMap_[RT_ERROR_TSFW_TS_CLOSED] = {ACL_ERROR_RT_TS_ERROR, "In sentinel mode, tsfw is closed"}; rtErrMap_[RT_ERROR_TSFW_TASK_ABORT_STOP] = {ACL_ERROR_RT_TASK_ABORT_STOP, "stream abort stop before post process"}; // subscribe error rtErrMap_[RT_ERROR_SUBSCRIBE_BASE] = {ACL_ERROR_RT_INTERNAL_ERROR, "subscribe base error"}; rtErrMap_[RT_ERROR_SUBSCRIBE_NULL] = {ACL_ERROR_RT_INTERNAL_ERROR, "subscribe pointer null"}; - rtErrMap_[RT_ERROR_SUBSCRIBE_NEW] = {ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the subscribe object. The host memory has been exhausted."}; + rtErrMap_[RT_ERROR_SUBSCRIBE_NEW] = { + ACL_ERROR_RT_MEMORY_ALLOCATION, "Failed to create the subscribe object. The host memory has been exhausted."}; rtErrMap_[RT_ERROR_SUBSCRIBE_STREAM] = {ACL_ERROR_RT_STREAM_SUBSCRIBE, "subscribe stream error"}; rtErrMap_[RT_ERROR_SUBSCRIBE_THREAD] = {ACL_ERROR_RT_THREAD_SUBSCRIBE, "subscribe thread error"}; rtErrMap_[RT_ERROR_SUBSCRIBE_GROUP] = {ACL_ERROR_RT_INTERNAL_ERROR, "subscribe group error"}; @@ -528,14 +553,15 @@ void ErrorcodeManage::InitRtErrCodeMap() rtErrMap_[RT_ERROR_SNAPSHOT_UNLOCK_FAILED] = {ACL_ERROR_SNAPSHOT_UNLOCK_FAILED, "snapshot unlock failed"}; rtErrMap_[RT_ERROR_SNAPSHOT_BACKUP_FAILED] = {ACL_ERROR_SNAPSHOT_BACKUP_FAILED, "snapshot backup failed"}; rtErrMap_[RT_ERROR_SNAPSHOT_RESTORE_FAILED] = {ACL_ERROR_SNAPSHOT_RESTORE_FAILED, "snapshot restore failed"}; - rtErrMap_[RT_ERROR_SNAPSHOT_CALLBACK_FAILED] = {ACL_ERROR_SNAPSHOT_CALLBACK_FAILED, "snapshot callback function execution failed"}; + rtErrMap_[RT_ERROR_SNAPSHOT_CALLBACK_FAILED] = { + ACL_ERROR_SNAPSHOT_CALLBACK_FAILED, "snapshot callback function execution failed"}; rtErrMap_[RT_ERROR_SNAPSHOT_REGISTER_CALLBACK_FAILED] = { ACL_ERROR_SNAPSHOT_REGISTER_CALLBACK_FAILED, "register snapshot callback function failed"}; // register memory - rtErrMap_[RT_ERROR_HOST_MEMORY_ALREADY_REGISTERED] = {ACL_ERROR_HOST_MEMORY_ALREADY_REGISTERED, - "host memory range already registered"}; - rtErrMap_[RT_ERROR_HOST_MEMORY_NOT_REGISTERED] = {ACL_ERROR_HOST_MEMORY_NOT_REGISTERED, - "host memory has not been registered"}; + rtErrMap_[RT_ERROR_HOST_MEMORY_ALREADY_REGISTERED] = { + ACL_ERROR_HOST_MEMORY_ALREADY_REGISTERED, "host memory range already registered"}; + rtErrMap_[RT_ERROR_HOST_MEMORY_NOT_REGISTERED] = { + ACL_ERROR_HOST_MEMORY_NOT_REGISTERED, "host memory has not been registered"}; } void ErrorcodeManage::InitDrvErrCodeMap() @@ -597,7 +623,7 @@ RtExtErrcodeType ErrorcodeManage::GetRtExtErrCode(const RtInnerErrcodeType errco return ret; } else { ret = errcode; - return ret; // protect for externel errorcode,in callback situation + return ret; // protect for externel errorcode,in callback situation } } ret = it->second.first; @@ -614,7 +640,7 @@ RtExtErrcodeType ErrorcodeManage::TransExtErrCode(const RtInnerErrcodeType errco if (errcode >= RT_ERRORCODE_BASE) { return ACL_ERROR_RT_INTERNAL_ERROR; } else { - return errcode; // protect for externel errorcode,in callback situation + return errcode; // protect for externel errorcode,in callback situation } } return it->second.first; @@ -636,7 +662,7 @@ std::string ErrorcodeManage::GetErrorDesc(const RtInnerErrcodeType errcode) ss << "ErrCode="; ss << errcode; ss << ", desc=[callback error]"; - return ss.str(); // protect for externel errorcode,in callback situation + return ss.str(); // protect for externel errorcode,in callback situation } } @@ -659,7 +685,7 @@ std::string ErrorcodeManage::GetErrorReason(const RtInnerErrcodeType errcode) return ss.str(); } else { ss << "[callback error]"; - return ss.str(); // protect for externel errorcode,in callback situation + return ss.str(); // protect for externel errorcode,in callback situation } } ss << it->second.second; @@ -710,13 +736,13 @@ static const std::unordered_map moduleNameMap = { {MBUFF_MODULE_ID, "MBUFF"}, {AICPU_SCHE_MODULE_ID, "AICPU_SCHEDULE"}, {CUSTOM_SCHE_MODULE_ID, "CUSTOM_SCHEDULE"}, - {HCCP_SCHE_MODULE_ID, "HCCP_SCHEDULE"} -}; + {HCCP_SCHE_MODULE_ID, "HCCP_SCHEDULE"}}; -const std::string& ErrorcodeManage::GetModuleName(const uint16_t moduleId) const { +const std::string& ErrorcodeManage::GetModuleName(const uint16_t moduleId) const +{ static const std::string unknown = "UNKNOWN"; auto it = moduleNameMap.find(moduleId); return it != moduleNameMap.end() ? it->second : unknown; } -} -} +} // namespace runtime +} // namespace cce diff --git a/src/runtime/feature/aclgraph/context_aclgraph.cc b/src/runtime/feature/aclgraph/context_aclgraph.cc index f2a0a21..eabbef7 100644 --- a/src/runtime/feature/aclgraph/context_aclgraph.cc +++ b/src/runtime/feature/aclgraph/context_aclgraph.cc @@ -36,65 +36,69 @@ namespace { constexpr size_t NOTIFY_INDEX = 2U; } // namespace -rtError_t Context::UpdateEndGraphTask(Stream * const origCaptureStream, Stream * const exeStream, Notify *ntf) const +rtError_t Context::UpdateEndGraphTask(Stream* const origCaptureStream, Stream* const exeStream, Notify* ntf) const { uint16_t taskId = origCaptureStream->GetLastTaskId(); - TaskInfo *rtNotifyRecord = origCaptureStream->Device_()->GetTaskFactory()->GetTask(origCaptureStream->Id_(), taskId); + TaskInfo* rtNotifyRecord = + origCaptureStream->Device_()->GetTaskFactory()->GetTask(origCaptureStream->Id_(), taskId); COND_RETURN_ERROR(rtNotifyRecord == nullptr, RT_ERROR_STREAM_CAPTURED, "EndGraph task is NULL"); - COND_RETURN_ERROR(rtNotifyRecord->type != TS_TASK_TYPE_NOTIFY_RECORD, RT_ERROR_STREAM_INVALID, - "EndGraph task type=%u", rtNotifyRecord->type); + COND_RETURN_ERROR( + rtNotifyRecord->type != TS_TASK_TYPE_NOTIFY_RECORD, RT_ERROR_STREAM_INVALID, "EndGraph task type=%u", + rtNotifyRecord->type); rtNotifyRecord->u.notifyrecordTask.notifyId = ntf->GetNotifyId(); uint8_t sqeMem[RT_STARS_SQE_LEN] = {0}; ConstructStarsSqeForNotifyRecordTask(rtNotifyRecord, sqeMem); - void *targetAddrOfUpdatedSqe = RtValueToPtr(origCaptureStream->GetSqBaseAddr() + - (rtNotifyRecord->pos * sizeof(rtStarsSqe_t))); + void* targetAddrOfUpdatedSqe = + RtValueToPtr(origCaptureStream->GetSqBaseAddr() + (rtNotifyRecord->pos * sizeof(rtStarsSqe_t))); uint64_t realSize = 0U; auto error = MemcopyAsync( targetAddrOfUpdatedSqe, sizeof(rtStarsSqe_t), sqeMem, sizeof(sqeMem), RT_MEMCPY_HOST_TO_DEVICE_EX, exeStream, &realSize); COND_RETURN_ERROR(error != RT_ERROR_NONE, error, "update task fail error=0x%x", error); - RT_LOG(RT_LOG_WARNING, "exec stream_id=%d target stream_id=%u pos=%u", - exeStream->Id_(), origCaptureStream->Id_(), rtNotifyRecord->pos); + RT_LOG( + RT_LOG_WARNING, "exec stream_id=%d target stream_id=%u pos=%u", exeStream->Id_(), origCaptureStream->Id_(), + rtNotifyRecord->pos); return error; } -rtError_t Context::UpdateSuModelExeStreamNotifyWaitSqe(TaskInfo *taskInfo, - Stream * const exeStream) const +rtError_t Context::UpdateSuModelExeStreamNotifyWaitSqe(TaskInfo* taskInfo, Stream* const exeStream) const { - Notify *ntf = taskInfo->u.captureConditionTask.condHandle->GetSubModelNotify(); + Notify* ntf = taskInfo->u.captureConditionTask.condHandle->GetSubModelNotify(); rtStarsSqe_t sqeMem = {}; - ConstructStarsSqeForConditionNotifyWait(taskInfo, reinterpret_cast(&sqeMem)); - void *targetAddrOfUpdatedSqe = RtValueToPtr(taskInfo->stream->GetSqBaseAddr() + - ((taskInfo->pos + 1U) * sizeof(rtStarsSqe_t))); + ConstructStarsSqeForConditionNotifyWait(taskInfo, reinterpret_cast(&sqeMem)); + void* targetAddrOfUpdatedSqe = + RtValueToPtr(taskInfo->stream->GetSqBaseAddr() + ((taskInfo->pos + 1U) * sizeof(rtStarsSqe_t))); uint64_t realSize = 0U; auto error = MemcopyAsync( targetAddrOfUpdatedSqe, sizeof(rtStarsSqe_t), &sqeMem, sizeof(sqeMem), RT_MEMCPY_HOST_TO_DEVICE_EX, exeStream, &realSize); COND_RETURN_ERROR(error != RT_ERROR_NONE, error, "update sqe fail error=0x%x", error); - RT_LOG(RT_LOG_DEBUG, "exec stream_id=%d target stream_id=%u, ntyId=%u", - exeStream->Id_(), taskInfo->stream->Id_(), ntf->GetNotifyId()); + RT_LOG( + RT_LOG_DEBUG, "exec stream_id=%d target stream_id=%u, ntyId=%u", exeStream->Id_(), taskInfo->stream->Id_(), + ntf->GetNotifyId()); return error; } -rtError_t Context::AllocCascadeCaptureStream(const Stream * const stm, Model *const captureModel, Stream **newCaptureStream) +rtError_t Context::AllocCascadeCaptureStream( + const Stream* const stm, Model* const captureModel, Stream** newCaptureStream) { - Stream *newCaptureStreamTmp = nullptr; + Stream* newCaptureStreamTmp = nullptr; if (captureModel == nullptr) { - RT_LOG(RT_LOG_ERROR, "Capture model is null, device_id=%u, original stream_id=%d.", - device_->Id_(), stm->Id_()); + RT_LOG(RT_LOG_ERROR, "Capture model is null, device_id=%u, original stream_id=%d.", device_->Id_(), stm->Id_()); return RT_ERROR_MODEL_NULL; } - CaptureModel *captureModelTmp = dynamic_cast(captureModel); + CaptureModel* captureModelTmp = dynamic_cast(captureModel); const uint32_t flag = GetCaptureStreamFlag(); /* create capture stream */ rtError_t error = StreamCreate(0U, flag, &newCaptureStreamTmp, nullptr, captureModelTmp->IsSoftwareSqEnable()); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Capture stream create failed, device_id=%u, original stream_id=%d, retCode=%#x.", + RT_LOG( + RT_LOG_ERROR, "Capture stream create failed, device_id=%u, original stream_id=%d, retCode=%#x.", device_->Id_(), stm->Id_(), error); return error; } @@ -108,7 +112,9 @@ rtError_t Context::AllocCascadeCaptureStream(const Stream * const stm, Model *co } if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Bind capture stream failed, device_id=%u, model_id=%u, stream_id=%d, " + RT_LOG( + RT_LOG_ERROR, + "Bind capture stream failed, device_id=%u, model_id=%u, stream_id=%d, " "original stream_id=%d, retCode=%#x.", device_->Id_(), captureModel->Id_(), newCaptureStreamTmp->Id_(), stm->Id_(), error); StreamDestroy(newCaptureStreamTmp); @@ -120,7 +126,7 @@ rtError_t Context::AllocCascadeCaptureStream(const Stream * const stm, Model *co return RT_ERROR_NONE; } -void Context::FreeCascadeCaptureStream(Stream * const cascadeCaptureStm) +void Context::FreeCascadeCaptureStream(Stream* const cascadeCaptureStm) { if (cascadeCaptureStm == nullptr) { RT_LOG(RT_LOG_ERROR, "cascade capture stream is null."); @@ -128,7 +134,7 @@ void Context::FreeCascadeCaptureStream(Stream * const cascadeCaptureStm) } if (cascadeCaptureStm->Model_() != nullptr) { - CaptureModel *captureModelTmp = dynamic_cast(cascadeCaptureStm->Model_()); + CaptureModel* captureModelTmp = dynamic_cast(cascadeCaptureStm->Model_()); if (captureModelTmp->IsSoftwareSqEnable()) { /* steam is add to model, only need del from model */ (void)ModelDelStream(cascadeCaptureStm->Model_(), cascadeCaptureStm); @@ -143,9 +149,9 @@ void Context::FreeCascadeCaptureStream(Stream * const cascadeCaptureStm) return; } -rtError_t Context::StreamAddToCaptureModelProc(Stream * const stm, Model * const captureMdl, const bool isOriginal) +rtError_t Context::StreamAddToCaptureModelProc(Stream* const stm, Model* const captureMdl, const bool isOriginal) { - Stream *captureStream = nullptr; + Stream* captureStream = nullptr; const int32_t streamId = stm->Id_(); if (captureMdl == nullptr) { RT_LOG(RT_LOG_ERROR, "Capture model is null, device_id=%u, original stream_id=%d.", device_->Id_(), streamId); @@ -153,14 +159,16 @@ rtError_t Context::StreamAddToCaptureModelProc(Stream * const stm, Model * const } if (captureMdl->GetModelType() != RT_MODEL_CAPTURE_MODEL) { - RT_LOG(RT_LOG_ERROR, "model type not match, device_id=%u, original stream_id=%d, model_id=%u.", - device_->Id_(), streamId, captureMdl->Id_()); + RT_LOG( + RT_LOG_ERROR, "model type not match, device_id=%u, original stream_id=%d, model_id=%u.", device_->Id_(), + streamId, captureMdl->Id_()); return RT_ERROR_INVALID_VALUE; } - CaptureModel *captureModelTmp = dynamic_cast(captureMdl); + CaptureModel* captureModelTmp = dynamic_cast(captureMdl); if (captureModelTmp->IsCaptureFinish() || captureModelTmp->IsCaptureInvalid()) { - RT_LOG(RT_LOG_ERROR, "model capture status mismatch, device_id=%u, original stream_id=%d, model_id=%u.", + RT_LOG( + RT_LOG_ERROR, "model capture status mismatch, device_id=%u, original stream_id=%d, model_id=%u.", device_->Id_(), streamId, captureMdl->Id_()); return RT_ERROR_MODEL_CAPTURE_STATUS; } @@ -169,7 +177,8 @@ rtError_t Context::StreamAddToCaptureModelProc(Stream * const stm, Model * const /* create capture stream */ rtError_t error = StreamCreate(0U, flag, &captureStream, nullptr, captureModelTmp->IsSoftwareSqEnable()); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Capture stream create failed, device_id=%u, original stream_id=%d, retCode=%#x.", + RT_LOG( + RT_LOG_ERROR, "Capture stream create failed, device_id=%u, original stream_id=%d, retCode=%#x.", device_->Id_(), streamId, error); return error; } @@ -183,7 +192,9 @@ rtError_t Context::StreamAddToCaptureModelProc(Stream * const stm, Model * const } if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Bind capture stream failed, device_id=%u, model_id=%u, stream_id=%d, " + RT_LOG( + RT_LOG_ERROR, + "Bind capture stream failed, device_id=%u, model_id=%u, stream_id=%d, " "original stream_id=%d, retCode=%#x.", device_->Id_(), captureMdl->Id_(), captureStream->Id_(), streamId, error); (void)StreamDestroy(captureStream); @@ -194,8 +205,9 @@ rtError_t Context::StreamAddToCaptureModelProc(Stream * const stm, Model * const const rtStreamCaptureStatus status = stm->GetCaptureStatus(); /* check capture status again */ if (status != RT_STREAM_CAPTURE_STATUS_NONE) { - RT_LOG(RT_LOG_ERROR, "stream is already in capture status, device_id=%u, stream_id=%d, status=%s.", - device_->Id_(), streamId, ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated")); + RT_LOG( + RT_LOG_ERROR, "stream is already in capture status, device_id=%u, stream_id=%d, status=%s.", device_->Id_(), + streamId, ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated")); if (captureModelTmp->IsSoftwareSqEnable()) { /* steam is add to model, only need destroy model */ @@ -244,27 +256,30 @@ bool Context::IsCaptureModeSupport(void) const return true; } -static inline rtError_t CheckCaptureModelIsCaptured(Model * const mdl) +static inline rtError_t CheckCaptureModelIsCaptured(Model* const mdl) { COND_PROC((mdl == nullptr), return RT_ERROR_NONE); - CaptureModel *captureModelTmp = dynamic_cast(mdl); + CaptureModel* captureModelTmp = dynamic_cast(mdl); if (captureModelTmp->GetCaptureModelStatus() != RtCaptureModelStatus::NONE) { - RT_LOG_OUTER_MSG_IMPL(ErrorCode::EE1017, "rtStreamBeginCaptureToModel", "modelRI", RtFmtMsg("ModelRI (model_id=%u) is already captured", mdl->Id_())); + RT_LOG_OUTER_MSG_IMPL( + ErrorCode::EE1017, "rtStreamBeginCaptureToModel", "modelRI", + RtFmtMsg("ModelRI (model_id=%u) is already captured", mdl->Id_())); return RT_ERROR_MODEL_CAPTURED; } return RT_ERROR_NONE; } -rtError_t Context::StreamBeginCapture(Stream * const stm, const rtStreamCaptureMode mode, Model * const mdl) +rtError_t Context::StreamBeginCapture(Stream* const stm, const rtStreamCaptureMode mode, Model* const mdl) { - Model *captureModel = mdl; + Model* captureModel = mdl; BufferAllocator::OpenHugeBuff(); std::unique_lock taskLock(captureLock_); rtError_t error = CheckCaptureModelIsCaptured(mdl); - COND_RETURN_ERROR(error != RT_ERROR_NONE, error, "stream begin captured failed, stream_id=%d, model_id=%u.", - stm->Id_(), mdl->Id_()); + COND_RETURN_ERROR( + error != RT_ERROR_NONE, error, "stream begin captured failed, stream_id=%d, model_id=%u.", stm->Id_(), + mdl->Id_()); const rtStreamCaptureStatus status = stm->GetCaptureStatus(); const int32_t streamId = stm->Id_(); @@ -272,32 +287,38 @@ rtError_t Context::StreamBeginCapture(Stream * const stm, const rtStreamCaptureM RT_LOG(RT_LOG_INFO, "capture begin, device_id=%u, original stream_id=%d.", device_->Id_(), streamId); /* check capture status */ - COND_RETURN_AND_MSG_OUTER(status != RT_STREAM_CAPTURE_STATUS_NONE, RT_ERROR_STREAM_CAPTURED, ErrorCode::EE1016, - "Stream begin capture", RtFmtMsg("Stream is already in capture status, device_id=%u, stream_id=%d, status=%s", - device_->Id_(), streamId, ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated"))); + COND_RETURN_AND_MSG_OUTER( + status != RT_STREAM_CAPTURE_STATUS_NONE, RT_ERROR_STREAM_CAPTURED, ErrorCode::EE1016, "Stream begin capture", + RtFmtMsg( + "Stream is already in capture status, device_id=%u, stream_id=%d, status=%s", device_->Id_(), streamId, + ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated"))); /* create capture model */ if (captureModel == nullptr) { error = ModelCreate(&captureModel, RT_MODEL_CAPTURE_MODEL); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Capture model create failed, device_id=%u, original stream_id=%d, retCode=%#x.", + RT_LOG( + RT_LOG_ERROR, "Capture model create failed, device_id=%u, original stream_id=%d, retCode=%#x.", device_->Id_(), streamId, error); return error; } } - if ((stm->Device_()->IsSupportFeature(RtOptionalFeatureType::RT_FEATURE_MODEL_ACL_GRAPH_SOFTWARE_ENABLE)) && + if ((stm->Device_()->IsSupportFeature(RtOptionalFeatureType::RT_FEATURE_MODEL_ACL_GRAPH_SOFTWARE_ENABLE)) && (stm->Device_()->CheckFeatureSupport(TS_FEATURE_SOFTWARE_SQ_ENABLE)) && (NpuDriver::CheckIsSupportFeature(device_->Id_(), FEATURE_TRSDRV_SQ_SUPPORT_DYNAMIC_BIND))) { - CaptureModel *captureModelTmp = dynamic_cast(captureModel); + CaptureModel* captureModelTmp = dynamic_cast(captureModel); captureModelTmp->SetSoftwareSqEnable(); - RT_LOG(RT_LOG_DEBUG, "Capture model set software sq enable, device_id=%u, model_id=%u", - device_->Id_(), captureModel->Id_()); + RT_LOG( + RT_LOG_DEBUG, "Capture model set software sq enable, device_id=%u, model_id=%u", device_->Id_(), + captureModel->Id_()); } error = StreamAddToCaptureModelProc(stm, captureModel, true); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "add stream to capture model failed, device_id=%u, model_id=%u, " + RT_LOG( + RT_LOG_ERROR, + "add stream to capture model failed, device_id=%u, model_id=%u, " "original stream_id=%d, retCode=%#x.", device_->Id_(), captureModel->Id_(), streamId, error); ModelDestroy(captureModel); @@ -306,34 +327,35 @@ rtError_t Context::StreamBeginCapture(Stream * const stm, const rtStreamCaptureM CaptureModeEnter(stm, mode); - CondHandle *condHandle = nullptr; + CondHandle* condHandle = nullptr; /* 父model取到的condHandle是nullptr,接口不返错 */ - CaptureModel *captureMdl = dynamic_cast(captureModel); + CaptureModel* captureMdl = dynamic_cast(captureModel); (void)GetValidatedObject(captureMdl->GetCondHandle(), condHandle); - RT_LOG(RT_LOG_EVENT, "capture begin success, device_id=%u, model_id=%u" - " original stream_id=%d, capture stream_id=%d, stream_status=%d, isSubmodel=%u, parent model_id=%u.", - device_->Id_(), captureMdl->Id_(), streamId, stm->GetCaptureStream()->Id_(), stm->GetCaptureStatus(), - captureMdl->IsSubCaptureModel(), (condHandle != nullptr) ? condHandle->GetParentModel()->Id_() : MAX_UINT32_NUM); + RT_LOG( + RT_LOG_EVENT, + "capture begin success, device_id=%u, model_id=%u" + " original stream_id=%d, capture stream_id=%d, stream_status=%d, isSubmodel=%u, parent model_id=%u.", + device_->Id_(), captureMdl->Id_(), streamId, stm->GetCaptureStream()->Id_(), stm->GetCaptureStatus(), + captureMdl->IsSubCaptureModel(), + (condHandle != nullptr) ? condHandle->GetParentModel()->Id_() : MAX_UINT32_NUM); return RT_ERROR_NONE; } -rtError_t Context::CheckCaptureModelValidity(Model * const captureMdl) const +rtError_t Context::CheckCaptureModelValidity(Model* const captureMdl) const { NULL_PTR_RETURN(captureMdl, RT_ERROR_MODEL_NULL); - std::list streams = captureMdl->StreamList_(); - COND_RETURN_ERROR((streams.empty() == true), - RT_ERROR_STREAM_UNJOINED, - "No streams is bound to the capture model, model_id=%u.", + std::list streams = captureMdl->StreamList_(); + COND_RETURN_ERROR( + (streams.empty() == true), RT_ERROR_STREAM_UNJOINED, "No streams is bound to the capture model, model_id=%u.", captureMdl->Id_()); - CaptureModel * const mdl = dynamic_cast(captureMdl); - std::set & streamIds = mdl->GetTaskGroupStreamIds(); - COND_RETURN_ERROR((!streamIds.empty()), - RT_ERROR_STREAM_TASKGRP_STATUS, - "A task group is not closed in the capture model, model_id=%u.", - captureMdl->Id_()); + CaptureModel* const mdl = dynamic_cast(captureMdl); + std::set& streamIds = mdl->GetTaskGroupStreamIds(); + COND_RETURN_ERROR( + (!streamIds.empty()), RT_ERROR_STREAM_TASKGRP_STATUS, + "A task group is not closed in the capture model, model_id=%u.", captureMdl->Id_()); bool isOnlyOrigStream = true; bool hasRecordOrigStream = false; @@ -342,64 +364,64 @@ rtError_t Context::CheckCaptureModelValidity(Model * const captureMdl) const if ((*it)->IsOrigCaptureStream()) { origStreamId = (*it)->Id_(); } - if (((*it)->IsOrigCaptureStream()) || - ((*it)->IsLastLevelCaptureStream() == false) || - (mdl->IsAddStream(*it))) { + if (((*it)->IsOrigCaptureStream()) || ((*it)->IsLastLevelCaptureStream() == false) || (mdl->IsAddStream(*it))) { continue; } isOnlyOrigStream = false; const int32_t streamId = (*it)->Id_(); const uint32_t taskId = (*it)->GetLastTaskId(); - Event *event = nullptr; + Event* event = nullptr; CaptureCntNotify cntInfo = {0, 0U}; const rtError_t ret = GetCaptureEventFromTask(device_, static_cast(streamId), taskId, event, cntInfo); COND_RETURN_WITH_NOLOG((ret != RT_ERROR_NONE), ret); - COND_RETURN_ERROR((event == nullptr), - RT_ERROR_EVENT_NULL, - "No event object, stream_id=%d, task_id=%u.", - streamId, taskId); - COND_RETURN_AND_MSG_OUTER((event->GetEventFlag() == RT_EVENT_EXTERNAL), - RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, + COND_RETURN_ERROR( + (event == nullptr), RT_ERROR_EVENT_NULL, "No event object, stream_id=%d, task_id=%u.", streamId, taskId); + COND_RETURN_AND_MSG_OUTER( + (event->GetEventFlag() == RT_EVENT_EXTERNAL), RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, "Capture model validity check", "capture model", - RtFmtMsg("In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " + RtFmtMsg( + "In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " "(stream_id=%d) is not an event record task. Call aclrtRecordEvent on the sub stream to " "deliver an event record task", taskId, streamId)); - COND_RETURN_AND_MSG_OUTER((event->IsCaptureStreamWaited() == false), - RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, + COND_RETURN_AND_MSG_OUTER( + (event->IsCaptureStreamWaited() == false), RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, "Capture model validity check", "capture model", - RtFmtMsg("In the cross-stream capture scenario, the last task (task_id=%u, event_id=%d) on the sub " + RtFmtMsg( + "In the cross-stream capture scenario, the last task (task_id=%u, event_id=%d) on the sub " "stream (stream_id=%d) lacks the corresponding event wait task", taskId, event->EventId_(), streamId)); if (event->IsRecordOrigCaptureStream(*it)) { hasRecordOrigStream = true; } } - COND_RETURN_AND_MSG_OUTER(((isOnlyOrigStream == false) && (hasRecordOrigStream == false)), - RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, + COND_RETURN_AND_MSG_OUTER( + ((isOnlyOrigStream == false) && (hasRecordOrigStream == false)), RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, "Capture model validity check", "capture model", - RtFmtMsg("In the cross-stream capture scenario, the origin stream (stream_id=%u) has no event wait task, " + RtFmtMsg( + "In the cross-stream capture scenario, the origin stream (stream_id=%u) has no event wait task, " "indicating that the sub stream is not joined back to the origin stream", static_cast(origStreamId))); return RT_ERROR_NONE; } -rtError_t Context::CreateNotify(Notify **notify, uint32_t flag) +rtError_t Context::CreateNotify(Notify** notify, uint32_t flag) { const uint32_t deviceId = device_->Id_(); *notify = new (std::nothrow) Notify(deviceId, device_->DevGetTsId()); - COND_RETURN_ERROR_MSG_CALL(ERR_MODULE_SYSTEM, *notify == nullptr, RT_ERROR_NOTIFY_NEW, - "Notify create failed, new notify failed."); + COND_RETURN_ERROR_MSG_CALL( + ERR_MODULE_SYSTEM, *notify == nullptr, RT_ERROR_NOTIFY_NEW, "Notify create failed, new notify failed."); (*notify)->SetNotifyFlag(flag); const rtError_t error = (*notify)->Setup(); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Notify create failed, setup failed, device_id=%d, retCode=%#x", - deviceId, static_cast(error)); + RT_LOG( + RT_LOG_ERROR, "Notify create failed, setup failed, device_id=%d, retCode=%#x", deviceId, + static_cast(error)); if ((error == RT_ERROR_DRV_NO_NOTIFY_RESOURCES) || (error == RT_ERROR_DRV_NO_RESOURCES)) { - RT_LOG_OUTER_MSG_IMPL(ErrorCode::EE1023, "Alloc Notify resource", - "Too many ACL graphs are executed concurrently"); + RT_LOG_OUTER_MSG_IMPL( + ErrorCode::EE1023, "Alloc Notify resource", "Too many ACL graphs are executed concurrently"); } DELETE_O(*notify); return error; @@ -408,30 +430,32 @@ rtError_t Context::CreateNotify(Notify **notify, uint32_t flag) return RT_ERROR_NONE; } -rtError_t Context::AddNotifyToAddedCaptureStream(Stream * const oriSingleStm, CaptureModel * const captureMdl) +rtError_t Context::AddNotifyToAddedCaptureStream(Stream* const oriSingleStm, CaptureModel* const captureMdl) { rtError_t error = RT_ERROR_NONE; - auto &streams = captureMdl->GetAddStreamMap(); - Api * const apiObj = Runtime::Instance()->ApiImpl_(); + auto& streams = captureMdl->GetAddStreamMap(); + Api* const apiObj = Runtime::Instance()->ApiImpl_(); NULL_PTR_RETURN_MSG(apiObj, RT_ERROR_API_NULL); - for (auto &streamObj : streams) { - Notify *notify = nullptr; + for (auto& streamObj : streams) { + Notify* notify = nullptr; error = CreateNotify(¬ify, RT_NOTIFY_DEFAULT); COND_RETURN_WITH_NOLOG((error != RT_ERROR_NONE), error); // notify在模型销毁时,统一进行释放 captureMdl->AddNotify(notify); - Stream *const lastStm = streamObj.second.back(); - error = apiObj->NotifyRecord(notify, lastStm); - ERROR_RETURN(error, + Stream* const lastStm = streamObj.second.back(); + error = apiObj->NotifyRecord(notify, lastStm); + ERROR_RETURN( + error, "Notify record failed, device_id=%u, original stream_id=%d, " "capture model_id=%u, stream_id=%d, notify_id=%u, retCode=%#x", - device_->Id_(), oriSingleStm->Id_(), captureMdl->Id_(), - streamObj.second.back()->Id_(), notify->GetNotifyId(), error); + device_->Id_(), oriSingleStm->Id_(), captureMdl->Id_(), streamObj.second.back()->Id_(), + notify->GetNotifyId(), error); error = apiObj->NotifyWait(notify, oriSingleStm, MAX_UINT32_NUM); - ERROR_RETURN(error, + ERROR_RETURN( + error, "Notify wait failed, device_id=%u, original stream_id=%d, " "capture model_id=%u, stream_id=%d, notify_id=%u, retCode=%#x", - device_->Id_(), oriSingleStm->Id_(), captureMdl->Id_(), - streamObj.second.back()->Id_(), notify->GetNotifyId(), error); + device_->Id_(), oriSingleStm->Id_(), captureMdl->Id_(), streamObj.second.back()->Id_(), + notify->GetNotifyId(), error); } return error; } @@ -440,9 +464,9 @@ rtError_t Context::SetNotifyForExeModel(CaptureModel* const captureMdl) { /* for exe stream and add stream alloc notify */ rtError_t error = RT_ERROR_NONE; - const std::map> &streams = captureMdl->GetAddStreamMap(); + const std::map>& streams = captureMdl->GetAddStreamMap(); for (size_t i = 0U; i < (streams.size() * NOTIFY_INDEX); i++) { - Notify *notify = nullptr; + Notify* notify = nullptr; error = CreateNotify(¬ify, RT_NOTIFY_DEFAULT); COND_RETURN_WITH_NOLOG((error != RT_ERROR_NONE), error); captureMdl->AddExeNotify(notify); @@ -451,13 +475,13 @@ rtError_t Context::SetNotifyForExeModel(CaptureModel* const captureMdl) return error; } -static inline void ClearCaptureModel(Context * const ctx, Stream * const stm, Model *mdl = nullptr) +static inline void ClearCaptureModel(Context* const ctx, Stream* const stm, Model* mdl = nullptr) { stm->ExitCapture(); /* steam is bound to model, only need destroy model */ if (mdl != nullptr) { - CaptureModel *captureModel = dynamic_cast(mdl); + CaptureModel* captureModel = dynamic_cast(mdl); COND_PROC(captureModel == nullptr, return;); /* 子model不在这里单独销毁,随父model销毁 */ @@ -466,82 +490,83 @@ static inline void ClearCaptureModel(Context * const ctx, Stream * const stm, Mo } } -bool Context::CheckSubModelsIsEndCapture(Stream * const captureStream) +bool Context::CheckSubModelsIsEndCapture(Stream* const captureStream) { - CaptureModel *captureModel = dynamic_cast(captureStream->Model_()); - COND_RETURN_ERROR(captureModel == nullptr, false, - "capture model is null, capture stream_id=%d.", captureStream->Id_()); + CaptureModel* captureModel = dynamic_cast(captureStream->Model_()); + COND_RETURN_ERROR( + captureModel == nullptr, false, "capture model is null, capture stream_id=%d.", captureStream->Id_()); captureModel->ClearCachedAllSubModels(); bool isEndCapture = captureModel->CheckSubModelsIsEndCapture(); - COND_RETURN_ERROR(!isEndCapture, false, - "sub capture model is not end capture, capture model_id=%d.", captureModel->Id_()); + COND_RETURN_ERROR( + !isEndCapture, false, "sub capture model is not end capture, capture model_id=%d.", captureModel->Id_()); return true; } -rtError_t Context::StreamEndCapture(Stream * const stm, Model ** const captureMdl) +rtError_t Context::StreamEndCapture(Stream* const stm, Model** const captureMdl) { RT_LOG(RT_LOG_INFO, "capture end, device_id=%u, original stream_id=%d.", device_->Id_(), stm->Id_()); *captureMdl = nullptr; std::unique_lock taskLock(captureLock_); const rtStreamCaptureStatus status = stm->GetCaptureStatus(); /* check capture status */ - COND_RETURN_AND_MSG_OUTER(status == RT_STREAM_CAPTURE_STATUS_NONE, RT_ERROR_STREAM_NOT_CAPTURED, - ErrorCode::EE1018, "rtStreamEndCapture", - RtFmtMsg("The stream (stream_id=%d) is not in capture status, call rtStreamBeginCapture API to capture stream first", - stm->Id_())); + COND_RETURN_AND_MSG_OUTER( + status == RT_STREAM_CAPTURE_STATUS_NONE, RT_ERROR_STREAM_NOT_CAPTURED, ErrorCode::EE1018, "rtStreamEndCapture", + RtFmtMsg( + "The stream (stream_id=%d) is not in capture status, call rtStreamBeginCapture API to capture stream first", + stm->Id_())); - Stream *captureStream = stm->GetCaptureStream(); + Stream* captureStream = stm->GetCaptureStream(); NULL_STREAM_PTR_RETURN_MSG(captureStream); if (!(captureStream->IsOrigCaptureStream())) { - RT_LOG(RT_LOG_ERROR, "The capture was not initiated in this stream. device_id=%u, stream_id=%d.", - device_->Id_(), stm->Id_()); + RT_LOG( + RT_LOG_ERROR, "The capture was not initiated in this stream. device_id=%u, stream_id=%d.", device_->Id_(), + stm->Id_()); return RT_ERROR_STREAM_CAPTURE_UNMATCHED; } rtError_t error = CheckCaptureStreamThreadIsMatch(stm); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, - CaptureModeExit(stm); - ClearCaptureModel(this, stm);, - "end capture in the wrong thread."); + COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, CaptureModeExit(stm); ClearCaptureModel(this, stm); + , "end capture in the wrong thread."); CaptureModeExit(stm); - Model *captureModel = captureStream->Model_(); + Model* captureModel = captureStream->Model_(); if (captureModel == nullptr) { - RT_LOG(RT_LOG_ERROR, "captureModel is null, device_id=%u, origin stream_id=%d, status=%s.", - device_->Id_(), stm->Id_(), ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated")); + RT_LOG( + RT_LOG_ERROR, "captureModel is null, device_id=%u, origin stream_id=%d, status=%s.", device_->Id_(), + stm->Id_(), ((status == RT_STREAM_CAPTURE_STATUS_ACTIVE) ? "active" : "invalidated")); ClearCaptureModel(this, stm); return RT_ERROR_MODEL_NULL; } - CaptureModel *captureModelTmp = RtPtrToPtr(captureModel); - if (status == RT_STREAM_CAPTURE_STATUS_INVALIDATED || - captureModelTmp->IsCaptureInvalid()) { - RT_LOG(RT_LOG_ERROR, "current capture is invalid, device_id=%u, origin stream_id=%d.", - device_->Id_(), stm->Id_()); + CaptureModel* captureModelTmp = RtPtrToPtr(captureModel); + if (status == RT_STREAM_CAPTURE_STATUS_INVALIDATED || captureModelTmp->IsCaptureInvalid()) { + RT_LOG( + RT_LOG_ERROR, "current capture is invalid, device_id=%u, origin stream_id=%d.", device_->Id_(), stm->Id_()); ClearCaptureModel(this, stm, captureModel); return RT_ERROR_STREAM_CAPTURE_INVALIDATED; } const bool isCaptureFinished = CheckSubModelsIsEndCapture(captureStream); - - COND_PROC_RETURN_AND_MSG_OUTER(!isCaptureFinished, RT_ERROR_STREAM_SUB_ACLGRAPH_IS_CAPTURING, - ErrorCode::EE1016, ClearCaptureModel(this, stm, captureModel), - "Stream end capture", RtFmtMsg("Sub ACL Graph is capturing, stream_id=%d, capture stream_id=%d", - stm->Id_(), captureStream->Id_())); + + COND_PROC_RETURN_AND_MSG_OUTER( + !isCaptureFinished, RT_ERROR_STREAM_SUB_ACLGRAPH_IS_CAPTURING, ErrorCode::EE1016, + ClearCaptureModel(this, stm, captureModel), "Stream end capture", + RtFmtMsg("Sub ACL Graph is capturing, stream_id=%d, capture stream_id=%d", stm->Id_(), captureStream->Id_())); error = CheckCaptureModelValidity(captureModel); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, - ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "Failed to verify the validity of the capture model, retCode=%#x.", static_cast(error)); captureStream = stm->GetCaptureStream(); - NULL_PTR_PROC_RETURN_ERROR(captureStream, RT_ERROR_STREAM_NULL, - ClearCaptureModel(this, stm, captureModel)); - error = AddNotifyToAddedCaptureStream(stm, static_cast(captureModelTmp)); + NULL_PTR_PROC_RETURN_ERROR(captureStream, RT_ERROR_STREAM_NULL, ClearCaptureModel(this, stm, captureModel)); + error = AddNotifyToAddedCaptureStream(stm, static_cast(captureModelTmp)); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "set notify for add capture stream failed, device_id=%u, origin stream_id=%d, " + RT_LOG( + RT_LOG_ERROR, + "set notify for add capture stream failed, device_id=%u, origin stream_id=%d, " "capture model_id=%u, stream_id=%d, retCode=%#x.", device_->Id_(), stm->Id_(), captureModel->Id_(), captureStream->Id_(), error); ClearCaptureModel(this, stm, captureModel); @@ -550,7 +575,9 @@ rtError_t Context::StreamEndCapture(Stream * const stm, Model ** const captureMd error = SetNotifyForExeModel(captureModelTmp); if (error != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "set notify for capture model failed, device_id=%u, origin stream_id=%d, " + RT_LOG( + RT_LOG_ERROR, + "set notify for capture model failed, device_id=%u, origin stream_id=%d, " "capture model_id=%u, stream_id=%d, retCode=%#x.", device_->Id_(), stm->Id_(), captureModel->Id_(), captureStream->Id_(), error); ClearCaptureModel(this, stm, captureModel); @@ -558,31 +585,36 @@ rtError_t Context::StreamEndCapture(Stream * const stm, Model ** const captureMd } error = captureModelTmp->ResetCaptureEvents(stm); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "Failed to reset capture events, retCode=%#x.", static_cast(error)); if (!captureModelTmp->IsSoftwareSqEnable()) { - Api * const apiObj = Runtime::Instance()->ApiImpl_(); + Api* const apiObj = Runtime::Instance()->ApiImpl_(); error = apiObj->ModelEndGraph(captureModel, captureStream, 0U); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "capture model end graph failed, device_id=%u, origin stream_id=%d, " "capture model_id=%u, stream_id=%d, retCode=%#x.", device_->Id_(), stm->Id_(), captureModel->Id_(), captureStream->Id_(), error); error = captureModel->LoadComplete(); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "capture model load complete failed, device_id=%u, origin stream_id=%d, " "capture model_id=%u, stream_id=%d, retCode=%#x.", device_->Id_(), stm->Id_(), captureModel->Id_(), captureStream->Id_(), error); } else if (Runtime::Instance()->GetConnectUbFlag()) { // ub + software sq enable - for (Stream *innerStm : captureModelTmp->StreamList_()) { + for (Stream* innerStm : captureModelTmp->StreamList_()) { if (innerStm != nullptr) { error = StreamJettyHandler::FillNopWqeOnCaptureEnd(innerStm, JettyType::JETTY_TYPE_H2D); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "Failed to fill nop wqe, retCode=%#x.", static_cast(error)); error = StreamJettyHandler::FillNopWqeOnCaptureEnd(innerStm, JettyType::JETTY_TYPE_D2D); - COND_PROC_RETURN_ERROR(error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), + COND_PROC_RETURN_ERROR( + error != RT_ERROR_NONE, error, ClearCaptureModel(this, stm, captureModel), "Failed to fill nop wqe, retCode=%#x.", static_cast(error)); } } @@ -593,29 +625,31 @@ rtError_t Context::StreamEndCapture(Stream * const stm, Model ** const captureMd stm->ExitCapture(); *captureMdl = captureModel; - RT_LOG(RT_LOG_EVENT, + RT_LOG( + RT_LOG_EVENT, "capture end success, device_id=%u, original stream_id=%d, capture stream_id=%d, capture model_id=%u.", device_->Id_(), stm->Id_(), captureStream->Id_(), captureModel->Id_()); return RT_ERROR_NONE; } -rtError_t Context::StreamGetCaptureInfo(const Stream * const stm, rtStreamCaptureStatus * const status, - Model ** const captureMdl) const +rtError_t Context::StreamGetCaptureInfo( + const Stream* const stm, rtStreamCaptureStatus* const status, Model** const captureMdl) const { - Stream *captureStream = stm->GetCaptureStream(); + Stream* captureStream = stm->GetCaptureStream(); const rtStreamCaptureStatus statusTmp = stm->GetCaptureStatus(); - Model *mdlTmp = nullptr; + Model* mdlTmp = nullptr; uint32_t modelId = 0xFFFFU; if ((statusTmp != RT_STREAM_CAPTURE_STATUS_NONE) && (captureStream != nullptr)) { mdlTmp = captureStream->Model_(); if (mdlTmp == nullptr) { - RT_LOG(RT_LOG_WARNING, "stream is not in capture status, device_id=%u, stream_id=%d.", - device_->Id_(), stm->Id_()); + RT_LOG( + RT_LOG_WARNING, "stream is not in capture status, device_id=%u, stream_id=%d.", device_->Id_(), + stm->Id_()); } else { - modelId = mdlTmp->Id_(); - } + modelId = mdlTmp->Id_(); + } } if (status != nullptr) { @@ -626,13 +660,14 @@ rtError_t Context::StreamGetCaptureInfo(const Stream * const stm, rtStreamCaptur *captureMdl = mdlTmp; } - RT_LOG(RT_LOG_INFO, "device_id=%u, model_id=%u, original stream_id=%d, stream_status=%d", - device_->Id_(), modelId, stm->Id_(), statusTmp); + RT_LOG( + RT_LOG_INFO, "device_id=%u, model_id=%u, original stream_id=%d, stream_status=%d", device_->Id_(), modelId, + stm->Id_(), statusTmp); return RT_ERROR_NONE; } -rtError_t Context::ModelGetNodes(const Model * const mdl, uint32_t * const num) +rtError_t Context::ModelGetNodes(const Model* const mdl, uint32_t* const num) { /* model can not bind or unbind while get nodes */ std::unique_lock taskLock(streamLock_); @@ -640,25 +675,25 @@ rtError_t Context::ModelGetNodes(const Model * const mdl, uint32_t * const num) return RT_ERROR_NONE; } -rtError_t Context::ModelDebugDotPrint(const Model * const mdl) +rtError_t Context::ModelDebugDotPrint(const Model* const mdl) { std::unique_lock taskLock(streamLock_); return mdl->ModelDebugDotPrint(); } -rtError_t Context::ModelDebugJsonPrint(const Model * const mdl, const char* path, const uint32_t flags) +rtError_t Context::ModelDebugJsonPrint(const Model* const mdl, const char* path, const uint32_t flags) { std::unique_lock taskLock(streamLock_); return mdl->ModelDebugJsonPrint(path, flags); } -rtError_t Context::StreamAddToModel(Stream * const stm, Model * const captureMdl) +rtError_t Context::StreamAddToModel(Stream* const stm, Model* const captureMdl) { std::unique_lock taskLock(captureLock_); - return static_cast(captureMdl)->AddStreamToCaptureModel(stm); + return static_cast(captureMdl)->AddStreamToCaptureModel(stm); } -rtError_t Context::ThreadExchangeCaptureMode(rtStreamCaptureMode * const mode) const +rtError_t Context::ThreadExchangeCaptureMode(rtStreamCaptureMode* const mode) const { const rtStreamCaptureMode exchangeCaptureModeOld = InnerThreadLocalContainer::GetThreadExchangeCaptureMode(); @@ -671,7 +706,7 @@ rtError_t Context::ThreadExchangeCaptureMode(rtStreamCaptureMode * const mode) c return RT_ERROR_NONE; } -void Context::CaptureModeEnter(Stream * const stm, rtStreamCaptureMode mode) +void Context::CaptureModeEnter(Stream* const stm, rtStreamCaptureMode mode) { stm->SetStreamCaptureMode(mode); stm->SetBeginCaptureThreadId(runtime::GetCurrentTid()); @@ -684,7 +719,7 @@ void Context::CaptureModeEnter(Stream * const stm, rtStreamCaptureMode mode) } } -void Context::CaptureModeExit(Stream * const stm) +void Context::CaptureModeExit(Stream* const stm) { const rtStreamCaptureMode streamCaptureMode = stm->GetStreamCaptureMode(); stm->SetStreamCaptureMode(RT_STREAM_CAPTURE_MODE_MAX); @@ -720,23 +755,23 @@ void Context::CaptureModeExit(Stream * const stm) return; } -rtError_t Context::StreamBeginTaskGrp(Stream * const stm) +rtError_t Context::StreamBeginTaskGrp(Stream* const stm) { const std::lock_guard tskGrpLock(stm->GetTaskGrpMutex()); const StreamTaskGroupStatus status = stm->GetTaskGroupStatus(); - COND_RETURN_ERROR_MSG_INNER(status != StreamTaskGroupStatus::NONE, - RT_ERROR_STREAM_TASKGRP_STATUS, + COND_RETURN_ERROR_MSG_INNER( + status != StreamTaskGroupStatus::NONE, RT_ERROR_STREAM_TASKGRP_STATUS, "Task group is repeatedly started, or a task group is being updated."); - Stream *captureStream = stm->GetCaptureStream(); + Stream* captureStream = stm->GetCaptureStream(); NULL_PTR_RETURN_MSG(captureStream, RT_ERROR_STREAM_NOT_CAPTURED); - CaptureModel *mdl = dynamic_cast(captureStream->Model_()); + CaptureModel* mdl = dynamic_cast(captureStream->Model_()); NULL_PTR_RETURN(mdl, RT_ERROR_MODEL_NULL); std::unique_ptr taskGrp(new (std::nothrow) TaskGroup); - COND_RETURN_ERROR_MSG_CALL(ERR_MODULE_SYSTEM, taskGrp == nullptr, - RT_ERROR_MEMORY_ALLOCATION, "Create task group object failed."); + COND_RETURN_ERROR_MSG_CALL( + ERR_MODULE_SYSTEM, taskGrp == nullptr, RT_ERROR_MEMORY_ALLOCATION, "Create task group object failed."); const uint8_t prefetchCnt = stm->Device_()->GetDevProperties().taskPrefetchCount; for (uint8_t idx = 0; idx < prefetchCnt; idx++) { @@ -746,31 +781,32 @@ rtError_t Context::StreamBeginTaskGrp(Stream * const stm) captureStream = stm->GetCaptureStream(); NULL_PTR_RETURN_MSG(captureStream, RT_ERROR_STREAM_NOT_CAPTURED); - COND_RETURN_ERROR((mdl != dynamic_cast(captureStream->Model_())), - RT_ERROR_STREAM_CAPTURE_CONFLICT, "Capture model conflict."); + COND_RETURN_ERROR( + (mdl != dynamic_cast(captureStream->Model_())), RT_ERROR_STREAM_CAPTURE_CONFLICT, + "Capture model conflict."); (void)stm->UpdateTaskGroupStatus(StreamTaskGroupStatus::SAMPLE); captureStream->UpdateCurrentTaskGroup(taskGrp); mdl->InsertTaskGroupStreamId(static_cast(captureStream->Id_())); return RT_ERROR_NONE; } -rtError_t Context::StreamEndTaskGrp(Stream * const stm, TaskGroup ** const handle) const +rtError_t Context::StreamEndTaskGrp(Stream* const stm, TaskGroup** const handle) const { *handle = nullptr; const std::lock_guard tskGrpLock(stm->GetTaskGrpMutex()); const StreamTaskGroupStatus status = stm->GetTaskGroupStatus(); - COND_RETURN_ERROR_MSG_INNER(status != StreamTaskGroupStatus::SAMPLE, - RT_ERROR_STREAM_TASKGRP_STATUS, + COND_RETURN_ERROR_MSG_INNER( + status != StreamTaskGroupStatus::SAMPLE, RT_ERROR_STREAM_TASKGRP_STATUS, "The end operation cannot be performed on a stream that has not started a task group."); - Stream * const captureStream = stm->GetCaptureStream(); + Stream* const captureStream = stm->GetCaptureStream(); NULL_PTR_RETURN(captureStream, RT_ERROR_STREAM_NOT_CAPTURED); - CaptureModel *mdl = dynamic_cast(captureStream->Model_()); + CaptureModel* mdl = dynamic_cast(captureStream->Model_()); NULL_PTR_RETURN(mdl, RT_ERROR_MODEL_NULL); - std::unique_ptr &taskGrp = captureStream->GetCurrentTaskGroup(); + std::unique_ptr& taskGrp = captureStream->GetCurrentTaskGroup(); NULL_PTR_RETURN(taskGrp, RT_ERROR_STREAM_TASKGRP_NULL); rtError_t errorCode = mdl->GetTaskGroupErrCode(); @@ -789,55 +825,59 @@ rtError_t Context::StreamEndTaskGrp(Stream * const stm, TaskGroup ** const handl return errorCode; } -rtError_t Context::StreamBeginTaskUpdate(Stream * const stm, TaskGroup * handle) const +rtError_t Context::StreamBeginTaskUpdate(Stream* const stm, TaskGroup* handle) const { const std::lock_guard tskGrpLock(stm->GetTaskGrpMutex()); - COND_RETURN_AND_MSG_OUTER(stm->GetTaskGroupStatus() != StreamTaskGroupStatus::NONE, - RT_ERROR_STREAM_TASKGRP_STATUS, ErrorCode::EE1016, "Marking the start of the task to be updated", - "The stream is already in task update or sample mode"); + COND_RETURN_AND_MSG_OUTER( + stm->GetTaskGroupStatus() != StreamTaskGroupStatus::NONE, RT_ERROR_STREAM_TASKGRP_STATUS, ErrorCode::EE1016, + "Marking the start of the task to be updated", "The stream is already in task update or sample mode"); - COND_RETURN_ERROR_MSG_INNER(handle->isUpdate, - RT_ERROR_STREAM_TASKGRP_STATUS, "The handle only can be updated by one stream."); + COND_RETURN_ERROR_MSG_INNER( + handle->isUpdate, RT_ERROR_STREAM_TASKGRP_STATUS, "The handle only can be updated by one stream."); const rtError_t ret = stm->UpdateTaskGroupStatus(StreamTaskGroupStatus::UPDATE); - ERROR_RETURN(ret, "update stream task group status failed, ret:%#x, status:%d.", - static_cast(ret), stm->GetTaskGroupStatus()); + ERROR_RETURN( + ret, "update stream task group status failed, ret:%#x, status:%d.", static_cast(ret), + stm->GetTaskGroupStatus()); stm->SetUpdateTaskGroup(handle); RT_LOG(RT_LOG_INFO, "Success to begin update tasks, stream_id=%d.", stm->Id_()); return RT_ERROR_NONE; } -rtError_t Context::StreamEndTaskUpdate(Stream * const stm) const +rtError_t Context::StreamEndTaskUpdate(Stream* const stm) const { const std::lock_guard tskGrpLock(stm->GetTaskGrpMutex()); - COND_RETURN_AND_MSG_OUTER(stm->GetTaskGroupStatus() != StreamTaskGroupStatus::UPDATE, - RT_ERROR_STREAM_TASKGRP_STATUS, ErrorCode::EE1016, "Marking the end of the task to be updated", - "The stream is not in task update mode"); + COND_RETURN_AND_MSG_OUTER( + stm->GetTaskGroupStatus() != StreamTaskGroupStatus::UPDATE, RT_ERROR_STREAM_TASKGRP_STATUS, ErrorCode::EE1016, + "Marking the end of the task to be updated", "The stream is not in task update mode"); - TaskGroup *updateTaskGroup = stm->GetUpdateTaskGroup(); - NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC(updateTaskGroup, RT_ERROR_INVALID_VALUE, "Marking the end of the task to be updated"); + TaskGroup* updateTaskGroup = stm->GetUpdateTaskGroup(); + NULL_PTR_RETURN_MSG_OUTER_WITH_FUNC_DESC( + updateTaskGroup, RT_ERROR_INVALID_VALUE, "Marking the end of the task to be updated"); (void)stm->UpdateTaskGroupStatus(StreamTaskGroupStatus::NONE); const size_t taskIndex = updateTaskGroup->updateTaskIndex; - COND_PROC_RETURN_ERROR_MSG_INNER(taskIndex != updateTaskGroup->taskIds.size(), - RT_ERROR_STREAM_TASKGRP_UPDATE, stm->ResetUpdateTaskGroup();, - "Update tasks failed, stream_id=%d, total=%zu, success=%zu, failed=%zu.", - stm->Id_(), updateTaskGroup->taskIds.size(), taskIndex, (updateTaskGroup->taskIds.size() - taskIndex)); + COND_PROC_RETURN_ERROR_MSG_INNER( + taskIndex != updateTaskGroup->taskIds.size(), RT_ERROR_STREAM_TASKGRP_UPDATE, stm->ResetUpdateTaskGroup(); + , "Update tasks failed, stream_id=%d, total=%zu, success=%zu, failed=%zu.", stm->Id_(), + updateTaskGroup->taskIds.size(), taskIndex, (updateTaskGroup->taskIds.size() - taskIndex)); stm->ResetUpdateTaskGroup(); - RT_LOG(RT_LOG_INFO, "stream_id=%d update tasks result: total=%zu, success=%zu, remain=%zu", - stm->Id_(), updateTaskGroup->taskIds.size(), taskIndex, (updateTaskGroup->taskIds.size() - taskIndex)); + RT_LOG( + RT_LOG_INFO, "stream_id=%d update tasks result: total=%zu, success=%zu, remain=%zu", stm->Id_(), + updateTaskGroup->taskIds.size(), taskIndex, (updateTaskGroup->taskIds.size() - taskIndex)); return RT_ERROR_NONE; } -rtError_t Context::CreateSubCaptureModels(CondHandle *condHandle, rtCondTaskParams params, Stream * const stm) +rtError_t Context::CreateSubCaptureModels(CondHandle* condHandle, rtCondTaskParams params, Stream* const stm) { for (uint32_t loop = 0; loop < params.size; loop++) { - Model *subModel = nullptr; + Model* subModel = nullptr; rtError_t ret = ModelCreate(&subModel, RT_MODEL_CAPTURE_MODEL); if (ret != RT_ERROR_NONE) { - RT_LOG(RT_LOG_ERROR, "Capture model create failed, device_id=%u, original stream_id=%d, size=%u, retCode=%#x.", + RT_LOG( + RT_LOG_ERROR, "Capture model create failed, device_id=%u, original stream_id=%d, size=%u, retCode=%#x.", stm->Device_()->Id_(), stm->Id_(), params.size, ret); condHandle->SubModelDestroy(); (void)memset_s(params.modelRIArray, params.size * sizeof(rtModel_t), 0x0U, params.size * sizeof(rtModel_t)); @@ -848,55 +888,61 @@ rtError_t Context::CreateSubCaptureModels(CondHandle *condHandle, rtCondTaskPara models_.remove(subModel); // capture model资源回收不遍历子模型,context析构也不遍历子图,都靠父模型递归完成。 modelLock_.Unlock(); subModel->SetExeStream(stm->GetCaptureStream()); // 子模型的执行流是固定的 - CaptureModel *subCaptureModel = dynamic_cast(subModel); + CaptureModel* subCaptureModel = dynamic_cast(subModel); subCaptureModel->SetSubCaptureModelEnable(); subCaptureModel->SetCondHandle(params.handle); condHandle->PushBackSubModel(subModel); params.modelRIArray[loop] = static_cast(subModel); - RT_LOG(RT_LOG_DEBUG, "Sub capture model create success, device_id=%u, parent model_id=%u, sub model_id=%u" + RT_LOG( + RT_LOG_DEBUG, + "Sub capture model create success, device_id=%u, parent model_id=%u, sub model_id=%u" " original stream_id=%d, capture stream_id=%d, isSubmodel=%u, condition type=%u, condition size=%u.", - device_->Id_(), condHandle->GetParentModel()->Id_(), subModel->Id_(), stm->Id_(), stm->GetCaptureStream()->Id_(), - (dynamic_cast(condHandle->GetParentModel()))->IsSubCaptureModel(), - condHandle->GetCondType(), condHandle->GetCondSize()); + device_->Id_(), condHandle->GetParentModel()->Id_(), subModel->Id_(), stm->Id_(), + stm->GetCaptureStream()->Id_(), + (dynamic_cast(condHandle->GetParentModel()))->IsSubCaptureModel(), condHandle->GetCondType(), + condHandle->GetCondSize()); } return RT_ERROR_NONE; } -rtError_t Context::SubmitCaptureConditionTask(CondHandle *condHandle, Stream * const stm) +rtError_t Context::SubmitCaptureConditionTask(CondHandle* condHandle, Stream* const stm) { rtError_t error = RT_ERROR_NONE; - Device * const dev = stm->Device_(); - TaskInfo *tsk = nullptr; + Device* const dev = stm->Device_(); + TaskInfo* tsk = nullptr; TaskInfo submitTask = {}; - const uint32_t sqeNum = (condHandle->GetCondType() == RT_COND_TASK_TYPE_WHILE) ? COND_TASK_WHILE_SQE_NUM : COND_TASK_IF_SWITCH_SQE_NUM; + const uint32_t sqeNum = + (condHandle->GetCondType() == RT_COND_TASK_TYPE_WHILE) ? COND_TASK_WHILE_SQE_NUM : COND_TASK_IF_SWITCH_SQE_NUM; tsk = stm->AllocTask(&submitTask, TS_TASK_TYPE_CAPTURE_CONDITION, error, sqeNum); NULL_PTR_RETURN_MSG(tsk, error); - std::function const errRecycle = [&dev, &tsk]() { - (void)dev->GetTaskFactory()->Recycle(tsk); - }; + std::function const errRecycle = [&dev, &tsk]() { (void)dev->GetTaskFactory()->Recycle(tsk); }; ScopeGuard tskErrRecycle(errRecycle); error = cce::runtime::CaptureConditionTaskInit(tsk, condHandle); - ERROR_RETURN(error, "Capture condition task init failed, model_id=%u, stream_id=%d, task_id=%u, condtype=%d, condsize=%u, retCode=%#x.", + ERROR_RETURN( + error, + "Capture condition task init failed, model_id=%u, stream_id=%d, task_id=%u, condtype=%d, condsize=%u, " + "retCode=%#x.", stm->Model_()->Id_(), stm->Id_(), tsk->id, condHandle->GetCondType(), condHandle->GetCondSize(), error); error = dev->SubmitTask(tsk, taskGenCallback_); - ERROR_RETURN_MSG_INNER(error, "Failed to submit capture model condition task, retCode=%#x.", - static_cast(error)); + ERROR_RETURN_MSG_INNER( + error, "Failed to submit capture model condition task, retCode=%#x.", static_cast(error)); tskErrRecycle.ReleaseGuard(); error = PostProcCaptureConditionTask(condHandle, stm, tsk->id); - ERROR_RETURN_MSG_INNER(error, "Failed to post proc capture condition task, stream_id=%d, task_id=%u, retCode=%#x.", - stm->Id_(), tsk->id, static_cast(error)); + ERROR_RETURN_MSG_INNER( + error, "Failed to post proc capture condition task, stream_id=%d, task_id=%u, retCode=%#x.", stm->Id_(), + tsk->id, static_cast(error)); GET_THREAD_TASKID_AND_STREAMID(tsk, stm->AllocTaskStreamId()); condHandle->SetSubModelExeStream(tsk->stream); return RT_ERROR_NONE; } -rtError_t Context::StreamAddCondTask(CondHandle *condHandle, rtCondTaskParams params, Stream * const stm, uint32_t flags) +rtError_t Context::StreamAddCondTask(CondHandle* condHandle, rtCondTaskParams params, Stream* const stm, uint32_t flags) { UNUSED(flags); std::function const errSubModelRecycle = [&condHandle, ¶ms]() { @@ -906,22 +952,23 @@ rtError_t Context::StreamAddCondTask(CondHandle *condHandle, rtCondTaskParams pa ScopeGuard subModelErrRecycle(errSubModelRecycle); rtError_t error; - Notify *notify = condHandle->GetSubModelNotify(); + Notify* notify = condHandle->GetSubModelNotify(); if (notify == nullptr) { notify = new (std::nothrow) Notify(device_->Id_(), device_->DevGetTsId()); - COND_RETURN_AND_MSG_OUTER(notify == nullptr, RT_ERROR_NOTIFY_NEW, ErrorCode::EE1013, std::to_string(sizeof(Notify)).c_str(), "new"); + COND_RETURN_AND_MSG_OUTER( + notify == nullptr, RT_ERROR_NOTIFY_NEW, ErrorCode::EE1013, std::to_string(sizeof(Notify)).c_str(), "new"); error = notify->SetupWithoutAllocNtyId(); COND_PROC_RETURN_WARN(error != RT_ERROR_NONE, error, DELETE_O(notify), "Notify setup, retCode=%#x", error); } condHandle->SetSubModelNotify(notify); - auto &subModels = condHandle->GetSubCaptureModels(); - Model *firstSubModel = subModels.empty() ? nullptr : subModels[0]; + auto& subModels = condHandle->GetSubCaptureModels(); + Model* firstSubModel = subModels.empty() ? nullptr : subModels[0]; notify->SetEndGraphModel(firstSubModel); error = SubmitCaptureConditionTask(condHandle, stm); - ERROR_RETURN_MSG_INNER(error, "Failed to submit capture condition task, retCode=%#x.", - static_cast(error)); + ERROR_RETURN_MSG_INNER( + error, "Failed to submit capture condition task, retCode=%#x.", static_cast(error)); subModelErrRecycle.ReleaseGuard(); return RT_ERROR_NONE; diff --git a/src/runtime/feature/aclgraph/v100/capture_adapt_v100.cc b/src/runtime/feature/aclgraph/v100/capture_adapt_v100.cc index 8ba92ae..8c11992 100644 --- a/src/runtime/feature/aclgraph/v100/capture_adapt_v100.cc +++ b/src/runtime/feature/aclgraph/v100/capture_adapt_v100.cc @@ -19,11 +19,7 @@ namespace runtime { bool StreamFlagIsSupportCapture(uint32_t flag) { static constexpr uint32_t flags[]{ - RT_STREAM_AICPU, - RT_STREAM_FORBIDDEN_DEFAULT, - RT_STREAM_CP_PROCESS_USE, - RT_STREAM_VECTOR_CORE_USE - }; + RT_STREAM_AICPU, RT_STREAM_FORBIDDEN_DEFAULT, RT_STREAM_CP_PROCESS_USE, RT_STREAM_VECTOR_CORE_USE}; for (const uint32_t elem : flags) { if ((flag & elem) == elem) { @@ -34,23 +30,22 @@ bool StreamFlagIsSupportCapture(uint32_t flag) return true; } -uint32_t GetCaptureStreamFlag() -{ - return RT_STREAM_DEFAULT; -} +uint32_t GetCaptureStreamFlag() { return RT_STREAM_DEFAULT; } -rtError_t GetCaptureEventFromTask(const Device * const dev, uint32_t streamId, uint32_t pos, Event *&eventPtr, CaptureCntNotify &cntInfo) +rtError_t GetCaptureEventFromTask( + const Device* const dev, uint32_t streamId, uint32_t pos, Event*& eventPtr, CaptureCntNotify& cntInfo) { UNUSED(cntInfo); if (dev != nullptr) { - const TaskInfo * const task = dev->GetTaskFactory()->GetTask(static_cast(streamId), static_cast(pos)); - COND_RETURN_ERROR((task == nullptr), - RT_ERROR_TASK_NULL, - "Get task failed, stream_id=%u, task_id=%u.", streamId, pos); - COND_RETURN_AND_MSG_OUTER(!((task->type == TS_TASK_TYPE_EVENT_RECORD) || (task->type == TS_TASK_TYPE_CAPTURE_RECORD)), - RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, - "Capture model validity check", "capture model", - RtFmtMsg("In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " + const TaskInfo* const task = + dev->GetTaskFactory()->GetTask(static_cast(streamId), static_cast(pos)); + COND_RETURN_ERROR( + (task == nullptr), RT_ERROR_TASK_NULL, "Get task failed, stream_id=%u, task_id=%u.", streamId, pos); + COND_RETURN_AND_MSG_OUTER( + !((task->type == TS_TASK_TYPE_EVENT_RECORD) || (task->type == TS_TASK_TYPE_CAPTURE_RECORD)), + RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, "Capture model validity check", "capture model", + RtFmtMsg( + "In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " "(stream_id=%u) is not an event record task. Call aclrtRecordEvent on the sub stream to " "deliver an event record task", pos, streamId)); @@ -64,27 +59,23 @@ rtError_t GetCaptureEventFromTask(const Device * const dev, uint32_t streamId, u return RT_ERROR_DEVICE_NULL; } -rtError_t ResetCaptureEventsProc(const CaptureModel * const captureModel, Stream * const stm) +rtError_t ResetCaptureEventsProc(const CaptureModel* const captureModel, Stream* const stm) { - for (Event * const evt : captureModel->GetCaptureEvent()) { - COND_RETURN_ERROR_MSG_INNER((!(evt->HasRecord())), - RT_ERROR_CAPTURE_DEPENDENCY, - "The capture event has not been recorded, stream_id=%d, event_id=%d.", - stm->Id_(), evt->EventId_()); + for (Event* const evt : captureModel->GetCaptureEvent()) { + COND_RETURN_ERROR_MSG_INNER( + (!(evt->HasRecord())), RT_ERROR_CAPTURE_DEPENDENCY, + "The capture event has not been recorded, stream_id=%d, event_id=%d.", stm->Id_(), evt->EventId_()); const rtError_t error = evt->Reset(stm); - COND_RETURN_ERROR((error != RT_ERROR_NONE), error, - "Capture stream reset event failed, stream_id=%d, error=%d.", - stm->Id_(), error); + COND_RETURN_ERROR( + (error != RT_ERROR_NONE), error, "Capture stream reset event failed, stream_id=%d, error=%d.", stm->Id_(), + error); } return RT_ERROR_NONE; } -rtError_t SendNopTask(const Context * const curCtx, Stream * const stm) -{ - return curCtx->NopTask(stm); -} +rtError_t SendNopTask(const Context* const curCtx, Stream* const stm) { return curCtx->NopTask(stm); } -bool TaskTypeIsSupportTaskGroup(const TaskInfo * const task) +bool TaskTypeIsSupportTaskGroup(const TaskInfo* const task) { return ((task->type == TS_TASK_TYPE_KERNEL_AICORE) || (task->type == TS_TASK_TYPE_KERNEL_AIVEC)); } diff --git a/src/runtime/feature/aclgraph/v200/capture_adapt_v200.cc b/src/runtime/feature/aclgraph/v200/capture_adapt_v200.cc index 4f90ccd..7bbc979 100644 --- a/src/runtime/feature/aclgraph/v200/capture_adapt_v200.cc +++ b/src/runtime/feature/aclgraph/v200/capture_adapt_v200.cc @@ -22,8 +22,8 @@ namespace runtime { bool StreamFlagIsSupportCapture(uint32_t flag) { - static constexpr uint32_t flags = RT_STREAM_AICPU | RT_STREAM_FORBIDDEN_DEFAULT | RT_STREAM_CP_PROCESS_USE - | RT_STREAM_VECTOR_CORE_USE | RT_STREAM_PERSISTENT | RT_STREAM_ACSQ_LOCK; + static constexpr uint32_t flags = RT_STREAM_AICPU | RT_STREAM_FORBIDDEN_DEFAULT | RT_STREAM_CP_PROCESS_USE | + RT_STREAM_VECTOR_CORE_USE | RT_STREAM_PERSISTENT | RT_STREAM_ACSQ_LOCK; if ((flag & flags) != 0U) { return false; @@ -31,24 +31,23 @@ bool StreamFlagIsSupportCapture(uint32_t flag) return true; } -uint32_t GetCaptureStreamFlag() -{ - return RT_STREAM_PERSISTENT; -} +uint32_t GetCaptureStreamFlag() { return RT_STREAM_PERSISTENT; } -rtError_t GetCaptureEventFromTask(const Device * const dev, uint32_t streamId, uint32_t pos, Event *&eventPtr, CaptureCntNotify &cntInfo) +rtError_t GetCaptureEventFromTask( + const Device* const dev, uint32_t streamId, uint32_t pos, Event*& eventPtr, CaptureCntNotify& cntInfo) { UNUSED(cntInfo); - COND_RETURN_ERROR((dev == nullptr), RT_ERROR_DEVICE_NULL, + COND_RETURN_ERROR( + (dev == nullptr), RT_ERROR_DEVICE_NULL, "Failed to get capture event from task, device is null, stream_id=%u, task_id=%u.", streamId, pos); - TaskInfo *taskInfo = GetTaskInfo(dev, streamId, pos); - COND_RETURN_ERROR((taskInfo == nullptr), - RT_ERROR_TASK_NULL, - "Failed to get task, stream_id=%u, task_id=%u.", streamId, pos); - COND_RETURN_AND_MSG_OUTER(!((taskInfo->type == TS_TASK_TYPE_DAVID_EVENT_RECORD) || (taskInfo->type ==TS_TASK_TYPE_CAPTURE_RECORD)), - RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, - "Capture model validity check", "capture model", - RtFmtMsg("In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " + TaskInfo* taskInfo = GetTaskInfo(dev, streamId, pos); + COND_RETURN_ERROR( + (taskInfo == nullptr), RT_ERROR_TASK_NULL, "Failed to get task, stream_id=%u, task_id=%u.", streamId, pos); + COND_RETURN_AND_MSG_OUTER( + !((taskInfo->type == TS_TASK_TYPE_DAVID_EVENT_RECORD) || (taskInfo->type == TS_TASK_TYPE_CAPTURE_RECORD)), + RT_ERROR_STREAM_UNJOINED, ErrorCode::EE1017, "Capture model validity check", "capture model", + RtFmtMsg( + "In the cross-stream capture scenario, the last task (task_id=%u) on the sub stream " "(stream_id=%u) is not an event record task. Call aclrtRecordEvent on the sub stream to " "deliver an event record task", pos, streamId)); @@ -60,35 +59,36 @@ rtError_t GetCaptureEventFromTask(const Device * const dev, uint32_t streamId, u return RT_ERROR_NONE; } -rtError_t ResetCaptureEventsProc(const CaptureModel * const captureModel, Stream * const stm) +rtError_t ResetCaptureEventsProc(const CaptureModel* const captureModel, Stream* const stm) { rtError_t error; - for (Event * const evt : captureModel->GetCaptureEvent()) { - COND_RETURN_ERROR((!(evt->HasRecord())), - RT_ERROR_CAPTURE_DEPENDENCY, + for (Event* const evt : captureModel->GetCaptureEvent()) { + COND_RETURN_ERROR( + (!(evt->HasRecord())), RT_ERROR_CAPTURE_DEPENDENCY, "Failed to reset capture events, the capture event has not been recorded, stream_id=%d, event_id=%d.", stm->Id_(), evt->EventId_()); if (evt->IsHardwareMode()) { - error = EvtReset(evt, stm); - } else { - error = EvtResetSoftwareMode(evt, stm); + error = EvtReset(evt, stm); + } else { + error = EvtResetSoftwareMode(evt, stm); } - COND_RETURN_ERROR((error != RT_ERROR_NONE), error, "Failed to reset capture event, stream_id=%d, retCode=%#x.", - stm->Id_(), static_cast(error)); + COND_RETURN_ERROR( + (error != RT_ERROR_NONE), error, "Failed to reset capture event, stream_id=%d, retCode=%#x.", stm->Id_(), + static_cast(error)); } return RT_ERROR_NONE; } -rtError_t SendNopTask(const Context * const curCtx, Stream * const stm) +rtError_t SendNopTask(const Context* const curCtx, Stream* const stm) { UNUSED(curCtx); return StreamNopTask(stm); } -bool TaskTypeIsSupportTaskGroup(const TaskInfo * const task) +bool TaskTypeIsSupportTaskGroup(const TaskInfo* const task) { if ((task->type == TS_TASK_TYPE_KERNEL_AICORE) || (task->type == TS_TASK_TYPE_KERNEL_AIVEC)) { return true; @@ -96,11 +96,14 @@ bool TaskTypeIsSupportTaskGroup(const TaskInfo * const task) /* 如果Fusion子任务不包括aic/aiv任务,不支持 */ if (task->type == TS_TASK_TYPE_FUSION_KERNEL) { - const FusionTaskInfo * const fusionTaskInfo = &(task->u.fusionKernelTask); + const FusionTaskInfo* const fusionTaskInfo = &(task->u.fusionKernelTask); if ((fusionTaskInfo->sqeSubType & (1U << RT_FUSION_AIC_BIT_MOVE)) != 0U) { return true; } - RT_LOG(RT_LOG_ERROR, "Failed to check task type for task group, fusion subtask does not include the aicore task, sqeSubType=0x%x.", + RT_LOG( + RT_LOG_ERROR, + "Failed to check task type for task group, fusion subtask does not include the aicore task, " + "sqeSubType=0x%x.", fusionTaskInfo->sqeSubType); return false; }