23 #ifndef COMMON_DSPLIB_TYPES_H_ 24 #define COMMON_DSPLIB_TYPES_H_ 1 28 #ifndef __OPENCL_VERSION__ 41 #include "c71/DSPLIB_defines.h" 43 #include "c7100/DSPLIB_defines.h" 44 #include "c7100/DSPLIB_types.h" 49 #if !defined(DSPLIB_DEBUGPRINT) 50 #define DSPLIB_DEBUGPRINT 0 53 #if (defined(_HOST_BUILD) && (DSPLIB_COMPILER_VERSION < 1003999)) 56 #define DSPLIB_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 DSPLIB_PRINTF(fmt,...) \ 74 fprintf(stdout, fmt, __VA_ARGS__); \ 77 #if DSPLIB_DEBUGPRINT > 0 78 #define DSPLIB_DEBUGPRINTFN(N, fmt, ...) \ 80 if (DSPLIB_DEBUGPRINT >= (N)) { \ 81 fprintf(stdout, "DSPLIB debug %s - %d: " fmt, __FUNCTION__, __LINE__, \ 86 #else // DSPLIB_DEBUGPRINT == 0 88 #define DSPLIB_DEBUGPRINTFN(N, fmt, ...) 90 #endif // #if DSPLIB_DEBUGPRINT 94 #if DSPLIB_DEBUGPRINT > 0 95 #define DSPLIB_DEBUGPRINTFN(N, fmt, ...) \ 96 if (DSPLIB_DEBUGPRINT >= (N)) { \ 97 fprintf(stderr, "DSPLIB debug %s - %d: " fmt, __FUNCTION__, __LINE__, \ 101 #define DSPLIB_PRINTF(fmt, ...) \ 102 fprintf(stderr, fmt, __VA_ARGS__) 104 #else // DSPLIB_DEBUGPRINT == 0 106 #define DSPLIB_DEBUGPRINTFN(N, fmt, ...) 107 #define DSPLIB_PRINTF(fmt, ...) 109 #endif // #if DSPLIB_DEBUGPRINT 110 #endif // #if defined(EVM_TEST) 112 #if defined(DSPLIB_MESSAGES) 115 #define DSPLIB_MESG(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) 117 #define DSPLIB_MESG(fmt, ...) 118 #endif //#if defined(DSPLIB_MESSAGES) 138 #define DSPLIB_SOFT_MMA_RESET 0 141 #define DSPLIB_STATIC_INLINE static inline 145 #include <c7x_scalable.h> 147 extern const c7x::uchar_vec DSPLIB_zeroVect_uchar_vec;
148 extern const c7x::ushort_vec DSPLIB_zeroVect_ushort_vec;
149 extern const c7x::uchar_vec DSPLIB_vperm_data_0_63;
309 #define DSPLIB_PARAM_SIZE 128 310 //#define DSPLIB_BYTE_WIDTH 64 311 #define DSPLIB_MMA_ACCUMULATOR_BYTE_WIDTH_8_BIT 4 312 #define DSPLIB_MMA_ACCUMULATOR_BYTE_WIDTH_16_BIT 8 313 #define DSPLIB_MMA_ACCUMULATOR_BYTE_WIDTH_32_BIT 16 322 #define DSPLIB_ALIGN_SHIFT_64BYTES \ 324 #define DSPLIB_ALIGN_SHIFT_128BYTES \ 326 #define DSPLIB_ALIGN_SHIFT_256BYTES \ 329 #define DSPLIB_ALIGN_64BYTES \ 330 (1 << DSPLIB_ALIGN_SHIFT_64BYTES) 331 #define DSPLIB_ALIGN_128BYTES \ 332 (1 << DSPLIB_ALIGN_SHIFT_128BYTES) 333 #define DSPLIB_ALIGN_256BYTES \ 334 (1 << DSPLIB_ALIGN_SHIFT_256BYTES) 336 #define DSPLIB_L2DATA_ALIGN_SHIFT \ 337 DSPLIB_ALIGN_SHIFT_64BYTES 341 #define DSPLIB_L2DATA_ALIGNMENT (((uint32_t)1) << ((uint32_t)DSPLIB_L2DATA_ALIGN_SHIFT)) 393 #if defined(QT_TEST) || defined(RTL_TEST) || defined(EVM_TEST) 394 #if defined(_HOST_BUILD) 395 #define DSPLIB_asm(string) ; 397 #define DSPLIB_asm(string); asm(string); 398 #endif // _HOST_BUILD 400 #define DSPLIB_asm(string) ; 410 #if defined(_HOST_BUILD) 412 #define xstr(x) str(x) 414 #define __attribute__() 415 #define DSPLIB_UNROLL(count) 417 #define DSPLIB_UNROLL(count) _Pragma(str(UNROLL(count))) 420 #define DSPLIB_UNROLL(COUNT) [[TI::unroll(COUNT)]] 423 #if defined(_HOST_BUILD) 425 #define __attribute__() 426 #define DSPLIB_MUST_ITERATE(initial, max, multiple) 428 #define DSPLIB_MUST_ITERATE(initial, max, multiple) _Pragma(str(MUST_ITERATE(initial, max, multiple))) 431 #define DSPLIB_MUST_ITERATE(INTIAL, MAX, MULTIPLE) [[TI::must_iterate(INTIAL, MAX, MULTIPLE)]] 434 #ifndef DSPLIB_NUMBER_RANDOM_DIM_TESTS 435 #define DSPLIB_NUMBER_RANDOM_DIM_TESTS 25 438 #if defined(PERFORMANCE_TEST) 439 #define DSPLIB_PERFORMANCE_TEST_PATTERN SEQUENTIAL 441 #define DSPLIB_PERFORMANCE_TEST_PATTERN RANDOM_SIGNED 444 #define DSPLIB_TEST_OUTPUT_HEAP 0 445 #if defined(_HOST_BUILD) 448 #define DSPLIB_TEST_OUTPUT_MSMC DSPLIB_TEST_OUTPUT_HEAP 450 #define DSPLIB_TEST_OUTPUT_MSMC 1 453 #define STRIDE_OPT_4CYCLE 1 466 #define DSPLIB_min(x, y) \ 467 (((x) < (y)) ? (x) : (y)) 468 #define DSPLIB_max(x, y) \ 469 (((x) < (y)) ? (y) : (x)) 470 #define DSPLIB_ceilingDiv(x, y) \ 481 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i32s_i32s_o32s;
483 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i16s_i16s_o16s;
484 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i16s_i16s_o16u;
485 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i16u_i16s_o16s;
486 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i16u_i16s_o16u;
488 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i8s_i8s_o8s;
489 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i8s_i8s_o8u;
490 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i8u_i8s_o8s;
491 extern const DSPLIB_MMA_CONFIG_REG configRegisterStruct_i8u_i8s_o8u;
493 extern const __HWA_OFFSET_REG offsetRegStruct_zeros;
494 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_32bit;
495 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_16bit;
496 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_8bit;
DSPLIB_STATUS_NAME
The enumeration of all status codes.
DSPLIB_buffer_mode_e
Buffer structure for input feature maps and coefficients of DSPLIB_CNN_convolve_row_ixX_ixX_oxX.
Used when tensor is in NCHW format.
Circular buffer for coefficients.
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
DSPLIB_FUNCTION_STYLE
Enumeration for the style of function implementation.
DSPLIB_tensor_format_e
Tensor format.
DSPLIB_tensor_format_e DSPLIB_tensor_format
float DSPLIB_F32
Single precision floating point.
double DSPLIB_D64
Double precision floating point.
DSPLIB_STATUS_NAME DSPLIB_STATUS
Return value for DSPLIB functions.
Used when tensor is in NHWC format.