RPP handle API

RPP handle API#

RPP: RPP handle API
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 const char * rppGetErrorString (rppStatus_t error)
 Returns error string. More...
 
SHARED_PUBLIC rppStatus_t rppCreate (rppHandle_t *handle)
 Creates RPP handle for HOST single image processing - To be deprecated. More...
 
SHARED_PUBLIC rppStatus_t rppCreateWithBatchSize (rppHandle_t *handle, size_t nBatchSize, Rpp32u numThreads=0)
 Creates RPP handle for HOST batch processing. More...
 
SHARED_PUBLIC rppStatus_t rppDestroy (rppHandle_t handle)
 Destory RPP handle. More...
 
SHARED_PUBLIC rppStatus_t rppDestroyHost (rppHandle_t handle)
 Destory RPP HOST handle - To be deprecated. 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 rppCreateWithStream (rppHandle_t *handle, rppAcceleratorQueue_t stream)
 Creates RPP handle with accelerator stream for GPU single image processing - To be deprecated. More...
 
SHARED_PUBLIC rppStatus_t rppCreateWithStreamAndBatchSize (rppHandle_t *handle, rppAcceleratorQueue_t stream, size_t nBatchSize)
 Creates RPP handle with accelerator stream for GPU batch processing. More...
 
SHARED_PUBLIC rppStatus_t rppDestroyGPU (rppHandle_t handle)
 Destory RPP GPU 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)
Value:
struct name \
{ \
}; \
typedef struct name* name##_t;

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]contextA pointer to a context.
[in]sizeBytesNumber 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]contextA pointer to a context.
[in]memoryA pointer to allocated memory.

Function Documentation

◆ rppCreate()

SHARED_PUBLIC rppStatus_t rppCreate ( rppHandle_t *  handle)

Creates RPP handle for HOST single image processing - To be deprecated.

Function to create a RPP handle. To be called in the beginning to initialize the RPP environment.

Parameters
[in]handleA pointer to RPP handle of type rppHandle_t.
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp
Deprecated:

◆ rppCreateWithBatchSize()

SHARED_PUBLIC rppStatus_t rppCreateWithBatchSize ( rppHandle_t *  handle,
size_t  nBatchSize,
Rpp32u  numThreads = 0 
)

Creates RPP handle for HOST batch processing.

Function to create a RPP handle for a batch. To be called in the beginning to initialize the RPP environment.

Parameters
[in]handleA pointer to RPP handle of type rppHandle_t.
[in]nBatchSizeBatch size.
[in]numThreadsNumber of threads to be used for OpenMP pragma.
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp

◆ rppCreateWithStream()

SHARED_PUBLIC rppStatus_t rppCreateWithStream ( rppHandle_t *  handle,
rppAcceleratorQueue_t  stream 
)

Creates RPP handle with accelerator stream for GPU single image processing - To be deprecated.

Function to create a RPP handle with an accelerator stream. To be called in the beginning to initialize the RPP environment.

Parameters
[in]handleA pointer to RPP handle of type rppHandle_t.
[in]streamAn accelerator queue of type rppAcceleratorQueue_t (hipStream_t for HIP and cl_command_queue for OpenCL).
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp
Deprecated:

◆ rppCreateWithStreamAndBatchSize()

SHARED_PUBLIC rppStatus_t rppCreateWithStreamAndBatchSize ( rppHandle_t *  handle,
rppAcceleratorQueue_t  stream,
size_t  nBatchSize 
)

Creates RPP handle with accelerator stream for GPU batch processing.

Function to create a RPP handle with an accelerator stream for a batch. To be called in the beginning to initialize the RPP environment.

Parameters
[in]handleA pointer to RPP handle of type rppHandle_t.
[in]streamAn accelerator queue of type rppAcceleratorQueue_t (hipStream_t for HIP and cl_command_queue for OpenCL).
[in]nBatchSizeBatch size
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp

◆ rppDestroy()

SHARED_PUBLIC rppStatus_t rppDestroy ( rppHandle_t  handle)

Destory RPP handle.

Function to destroy a RPP handle. To be called in the end to break down the RPP environment.

Parameters
[in]handleRPP handle of type rppHandle_t.
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp

◆ rppDestroyGPU()

SHARED_PUBLIC rppStatus_t rppDestroyGPU ( rppHandle_t  handle)

Destory RPP GPU handle.

Function to destroy a RPP handle's device memory allocation. To be called in the end to break down the RPP environment.

Parameters
[in]handleRPP handle of type rppHandle_t.
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp

◆ rppDestroyHost()

SHARED_PUBLIC rppStatus_t rppDestroyHost ( rppHandle_t  handle)

Destory RPP HOST handle - To be deprecated.

Function to destroy a RPP handle's host memory allocation. To be called in the end to break down the rpp environment.

Parameters
[in]handleRPP handle of type rppHandle_t.
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp
Deprecated:

◆ rppEnableProfiling()

SHARED_PUBLIC rppStatus_t rppEnableProfiling ( rppHandle_t  handle,
bool  enable 
)

Enable Profiling.

Function to enable profiling to retrieve kernel time.

Parameters
[in]handleRPP handle of type rppHandle_t.
[in]enableBoolean to toggle profiling.
Returns
A rppStatus_t enumeration.
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]handleRPP handle of type rppHandle_t.
[in]batchSizeBatch size
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp

◆ rppGetErrorString()

SHARED_PUBLIC const char* rppGetErrorString ( rppStatus_t  error)

Returns error string.

Returns a NULL terminated character string of the passed error code.

Parameters
[in]errorError status of rppStatus_t type.
Returns
const char*
Returns an error string among those listed under rppStatus_t.

◆ 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]handleRPP handle of type rppHandle_t.
[in]timePointer to a float type to contain kernel time in milliseconds.
Returns
A rppStatus_t enumeration.
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]handleRPP handle of type rppHandle_t.
[in]streamAn accelerator queue of type rppAcceleratorQueue_t (hipStream_t for HIP and cl_command_queue for OpenCL).
Returns
A rppStatus_t enumeration.
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]handleRPP handle of type rppHandle_t.
[in]allocatorA 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]deallocatorA callback function rpp will use to for internal memory deallocation. The provided callback function should free the specified memory pointer.
[in]allocatorContextUser-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_t enumeration.
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]handleRPP handle of type rppHandle_t.
[in]batchSizeBatch size.
Returns
A rppStatus_t enumeration.
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]handleRPP handle of type rppHandle_t.
[in]streamAn accelerator queue of type rppAcceleratorQueue_t (hipStream_t for HIP and cl_command_queue for OpenCL).
Returns
A rppStatus_t enumeration.
Return values
rppStatusSuccess
rppStatusNotInitialized
rppStatusInvalidValue
rppStatusBadParm
rppStatusAllocFailed
rppStatusInternalError
rppStatusNotImplemented
rppStatusUnknownError
rppStatusUnsupportedOp