RPP handle API#
-
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.
Custom allocator function to allow for user-defined custom allocation.
- Param context:
[in] A pointer to a context.
- Param sizeBytes:
[in] Number of bytes to allocate.
-
typedef void (*rppDeallocatorFunction)(void *context, void *memory)#
Handles RPP context allocations.
Custom deallocator function to allow for user-defined custom deallocation.
- Param context:
[in] A pointer to a context.
- Param memory:
[in] A pointer to allocated memory.
-
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 backend batch processing.
Function to create a RPP handle, and the necessary host/device memory allocations.
- Parameters:
handle – [in] A pointer to RPP handle of type
rppHandle_t.nBatchSize – [in] Batch size.
numThreads – [in] Number of threads to use if backend = RppBackend::RPP_HOST_BACKEND. (Pass 0 if backend = RppBackend::RPP_HIP_BACKEND).
stream – [in] A pointer to an accelerator queue of type
rppAcceleratorQueue_t- hipStream_t if backend = RppBackend::RPP_HIP_BACKEND. (Pass nullptr if backend = RppBackend::RPP_HOST_BACKEND).backend – [in] RPP backend to run augmentations (backend = RppBackend::RPP_HOST_BACKEND / RppBackend::RPP_HIP_BACKEND) \ <> \ </> .
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- SHARED_PUBLIC rppStatus_t rppDestroy (rppHandle_t handle, RppBackend backend=RppBackend::RPP_HOST_BACKEND)
Destroys RPP handle for HOST/HIP 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:
handle – [in] RPP handle of type
rppHandle_t.backend – [in] RPP backend to run augmentations (backend = RppBackend::RPP_HOST_BACKEND / RppBackend::RPP_HIP_BACKEND) \ <> rppStatus_t enumeration.
- Return values:
rppStatusSuccess –
- 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:
handle – [in] RPP handle of type
rppHandle_t.batchSize – [in] Batch size.
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- Returns:
A
rppStatus_tenumeration.
- 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:
handle – [in] RPP handle of type
rppHandle_t.batchSize – [in] Batch size
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- Returns:
A
rppStatus_tenumeration.
- 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:
handle – [in] RPP handle of type
rppHandle_t.stream – [in] An accelerator queue of type
rppAcceleratorQueue_t(hipStream_t for HIP). \ <> \ </> . \ rppStatusSuccess
- Return values:
rppStatusNotInitialized –
- 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:
handle – [in] RPP handle of type
rppHandle_t.stream – [in] An accelerator queue of type
rppAcceleratorQueue_t(hipStream_t for HIP). \ <> \ </> . \ rppStatusSuccess
- Return values:
rppStatusNotInitialized –
- 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:
handle – [in] RPP handle of type
rppHandle_t.allocator – [in] 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.
deallocator – [in] A callback function rpp will use to for internal memory deallocation. The provided callback function should free the specified memory pointer.
allocatorContext – [in] 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.
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- Returns:
A
rppStatus_tenumeration.
- 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:
handle – [in] RPP handle of type
rppHandle_t.time – [in] Pointer to a float type to contain kernel time in milliseconds.
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- Returns:
A
rppStatus_tenumeration.
- SHARED_PUBLIC rppStatus_t rppEnableProfiling (rppHandle_t handle, bool enable)
Enable Profiling.
Function to enable profiling to retrieve kernel time.
- Parameters:
handle – [in] RPP handle of type
rppHandle_t.enable – [in] Boolean to toggle profiling.
- Return values:
rppStatusSuccess –
rppStatusNotInitialized –
rppStatusInvalidValue –
rppStatusBadParm –
rppStatusAllocFailed –
rppStatusInternalError –
rppStatusNotImplemented –
rppStatusUnknownError –
rppStatusUnsupportedOp –
- Returns:
A
rppStatus_tenumeration.
-
RPP_DECLARE_OBJECT(name)#
Construct type name from a struct.