23 #ifndef COMMON_MMALIB_TYPES_H_ 24 #define COMMON_MMALIB_TYPES_H_ 1 28 #ifndef __OPENCL_VERSION__ 41 #if defined (__C7100__) || defined (__device__) 42 #include "c71/MMALIB_defines.h" 47 #if defined (__C7100__) 56 #if !defined(MMALIB_DEBUGPRINT) 57 #define MMALIB_DEBUGPRINT 0 59 #if MMALIB_DEBUGPRINT == 1 60 #include "c71/MMALIB_debug.h" 63 #if (defined(_HOST_BUILD) && (MMALIB_COMPILER_VERSION < 1003999)) 66 #define MMALIB_const const 74 #define MMALIB_DEBUGPRINTFN(N, fmt, ...) \ 76 if (MMALIB_DEBUGPRINT >= (N)) { \ 77 fprintf(stdout, "MMALIB debug %s - %d: " fmt, __FUNCTION__, __LINE__, \ 82 #define MMALIB_PRINTF(fmt,...) \ 84 fprintf(stdout, fmt, __VA_ARGS__); \ 87 #if defined(MMALIB_MESSAGES) 90 #define MMALIB_MESG(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) 92 #define MMALIB_MESG(fmt, ...) 93 #endif //#if defined(MMALIB_MESSAGES) 113 #define MMALIB_SOFT_MMA_RESET 0 116 #define MMALIB_STATIC_INLINE static inline 256 #define MMALIB_PARAM_SIZE 128 257 #define MMALIB_BYTE_WIDTH 64 265 #define MMALIB_ALIGN_SHIFT_64BYTES \ 267 #define MMALIB_ALIGN_SHIFT_128BYTES \ 269 #define MMALIB_ALIGN_SHIFT_256BYTES \ 272 #define MMALIB_ALIGN_64BYTES \ 273 (1 << MMALIB_ALIGN_SHIFT_64BYTES) 274 #define MMALIB_ALIGN_128BYTES \ 275 (1 << MMALIB_ALIGN_SHIFT_128BYTES) 276 #define MMALIB_ALIGN_256BYTES \ 277 (1 << MMALIB_ALIGN_SHIFT_256BYTES) 279 #define MMALIB_L2DATA_ALIGN_SHIFT \ 280 MMALIB_ALIGN_SHIFT_64BYTES 284 #define MMALIB_L2DATA_ALIGNMENT (((uint32_t)1) << ((uint32_t)MMALIB_L2DATA_ALIGN_SHIFT)) 292 #define MMALIB_CALC_STRIDE(BYTES, ALIGN_SHIFT) \ 293 (((((BYTES)-1) >> (ALIGN_SHIFT)) + 1) << (ALIGN_SHIFT)) 296 #define MMALIB_MMA_SIZE_8_BIT_SHIFT \ 298 #define MMALIB_MMA_SIZE_16_BIT_SHIFT \ 300 #define MMALIB_MMA_SIZE_32_BIT_SHIFT \ 305 #define MMALIB_MMA_SIZE_8_BIT \ 306 ((uint32_t)(((uint32_t)1) \ 307 << MMALIB_MMA_SIZE_8_BIT_SHIFT)) 308 #define MMALIB_MMA_SIZE_16_BIT \ 310 ((uint32_t)(((uint32_t)1) \ 311 << MMALIB_MMA_SIZE_16_BIT_SHIFT)) 312 #define MMALIB_MMA_SIZE_32_BIT \ 314 ((int32_t)(((uint32_t)1) \ 315 << MMALIB_MMA_SIZE_32_BIT_SHIFT)) 336 #if defined(_HOST_BUILD) 337 #define MMALIB_asm(string) ; 339 #define MMALIB_asm(string); asm(string); 340 #endif // _HOST_BUILD 349 #if defined(_HOST_BUILD) 351 #define xstr(x) str(x) 353 #define __attribute__() 354 #define MMALIB_UNROLL(count) 356 #define MMALIB_UNROLL(count) _Pragma(str(UNROLL(count))) 359 #define MMALIB_UNROLL(COUNT) [[TI::unroll(COUNT)]] 362 #if defined(_HOST_BUILD) 364 #define __attribute__() 365 #define MMALIB_MUST_ITERATE(initial, max, multiple) 367 #define MMALIB_MUST_ITERATE(initial, max, multiple) _Pragma(str(MUST_ITERATE(initial, max, multiple))) 370 #define MMALIB_MUST_ITERATE(INTIAL, MAX, MULTIPLE) [[TI::must_iterate(INTIAL, MAX, MULTIPLE)]] 373 #ifndef MMALIB_NUMBER_RANDOM_DIM_TESTS 374 #define MMALIB_NUMBER_RANDOM_DIM_TESTS 25 377 #define MMALIB_PERFORMANCE_TEST_PATTERN RANDOM_SIGNED 379 #define MMALIB_TEST_OUTPUT_HEAP 0 380 #if defined(_HOST_BUILD) 383 #define MMALIB_TEST_OUTPUT_MSMC MMALIB_TEST_OUTPUT_HEAP 385 #define MMALIB_TEST_OUTPUT_MSMC 1 388 #define STRIDE_OPT_4CYCLE 1 401 #define MMALIB_min(x, y) \ 402 (((x) < (y)) ? (x) : (y)) 403 #define MMALIB_max(x, y) \ 404 (((x) < (y)) ? (y) : (x)) 405 #define MMALIB_ceilingDiv(x, y) \ 416 extern const uchar64 MMALIB_zeroVect_uchar64;
417 extern const ushort32 MMALIB_zeroVect_ushort32;
418 extern const uchar64 MMALIB_vperm_data_0_63;
432 extern const __HWA_OFFSET_REG offsetRegStruct_zeros;
433 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_32bit;
434 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_16bit;
435 extern const __HWA_OFFSET_REG offsetRegStruct_diagonal_8bit;
MMALIB_STATUS_NAME MMALIB_STATUS
Return value for MMALIB functions.
float MMALIB_F32
Single precision floating point.
MMALIB_STATUS_NAME
The enumeration of all status codes.
File to hold common structure, enums, macros and functions for MMALIB.
#define MMALIB_MMA_CONFIG_REG
MMALIB_buffer_mode_e
Buffer structure for input feature maps and coefficients of MMALIB_CNN_convolve_row_ixX_ixX_oxX.
Circular buffer for coefficients.
double MMALIB_D64
Double precision floating point.
MMALIB_FUNCTION_STYLE
Enumeration for the style of function implementation.
File to hold buffer parameter related info for MMALIB.
void * MMALIB_kernelHandle
Handle type for MMALIB operations.