/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rpp/checkouts/develop/api/rppdefs.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rpp/checkouts/develop/api/rppdefs.h Source File#

RPP: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rpp/checkouts/develop/api/rppdefs.h Source File
rppdefs.h
Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2019 - 2025 Advanced Micro Devices, Inc.
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef RPPDEFS_H
26 #define RPPDEFS_H
27 
34 #include <stddef.h>
35 #include <cmath>
36 #ifdef HIP_COMPILE
37  #include <hip/hip_fp16.h>
38 #endif // HIP_COMPILE
39 #if __has_include(<half/half.hpp>)
40  #include <half/half.hpp>
41 #else
42  #include <half.hpp>
43 #endif
44 using halfhpp = half_float::half;
45 typedef halfhpp Rpp16f;
46 
47 #ifdef OCL_COMPILE
48 #include <CL/cl.h>
49 #endif
50 
51 #if _WIN32
52 #include <intrin.h>
53 #else
54 #include <x86intrin.h>
55 #include <smmintrin.h>
56 #include <immintrin.h>
57 #endif
58 #include<vector>
59 
61 #define RPP_MIN_8U ( 0 )
63 #define RPP_MAX_8U ( 255 )
65 #define RPPT_MAX_DIMS ( 5 )
67 #define RPPT_MAX_AUDIO_CHANNELS ( 16 )
68 
69 #define CHECK_RETURN_STATUS(x) do { \
70  int retval = (x); \
71  if (retval != 0) { \
72  fprintf(stderr, "Runtime error: %s returned %d at %s:%d", #x, retval, __FILE__, __LINE__); \
73  exit(-1); \
74  } \
75 } while (0)
76 
77 #ifdef HIP_COMPILE
78 #include <hip/hip_runtime.h>
79 #define RPP_HOST_DEVICE __host__ __device__
80 #else
81 #define RPP_HOST_DEVICE
82 #endif
83 
84 const float ONE_OVER_6 = 1.0f / 6;
85 const float ONE_OVER_3 = 1.0f / 3;
86 const float ONE_OVER_255 = 1.0f / 255;
87 const uint MMS_MAX_SCRATCH_MEMORY = 115293120; // maximum scratch memory size (in number of floats) needed for MMS buffer in RNNT training
88 const uint SPECTROGRAM_MAX_SCRATCH_MEMORY = 372877312; // maximum scratch memory size (in number of floats) needed for spectrogram HIP kernel in RNNT training
89 #define DROPOUT_FIXED_SEED 42 // Constant fixed seed for reproducing the dropout output
90 
91 /******************** RPP typedefs ********************/
92 
94 typedef unsigned char Rpp8u;
96 typedef signed char Rpp8s;
98 typedef unsigned short Rpp16u;
100 typedef short Rpp16s;
102 typedef unsigned int Rpp32u;
104 typedef int Rpp32s;
106 typedef unsigned long long Rpp64u;
108 typedef long long Rpp64s;
110 typedef float Rpp32f;
112 typedef double Rpp64f;
114 typedef void* RppPtr_t;
116 typedef size_t RppSize_t;
117 
121 typedef enum
122 {
126  RPP_ERROR = -1,
178 
182 typedef enum
183 {
184  RPP_HOST_BACKEND,
185  RPP_HIP_BACKEND,
186  RPP_OCL_BACKEND
187 } RppBackend;
188 
192 typedef enum
193 {
194  rppStatusSuccess = 0,
195  rppStatusBadParm = -1,
196  rppStatusUnknownError = -2,
197  rppStatusNotInitialized = -3,
198  rppStatusInvalidValue = -4,
199  rppStatusAllocFailed = -5,
200  rppStatusInternalError = -6,
201  rppStatusNotImplemented = -7,
202  rppStatusUnsupportedOp = -8,
203 } rppStatus_t;
204 
205 #ifdef LEGACY_SUPPORT
209 typedef enum
210 {
211  RPP_SCALAR_OP_AND = 1,
212  RPP_SCALAR_OP_OR,
213  RPP_SCALAR_OP_XOR,
214  RPP_SCALAR_OP_NAND,
215  RPP_SCALAR_OP_EQUAL,
216  RPP_SCALAR_OP_NOTEQUAL,
217  RPP_SCALAR_OP_LESS,
218  RPP_SCALAR_OP_LESSEQ,
219  RPP_SCALAR_OP_GREATER,
220  RPP_SCALAR_OP_GREATEREQ,
221  RPP_SCALAR_OP_ADD,
222  RPP_SCALAR_OP_SUBTRACT,
223  RPP_SCALAR_OP_MULTIPLY,
224  RPP_SCALAR_OP_DIVIDE,
225  RPP_SCALAR_OP_MODULUS,
226  RPP_SCALAR_OP_MIN,
227  RPP_SCALAR_OP_MAX,
228 } RppOp;
229 
233 typedef enum
234 {
235  U8_S8,
236  S8_U8,
237 } RppConvertBitDepthMode;
238 
242 typedef struct
243 {
244  Rpp32f rho;
245  Rpp32f theta;
246 } RppPointPolar;
247 #endif
248 
252 typedef struct
253 {
254  Rpp32u channelParam;
255  Rpp32u bufferMultiplier;
257 
261 typedef struct
262 {
263  Rpp32f data[6];
264 } Rpp32f6;
265 
269 typedef struct
270 {
271  Rpp32f data[9];
272 } Rpp32f9;
273 
277 typedef struct
278 {
279  Rpp32s data[24];
280 } Rpp32s24;
281 
285 typedef struct
286 {
287  Rpp32f data[24];
288 } Rpp32f24;
289 
290 /******************** RPPI typedefs ********************/
291 
292 #ifdef LEGACY_SUPPORT
296 typedef enum
297 {
298  RGB_HSV = 1,
299  HSV_RGB
300 } RppiColorConvertMode;
301 
305 typedef enum
306 {
307  RPPI_LOW,
308  RPPI_MEDIUM,
309  RPPI_HIGH
310 } RppiFuzzyLevel;
311 
315 typedef enum
316 {
317  RPPI_HORIZONTAL_AXIS,
318  RPPI_VERTICAL_AXIS,
319  RPPI_BOTH_AXIS
320 } RppiAxis;
321 
325 typedef enum
326 {
327  GAUSS3,
328  GAUSS5,
329  GAUSS3x1,
330  GAUSS1x3,
331  AVG3 = 10,
332  AVG5
333 } RppiBlur;
334 
338 typedef enum
339 {
340  ZEROPAD,
341  NOPAD
342 } RppiPad;
343 
347 typedef enum
348 {
349  RGB,
350  HSV
351 } RppiFormat;
352 
356 typedef struct
357 {
358  int x;
359  int y;
360  int width;
361  int height;
362 } RppiRect;
363 #endif
364 
368 typedef enum
369 {
370  RPPI_CHN_PLANAR,
371  RPPI_CHN_PACKED
372 } RppiChnFormat;
373 
377 typedef struct
378 {
379  unsigned int width;
380  unsigned int height;
381 } RppiSize;
382 
386 typedef struct
387 {
388  unsigned int x;
389  unsigned int y;
390  unsigned int roiWidth;
391  unsigned int roiHeight;
392 } RppiROI;
393 
394 /******************** RPPT typedefs ********************/
395 
399 typedef enum
400 {
401  U8,
402  F32,
403  F16,
404  I8,
405  I16
406 } RpptDataType;
407 
411 typedef enum
412 {
413  NCHW, // BatchSize-Channels-Height-Width
414  NHWC, // BatchSize-Height-Width-Channels
415  NCDHW, // BatchSize-Channels-Depth-Height-Width
416  NDHWC, // BatchSize-Depth-Height-Width-Channels
417  NHW, // BatchSize-Height-Width
418  NFT, // BatchSize-Frequency-Time -> Frequency Major used for Spectrogram / MelfilterBank
419  NTF // BatchSize-Time-Frequency -> Time Major used for Spectrogram / MelfilterBank
420 } RpptLayout;
421 
425 typedef enum
426 {
427  LTRB, // Left-Top-Right-Bottom
428  XYWH // X-Y-Width-Height
429 } RpptRoiType;
430 
434 typedef enum
435 {
436  LTFRBB, // Left-Top-Front-Right-Bottom-Back
437  XYZWHD // X-Y-Z-Width-Height-Depth
438 } RpptRoi3DType;
439 
443 typedef enum
444 {
445  RGBtype,
446  BGRtype
448 
452 typedef enum
453 {
454  NEAREST_NEIGHBOR = 0,
455  BILINEAR,
456  BICUBIC,
457  LANCZOS,
458  GAUSSIAN,
459  TRIANGULAR
461 
465 typedef enum
466 {
467  ZERO = 0,
468  CLAMP,
469  REFLECT
471 
475 typedef enum
476 {
477  TOP_EDGE = 0,
478  BOTTOM_EDGE,
479  LEFT_EDGE,
480  RIGHT_EDGE
482 
486 typedef enum
487 {
488  REPLICATE = 0, // Similar to Nearest Neighbors Padding
489  CONSTANT, // Unsupported Border Type
490  REFLECT_NO_EDGE // Unsupported Border Type
492 
496 typedef enum
497 {
498  SLANEY = 0, // Follows Slaney’s MATLAB Auditory Modelling Work behavior
499  HTK, // Follows O’Shaughnessy’s book formula, consistent with Hidden Markov Toolkit(HTK), m = 2595 * log10(1 + (f/700))
501 
505 typedef struct
506 {
507  int x;
508  int y;
509 } RpptPoint2D;
510 
514 typedef struct
515 {
516  int x;
517  int y;
518  int z;
519 } RpptPoint3D;
520 
524 typedef struct
525 {
526  RpptPoint2D lt, rb; // Left-Top point and Right-Bottom point
527 
528 } RpptRoiLtrb;
529 
533 typedef struct
534 {
535  RpptPoint2D r;
536  RpptPoint2D g;
537  RpptPoint2D b;
539 
543 typedef struct
544 {
545  RpptPoint3D ltf, rbb; // Left-Top-Front point and Right-Bottom-Back point
546 
547 } RpptRoiLtfrbb;
548 
552 typedef struct
553 {
554  RpptPoint2D xy;
555  int roiWidth, roiHeight;
556 
557 } RpptRoiXywh;
558 
562 typedef struct
563 {
564  RpptPoint3D xyz;
565  int roiWidth, roiHeight, roiDepth;
566 
567 } RpptRoiXyzwhd;
568 
572 typedef union
573 {
574  RpptRoiLtrb ltrbROI; // ROI defined as Left-Top-Right-Bottom
575  RpptRoiXywh xywhROI; // ROI defined as X-Y-Width-Height
576 
577 } RpptROI, *RpptROIPtr;
578 
582 typedef union
583 {
584  RpptRoiLtfrbb ltfrbbROI; // ROI defined as Left-Top-Front-Right-Bottom-Back
585  RpptRoiXyzwhd xyzwhdROI; // ROI defined as X-Y-Z-Width-Height-Depth
586 
588 
592 typedef struct
593 {
594  Rpp32u nStride;
595  Rpp32u cStride;
596  Rpp32u hStride;
597  Rpp32u wStride;
598 } RpptStrides;
599 
603 typedef struct
604 {
605  RppSize_t numDims;
606  Rpp32u offsetInBytes;
607  RpptDataType dataType;
608  Rpp32u n, c, h, w;
609  RpptStrides strides;
610  RpptLayout layout;
612 
616 typedef struct
617 {
618  RppSize_t numDims;
619  Rpp32u offsetInBytes;
620  RpptDataType dataType;
621  Rpp32u dims[RPPT_MAX_DIMS];
622  Rpp32u strides[RPPT_MAX_DIMS];
623  RpptLayout layout;
625 
629 typedef struct
630 {
631  Rpp8u R;
632  Rpp8u G;
633  Rpp8u B;
634 } RpptRGB;
635 
639 typedef struct
640 {
641  Rpp32f R;
642  Rpp32f G;
643  Rpp32f B;
644 } RpptFloatRGB;
645 
649 typedef struct
650 {
651  Rpp32u x;
652  Rpp32u y;
654 
658 typedef struct
659 {
660  Rpp32f x;
661  Rpp32f y;
663 
667 typedef struct
668 {
669  Rpp32u width;
670  Rpp32u height;
672 
676 typedef struct
677 { Rpp32u x[5];
678  Rpp32u counter;
680 
684 typedef struct
685 { Rpp32s x[5];
686  Rpp32s counter;
687  int boxMullerFlag;
688  float boxMullerExtra;
690 
694 typedef struct
695 {
696  Rpp32s24 srcLocsTL;
697  Rpp32s24 srcLocsTR;
698  Rpp32s24 srcLocsBL;
699  Rpp32s24 srcLocsBR;
701 
705 typedef struct
706 {
707  Rpp32f24 srcValsTL;
708  Rpp32f24 srcValsTR;
709  Rpp32f24 srcValsBL;
710  Rpp32f24 srcValsBR;
712 
716 typedef struct GenericFilter
717 {
718  Rpp32f scale = 1.0f;
719  Rpp32f radius = 1.0f;
720  Rpp32s size;
721  GenericFilter(RpptInterpolationType interpolationType, Rpp32s in_size, Rpp32s out_size, Rpp32f scaleRatio)
722  {
723  switch(interpolationType)
724  {
725  case RpptInterpolationType::BICUBIC:
726  {
727  this->radius = 2.0f;
728  break;
729  }
730  case RpptInterpolationType::LANCZOS:
731  {
732  if(in_size > out_size)
733  {
734  this->radius = 3.0f * scaleRatio;
735  this->scale = (1 / scaleRatio);
736  }
737  else
738  this->radius = 3.0f;
739  break;
740  }
741  case RpptInterpolationType::GAUSSIAN:
742  {
743  if(in_size > out_size)
744  {
745  this->radius = scaleRatio;
746  this->scale = (1 / scaleRatio);
747  }
748  break;
749  }
750  case RpptInterpolationType::TRIANGULAR:
751  {
752  if(in_size > out_size)
753  {
754  this->radius = scaleRatio;
755  this->scale = (1 / scaleRatio);
756  }
757  break;
758  }
759  default:
760  {
761  this->radius = 1.0f;
762  this->scale = 1.0f;
763  break;
764  }
765  }
766  this->size = std::ceil(2 * this->radius);
767  }
769 
773 typedef struct RpptResamplingWindow
774 {
775  inline RPP_HOST_DEVICE void input_range(Rpp32f x, Rpp32s *loc0, Rpp32s *loc1)
776  {
777  Rpp32s xc = std::ceil(x);
778  *loc0 = xc - lobes;
779  *loc1 = xc + lobes;
780  }
781 
782  inline Rpp32f operator()(Rpp32f x)
783  {
784  Rpp32f locRaw = x * scale + center;
785  Rpp32s locFloor = std::floor(locRaw);
786  Rpp32f weight = locRaw - locFloor;
787  locFloor = std::max(std::min(locFloor, lookupSize - 2), 0);
788  Rpp32f current = lookup[locFloor];
789  Rpp32f next = lookup[locFloor + 1];
790  return current + weight * (next - current);
791  }
792 
793  inline __m128 operator()(__m128 x)
794  {
795  __m128 pLocRaw = _mm_add_ps(_mm_mul_ps(x, pScale), pCenter);
796  __m128i pxLocFloor = _mm_cvttps_epi32(pLocRaw);
797  __m128 pLocFloor = _mm_cvtepi32_ps(pxLocFloor);
798  __m128 pWeight = _mm_sub_ps(pLocRaw, pLocFloor);
799  Rpp32s idx[4];
800  _mm_storeu_si128(reinterpret_cast<__m128i*>(idx), pxLocFloor);
801  __m128 pCurrent = _mm_setr_ps(lookup[idx[0]], lookup[idx[1]], lookup[idx[2]], lookup[idx[3]]);
802  __m128 pNext = _mm_setr_ps(lookup[idx[0] + 1], lookup[idx[1] + 1], lookup[idx[2] + 1], lookup[idx[3] + 1]);
803  return _mm_add_ps(pCurrent, _mm_mul_ps(pWeight, _mm_sub_ps(pNext, pCurrent)));
804  }
805 
806  Rpp32f scale = 1, center = 1;
807  Rpp32s lobes = 0, coeffs = 0;
808  Rpp32s lookupSize = 0;
809  Rpp32f *lookupPinned = nullptr;
810  std::vector<Rpp32f> lookup;
811  __m128 pCenter, pScale;
813 
818 {
819  public:
820  inline RPP_HOST_DEVICE virtual Rpp32f hz_to_mel(Rpp32f hz) = 0;
821  inline RPP_HOST_DEVICE virtual Rpp32f mel_to_hz(Rpp32f mel) = 0;
822  virtual ~BaseMelScale() = default;
823 };
824 
828 struct HtkMelScale : public BaseMelScale
829 {
830  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz) { return 1127.0f * std::log(1.0f + (hz / 700.0f)); }
831  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel) { return 700.0f * (std::exp(mel / 1127.0f) - 1.0f); }
832  public:
833  ~HtkMelScale() {};
834 };
835 
840 {
841  const Rpp32f freqLow = 0;
842  const Rpp32f fsp = 66.666667f;
843  const Rpp32f minLogHz = 1000.0;
844  const Rpp32f minLogMel = (minLogHz - freqLow) / fsp;
845  const Rpp32f stepLog = 0.068751777; // Equivalent to std::log(6.4) / 27.0;
846 
847  const Rpp32f invMinLogHz = 0.001f;
848  const Rpp32f invStepLog = 1.0f / stepLog;
849  const Rpp32f invFsp = 1.0f / fsp;
850 
851  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz)
852  {
853  Rpp32f mel = 0.0f;
854  if (hz >= minLogHz)
855  mel = minLogMel + std::log(hz * invMinLogHz) * invStepLog;
856  else
857  mel = (hz - freqLow) * invFsp;
858 
859  return mel;
860  }
861 
862  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel)
863  {
864  Rpp32f hz = 0.0f;
865  if (mel >= minLogMel)
866  hz = minLogHz * std::exp(stepLog * (mel - minLogMel));
867  else
868  hz = freqLow + mel * fsp;
869  return hz;
870  }
871  public:
872  ~SlaneyMelScale() {};
873 };
874 
875 /******************** HOST memory typedefs ********************/
876 
880 typedef struct
881 {
882  Rpp32f *floatmem;
883 } memRpp32f;
884 
888 typedef struct
889 {
890  Rpp64f *doublemem;
891 } memRpp64f;
892 
896 typedef struct
897 {
898  Rpp32u *uintmem;
899 } memRpp32u;
900 
904 typedef struct
905 {
906  Rpp32s *intmem;
907 } memRpp32s;
908 
912 typedef struct
913 {
914  Rpp8u *ucharmem;
915 } memRpp8u;
916 
920 typedef struct
921 {
922  Rpp8s *charmem;
923 } memRpp8s;
924 
928 typedef struct
929 {
930  RpptRGB* rgbmem;
931 } memRpptRGB;
932 
936 typedef struct
937 {
938  Rpp32u *height;
939  Rpp32u *width;
940 } memSize;
941 
945 typedef struct
946 {
947  Rpp32u *x;
948  Rpp32u *y;
949  Rpp32u *roiHeight;
950  Rpp32u *roiWidth;
951 } memROI;
952 
956 typedef struct {
957  RppiSize *srcSize;
958  RppiSize *dstSize;
959  RppiSize *maxSrcSize;
960  RppiSize *maxDstSize;
961  RppiROI *roiPoints;
962  memRpp32f floatArr[10];
963  memRpp64f doubleArr[10];
964  memRpp32u uintArr[10];
965  memRpp32s intArr[10];
966  memRpp8u ucharArr[10];
967  memRpp8s charArr[10];
968  memRpptRGB rgbArr;
969  Rpp64u *srcBatchIndex;
970  Rpp64u *dstBatchIndex;
971  Rpp32u *inc;
972  Rpp32u *dstInc;
973  Rpp32f *scratchBufferHost;
974 } memCPU;
975 
976 #ifdef OCL_COMPILE
977 
978 /******************** OCL memory typedefs ********************/
979 
983 typedef struct
984 {
985  cl_mem floatmem;
986 } clmemRpp32f;
987 
991 typedef struct
992 {
993  cl_mem doublemem;
994 } clmemRpp64f;
995 
999 typedef struct
1000 {
1001  cl_mem uintmem;
1002 } clmemRpp32u;
1003 
1007 typedef struct
1008 {
1009  cl_mem intmem;
1010 } clmemRpp32s;
1011 
1015 typedef struct
1016 {
1017  cl_mem ucharmem;
1018 } clmemRpp8u;
1019 
1023 typedef struct
1024 {
1025  cl_mem charmem;
1026 } clmemRpp8s;
1027 
1031 typedef struct
1032 {
1033  cl_mem height;
1034  cl_mem width;
1035 } clmemSize;
1036 
1040 typedef struct
1041 {
1042  cl_mem x;
1043  cl_mem y;
1044  cl_mem roiHeight;
1045  cl_mem roiWidth;
1046 } clmemROI;
1047 
1051 typedef struct
1052 {
1053  memSize csrcSize;
1054  memSize cdstSize;
1055  memSize cmaxSrcSize;
1056  memSize cmaxDstSize;
1057  memROI croiPoints;
1058  clmemSize srcSize;
1059  clmemSize dstSize;
1060  clmemSize maxSrcSize;
1061  clmemSize maxDstSize;
1062  clmemROI roiPoints;
1063  clmemRpp32f floatArr[10];
1064  clmemRpp64f doubleArr[10];
1065  clmemRpp32u uintArr[10];
1066  clmemRpp32s intArr[10];
1067  clmemRpp8u ucharArr[10];
1068  clmemRpp8s charArr[10];
1069  cl_mem srcBatchIndex;
1070  cl_mem dstBatchIndex;
1071  cl_mem inc;
1072  cl_mem dstInc;
1073 } memGPU;
1074 
1078 typedef struct
1079 {
1080  memCPU mcpu;
1081  memGPU mgpu;
1082 } memMgmt;
1083 
1084 #elif defined(HIP_COMPILE)
1085 
1086 /******************** HIP memory typedefs ********************/
1087 
1091 typedef struct
1092 {
1093  Rpp32f* floatmem;
1094 } hipMemRpp32f;
1095 
1099 typedef struct
1100 {
1101  Rpp64f* doublemem;
1102 } hipMemRpp64f;
1103 
1107 typedef struct
1108 {
1109  Rpp32u* uintmem;
1110 } hipMemRpp32u;
1111 
1115 typedef struct
1116 {
1117  Rpp32s* intmem;
1118 } hipMemRpp32s;
1119 
1123 typedef struct
1124 {
1125  Rpp8u* ucharmem;
1126 } hipMemRpp8u;
1127 
1131 typedef struct
1132 {
1133  Rpp8s* charmem;
1134 } hipMemRpp8s;
1135 
1139 typedef struct
1140 {
1141  RpptRGB* rgbmem;
1142 } hipMemRpptRGB;
1143 
1147 typedef struct
1148 {
1149  Rpp32u* height;
1150  Rpp32u* width;
1151 } hipMemSize;
1152 
1156 typedef struct
1157 {
1158  Rpp32u* x;
1159  Rpp32u* y;
1160  Rpp32u* roiHeight;
1161  Rpp32u* roiWidth;
1162 } hipMemROI;
1163 
1167 typedef struct
1168 {
1169  memSize csrcSize;
1170  memSize cdstSize;
1171  memSize cmaxSrcSize;
1172  memSize cmaxDstSize;
1173  memROI croiPoints;
1174  hipMemSize srcSize;
1175  hipMemSize dstSize;
1176  hipMemSize maxSrcSize;
1177  hipMemSize maxDstSize;
1178  hipMemROI roiPoints;
1179  hipMemRpp32f floatArr[10];
1180  hipMemRpp32f float3Arr[10];
1181  hipMemRpp64f doubleArr[10];
1182  hipMemRpp32u uintArr[10];
1183  hipMemRpp32s intArr[10];
1184  hipMemRpp8u ucharArr[10];
1185  hipMemRpp8s charArr[10];
1186  hipMemRpptRGB rgbArr;
1187  hipMemRpp32f scratchBufferHip;
1188  Rpp64u* srcBatchIndex;
1189  Rpp64u* dstBatchIndex;
1190  Rpp32u* inc;
1191  Rpp32u* dstInc;
1192  hipMemRpp32f scratchBufferPinned;
1193 } memGPU;
1194 
1198 typedef struct
1199 {
1200  memCPU mcpu;
1201  memGPU mgpu;
1202 } memMgmt;
1203 
1204 #else
1205 
1209 typedef struct
1210 {
1211  memCPU mcpu;
1212 } memMgmt;
1213 
1214 #endif //BACKEND
1215 
1219 typedef struct
1220 {
1221  RppPtr_t cpuHandle;
1222  Rpp32u nbatchSize;
1223  memMgmt mem;
1224 } InitHandle;
1225 
1226 #endif /* RPPDEFS_H */
unsigned int Rpp32u
32 bit unsigned int
Definition: rppdefs.h:102
int Rpp32s
32 bit signed int
Definition: rppdefs.h:104
signed char Rpp8s
8 bit signed char
Definition: rppdefs.h:96
RppiChnFormat
RPPI Image channel format type enum.
Definition: rppdefs.h:369
RpptMelScaleFormula
RPPT Mel Scale Formula.
Definition: rppdefs.h:497
unsigned short Rpp16u
16 bit unsigned short
Definition: rppdefs.h:98
unsigned char Rpp8u
8 bit unsigned char
Definition: rppdefs.h:94
void * RppPtr_t
void pointer
Definition: rppdefs.h:114
RpptLayout
RPPT Tensor layout type enum.
Definition: rppdefs.h:412
RpptRoiType
RPPT Tensor 2D ROI type enum.
Definition: rppdefs.h:426
RpptDataType
RPPT Tensor datatype enum.
Definition: rppdefs.h:400
RpptImageBorderType
RPPT Image Border Type.
Definition: rppdefs.h:487
struct RpptResamplingWindow RpptResamplingWindow
RPPT Tensor RpptResamplingWindow type struct.
double Rpp64f
64 bit double
Definition: rppdefs.h:112
RpptImageBorderEdge
RPPT Image Border Edge type enum.
Definition: rppdefs.h:476
RpptAudioBorderType
RPPT Audio Border Type.
Definition: rppdefs.h:466
size_t RppSize_t
size_t
Definition: rppdefs.h:116
struct GenericFilter GenericFilter
RPPT Tensor GenericFilter type struct.
RppStatus
RPP RppStatus type enums.
Definition: rppdefs.h:122
RpptRoi3DType
RPPT Tensor 3D ROI type enum.
Definition: rppdefs.h:435
unsigned long long Rpp64u
64 bit unsigned long long
Definition: rppdefs.h:106
#define RPPT_MAX_DIMS
RPP maximum dimensions in tensor .
Definition: rppdefs.h:65
RpptInterpolationType
RPPT Tensor interpolation type enum.
Definition: rppdefs.h:453
RpptSubpixelLayout
RPPT Tensor subpixel layout type enum.
Definition: rppdefs.h:444
short Rpp16s
16 bit signed short
Definition: rppdefs.h:100
float Rpp32f
32 bit float
Definition: rppdefs.h:110
RppBackend
RPP RppBackend type enums.
Definition: rppdefs.h:183
long long Rpp64s
64 bit long long
Definition: rppdefs.h:108
rppStatus_t
RPP rppStatus_t type enums.
Definition: rppdefs.h:193
@ RPP_ERROR_NOT_IMPLEMENTED
Function variant requested is not implemented / unsupported.
Definition: rppdefs.h:136
@ RPP_ERROR_INVALID_DST_DATATYPE
Invalid dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:148
@ RPP_ERROR_INVALID_OUTPUT_TILE_LENGTH
Invalid output tile length (Needs to adhere to function specification.)
Definition: rppdefs.h:164
@ RPP_ERROR_INVALID_DIM_LENGTHS
Length in some dimensions are invalid. (Needs to adhere to function specification....
Definition: rppdefs.h:174
@ RPP_ERROR_OUT_OF_BOUND_SRC_ROI
Out of bound source ROI.
Definition: rppdefs.h:158
@ RPP_ERROR_OUT_OF_BOUND_SHARED_MEMORY_SIZE
Shared memory size needed is beyond the bounds (Needs to adhere to function specification....
Definition: rppdefs.h:166
@ RPP_ERROR_ZERO_DIVISION
Arguments provided will result in zero division error.
Definition: rppdefs.h:132
@ RPP_ERROR_INVALID_ARGUMENTS
One or more arguments invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:128
@ RPP_ERROR_LAYOUT_MISMATCH
src and dst layout mismatch
Definition: rppdefs.h:160
@ RPP_ERROR_INVALID_CHANNELS
Number of channels is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:162
@ RPP_ERROR_INVALID_SRC_CHANNELS
Invalid src tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:138
@ RPP_ERROR_INVALID_SRC_OR_DST_DATATYPE
Invalid src/dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:150
@ RPP_ERROR_INVALID_PARAMETER_DATATYPE
Invalid datatype.
Definition: rppdefs.h:154
@ RPP_ERROR_NOT_ENOUGH_MEMORY
Not enough memory to write outputs, as per dim-lengths and strides set in descriptor.
Definition: rppdefs.h:156
@ RPP_ERROR
Unspecified error.
Definition: rppdefs.h:126
@ RPP_ERROR_INVALID_SRC_DIMS
Number of src dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:170
@ RPP_ERROR_OUT_OF_BOUND_SCRATCH_MEMORY_SIZE
Scratch memory size needed is beyond the bounds (Needs to adhere to function specification....
Definition: rppdefs.h:168
@ RPP_ERROR_INVALID_DST_LAYOUT
Invalid dst tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:144
@ RPP_ERROR_INVALID_AXIS
The specified axis is invalid or out of range. (Needs to adhere to function specification....
Definition: rppdefs.h:176
@ RPP_ERROR_INVALID_DST_CHANNELS
Invalid dst tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:140
@ RPP_ERROR_INVALID_SRC_DATATYPE
Invalid src tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:146
@ RPP_ERROR_INVALID_SRC_LAYOUT
Invalid src tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:142
@ RPP_ERROR_HIGH_SRC_DIMENSION
Src tensor / src ROI dimension too high. (Needs to adhere to function specification....
Definition: rppdefs.h:134
@ RPP_SUCCESS
No error.
Definition: rppdefs.h:124
@ RPP_ERROR_INSUFFICIENT_DST_BUFFER_LENGTH
Insufficient dst buffer length provided. (Needs to adhere to function specification....
Definition: rppdefs.h:152
@ RPP_ERROR_INVALID_DST_DIMS
Number of dst dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:172
@ RPP_ERROR_LOW_OFFSET
Low tensor offsetInBytes provided for src/dst tensor.
Definition: rppdefs.h:130
Base class for Mel scale conversions.
Definition: rppdefs.h:818
RPPT Tensor GenericFilter type struct.
Definition: rppdefs.h:717
Derived class for HTK Mel scale conversions.
Definition: rppdefs.h:829
RPP initialize handle.
Definition: rppdefs.h:1220
RPP 24 float vector.
Definition: rppdefs.h:286
RPP 6 float vector.
Definition: rppdefs.h:262
RPP 9 float vector.
Definition: rppdefs.h:270
RPP 24 signed int vector.
Definition: rppdefs.h:278
RPP layout params.
Definition: rppdefs.h:253
RPPI Image 2D ROI (XYWH format) type struct.
Definition: rppdefs.h:387
RPPI Image size(Width/Height dimensions) type struct.
Definition: rppdefs.h:378
RPPT Tensor 2D bilinear neighborhood 32-bit signed int 8-length-vectors type struct.
Definition: rppdefs.h:695
RPPT Tensor 2D bilinear neighborhood 32-bit float 8-length-vectors type struct.
Definition: rppdefs.h:706
RPPT Tensor Channel Offsets struct.
Definition: rppdefs.h:534
RPPT Tensor descriptor type struct.
Definition: rppdefs.h:604
RPPT Tensor 32-bit float RGB type struct.
Definition: rppdefs.h:640
RPPT Tensor 2D 32-bit float vector type struct.
Definition: rppdefs.h:659
RPPT Tensor Generic descriptor type struct.
Definition: rppdefs.h:617
RPPT Tensor 2D image patch dimensions type struct.
Definition: rppdefs.h:668
RPPT Image 2D cartesian point type struct.
Definition: rppdefs.h:506
RPPT Image 3D point type struct.
Definition: rppdefs.h:515
RPPT Tensor 8-bit uchar RGB type struct.
Definition: rppdefs.h:630
RPPT Tensor RpptResamplingWindow type struct.
Definition: rppdefs.h:774
RPPT Tensor 3D ROI LTFRBB struct.
Definition: rppdefs.h:544
RPPT Tensor 2D ROI LTRB struct.
Definition: rppdefs.h:525
RPPT Tensor 2D ROI XYWH struct.
Definition: rppdefs.h:553
RPPT Tensor 3D ROI XYZWHD struct.
Definition: rppdefs.h:563
RPPT Tensor strides type struct.
Definition: rppdefs.h:593
RPPT Tensor 2D 32-bit uint vector type struct.
Definition: rppdefs.h:650
RPPT Tensor random number generator state (xorwow box muller state) type struct.
Definition: rppdefs.h:685
RPPT Tensor random number generator state (xorwow state) type struct.
Definition: rppdefs.h:677
Derived class for Slaney Mel scale conversions.
Definition: rppdefs.h:840
RPP HIP 2D ROI memory.
Definition: rppdefs.h:1157
RPP HIP 32-bit float memory.
Definition: rppdefs.h:1092
RPP HIP 32-bit signed int memory.
Definition: rppdefs.h:1116
RPP HIP 32-bit unsigned int memory.
Definition: rppdefs.h:1108
RPP HIP 64-bit double memory.
Definition: rppdefs.h:1100
RPP HIP 8-bit signed char memory.
Definition: rppdefs.h:1132
RPP HIP 8-bit unsigned char memory.
Definition: rppdefs.h:1124
RPP HIP RGB memory.
Definition: rppdefs.h:1140
RPP HIP 2D dimensions memory.
Definition: rppdefs.h:1148
RPP HOST memory type struct.
Definition: rppdefs.h:956
RPP OCL memory management type struct.
Definition: rppdefs.h:1168
RPP HIP-HOST memory management.
Definition: rppdefs.h:1199
RPP HOST 2D ROI memory.
Definition: rppdefs.h:946
RPP HOST 32-bit float memory.
Definition: rppdefs.h:881
RPP HOST 32-bit signed int memory.
Definition: rppdefs.h:905
RPP HOST 32-bit unsigned int memory.
Definition: rppdefs.h:897
RPP HOST 64-bit double memory.
Definition: rppdefs.h:889
RPP HOST 8-bit signed char memory.
Definition: rppdefs.h:921
RPP HOST 8-bit unsigned char memory.
Definition: rppdefs.h:913
RPP HOST RGB memory.
Definition: rppdefs.h:929
RPP HOST 2D dimensions memory.
Definition: rppdefs.h:937
RPPT Tensor 3D ROI union.
Definition: rppdefs.h:583
RPPT Tensor 2D ROI union.
Definition: rppdefs.h:573