/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 TWO_OVER_3 = 2.0f / 3;
87 const float ONE_OVER_255 = 1.0f / 255;
88 const uint MMS_MAX_SCRATCH_MEMORY = 115293120; // maximum scratch memory size (in number of floats) needed for MMS buffer in RNNT training
89 const uint SPECTROGRAM_MAX_SCRATCH_MEMORY = 372877312; // maximum scratch memory size (in number of floats) needed for spectrogram HIP kernel in RNNT training
90 #define DROPOUT_FIXED_SEED 42 // Constant fixed seed for reproducing the dropout output
91 
92 /******************** RPP typedefs ********************/
93 
95 typedef unsigned char Rpp8u;
97 typedef signed char Rpp8s;
99 typedef unsigned short Rpp16u;
101 typedef short Rpp16s;
103 typedef unsigned int Rpp32u;
105 typedef int Rpp32s;
107 typedef unsigned long long Rpp64u;
109 typedef long long Rpp64s;
111 typedef float Rpp32f;
113 typedef double Rpp64f;
115 typedef void* RppPtr_t;
117 typedef size_t RppSize_t;
118 
122 typedef enum
123 {
127  RPP_ERROR = -1,
179 
183 typedef enum
184 {
185  RPP_HOST_BACKEND,
186  RPP_HIP_BACKEND,
187  RPP_OCL_BACKEND
188 } RppBackend;
189 
193 typedef enum
194 {
195  rppStatusSuccess = 0,
196  rppStatusBadParm = -1,
197  rppStatusUnknownError = -2,
198  rppStatusNotInitialized = -3,
199  rppStatusInvalidValue = -4,
200  rppStatusAllocFailed = -5,
201  rppStatusInternalError = -6,
202  rppStatusNotImplemented = -7,
203  rppStatusUnsupportedOp = -8,
204 } rppStatus_t;
205 
206 #ifdef LEGACY_SUPPORT
210 typedef enum
211 {
212  RPP_SCALAR_OP_AND = 1,
213  RPP_SCALAR_OP_OR,
214  RPP_SCALAR_OP_XOR,
215  RPP_SCALAR_OP_NAND,
216  RPP_SCALAR_OP_EQUAL,
217  RPP_SCALAR_OP_NOTEQUAL,
218  RPP_SCALAR_OP_LESS,
219  RPP_SCALAR_OP_LESSEQ,
220  RPP_SCALAR_OP_GREATER,
221  RPP_SCALAR_OP_GREATEREQ,
222  RPP_SCALAR_OP_ADD,
223  RPP_SCALAR_OP_SUBTRACT,
224  RPP_SCALAR_OP_MULTIPLY,
225  RPP_SCALAR_OP_DIVIDE,
226  RPP_SCALAR_OP_MODULUS,
227  RPP_SCALAR_OP_MIN,
228  RPP_SCALAR_OP_MAX,
229 } RppOp;
230 
234 typedef enum
235 {
236  U8_S8,
237  S8_U8,
238 } RppConvertBitDepthMode;
239 
243 typedef struct
244 {
245  Rpp32f rho;
246  Rpp32f theta;
247 } RppPointPolar;
248 #endif
249 
253 typedef struct
254 {
255  Rpp32u channelParam;
256  Rpp32u bufferMultiplier;
258 
262 typedef struct
263 {
264  Rpp32f data[6];
265 } Rpp32f6;
266 
270 typedef struct
271 {
272  Rpp32f data[9];
273 } Rpp32f9;
274 
278 typedef struct
279 {
280  Rpp32s data[24];
281 } Rpp32s24;
282 
286 typedef struct
287 {
288  Rpp32f data[24];
289 } Rpp32f24;
290 
291 /******************** RPPI typedefs ********************/
292 
293 #ifdef LEGACY_SUPPORT
297 typedef enum
298 {
299  RGB_HSV = 1,
300  HSV_RGB
301 } RppiColorConvertMode;
302 
306 typedef enum
307 {
308  RPPI_LOW,
309  RPPI_MEDIUM,
310  RPPI_HIGH
311 } RppiFuzzyLevel;
312 
316 typedef enum
317 {
318  RPPI_HORIZONTAL_AXIS,
319  RPPI_VERTICAL_AXIS,
320  RPPI_BOTH_AXIS
321 } RppiAxis;
322 
326 typedef enum
327 {
328  GAUSS3,
329  GAUSS5,
330  GAUSS3x1,
331  GAUSS1x3,
332  AVG3 = 10,
333  AVG5
334 } RppiBlur;
335 
339 typedef enum
340 {
341  ZEROPAD,
342  NOPAD
343 } RppiPad;
344 
348 typedef enum
349 {
350  RGB,
351  HSV
352 } RppiFormat;
353 
357 typedef struct
358 {
359  int x;
360  int y;
361  int width;
362  int height;
363 } RppiRect;
364 #endif
365 
369 typedef enum
370 {
371  RPPI_CHN_PLANAR,
372  RPPI_CHN_PACKED
373 } RppiChnFormat;
374 
378 typedef struct
379 {
380  unsigned int width;
381  unsigned int height;
382 } RppiSize;
383 
387 typedef struct
388 {
389  unsigned int x;
390  unsigned int y;
391  unsigned int roiWidth;
392  unsigned int roiHeight;
393 } RppiROI;
394 
395 /******************** RPPT typedefs ********************/
396 
400 typedef enum
401 {
402  U8,
403  F32,
404  F16,
405  I8,
406  I16
407 } RpptDataType;
408 
412 typedef enum
413 {
414  NCHW, // BatchSize-Channels-Height-Width
415  NHWC, // BatchSize-Height-Width-Channels
416  NCDHW, // BatchSize-Channels-Depth-Height-Width
417  NDHWC, // BatchSize-Depth-Height-Width-Channels
418  NHW, // BatchSize-Height-Width
419  NFT, // BatchSize-Frequency-Time -> Frequency Major used for Spectrogram / MelfilterBank
420  NTF // BatchSize-Time-Frequency -> Time Major used for Spectrogram / MelfilterBank
421 } RpptLayout;
422 
426 typedef enum
427 {
428  LTRB, // Left-Top-Right-Bottom
429  XYWH // X-Y-Width-Height
430 } RpptRoiType;
431 
435 typedef enum
436 {
437  LTFRBB, // Left-Top-Front-Right-Bottom-Back
438  XYZWHD // X-Y-Z-Width-Height-Depth
439 } RpptRoi3DType;
440 
444 typedef enum
445 {
446  RGBtype,
447  BGRtype
449 
453 typedef enum
454 {
455  NEAREST_NEIGHBOR = 0,
456  BILINEAR,
457  BICUBIC,
458  LANCZOS,
459  GAUSSIAN,
460  TRIANGULAR
462 
466 typedef enum
467 {
468  ZERO = 0,
469  CLAMP,
470  REFLECT
472 
476 typedef enum
477 {
478  TOP_EDGE = 0,
479  BOTTOM_EDGE,
480  LEFT_EDGE,
481  RIGHT_EDGE
483 
487 typedef enum
488 {
489  REPLICATE = 0, // Similar to Nearest Neighbors Padding
490  CONSTANT, // Unsupported Border Type
491  REFLECT_NO_EDGE // Unsupported Border Type
493 
497 typedef enum
498 {
499  SLANEY = 0, // Follows Slaney’s MATLAB Auditory Modelling Work behavior
500  HTK, // Follows O’Shaughnessy’s book formula, consistent with Hidden Markov Toolkit(HTK), m = 2595 * log10(1 + (f/700))
502 
506 typedef struct
507 {
508  int x;
509  int y;
510 } RpptPoint2D;
511 
515 typedef struct
516 {
517  int x;
518  int y;
519  int z;
520 } RpptPoint3D;
521 
525 typedef struct
526 {
527  RpptPoint2D lt, rb; // Left-Top point and Right-Bottom point
528 
529 } RpptRoiLtrb;
530 
534 typedef struct
535 {
536  RpptPoint2D r;
537  RpptPoint2D g;
538  RpptPoint2D b;
540 
544 typedef struct
545 {
546  RpptPoint3D ltf, rbb; // Left-Top-Front point and Right-Bottom-Back point
547 
548 } RpptRoiLtfrbb;
549 
553 typedef struct
554 {
555  RpptPoint2D xy;
556  int roiWidth, roiHeight;
557 
558 } RpptRoiXywh;
559 
563 typedef struct
564 {
565  RpptPoint3D xyz;
566  int roiWidth, roiHeight, roiDepth;
567 
568 } RpptRoiXyzwhd;
569 
573 typedef union
574 {
575  RpptRoiLtrb ltrbROI; // ROI defined as Left-Top-Right-Bottom
576  RpptRoiXywh xywhROI; // ROI defined as X-Y-Width-Height
577 
578 } RpptROI, *RpptROIPtr;
579 
583 typedef union
584 {
585  RpptRoiLtfrbb ltfrbbROI; // ROI defined as Left-Top-Front-Right-Bottom-Back
586  RpptRoiXyzwhd xyzwhdROI; // ROI defined as X-Y-Z-Width-Height-Depth
587 
589 
593 typedef struct
594 {
595  Rpp32u nStride;
596  Rpp32u cStride;
597  Rpp32u hStride;
598  Rpp32u wStride;
599 } RpptStrides;
600 
604 typedef struct
605 {
606  RppSize_t numDims;
607  Rpp32u offsetInBytes;
608  RpptDataType dataType;
609  Rpp32u n, c, h, w;
610  RpptStrides strides;
611  RpptLayout layout;
613 
617 typedef struct
618 {
619  RppSize_t numDims;
620  Rpp32u offsetInBytes;
621  RpptDataType dataType;
622  Rpp32u dims[RPPT_MAX_DIMS];
623  Rpp32u strides[RPPT_MAX_DIMS];
624  RpptLayout layout;
626 
630 typedef struct
631 {
632  Rpp8u R;
633  Rpp8u G;
634  Rpp8u B;
635 } RpptRGB;
636 
640 typedef struct
641 {
642  Rpp32f R;
643  Rpp32f G;
644  Rpp32f B;
645 } RpptFloatRGB;
646 
650 typedef struct
651 {
652  Rpp32u x;
653  Rpp32u y;
655 
659 typedef struct
660 {
661  Rpp32f x;
662  Rpp32f y;
664 
668 typedef struct
669 {
670  Rpp32u width;
671  Rpp32u height;
673 
677 typedef struct
678 { Rpp32u x[5];
679  Rpp32u counter;
681 
685 typedef struct
686 { Rpp32s x[5];
687  Rpp32s counter;
688  int boxMullerFlag;
689  float boxMullerExtra;
691 
695 typedef struct
696 {
697  Rpp32s24 srcLocsTL;
698  Rpp32s24 srcLocsTR;
699  Rpp32s24 srcLocsBL;
700  Rpp32s24 srcLocsBR;
702 
706 typedef struct
707 {
708  Rpp32f24 srcValsTL;
709  Rpp32f24 srcValsTR;
710  Rpp32f24 srcValsBL;
711  Rpp32f24 srcValsBR;
713 
717 typedef struct GenericFilter
718 {
719  Rpp32f scale = 1.0f;
720  Rpp32f radius = 1.0f;
721  Rpp32s size;
722  GenericFilter(RpptInterpolationType interpolationType, Rpp32s in_size, Rpp32s out_size, Rpp32f scaleRatio)
723  {
724  switch(interpolationType)
725  {
726  case RpptInterpolationType::BICUBIC:
727  {
728  this->radius = 2.0f;
729  break;
730  }
731  case RpptInterpolationType::LANCZOS:
732  {
733  if(in_size > out_size)
734  {
735  this->radius = 3.0f * scaleRatio;
736  this->scale = (1 / scaleRatio);
737  }
738  else
739  this->radius = 3.0f;
740  break;
741  }
742  case RpptInterpolationType::GAUSSIAN:
743  {
744  if(in_size > out_size)
745  {
746  this->radius = scaleRatio;
747  this->scale = (1 / scaleRatio);
748  }
749  break;
750  }
751  case RpptInterpolationType::TRIANGULAR:
752  {
753  if(in_size > out_size)
754  {
755  this->radius = scaleRatio;
756  this->scale = (1 / scaleRatio);
757  }
758  break;
759  }
760  default:
761  {
762  this->radius = 1.0f;
763  this->scale = 1.0f;
764  break;
765  }
766  }
767  this->size = std::ceil(2 * this->radius);
768  }
770 
774 typedef struct RpptResamplingWindow
775 {
776  inline RPP_HOST_DEVICE void input_range(Rpp32f x, Rpp32s *loc0, Rpp32s *loc1)
777  {
778  Rpp32s xc = std::ceil(x);
779  *loc0 = xc - lobes;
780  *loc1 = xc + lobes;
781  }
782 
783  inline Rpp32f operator()(Rpp32f x)
784  {
785  Rpp32f locRaw = x * scale + center;
786  Rpp32s locFloor = std::floor(locRaw);
787  Rpp32f weight = locRaw - locFloor;
788  locFloor = std::max(std::min(locFloor, lookupSize - 2), 0);
789  Rpp32f current = lookup[locFloor];
790  Rpp32f next = lookup[locFloor + 1];
791  return current + weight * (next - current);
792  }
793 
794  inline __m128 operator()(__m128 x)
795  {
796  __m128 pLocRaw = _mm_add_ps(_mm_mul_ps(x, pScale), pCenter);
797  __m128i pxLocFloor = _mm_cvttps_epi32(pLocRaw);
798  __m128 pLocFloor = _mm_cvtepi32_ps(pxLocFloor);
799  __m128 pWeight = _mm_sub_ps(pLocRaw, pLocFloor);
800  Rpp32s idx[4];
801  _mm_storeu_si128(reinterpret_cast<__m128i*>(idx), pxLocFloor);
802  __m128 pCurrent = _mm_setr_ps(lookup[idx[0]], lookup[idx[1]], lookup[idx[2]], lookup[idx[3]]);
803  __m128 pNext = _mm_setr_ps(lookup[idx[0] + 1], lookup[idx[1] + 1], lookup[idx[2] + 1], lookup[idx[3] + 1]);
804  return _mm_add_ps(pCurrent, _mm_mul_ps(pWeight, _mm_sub_ps(pNext, pCurrent)));
805  }
806 
807  Rpp32f scale = 1, center = 1;
808  Rpp32s lobes = 0, coeffs = 0;
809  Rpp32s lookupSize = 0;
810  Rpp32f *lookupPinned = nullptr;
811  std::vector<Rpp32f> lookup;
812  __m128 pCenter, pScale;
814 
819 {
820  public:
821  inline RPP_HOST_DEVICE virtual Rpp32f hz_to_mel(Rpp32f hz) = 0;
822  inline RPP_HOST_DEVICE virtual Rpp32f mel_to_hz(Rpp32f mel) = 0;
823  virtual ~BaseMelScale() = default;
824 };
825 
829 struct HtkMelScale : public BaseMelScale
830 {
831  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz) { return 1127.0f * std::log(1.0f + (hz / 700.0f)); }
832  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel) { return 700.0f * (std::exp(mel / 1127.0f) - 1.0f); }
833  public:
834  ~HtkMelScale() {};
835 };
836 
841 {
842  const Rpp32f freqLow = 0;
843  const Rpp32f fsp = 66.666667f;
844  const Rpp32f minLogHz = 1000.0;
845  const Rpp32f minLogMel = (minLogHz - freqLow) / fsp;
846  const Rpp32f stepLog = 0.068751777; // Equivalent to std::log(6.4) / 27.0;
847 
848  const Rpp32f invMinLogHz = 0.001f;
849  const Rpp32f invStepLog = 1.0f / stepLog;
850  const Rpp32f invFsp = 1.0f / fsp;
851 
852  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz)
853  {
854  Rpp32f mel = 0.0f;
855  if (hz >= minLogHz)
856  mel = minLogMel + std::log(hz * invMinLogHz) * invStepLog;
857  else
858  mel = (hz - freqLow) * invFsp;
859 
860  return mel;
861  }
862 
863  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel)
864  {
865  Rpp32f hz = 0.0f;
866  if (mel >= minLogMel)
867  hz = minLogHz * std::exp(stepLog * (mel - minLogMel));
868  else
869  hz = freqLow + mel * fsp;
870  return hz;
871  }
872  public:
873  ~SlaneyMelScale() {};
874 };
875 
876 /******************** HOST memory typedefs ********************/
877 
881 typedef struct
882 {
883  Rpp32f *floatmem;
884 } memRpp32f;
885 
889 typedef struct
890 {
891  Rpp64f *doublemem;
892 } memRpp64f;
893 
897 typedef struct
898 {
899  Rpp32u *uintmem;
900 } memRpp32u;
901 
905 typedef struct
906 {
907  Rpp32s *intmem;
908 } memRpp32s;
909 
913 typedef struct
914 {
915  Rpp8u *ucharmem;
916 } memRpp8u;
917 
921 typedef struct
922 {
923  Rpp8s *charmem;
924 } memRpp8s;
925 
929 typedef struct
930 {
931  RpptRGB* rgbmem;
932 } memRpptRGB;
933 
937 typedef struct
938 {
939  Rpp32u *height;
940  Rpp32u *width;
941 } memSize;
942 
946 typedef struct
947 {
948  Rpp32u *x;
949  Rpp32u *y;
950  Rpp32u *roiHeight;
951  Rpp32u *roiWidth;
952 } memROI;
953 
957 typedef struct {
958  RppiSize *srcSize;
959  RppiSize *dstSize;
960  RppiSize *maxSrcSize;
961  RppiSize *maxDstSize;
962  RppiROI *roiPoints;
963  memRpp32f floatArr[10];
964  memRpp64f doubleArr[10];
965  memRpp32u uintArr[10];
966  memRpp32s intArr[10];
967  memRpp8u ucharArr[10];
968  memRpp8s charArr[10];
969  memRpptRGB rgbArr;
970  Rpp64u *srcBatchIndex;
971  Rpp64u *dstBatchIndex;
972  Rpp32u *inc;
973  Rpp32u *dstInc;
974  Rpp32f *scratchBufferHost;
975 } memCPU;
976 
977 #ifdef OCL_COMPILE
978 
979 /******************** OCL memory typedefs ********************/
980 
984 typedef struct
985 {
986  cl_mem floatmem;
987 } clmemRpp32f;
988 
992 typedef struct
993 {
994  cl_mem doublemem;
995 } clmemRpp64f;
996 
1000 typedef struct
1001 {
1002  cl_mem uintmem;
1003 } clmemRpp32u;
1004 
1008 typedef struct
1009 {
1010  cl_mem intmem;
1011 } clmemRpp32s;
1012 
1016 typedef struct
1017 {
1018  cl_mem ucharmem;
1019 } clmemRpp8u;
1020 
1024 typedef struct
1025 {
1026  cl_mem charmem;
1027 } clmemRpp8s;
1028 
1032 typedef struct
1033 {
1034  cl_mem height;
1035  cl_mem width;
1036 } clmemSize;
1037 
1041 typedef struct
1042 {
1043  cl_mem x;
1044  cl_mem y;
1045  cl_mem roiHeight;
1046  cl_mem roiWidth;
1047 } clmemROI;
1048 
1052 typedef struct
1053 {
1054  memSize csrcSize;
1055  memSize cdstSize;
1056  memSize cmaxSrcSize;
1057  memSize cmaxDstSize;
1058  memROI croiPoints;
1059  clmemSize srcSize;
1060  clmemSize dstSize;
1061  clmemSize maxSrcSize;
1062  clmemSize maxDstSize;
1063  clmemROI roiPoints;
1064  clmemRpp32f floatArr[10];
1065  clmemRpp64f doubleArr[10];
1066  clmemRpp32u uintArr[10];
1067  clmemRpp32s intArr[10];
1068  clmemRpp8u ucharArr[10];
1069  clmemRpp8s charArr[10];
1070  cl_mem srcBatchIndex;
1071  cl_mem dstBatchIndex;
1072  cl_mem inc;
1073  cl_mem dstInc;
1074 } memGPU;
1075 
1079 typedef struct
1080 {
1081  memCPU mcpu;
1082  memGPU mgpu;
1083 } memMgmt;
1084 
1085 #elif defined(HIP_COMPILE)
1086 
1087 /******************** HIP memory typedefs ********************/
1088 
1092 typedef struct
1093 {
1094  Rpp32f* floatmem;
1095 } hipMemRpp32f;
1096 
1100 typedef struct
1101 {
1102  Rpp64f* doublemem;
1103 } hipMemRpp64f;
1104 
1108 typedef struct
1109 {
1110  Rpp32u* uintmem;
1111 } hipMemRpp32u;
1112 
1116 typedef struct
1117 {
1118  Rpp32s* intmem;
1119 } hipMemRpp32s;
1120 
1124 typedef struct
1125 {
1126  Rpp8u* ucharmem;
1127 } hipMemRpp8u;
1128 
1132 typedef struct
1133 {
1134  Rpp8s* charmem;
1135 } hipMemRpp8s;
1136 
1140 typedef struct
1141 {
1142  RpptRGB* rgbmem;
1143 } hipMemRpptRGB;
1144 
1148 typedef struct
1149 {
1150  Rpp32u* height;
1151  Rpp32u* width;
1152 } hipMemSize;
1153 
1157 typedef struct
1158 {
1159  Rpp32u* x;
1160  Rpp32u* y;
1161  Rpp32u* roiHeight;
1162  Rpp32u* roiWidth;
1163 } hipMemROI;
1164 
1168 typedef struct
1169 {
1170  memSize csrcSize;
1171  memSize cdstSize;
1172  memSize cmaxSrcSize;
1173  memSize cmaxDstSize;
1174  memROI croiPoints;
1175  hipMemSize srcSize;
1176  hipMemSize dstSize;
1177  hipMemSize maxSrcSize;
1178  hipMemSize maxDstSize;
1179  hipMemROI roiPoints;
1180  hipMemRpp32f floatArr[10];
1181  hipMemRpp32f float3Arr[10];
1182  hipMemRpp64f doubleArr[10];
1183  hipMemRpp32u uintArr[10];
1184  hipMemRpp32s intArr[10];
1185  hipMemRpp8u ucharArr[10];
1186  hipMemRpp8s charArr[10];
1187  hipMemRpptRGB rgbArr;
1188  hipMemRpp32f scratchBufferHip;
1189  Rpp64u* srcBatchIndex;
1190  Rpp64u* dstBatchIndex;
1191  Rpp32u* inc;
1192  Rpp32u* dstInc;
1193  hipMemRpp32f scratchBufferPinned;
1194 } memGPU;
1195 
1199 typedef struct
1200 {
1201  memCPU mcpu;
1202  memGPU mgpu;
1203 } memMgmt;
1204 
1205 #else
1206 
1210 typedef struct
1211 {
1212  memCPU mcpu;
1213 } memMgmt;
1214 
1215 #endif //BACKEND
1216 
1220 typedef struct
1221 {
1222  RppPtr_t cpuHandle;
1223  Rpp32u nbatchSize;
1224  memMgmt mem;
1225 } InitHandle;
1226 
1227 #endif /* RPPDEFS_H */
unsigned int Rpp32u
32 bit unsigned int
Definition: rppdefs.h:103
int Rpp32s
32 bit signed int
Definition: rppdefs.h:105
signed char Rpp8s
8 bit signed char
Definition: rppdefs.h:97
RppiChnFormat
RPPI Image channel format type enum.
Definition: rppdefs.h:370
RpptMelScaleFormula
RPPT Mel Scale Formula.
Definition: rppdefs.h:498
unsigned short Rpp16u
16 bit unsigned short
Definition: rppdefs.h:99
unsigned char Rpp8u
8 bit unsigned char
Definition: rppdefs.h:95
void * RppPtr_t
void pointer
Definition: rppdefs.h:115
RpptLayout
RPPT Tensor layout type enum.
Definition: rppdefs.h:413
RpptRoiType
RPPT Tensor 2D ROI type enum.
Definition: rppdefs.h:427
RpptDataType
RPPT Tensor datatype enum.
Definition: rppdefs.h:401
RpptImageBorderType
RPPT Image Border Type.
Definition: rppdefs.h:488
struct RpptResamplingWindow RpptResamplingWindow
RPPT Tensor RpptResamplingWindow type struct.
double Rpp64f
64 bit double
Definition: rppdefs.h:113
RpptImageBorderEdge
RPPT Image Border Edge type enum.
Definition: rppdefs.h:477
RpptAudioBorderType
RPPT Audio Border Type.
Definition: rppdefs.h:467
size_t RppSize_t
size_t
Definition: rppdefs.h:117
struct GenericFilter GenericFilter
RPPT Tensor GenericFilter type struct.
RppStatus
RPP RppStatus type enums.
Definition: rppdefs.h:123
RpptRoi3DType
RPPT Tensor 3D ROI type enum.
Definition: rppdefs.h:436
unsigned long long Rpp64u
64 bit unsigned long long
Definition: rppdefs.h:107
#define RPPT_MAX_DIMS
RPP maximum dimensions in tensor .
Definition: rppdefs.h:65
RpptInterpolationType
RPPT Tensor interpolation type enum.
Definition: rppdefs.h:454
RpptSubpixelLayout
RPPT Tensor subpixel layout type enum.
Definition: rppdefs.h:445
short Rpp16s
16 bit signed short
Definition: rppdefs.h:101
float Rpp32f
32 bit float
Definition: rppdefs.h:111
RppBackend
RPP RppBackend type enums.
Definition: rppdefs.h:184
long long Rpp64s
64 bit long long
Definition: rppdefs.h:109
rppStatus_t
RPP rppStatus_t type enums.
Definition: rppdefs.h:194
@ RPP_ERROR_NOT_IMPLEMENTED
Function variant requested is not implemented / unsupported.
Definition: rppdefs.h:137
@ RPP_ERROR_INVALID_DST_DATATYPE
Invalid dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:149
@ RPP_ERROR_INVALID_OUTPUT_TILE_LENGTH
Invalid output tile length (Needs to adhere to function specification.)
Definition: rppdefs.h:165
@ RPP_ERROR_INVALID_DIM_LENGTHS
Length in some dimensions are invalid. (Needs to adhere to function specification....
Definition: rppdefs.h:175
@ RPP_ERROR_OUT_OF_BOUND_SRC_ROI
Out of bound source ROI.
Definition: rppdefs.h:159
@ 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:167
@ RPP_ERROR_ZERO_DIVISION
Arguments provided will result in zero division error.
Definition: rppdefs.h:133
@ RPP_ERROR_INVALID_ARGUMENTS
One or more arguments invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:129
@ RPP_ERROR_LAYOUT_MISMATCH
src and dst layout mismatch
Definition: rppdefs.h:161
@ RPP_ERROR_INVALID_CHANNELS
Number of channels is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:163
@ RPP_ERROR_INVALID_SRC_CHANNELS
Invalid src tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:139
@ RPP_ERROR_INVALID_SRC_OR_DST_DATATYPE
Invalid src/dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:151
@ RPP_ERROR_INVALID_PARAMETER_DATATYPE
Invalid datatype.
Definition: rppdefs.h:155
@ RPP_ERROR_NOT_ENOUGH_MEMORY
Not enough memory to write outputs, as per dim-lengths and strides set in descriptor.
Definition: rppdefs.h:157
@ RPP_ERROR
Unspecified error.
Definition: rppdefs.h:127
@ RPP_ERROR_INVALID_SRC_DIMS
Number of src dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:171
@ 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:169
@ RPP_ERROR_INVALID_DST_LAYOUT
Invalid dst tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:145
@ RPP_ERROR_INVALID_AXIS
The specified axis is invalid or out of range. (Needs to adhere to function specification....
Definition: rppdefs.h:177
@ RPP_ERROR_INVALID_DST_CHANNELS
Invalid dst tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:141
@ RPP_ERROR_INVALID_SRC_DATATYPE
Invalid src tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:147
@ RPP_ERROR_INVALID_SRC_LAYOUT
Invalid src tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:143
@ RPP_ERROR_HIGH_SRC_DIMENSION
Src tensor / src ROI dimension too high. (Needs to adhere to function specification....
Definition: rppdefs.h:135
@ RPP_SUCCESS
No error.
Definition: rppdefs.h:125
@ RPP_ERROR_INSUFFICIENT_DST_BUFFER_LENGTH
Insufficient dst buffer length provided. (Needs to adhere to function specification....
Definition: rppdefs.h:153
@ RPP_ERROR_INVALID_DST_DIMS
Number of dst dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:173
@ RPP_ERROR_LOW_OFFSET
Low tensor offsetInBytes provided for src/dst tensor.
Definition: rppdefs.h:131
Base class for Mel scale conversions.
Definition: rppdefs.h:819
RPPT Tensor GenericFilter type struct.
Definition: rppdefs.h:718
Derived class for HTK Mel scale conversions.
Definition: rppdefs.h:830
RPP initialize handle.
Definition: rppdefs.h:1221
RPP 24 float vector.
Definition: rppdefs.h:287
RPP 6 float vector.
Definition: rppdefs.h:263
RPP 9 float vector.
Definition: rppdefs.h:271
RPP 24 signed int vector.
Definition: rppdefs.h:279
RPP layout params.
Definition: rppdefs.h:254
RPPI Image 2D ROI (XYWH format) type struct.
Definition: rppdefs.h:388
RPPI Image size(Width/Height dimensions) type struct.
Definition: rppdefs.h:379
RPPT Tensor 2D bilinear neighborhood 32-bit signed int 8-length-vectors type struct.
Definition: rppdefs.h:696
RPPT Tensor 2D bilinear neighborhood 32-bit float 8-length-vectors type struct.
Definition: rppdefs.h:707
RPPT Tensor Channel Offsets struct.
Definition: rppdefs.h:535
RPPT Tensor descriptor type struct.
Definition: rppdefs.h:605
RPPT Tensor 32-bit float RGB type struct.
Definition: rppdefs.h:641
RPPT Tensor 2D 32-bit float vector type struct.
Definition: rppdefs.h:660
RPPT Tensor Generic descriptor type struct.
Definition: rppdefs.h:618
RPPT Tensor 2D image patch dimensions type struct.
Definition: rppdefs.h:669
RPPT Image 2D cartesian point type struct.
Definition: rppdefs.h:507
RPPT Image 3D point type struct.
Definition: rppdefs.h:516
RPPT Tensor 8-bit uchar RGB type struct.
Definition: rppdefs.h:631
RPPT Tensor RpptResamplingWindow type struct.
Definition: rppdefs.h:775
RPPT Tensor 3D ROI LTFRBB struct.
Definition: rppdefs.h:545
RPPT Tensor 2D ROI LTRB struct.
Definition: rppdefs.h:526
RPPT Tensor 2D ROI XYWH struct.
Definition: rppdefs.h:554
RPPT Tensor 3D ROI XYZWHD struct.
Definition: rppdefs.h:564
RPPT Tensor strides type struct.
Definition: rppdefs.h:594
RPPT Tensor 2D 32-bit uint vector type struct.
Definition: rppdefs.h:651
RPPT Tensor random number generator state (xorwow box muller state) type struct.
Definition: rppdefs.h:686
RPPT Tensor random number generator state (xorwow state) type struct.
Definition: rppdefs.h:678
Derived class for Slaney Mel scale conversions.
Definition: rppdefs.h:841
RPP HIP 2D ROI memory.
Definition: rppdefs.h:1158
RPP HIP 32-bit float memory.
Definition: rppdefs.h:1093
RPP HIP 32-bit signed int memory.
Definition: rppdefs.h:1117
RPP HIP 32-bit unsigned int memory.
Definition: rppdefs.h:1109
RPP HIP 64-bit double memory.
Definition: rppdefs.h:1101
RPP HIP 8-bit signed char memory.
Definition: rppdefs.h:1133
RPP HIP 8-bit unsigned char memory.
Definition: rppdefs.h:1125
RPP HIP RGB memory.
Definition: rppdefs.h:1141
RPP HIP 2D dimensions memory.
Definition: rppdefs.h:1149
RPP HOST memory type struct.
Definition: rppdefs.h:957
RPP OCL memory management type struct.
Definition: rppdefs.h:1169
RPP HIP-HOST memory management.
Definition: rppdefs.h:1200
RPP HOST 2D ROI memory.
Definition: rppdefs.h:947
RPP HOST 32-bit float memory.
Definition: rppdefs.h:882
RPP HOST 32-bit signed int memory.
Definition: rppdefs.h:906
RPP HOST 32-bit unsigned int memory.
Definition: rppdefs.h:898
RPP HOST 64-bit double memory.
Definition: rppdefs.h:890
RPP HOST 8-bit signed char memory.
Definition: rppdefs.h:922
RPP HOST 8-bit unsigned char memory.
Definition: rppdefs.h:914
RPP HOST RGB memory.
Definition: rppdefs.h:930
RPP HOST 2D dimensions memory.
Definition: rppdefs.h:938
RPPT Tensor 3D ROI union.
Definition: rppdefs.h:584
RPPT Tensor 2D ROI union.
Definition: rppdefs.h:574