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