OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
L0Exception.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
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 
17 #include "L0Exception.h"
18 
19 #include <level_zero/ze_api.h>
20 
21 namespace l0 {
22 L0Exception::L0Exception(L0result status) : status_(status) {}
23 
24 const char* L0Exception::what() const noexcept {
25  switch (status_) {
26  case ZE_RESULT_NOT_READY:
27  return "L0 error: synchronization primitive not signaled";
28  case ZE_RESULT_ERROR_DEVICE_LOST:
29  return "L0 error: device hung, reset, was removed, or driver update occurred";
30  case ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY:
31  return "L0 error: insufficient host memory to satisfy call";
32  case ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY:
33  return "L0 error: insufficient device memory to satisfy call";
34  case ZE_RESULT_ERROR_MODULE_BUILD_FAILURE:
35  return "L0 error: error occurred when building module, see build log for details";
36  case ZE_RESULT_ERROR_MODULE_LINK_FAILURE:
37  return "L0 error: error occurred when linking modules, see build log for details";
38  case ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS:
39  return "L0 error: access denied due to permission level";
40  case ZE_RESULT_ERROR_NOT_AVAILABLE:
41  return "L0 error: resource already in use and simultaneous access not allowed or "
42  "resource was removed";
43  case ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE:
44  return "L0 error: external required dependency is unavailable or missing";
45  case ZE_RESULT_ERROR_UNINITIALIZED:
46  return "L0 error: driver is not initialized";
47  case ZE_RESULT_ERROR_UNSUPPORTED_VERSION:
48  return "L0 error: generic error code for unsupported versions";
49  case ZE_RESULT_ERROR_UNSUPPORTED_FEATURE:
50  return "L0 error: generic error code for unsupported features";
51  case ZE_RESULT_ERROR_INVALID_ARGUMENT:
52  return "L0 error: generic error code for invalid arguments";
53  case ZE_RESULT_ERROR_INVALID_NULL_HANDLE:
54  return "L0 error: handle argument is not valid";
55  case ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE:
56  return "L0 error: object pointed to by handle still in-use by device";
57  case ZE_RESULT_ERROR_INVALID_NULL_POINTER:
58  return "L0 error: pointer argument may not be nullptr";
59  case ZE_RESULT_ERROR_INVALID_SIZE:
60  return "L0 error: size argument is invalid (e.g., must not be zero)";
61  case ZE_RESULT_ERROR_UNSUPPORTED_SIZE:
62  return "L0 error: size argument is not supported by the device (e.g., too large)";
63  case ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT:
64  return "L0 error: alignment argument is not supported by the device";
65  case ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT:
66  return "L0 error: synchronization object in invalid state";
67  case ZE_RESULT_ERROR_INVALID_ENUMERATION:
68  return "L0 error: enumerator argument is not valid";
69  case ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION:
70  return "L0 error: enumerator argument is not supported by the device";
71  case ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT:
72  return "L0 error: image format is not supported by the device";
73  case ZE_RESULT_ERROR_INVALID_NATIVE_BINARY:
74  return "L0 error: native binary is not supported by the device";
75  case ZE_RESULT_ERROR_INVALID_GLOBAL_NAME:
76  return "L0 error: global variable is not found in the module";
77  case ZE_RESULT_ERROR_INVALID_KERNEL_NAME:
78  return "L0 error: kernel name is not found in the module";
79  case ZE_RESULT_ERROR_INVALID_FUNCTION_NAME:
80  return "L0 error: function name is not found in the module";
81  case ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
82  return "L0 error: group size dimension is not valid for the kernel or device";
83  case ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:
84  return "L0 error: global width dimension is not valid for the kernel or device";
85  case ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX:
86  return "L0 error: kernel argument index is not valid for kernel";
87  case ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE:
88  return "L0 error: kernel argument size does not match kernel";
89  case ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE:
90  return "L0 error: value of kernel attribute is not valid for the kernel or device";
91  case ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED:
92  return "L0 error: module with imports needs to be linked before kernels can be "
93  "created from it";
94  case ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE:
95  return "L0 error: command list type does not match command queue type";
96  case ZE_RESULT_ERROR_OVERLAPPING_REGIONS:
97  return "L0 error: copy operations do not support overlapping regions of memory";
98  case ZE_RESULT_ERROR_UNKNOWN:
99  return "L0 error: unknown or internal error";
100  default:
101  return "L0 unexpected error code";
102  }
103 }
104 } // namespace l0
int L0result
Definition: L0Exception.h:21
L0result const status_
Definition: L0Exception.h:30
L0Exception(L0result status)
Definition: L0Exception.cpp:22
const char * what() const noexceptoverride
Definition: L0Exception.cpp:24