23 #ifndef COMMON_MATHLIB_TYPES_H_ 24 #define COMMON_MATHLIB_TYPES_H_ 1 28 #ifndef __OPENCL_VERSION__ 41 #include "c71/MATHLIB_defines.h" 43 #include "c7100/MATHLIB_defines.h" 44 #include "c7100/MATHLIB_types.h" 49 #if !defined(MATHLIB_DEBUGPRINT) 50 #define MATHLIB_DEBUGPRINT 0 53 #if (defined(_HOST_BUILD) && (MATHLIB_COMPILER_VERSION < 1003999)) 56 #define MATHLIB_const const 59 #define __PRAGMA(x) _Pragma(#x) 61 # define __INLINE_FUNC(x) __PRAGMA(FUNC_ALWAYS_INLINE) 63 # define __INLINE_FUNC(x) __PRAGMA(FUNC_ALWAYS_INLINE(x)) 72 #define MATHLIB_PRINTF(fmt,...) \ 74 fprintf(stdout, fmt, __VA_ARGS__); \ 77 #if MATHLIB_DEBUGPRINT > 0 78 #define MATHLIB_DEBUGPRINTFN(N, fmt, ...) \ 80 if (MATHLIB_DEBUGPRINT >= (N)) { \ 81 fprintf(stdout, "MATHLIB debug %s - %d: " fmt, __FUNCTION__, __LINE__, \ 86 #else // MATHLIB_DEBUGPRINT == 0 88 #define MATHLIB_DEBUGPRINTFN(N, fmt, ...) 90 #endif // #if MATHLIB_DEBUGPRINT 94 #if MATHLIB_DEBUGPRINT > 0 95 #define MATHLIB_DEBUGPRINTFN(N, fmt, ...) \ 96 if (MATHLIB_DEBUGPRINT >= (N)) { \ 97 fprintf(stderr, "MATHLIB debug %s - %d: " fmt, __FUNCTION__, __LINE__, \ 101 #define MATHLIB_PRINTF(fmt, ...) \ 102 fprintf(stderr, fmt, __VA_ARGS__) 104 #else // MATHLIB_DEBUGPRINT == 0 106 #define MATHLIB_DEBUGPRINTFN(N, fmt, ...) 107 #define MATHLIB_PRINTF(fmt, ...) 109 #endif // #if MATHLIB_DEBUGPRINT 110 #endif // #if defined(EVM_TEST) 112 #if defined(MATHLIB_MESSAGES) 115 #define MATHLIB_MESG(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) 117 #define MATHLIB_MESG(fmt, ...) 118 #endif //#if defined(MATHLIB_MESSAGES) 138 #define MATHLIB_SOFT_MMA_RESET 0 142 #define MATHLIB_STATIC_INLINE static inline 146 #include <c7x_scalable.h> 148 extern const c7x::uchar_vec MATHLIB_zeroVect_uchar_vec;
149 extern const c7x::ushort_vec MATHLIB_zeroVect_ushort_vec;
150 extern const c7x::uchar_vec MATHLIB_vperm_data_0_63;
220 #define MATHLIB_PARAM_SIZE 128 221 //#define MATHLIB_BYTE_WIDTH 64 222 #define MATHLIB_MMA_ACCUMULATOR_BYTE_WIDTH_8_BIT 4 223 #define MATHLIB_MMA_ACCUMULATOR_BYTE_WIDTH_16_BIT 8 224 #define MATHLIB_MMA_ACCUMULATOR_BYTE_WIDTH_32_BIT 16 233 #define MATHLIB_ALIGN_SHIFT_64BYTES \ 235 #define MATHLIB_ALIGN_SHIFT_128BYTES \ 237 #define MATHLIB_ALIGN_SHIFT_256BYTES \ 240 #define MATHLIB_ALIGN_64BYTES \ 241 (1 << MATHLIB_ALIGN_SHIFT_64BYTES) 242 #define MATHLIB_ALIGN_128BYTES \ 243 (1 << MATHLIB_ALIGN_SHIFT_128BYTES) 244 #define MATHLIB_ALIGN_256BYTES \ 245 (1 << MATHLIB_ALIGN_SHIFT_256BYTES) 247 #define MATHLIB_L2DATA_ALIGN_SHIFT \ 248 MATHLIB_ALIGN_SHIFT_64BYTES 252 #define MATHLIB_L2DATA_ALIGNMENT (((uint32_t)1) << ((uint32_t)MATHLIB_L2DATA_ALIGN_SHIFT)) 278 #if defined(QT_TEST) || defined(RTL_TEST) || defined(EVM_TEST) 279 #if defined(_HOST_BUILD) 280 #define MATHLIB_asm(string) ; 282 #define MATHLIB_asm(string); asm(string); 283 #endif // _HOST_BUILD 285 #define MATHLIB_asm(string) ; 295 #if defined(_HOST_BUILD) 297 #define xstr(x) str(x) 299 #define __attribute__() 300 #define MATHLIB_UNROLL(count) 302 #define MATHLIB_UNROLL(count) _Pragma(str(UNROLL(count))) 305 #define MATHLIB_UNROLL(COUNT) [[TI::unroll(COUNT)]] 308 #if defined(_HOST_BUILD) 310 #define __attribute__() 311 #define MATHLIB_MUST_ITERATE(initial, max, multiple) 313 #define MATHLIB_MUST_ITERATE(initial, max, multiple) _Pragma(str(MUST_ITERATE(initial, max, multiple))) 316 #define MATHLIB_MUST_ITERATE(INTIAL, MAX, MULTIPLE) [[TI::must_iterate(INTIAL, MAX, MULTIPLE)]] 319 #ifndef MATHLIB_NUMBER_RANDOM_DIM_TESTS 320 #define MATHLIB_NUMBER_RANDOM_DIM_TESTS 25 323 #if defined(PERFORMANCE_TEST) 324 #define MATHLIB_PERFORMANCE_TEST_PATTERN SEQUENTIAL 326 #define MATHLIB_PERFORMANCE_TEST_PATTERN RANDOM_SIGNED 329 #define MATHLIB_TEST_OUTPUT_HEAP 0 330 #if defined(_HOST_BUILD) 333 #define MATHLIB_TEST_OUTPUT_MSMC MATHLIB_TEST_OUTPUT_HEAP 335 #define MATHLIB_TEST_OUTPUT_MSMC 1 338 #define STRIDE_OPT_4CYCLE 1 351 #define MATHLIB_min(x, y) \ 352 (((x) < (y)) ? (x) : (y)) 353 #define MATHLIB_max(x, y) \ 354 (((x) < (y)) ? (y) : (x)) 355 #define MATHLIB_ceilingDiv(x, y) \
Circular buffer for coefficients.
float MATHLIB_F32
Single precision floating point.
double MATHLIB_D64
Double precision floating point.
MATHLIB_FUNCTION_STYLE
Enumeration for the style of function implementation.
MATHLIB_STATUS_NAME
The enumeration of all status codes.
MATHLIB_STATUS_NAME MATHLIB_STATUS
Return value for MATHLIB functions.
MATHLIB_buffer_mode_e
Buffer structure for input feature maps and coefficients of MATHLIB_CNN_convolve_row_ixX_ixX_oxX.
void * MATHLIB_kernelHandle
Handle type for MATHLIB operations.