/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 
90 /******************** RPP typedefs ********************/
91 
93 typedef unsigned char Rpp8u;
95 typedef signed char Rpp8s;
97 typedef unsigned short Rpp16u;
99 typedef short Rpp16s;
101 typedef unsigned int Rpp32u;
103 typedef int Rpp32s;
105 typedef unsigned long long Rpp64u;
107 typedef long long Rpp64s;
109 typedef float Rpp32f;
111 typedef double Rpp64f;
113 typedef void* RppPtr_t;
115 typedef size_t RppSize_t;
116 
120 typedef enum
121 {
125  RPP_ERROR = -1,
177 
181 typedef enum
182 {
183  RPP_HOST_BACKEND,
184  RPP_HIP_BACKEND,
185  RPP_OCL_BACKEND
186 } RppBackend;
187 
191 typedef enum
192 {
193  rppStatusSuccess = 0,
194  rppStatusBadParm = -1,
195  rppStatusUnknownError = -2,
196  rppStatusNotInitialized = -3,
197  rppStatusInvalidValue = -4,
198  rppStatusAllocFailed = -5,
199  rppStatusInternalError = -6,
200  rppStatusNotImplemented = -7,
201  rppStatusUnsupportedOp = -8,
202 } rppStatus_t;
203 
204 #ifdef LEGACY_SUPPORT
208 typedef enum
209 {
210  RPP_SCALAR_OP_AND = 1,
211  RPP_SCALAR_OP_OR,
212  RPP_SCALAR_OP_XOR,
213  RPP_SCALAR_OP_NAND,
214  RPP_SCALAR_OP_EQUAL,
215  RPP_SCALAR_OP_NOTEQUAL,
216  RPP_SCALAR_OP_LESS,
217  RPP_SCALAR_OP_LESSEQ,
218  RPP_SCALAR_OP_GREATER,
219  RPP_SCALAR_OP_GREATEREQ,
220  RPP_SCALAR_OP_ADD,
221  RPP_SCALAR_OP_SUBTRACT,
222  RPP_SCALAR_OP_MULTIPLY,
223  RPP_SCALAR_OP_DIVIDE,
224  RPP_SCALAR_OP_MODULUS,
225  RPP_SCALAR_OP_MIN,
226  RPP_SCALAR_OP_MAX,
227 } RppOp;
228 
232 typedef enum
233 {
234  U8_S8,
235  S8_U8,
236 } RppConvertBitDepthMode;
237 
241 typedef struct
242 {
243  Rpp32f rho;
244  Rpp32f theta;
245 } RppPointPolar;
246 #endif
247 
251 typedef struct
252 {
253  Rpp32u channelParam;
254  Rpp32u bufferMultiplier;
256 
260 typedef struct
261 {
262  Rpp32f data[6];
263 } Rpp32f6;
264 
268 typedef struct
269 {
270  Rpp32f data[9];
271 } Rpp32f9;
272 
276 typedef struct
277 {
278  Rpp32s data[24];
279 } Rpp32s24;
280 
284 typedef struct
285 {
286  Rpp32f data[24];
287 } Rpp32f24;
288 
289 /******************** RPPI typedefs ********************/
290 
291 #ifdef LEGACY_SUPPORT
295 typedef enum
296 {
297  RGB_HSV = 1,
298  HSV_RGB
299 } RppiColorConvertMode;
300 
304 typedef enum
305 {
306  RPPI_LOW,
307  RPPI_MEDIUM,
308  RPPI_HIGH
309 } RppiFuzzyLevel;
310 
314 typedef enum
315 {
316  RPPI_HORIZONTAL_AXIS,
317  RPPI_VERTICAL_AXIS,
318  RPPI_BOTH_AXIS
319 } RppiAxis;
320 
324 typedef enum
325 {
326  GAUSS3,
327  GAUSS5,
328  GAUSS3x1,
329  GAUSS1x3,
330  AVG3 = 10,
331  AVG5
332 } RppiBlur;
333 
337 typedef enum
338 {
339  ZEROPAD,
340  NOPAD
341 } RppiPad;
342 
346 typedef enum
347 {
348  RGB,
349  HSV
350 } RppiFormat;
351 
355 typedef struct
356 {
357  int x;
358  int y;
359  int width;
360  int height;
361 } RppiRect;
362 #endif
363 
367 typedef enum
368 {
369  RPPI_CHN_PLANAR,
370  RPPI_CHN_PACKED
371 } RppiChnFormat;
372 
376 typedef struct
377 {
378  unsigned int width;
379  unsigned int height;
380 } RppiSize;
381 
385 typedef struct
386 {
387  unsigned int x;
388  unsigned int y;
389  unsigned int roiWidth;
390  unsigned int roiHeight;
391 } RppiROI;
392 
393 /******************** RPPT typedefs ********************/
394 
398 typedef enum
399 {
400  U8,
401  F32,
402  F16,
403  I8,
404  I16
405 } RpptDataType;
406 
410 typedef enum
411 {
412  NCHW, // BatchSize-Channels-Height-Width
413  NHWC, // BatchSize-Height-Width-Channels
414  NCDHW, // BatchSize-Channels-Depth-Height-Width
415  NDHWC, // BatchSize-Depth-Height-Width-Channels
416  NHW, // BatchSize-Height-Width
417  NFT, // BatchSize-Frequency-Time -> Frequency Major used for Spectrogram / MelfilterBank
418  NTF // BatchSize-Time-Frequency -> Time Major used for Spectrogram / MelfilterBank
419 } RpptLayout;
420 
424 typedef enum
425 {
426  LTRB, // Left-Top-Right-Bottom
427  XYWH // X-Y-Width-Height
428 } RpptRoiType;
429 
433 typedef enum
434 {
435  LTFRBB, // Left-Top-Front-Right-Bottom-Back
436  XYZWHD // X-Y-Z-Width-Height-Depth
437 } RpptRoi3DType;
438 
442 typedef enum
443 {
444  RGBtype,
445  BGRtype
447 
451 typedef enum
452 {
453  NEAREST_NEIGHBOR = 0,
454  BILINEAR,
455  BICUBIC,
456  LANCZOS,
457  GAUSSIAN,
458  TRIANGULAR
460 
464 typedef enum
465 {
466  ZERO = 0,
467  CLAMP,
468  REFLECT
470 
474 typedef enum
475 {
476  REPLICATE = 0, // Similar to Nearest Neighbors Padding
477  CONSTANT, // Unsupported Border Type
478  REFLECT_NO_EDGE // Unsupported Border Type
480 
484 typedef enum
485 {
486  SLANEY = 0, // Follows Slaney’s MATLAB Auditory Modelling Work behavior
487  HTK, // Follows O’Shaughnessy’s book formula, consistent with Hidden Markov Toolkit(HTK), m = 2595 * log10(1 + (f/700))
489 
493 typedef struct
494 {
495  int x;
496  int y;
497 } RpptPoint2D;
498 
502 typedef struct
503 {
504  int x;
505  int y;
506  int z;
507 } RpptPoint3D;
508 
512 typedef struct
513 {
514  RpptPoint2D lt, rb; // Left-Top point and Right-Bottom point
515 
516 } RpptRoiLtrb;
517 
521 typedef struct
522 {
523  RpptPoint2D r;
524  RpptPoint2D g;
525  RpptPoint2D b;
527 
531 typedef struct
532 {
533  RpptPoint3D ltf, rbb; // Left-Top-Front point and Right-Bottom-Back point
534 
535 } RpptRoiLtfrbb;
536 
540 typedef struct
541 {
542  RpptPoint2D xy;
543  int roiWidth, roiHeight;
544 
545 } RpptRoiXywh;
546 
550 typedef struct
551 {
552  RpptPoint3D xyz;
553  int roiWidth, roiHeight, roiDepth;
554 
555 } RpptRoiXyzwhd;
556 
560 typedef union
561 {
562  RpptRoiLtrb ltrbROI; // ROI defined as Left-Top-Right-Bottom
563  RpptRoiXywh xywhROI; // ROI defined as X-Y-Width-Height
564 
565 } RpptROI, *RpptROIPtr;
566 
570 typedef union
571 {
572  RpptRoiLtfrbb ltfrbbROI; // ROI defined as Left-Top-Front-Right-Bottom-Back
573  RpptRoiXyzwhd xyzwhdROI; // ROI defined as X-Y-Z-Width-Height-Depth
574 
576 
580 typedef struct
581 {
582  Rpp32u nStride;
583  Rpp32u cStride;
584  Rpp32u hStride;
585  Rpp32u wStride;
586 } RpptStrides;
587 
591 typedef struct
592 {
593  RppSize_t numDims;
594  Rpp32u offsetInBytes;
595  RpptDataType dataType;
596  Rpp32u n, c, h, w;
597  RpptStrides strides;
598  RpptLayout layout;
600 
604 typedef struct
605 {
606  RppSize_t numDims;
607  Rpp32u offsetInBytes;
608  RpptDataType dataType;
609  Rpp32u dims[RPPT_MAX_DIMS];
610  Rpp32u strides[RPPT_MAX_DIMS];
611  RpptLayout layout;
613 
617 typedef struct
618 {
619  Rpp8u R;
620  Rpp8u G;
621  Rpp8u B;
622 } RpptRGB;
623 
627 typedef struct
628 {
629  Rpp32f R;
630  Rpp32f G;
631  Rpp32f B;
632 } RpptFloatRGB;
633 
637 typedef struct
638 {
639  Rpp32u x;
640  Rpp32u y;
642 
646 typedef struct
647 {
648  Rpp32f x;
649  Rpp32f y;
651 
655 typedef struct
656 {
657  Rpp32u width;
658  Rpp32u height;
660 
664 typedef struct
665 { Rpp32u x[5];
666  Rpp32u counter;
668 
672 typedef struct
673 { Rpp32s x[5];
674  Rpp32s counter;
675  int boxMullerFlag;
676  float boxMullerExtra;
678 
682 typedef struct
683 {
684  Rpp32s24 srcLocsTL;
685  Rpp32s24 srcLocsTR;
686  Rpp32s24 srcLocsBL;
687  Rpp32s24 srcLocsBR;
689 
693 typedef struct
694 {
695  Rpp32f24 srcValsTL;
696  Rpp32f24 srcValsTR;
697  Rpp32f24 srcValsBL;
698  Rpp32f24 srcValsBR;
700 
704 typedef struct GenericFilter
705 {
706  Rpp32f scale = 1.0f;
707  Rpp32f radius = 1.0f;
708  Rpp32s size;
709  GenericFilter(RpptInterpolationType interpolationType, Rpp32s in_size, Rpp32s out_size, Rpp32f scaleRatio)
710  {
711  switch(interpolationType)
712  {
713  case RpptInterpolationType::BICUBIC:
714  {
715  this->radius = 2.0f;
716  break;
717  }
718  case RpptInterpolationType::LANCZOS:
719  {
720  if(in_size > out_size)
721  {
722  this->radius = 3.0f * scaleRatio;
723  this->scale = (1 / scaleRatio);
724  }
725  else
726  this->radius = 3.0f;
727  break;
728  }
729  case RpptInterpolationType::GAUSSIAN:
730  {
731  if(in_size > out_size)
732  {
733  this->radius = scaleRatio;
734  this->scale = (1 / scaleRatio);
735  }
736  break;
737  }
738  case RpptInterpolationType::TRIANGULAR:
739  {
740  if(in_size > out_size)
741  {
742  this->radius = scaleRatio;
743  this->scale = (1 / scaleRatio);
744  }
745  break;
746  }
747  default:
748  {
749  this->radius = 1.0f;
750  this->scale = 1.0f;
751  break;
752  }
753  }
754  this->size = std::ceil(2 * this->radius);
755  }
757 
761 typedef struct RpptResamplingWindow
762 {
763  inline RPP_HOST_DEVICE void input_range(Rpp32f x, Rpp32s *loc0, Rpp32s *loc1)
764  {
765  Rpp32s xc = std::ceil(x);
766  *loc0 = xc - lobes;
767  *loc1 = xc + lobes;
768  }
769 
770  inline Rpp32f operator()(Rpp32f x)
771  {
772  Rpp32f locRaw = x * scale + center;
773  Rpp32s locFloor = std::floor(locRaw);
774  Rpp32f weight = locRaw - locFloor;
775  locFloor = std::max(std::min(locFloor, lookupSize - 2), 0);
776  Rpp32f current = lookup[locFloor];
777  Rpp32f next = lookup[locFloor + 1];
778  return current + weight * (next - current);
779  }
780 
781  inline __m128 operator()(__m128 x)
782  {
783  __m128 pLocRaw = _mm_add_ps(_mm_mul_ps(x, pScale), pCenter);
784  __m128i pxLocFloor = _mm_cvttps_epi32(pLocRaw);
785  __m128 pLocFloor = _mm_cvtepi32_ps(pxLocFloor);
786  __m128 pWeight = _mm_sub_ps(pLocRaw, pLocFloor);
787  Rpp32s idx[4];
788  _mm_storeu_si128(reinterpret_cast<__m128i*>(idx), pxLocFloor);
789  __m128 pCurrent = _mm_setr_ps(lookup[idx[0]], lookup[idx[1]], lookup[idx[2]], lookup[idx[3]]);
790  __m128 pNext = _mm_setr_ps(lookup[idx[0] + 1], lookup[idx[1] + 1], lookup[idx[2] + 1], lookup[idx[3] + 1]);
791  return _mm_add_ps(pCurrent, _mm_mul_ps(pWeight, _mm_sub_ps(pNext, pCurrent)));
792  }
793 
794  Rpp32f scale = 1, center = 1;
795  Rpp32s lobes = 0, coeffs = 0;
796  Rpp32s lookupSize = 0;
797  Rpp32f *lookupPinned = nullptr;
798  std::vector<Rpp32f> lookup;
799  __m128 pCenter, pScale;
801 
806 {
807  public:
808  inline RPP_HOST_DEVICE virtual Rpp32f hz_to_mel(Rpp32f hz) = 0;
809  inline RPP_HOST_DEVICE virtual Rpp32f mel_to_hz(Rpp32f mel) = 0;
810  virtual ~BaseMelScale() = default;
811 };
812 
816 struct HtkMelScale : public BaseMelScale
817 {
818  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz) { return 1127.0f * std::log(1.0f + (hz / 700.0f)); }
819  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel) { return 700.0f * (std::exp(mel / 1127.0f) - 1.0f); }
820  public:
821  ~HtkMelScale() {};
822 };
823 
828 {
829  const Rpp32f freqLow = 0;
830  const Rpp32f fsp = 66.666667f;
831  const Rpp32f minLogHz = 1000.0;
832  const Rpp32f minLogMel = (minLogHz - freqLow) / fsp;
833  const Rpp32f stepLog = 0.068751777; // Equivalent to std::log(6.4) / 27.0;
834 
835  const Rpp32f invMinLogHz = 0.001f;
836  const Rpp32f invStepLog = 1.0f / stepLog;
837  const Rpp32f invFsp = 1.0f / fsp;
838 
839  inline RPP_HOST_DEVICE Rpp32f hz_to_mel(Rpp32f hz)
840  {
841  Rpp32f mel = 0.0f;
842  if (hz >= minLogHz)
843  mel = minLogMel + std::log(hz * invMinLogHz) * invStepLog;
844  else
845  mel = (hz - freqLow) * invFsp;
846 
847  return mel;
848  }
849 
850  inline RPP_HOST_DEVICE Rpp32f mel_to_hz(Rpp32f mel)
851  {
852  Rpp32f hz = 0.0f;
853  if (mel >= minLogMel)
854  hz = minLogHz * std::exp(stepLog * (mel - minLogMel));
855  else
856  hz = freqLow + mel * fsp;
857  return hz;
858  }
859  public:
860  ~SlaneyMelScale() {};
861 };
862 
863 /******************** HOST memory typedefs ********************/
864 
868 typedef struct
869 {
870  Rpp32f *floatmem;
871 } memRpp32f;
872 
876 typedef struct
877 {
878  Rpp64f *doublemem;
879 } memRpp64f;
880 
884 typedef struct
885 {
886  Rpp32u *uintmem;
887 } memRpp32u;
888 
892 typedef struct
893 {
894  Rpp32s *intmem;
895 } memRpp32s;
896 
900 typedef struct
901 {
902  Rpp8u *ucharmem;
903 } memRpp8u;
904 
908 typedef struct
909 {
910  Rpp8s *charmem;
911 } memRpp8s;
912 
916 typedef struct
917 {
918  RpptRGB* rgbmem;
919 } memRpptRGB;
920 
924 typedef struct
925 {
926  Rpp32u *height;
927  Rpp32u *width;
928 } memSize;
929 
933 typedef struct
934 {
935  Rpp32u *x;
936  Rpp32u *y;
937  Rpp32u *roiHeight;
938  Rpp32u *roiWidth;
939 } memROI;
940 
944 typedef struct {
945  RppiSize *srcSize;
946  RppiSize *dstSize;
947  RppiSize *maxSrcSize;
948  RppiSize *maxDstSize;
949  RppiROI *roiPoints;
950  memRpp32f floatArr[10];
951  memRpp64f doubleArr[10];
952  memRpp32u uintArr[10];
953  memRpp32s intArr[10];
954  memRpp8u ucharArr[10];
955  memRpp8s charArr[10];
956  memRpptRGB rgbArr;
957  Rpp64u *srcBatchIndex;
958  Rpp64u *dstBatchIndex;
959  Rpp32u *inc;
960  Rpp32u *dstInc;
961  Rpp32f *scratchBufferHost;
962 } memCPU;
963 
964 #ifdef OCL_COMPILE
965 
966 /******************** OCL memory typedefs ********************/
967 
971 typedef struct
972 {
973  cl_mem floatmem;
974 } clmemRpp32f;
975 
979 typedef struct
980 {
981  cl_mem doublemem;
982 } clmemRpp64f;
983 
987 typedef struct
988 {
989  cl_mem uintmem;
990 } clmemRpp32u;
991 
995 typedef struct
996 {
997  cl_mem intmem;
998 } clmemRpp32s;
999 
1003 typedef struct
1004 {
1005  cl_mem ucharmem;
1006 } clmemRpp8u;
1007 
1011 typedef struct
1012 {
1013  cl_mem charmem;
1014 } clmemRpp8s;
1015 
1019 typedef struct
1020 {
1021  cl_mem height;
1022  cl_mem width;
1023 } clmemSize;
1024 
1028 typedef struct
1029 {
1030  cl_mem x;
1031  cl_mem y;
1032  cl_mem roiHeight;
1033  cl_mem roiWidth;
1034 } clmemROI;
1035 
1039 typedef struct
1040 {
1041  memSize csrcSize;
1042  memSize cdstSize;
1043  memSize cmaxSrcSize;
1044  memSize cmaxDstSize;
1045  memROI croiPoints;
1046  clmemSize srcSize;
1047  clmemSize dstSize;
1048  clmemSize maxSrcSize;
1049  clmemSize maxDstSize;
1050  clmemROI roiPoints;
1051  clmemRpp32f floatArr[10];
1052  clmemRpp64f doubleArr[10];
1053  clmemRpp32u uintArr[10];
1054  clmemRpp32s intArr[10];
1055  clmemRpp8u ucharArr[10];
1056  clmemRpp8s charArr[10];
1057  cl_mem srcBatchIndex;
1058  cl_mem dstBatchIndex;
1059  cl_mem inc;
1060  cl_mem dstInc;
1061 } memGPU;
1062 
1066 typedef struct
1067 {
1068  memCPU mcpu;
1069  memGPU mgpu;
1070 } memMgmt;
1071 
1072 #elif defined(HIP_COMPILE)
1073 
1074 /******************** HIP memory typedefs ********************/
1075 
1079 typedef struct
1080 {
1081  Rpp32f* floatmem;
1082 } hipMemRpp32f;
1083 
1087 typedef struct
1088 {
1089  Rpp64f* doublemem;
1090 } hipMemRpp64f;
1091 
1095 typedef struct
1096 {
1097  Rpp32u* uintmem;
1098 } hipMemRpp32u;
1099 
1103 typedef struct
1104 {
1105  Rpp32s* intmem;
1106 } hipMemRpp32s;
1107 
1111 typedef struct
1112 {
1113  Rpp8u* ucharmem;
1114 } hipMemRpp8u;
1115 
1119 typedef struct
1120 {
1121  Rpp8s* charmem;
1122 } hipMemRpp8s;
1123 
1127 typedef struct
1128 {
1129  RpptRGB* rgbmem;
1130 } hipMemRpptRGB;
1131 
1135 typedef struct
1136 {
1137  Rpp32u* height;
1138  Rpp32u* width;
1139 } hipMemSize;
1140 
1144 typedef struct
1145 {
1146  Rpp32u* x;
1147  Rpp32u* y;
1148  Rpp32u* roiHeight;
1149  Rpp32u* roiWidth;
1150 } hipMemROI;
1151 
1155 typedef struct
1156 {
1157  memSize csrcSize;
1158  memSize cdstSize;
1159  memSize cmaxSrcSize;
1160  memSize cmaxDstSize;
1161  memROI croiPoints;
1162  hipMemSize srcSize;
1163  hipMemSize dstSize;
1164  hipMemSize maxSrcSize;
1165  hipMemSize maxDstSize;
1166  hipMemROI roiPoints;
1167  hipMemRpp32f floatArr[10];
1168  hipMemRpp32f float3Arr[10];
1169  hipMemRpp64f doubleArr[10];
1170  hipMemRpp32u uintArr[10];
1171  hipMemRpp32s intArr[10];
1172  hipMemRpp8u ucharArr[10];
1173  hipMemRpp8s charArr[10];
1174  hipMemRpptRGB rgbArr;
1175  hipMemRpp32f scratchBufferHip;
1176  Rpp64u* srcBatchIndex;
1177  Rpp64u* dstBatchIndex;
1178  Rpp32u* inc;
1179  Rpp32u* dstInc;
1180  hipMemRpp32f scratchBufferPinned;
1181 } memGPU;
1182 
1186 typedef struct
1187 {
1188  memCPU mcpu;
1189  memGPU mgpu;
1190 } memMgmt;
1191 
1192 #else
1193 
1197 typedef struct
1198 {
1199  memCPU mcpu;
1200 } memMgmt;
1201 
1202 #endif //BACKEND
1203 
1207 typedef struct
1208 {
1209  RppPtr_t cpuHandle;
1210  Rpp32u nbatchSize;
1211  memMgmt mem;
1212 } InitHandle;
1213 
1214 #endif /* RPPDEFS_H */
unsigned int Rpp32u
32 bit unsigned int
Definition: rppdefs.h:101
int Rpp32s
32 bit signed int
Definition: rppdefs.h:103
signed char Rpp8s
8 bit signed char
Definition: rppdefs.h:95
RppiChnFormat
RPPI Image channel format type enum.
Definition: rppdefs.h:368
RpptMelScaleFormula
RPPT Mel Scale Formula.
Definition: rppdefs.h:485
unsigned short Rpp16u
16 bit unsigned short
Definition: rppdefs.h:97
unsigned char Rpp8u
8 bit unsigned char
Definition: rppdefs.h:93
void * RppPtr_t
void pointer
Definition: rppdefs.h:113
RpptLayout
RPPT Tensor layout type enum.
Definition: rppdefs.h:411
RpptRoiType
RPPT Tensor 2D ROI type enum.
Definition: rppdefs.h:425
RpptDataType
RPPT Tensor datatype enum.
Definition: rppdefs.h:399
RpptImageBorderType
RPPT Image Border Type.
Definition: rppdefs.h:475
struct RpptResamplingWindow RpptResamplingWindow
RPPT Tensor RpptResamplingWindow type struct.
double Rpp64f
64 bit double
Definition: rppdefs.h:111
RpptAudioBorderType
RPPT Audio Border Type.
Definition: rppdefs.h:465
size_t RppSize_t
size_t
Definition: rppdefs.h:115
struct GenericFilter GenericFilter
RPPT Tensor GenericFilter type struct.
RppStatus
RPP RppStatus type enums.
Definition: rppdefs.h:121
RpptRoi3DType
RPPT Tensor 3D ROI type enum.
Definition: rppdefs.h:434
unsigned long long Rpp64u
64 bit unsigned long long
Definition: rppdefs.h:105
#define RPPT_MAX_DIMS
RPP maximum dimensions in tensor .
Definition: rppdefs.h:65
RpptInterpolationType
RPPT Tensor interpolation type enum.
Definition: rppdefs.h:452
RpptSubpixelLayout
RPPT Tensor subpixel layout type enum.
Definition: rppdefs.h:443
short Rpp16s
16 bit signed short
Definition: rppdefs.h:99
float Rpp32f
32 bit float
Definition: rppdefs.h:109
RppBackend
RPP RppBackend type enums.
Definition: rppdefs.h:182
long long Rpp64s
64 bit long long
Definition: rppdefs.h:107
rppStatus_t
RPP rppStatus_t type enums.
Definition: rppdefs.h:192
@ RPP_ERROR_NOT_IMPLEMENTED
Function variant requested is not implemented / unsupported.
Definition: rppdefs.h:135
@ RPP_ERROR_INVALID_DST_DATATYPE
Invalid dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:147
@ RPP_ERROR_INVALID_OUTPUT_TILE_LENGTH
Invalid output tile length (Needs to adhere to function specification.)
Definition: rppdefs.h:163
@ RPP_ERROR_INVALID_DIM_LENGTHS
Length in some dimensions are invalid. (Needs to adhere to function specification....
Definition: rppdefs.h:173
@ RPP_ERROR_OUT_OF_BOUND_SRC_ROI
Out of bound source ROI.
Definition: rppdefs.h:157
@ 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:165
@ RPP_ERROR_ZERO_DIVISION
Arguments provided will result in zero division error.
Definition: rppdefs.h:131
@ RPP_ERROR_INVALID_ARGUMENTS
One or more arguments invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:127
@ RPP_ERROR_LAYOUT_MISMATCH
src and dst layout mismatch
Definition: rppdefs.h:159
@ RPP_ERROR_INVALID_CHANNELS
Number of channels is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:161
@ RPP_ERROR_INVALID_SRC_CHANNELS
Invalid src tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:137
@ RPP_ERROR_INVALID_SRC_OR_DST_DATATYPE
Invalid src/dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:149
@ RPP_ERROR_INVALID_PARAMETER_DATATYPE
Invalid datatype.
Definition: rppdefs.h:153
@ RPP_ERROR_NOT_ENOUGH_MEMORY
Not enough memory to write outputs, as per dim-lengths and strides set in descriptor.
Definition: rppdefs.h:155
@ RPP_ERROR
Unspecified error.
Definition: rppdefs.h:125
@ RPP_ERROR_INVALID_SRC_DIMS
Number of src dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:169
@ 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:167
@ RPP_ERROR_INVALID_DST_LAYOUT
Invalid dst tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:143
@ RPP_ERROR_INVALID_AXIS
The specified axis is invalid or out of range. (Needs to adhere to function specification....
Definition: rppdefs.h:175
@ RPP_ERROR_INVALID_DST_CHANNELS
Invalid dst tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:139
@ RPP_ERROR_INVALID_SRC_DATATYPE
Invalid src tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:145
@ RPP_ERROR_INVALID_SRC_LAYOUT
Invalid src tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:141
@ RPP_ERROR_HIGH_SRC_DIMENSION
Src tensor / src ROI dimension too high. (Needs to adhere to function specification....
Definition: rppdefs.h:133
@ RPP_SUCCESS
No error.
Definition: rppdefs.h:123
@ RPP_ERROR_INSUFFICIENT_DST_BUFFER_LENGTH
Insufficient dst buffer length provided. (Needs to adhere to function specification....
Definition: rppdefs.h:151
@ RPP_ERROR_INVALID_DST_DIMS
Number of dst dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:171
@ RPP_ERROR_LOW_OFFSET
Low tensor offsetInBytes provided for src/dst tensor.
Definition: rppdefs.h:129
Base class for Mel scale conversions.
Definition: rppdefs.h:806
RPPT Tensor GenericFilter type struct.
Definition: rppdefs.h:705
Derived class for HTK Mel scale conversions.
Definition: rppdefs.h:817
RPP initialize handle.
Definition: rppdefs.h:1208
RPP 24 float vector.
Definition: rppdefs.h:285
RPP 6 float vector.
Definition: rppdefs.h:261
RPP 9 float vector.
Definition: rppdefs.h:269
RPP 24 signed int vector.
Definition: rppdefs.h:277
RPP layout params.
Definition: rppdefs.h:252
RPPI Image 2D ROI (XYWH format) type struct.
Definition: rppdefs.h:386
RPPI Image size(Width/Height dimensions) type struct.
Definition: rppdefs.h:377
RPPT Tensor 2D bilinear neighborhood 32-bit signed int 8-length-vectors type struct.
Definition: rppdefs.h:683
RPPT Tensor 2D bilinear neighborhood 32-bit float 8-length-vectors type struct.
Definition: rppdefs.h:694
RPPT Tensor Channel Offsets struct.
Definition: rppdefs.h:522
RPPT Tensor descriptor type struct.
Definition: rppdefs.h:592
RPPT Tensor 32-bit float RGB type struct.
Definition: rppdefs.h:628
RPPT Tensor 2D 32-bit float vector type struct.
Definition: rppdefs.h:647
RPPT Tensor Generic descriptor type struct.
Definition: rppdefs.h:605
RPPT Tensor 2D image patch dimensions type struct.
Definition: rppdefs.h:656
RPPT Image 2D cartesian point type struct.
Definition: rppdefs.h:494
RPPT Image 3D point type struct.
Definition: rppdefs.h:503
RPPT Tensor 8-bit uchar RGB type struct.
Definition: rppdefs.h:618
RPPT Tensor RpptResamplingWindow type struct.
Definition: rppdefs.h:762
RPPT Tensor 3D ROI LTFRBB struct.
Definition: rppdefs.h:532
RPPT Tensor 2D ROI LTRB struct.
Definition: rppdefs.h:513
RPPT Tensor 2D ROI XYWH struct.
Definition: rppdefs.h:541
RPPT Tensor 3D ROI XYZWHD struct.
Definition: rppdefs.h:551
RPPT Tensor strides type struct.
Definition: rppdefs.h:581
RPPT Tensor 2D 32-bit uint vector type struct.
Definition: rppdefs.h:638
RPPT Tensor random number generator state (xorwow box muller state) type struct.
Definition: rppdefs.h:673
RPPT Tensor random number generator state (xorwow state) type struct.
Definition: rppdefs.h:665
Derived class for Slaney Mel scale conversions.
Definition: rppdefs.h:828
RPP HIP 2D ROI memory.
Definition: rppdefs.h:1145
RPP HIP 32-bit float memory.
Definition: rppdefs.h:1080
RPP HIP 32-bit signed int memory.
Definition: rppdefs.h:1104
RPP HIP 32-bit unsigned int memory.
Definition: rppdefs.h:1096
RPP HIP 64-bit double memory.
Definition: rppdefs.h:1088
RPP HIP 8-bit signed char memory.
Definition: rppdefs.h:1120
RPP HIP 8-bit unsigned char memory.
Definition: rppdefs.h:1112
RPP HIP RGB memory.
Definition: rppdefs.h:1128
RPP HIP 2D dimensions memory.
Definition: rppdefs.h:1136
RPP HOST memory type struct.
Definition: rppdefs.h:944
RPP OCL memory management type struct.
Definition: rppdefs.h:1156
RPP HIP-HOST memory management.
Definition: rppdefs.h:1187
RPP HOST 2D ROI memory.
Definition: rppdefs.h:934
RPP HOST 32-bit float memory.
Definition: rppdefs.h:869
RPP HOST 32-bit signed int memory.
Definition: rppdefs.h:893
RPP HOST 32-bit unsigned int memory.
Definition: rppdefs.h:885
RPP HOST 64-bit double memory.
Definition: rppdefs.h:877
RPP HOST 8-bit signed char memory.
Definition: rppdefs.h:909
RPP HOST 8-bit unsigned char memory.
Definition: rppdefs.h:901
RPP HOST RGB memory.
Definition: rppdefs.h:917
RPP HOST 2D dimensions memory.
Definition: rppdefs.h:925
RPPT Tensor 3D ROI union.
Definition: rppdefs.h:571
RPPT Tensor 2D ROI union.
Definition: rppdefs.h:561