File UdoImpl.h¶
↰ Parent directory (include/QNN/AIP/Udo)
Contents
Definition (include/QNN/AIP/Udo/UdoImpl.h)¶
Includes¶
AIP/Udo/UdoShared.h(File UdoShared.h)stdbool.h
Included By¶
Functions¶
Typedefs¶
Full File Listing¶
Typedefs
-
typedef struct _SnpeUdo_OpFactory_t *SnpeUdo_OpFactory_t
-
typedef struct _SnpeUdo_Operation_t *SnpeUdo_Operation_t
-
typedef SnpeUdo_OpFactory_t Udo_OpFactory_t
-
typedef SnpeUdo_Operation_t Udo_Operation_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_InitImplLibraryFunction_t)(void*)
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_getImplVersion_t)(SnpeUdo_LibVersion_t **version)
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_TerminateImplLibraryFunction_t)(void)
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_GetImpInfoFunction_t)(SnpeUdo_ImpInfo_t **implementationInfo)
-
typedef SnpeUdo_GetImpInfoFunction_t Udo_GetImpInfoFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_CreateOpFactoryFunction_t)(SnpeUdo_CoreType_t, void*, SnpeUdo_String_t, uint32_t, SnpeUdo_Param_t*, SnpeUdo_OpFactory_t*)
-
typedef SnpeUdo_CreateOpFactoryFunction_t Udo_CreateOpFactoryFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ReleaseOpFactoryFunction_t)(SnpeUdo_OpFactory_t)
-
typedef SnpeUdo_ReleaseOpFactoryFunction_t Udo_ReleaseOpFactoryFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_CreateOperationFunction_t)(SnpeUdo_OpFactory_t, void*, uint32_t, SnpeUdo_TensorParam_t*, uint32_t, SnpeUdo_TensorParam_t*, SnpeUdo_Operation_t*)
-
typedef SnpeUdo_CreateOperationFunction_t Udo_CreateOperationFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ExternalNotify_t)(const uint32_t ID)
A pointer to notification function.
The notification function supports the non-blocking (e.g. asynchronous) execution use-case. In case an "executeUdoOp" function is called with "blocking" set to zero, and a notify function, this function will be called by the implementation library at the end of execution. The implementation library will pass the notify function the ID that was provided to it when "executeUdoOp" was called.
- Param ID
[in] 32-bit value, that was provided to executeUdoOp by the calling entity. Can be used to track the notifications, in case of multiple execute calls issued.
- Return
Error code
-
typedef SnpeUdo_ExternalNotify_t Udo_ExternalNotify_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ExecuteOpFunction_t)(SnpeUdo_Operation_t, bool, const uint32_t, SnpeUdo_ExternalNotify_t)
-
typedef SnpeUdo_ExecuteOpFunction_t Udo_ExecuteOpFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_SetOpIOFunction_t)(SnpeUdo_Operation_t, SnpeUdo_TensorParam_t*, SnpeUdo_TensorParam_t*)
-
typedef SnpeUdo_SetOpIOFunction_t Udo_SetOpIOFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ProfileOpFunction_t)(SnpeUdo_Operation_t, uint32_t*)
-
typedef SnpeUdo_ProfileOpFunction_t Udo_ProfileOpFunction_t
-
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ReleaseOpFunction_t)(SnpeUdo_Operation_t)
-
typedef SnpeUdo_ReleaseOpFunction_t Udo_ReleaseOpFunction_t
Functions
-
SnpeUdo_ErrorType_t SnpeUdo_initImplLibrary(void *globalInfrastructure)¶
Initialize the shared library’s data structures. Calling any other library function before this one will result in error.
- Parameters
globalInfrastructure – [in] Global core-specific infrastructure to be used by operations created in this library. The definition and semantics of this object will be defined in the corresponding implementation header for the core type.
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_getImplVersion(SnpeUdo_LibVersion_t **version)¶
A function to query the API version of the UDO implementation library. The function populates a SnpeUdo_LibVersion_t struct, which contains a SnpeUdo_Version_t struct for API version and library version.
- Parameters
version – [inout] A pointer to struct which contains major, minor, teeny information for library and api versions.
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_terminateImplLibrary(void)¶
Release the shared library’s data structures, and invalidate any handles returned by the library. The behavior of any outstanding asynchronous calls made to this library when this function is called are undefined. All library functions (except SnpeUdo_initImplLibrary) will return an error after this function has been successfully called.
It should be possible to call SnpeUdo_initImplLibrary after calling this function, and re-initialize the library.
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_getImpInfo(SnpeUdo_ImpInfo_t **implementationInfo)¶
A function to query info on the UDO implementation library. The function populates a structure which contains information about operations that are part of this library.
- Parameters
implementationInfo – [inout] A pointer to struct which contains information on the operations
- Returns
error code
-
SnpeUdo_ErrorType_t SnpeUdo_createOpFactory(SnpeUdo_CoreType_t udoCoreType, void *perFactoryInfrastructure, SnpeUdo_String_t operationType, uint32_t numOfStaticParams, SnpeUdo_Param_t *staticParams, SnpeUdo_OpFactory_t *opFactory)¶
A function to create an operation factory. The function receives the operation type, and an array of static parameters, and returns operation factory handler.
- Parameters
udoCoreType – [in] The Core type to create the operation on. An error will be returned if this does not match the core type of the library.
perFactoryInfrastructure – [in] CreateOpFactory infrastructure appropriate to this core type. The definition and semantics of this object will be defined in the corresponding implementation header for the core type.
operationType – [in] A string containing Operation type. for example “MY_CONV”
numOfStaticParams – [in] The number of static parameters.
staticParams – [in] Array of static parameters
opFactory – [inout] Handler to Operation Factory, to be used when creating operations
- Returns
Error Code
-
SnpeUdo_ErrorType_t SnpeUdo_releaseOpFactory(SnpeUdo_OpFactory_t opFactory)¶
A function to release the resources allocated for an operation factory created by this library.
- Parameters
opFactory – [in] The operation factory to release. Upon success this handle will be invalidated.
- Returns
Error Code
-
SnpeUdo_ErrorType_t SnpeUdo_createOperation(SnpeUdo_OpFactory_t opFactory, void *perOpInfrastructure, uint32_t numOfInputs, SnpeUdo_TensorParam_t *inputs, uint32_t numOfOutputs, SnpeUdo_TensorParam_t *outputs, SnpeUdo_Operation_t *operation)¶
A function to create an operation from the factory. The function receives array of inputs and array of outputs, and creates an operation instance, returning the operation instance handler.
- Parameters
opFactory – [in] OpFactory instance containing the parameters for this operation.
perOpInfrastructure – [in] Per-Op infrastructure for this operation. The definition and semantics of this object will be defined in the implementation header appropriate to this core type.
numOfInputs – [in] The number of input tensors this operation will receive.
inputs – [in] Array of input tensors, providing both the sizes and initial location of the data.
numOfOutputs – [in] Number of output tensors this operation will produce.
outputs – [in] Array of output tensors, providing both the sizes and initial location of the data.
operation – [inout] Handle for newly created operation instance.
- Returns
Error Code
-
SnpeUdo_ErrorType_t SnpeUdo_executeOp(SnpeUdo_Operation_t operation, bool blocking, const uint32_t ID, SnpeUdo_ExternalNotify_t notifyFunc)¶
Operation execution function.
Calling this function will run the operation on set of inputs, generating a set of outputs. The call can be blocking (synchronous) or non-blocking (asynchronous). To support the non-blocking mode, the calling entity can pass an ID and a notification function. At the end of the execution this notification function would be called, passing it the ID. <b> NOTE: Asynchronous execution mode not supported in this release. </b>
- Parameters
operation – [in] handle to the operation on which execute is invoked
blocking – [in] flag to indicate execution mode. If set, execution is blocking, e.g SnpeUdo_executeOp call does not return until execution is done. If not set, SnpeUdo_executeOp returns immediately, and the library will call the notification function (if set) when execution is done.
ID – [in] 32-bit number that can be used by the calling entity to track execution in case of non-blocking execution. For example, it can be a sequence number, increased by one on each call.
notifyFunc – [in] Pointer to notification function. if the pointer is set, and execution is non-blocking, the library will call this function at end of execution, passing the number provided as ID
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_setOpIO(SnpeUdo_Operation_t operation, SnpeUdo_TensorParam_t *inputs, SnpeUdo_TensorParam_t *outputs)¶
A function to setting the inputs & outputs. part of SnpeUdo_Operation struct, returned from creation of a new operation instance. Not supported in this release.
This function allows the calling entity to change some of the inputs and outputs between calls to execute. Note that the change is limited to changing the pointer to the tensor data only. Any other change may be rejected by the implementation library, causing immediate invalidation of the operation instance
- Parameters
operation – [in] Operation on which IO tensors are set
inputs – [in] array of tensor parameters. The calling entity may provide a subset of the operation inputs, providing only those that it wants to change.
outputs – [in] array of tensor parameters. The calling entity may provide a subset of the operation outputs, providing only those that it wants to change.
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_profileOp(SnpeUdo_Operation_t operation, uint32_t *executionTime)¶
A function to return execution times.
This function can be called to query the operation execution times on the IP core on which the operation is run. The time is provided in micro-seconds
- Parameters
operation – [in] Handle to operation whose execution time is being profiled
executionTime – [inout] pointer to a uint32 value.This function writes the operation execution time in usec into this value.
- Returns
Error code
-
SnpeUdo_ErrorType_t SnpeUdo_releaseOp(SnpeUdo_Operation_t operation)¶
A function to release the operation instance
When it is called, the implementation library needs to release all resources allocated for this operation instance.
Note that all function pointers which are part of SnpeUdo_Operation become invalid once releaseUdoOp call returns.- Parameters
operation – [in] Handle to operation to be released
- Returns
Error code