File UdoImplDsp.h

Parent directory (include/QNN/AIP/Udo)

Definition (include/QNN/AIP/Udo/UdoImplDsp.h)

Includes

Full File Listing

Typedefs

typedef SnpeUdo_ErrorType_t (*SnpeUdo_ValidateOperationFunction_t)(SnpeUdo_String_t, uint32_t, const SnpeUdo_Param_t*)
typedef SnpeUdo_ValidateOperationFunction_t Udo_ValidateOperationFunction_t
typedef SnpeUdo_HexNNTensorLayout_t Udo_HexNNTensorLayout_t
typedef SnpeUdo_ErrorType_t (*SnpeUdo_QueryOperationFunction_t)(SnpeUdo_String_t, uint32_t, const SnpeUdo_Param_t*, uint32_t*, SnpeUdo_QuantizationType_t**, SnpeUdo_HexNNTensorLayout_t**, uint32_t*, SnpeUdo_QuantizationType_t**, SnpeUdo_HexNNTensorLayout_t**)
typedef SnpeUdo_QueryOperationFunction_t Udo_QueryOperationFunction_t
typedef void (*workerThread_t)(void *perOpInfrastructure, void *userData)
typedef int (*udoSetOutputTensorSize_t)(void *perOpInfrastructure, uint32_t outIdx, uint32_t size)
typedef int (*udoGetInputD32Paddings_t)(void *perOpInfrastructure, uint32_t inIdx, uint32_t *heightPadBefore, uint32_t *heightPadAfter, uint32_t *widthPadBefore, uint32_t *widthPadAfter, uint32_t *depthPadBefore, uint32_t *depthPadAfter)
typedef int (*udoSetOutputD32ShapeSizePaddings_t)(void *perOpInfrastructure, uint32_t outIdx, uint32_t batch, uint32_t height, uint32_t heightPadBefore, uint32_t heightPadAfter, uint32_t width, uint32_t widthPadBefore, uint32_t widthPadAfter, uint32_t depth, uint32_t depthPadBefore, uint32_t depthPadAfter, SnpeUdo_DataType_t dataType)
typedef void *(*udoMemalign_t)(size_t n, size_t size)
typedef void *(*udoMalloc_t)(size_t size)
typedef void *(*udoCalloc_t)(size_t n, size_t size)
typedef void (*udoFree_t)(void *ptr)
typedef uint32_t (*udoGetVtcmSize_t)(void *perOpInfrastructure)
typedef void *(*udoGetVtcmPtr_t)(void *perOpInfrastructure)
typedef uint32_t (*udoVtcmIsReal_t)(void *perOpInfrastructure)
typedef void (*udoRunWorkerThreads_t)(void *perOpInfrastructure, uint32_t nThreads, workerThread_t w, void *userData)
typedef struct hexNNv2GlobalInfra SnpeUdo_HexNNv2GlobalInfra_t
typedef SnpeUdo_HexNNv2GlobalInfra_t Udo_HexNNv2GlobalInfra_t
typedef enum hexnnInfraType SnpeUdo_HexNNInfraType_t
typedef SnpeUdo_HexNNInfraType_t Udo_HexNNInfraType_t
typedef struct dspGlobalInfrastructure SnpeUdo_DspGlobalInfrastructure_t

Infrastructures needed by a developer of DSP Hexnn UDO Implementation library.

The framework/runtime which loads the Hexnn UDO implementation library provides this infrastructure to the loaded library by calling “SnpeUdo_initImplLibrary” function, and passing it (cast to void*). The Hexnn UDO library is expected to cast it back to this structure.

typedef SnpeUdo_DspGlobalInfrastructure_t Udo_DspGlobalInfrastructure_t
typedef struct hexnnv2OpFactoryInfra SnpeUdo_HexNNv2OpFactoryInfra_t

hexnn v2 per op factory infrastructure

The framework/runtime passes per op factory infrastructure as a void pointer to HexNN UDO implementation library by calling function “SnpeUdo_createOpFactory”. UDO implementation library is expected to cast it back to this following struct.

typedef SnpeUdo_HexNNv2OpFactoryInfra_t Udo_HexNNv2OpFactoryInfra_t
typedef void *SnpeUdo_HexNNv2OpInfra_t

hexnn v2 per operation infrastructure

The framework/runtime passes per operation infrastructure as a void pointer to HexNN UDO implementation library by calling function “SnpeUdo_createOperation”. UDO implementation library is expected to cast it to the following type and save it.

This is needed to be passed back into some functions from global infrastructure.

typedef SnpeUdo_HexNNv2OpInfra_t Udo_HexNNv2OpInfra_t

Enums

enum SnpeUdo_HexNNTensorLayout_t

Values:

enumerator SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00
enumerator UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00
enumerator SNPE_UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
enumerator UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
enumerator SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00
enumerator UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00
enumerator SNPE_UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
enumerator UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
enum hexnnInfraType

Values:

enumerator UDO_INFRA_HEXNN_V2
enumerator UDO_INFRA_HEXNN_V3
enumerator UDO_INFRA_HEXNN_V2
enumerator UDO_INFRA_HEXNN_V3

Functions

SnpeUdo_ErrorType_t SnpeUdo_validateOperation(SnpeUdo_String_t operationType, uint32_t numOfStaticParams, const SnpeUdo_Param_t *staticParams)

A function to validate that a set of params is supported by an operation This function is HexNN specific, use case is when registration library is not in use. Optional function.

Parameters
  • operationType[in] Operation type

  • numOfStaticParams[in] Number of static params defined by the op

  • staticParams[in] Array of static params to the op

Returns

Error code, indicating if the operation can be created on this set of configuration or not.

SnpeUdo_ErrorType_t SnpeUdo_queryOperation(SnpeUdo_String_t operationType, uint32_t numOfStaticParams, const SnpeUdo_Param_t *staticParams, uint32_t *numOfInputs, SnpeUdo_QuantizationType_t **inputsQuantTypes, SnpeUdo_HexNNTensorLayout_t **inputsLayouts, uint32_t *numOfOutputs, SnpeUdo_QuantizationType_t **outputsQuantTypes, SnpeUdo_HexNNTensorLayout_t **outputsLayouts)

A function to query numbers of inputs and outputs, quantization type of each input and each output as arrays, and data layout (plain vs d32) of each input and each output as arrays of an operation. inputsQuantTypes and inputsLayouts should point to arrays of size numOfInputs outputsQuantTypes and outputsLayouts should point to arrays of size numOfOutputs.

Note: inputsLayouts and inputsLayouts can point to NULL, in this case, it is assumed all inputs and/or outputs have plain data layouts, i.e. no D32

Parameters
  • operationType[in] Operation type

  • numOfStaticParams[in] Number of static params defined by the op

  • staticParams[in] Array of static params to the op

  • numOfInputs[inout] Number of input tensors to the op

  • inputsQuantTypes[inout] Array of Quantization info for each input tensor

  • inputsLayouts[inout] Array of layout type for each input tensor

  • numOfOutputs[inout] Number of output tensors to the op

  • outputsQuantTypes[inout] Array of Quantization info for each output tensor

  • outputsLayouts[inout] Array of layout type for each output tensor

Returns

error code, indicating status of query

struct hexNNv2GlobalInfra
#include <UdoImplDsp.h>

Public Members

udoSetOutputTensorSize_t udoSetOutputTensorSize
udoGetInputD32Paddings_t udoGetInputD32Paddings
udoSetOutputD32ShapeSizePaddings_t udoSetOutputD32ShapeSizePaddings
udoMemalign_t udoMemalign
udoMalloc_t udoMalloc
udoCalloc_t udoCalloc
udoFree_t udoFree
udoGetVtcmSize_t udoGetVtcmSize
udoGetVtcmPtr_t udoGetVtcmPtr
udoVtcmIsReal_t udoVtcmIsReal
udoRunWorkerThreads_t udoRunWorkerThreads
struct udo_func_package_t
#include <UdoImplDsp.h>
struct dspGlobalInfrastructure
#include <UdoImplDsp.h>

Infrastructures needed by a developer of DSP Hexnn UDO Implementation library.

The framework/runtime which loads the Hexnn UDO implementation library provides this infrastructure to the loaded library by calling “SnpeUdo_initImplLibrary” function, and passing it (cast to void*). The Hexnn UDO library is expected to cast it back to this structure.

Public Members

SnpeUdo_Version_t dspInfraVersion
SnpeUdo_HexNNInfraType_t infraType
SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra
struct hexnnv2OpFactoryInfra
#include <UdoImplDsp.h>

hexnn v2 per op factory infrastructure

The framework/runtime passes per op factory infrastructure as a void pointer to HexNN UDO implementation library by calling function “SnpeUdo_createOpFactory”. UDO implementation library is expected to cast it back to this following struct.

Public Members

unsigned long graphId