xref: /aosp_15_r20/external/executorch/backends/xnnpack/runtime/XNNStatus.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <assert.h>
12 #include <xnnpack.h>
13 
14 namespace executorch {
15 namespace backends {
16 namespace xnnpack {
17 namespace delegate {
18 
19 constexpr const uint16_t kOffset[] = {0, 19, 44, 73, 98, 131, 163};
20 
21 constexpr const char* kData =
22     "xnn_status_success\0"
23     "xnn_status_uninitialized\0"
24     "xnn_status_invalid_parameter\0"
25     "xnn_status_invalid_state\0"
26     "xnn_status_unsupported_parameter\0"
27     "xnn_status_unsupported_hardware\0"
28     "xnn_status_out_of_memory\0";
29 
xnn_status_to_string(enum xnn_status type)30 inline const char* xnn_status_to_string(enum xnn_status type) {
31   assert(type <= xnn_status_out_of_memory);
32   return &kData[kOffset[type]];
33 }
34 
35 } // namespace delegate
36 } // namespace xnnpack
37 } // namespace backends
38 } // namespace executorch
39