File UdoBase.h

Parent directory (SnpeUdo)

Definition (SnpeUdo/UdoBase.h)

Includes

  • stdint.h

Included By

Full File Listing

Defines

API_VERSION_MAJOR 1
API_VERSION_MINOR 6
API_VERSION_TEENY 0
SNPE_UDO_MAX_STRING_SIZE 1024

Typedefs

typedef uint32_t SnpeUdo_Bitmask_t
typedef SnpeUdo_Bitmask_t Udo_Bitmask_t
typedef char *SnpeUdo_String_t
typedef SnpeUdo_String_t Udo_String_t
typedef SnpeUdo_ErrorType_t Udo_ErrorType_t
typedef SnpeUdo_DataType_t Udo_DataType_t
typedef SnpeUdo_TensorLayout_t Udo_TensorLayout_t
typedef SnpeUdo_CoreType_t Udo_CoreType_t
typedef SnpeUdo_ParamType_t Udo_ParamType_t
typedef SnpeUdo_QuantizationType_t Udo_QuantizationType_t
typedef SnpeUdo_Version_t Udo_Version_t
typedef SnpeUdo_Value_t Udo_Value_t
typedef SnpeUdo_ScalarParam_t Udo_ScalarParam_t
typedef SnpeUdo_TFQuantize_t Udo_TFQuantize_t
typedef SnpeUdo_QuantizeParams_t Udo_QuantizeParams_t
typedef SnpeUdo_PerCoreDatatype_t Udo_PerCoreDatatype_t
typedef SnpeUdo_TensorParam_t Udo_TensorParam_t
typedef SnpeUdo_TensorInfo_t Udo_TensorInfo_t
typedef SnpeUdo_Param_t Udo_Param_t
typedef SnpeUdo_OpCoreInfo_t Udo_OpCoreInfo_t
typedef SnpeUdo_OperationInfo_t Udo_OperationInfo_t
typedef SnpeUdo_LibraryInfo_t Udo_LibraryInfo_t
typedef SnpeUdo_RegInfo_t Udo_RegInfo_t
typedef SnpeUdo_ImpInfo_t Udo_ImpInfo_t
typedef SnpeUdo_OpDefinition_t Udo_OpDefinition_t

Enums

enum SnpeUdo_ErrorType_t

An enum which holds the various error types. The error types are divided to classes : 0 - 99 : generic errors 100 - 200 : errors related to configuration

Values:

enumerator SNPE_UDO_NO_ERROR = 0

No Error.

enumerator UDO_NO_ERROR = 0
enumerator SNPE_UDO_WRONG_CORE = 1

Unsupported value for core type.

enumerator UDO_WRONG_CORE = 1
enumerator SNPE_UDO_INVALID_ARGUMENT = 2

Invalid attribute/argument passed into UDO API.

enumerator UDO_INVALID_ARGUMENT = 2
enumerator SNPE_UDO_UNSUPPORTED_FEATURE = 3

Unsupported feature error.

enumerator UDO_UNSUPPORTED_FEATURE = 3
enumerator SNPE_UDO_MEM_ALLOC_ERROR = 4

Error relating to memory allocation.

enumerator UDO_MEM_ALLOC_ERROR = 4
enumerator SNPE_UDO_WRONG_OPERATION = 100

No op with given attributes available in library.

enumerator UDO_WRONG_OPERATION = 100
enumerator SNPE_UDO_WRONG_CORE_TYPE = 101

Unsupported value for core type in UDO configuration.

enumerator UDO_WRONG_CORE_TYPE = 101
enumerator SNPE_UDO_WRONG_NUM_OF_PARAMS = 102

Wrong number of params in UDO definition.

enumerator UDO_WRONG_NUM_OF_PARAMS = 102
enumerator SNPE_UDO_WRONG_NUM_OF_DIMENSIONS = 103

Wrong number of dimensions for tensor(s) in UDO definition.

enumerator UDO_WRONG_NUM_OF_DIMENSIONS = 103
enumerator SNPE_UDO_WRONG_NUM_OF_INPUTS = 104

Wrong number of input tensors in UDO definition.

enumerator UDO_WRONG_NUM_OF_INPUTS = 104
enumerator SNPE_UDO_WRONG_NUM_OF_OUTPUTS = 105

Wrong number of output tensors in UDO definition.

enumerator UDO_WRONG_NUM_OF_OUTPUTS = 105
enumerator SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106
enumerator UDO_PROGRAM_CACHE_NOT_FOUND = 106
enumerator SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF
enumerator UDO_UNKNOWN_ERROR = 0xFFFFFFFF
enum SnpeUdo_DataType_t

An enum which holds the various data types. Designed to be used as single values or combined into a bitfield parameter (0x1, 0x2, 0x4, etc)

FIXED_XX types are targeted for data in tensors.

UINT / INT types are targeted for scalar params

Values:

enumerator SNPE_UDO_DATATYPE_FLOAT_16 = 0x01

data type: 16-bit floating point

enumerator UDO_DATATYPE_FLOAT_16 = 0x01
enumerator SNPE_UDO_DATATYPE_FLOAT_32 = 0x02

data type: 32-bit floating point

enumerator UDO_DATATYPE_FLOAT_32 = 0x02
enumerator SNPE_UDO_DATATYPE_FIXED_4 = 0x04

data type: 4-bit fixed point

enumerator UDO_DATATYPE_FIXED_4 = 0x04
enumerator SNPE_UDO_DATATYPE_FIXED_8 = 0x08

data type: 8-bit fixed point

enumerator UDO_DATATYPE_FIXED_8 = 0x08
enumerator SNPE_UDO_DATATYPE_FIXED_16 = 0x10

data type: 16-bit fixed point

enumerator UDO_DATATYPE_FIXED_16 = 0x10
enumerator SNPE_UDO_DATATYPE_FIXED_32 = 0x20

data type: 32-bit fixed point

enumerator UDO_DATATYPE_FIXED_32 = 0x20
enumerator SNPE_UDO_DATATYPE_UINT_8 = 0x100

data type: 8-bit unsigned integer

enumerator UDO_DATATYPE_UINT_8 = 0x100
enumerator SNPE_UDO_DATATYPE_UINT_16 = 0x200

data type: 16-bit unsigned integer

enumerator UDO_DATATYPE_UINT_16 = 0x200
enumerator SNPE_UDO_DATATYPE_UINT_32 = 0x400

data type: 32-bit unsigned integer

enumerator UDO_DATATYPE_UINT_32 = 0x400
enumerator SNPE_UDO_DATATYPE_INT_8 = 0x1000

data type: 8-bit signed integer

enumerator UDO_DATATYPE_INT_8 = 0x1000
enumerator SNPE_UDO_DATATYPE_INT_16 = 0x2000

data type: 16-bit signed integer

enumerator UDO_DATATYPE_INT_16 = 0x2000
enumerator SNPE_UDO_DATATYPE_INT_32 = 0x4000

data type: 32-bit signed integer

enumerator UDO_DATATYPE_INT_32 = 0x4000
enumerator SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF
enumerator UDO_DATATYPE_LAST = 0xFFFFFFFF
enum SnpeUdo_TensorLayout_t

An enum which holds the various layouts. Designed to be used as single values or combined into a bitfield parameter (0x1, 0x2, 0x4, etc)

Values:

enumerator SNPE_UDO_LAYOUT_NHWC = 0x01

data layout (4D): NHWC (batch-height-width-channel)

enumerator UDO_LAYOUT_NHWC = 0x01
enumerator SNPE_UDO_LAYOUT_NCHW = 0x02

data layout (4D): NCHW (batch-channel-height-width)

enumerator UDO_LAYOUT_NCHW = 0x02
enumerator SNPE_UDO_LAYOUT_NDHWC = 0x04

data layout (5D): NDHWC (batch-depth-height-width-channel)

enumerator UDO_LAYOUT_NDHWC = 0x04
enumerator SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08
enumerator UDO_LAYOUT_GPU_OPTIMAL1 = 0x08
enumerator SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10
enumerator UDO_LAYOUT_GPU_OPTIMAL2 = 0x10
enumerator SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11
enumerator UDO_LAYOUT_DSP_OPTIMAL1 = 0x11
enumerator SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12
enumerator UDO_LAYOUT_DSP_OPTIMAL2 = 0x12
enumerator SNPE_UDO_LAYOUT_NULL = 0x13
enumerator UDO_LAYOUT_NULL = 0x13
enumerator SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF
enumerator UDO_LAYOUT_LAST = 0xFFFFFFFF
enum SnpeUdo_CoreType_t

An enum which holds the UDO library Core type . Designed to be used as single values or combined into a bitfield parameter (0x1, 0x2, 0x4, etc)

Values:

enumerator SNPE_UDO_CORETYPE_UNDEFINED = 0x00

Library target IP Core is undefined.

enumerator UDO_CORETYPE_UNDEFINED = 0x00
enumerator SNPE_UDO_CORETYPE_CPU = 0x01

Library target IP Core is CPU.

enumerator UDO_CORETYPE_CPU = 0x01
enumerator SNPE_UDO_CORETYPE_GPU = 0x02

Library target IP Core is GPU.

enumerator UDO_CORETYPE_GPU = 0x02
enumerator SNPE_UDO_CORETYPE_DSP = 0x04

Library target IP Core is DSP.

enumerator UDO_CORETYPE_DSP = 0x04
enumerator SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF
enumerator UDO_CORETYPE_LAST = 0xFFFFFFFF
enum SnpeUdo_ParamType_t

An enum to specify the parameter type : Scalar or Tensor

Values:

enumerator SNPE_UDO_PARAMTYPE_SCALAR = 0x00

UDO static param type: scalar.

enumerator UDO_PARAMTYPE_SCALAR = 0x00
enumerator SNPE_UDO_PARAMTYPE_STRING = 0x01

UDO static param type: string.

enumerator UDO_PARAMTYPE_STRING = 0x01
enumerator SNPE_UDO_PARAMTYPE_TENSOR = 0x02

UDO static param type: tensor.

enumerator UDO_PARAMTYPE_TENSOR = 0x02
enumerator SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF
enumerator UDO_PARAMTYPE_LAST = 0xFFFFFFFF
enum SnpeUdo_QuantizationType_t

An enum to specify quantization type

Values:

enumerator SNPE_UDO_QUANTIZATION_NONE = 0x00

Tensor Quantization type: NONE. Signifies unquantized tensor data.

enumerator UDO_QUANTIZATION_NONE = 0x00
enumerator SNPE_UDO_QUANTIZATION_TF = 0x01

Tensor Quantization type: Tensorflow-style.

enumerator UDO_QUANTIZATION_TF = 0x01
enumerator SNPE_UDO_QUANTIZATION_QMN = 0x02
enumerator UDO_QUANTIZATION_QMN = 0x02
enumerator SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF
enumerator UDO_QUANTIZATION_LAST = 0xFFFFFFFF
struct SnpeUdo_Version_t
#include <UdoBase.h>

A struct which is used to provide a version number using 3 values : major, minor, teeny.

Public Members

uint32_t major

version field: major - for backward-incompatible changes

uint32_t minor

version field: minor - for backward-compatible feature updates

uint32_t teeny

version field: teeny - for minor bug-fixes and clean-up

struct SnpeUdo_LibVersion_t
#include <UdoBase.h>

A struct returned from version query, contains the Library version and API version.

Public Members

SnpeUdo_Version_t libVersion

Version of UDO library. Controlled by users.

SnpeUdo_Version_t apiVersion

Version of SNPE UDO API used in compiling library. Determined by SNPE.

struct Udo_PkgVersion_t
#include <UdoBase.h>

A struct returned from version query, contains the package version.

Public Members

Udo_Version_t apiVersion

Version of UDO API used in package.

union SnpeUdo_Value_t
#include <UdoBase.h>

A union to hold the value of a generic type. Allows defining a parameter struct in a generic way, with a “value” location that holds the data regardless of the type.

Public Members

float floatValue

value type: float

uint32_t uint32Value

value type: unsigned 32-bit integer

int32_t int32Value

value type: signed 32-bit integer

uint16_t uint16Value

value type: unsigned 16-bit integer

int16_t int16Value

value type: signed 16-bit integer

uint8_t uint8Value

value type: unsigned 8-bit integer

int8_t int8Value

value type: signed 8-bit integer

struct SnpeUdo_ScalarParam_t
#include <UdoBase.h>

A struct which defines a scalar parameter : name, data type, and union of values.

Public Members

SnpeUdo_DataType_t dataType

The parameter data type : float, int, etc.

SnpeUdo_Value_t dataValue

a union of specified type which holds the data

struct SnpeUdo_TFQuantize_t
#include <UdoBase.h>

A struct which defines the quantization parameters in case of Tensorflow style quantization.

Public Members

float minValue

minimum value of the quantization range of data

float maxValue

maximum value of the quantization range of data

struct SnpeUdo_QuantizeParams_t
#include <UdoBase.h>

A struct which defines the quantization type, and union of supported quantization structs.

Public Members

SnpeUdo_QuantizationType_t quantizeType

quantization type (only TF-style currently supported)

SnpeUdo_TFQuantize_t TFParams

TF-style min-max quantization ranges.

union SnpeUdo_QuantizeParams_t::[anonymous] [anonymous]
struct SnpeUdo_PerCoreDatatype_t
#include <UdoBase.h>

A struct which defines the datatype associated with a specified core-type This should be used to denote the datatypes for a single tensor info, depending on the intended execution core.

Public Members

SnpeUdo_CoreType_t coreType

The IP Core.

SnpeUdo_DataType_t dataType

The associated datatype for this coreType.

struct SnpeUdo_TensorParam_t
#include <UdoBase.h>

A struct which defines a tensor parameter : name, data type, layout, quantization, more. Also holds a pointer to the tensor data.

Public Members

uint32_t *maxDimensions

The maximum allowable dimensions of the tensor. The memory held in tensorData is guaranteed to be large enough for this.

uint32_t *currDimensions

The current dimensions of the tensor. An operation may modify the current dimensions of its output, to indicate cases where the output has been “resized”. Note that for static parameters, the current and max dimensions must match.

SnpeUdo_QuantizeParams_t quantizeParams

Quantization params applicable to the tensor. Currently only supports Tensorflow quantization style.

uint32_t tensorRank

Number of dimensions to the tensor: 3D, 4D, etc.

SnpeUdo_DataType_t dataType

The parameter data type: float, int, etc.

SnpeUdo_TensorLayout_t layout

The tensor layout type: NCHW, NHWC, etc.

void *tensorData

Opaque pointer to tensor data. User may be required to re-interpret the pointer based on core-specific definitions.

struct SnpeUdo_TensorInfo_t
#include <UdoBase.h>

A struct which defines tensor information for activation tensors only.

It describes an activation tensor object using its name, the intended layout and the datatype it will take depending on the intended runtime core. The repeated field indicates that that the tensor info describes several input/output activation tensors, which all share the aforementioned properties.

Public Members

SnpeUdo_String_t tensorName

The tensor name.

SnpeUdo_TensorLayout_t layout

The tensor layout type: NCHW, NHWC, etc.

SnpeUdo_PerCoreDatatype_t *perCoreDatatype

The per core datatype: {SNPE_UDO_DATATYPE, SNPE_UDO_CORE_TYPE}.

bool repeated

A boolean field indicating that this tensorinfo will be repeated e.x for ops such as Concat or Split.

bool isStatic

A boolean field indicating whether input is static or not.

struct SnpeUdo_Param_t
#include <UdoBase.h>

struct which defines a UDO parameter - a union of scalar, tensor and string parameters

Public Members

SnpeUdo_ParamType_t paramType

Type is scalar or tensor.

SnpeUdo_String_t paramName

The param name, for example : “offset”, “activation_type”.

SnpeUdo_ScalarParam_t scalarParam

scalar param value

SnpeUdo_TensorParam_t tensorParam

tensor param value

SnpeUdo_String_t stringParam

string param value

union SnpeUdo_Param_t::[anonymous] [anonymous]
struct SnpeUdo_OpCoreInfo_t
#include <UdoBase.h>

A struct which defines Operation information which is specific for IP core (CPU, GPU, DSP …)

Public Members

SnpeUdo_CoreType_t udoCoreType

The IP Core.

SnpeUdo_Bitmask_t operationCalculationTypes

Bitmask, defines supported internal calculation types (like FLOAT_32, etc) Based on SnpeUdo_DataType

struct SnpeUdo_OperationInfo_t
#include <UdoBase.h>

A struct which defines the common and core-specific Operation information.

Public Members

SnpeUdo_String_t operationType

Operation type.

SnpeUdo_Bitmask_t supportedByCores

A bitmask describing which IP Cores (CPU, GPU, DSP …) support this operation Translated based on SnpeUdo_CoreType

uint32_t numOfStaticParams

Number of static parameters defined by the op.

SnpeUdo_Param_t *staticParams

Array of static parameters. Can be scalar or tensor params.

uint32_t numOfInputs

Number of input tensors this op receives.

SnpeUdo_String_t *inputNames

Array of input tensor names to this operation.

uint32_t numOfOutputs

Number of output tensors this op receives.

SnpeUdo_String_t *outputNames

Array of output tensor names to this operation.

uint32_t numOfCoreInfo

Number of cores that the op can execute on.

SnpeUdo_OpCoreInfo_t *opPerCoreInfo

Array of per-core information entries.

SnpeUdo_TensorInfo_t *inputInfos

Array of input tensor infos for this operation.

SnpeUdo_TensorInfo_t *outputInfos

Array of output tensor infos for this operation.

struct SnpeUdo_LibraryInfo_t
#include <UdoBase.h>

A struct which provides the implementation library info : type, name.

Public Members

SnpeUdo_CoreType_t udoCoreType

Defines the IP Core that this implementation library is targeting.

SnpeUdo_String_t libraryName

library name. will be looked at in the standard library path

struct SnpeUdo_RegInfo_t
#include <UdoBase.h>

A struct returned by the registration library and contains information on the UDO package : name, operations, libraries, etc.

Public Members

SnpeUdo_String_t packageName

A string containing the package name.

SnpeUdo_Bitmask_t supportedCoreTypes

A bitmask describing supported IP cores (CPU, GPU, DSP …) Translated based on SnpeUdo_CoreType

uint32_t numOfImplementationLib

The number of implementation libraries in the package.

SnpeUdo_LibraryInfo_t *implementationLib

Array of implementation libraries names/types.

SnpeUdo_String_t operationsString

A string containing all operation types separated by space.

uint32_t numOfOperations

Number of supported operations.

SnpeUdo_OperationInfo_t *operationsInfo

Array of Operation info structs. Each entry describes one Operation (name, params, inputs, outputs)

struct SnpeUdo_ImpInfo_t
#include <UdoBase.h>

A struct returned by the implementation library and contains information on the specific library: name, IP Core, operations, etc.

Public Members

SnpeUdo_CoreType_t udoCoreType

Defines the IP Core that this implementation library is targeting.

SnpeUdo_String_t packageName

A string containing the package name.

SnpeUdo_String_t operationsString

A string containing all operation types separated by space.

uint32_t numOfOperations

Number of supported operations.

struct SnpeUdo_OpDefinition_t
#include <UdoBase.h>

This struct defines an operation. It is used for validation or creation of an operation. In case of using it for creation, the static params which are tensors contain pointers to the real data (weights, for example), and input/output tensors also include pointers to the buffers used.

Public Members

SnpeUdo_CoreType_t udoCoreType

The IP Core that the operation is defined for - CPU, GPU, DSP…

SnpeUdo_String_t operationType

Operation type.

uint32_t numOfStaticParams

The number of static parameters provided in the staticParams array. this number has to match the number provided by the UDO Registration library information

SnpeUdo_Param_t *staticParams

Array of static parameters.

uint32_t numOfInputs

The number of input parameters provided in inputs array. this number has to match the number provided by the UDO Registration library information

SnpeUdo_TensorParam_t *inputs

Array of input tensors, providing layout, data type, sizes, etc When used to create an operation, also contains the initial location of the data

uint32_t numOfOutputs

The number of output parameters provided in inputs array. this number has to match the number provided by the UDO Registration library information

SnpeUdo_TensorParam_t *outputs

Array of output tensors, providing layout, data type, sizes, etc When used to create an operation, also contains the initial location of the data