Snapdragon Neural Processing Engine SDK
Reference Guide
C++

Classes

class  Optional
 
class  Version_t
 
class  IDiagLog
 
class  IDlContainer
 
class  ITensor
 
class  ITensorFactory
 
class  IUDL
 
class  UserBufferEncoding
 
class  UserBufferSource
 
class  UserBufferSourceGLBuffer
 
class  UserBufferEncodingUnsigned8Bit
 
class  UserBufferEncodingFloat
 
class  UserBufferEncodingTfN
 
class  IUserBuffer
 
class  IUserBufferFactory
 
class  Options
 
struct  UserGLConfig
 
struct  UserGpuConfig
 
class  PlatformConfig
 
class  PlatformValidator
 
class  SNPE
 
class  SNPEBuilder
 
class  SNPEFactory
 
class  StringList
 
class  TensorMap
 
class  TensorShape
 
class  TensorShapeMap
 
class  UDLContext
 
struct  UDLBundle
 
struct  SnpeUdo_Version_t
 
struct  SnpeUdo_LibVersion_t
 
union  SnpeUdo_Value_t
 
struct  SnpeUdo_ScalarParam_t
 
struct  SnpeUdo_TFQuantize_t
 
struct  SnpeUdo_QuantizeParams_t
 
struct  SnpeUdo_PerCoreDatatype_t
 
struct  SnpeUdo_TensorParam_t
 
struct  SnpeUdo_TensorInfo_t
 
struct  SnpeUdo_Param_t
 
struct  SnpeUdo_OpCoreInfo_t
 
struct  SnpeUdo_OperationInfo_t
 
struct  SnpeUdo_LibraryInfo_t
 
struct  SnpeUdo_RegInfo_t
 
struct  SnpeUdo_ImpInfo_t
 
struct  SnpeUdo_OpDefinition_t
 
struct  SnpeUdo_CpuInfrastructure_t
 
struct  dspGlobalInfrastructure
 
struct  hexnnv2OpFactoryInfra
 
struct  SnpeUdo_GpuInfrastructure_t
 
struct  SnpeUdo_GpuOpFactoryInfrastructure_t
 
struct  SnpeUdo_GpuTensorData_t
 
class  UserBufferMap
 

Typedefs

using Dimension = size_t
 
using UDLFactoryFunc = std::function< zdl::DlSystem::IUDL *(void *, const zdl::DlSystem::UDLContext *)>
 
typedef SnpeUdo_ErrorType_t(* SnpeUdo_ExternalNotify_t) (const uint32_t ID)
 
typedef struct dspGlobalInfrastructure SnpeUdo_DspGlobalInfrastructure_t
 
typedef struct hexnnv2OpFactoryInfra SnpeUdo_HexNNv2OpFactoryInfra_t
 
typedef void * SnpeUdo_HexNNv2OpInfra_t
 
typedef SnpeUdo_ErrorType_t(* SnpeUdo_getProgram_t) (void *programCache, const char *programName, cl_program *program)
 
typedef SnpeUdo_ErrorType_t(* SnpeUdo_storeProgram_t) (void *programCache, const char *programName, cl_program program)
 

Enumerations

enum  Runtime_t {
  CPU_FLOAT32 = 0, GPU_FLOAT32_16_HYBRID = 1, DSP_FIXED8_TF = 2, GPU_FLOAT16 = 3,
  AIP_FIXED8_TF = 5 , CPU = CPU_FLOAT32, GPU = GPU_FLOAT32_16_HYBRID, DSP = DSP_FIXED8_TF
}
 
enum  RuntimeCheckOption_t
 
enum  PerformanceProfile_t { DEFAULT = 0 }
 
enum  ProfilingLevel_t { OFF = 0, BASIC = 1, DETAILED = 2, MODERATE = 3 }
 
enum  ExecutionPriorityHint_t
 
enum  SnpeUdo_ErrorType_t
 
enum  SnpeUdo_DataType_t
 
enum  SnpeUdo_TensorLayout_t
 
enum  SnpeUdo_CoreType_t
 
enum  SnpeUdo_ParamType_t
 
enum  SnpeUdo_QuantizationType_t
 

Functions

ZDL_EXPORT ErrorCode getLastErrorCode ()
 
ZDL_EXPORT const char * getLastErrorString ()
 
ZDL_EXPORT const char * getLastInfoString ()
 
ZDL_EXPORT uint32_t enumToUInt32 (zdl::DlSystem::ErrorCode code)
 
 Optional ()
 
template<typename Q = T>
 Optional (const T &v, typename std::enable_if<!std::is_pointer< Q >::value >::type *=0)
 
 operator bool () const noexcept
 
const T & operator* ()
 
const T & operator* () const
 
const std::string toString () const
 
const zdl::DlSystem::String asString () const
 
virtual bool setOptions (const Options &loggingOptions)=0
 
virtual Options getOptions ()=0
 
virtual bool setDiagLogMask (const std::string &mask)=0
 
virtual bool setDiagLogMask (const zdl::DlSystem::String &mask)=0
 
virtual bool start (void)=0
 
static std::unique_ptr< IDlContaineropen (const std::string &filename) noexcept
 
static std::unique_ptr< IDlContaineropen (const zdl::DlSystem::String &filename) noexcept
 
static std::unique_ptr< IDlContaineropen (const std::vector< uint8_t > &buffer) noexcept
 
static std::unique_ptr< IDlContaineropen (const uint8_t *buffer, const size_t size) noexcept
 
virtual iterator begin ()=0
 
virtual const_iterator cbegin () const =0
 
virtual iterator end ()=0
 
virtual const_iterator cend () const =0
 
virtual TensorShape getShape () const =0
 
virtual size_t getSize () const =0
 
virtual void serialize (std::ostream &output) const =0
 
virtual std::unique_ptr< ITensorcreateTensor (const TensorShape &shape) noexcept=0
 
virtual std::unique_ptr< ITensorcreateTensor (std::istream &input) noexcept=0
 
virtual std::unique_ptr< ITensorcreateTensor (const TensorShape &shape, const unsigned char *data, size_t dataSize) noexcept=0
 
 StringList (size_t length)
 
void append (const char *str)
 
const char * at (size_t idx) const noexcept
 
const char ** begin () const noexcept
 
const char ** end () const noexcept
 
size_t size () const noexcept
 
StringListoperator= (const StringList &) noexcept
 
 StringList (const StringList &other)
 
 StringList (StringList &&other) noexcept
 
 TensorMap ()
 
 TensorMap (const TensorMap &other)
 
TensorMapoperator= (const TensorMap &other)
 
void add (const char *name, zdl::DlSystem::ITensor *tensor)
 
void remove (const char *name) noexcept
 
void clear () noexcept
 
zdl::DlSystem::ITensorgetTensor (const char *name) const noexcept
 
zdl::DlSystem::StringList getTensorNames () const
 
 TensorShape (std::initializer_list< Dimension > dims)
 
 TensorShape (const Dimension *dims, size_t size)
 
 TensorShape (std::vector< Dimension > dims)
 
 TensorShape (const TensorShape &other)
 
TensorShapeoperator= (const TensorShape &other)
 
 TensorShape ()
 
void concatenate (std::initializer_list< Dimension > dims)
 
void concatenate (const Dimension *dims, size_t size)
 
void concatenate (const Dimension &dim)
 
Dimensionoperator[] (size_t index)
 
size_t rank () const
 
const DimensiongetDimensions () const
 
 TensorShapeMap ()
 
 TensorShapeMap (const TensorShapeMap &other)
 
TensorShapeMapoperator= (const TensorShapeMap &other)
 
void add (const char *name, const zdl::DlSystem::TensorShape &tensorShape)
 
void remove (const char *name) noexcept
 
void clear () noexcept
 
zdl::DlSystem::TensorShape getTensorShape (const char *name) const noexcept
 
zdl::DlSystem::StringList getTensorShapeNames () const
 
ZDL_EXPORT zdl::DlSystem::IUDLDefaultUDLFunc (void *, const zdl::DlSystem::UDLContext *)
 
SnpeUdo_ErrorType_t SnpeUdo_initImplLibrary (void *globalInfrastructure)
 
SnpeUdo_ErrorType_t SnpeUdo_getImplVersion (SnpeUdo_LibVersion_t **version)
 
SnpeUdo_ErrorType_t SnpeUdo_terminateImplLibrary (void)
 
SnpeUdo_ErrorType_t SnpeUdo_getImpInfo (SnpeUdo_ImpInfo_t **implementationInfo)
 
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)
 
SnpeUdo_ErrorType_t SnpeUdo_releaseOpFactory (SnpeUdo_OpFactory_t opFactory)
 
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)
 
SnpeUdo_ErrorType_t SnpeUdo_executeOp (SnpeUdo_Operation_t operation, bool blocking, const uint32_t ID, SnpeUdo_ExternalNotify_t notifyFunc)
 
SnpeUdo_ErrorType_t SnpeUdo_setOpIO (SnpeUdo_Operation_t operation, SnpeUdo_TensorParam_t *inputs, SnpeUdo_TensorParam_t *outputs)
 
SnpeUdo_ErrorType_t SnpeUdo_profileOp (SnpeUdo_Operation_t operation, uint32_t *executionTime)
 
SnpeUdo_ErrorType_t SnpeUdo_releaseOp (SnpeUdo_Operation_t operation)
 
SnpeUdo_ErrorType_t SnpeUdo_validateOperation (SnpeUdo_String_t operationType, uint32_t numOfStaticParams, const SnpeUdo_Param_t *staticParams)
 
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)
 
SnpeUdo_ErrorType_t SnpeUdo_initRegLibrary (void)
 
SnpeUdo_ErrorType_t SnpeUdo_getRegLibraryVersion (SnpeUdo_LibVersion_t **version)
 
SnpeUdo_ErrorType_t SnpeUdo_terminateRegLibrary (void)
 
SnpeUdo_ErrorType_t SnpeUdo_getRegInfo (SnpeUdo_RegInfo_t **registrationInfo)
 
SnpeUdo_ErrorType_t SnpeUdo_validateOperation (SnpeUdo_OpDefinition_t *opDefinition)
 
SnpeUdo_ErrorType_t SnpeUdo_getVersion (SnpeUdo_LibVersion_t **version)
 

Variables

int32_t Major
 
int32_t Minor
 
int32_t Teeny
 
std::string Build
 

Detailed Description

This module defines the SNPE C++ APIs


Class Documentation

◆ zdl::DlSystem::Optional

class zdl::DlSystem::Optional

Class to manage a value that may or may not exist. The boolean value of the Optional class is true if the object contains a value and false if it does not contain a value.

The class must be evaluated and confirmed as true (containing a value) before being dereferenced.

Public Member Functions

 Optional ()
 
template<typename Q = T>
 Optional (const T &v, typename std::enable_if<!std::is_pointer< Q >::value >::type *=0)
 
 operator bool () const noexcept
 
const T & operator* ()
 
const T & operator* () const
 

◆ zdl::DlSystem::Version_t

class zdl::DlSystem::Version_t

A class that contains the different portions of a version number.

Public Member Functions

const std::string toString () const
 
const zdl::DlSystem::String asString () const
 

Public Attributes

int32_t Major
 
int32_t Minor
 
int32_t Teeny
 
std::string Build
 

◆ zdl::DiagLog::IDiagLog

class zdl::DiagLog::IDiagLog

Interface for controlling logging for zdl components.

Public Member Functions

virtual bool setOptions (const Options &loggingOptions)=0
 
virtual Options getOptions ()=0
 
virtual bool setDiagLogMask (const std::string &mask)=0
 
virtual bool setDiagLogMask (const zdl::DlSystem::String &mask)=0
 
virtual bool start (void)=0
 

◆ zdl::DlContainer::IDlContainer

class zdl::DlContainer::IDlContainer

Represents a container for a neural network model which can be used to load the model into the SNPE runtime.

Public Member Functions

virtual bool save (const std::string &filename)=0
 
virtual bool save (const zdl::DlSystem::String &filename)=0
 

Static Public Member Functions

static std::unique_ptr< IDlContaineropen (const std::string &filename) noexcept
 
static std::unique_ptr< IDlContaineropen (const zdl::DlSystem::String &filename) noexcept
 
static std::unique_ptr< IDlContaineropen (const std::vector< uint8_t > &buffer) noexcept
 
static std::unique_ptr< IDlContaineropen (const uint8_t *buffer, const size_t size) noexcept
 

Member Function Documentation

◆ save() [1/2]

virtual bool save ( const std::string &  filename)
pure virtual

Save the container to an archive on disk. This function will save the container if the filename is different from the file that it was opened from, or if at least one record was modified since the container was opened.

It will truncate any existing file at the target path.

Parameters
filenameContainer archive file path.
Returns
indication of success/failure

◆ save() [2/2]

virtual bool save ( const zdl::DlSystem::String &  filename)
pure virtual

Save the container to an archive on disk. This function will save the container if the filename is different from the file that it was opened from, or if at least one record was modified since the container was opened.

It will truncate any existing file at the target path.

Parameters
filenameContainer archive file path.
Returns
indication of success/failure

◆ zdl::DlSystem::ITensor

class zdl::DlSystem::ITensor

Represents a tensor which holds n-dimensional data. It is important to understand how the tensor data is represented in memory relative to the tensor dimensions. Tensors store data in memory in row-major order (i.e. the last tensor dimension is the fastest varying one). For example, if you have a two dimensional tensor with 3 rows and 2 columns (i.e. the tensor dimensions are 3,2 as returned in tensor dimension vectors) with the following data in terms rows and columns:

| 1 2 |
| 3 4 |
| 5 6 |

This data would be stored in memory as 1,2,3,4,5,6.

Public Member Functions

virtual iterator begin ()=0
 
virtual const_iterator cbegin () const =0
 
virtual iterator end ()=0
 
virtual const_iterator cend () const =0
 
virtual TensorShape getShape () const =0
 
virtual size_t getSize () const =0
 
virtual void serialize (std::ostream &output) const =0
 

◆ zdl::DlSystem::ITensorFactory

class zdl::DlSystem::ITensorFactory

Factory interface class to create ITensor objects.

Public Member Functions

virtual std::unique_ptr< ITensorcreateTensor (const TensorShape &shape) noexcept=0
 
virtual std::unique_ptr< ITensorcreateTensor (std::istream &input) noexcept=0
 
virtual std::unique_ptr< ITensorcreateTensor (const TensorShape &shape, const unsigned char *data, size_t dataSize) noexcept=0
 

◆ zdl::DlSystem::IUDL

class zdl::DlSystem::IUDL

Base class user concrete UDL implementation.

All functions are marked as:

  • virtual
  • noexcept

User should make sure no exceptions are propagated outside of their module. Errors can be communicated via return values.

Public Member Functions

virtual ~IUDL ()=default
 
virtual bool setup (void *cookie, size_t insz, const size_t **indim, const size_t *indimsz, size_t outsz, const size_t **outdim, const size_t *outdimsz)=0
 
virtual void close (void *cookie) noexcept=0
 
virtual bool execute (void *cookie, const float **input, float **output)=0
 

Constructor & Destructor Documentation

◆ ~IUDL()

virtual ~IUDL ( )
virtualdefault

Destructor

Member Function Documentation

◆ close()

virtual void close ( void *  cookie)
pure virtualnoexcept

Close the instance. Invoked by the SNPE framework to allow the user the opportunity to release any resources allocated during setup.

Parameters
cookie- User provided opaque data returned by the SNPE runtime

◆ execute()

virtual bool execute ( void *  cookie,
const float **  input,
float **  output 
)
pure virtual

Execute the user defined layer.

Parameters
cookieUser provided opaque data returned by the SNPE runtime
inputConst pointer to a float buffer that contains the input
outputFloat pointer to a buffer that would hold the user defined layer's output. This buffer is allocated and owned by SNPE runtime.

◆ setup()

virtual bool setup ( void *  cookie,
size_t  insz,
const size_t **  indim,
const size_t *  indimsz,
size_t  outsz,
const size_t **  outdim,
const size_t *  outdimsz 
)
pure virtual

Sets up the user's environment. This is called by the SNPE framework to allow the user the opportunity to setup anything which is needed for running user defined layers.

Parameters
cookieUser provided opaque data returned by the SNPE runtime
inszHow many elements in input size array
indimPointer to a buffer that holds input dimension array
indimszInput dimension size array of the buffer 'indim'. Corresponds to indim
outszHow many elements in output size array
outdimPointer to a buffer that holds output dimension array
outdimszOutput dimension size of the buffer 'oudim'. Corresponds to indim
Returns
true on success, false otherwise

◆ zdl::DlSystem::UserBufferEncoding

class zdl::DlSystem::UserBufferEncoding

A base class buffer encoding type

Public Types

enum  ElementType_t
 

Public Member Functions

virtual size_t getElementSize () const noexcept=0
 
ElementType_t getElementType () const noexcept
 

Member Enumeration Documentation

◆ ElementType_t

enum ElementType_t
strong

An enum class of all supported element types in a IUserBuffer

Enumerator
UNKNOWN 

Unknown element type.

FLOAT 

Each element is presented by float.

UNSIGNED8BIT 

Each element is presented by an unsigned int.

TF8 

Each element is presented by an 8-bit quantized value.

TF16 

Each element is presented by an 16-bit quantized value.

Member Function Documentation

◆ getElementSize()

virtual size_t getElementSize ( ) const
pure virtualnoexcept

Retrieves the size of the element, in bytes.

Returns
Size of the element, in bytes.

Implemented in UserBufferEncodingTfN, UserBufferEncodingFloat, and UserBufferEncodingUnsigned8Bit.

◆ getElementType()

ElementType_t getElementType ( ) const
inlinenoexcept

Retrieves the element type.

Returns
Element type

◆ zdl::DlSystem::UserBufferSource

class zdl::DlSystem::UserBufferSource

A base class buffer source type

Note
User buffer from CPU support all kinds of runtimes; User buffer from GLBUFFER support only GPU runtime.

Public Member Functions

SourceType_t getSourceType () const noexcept
 

Member Enumeration Documentation

◆ SourceType_t

enum SourceType_t
strong
Enumerator
UNKNOWN 

Unknown buffer source type.

CPU 

The network inputs are from CPU buffer.

GLBUFFER 

The network inputs are from OpenGL buffer.

Member Function Documentation

◆ getSourceType()

SourceType_t getSourceType ( ) const
inlinenoexcept

Retrieves the source type.

Returns
Source type

◆ zdl::DlSystem::UserBufferSourceGLBuffer

class zdl::DlSystem::UserBufferSourceGLBuffer

An source type where input data is delivered from OpenGL buffer

Additional Inherited Members

- Public Member Functions inherited from UserBufferSource
SourceType_t getSourceType () const noexcept
 

◆ zdl::DlSystem::UserBufferEncodingUnsigned8Bit

class zdl::DlSystem::UserBufferEncodingUnsigned8Bit

An encoding type where each element is represented by an unsigned int

Public Member Functions

size_t getElementSize () const noexcept override
 
- Public Member Functions inherited from UserBufferEncoding
ElementType_t getElementType () const noexcept
 

Additional Inherited Members

- Public Types inherited from UserBufferEncoding
enum  ElementType_t
 

Member Function Documentation

◆ getElementSize()

size_t getElementSize ( ) const
overridevirtualnoexcept

Retrieves the size of the element, in bytes.

Returns
Size of the element, in bytes.

Implements UserBufferEncoding.

◆ zdl::DlSystem::UserBufferEncodingFloat

class zdl::DlSystem::UserBufferEncodingFloat

An encoding type where each element is represented by a float

Public Member Functions

size_t getElementSize () const noexcept override
 
- Public Member Functions inherited from UserBufferEncoding
ElementType_t getElementType () const noexcept
 

Additional Inherited Members

- Public Types inherited from UserBufferEncoding
enum  ElementType_t
 

Member Function Documentation

◆ getElementSize()

size_t getElementSize ( ) const
overridevirtualnoexcept

Retrieves the size of the element, in bytes.

Returns
Size of the element, in bytes.

Implements UserBufferEncoding.

◆ zdl::DlSystem::UserBufferEncodingTfN

class zdl::DlSystem::UserBufferEncodingTfN

An encoding type where each element is represented by tf8, which is an 8-bit quantizd value, which has an exact representation of 0.0

Public Member Functions

size_t getElementSize () const noexcept override
 
void setStepExactly0 (uint64_t stepExactly0)
 
void setQuantizedStepSize (const float quantizedStepSize)
 
uint64_t getStepExactly0 () const
 
float getMin () const
 
float getMax () const
 
float getQuantizedStepSize () const
 
- Public Member Functions inherited from UserBufferEncoding
ElementType_t getElementType () const noexcept
 

Additional Inherited Members

- Public Types inherited from UserBufferEncoding
enum  ElementType_t
 

Member Function Documentation

◆ getElementSize()

size_t getElementSize ( ) const
overridevirtualnoexcept

Retrieves the size of the element, in bytes.

Returns
Size of the element, in bytes.

Implements UserBufferEncoding.

◆ getMax()

float getMax ( ) const
inline

Calculates the maximum floating point value that can be represented with this encoding.

Returns
Maximum representable floating point value

◆ getMin()

float getMin ( ) const
inline

Calculates the minimum floating point value that can be represented with this encoding.

Returns
Minimum representable floating point value

◆ getQuantizedStepSize()

float getQuantizedStepSize ( ) const
inline

Retrieves the step size.

Returns
Step size

◆ getStepExactly0()

uint64_t getStepExactly0 ( ) const
inline

Retrieves the step that represents 0.0.

Returns
Step value

◆ setQuantizedStepSize()

void setQuantizedStepSize ( const float  quantizedStepSize)
inline

Sets the float value that each step represents.

Parameters
[in]quantizedStepSizeThe float value of each step size

◆ setStepExactly0()

void setStepExactly0 ( uint64_t  stepExactly0)
inline

Sets the step value that represents 0.

Parameters
[in]stepExactly0The step value that represents 0

◆ zdl::DlSystem::IUserBuffer

class zdl::DlSystem::IUserBuffer

Public Member Functions

virtual const TensorShapegetStrides () const =0
 
virtual size_t getSize () const =0
 
virtual size_t getOutputSize () const =0
 
virtual bool setBufferAddress (void *buffer) noexcept=0
 
virtual const UserBufferEncodinggetEncoding () const noexcept=0
 
virtual UserBufferEncodinggetEncoding () noexcept=0
 

Member Function Documentation

◆ getEncoding() [1/2]

virtual const UserBufferEncoding& getEncoding ( ) const
pure virtualnoexcept

Gets a const reference to the data encoding object of the underlying buffer.

This is necessary when the UserBuffer is filled by SNPE with data types such as TF8, where the caller needs to know the quantization parameters in order to interpret the data properly

Returns
A read-only encoding object

◆ getEncoding() [2/2]

virtual UserBufferEncoding& getEncoding ( )
pure virtualnoexcept

Gets a reference to the data encoding object of the underlying buffer.

This is necessary when the UserBuffer is re-used, and the encoding parameters can change. For example, each input can be quantized with different step sizes.

Returns
Data encoding meta-data

◆ getOutputSize()

virtual size_t getOutputSize ( ) const
pure virtual

Retrieves the size of the inference data in the buffer, in bytes.

The inference results from a dynamic-sized model may not be exactly the same size as the UserBuffer provided to SNPE. This function can be used to get the amount of output inference data, which may be less or greater than the size of the UserBuffer.

If the inference results fit in the UserBuffer, getOutputSize() would be less than or equal to getSize(). But if the inference results were more than the capacity of the provided UserBuffer, the results would be truncated to fit the UserBuffer. But, getOutputSize() would be greater than getSize(), which indicates a bigger buffer needs to be provided to SNPE to hold all of the inference results.

Returns
Size required for the buffer to hold all inference results, which can be less or more than the size of the buffer, in bytes.

◆ getSize()

virtual size_t getSize ( ) const
pure virtual

Retrieves the size of the buffer, in bytes.

Returns
Size of the underlying buffer, in bytes.

◆ getStrides()

virtual const TensorShape& getStrides ( ) const
pure virtual

Retrieves the total number of bytes between elements in each dimension if the buffer were to be interpreted as a multi-dimensional array.

Returns
Number of bytes between elements in each dimension. e.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would return strides of [24, 8, 4].

◆ setBufferAddress()

virtual bool setBufferAddress ( void *  buffer)
pure virtualnoexcept

Changes the underlying memory that backs the UserBuffer.

This can be used to avoid creating multiple UserBuffer objects when the only thing that differs is the memory location.

Parameters
[in]bufferPointer to the memory location
Returns
Whether the set succeeds.

◆ zdl::DlSystem::IUserBufferFactory

class zdl::DlSystem::IUserBufferFactory

Factory interface class to create IUserBuffer objects.

Public Member Functions

virtual std::unique_ptr< IUserBuffercreateUserBuffer (void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding *userBufferEncoding) noexcept=0
 
virtual std::unique_ptr< IUserBuffercreateUserBuffer (void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding *userBufferEncoding, zdl::DlSystem::UserBufferSource *userBufferSource) noexcept=0
 

Member Function Documentation

◆ createUserBuffer() [1/2]

virtual std::unique_ptr<IUserBuffer> createUserBuffer ( void *  buffer,
size_t  bufSize,
const zdl::DlSystem::TensorShape strides,
zdl::DlSystem::UserBufferEncoding userBufferEncoding 
)
pure virtualnoexcept

Creates a UserBuffer.

Parameters
[in]bufferPointer to the buffer that the caller supplies
[in]bufSizeBuffer size, in bytes
[in]stridesTotal number of bytes between elements in each dimension. E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4].
[in]userBufferEncodingReference to an UserBufferEncoding object
Note
Caller has to ensure that memory pointed to by buffer stays accessible for the lifetime of the object created

◆ createUserBuffer() [2/2]

virtual std::unique_ptr<IUserBuffer> createUserBuffer ( void *  buffer,
size_t  bufSize,
const zdl::DlSystem::TensorShape strides,
zdl::DlSystem::UserBufferEncoding userBufferEncoding,
zdl::DlSystem::UserBufferSource userBufferSource 
)
pure virtualnoexcept

Creates a UserBuffer.

Parameters
[in]bufferPointer to the buffer that the caller supplies
[in]bufSizeBuffer size, in bytes
[in]stridesTotal number of bytes between elements in each dimension. E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4].
[in]userBufferEncodingReference to an UserBufferEncoding object
[in]userBufferSourceReference to an UserBufferSource object
Note
Caller has to ensure that memory pointed to by buffer stays accessible for the lifetime of the object created

◆ zdl::DiagLog::Options

class zdl::DiagLog::Options

Options for setting up diagnostic logging for zdl components.

Public Attributes

std::string DiagLogMask
 
std::string LogFileDirectory
 
std::string LogFileName
 
uint32_t LogFileRotateCount
 

Member Data Documentation

◆ DiagLogMask

std::string DiagLogMask

Enables diag logging only on the specified area mask (DNN_RUNTIME=ON | OFF)

◆ LogFileDirectory

std::string LogFileDirectory

The path to the directory where log files will be written. The path may be relative or absolute. Relative paths are interpreted from the current working directory. Default value is "diaglogs"

◆ LogFileName

std::string LogFileName

The name used for log files. If this value is empty then BaseName will be used as the default file name. Default value is "DiagLog"

◆ LogFileRotateCount

uint32_t LogFileRotateCount

The maximum number of log files to create. If set to 0 no log rotation will be used and the log file name specified will be used each time, overwriting any existing log file that may exist. Default value is 20

◆ zdl::DlSystem::UserGLConfig

struct zdl::DlSystem::UserGLConfig

A structure OpenGL configuration

Note
When certain OpenGL context and display are provided to UserGLConfig for using GPU buffer as input directly, the user MUST ensure the particular OpenGL context and display remain vaild throughout the execution of neural network models.
Class Members
void * userGLContext

Holds user EGL context.

void * userGLDisplay Holds user EGL display.

◆ zdl::DlSystem::UserGpuConfig

struct zdl::DlSystem::UserGpuConfig

A structure Gpu configuration

Class Members
UserGLConfig userGLConfig

Holds user OpenGL configuration.

◆ zdl::DlSystem::PlatformConfig

class zdl::DlSystem::PlatformConfig

A class user platform configuration

Public Types

enum  PlatformType_t
 

Public Member Functions

PlatformType_t getPlatformType () const
 
bool isValid () const
 
bool getUserGpuConfig (UserGpuConfig &userGpuConfig) const
 
bool setUserGpuConfig (UserGpuConfig &userGpuConfig)
 
bool setPlatformOptions (std::string options)
 
bool isOptionsValid () const
 
std::string getPlatformOptions () const
 

Member Enumeration Documentation

◆ PlatformType_t

enum PlatformType_t
strong

An enum class of all supported platform types

Enumerator
UNKNOWN 

Unknown platform type.

CPU 

Snapdragon CPU.

GPU 

Adreno GPU.

DSP 

Hexagon DSP.

Member Function Documentation

◆ getPlatformOptions()

std::string getPlatformOptions ( ) const
inline

Gets the platform options.

Returns
Options as a string

◆ getPlatformType()

PlatformType_t getPlatformType ( ) const
inline

Retrieves the platform type.

Returns
Platform type

◆ getUserGpuConfig()

bool getUserGpuConfig ( UserGpuConfig userGpuConfig) const
inline

Retrieves the Gpu configuration.

Parameters
[out]userGpuConfigThe passed in userGpuConfig populated with the Gpu configuration on return.
Returns
True if Gpu configuration was retrieved; false otherwise.

◆ isOptionsValid()

bool isOptionsValid ( ) const

Indicates whther the plaform configuration is valid.

Returns
True if the platform configuration is valid; false otherwise.

◆ isValid()

bool isValid ( ) const
inline

Indicates whther the plaform configuration is valid.

Returns
True if the platform configuration is valid; false otherwise.

◆ setPlatformOptions()

bool setPlatformOptions ( std::string  options)
inline

Sets the platform options.

Parameters
[in]optionsOptions as a string in the form of "keyword:options"
Returns
True if options are pass validation; otherwise false. If false, the options are not updated.

◆ setUserGpuConfig()

bool setUserGpuConfig ( UserGpuConfig userGpuConfig)
inline

Sets the Gpu configuration.

Parameters
[in]userGpuConfigGpu Configuration
Returns
True if Gpu configuration was successfully set; false otherwise.

◆ zdl::SNPE::PlatformValidator

class zdl::SNPE::PlatformValidator

The class for checking SNPE compatibility/capability of a device.

Public Member Functions

 PlatformValidator ()
 
void setRuntime (zdl::DlSystem::Runtime_t runtime)
 
bool isRuntimeAvailable ()
 
std::string getCoreVersion ()
 
std::string getLibVersion ()
 
bool runtimeCheck ()
 

Constructor & Destructor Documentation

◆ PlatformValidator()

Default Constructor of the PlatformValidator Class.

Returns
A new instance of a PlatformValidator object that can be used to check the SNPE compatibility of a device

Member Function Documentation

◆ getCoreVersion()

std::string getCoreVersion ( )

Returns the core version for the Runtime selected.

Returns
String which contains the actual core version value

◆ getLibVersion()

std::string getLibVersion ( )

Returns the library version for the Runtime selected.

Returns
String which contains the actual lib version value

◆ isRuntimeAvailable()

bool isRuntimeAvailable ( )

Checks if the Runtime prerequisites for SNPE are available.

Returns
True if the Runtime prerequisites are available, else false.

◆ runtimeCheck()

bool runtimeCheck ( )

Runs a small program on the runtime and Checks if SNPE is supported for Runtime.

Returns
If True, the device is ready for SNPE execution, else not.

◆ setRuntime()

void setRuntime ( zdl::DlSystem::Runtime_t  runtime)

Sets the runtime processor for compatibility check.

Returns
Void

◆ zdl::SNPE::SNPE

class zdl::SNPE::SNPE

The SNPE interface class definition

Public Member Functions

zdl::DlSystem::Optional< zdl::DlSystem::StringListgetInputTensorNames () const noexcept
 
zdl::DlSystem::Optional< zdl::DlSystem::StringListgetOutputTensorNames () const noexcept
 
zdl::DlSystem::StringList getOutputTensorNamesByLayerName (const char *name) const noexcept
 
bool execute (const zdl::DlSystem::TensorMap &input, zdl::DlSystem::TensorMap &output) noexcept
 
bool execute (const zdl::DlSystem::ITensor *input, zdl::DlSystem::TensorMap &output) noexcept
 
bool execute (const zdl::DlSystem::UserBufferMap &input, const zdl::DlSystem::UserBufferMap &output) noexcept
 
zdl::DlSystem::String getModelVersion () const noexcept
 
zdl::DlSystem::Optional< zdl::DlSystem::TensorShapegetInputDimensions () const noexcept
 
zdl::DlSystem::Optional< zdl::DlSystem::StringListgetOutputLayerNames () const noexcept
 
zdl::DlSystem::Optional< zdl::DlSystem::IBufferAttributes * > getInputOutputBufferAttributes (const char *name) const noexcept
 
zdl::DlSystem::Optional< zdl::DiagLog::IDiagLog * > getDiagLogInterface () noexcept
 

Member Function Documentation

◆ execute() [1/3]

bool execute ( const zdl::DlSystem::TensorMap input,
zdl::DlSystem::TensorMap output 
)
noexcept

Processes the input data and returns the output.

Parameters
[in]Amap of tensors that contains the input data for each input. The names of tensors needs to be matched with names retrieved through getInputTensorNames()
[in,out]Anempty map of tensors that will contain the output data of potentially multiple layers (the key in the map is the layer name) upon return
Note
output tensormap has to be empty. To forward propagate and get results in user-supplied tensors, use executeWithSuppliedOutputTensors.

◆ execute() [2/3]

bool execute ( const zdl::DlSystem::ITensor input,
zdl::DlSystem::TensorMap output 
)
noexcept

Processes the input data and returns the output.

Parameters
[in]Asingle tensor contains the input data.
[in,out]Anempty map of tensors that will contain the output data of potentially multiple layers (the key in the map is the layer name) upon return
Note
output tensormap has to be empty.

◆ execute() [3/3]

bool execute ( const zdl::DlSystem::UserBufferMap input,
const zdl::DlSystem::UserBufferMap output 
)
noexcept

Processes the input data and returns the output, using user-supplied buffers.

Parameters
[in]Amap of UserBuffers that contains the input data for each input. The names of UserBuffers needs to be matched with names retrieved through getInputTensorNames()
[in,out]Amap of UserBuffers that will hold the output data of potentially multiple layers (the key in the map is the UserBuffer name)
Note
input and output UserBuffer maps must be fully pre-populated. with dimensions matching what the network expects. For example, if there are 5 output UserBuffers they all have to be present in map.

Caller must guarantee that for the duration of execute(), the buffer stored in UserBuffer would remain valid. For more detail on buffer ownership and lifetime requirements, please refer to zdl::DlSystem::UserBuffer documentation.

◆ getDiagLogInterface()

zdl::DlSystem::Optional<zdl::DiagLog::IDiagLog*> getDiagLogInterface ( )
noexcept

Get the diagnostic logging interface

Note
Note that because the returned type is an Optional instance, it must be verified as a boolean true value before being dereferenced.
See also
zdl::DlSystem::Optional

◆ getInputDimensions()

zdl::DlSystem::Optional<zdl::DlSystem::TensorShape> getInputDimensions ( ) const
noexcept

Returns the dimensions of the input data to the model in the form of TensorShape. The dimensions in TensorShape corresponds to what the tensor dimensions would need to be for an input tensor to the model.

Parameters
[in]layerinput name.
Note
Note that this function only makes sense for networks that have a fixed input size. For networks in which the input size varies with each call of Execute(), this function should not be used.
Because the returned type is an Optional instance, it must be verified as a boolean true value before being dereferenced.
Returns
An Optional instance of TensorShape that maintains dimensions, matching the tensor dimensions for input to the model, where the last entry is the fastest varying dimension, etc.
See also
zdl::DlSystem::ITensor
zdl::DlSystem::TensorShape
zdl::DlSystem::Optional

◆ getInputOutputBufferAttributes()

zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes ( const char *  name) const
noexcept

Returns attributes of buffers used to feed input tensors and receive result from output tensors.

Parameters
[in]Tensorname.
Returns
BufferAttributes of input/output tensor named

◆ getInputTensorNames()

zdl::DlSystem::Optional<zdl::DlSystem::StringList> getInputTensorNames ( ) const
noexcept

Gets the names of input tensors to the network.

To support multiple input scenarios, where multiple tensors are passed through execute() in a TensorMap, each tensor needs to be uniquely named. The names of tensors can be retrieved through this function.

In the case of a single input, one name will be returned.

Note
Note that because the returned value is an Optional list, the list must be verified as boolean true value before being dereferenced.
Returns
An Optional List of input tensor names.
See also
zdl::DlSystem::Optional

◆ getModelVersion()

zdl::DlSystem::String getModelVersion ( ) const
noexcept

Returns the version string embedded at model conversion time.

Returns
Model version string, which is a free-form string supplied at the time of the conversion

◆ getOutputLayerNames()

zdl::DlSystem::Optional<zdl::DlSystem::StringList> getOutputLayerNames ( ) const
noexcept

Gets the output layer(s) for the network.

Note that the output layers returned by this function may be different than those specified when the network was created via the zdl::SNPE::SNPEBuilder. For example, if the network was created in debug mode with no explicit output layers specified, this will contain all layers.

Note
Note that because the returned value is an Optional StringList, the list must be verified as a boolean true value before being dereferenced.
Returns
A List of output layer names.
See also
zdl::DlSystem::Optional

◆ getOutputTensorNames()

zdl::DlSystem::Optional<zdl::DlSystem::StringList> getOutputTensorNames ( ) const
noexcept

Gets the names of output tensors to the network.

Returns
List of output tensor names.

◆ getOutputTensorNamesByLayerName()

zdl::DlSystem::StringList getOutputTensorNamesByLayerName ( const char *  name) const
noexcept

Gets the name of output tensor from the input layer name.

Returns
Output tensor name.

◆ zdl::SNPE::SNPEBuilder

class zdl::SNPE::SNPEBuilder

The builder class for creating SNPE objects. Not meant to be extended.

Public Member Functions

 SNPEBuilder (zdl::DlContainer::IDlContainer *container)
 
SNPEBuildersetRuntimeProcessor (zdl::DlSystem::Runtime_t targetRuntimeProcessor)
 
SNPEBuildersetPerformanceProfile (zdl::DlSystem::PerformanceProfile_t performanceProfile)
 
SNPEBuildersetProfilingLevel (zdl::DlSystem::ProfilingLevel_t profilingLevel)
 
SNPEBuildersetExecutionPriorityHint (zdl::DlSystem::ExecutionPriorityHint_t priority)
 
SNPEBuildersetOutputLayers (const zdl::DlSystem::StringList &outputLayerNames)
 
SNPEBuildersetOutputTensors (const zdl::DlSystem::StringList &outputTensorNames)
 
SNPEBuildersetUdlBundle (zdl::DlSystem::UDLBundle udlBundle)
 
SNPEBuildersetUseUserSuppliedBuffers (bool bufferMode)
 
SNPEBuildersetDebugMode (bool debugMode)
 
SNPEBuildersetCPUFallbackMode (bool mode)
 
SNPEBuildersetInputDimensions (const zdl::DlSystem::TensorShapeMap &inputDimensionsMap)
 
SNPEBuildersetInitCacheMode (bool cacheMode)
 
std::unique_ptr< SNPEbuild () noexcept
 
SNPEBuildersetPlatformConfig (const zdl::DlSystem::PlatformConfig &platformConfig)
 
SNPEBuildersetRuntimeProcessorOrder (const zdl::DlSystem::RuntimeList &runtimeList)
 
SNPEBuildersetUnconsumedTensorsAsOutputs (bool setOutput)
 

Constructor & Destructor Documentation

◆ SNPEBuilder()

SNPEBuilder ( zdl::DlContainer::IDlContainer container)
explicit

Constructor of NeuralNetwork Builder with a supplied model.

Parameters
[in]containerA container holding the model.
Returns
A new instance of a SNPEBuilder object that can be used to configure and build an instance of SNPE.

Member Function Documentation

◆ build()

std::unique_ptr<SNPE> build ( )
noexcept

Returns an instance of SNPE based on the current parameters.

Returns
A new instance of a SNPE object that can be used to execute models or null if any errors occur.

◆ setCPUFallbackMode()

SNPEBuilder& setCPUFallbackMode ( bool  mode)

Sets the mode of CPU fallback functionality.

NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE. Please use setRuntimeProcessorOrder()

Parameters
[in]modeThis flag enables/disables the functionality of CPU fallback. When the CPU fallback functionality is enabled, layers in model that violates runtime constraints will run on CPU while the rest of non-violating layers will run on the chosen runtime processor. In disabled mode, models with layers violating runtime constraints will NOT run on the chosen runtime processor and will result in runtime exception. By default, the functionality is enabled.
Returns
The current instance of SNPEBuilder.

◆ setDebugMode()

SNPEBuilder& setDebugMode ( bool  debugMode)

Sets the debug mode of the runtime.

Parameters
[in]debugModeThis enables debug mode for the runtime. It does two things. For an empty outputLayerNames list, all layers will be output. It might also disable some internal runtime optimizations (e.g., some networks might be optimized by combining layers, etc.).
Returns
The current instance of SNPEBuilder.

◆ setExecutionPriorityHint()

SNPEBuilder& setExecutionPriorityHint ( zdl::DlSystem::ExecutionPriorityHint_t  priority)

Sets a preference for execution priority.

This allows the caller to give coarse hint to SNPE runtime about the priority of the network. SNPE runtime is free to use this information to co-ordinate between different workloads that may or may not extend beyond SNPE.

Parameters
[in]ExecutionPriorityHint_tThe target performance profile.
Returns
The current instance of SNPEBuilder.

◆ setInitCacheMode()

SNPEBuilder& setInitCacheMode ( bool  cacheMode)

Sets the mode of init caching functionality.

Parameters
[in]modeThis flag enables/disables the functionality of init caching. When init caching functionality is enabled, a set of init caches will be created during network building/initialization process and will be added to DLC container. If such DLC container is saved by the user, in subsequent network building/initialization processes these init caches will be loaded from the DLC so as to reduce initialization time. In disable mode, no init caches will be added to DLC container.
Returns
The current instance of SNPEBuilder.

◆ setInputDimensions()

SNPEBuilder& setInputDimensions ( const zdl::DlSystem::TensorShapeMap inputDimensionsMap)

Sets network's input dimensions to enable resizing of the spatial dimensions of each layer for fully convolutional networks, and the batch dimension for all networks.

Parameters
[in]tensorShapeMapThe map of input names and their new dimensions. The new dimensions overwrite the input dimensions embedded in the model and then resize each layer of the model. If the model contains layers whose dimensions cannot be resized e.g FullyConnected, exception will be thrown when SNPE instance is actually built. In general the batch dimension is always resizable. After resizing of layers' dimensions in model based on new input dimensions, the new model is revalidated against all runtime constraints, whose failures may result in cpu fallback situation.
Returns
The current instance of SNPEBuilder.

◆ setOutputLayers()

SNPEBuilder& setOutputLayers ( const zdl::DlSystem::StringList outputLayerNames)

Sets the layers that will generate output.

Parameters
[in]outputLayerNamesList of layer names to output. An empty list will result in only the final layer of the model being the output layer. The list will be copied.
Returns
The current instance of SNPEBuilder.

◆ setOutputTensors()

SNPEBuilder& setOutputTensors ( const zdl::DlSystem::StringList outputTensorNames)

Sets the output tensor names.

Parameters
[in]outputTensorNamesList of tensor names to output. An empty list will result in producing output for the final output tensor of the model. The list will be copied.
Returns
The current instance of SNPEBuilder.

◆ setPerformanceProfile()

SNPEBuilder& setPerformanceProfile ( zdl::DlSystem::PerformanceProfile_t  performanceProfile)

Requests a performance profile.

Parameters
[in]targetRuntimeProfileThe target performance profile.
Returns
The current instance of SNPEBuilder.

◆ setPlatformConfig()

SNPEBuilder& setPlatformConfig ( const zdl::DlSystem::PlatformConfig platformConfig)

Sets the platform configuration.

Parameters
[in]platformConfigThe platform configuration.
Returns
The current instance of SNPEBuilder.

◆ setProfilingLevel()

SNPEBuilder& setProfilingLevel ( zdl::DlSystem::ProfilingLevel_t  profilingLevel)

Sets the profiling level. Default profiling level for SNPEBuilder is off. Off and basic only applies to DSP runtime.

Parameters
[in]profilingLevelThe target profiling level.
Returns
The current instance of SNPEBuilder.

◆ setRuntimeProcessor()

SNPEBuilder& setRuntimeProcessor ( zdl::DlSystem::Runtime_t  targetRuntimeProcessor)

Sets the runtime processor.

NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE. Please use setRuntimeProcessorOrder()

Parameters
[in]targetRuntimeProcessorThe target runtime.
Returns
The current instance of SNPEBuilder.

◆ setRuntimeProcessorOrder()

SNPEBuilder& setRuntimeProcessorOrder ( const zdl::DlSystem::RuntimeList &  runtimeList)

Sets network's runtime order of precedence. Example: CPU_FLOAT32, GPU_FLOAT16, AIP_FIXED8_TF Note:- setRuntimeProcessor() or setCPUFallbackMode() will be silently ignored when setRuntimeProcessorOrder() is invoked.

Parameters
[in]runtimeListThe list of runtime in order of precedence
Returns
The current instance of SNPEBuilder.

◆ setUdlBundle()

SNPEBuilder& setUdlBundle ( zdl::DlSystem::UDLBundle  udlBundle)

Passes in a User-defined layer.

Parameters
udlBundleBundle of udl factory function and a cookie
Returns
The current instance of SNPEBuilder.

◆ setUnconsumedTensorsAsOutputs()

SNPEBuilder& setUnconsumedTensorsAsOutputs ( bool  setOutput)

Sets the unconsumed tensors as output.

Parameters
[in]setOutputThis enables unconsumed tensors (i.e) outputs which are not inputs to any layer (basically dead ends) to be marked for output
Returns
The current instance of SNPEBuilder.

◆ setUseUserSuppliedBuffers()

SNPEBuilder& setUseUserSuppliedBuffers ( bool  bufferMode)

Sets whether this neural network will perform inference with input from user-supplied buffers, and write output to user-supplied buffers. Default behaviour is to use tensors created by ITensorFactory.

Parameters
[in]bufferModeWhether to use user-supplied buffer or not.
Returns
The current instance of SNPEBuilder.

◆ zdl::SNPE::SNPEFactory

class zdl::SNPE::SNPEFactory

The factory class for creating SNPE objects.

Static Public Member Functions

static bool isRuntimeAvailable (zdl::DlSystem::Runtime_t runtime)
 
static bool isRuntimeAvailable (zdl::DlSystem::Runtime_t runtime, zdl::DlSystem::RuntimeCheckOption_t option)
 
static zdl::DlSystem::ITensorFactorygetTensorFactory ()
 
static zdl::DlSystem::IUserBufferFactorygetUserBufferFactory ()
 
static zdl::DlSystem::Version_t getLibraryVersion ()
 
static bool setSNPEStorageLocation (const char *storagePath)
 
static bool addOpPackage (const std::string &regLibraryPath)
 
static bool isGLCLInteropSupported ()
 

Member Function Documentation

◆ addOpPackage()

static bool addOpPackage ( const std::string &  regLibraryPath)
static

Register a user-defined op package with SNPE.

Parameters
[in]regLibraryPathPath to the registration library that allows clients to register a set of operations that are part of the package, and share op info with SNPE
Returns
True if successful, False otherwise.

◆ getLibraryVersion()

static zdl::DlSystem::Version_t getLibraryVersion ( )
static

Gets the version of the SNPE library.

Returns
Version of the SNPE library.

◆ getTensorFactory()

static zdl::DlSystem::ITensorFactory& getTensorFactory ( )
static

Gets a reference to the tensor factory.

Returns
A reference to the tensor factory.

◆ getUserBufferFactory()

static zdl::DlSystem::IUserBufferFactory& getUserBufferFactory ( )
static

Gets a reference to the UserBuffer factory.

Returns
A reference to the UserBuffer factory.

◆ isGLCLInteropSupported()

static bool isGLCLInteropSupported ( )
static

Indicates whether the OpenGL and OpenCL interoperability is supported on GPU platform.

Returns
True if the OpenGL and OpenCl interop is supported; false, otherwise.

◆ isRuntimeAvailable() [1/2]

static bool isRuntimeAvailable ( zdl::DlSystem::Runtime_t  runtime)
static

Indicates whether the supplied runtime is available on the current platform.

Parameters
[in]runtimeThe target runtime to check.
[in]optionExtent to perform runtime available check.
Returns
True if the supplied runtime is available; false, otherwise.

◆ isRuntimeAvailable() [2/2]

static bool isRuntimeAvailable ( zdl::DlSystem::Runtime_t  runtime,
zdl::DlSystem::RuntimeCheckOption_t  option 
)
static

Indicates whether the supplied runtime is available on the current platform.

Parameters
[in]runtimeThe target runtime to check.
[in]optionExtent to perform runtime available check.
Returns
True if the supplied runtime is available; false, otherwise.

◆ setSNPEStorageLocation()

static bool setSNPEStorageLocation ( const char *  storagePath)
static

Set the SNPE storage location for all SNPE instances in this process. Note that this may only be called once, and if so must be called before creating any SNPE instances.

Parameters
[in]storagePathAbsolute path to a directory which SNPE may use for caching and other storage purposes.
Returns
True if the supplied path was succesfully set as the SNPE storage location, false otherwise.

◆ zdl::DlSystem::StringList

class zdl::DlSystem::StringList

Class for holding an order list of null-terminated ASCII strings.

Public Member Functions

 StringList (size_t length)
 
void append (const char *str)
 
const char * at (size_t idx) const noexcept
 
const char ** begin () const noexcept
 
const char ** end () const noexcept
 
size_t size () const noexcept
 
StringListoperator= (const StringList &) noexcept
 
 StringList (const StringList &other)
 
 StringList (StringList &&other) noexcept
 

◆ zdl::DlSystem::TensorMap

class zdl::DlSystem::TensorMap

A class representing the map of tensor.

Public Member Functions

 TensorMap ()
 
 TensorMap (const TensorMap &other)
 
TensorMapoperator= (const TensorMap &other)
 
void add (const char *name, zdl::DlSystem::ITensor *tensor)
 
void remove (const char *name) noexcept
 
void clear () noexcept
 
zdl::DlSystem::ITensorgetTensor (const char *name) const noexcept
 
zdl::DlSystem::StringList getTensorNames () const
 

◆ zdl::DlSystem::TensorShape

class zdl::DlSystem::TensorShape

A class representing the shape of tensor. It is used at the time of creation of tensor.

Public Member Functions

 TensorShape (std::initializer_list< Dimension > dims)
 
 TensorShape (const Dimension *dims, size_t size)
 
 TensorShape (std::vector< Dimension > dims)
 
 TensorShape (const TensorShape &other)
 
TensorShapeoperator= (const TensorShape &other)
 
 TensorShape ()
 
void concatenate (std::initializer_list< Dimension > dims)
 
void concatenate (const Dimension *dims, size_t size)
 
void concatenate (const Dimension &dim)
 
Dimensionoperator[] (size_t index)
 
size_t rank () const
 
const DimensiongetDimensions () const
 

◆ zdl::DlSystem::TensorShapeMap

class zdl::DlSystem::TensorShapeMap

A class representing the map of names and tensorshapes.

Public Member Functions

 TensorShapeMap ()
 
 TensorShapeMap (const TensorShapeMap &other)
 
TensorShapeMapoperator= (const TensorShapeMap &other)
 
void add (const char *name, const zdl::DlSystem::TensorShape &tensorShape)
 
void remove (const char *name) noexcept
 
void clear () noexcept
 
zdl::DlSystem::TensorShape getTensorShape (const char *name) const noexcept
 
zdl::DlSystem::StringList getTensorShapeNames () const
 

◆ zdl::DlSystem::UDLContext

class zdl::DlSystem::UDLContext

UDLContext holds the user defined layer context which consists of a layer name, layer ID, blob and blob size.

An instance of UDLContext is passed as an argument to the UDLFactoryFunc provided by the user every time the SNPE runtime encounters an unknown layer descriptor. The instance of a UDLContext is created by the SNPE runtime and is consumed by the user's factory function. The user should obtain a copy of this class and should not assume any prolonged object lifetime beyond the UDLFactoryFunction.

Public Member Functions

 UDLContext (const std::string &name, const std::string &type, int32_t id, const std::string &blob)
 
 UDLContext ()
 
 ~UDLContext ()
 
void release ()
 
 UDLContext (const UDLContext &ctx)
 
UDLContextoperator= (const UDLContext &ctx)
 
 UDLContext (UDLContext &&ctx)
 
UDLContextoperator= (UDLContext &&ctx)
 
const std::string & getName () const noexcept
 
const std::string & getType () const noexcept
 
int32_t getId () const noexcept
 
size_t getSize () const noexcept
 
const uint8_t * getBlob () const noexcept
 
std::tuple< uint8_t *, size_t > getCopy () const
 
void clear ()
 

Constructor & Destructor Documentation

◆ UDLContext() [1/4]

UDLContext ( const std::string &  name,
const std::string &  type,
int32_t  id,
const std::string &  blob 
)
inline

Constructor.

Parameters
[in]namename of the layer
[in]typelayer type
[in]ididentifier for the layer
[in]idBlob/bytes as packed by the user code as part of the Python converter script

◆ UDLContext() [2/4]

UDLContext ( )
inlineexplicit

Empty constructor is useful for creating an empty UDLContext and then run copy constructor from a fully initialized one.

◆ ~UDLContext()

~UDLContext ( )
inline

destructor Deallocates any internal allocated memory

◆ UDLContext() [3/4]

UDLContext ( const UDLContext ctx)
inline

Copy Constructor - makes a copy from ctx

Parameters
[in]ctxSource UDLContext to copy from

◆ UDLContext() [4/4]

UDLContext ( UDLContext &&  ctx)
inline

Move Constructor - Move internals from ctx into this

Parameters
[in]ctxSource UDLContext to move from

Member Function Documentation

◆ clear()

void clear ( )
inline

Set zeros in the internals members

◆ getBlob()

const uint8_t* getBlob ( ) const
inlinenoexcept

Get a const pointer to the internal blob

Returns
Const pointer to the internal blob

◆ getCopy()

std::tuple<uint8_t*, size_t> getCopy ( ) const
inline

Get a copy of the blob/size into a tuple

Returns
A tuple with a pointer to a copy of the blob and a size

◆ getId()

int32_t getId ( ) const
inlinenoexcept

Obtain the Id of the layer

Returns
The id of the layer

◆ getName()

const std::string& getName ( ) const
inlinenoexcept

Obtain the name of the layer

Returns
const reference to the name of the layer

◆ getSize()

size_t getSize ( ) const
inlinenoexcept

Obtain the size of the blob

Returns
Size of the internal blob

◆ getType()

const std::string& getType ( ) const
inlinenoexcept

Obtain the type of the layer

Returns
const reference to the type of the layer

◆ operator=() [1/2]

UDLContext& operator= ( const UDLContext ctx)
inline

Assignment operator - makes a copy from ctx.

Parameters
[in]ctxSource UDLContext to copy from
Returns
this

◆ operator=() [2/2]

UDLContext& operator= ( UDLContext &&  ctx)
inline

Assignment move - Move assignment operator from ctx

Parameters
[in]ctxSource UDLContext to move from
Returns
this

◆ release()

void release ( )
inline

Deallocate any internally allocated memory

◆ zdl::DlSystem::UDLBundle

struct zdl::DlSystem::UDLBundle

Simple struct to bundle 2 elements. A user defined cookie that would be returned for each IUDL call. The user can place anything there and the SNPE runtime will provide it back

◆ SnpeUdo_Version_t

struct SnpeUdo_Version_t

◆ SnpeUdo_LibVersion_t

struct SnpeUdo_LibVersion_t

◆ SnpeUdo_Value_t

union SnpeUdo_Value_t

◆ SnpeUdo_ScalarParam_t

struct SnpeUdo_ScalarParam_t

◆ SnpeUdo_TFQuantize_t

struct SnpeUdo_TFQuantize_t

◆ SnpeUdo_QuantizeParams_t

struct SnpeUdo_QuantizeParams_t

◆ SnpeUdo_PerCoreDatatype_t

struct SnpeUdo_PerCoreDatatype_t

◆ SnpeUdo_TensorParam_t

struct SnpeUdo_TensorParam_t
Class Members
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_DataType_t dataType The parameter data type: float, int, etc.
SnpeUdo_TensorLayout_t layout The tensor layout type: NCHW, NHWC, etc.
uint32_t * maxDimensions

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

SnpeUdo_QuantizeParams_t quantizeParams

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

void * tensorData

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

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

◆ SnpeUdo_TensorInfo_t

struct SnpeUdo_TensorInfo_t

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.

◆ SnpeUdo_Param_t

struct SnpeUdo_Param_t

◆ SnpeUdo_OpCoreInfo_t

struct SnpeUdo_OpCoreInfo_t
Class Members
SnpeUdo_Bitmask_t operationCalculationTypes

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

SnpeUdo_CoreType_t udoCoreType The IP Core.

◆ SnpeUdo_OperationInfo_t

struct SnpeUdo_OperationInfo_t
Class Members
SnpeUdo_TensorInfo_t * inputInfos Array of input tensor infos for this operation.
SnpeUdo_String_t * inputNames Array of input tensor names to this operation.
uint32_t numOfCoreInfo Number of cores that the op can execute on.
uint32_t numOfInputs Number of input tensors this op receives.
uint32_t numOfOutputs Number of output tensors this op receives.
uint32_t numOfStaticParams Number of static parameters defined by the op.
SnpeUdo_String_t operationType Operation type.
SnpeUdo_OpCoreInfo_t * opPerCoreInfo Array of per-core information entries.
SnpeUdo_TensorInfo_t * outputInfos Array of output tensor infos for this operation.
SnpeUdo_String_t * outputNames Array of output tensor names to this operation.
SnpeUdo_Param_t * staticParams Array of static parameters. Can be scalar or tensor params.
SnpeUdo_Bitmask_t supportedByCores

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

◆ SnpeUdo_LibraryInfo_t

struct SnpeUdo_LibraryInfo_t

◆ SnpeUdo_RegInfo_t

struct SnpeUdo_RegInfo_t
Class Members
SnpeUdo_LibraryInfo_t * implementationLib Array of implementation libraries names/types.
uint32_t numOfImplementationLib The number of implementation libraries in the package.
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)

SnpeUdo_String_t operationsString A string containing all operation types separated by space.
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

◆ SnpeUdo_ImpInfo_t

struct SnpeUdo_ImpInfo_t

◆ SnpeUdo_OpDefinition_t

struct SnpeUdo_OpDefinition_t
Class Members
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 numOfInputs

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

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

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_String_t operationType Operation type.
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

SnpeUdo_Param_t * staticParams Array of static parameters.
SnpeUdo_CoreType_t udoCoreType The IP Core that the operation is defined for - CPU, GPU, DSP...

◆ SnpeUdo_CpuInfrastructure_t

struct SnpeUdo_CpuInfrastructure_t

The framework/runtime which loads the CPU UDO implementation library provides this infrastructure data to the loaded library at the time of op factory creation. as an opaque pointer. It contains hooks for the UDO library to invoke supported functionality at the time of execution

Parameters
getDatafunction pointer to retrieve raw tensor data from opaque pointer passed into the UDO when creating an instance.
getDataSizefunction pointer to retrieve tensor data size from opaque pointer

Public Attributes

float *(* getData )(void *)
 

Member Data Documentation

◆ getData

float*(* getData) (void *)

function pointer to retrieve raw tensor data from opaque pointer passed into the UDO when creating an instance.

◆ dspGlobalInfrastructure

struct dspGlobalInfrastructure

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.

◆ hexnnv2OpFactoryInfra

struct hexnnv2OpFactoryInfra

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.

◆ SnpeUdo_GpuInfrastructure_t

struct SnpeUdo_GpuInfrastructure_t

◆ SnpeUdo_GpuOpFactoryInfrastructure_t

struct SnpeUdo_GpuOpFactoryInfrastructure_t
Note
This version of the infrastructure definition guarantees that the same Per OpFactory infrastructure pointer will be provided to all OpFactories in the same network.

◆ SnpeUdo_GpuTensorData_t

struct SnpeUdo_GpuTensorData_t

The following is a list of all SnpeUdoTensorLayout_t values supported by the GPU UDO implementation, and how the parameters of the struct should be interpreted in each case:

SNPE_UDO_LAYOUT_NHWC: mem shall be single-element array, pointing to a cl buffer memory object. the dimensions of this object match the dimensions specified in the encompassing SnpeUdoTensorParam_t's currDimensions.

memCount shall be 1.

paddedRank and paddedDimensions are undefined and shall be ignored by the UDO implementation.

◆ zdl::DlSystem::UserBufferMap

class zdl::DlSystem::UserBufferMap

A class representing the map of UserBuffer.

Public Member Functions

 UserBufferMap ()
 
 UserBufferMap (const UserBufferMap &other)
 
UserBufferMapoperator= (const UserBufferMap &other)
 
void add (const char *name, zdl::DlSystem::IUserBuffer *buffer)
 
void remove (const char *name) noexcept
 
void clear () noexcept
 
zdl::DlSystem::IUserBuffergetUserBuffer (const char *name) const noexcept
 
zdl::DlSystem::StringList getUserBufferNames () const
 

Constructor & Destructor Documentation

◆ UserBufferMap() [1/2]

Creates a new empty UserBuffer map

◆ UserBufferMap() [2/2]

UserBufferMap ( const UserBufferMap other)

copy constructor.

Parameters
[in]otherobject to copy.

Member Function Documentation

◆ add()

void add ( const char *  name,
zdl::DlSystem::IUserBuffer buffer 
)

Adds a name and the corresponding UserBuffer pointer to the map.

Parameters
[in]nameThe name of the UserBuffer
[in]userBufferThe pointer to the UserBuffer
Note
If a UserBuffer with the same name already exists, the new UserBuffer pointer would be updated.

◆ clear()

void clear ( )
noexcept

Removes all UserBuffers from the map

◆ getUserBuffer()

zdl::DlSystem::IUserBuffer* getUserBuffer ( const char *  name) const
noexcept

Returns the UserBuffer given its name.

Parameters
[in]nameThe name of the UserBuffer to get.
Returns
nullptr if no UserBuffer with the specified name is found; otherwise, a valid pointer to the UserBuffer.

◆ getUserBufferNames()

zdl::DlSystem::StringList getUserBufferNames ( ) const

Returns the names of all UserBuffers

Returns
A list of UserBuffer names.

◆ operator=()

UserBufferMap& operator= ( const UserBufferMap other)

assignment operator.

◆ remove()

void remove ( const char *  name)
noexcept

Removes a mapping of one UserBuffer and its name by its name.

Parameters
[in]nameThe name of UserBuffer to be removed
Note
If no UserBuffer with the specified name is found, nothing is done.

Typedef Documentation

◆ Dimension

using Dimension = size_t

Convenient typedef to represent dimension

◆ 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.

◆ SnpeUdo_ExternalNotify_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.

Parameters
[in]ID32-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.
Returns
Error code

◆ SnpeUdo_getProgram_t

typedef SnpeUdo_ErrorType_t(* SnpeUdo_getProgram_t) (void *programCache, const char *programName, cl_program *program)

Function to retrieve opencl program from Program Cache repository.

This header defines version 0.0.0 of the GPU UDO Infrastructure. It defines the interpretation of the global and per-OpFactory infrastructure pointers as well as the interpretation of tensorData pointers.

The per-Operation infrastructure pointer is defined to be null, and should not be used.

The SnpeUdoTensorParam_t struct below provides the interpretation for the tensorData opaque pointer for SnpeUdoTensorParams representing inputs or outputs.

The tensorData opaque pointer populated in SnpeUdoScalarParam_t structs should be interpreted as a host-readable data pointer.

Parameters
programCacheis opaque pointer to Program Cache repository provided by SNPE GPU UDO runtime.
programNameis name associated with opencl program for UDO.
programis pointer to opencl program which will be populated with valid opencl program if found in Program Cache repository.
Returns
SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned on success.

◆ 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.

◆ SnpeUdo_HexNNv2OpInfra_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.

◆ SnpeUdo_storeProgram_t

typedef SnpeUdo_ErrorType_t(* SnpeUdo_storeProgram_t) (void *programCache, const char *programName, cl_program program)

Function to store valid opencl program in Program Cache repository.

Parameters
programCacheis opaque pointer to Program Cache repository provided by SNPE GPU UDO runtime.
programNameis name associated with opencl program for UDO.
programis valid opencl program after program is built.
Returns
SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned on success.

◆ UDLFactoryFunc

using UDLFactoryFunc = std::function<zdl::DlSystem::IUDL* (void*, const zdl::DlSystem::UDLContext*)>

Definition of UDLFactoyFunc, using/typedef and default FactoryFunction UDLBundle - a simple way to bundle func and cookie into one type Convenient typedef for user defined layer creation factory

Parameters
[out]void*Cookie - a user opaque data that was passed during SNPE's runtime's CreateInstance. SNPE's runtime is passing this back to the user.
[out]DlSystem::UDLContext*- The specific Layer Description context what is passe SNPE runtime.
Returns
IUDL* - a Concrete instance of IUDL derivative

Enumeration Type Documentation

◆ ExecutionPriorityHint_t

Enumeration of various execution priority hints.

Enumerator
NORMAL 

Normal priority.

HIGH 

Higher than normal priority.

LOW 

Lower priority.

◆ PerformanceProfile_t

enum PerformanceProfile_t
strong

Enumeration of various performance profiles that can be requested.

Enumerator
DEFAULT 

Run in a standard mode. This mode will be deprecated in the future and replaced with BALANCED.

BALANCED 

Run in a balanced mode.

HIGH_PERFORMANCE 

Run in high performance mode.

POWER_SAVER 

Run in a power sensitive mode, at the expense of performance.

SYSTEM_SETTINGS 

Use system settings. SNPE makes no calls to any performance related APIs.

SUSTAINED_HIGH_PERFORMANCE 

Run in sustained high performance mode.

BURST 

Run in burst mode.

LOW_POWER_SAVER 

Run in lower clock than POWER_SAVER, at the expense of performance.

HIGH_POWER_SAVER 

Run in higher clock and provides better performance than POWER_SAVER.

LOW_BALANCED 

Run in lower balanced mode.

◆ ProfilingLevel_t

enum ProfilingLevel_t
strong

Enumeration of various profilngLevels that can be requested.

Enumerator
OFF 

No profiling. Collects no runtime stats in the DiagLog

BASIC 

Basic profiling Collects some runtime stats in the DiagLog

DETAILED 

Detailed profiling Collects more runtime stats in the DiagLog, including per-layer statistics Performance may be impacted

MODERATE 

Moderate profiling Collects more runtime stats in the DiagLog, no per-layer statistics

◆ Runtime_t

enum Runtime_t
strong

Enumeration of supported target runtimes.

Enumerator
CPU_FLOAT32 

Run the processing on Snapdragon CPU. Data: float 32bit Math: float 32bit

GPU_FLOAT32_16_HYBRID 

Run the processing on the Adreno GPU. Data: float 16bit Math: float 32bit

DSP_FIXED8_TF 

Run the processing on the Hexagon DSP. Data: 8bit fixed point Tensorflow style format Math: 8bit fixed point Tensorflow style format

GPU_FLOAT16 

Run the processing on the Adreno GPU. Data: float 16bit Math: float 16bit

AIP_FIXED8_TF 

Run the processing on Snapdragon AIX+HVX. Data: 8bit fixed point Tensorflow style format Math: 8bit fixed point Tensorflow style format

CPU 

Default legacy enum to retain backward compatibility. CPU = CPU_FLOAT32

GPU 

Default legacy enum to retain backward compatibility. GPU = GPU_FLOAT32_16_HYBRID

DSP 

Default legacy enum to retain backward compatibility. DSP = DSP_FIXED8_TF

UNSET 

Special value indicating the property is unset.

◆ RuntimeCheckOption_t

enum RuntimeCheckOption_t
strong

Enumeration of runtime available check options.

Enumerator
DEFAULT 

Perform standard runtime available check.

NORMAL_CHECK 

Perform standard runtime available check.

BASIC_CHECK 

Perform basic runtime available check, may be runtime specific.

◆ 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)

Enumerator
SNPE_UDO_CORETYPE_UNDEFINED 

Library target IP Core is undefined.

SNPE_UDO_CORETYPE_CPU 

Library target IP Core is CPU.

SNPE_UDO_CORETYPE_GPU 

Library target IP Core is GPU.

SNPE_UDO_CORETYPE_DSP 

Library target IP Core is DSP.

◆ 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

Enumerator
SNPE_UDO_DATATYPE_FLOAT_16 

data type: 16-bit floating point

SNPE_UDO_DATATYPE_FLOAT_32 

data type: 32-bit floating point

SNPE_UDO_DATATYPE_FIXED_4 

data type: 4-bit fixed point

SNPE_UDO_DATATYPE_FIXED_8 

data type: 8-bit fixed point

SNPE_UDO_DATATYPE_FIXED_16 

data type: 16-bit fixed point

SNPE_UDO_DATATYPE_FIXED_32 

data type: 32-bit fixed point

SNPE_UDO_DATATYPE_UINT_8 

data type: 8-bit unsigned integer

SNPE_UDO_DATATYPE_UINT_16 

data type: 16-bit unsigned integer

SNPE_UDO_DATATYPE_UINT_32 

data type: 32-bit unsigned integer

SNPE_UDO_DATATYPE_INT_8 

data type: 8-bit signed integer

SNPE_UDO_DATATYPE_INT_16 

data type: 16-bit signed integer

SNPE_UDO_DATATYPE_INT_32 

data type: 32-bit signed integer

◆ 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

Enumerator
SNPE_UDO_NO_ERROR 

No Error.

SNPE_UDO_WRONG_CORE 

Unsupported value for core type.

SNPE_UDO_INVALID_ARGUMENT 

Invalid attribute/argument passed into UDO API.

SNPE_UDO_UNSUPPORTED_FEATURE 

Unsupported feature error.

SNPE_UDO_MEM_ALLOC_ERROR 

Error relating to memory allocation.

SNPE_UDO_WRONG_OPERATION 

No op with given attributes available in library.

SNPE_UDO_WRONG_CORE_TYPE 

Unsupported value for core type in UDO configuration.

SNPE_UDO_WRONG_NUM_OF_PARAMS 

Wrong number of params in UDO definition.

SNPE_UDO_WRONG_NUM_OF_DIMENSIONS 

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

SNPE_UDO_WRONG_NUM_OF_INPUTS 

Wrong number of input tensors in UDO definition.

SNPE_UDO_WRONG_NUM_OF_OUTPUTS 

Wrong number of output tensors in UDO definition.

◆ SnpeUdo_ParamType_t

An enum to specify the parameter type : Scalar or Tensor

Enumerator
SNPE_UDO_PARAMTYPE_SCALAR 

UDO static param type: scalar.

SNPE_UDO_PARAMTYPE_STRING 

UDO static param type: string.

SNPE_UDO_PARAMTYPE_TENSOR 

UDO static param type: tensor.

◆ SnpeUdo_QuantizationType_t

An enum to specify quantization type

Enumerator
SNPE_UDO_QUANTIZATION_NONE 

Tensor Quantization type: NONE. Signifies unquantized tensor data.

SNPE_UDO_QUANTIZATION_TF 

Tensor Quantization type: Tensorflow-style.

◆ 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)

Enumerator
SNPE_UDO_LAYOUT_NHWC 

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

SNPE_UDO_LAYOUT_NCHW 

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

SNPE_UDO_LAYOUT_NDHWC 

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

Function Documentation

◆ add() [1/2]

void add ( const char *  name,
zdl::DlSystem::ITensor tensor 
)

Adds a name and the corresponding tensor pointer to the map.

Parameters
[in]nameThe name of the tensor
[out]tensorThe pointer to the tensor
Note
If a tensor with the same name already exists, the tensor is replaced with the existing tensor.

◆ add() [2/2]

void add ( const char *  name,
const zdl::DlSystem::TensorShape tensorShape 
)

Adds a name and the corresponding tensor pointer to the map.

Parameters
[in]nameThe name of the tensor
[out]tensorThe pointer to the tensor
Note
If a tensor with the same name already exists, no new tensor is added.

◆ append()

void append ( const char *  str)

Append a string to the list.

Parameters
[in]strNull-terminated ASCII string to append to the list.

◆ asString()

const zdl::DlSystem::String asString ( ) const

Returns a string in the form Major.Minor.Teeny.Build.

Returns
A formatted string holding the version information.

◆ at()

const char* at ( size_t  idx) const
noexcept

Returns the string at the indicated position, or an empty string if the positions is greater than the size of the list.

Parameters
[in]idxPosition in the list of the desired string

◆ begin() [1/2]

const char** begin ( ) const
noexcept

Pointer to the first string in the list. Can be used to iterate through the list.

◆ begin() [2/2]

virtual iterator begin ( )
pure virtual

Returns a tensor iterator pointing to the beginning of the data in the tensor.

Returns
A tensor iterator that points to the first data element in the tensor.

◆ cbegin()

virtual const_iterator cbegin ( ) const
pure virtual

Returns the const version of a tensor iterator pointing to the beginning of the data in the tensor.

Returns
A tensor const iterator that points to the first data element in the tensor.

◆ cend()

virtual const_iterator cend ( ) const
pure virtual

Returns the const version of a tensor iterator pointing to the end of the data in the tensor. This tensor should not be dereferenced.

Returns
A tensor const iterator that points to the end of the data (one past the last element) in the tensor.

◆ clear() [1/2]

void clear ( )
noexcept

Removes all tensors from the map

◆ clear() [2/2]

void clear ( )
noexcept

Removes all tensors from the map

◆ concatenate() [1/3]

void concatenate ( std::initializer_list< Dimension dims)

Concatenates additional dimensions specified in initializer list fashion to the existing dimensions.

Parameters
[in]dimsThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

◆ concatenate() [2/3]

void concatenate ( const Dimension dims,
size_t  size 
)

Concatenates additional dimensions specified in the array to the existing dimensions.

Parameters
[in]dimsThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.
[in]sizeSize of the array.

◆ concatenate() [3/3]

void concatenate ( const Dimension dim)

Concatenates an additional dimension to the existing dimensions.

Parameters
[in]dimThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

◆ createTensor() [1/3]

virtual std::unique_ptr<ITensor> createTensor ( const TensorShape shape)
pure virtualnoexcept

Creates a new ITensor with uninitialized data.

The strides for the tensor will match the tensor dimensions (i.e., the tensor data is contiguous in memory).

Parameters
[in]shapeThe dimensions for the tensor in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.
Returns
A pointer to the created tensor or nullptr if creating failed.

◆ createTensor() [2/3]

virtual std::unique_ptr<ITensor> createTensor ( std::istream &  input)
pure virtualnoexcept

Creates a new ITensor by loading it from a file.

Parameters
[in]inputThe input stream from which to read the tensor data.
Returns
A pointer to the created tensor or nullptr if creating failed.

◆ createTensor() [3/3]

virtual std::unique_ptr<ITensor> createTensor ( const TensorShape shape,
const unsigned char *  data,
size_t  dataSize 
)
pure virtualnoexcept

Create a new ITensor with specific data. (i.e. the tensor data is contiguous in memory). This tensor is primarily used to create a tensor where tensor size can't be computed directly from dimension. One such example is NV21-formatted image, or any YUV formatted image

Parameters
[in]shapeThe dimensions for the tensor in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.
[in]dataThe actual data with which the Tensor object is filled.
[in]dataSizeThe size of data
Returns
A pointer to the created tensor

◆ DefaultUDLFunc()

ZDL_EXPORT zdl::DlSystem::IUDL* zdl::DlSystem::DefaultUDLFunc ( void *  ,
const zdl::DlSystem::UDLContext  
)
inline

default UDL factory implementation

Parameters
[out]DlSystem::UDLContext*- The specific Layer Description context what is passe SNPE runtime.
[out]void*Cookie - a user opaque data that was passed during SNPE's runtime's CreateInstance. SNPE's runtime is passing this back to the user.
Returns
IUDL* - nullptr to indicate SNPE's runtime that there is no specific implementation for UDL. When SNPE's runtime sees nullptr as a return value from the factory, it will halt execution if model has an unknown layer

◆ end() [1/2]

const char** end ( ) const
noexcept

Pointer to one after the last string in the list. Can be used to iterate through the list.

◆ end() [2/2]

virtual iterator end ( )
pure virtual

Returns a tensor iterator pointing to the end of the data in the tensor. This tensor should not be dereferenced.

Returns
A tensor iterator that points to the end of the data (one past the last element) in the tensor.

◆ enumToUInt32()

ZDL_EXPORT uint32_t zdl::DlSystem::enumToUInt32 ( zdl::DlSystem::ErrorCode  code)

Returns the uint32_t representation of the error code enum.

Parameters
[in]codeThe error code to be converted.
Returns
uint32_t representation of the error code.

◆ getDimensions()

const Dimension* getDimensions ( ) const

Retrieves a pointer to the first dimension of shape

Returns
nullptr if no dimension exists; otherwise, points to the first dimension.

◆ getLastErrorCode()

ZDL_EXPORT ErrorCode zdl::DlSystem::getLastErrorCode ( )

Returns the error code of the last error encountered.

Returns
The error code.
Note
The returned error code is significant only when the return value of the call indicated an error.

◆ getLastErrorString()

ZDL_EXPORT const char* zdl::DlSystem::getLastErrorString ( )

Returns the error string of the last error encountered.

Returns
The error string.
Note
The returned error string is significant only when the return value of the call indicated an error.

◆ getLastInfoString()

ZDL_EXPORT const char* zdl::DlSystem::getLastInfoString ( )

Returns the info string of the last error encountered.

◆ getOptions()

virtual Options getOptions ( )
pure virtual

Gets the curent options for the diag logger.

Returns
Diag log options object.

◆ getShape()

virtual TensorShape getShape ( ) const
pure virtual

Gets the shape of this tensor.

The last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying dimension, etc.

Returns
A shape class holding the tensor dimensions.

◆ getSize()

virtual size_t getSize ( ) const
pure virtual

Returns the element size of the data in the tensor (discounting strides). This is how big a buffer would need to be to hold the tensor data contiguously in memory.

Returns
The size of the tensor (in elements).

◆ getTensor()

zdl::DlSystem::ITensor* getTensor ( const char *  name) const
noexcept

Returns the tensor given its name.

Parameters
[in]nameThe name of the tensor to get.
Returns
nullptr if no tensor with the specified name is found; otherwise, a valid pointer to the tensor.

◆ getTensorNames()

zdl::DlSystem::StringList getTensorNames ( ) const

Returns the names of all tensors

◆ getTensorShape()

zdl::DlSystem::TensorShape getTensorShape ( const char *  name) const
noexcept

Returns the tensor given its name.

Parameters
[in]nameThe name of the tensor to get.
Returns
nullptr if no tensor with the specified name is found; otherwise, a valid pointer to the tensor.

◆ getTensorShapeNames()

zdl::DlSystem::StringList getTensorShapeNames ( ) const

Returns the names of all tensor shapes

◆ open() [1/4]

static std::unique_ptr<IDlContainer> open ( const std::string &  filename)
staticnoexcept

Initializes a container from a container archive file.

Parameters
[in]filenameContainer archive file path.
Returns
A pointer to the initialized container

◆ open() [2/4]

static std::unique_ptr<IDlContainer> open ( const zdl::DlSystem::String &  filename)
staticnoexcept

Initializes a container from a container archive file.

Parameters
[in]filenameContainer archive file path.
Returns
A pointer to the initialized container

◆ open() [3/4]

static std::unique_ptr<IDlContainer> open ( const std::vector< uint8_t > &  buffer)
staticnoexcept

Initializes a container from a byte buffer.

Parameters
[in]bufferByte buffer holding the contents of an archive file.
Returns
A pointer to the initialized container

◆ open() [4/4]

static std::unique_ptr<IDlContainer> open ( const uint8_t *  buffer,
const size_t  size 
)
staticnoexcept

Initializes a container from a byte buffer.

Parameters
[in]bufferByte buffer holding the contents of an archive file.
[in]sizeSize of the byte buffer.
Returns
A pointer to the initialized container

◆ operator bool()

operator bool ( ) const
inlinenoexcept

Boolean value of Optional class is only true when there exists a value.

◆ operator*() [1/2]

const T& operator* ( )
inline

Get reference of Optional object

Warning
User must validate Optional has value before.

◆ operator*() [2/2]

const T& operator* ( ) const
inline

Get reference of Optional object

Warning
User must validate Optional has value before.

◆ operator=() [1/4]

TensorMap& operator= ( const TensorMap other)

assignment operator.

◆ operator=() [2/4]

TensorShapeMap& operator= ( const TensorShapeMap other)

assignment operator.

◆ operator=() [3/4]

StringList& operator= ( const StringList )
noexcept

assignment operator.

◆ operator=() [4/4]

TensorShape& operator= ( const TensorShape other)

assignment operator.

◆ operator[]()

Dimension& operator[] ( size_t  index)

Retrieves a single dimension, based on its index.

Returns
The value of dimension
Exceptions
std::out_of_rangeif the index is >= the number of dimensions (or rank).

◆ Optional() [1/2]

Optional ( )
inline

The default constructor is set to not have any value, and is therefore evaluated as false.

◆ Optional() [2/2]

Optional ( const T &  v,
typename std::enable_if<!std::is_pointer< Q >::value >::type *  = 0 
)
inline

Construct an Optional class using an object.

Parameters
[in]Referenceto an object v
[out]Optionalinstance of object v

◆ rank()

size_t rank ( ) const

Retrieves the rank i.e. number of dimensions.

Returns
The rank

◆ remove() [1/2]

void remove ( const char *  name)
noexcept

Removes a mapping of tensor and its name by its name.

Parameters
[in]nameThe name of tensor to be removed
Note
If no tensor with the specified name is found, nothing is done.

◆ remove() [2/2]

void remove ( const char *  name)
noexcept

Removes a mapping of tensor and its name by its name.

Parameters
[in]nameThe name of tensor to be removed
Note
If no tensor with the specified name is found, nothing is done.

◆ serialize()

virtual void serialize ( std::ostream &  output) const
pure virtual

Serializes the tensor to an output stream.

Parameters
[in]outputThe output stream to which to write the tensor
Exceptions
std::runtime_errorIf the stream is ever in a bad state before the tensor is fully serialized.

◆ setDiagLogMask() [1/2]

virtual bool setDiagLogMask ( const std::string &  mask)
pure virtual

Allows for setting the log mask once diag logging has started

Returns
True if the level was set successfully, false if a failure occurred.

◆ setDiagLogMask() [2/2]

virtual bool setDiagLogMask ( const zdl::DlSystem::String &  mask)
pure virtual

Allows for setting the log mask once diag logging has started

Returns
True if the level was set successfully, false if a failure occurred.

◆ setOptions()

virtual bool setOptions ( const Options loggingOptions)
pure virtual

Sets the options after initialization occurs.

Parameters
[in]loggingOptionsThe options to set up diagnostic logging.
Returns
False if the options could not be set. Ensure logging is not started.

◆ size()

size_t size ( ) const
noexcept

Return the number of valid string pointers held by this list.

◆ SnpeUdo_createOperation()

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
[in]opFactoryOpFactory instance containing the parameters for this operation.
[in]perOpInfrastructurePer-Op infrastructure for this operation. The definition and semantics of this object will be defined in the implementation header appropriate to this core type.
[in]numOfInputsThe number of input tensors this operation will receive.
[in]inputsArray of input tensors, providing both the sizes and initial location of the data.
[in]numOfOutputsNumber of output tensors this operation will produce.
[in]outputsArray of output tensors, providing both the sizes and initial location of the data.
[in,out]operationHandle for newly created operation instance.
Returns
Error Code

◆ SnpeUdo_createOpFactory()

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
[in]udoCoreTypeThe Core type to create the operation on. An error will be returned if this does not match the core type of the library.
[in]perFactoryInfrastructureCreateOpFactory 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.
[in]operationTypeA string containing Operation type. for example "MY_CONV"
[in]numOfStaticParamsThe number of static parameters.
[in]staticParamsArray of static parameters
[in,out]opFactoryHandler to Operation Factory, to be used when creating operations
Returns
Error Code

◆ SnpeUdo_executeOp()

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. NOTE: Asynchronous execution mode not supported in this release.

Parameters
[in]operationhandle to the operation on which execute is invoked
[in]blockingflag 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.
[in]ID32-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.
[in]notifyFuncPointer 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_getImpInfo()

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
[in,out]implementationInfoA pointer to struct which contains information on the operations
Returns
error code

◆ SnpeUdo_getImplVersion()

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
[in,out]versionA pointer to struct which contains major, minor, teeny information for library and api versions.
Returns
Error code

◆ SnpeUdo_getRegInfo()

SnpeUdo_ErrorType_t SnpeUdo_getRegInfo ( SnpeUdo_RegInfo_t **  registrationInfo)

A function to query the info on the UDO set. The function populates a structure which contains information about the package and operations contained in it.

Parameters
[in,out]registrationInfoA struct which contains information on the set of UDOs
Returns
Error code

◆ SnpeUdo_getRegLibraryVersion()

SnpeUdo_ErrorType_t SnpeUdo_getRegLibraryVersion ( SnpeUdo_LibVersion_t **  version)

A function to query the API version of the UDO registration library. The function populates a SnpeUdo_LibVersion_t struct, which contains a SnpeUdo_Version_t struct for API version and library version.

Parameters
[in,out]versionA pointer to struct which contains major, minor, teeny information for library and api versions.
Returns
Error code

◆ SnpeUdo_getVersion()

SnpeUdo_ErrorType_t SnpeUdo_getVersion ( SnpeUdo_LibVersion_t **  version)

A function to return the various versions as they relate to the UDO The function returns a struct containing the the following: libVersion: the version of the implementation library compiled for the UDO. Set by user apiVersion: the version of the UDO API used in compiling the implementation library. Set by SNPE.

Parameters
[in,out]versionA pointer to Version struct of type SnpeUdo_LibVersion_t
Returns
Error code

◆ SnpeUdo_initImplLibrary()

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
[in]globalInfrastructureGlobal 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_initRegLibrary()

SnpeUdo_ErrorType_t SnpeUdo_initRegLibrary ( void  )

Initialize the shared library's data structures. Calling any other library function before this one will result in an error being returned.

Returns
Error code

◆ SnpeUdo_profileOp()

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
[in]operationHandle to operation whose execution time is being profiled
[in,out]executionTimepointer to a uint32 value.This function writes the operation execution time in usec into this value.
Returns
Error code

◆ SnpeUdo_queryOperation()

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
[in]operationTypeOperation type
[in]numOfStaticParamsNumber of static params defined by the op
[in]staticParamsArray of static params to the op
[in,out]numOfInputsNumber of input tensors to the op
[in,out]inputsQuantTypesArray of Quantization info for each input tensor
[in,out]inputsLayoutsArray of layout type for each input tensor
[in,out]numOfOutputsNumber of output tensors to the op
[in,out]outputsQuantTypesArray of Quantization info for each output tensor
[in,out]outputsLayoutsArray of layout type for each output tensor
Returns
error code, indicating status of query

◆ SnpeUdo_releaseOp()

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
[in]operationHandle to operation to be released
Returns
Error code

◆ SnpeUdo_releaseOpFactory()

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
[in]factoryThe operation factory to release. Upon success this handle will be invalidated.
Returns
Error Code

◆ SnpeUdo_setOpIO()

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
[in]operationOperation on which IO tensors are set
[in]inputsarray of tensor parameters. The calling entity may provide a subset of the operation inputs, providing only those that it wants to change.
[in]outputsarray 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_terminateImplLibrary()

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_terminateRegLibrary()

SnpeUdo_ErrorType_t SnpeUdo_terminateRegLibrary ( 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_InitRegLibrary) will return an error after this function has been successfully called.

It should be possible to call SnpeUdo_InitRegLibrary after calling this function, and re-initialize the library.

Returns
Error code

◆ SnpeUdo_validateOperation() [1/2]

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
[in]operationTypeOperation type
[in]numOfStaticParamsNumber of static params defined by the op
[in]staticParamsArray of static params to the op
Returns
Error code, indicating if the operation can be created on this set of configuration or not.

◆ SnpeUdo_validateOperation() [2/2]

SnpeUdo_ErrorType_t SnpeUdo_validateOperation ( SnpeUdo_OpDefinition_t opDefinition)

A function to validate that a set of params is supported by an operation The function receives an operation definition struct, and returns if this configuration is supported (e.g. if an operation can be created using this configuration)

Parameters
[in]opDefinitionA struct of SnpeUdo_OpDefinition type, containing the information needed to validate that an operation can be created with this configuration.
Returns
Error code, indicating is the operation can be created on this set or not.

◆ start()

virtual bool start ( void  )
pure virtual

Enables logging for zdl components.

Logging should be started prior to the instantiation of zdl components to ensure all events are captured.

Returns
False if diagnostic logging could not be started.

◆ StringList() [1/3]

StringList ( size_t  length)
explicit

Construct a string list with some pre-allocated memory.

Warning
Contents of the list will be uninitialized
Parameters
[in]lengthNumber of elements for which to pre-allocate space.

◆ StringList() [2/3]

StringList ( const StringList other)

copy constructor.

Parameters
[in]otherobject to copy.

◆ StringList() [3/3]

StringList ( StringList &&  other)
noexcept

move constructor.

Parameters
[in]otherobject to move.

◆ TensorMap() [1/2]

TensorMap ( )

Creates a new empty tensor map

◆ TensorMap() [2/2]

TensorMap ( const TensorMap other)

copy constructor.

Parameters
[in]otherobject to copy.

◆ TensorShape() [1/5]

TensorShape ( std::initializer_list< Dimension dims)

Creates a new shape with a list of dims specified in initializer list fashion.

Parameters
[in]dimsThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

◆ TensorShape() [2/5]

TensorShape ( const Dimension dims,
size_t  size 
)

Creates a new shape with a list of dims specified in array

Parameters
[in]dimsThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.
[in]sizeSize of the array.

◆ TensorShape() [3/5]

TensorShape ( std::vector< Dimension dims)

Creates a new shape with a vector of dims specified in vector fashion.

Parameters
[in]dimsThe dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

◆ TensorShape() [4/5]

TensorShape ( const TensorShape other)

copy constructor.

Parameters
[in]otherobject to copy.

◆ TensorShape() [5/5]

Creates a new shape with no dims. It can be extended later by invoking concatenate.

◆ TensorShapeMap() [1/2]

Creates a new tensor shape map

◆ TensorShapeMap() [2/2]

TensorShapeMap ( const TensorShapeMap other)

copy constructor.

Parameters
[in]otherobject to copy.

◆ toString()

const std::string toString ( ) const

Returns a string in the form Major.Minor.Teeny.Build.

Returns
A formatted string holding the version information.

Variable Documentation

◆ Build

std::string Build

This string holds information about the build version.

◆ Major

int32_t Major

Holds the major version number. Changes in this value indicate major changes that break backward compatibility.

◆ Minor

int32_t Minor

Holds the minor version number. Changes in this value indicate minor changes made to library that are backwards compatible (such as additions to the interface).

◆ Teeny

int32_t Teeny

Holds the teeny version number. Changes in this value indicate changes such as bug fixes and patches made to the library that do not affect the interface.