RPP handle API#
RPP API to create and destroy RPP HOST/GPU handle. More...
Macros | |
| #define | RPP_DECLARE_OBJECT(name) |
| Construct type name from a struct. More... | |
Typedefs | |
| typedef hipStream_t | rppAcceleratorQueue_t |
| Set rppAcceleratorQueue_t to hipStream_t if RPP_BACKEND_HIP. | |
| typedef rppHandle_t | RppHandle_t |
| RPP handle. | |
| typedef void *(* | rppAllocatorFunction) (void *context, size_t sizeBytes) |
| Handles RPP context allocations. More... | |
| typedef void(* | rppDeallocatorFunction) (void *context, void *memory) |
| Handles RPP context allocations. More... | |
Functions | |
| RPP_DECLARE_OBJECT (rppHandle) | |
| RPP handle type creation. | |
| SHARED_PUBLIC rppStatus_t | rppCreate (rppHandle_t *handle, size_t nBatchSize, Rpp32u numThreads=0, void *stream=nullptr, RppBackend backend=RppBackend::RPP_HOST_BACKEND) |
| Creates RPP handle for HOST/HIP/OCL backend batch processing. More... | |
| SHARED_PUBLIC rppStatus_t | rppDestroy (rppHandle_t handle, RppBackend backend=RppBackend::RPP_HOST_BACKEND) |
| Destroys RPP handle for HOST/HIP/OCL backend batch processing. More... | |
| SHARED_PUBLIC rppStatus_t | rppSetBatchSize (rppHandle_t handle, size_t batchSize) |
| Set batch size given a RPP handle. More... | |
| SHARED_PUBLIC rppStatus_t | rppGetBatchSize (rppHandle_t handle, size_t *batchSize) |
| Get batch size given a RPP Handle. More... | |
| SHARED_PUBLIC rppStatus_t | rppSetStream (rppHandle_t handle, rppAcceleratorQueue_t streamID) |
| Set accelerator stream given a RPP handle. More... | |
| SHARED_PUBLIC rppStatus_t | rppGetStream (rppHandle_t handle, rppAcceleratorQueue_t *streamID) |
| Get accelerator stream given a RPP handle. More... | |
| SHARED_PUBLIC rppStatus_t | rppSetAllocator (rppHandle_t handle, rppAllocatorFunction allocator, rppDeallocatorFunction deallocator, void *allocatorContext) |
| Set allocator given a RPP handle. More... | |
| SHARED_PUBLIC rppStatus_t | rppGetKernelTime (rppHandle_t handle, float *time) |
| Get time taken by previous kernel. More... | |
| SHARED_PUBLIC rppStatus_t | rppEnableProfiling (rppHandle_t handle, bool enable) |
| Enable Profiling. More... | |
Detailed Description
RPP API to create and destroy RPP HOST/GPU handle.
Macro Definition Documentation
◆ RPP_DECLARE_OBJECT
| #define RPP_DECLARE_OBJECT | ( | name | ) |
Construct type name from a struct.
Typedef Documentation
◆ rppAllocatorFunction
| typedef void*(* rppAllocatorFunction) (void *context, size_t sizeBytes) |
Handles RPP context allocations.
Custom allocator function to allow for user-defined custom allocation.
- Parameters
-
[in] context A pointer to a context. [in] sizeBytes Number of bytes to allocate.
◆ rppDeallocatorFunction
| typedef void(* rppDeallocatorFunction) (void *context, void *memory) |
Handles RPP context allocations.
Custom deallocator function to allow for user-defined custom deallocation.
- Parameters
-
[in] context A pointer to a context. [in] memory A pointer to allocated memory.
Function Documentation
◆ rppCreate()
| SHARED_PUBLIC rppStatus_t rppCreate | ( | rppHandle_t * | handle, |
| size_t | nBatchSize, | ||
| Rpp32u | numThreads = 0, |
||
| void * | stream = nullptr, |
||
| RppBackend | backend = RppBackend::RPP_HOST_BACKEND |
||
| ) |
Creates RPP handle for HOST/HIP/OCL backend batch processing.
Function to create a RPP handle, and the necessary host/device memory allocations.
- Parameters
-
[in] handle A pointer to RPP handle of type rppHandle_t.[in] nBatchSize Batch size. [in] numThreads Number of threads to use if backend = RppBackend::RPP_HOST_BACKEND. (Pass 0 if backend = RppBackend::RPP_HIP_BACKEND). [in] stream A pointer to an accelerator queue of type rppAcceleratorQueue_t- hipStream_t if backend = RppBackend::RPP_HIP_BACKEND and cl_command_queue if backend = RppBackend::RPP_OCL_BACKEND. (Pass nullptr if backend = RppBackend::RPP_HOST_BACKEND).[in] backend RPP backend to run augmentations (backend = RppBackend::RPP_HOST_BACKEND / RppBackend::RPP_HIP_BACKEND / RppBackend::RPP_OCL_BACKEND)
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppDestroy()
| SHARED_PUBLIC rppStatus_t rppDestroy | ( | rppHandle_t | handle, |
| RppBackend | backend = RppBackend::RPP_HOST_BACKEND |
||
| ) |
Destroys RPP handle for HOST/HIP/OCL backend batch processing.
Function to destroy a RPP handle's host/device memory allocation. To be called in the end to break down the RPP environment.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] backend RPP backend to run augmentations (backend = RppBackend::RPP_HOST_BACKEND / RppBackend::RPP_HIP_BACKEND / RppBackend::RPP_OCL_BACKEND)
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppEnableProfiling()
| SHARED_PUBLIC rppStatus_t rppEnableProfiling | ( | rppHandle_t | handle, |
| bool | enable | ||
| ) |
Enable Profiling.
Function to enable profiling to retrieve kernel time.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] enable Boolean to toggle profiling.
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppGetBatchSize()
| SHARED_PUBLIC rppStatus_t rppGetBatchSize | ( | rppHandle_t | handle, |
| size_t * | batchSize | ||
| ) |
Get batch size given a RPP Handle.
Function to get batch size for handle previously created.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] batchSize Batch size
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppGetKernelTime()
| SHARED_PUBLIC rppStatus_t rppGetKernelTime | ( | rppHandle_t | handle, |
| float * | time | ||
| ) |
Get time taken by previous kernel.
Function to get time for last kernel launched. This function is used only when profiling mode has been enabled.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] time Pointer to a float type to contain kernel time in milliseconds.
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppGetStream()
| SHARED_PUBLIC rppStatus_t rppGetStream | ( | rppHandle_t | handle, |
| rppAcceleratorQueue_t * | streamID | ||
| ) |
Get accelerator stream given a RPP handle.
Function to get an accelerator stream previously created.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] stream An accelerator queue of type rppAcceleratorQueue_t(hipStream_t for HIP and cl_command_queue for OpenCL).
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppSetAllocator()
| SHARED_PUBLIC rppStatus_t rppSetAllocator | ( | rppHandle_t | handle, |
| rppAllocatorFunction | allocator, | ||
| rppDeallocatorFunction | deallocator, | ||
| void * | allocatorContext | ||
| ) |
Set allocator given a RPP handle.
Function to set allocator for a previously created RPP handle of type rppHandle_t.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] allocator A callback function rpp will use for internal memory allocations. The provided callback function should allocate device memory with requested size and return a pointer to this memory. Passing 0 will restore the default RPP allocator and deallocator. [in] deallocator A callback function rpp will use to for internal memory deallocation. The provided callback function should free the specified memory pointer. [in] allocatorContext User-specified pointer which is passed to allocator and deallocator. This allows the callback function to access state set by the caller to this function, for example a stateful heap allocator or a c++ class.
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppSetBatchSize()
| SHARED_PUBLIC rppStatus_t rppSetBatchSize | ( | rppHandle_t | handle, |
| size_t | batchSize | ||
| ) |
Set batch size given a RPP handle.
Function to set batch size for handle previously created.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] batchSize Batch size.
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp
◆ rppSetStream()
| SHARED_PUBLIC rppStatus_t rppSetStream | ( | rppHandle_t | handle, |
| rppAcceleratorQueue_t | streamID | ||
| ) |
Set accelerator stream given a RPP handle.
Function to set an accelerator stream previously created.
- Parameters
-
[in] handle RPP handle of type rppHandle_t.[in] stream An accelerator queue of type rppAcceleratorQueue_t(hipStream_t for HIP and cl_command_queue for OpenCL).
- Returns
- A
rppStatus_tenumeration.
- Return values
-
rppStatusSuccess rppStatusNotInitialized rppStatusInvalidValue rppStatusBadParm rppStatusAllocFailed rppStatusInternalError rppStatusNotImplemented rppStatusUnknownError rppStatusUnsupportedOp