Open Deep Learning API
Loading...
Searching...
No Matches
odla_common.h
Go to the documentation of this file.
1//===- odla_common.h ------------------------------------------------------===//
2//
3// Copyright (C) 2019-2020 Alibaba Group Holding Limited.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16// =============================================================================
17
18#ifndef _ODLA_COMMON_H_
19#define _ODLA_COMMON_H_
20
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#if (defined(_WIN32) && defined(_MSC_VER))
30// Integer types
31typedef signed __int8 odla_int8;
32typedef signed __int16 odla_int16;
33typedef signed __int32 odla_int32;
34typedef signed __int64 odla_int64;
35typedef unsigned __int8 odla_uint8;
36typedef unsigned __int16 odla_uint16;
37typedef unsigned __int32 odla_uint32;
38typedef unsigned __int64 odla_uint64;
40// brief Quantized integer types
41typedef signed __int8 odla_qint8;
42typedef signed __int16 odla_qint16;
43typedef signed __int32 odla_qint32;
44typedef signed __int64 odla_qint64;
45typedef unsigned __int8
47typedef unsigned __int16
49typedef unsigned __int32
51typedef unsigned __int64
54// Floating point types
55typedef unsigned __int16 odla_float16;
56typedef unsigned __int16 odla_bfloat16;
57typedef float odla_float32;
58typedef double odla_float64;
59typedef const char* odla_string;
61#else
62
63// Integer types
64typedef __INT8_TYPE__ odla_int8;
65typedef __INT16_TYPE__ odla_int16;
66typedef __INT32_TYPE__ odla_int32;
67typedef __INT64_TYPE__ odla_int64;
68typedef __UINT8_TYPE__ odla_uint8;
69typedef __UINT16_TYPE__ odla_uint16;
70typedef __UINT32_TYPE__ odla_uint32;
71typedef __UINT64_TYPE__ odla_uint64;
73// Quantized integer types
74typedef __INT8_TYPE__ odla_qint8;
75typedef __INT16_TYPE__ odla_qint16;
76typedef __INT32_TYPE__ odla_qint32;
77typedef __INT64_TYPE__ odla_qint64;
78typedef __UINT8_TYPE__
80typedef __UINT16_TYPE__
82typedef __UINT32_TYPE__
84typedef __UINT64_TYPE__
87// Floating point types
88typedef __UINT16_TYPE__ odla_float16;
89typedef __UINT16_TYPE__ odla_bfloat16;
90typedef float odla_float32;
91typedef double odla_float64;
92typedef const char* odla_string;
93#endif
94
95#ifndef NULL
96#define NULL ((void*)0)
97#endif
98
102typedef enum {
103 ODLA_INT8,
104 ODLA_INT16,
105 ODLA_INT32,
106 ODLA_INT64,
107 ODLA_UINT8,
108 ODLA_UINT16,
109 ODLA_UINT32,
110 ODLA_UINT64,
111
112 ODLA_QINT8,
113 ODLA_QINT16,
114 ODLA_QINT32,
115 ODLA_QINT64,
116 ODLA_QUINT8,
117 ODLA_QUINT16,
118 ODLA_QUINT32,
119 ODLA_QUINT64,
120
121 ODLA_FLOAT16,
122 ODLA_BFLOAT16,
123 ODLA_FLOAT32,
124 ODLA_FLOAT64,
125
126 ODLA_BOOL,
127 ODLA_STRING,
128} odla_element_type;
129
131typedef char odla_char;
132
134typedef __SIZE_TYPE__ odla_size_t;
135
137typedef void odla_void;
138
140typedef enum {
141 ODLA_SUCCESS,
144 ODLA_FILE_NOT_EXIST,
149 ODLA_UNSUPPORTED_DATATYPE,
150 ODLA_UNSUPPORTED_DEVICE_TYPE,
161 ODLA_FULL_RESET,
164 ODLA_FAILURE,
166
168#if defined(_WIN32)
169#define ODLA_API_EXPORT __declspec(dllexport)
170#define ODLA_API_CALL __stdcall
171#else
172#define ODLA_API_EXPORT
173#define ODLA_API_CALL
174#endif
175
176#ifdef __cplusplus
177} // C extern
178#endif
179
180#endif // _ODLA_COMMON_H_
__UINT64_TYPE__ odla_quint64
Definition: odla_common.h:85
__UINT16_TYPE__ odla_uint16
Definition: odla_common.h:69
__INT32_TYPE__ odla_int32
Definition: odla_common.h:66
__INT32_TYPE__ odla_qint32
Definition: odla_common.h:76
__UINT16_TYPE__ odla_quint16
Definition: odla_common.h:81
odla_status
Return status.
Definition: odla_common.h:140
@ ODLA_INTERNAL_LOGIC_ERR
internal error
Definition: odla_common.h:156
@ ODLA_TIMEOUT
process timeout
Definition: odla_common.h:154
@ ODLA_MEM_ERROR
allocate/deallocate memory error, out of memory error
Definition: odla_common.h:148
@ ODLA_PARTITION_RESET
manual recoverable error, include partition reset and full reset type
Definition: odla_common.h:160
@ ODLA_INVALID_PARAM
illegal input argument, such as nullptr
Definition: odla_common.h:146
@ ODLA_DL_ERROR
dlopen a shared library error
Definition: odla_common.h:143
@ ODLA_RECOVERABLE_ERR
auto recoverable error
Definition: odla_common.h:158
@ ODLA_UNRECOVERABLE_ERR
unrecoverable error
Definition: odla_common.h:163
@ ODLA_UNSUPPORTED_OP
odla op is not implemented yet
Definition: odla_common.h:152
__UINT8_TYPE__ odla_quint8
Definition: odla_common.h:79
__INT64_TYPE__ odla_int64
Definition: odla_common.h:67
__UINT16_TYPE__ odla_float16
Definition: odla_common.h:88
__UINT32_TYPE__ odla_uint32
Definition: odla_common.h:70
__INT16_TYPE__ odla_int16
Definition: odla_common.h:65
char odla_char
char
Definition: odla_common.h:131
__UINT8_TYPE__ odla_uint8
Definition: odla_common.h:68
odla_uint32 odla_bool
Definition: odla_common.h:99
double odla_float64
Definition: odla_common.h:91
__INT16_TYPE__ odla_qint16
Definition: odla_common.h:75
__INT8_TYPE__ odla_qint8
Definition: odla_common.h:74
__INT8_TYPE__ odla_int8
Definition: odla_common.h:64
const char * odla_string
Definition: odla_common.h:92
__UINT16_TYPE__ odla_bfloat16
Definition: odla_common.h:89
__UINT32_TYPE__ odla_quint32
Definition: odla_common.h:83
__SIZE_TYPE__ odla_size_t
size_t
Definition: odla_common.h:134
void odla_void
void
Definition: odla_common.h:137
__INT64_TYPE__ odla_qint64
Definition: odla_common.h:77
float odla_float32
Definition: odla_common.h:90
__UINT64_TYPE__ odla_uint64
Definition: odla_common.h:71