1 /**
2 * Copyright 2021 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "utils/runtime_error_codes.h"
17 #include <map>
18 #include <vector>
19 #include "graphengine/inc/external/runtime/rt_error_codes.h"
20
21 const std::map<uint32_t, std::string> error_msg = {
22 {ACL_RT_SUCCESS, "success"},
23 {ACL_ERROR_RT_PARAM_INVALID, "param invalid"},
24 {ACL_ERROR_RT_INVALID_DEVICEID, "invalid device id"},
25 {ACL_ERROR_RT_CONTEXT_NULL, "current context null"},
26 {ACL_ERROR_RT_STREAM_CONTEXT, "stream not in current context"},
27 {ACL_ERROR_RT_MODEL_CONTEXT, "model not in current context"},
28 {ACL_ERROR_RT_STREAM_MODEL, "stream not in model"},
29 {ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID, "event timestamp invalid"},
30 {ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL, " event timestamp reversal"},
31 {ACL_ERROR_RT_ADDR_UNALIGNED, "memory address unaligned"},
32 {ACL_ERROR_RT_FILE_OPEN, "open file failed"},
33 {ACL_ERROR_RT_FILE_WRITE, "write file failed"},
34 {ACL_ERROR_RT_STREAM_SUBSCRIBE, "error subscribe stream"},
35 {ACL_ERROR_RT_THREAD_SUBSCRIBE, "error subscribe thread"},
36 {ACL_ERROR_RT_GROUP_NOT_SET, "group not set"},
37 {ACL_ERROR_RT_GROUP_NOT_CREATE, "group not create"},
38 {ACL_ERROR_RT_STREAM_NO_CB_REG, "callback not register to stream"},
39 {ACL_ERROR_RT_INVALID_MEMORY_TYPE, "invalid memory type"},
40 {ACL_ERROR_RT_INVALID_HANDLE, "invalid handle"},
41 {ACL_ERROR_RT_INVALID_MALLOC_TYPE, "invalid malloc type"},
42 {ACL_ERROR_RT_FEATURE_NOT_SUPPORT, "feature not support"},
43 {ACL_ERROR_RT_MEMORY_ALLOCATION, "memory allocation error"},
44 {ACL_ERROR_RT_MEMORY_FREE, "memory free error"},
45 {ACL_ERROR_RT_AICORE_OVER_FLOW, "aicore over flow"},
46 {ACL_ERROR_RT_NO_DEVICE, "no device"},
47 {ACL_ERROR_RT_RESOURCE_ALLOC_FAIL, "resource alloc fail"},
48 {ACL_ERROR_RT_NO_PERMISSION, "no permission"},
49 {ACL_ERROR_RT_NO_EVENT_RESOURCE, "no event resource"},
50 {ACL_ERROR_RT_NO_STREAM_RESOURCE, "no stream resource"},
51 {ACL_ERROR_RT_NO_NOTIFY_RESOURCE, "no notify resource"},
52 {ACL_ERROR_RT_NO_MODEL_RESOURCE, "no model resource"},
53 {ACL_ERROR_RT_INTERNAL_ERROR, "runtime internal error"},
54 {ACL_ERROR_RT_TS_ERROR, "ts internal error"},
55 {ACL_ERROR_RT_STREAM_TASK_FULL, "task full in stream"},
56 {ACL_ERROR_RT_STREAM_TASK_EMPTY, " task empty in stream"},
57 {ACL_ERROR_RT_STREAM_NOT_COMPLETE, "stream not complete"},
58 {ACL_ERROR_RT_END_OF_SEQUENCE, "end of sequence"},
59 {ACL_ERROR_RT_EVENT_NOT_COMPLETE, "event not complete"},
60 {ACL_ERROR_RT_CONTEXT_RELEASE_ERROR, "context release error"},
61 {ACL_ERROR_RT_SOC_VERSION, "soc version error"},
62 {ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT, "task type not support"},
63 {ACL_ERROR_RT_LOST_HEARTBEAT, "ts lost heartbeat"},
64 {ACL_ERROR_RT_MODEL_EXECUTE, " model execute failed"},
65 {ACL_ERROR_RT_REPORT_TIMEOUT, "report timeout"},
66 {ACL_ERROR_RT_SYS_DMA, "sys dma error"},
67 {ACL_ERROR_RT_AICORE_TIMEOUT, "aicore timeout"},
68 {ACL_ERROR_RT_AICORE_EXCEPTION, "aicore exception"},
69 {ACL_ERROR_RT_AICORE_TRAP_EXCEPTION, " aicore trap exception"},
70 {ACL_ERROR_RT_AICPU_TIMEOUT, " aicpu timeout"},
71 {ACL_ERROR_RT_AICPU_EXCEPTION, "aicpu exception"},
72 {ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR, " aicpu datadump response error"},
73 {ACL_ERROR_RT_AICPU_MODEL_RSP_ERR, "aicpu model operate response error"},
74 {ACL_ERROR_RT_PROFILING_ERROR, "profiling error"},
75 {ACL_ERROR_RT_IPC_ERROR, "ipc error"},
76 {ACL_ERROR_RT_MODEL_ABORT_NORMAL, "model abort normal"},
77 {ACL_ERROR_RT_KERNEL_UNREGISTERING, "kernel unregistering"},
78 {ACL_ERROR_RT_RINGBUFFER_NOT_INIT, "ringbuffer not init"},
79 {ACL_ERROR_RT_RINGBUFFER_NO_DATA, "ringbuffer no data"},
80 {ACL_ERROR_RT_KERNEL_LOOKUP, "kernel lookup error"},
81 {ACL_ERROR_RT_KERNEL_DUPLICATE, "kernel register duplicate"},
82 {ACL_ERROR_RT_DEBUG_REGISTER_FAIL, "debug register failed"},
83 {ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL, "debug unregister failed"},
84 {ACL_ERROR_RT_LABEL_CONTEXT, "label not in current context"},
85 {ACL_ERROR_RT_PROGRAM_USE_OUT, "program register num use out"},
86 {ACL_ERROR_RT_DEV_SETUP_ERROR, "device setup error"},
87 {ACL_ERROR_RT_DRV_INTERNAL_ERROR, "drv internal error"},
88 };
89
90 namespace mindspore {
GetErrorMsg(uint32_t rt_error_code)91 std::string GetErrorMsg(uint32_t rt_error_code) {
92 auto find_iter = error_msg.find(rt_error_code);
93 if (find_iter == error_msg.end()) {
94 return "Return error code unknown, ret code: " + std::to_string(rt_error_code);
95 }
96 return find_iter->second;
97 }
98 } // namespace mindspore
99