@@ -45,41 +45,47 @@ def : Handle {
4545}
4646
4747def : Enum {
48- let name = "offload_result_t ";
48+ let name = "offload_errc_t ";
4949 let desc = "Defines Return/Error codes";
5050 let etors =[
5151 Etor<"SUCCESS", "Success">,
52- Etor<"ERROR_INVALID_VALUE ", "Invalid Value">,
53- Etor<"ERROR_INVALID_PLATFORM ", "Invalid platform">,
54- Etor<"ERROR_DEVICE_NOT_FOUND ", "Device not found">,
55- Etor<"ERROR_INVALID_DEVICE ", "Invalid device">,
56- Etor<"ERROR_DEVICE_LOST ", "Device hung, reset, was removed, or driver update occurred">,
57- Etor<"ERROR_UNINITIALIZED ", "plugin is not initialized or specific entry-point is not implemented">,
58- Etor<"ERROR_OUT_OF_RESOURCES ", "Out of resources">,
59- Etor<"ERROR_UNSUPPORTED_VERSION ", "generic error code for unsupported versions">,
60- Etor<"ERROR_UNSUPPORTED_FEATURE ", "generic error code for unsupported features">,
61- Etor<"ERROR_INVALID_ARGUMENT ", "generic error code for invalid arguments">,
62- Etor<"ERROR_INVALID_NULL_HANDLE ", "handle argument is not valid">,
63- Etor<"ERROR_INVALID_NULL_POINTER ", "pointer argument may not be nullptr">,
64- Etor<"ERROR_INVALID_SIZE ", "invalid size or dimensions (e.g., must not be zero, or is out of bounds)">,
65- Etor<"ERROR_INVALID_ENUMERATION ", "enumerator argument is not valid">,
66- Etor<"ERROR_UNSUPPORTED_ENUMERATION ", "enumerator argument is not supported by the device">,
67- Etor<"ERROR_UNKNOWN ", "Unknown or internal error">
52+ Etor<"INVALID_VALUE ", "Invalid Value">,
53+ Etor<"INVALID_PLATFORM ", "Invalid platform">,
54+ Etor<"DEVICE_NOT_FOUND ", "Device not found">,
55+ Etor<"INVALID_DEVICE ", "Invalid device">,
56+ Etor<"DEVICE_LOST ", "Device hung, reset, was removed, or driver update occurred">,
57+ Etor<"UNINITIALIZED ", "plugin is not initialized or specific entry-point is not implemented">,
58+ Etor<"OUT_OF_RESOURCES ", "Out of resources">,
59+ Etor<"UNSUPPORTED_VERSION ", "generic error code for unsupported versions">,
60+ Etor<"UNSUPPORTED_FEATURE ", "generic error code for unsupported features">,
61+ Etor<"INVALID_ARGUMENT ", "generic error code for invalid arguments">,
62+ Etor<"INVALID_NULL_HANDLE ", "handle argument is not valid">,
63+ Etor<"INVALID_NULL_POINTER ", "pointer argument may not be nullptr">,
64+ Etor<"INVALID_SIZE ", "invalid size or dimensions (e.g., must not be zero, or is out of bounds)">,
65+ Etor<"INVALID_ENUMERATION ", "enumerator argument is not valid">,
66+ Etor<"UNSUPPORTED_ENUMERATION ", "enumerator argument is not supported by the device">,
67+ Etor<"UNKNOWN ", "Unknown or internal error">
6868 ];
6969}
7070
71- def : Function {
72- let name = "offloadGetErrorDetails";
73- let desc = "Get a detailed error message for the last error that occurred on this thread, if it exists";
74- let details = [
75- "When an Offload API call returns a return value other than OFFLOAD_RESULT_SUCCESS, the implementation *may* set an additional error message.",
76- "If a further Offload call (excluding this function) is made on the same thread without checking "
77- "its detailed error message with this function, that message should be considered lost.",
78- "The returned char* is only valid until the next Offload function call on the same thread (excluding further calls to this function.)"
79- ];
80- let params = [
81- Param<"size_t*", "SizeRet", "Pointer to return the size of the available error message. A size of 0 indicates no message.", PARAM_OUT_OPTIONAL>,
82- Param<"const char**", "DetailStringRet", "Pointer to return the error message string.", PARAM_OUT_OPTIONAL>
71+ def : Struct {
72+ let name = "offload_error_struct_t";
73+ let desc = "Details of the error condition returned by an API call";
74+ let members = [
75+ StructMember<"offload_errc_t", "code", "The error code">,
76+ StructMember<"const char*", "details", "String containing error details">
8377 ];
84- let returns = []; // Only SUCCESS is expected
78+ }
79+
80+ def : Typedef {
81+ let name = "offload_result_t";
82+ let desc = "Result type returned by all entry points.";
83+ let value = "const offload_error_struct_t*";
84+ }
85+
86+ def : Macro {
87+ let name = "OFFLOAD_SUCCESS";
88+ let condition = "!defined(OFFLOAD_SUCCESS)";
89+ let desc = "Success condition";
90+ let value = "NULL";
8591}
0 commit comments