This commit is contained in:
Your Name
2024-04-27 03:23:42 -05:00
parent b1c566e71e
commit fbbdf2c03c
315 changed files with 79358 additions and 3 deletions

View File

@@ -0,0 +1,537 @@
//==============================================================================
//
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef SNPE_UDO_BASE_H
#define SNPE_UDO_BASE_H
#include <stdint.h>
// Provide values to use for API version.
#define API_VERSION_MAJOR 1
#define API_VERSION_MINOR 6
#define API_VERSION_TEENY 0
/** @addtogroup c_plus_plus_apis C++
@{ */
// Defines a bitmask of enum values.
typedef uint32_t SnpeUdo_Bitmask_t;
typedef SnpeUdo_Bitmask_t Udo_Bitmask_t;
// A string of characters, rather than an array of bytes.
// Assumed to be UTF-8.
typedef char* SnpeUdo_String_t;
typedef SnpeUdo_String_t Udo_String_t;
// The maximum allowable length of a SnpeUdo_String_t in bytes,
// including null terminator. SNPE will truncate strings longer
// than this.
#define SNPE_UDO_MAX_STRING_SIZE 1024
/**
* 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
*
*/
typedef enum
{
/// No Error
SNPE_UDO_NO_ERROR = 0, UDO_NO_ERROR = 0,
/// Unsupported value for core type
SNPE_UDO_WRONG_CORE = 1, UDO_WRONG_CORE = 1,
/// Invalid attribute/argument passed into UDO API
SNPE_UDO_INVALID_ARGUMENT = 2, UDO_INVALID_ARGUMENT = 2,
/// Unsupported feature error
SNPE_UDO_UNSUPPORTED_FEATURE = 3, UDO_UNSUPPORTED_FEATURE = 3,
/// Error relating to memory allocation
SNPE_UDO_MEM_ALLOC_ERROR = 4, UDO_MEM_ALLOC_ERROR = 4,
/* Configuration Specific errors */
/// No op with given attributes available in library
SNPE_UDO_WRONG_OPERATION = 100, UDO_WRONG_OPERATION = 100,
/// Unsupported value for core type in UDO configuration
SNPE_UDO_WRONG_CORE_TYPE = 101, UDO_WRONG_CORE_TYPE = 101,
/// Wrong number of params in UDO definition
SNPE_UDO_WRONG_NUM_OF_PARAMS = 102, UDO_WRONG_NUM_OF_PARAMS = 102,
/// Wrong number of dimensions for tensor(s) in UDO definition
SNPE_UDO_WRONG_NUM_OF_DIMENSIONS = 103, UDO_WRONG_NUM_OF_DIMENSIONS = 103,
/// Wrong number of input tensors in UDO definition
SNPE_UDO_WRONG_NUM_OF_INPUTS = 104, UDO_WRONG_NUM_OF_INPUTS = 104,
/// Wrong number of output tensors in UDO definition
SNPE_UDO_WRONG_NUM_OF_OUTPUTS = 105, UDO_WRONG_NUM_OF_OUTPUTS = 105,
SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106, UDO_PROGRAM_CACHE_NOT_FOUND = 106,
SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF, UDO_UNKNOWN_ERROR = 0xFFFFFFFF
} SnpeUdo_ErrorType_t;
typedef SnpeUdo_ErrorType_t Udo_ErrorType_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)
* \n FIXED_XX types are targeted for data in tensors.
* \n UINT / INT types are targeted for scalar params
*/
typedef enum
{
/// data type: 16-bit floating point
SNPE_UDO_DATATYPE_FLOAT_16 = 0x01, UDO_DATATYPE_FLOAT_16 = 0x01,
/// data type: 32-bit floating point
SNPE_UDO_DATATYPE_FLOAT_32 = 0x02, UDO_DATATYPE_FLOAT_32 = 0x02,
/// data type: 4-bit fixed point
SNPE_UDO_DATATYPE_FIXED_4 = 0x04, UDO_DATATYPE_FIXED_4 = 0x04,
/// data type: 8-bit fixed point
SNPE_UDO_DATATYPE_FIXED_8 = 0x08, UDO_DATATYPE_FIXED_8 = 0x08,
/// data type: 16-bit fixed point
SNPE_UDO_DATATYPE_FIXED_16 = 0x10, UDO_DATATYPE_FIXED_16 = 0x10,
/// data type: 32-bit fixed point
SNPE_UDO_DATATYPE_FIXED_32 = 0x20, UDO_DATATYPE_FIXED_32 = 0x20,
/// data type: 8-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_8 = 0x100, UDO_DATATYPE_UINT_8 = 0x100,
/// data type: 16-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_16 = 0x200, UDO_DATATYPE_UINT_16 = 0x200,
/// data type: 32-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_32 = 0x400, UDO_DATATYPE_UINT_32 = 0x400,
/// data type: 8-bit signed integer
SNPE_UDO_DATATYPE_INT_8 = 0x1000, UDO_DATATYPE_INT_8 = 0x1000,
/// data type: 16-bit signed integer
SNPE_UDO_DATATYPE_INT_16 = 0x2000, UDO_DATATYPE_INT_16 = 0x2000,
/// data type: 32-bit signed integer
SNPE_UDO_DATATYPE_INT_32 = 0x4000, UDO_DATATYPE_INT_32 = 0x4000,
SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF, UDO_DATATYPE_LAST = 0xFFFFFFFF
} SnpeUdo_DataType_t;
typedef SnpeUdo_DataType_t Udo_DataType_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)
*/
typedef enum
{
/// data layout (4D): NHWC (batch-height-width-channel)
SNPE_UDO_LAYOUT_NHWC = 0x01, UDO_LAYOUT_NHWC = 0x01,
/// data layout (4D): NCHW (batch-channel-height-width)
SNPE_UDO_LAYOUT_NCHW = 0x02, UDO_LAYOUT_NCHW = 0x02,
/// data layout (5D): NDHWC (batch-dimension-height-width-channel)
SNPE_UDO_LAYOUT_NDHWC = 0x04, UDO_LAYOUT_NDHWC = 0x04,
SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08, UDO_LAYOUT_GPU_OPTIMAL1 = 0x08,
SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10, UDO_LAYOUT_GPU_OPTIMAL2 = 0x10,
SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11, UDO_LAYOUT_DSP_OPTIMAL1 = 0x11,
SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12, UDO_LAYOUT_DSP_OPTIMAL2 = 0x12,
// Indicates no data will be allocated for this tensor.
// Used to specify optional inputs/outputs positionally.
SNPE_UDO_LAYOUT_NULL = 0x13, UDO_LAYOUT_NULL = 0x13,
SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF, UDO_LAYOUT_LAST = 0xFFFFFFFF
} SnpeUdo_TensorLayout_t;
typedef SnpeUdo_TensorLayout_t Udo_TensorLayout_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)
*/
typedef enum
{
/// Library target IP Core is undefined
SNPE_UDO_CORETYPE_UNDEFINED = 0x00, UDO_CORETYPE_UNDEFINED = 0x00,
/// Library target IP Core is CPU
SNPE_UDO_CORETYPE_CPU = 0x01, UDO_CORETYPE_CPU = 0x01,
/// Library target IP Core is GPU
SNPE_UDO_CORETYPE_GPU = 0x02, UDO_CORETYPE_GPU = 0x02,
/// Library target IP Core is DSP
SNPE_UDO_CORETYPE_DSP = 0x04, UDO_CORETYPE_DSP = 0x04,
SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF, UDO_CORETYPE_LAST = 0xFFFFFFFF
} SnpeUdo_CoreType_t;
typedef SnpeUdo_CoreType_t Udo_CoreType_t;
/**
* An enum to specify the parameter type : Scalar or Tensor
*/
typedef enum
{
/// UDO static param type: scalar
SNPE_UDO_PARAMTYPE_SCALAR = 0x00, UDO_PARAMTYPE_SCALAR = 0x00,
/// UDO static param type: string
SNPE_UDO_PARAMTYPE_STRING = 0x01, UDO_PARAMTYPE_STRING = 0x01,
/// UDO static param type: tensor
SNPE_UDO_PARAMTYPE_TENSOR = 0x02, UDO_PARAMTYPE_TENSOR = 0x02,
SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF, UDO_PARAMTYPE_LAST = 0xFFFFFFFF
} SnpeUdo_ParamType_t;
typedef SnpeUdo_ParamType_t Udo_ParamType_t;
/**
* An enum to specify quantization type
*/
typedef enum
{
/// Tensor Quantization type: NONE. Signifies unquantized tensor data
SNPE_UDO_QUANTIZATION_NONE = 0x00, UDO_QUANTIZATION_NONE = 0x00,
/// Tensor Quantization type: Tensorflow-style
SNPE_UDO_QUANTIZATION_TF = 0x01, UDO_QUANTIZATION_TF = 0x01,
SNPE_UDO_QUANTIZATION_QMN = 0x02, UDO_QUANTIZATION_QMN = 0x02,
SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF, UDO_QUANTIZATION_LAST = 0xFFFFFFFF
} SnpeUdo_QuantizationType_t;
typedef SnpeUdo_QuantizationType_t Udo_QuantizationType_t;
/**
* @brief A struct which is used to provide a version number using 3 values : major, minor, teeny
*
*/
typedef struct
{
/// version field: major - for backward-incompatible changes
uint32_t major;
/// version field: minor - for backward-compatible feature updates
uint32_t minor;
/// version field: teeny - for minor bug-fixes and clean-up
uint32_t teeny;
} SnpeUdo_Version_t;
typedef SnpeUdo_Version_t Udo_Version_t;
/**
* @brief A struct returned from version query, contains the Library version and API version
*
*/
typedef struct
{
/// Version of UDO library. Controlled by users
SnpeUdo_Version_t libVersion;
/// Version of SNPE UDO API used in compiling library. Determined by SNPE
SnpeUdo_Version_t apiVersion;
} SnpeUdo_LibVersion_t;
/**
* @brief A struct returned from version query, contains the package version
*
*/
typedef struct
{
/// Version of UDO API used in package.
Udo_Version_t apiVersion;
} Udo_PkgVersion_t;
/**
* @brief A union to hold the value of a generic type. Allows defining a parameter struct
* in a generic way, with a "value" location that holds the data regardless of the type.
*
*/
typedef union
{
/// value type: float
float floatValue;
/// value type: unsigned 32-bit integer
uint32_t uint32Value;
/// value type: signed 32-bit integer
int32_t int32Value;
/// value type: unsigned 16-bit integer
uint16_t uint16Value;
/// value type: signed 16-bit integer
int16_t int16Value;
/// value type: unsigned 8-bit integer
uint8_t uint8Value;
/// value type: signed 8-bit integer
int8_t int8Value;
} SnpeUdo_Value_t;
typedef SnpeUdo_Value_t Udo_Value_t;
/**
* @brief A struct which defines a scalar parameter : name, data type, and union of values
*
*/
typedef struct
{
/// The parameter data type : float, int, etc.
SnpeUdo_DataType_t dataType;
/// a union of specified type which holds the data
SnpeUdo_Value_t dataValue;
} SnpeUdo_ScalarParam_t;
typedef SnpeUdo_ScalarParam_t Udo_ScalarParam_t;
/**
* @brief A struct which defines the quantization parameters in case of Tensorflow style quantization
*
*/
typedef struct
{
/// minimum value of the quantization range of data
float minValue;
/// maximum value of the quantization range of data
float maxValue;
} SnpeUdo_TFQuantize_t;
typedef SnpeUdo_TFQuantize_t Udo_TFQuantize_t;
/**
* @brief A struct which defines the quantization type, and union of supported quantization structs
*
*/
typedef struct
{
/// quantization type (only TF-style currently supported)
SnpeUdo_QuantizationType_t quantizeType;
union
{
/// TF-style min-max quantization ranges
SnpeUdo_TFQuantize_t TFParams;
};
} SnpeUdo_QuantizeParams_t;
typedef SnpeUdo_QuantizeParams_t Udo_QuantizeParams_t;
/**
* @brief A struct which defines the datatype associated with a specified core-type
* This should be used to denote the datatypes for a single tensor info, depending
* on the intended execution core.
*
*/
typedef struct
{
/// The IP Core
SnpeUdo_CoreType_t coreType;
/// The associated datatype for this coreType
SnpeUdo_DataType_t dataType;
} SnpeUdo_PerCoreDatatype_t;
typedef SnpeUdo_PerCoreDatatype_t Udo_PerCoreDatatype_t;
/**
* @brief A struct which defines a tensor parameter : name, data type, layout, quantization, more.
* Also holds a pointer to the tensor data.
*
*/
typedef struct
{
/// The maximum allowable dimensions of the tensor. The memory held in
/// _tensorData_ is guaranteed to be large enough for this.
uint32_t* maxDimensions;
/// 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.
uint32_t* currDimensions;
/// Quantization params applicable to the tensor. Currently only supports
/// Tensorflow quantization style.
SnpeUdo_QuantizeParams_t quantizeParams;
/// Number of dimensions to the tensor: 3D, 4D, etc.
uint32_t tensorRank;
/// The parameter data type: float, int, etc.
SnpeUdo_DataType_t dataType;
/// The tensor layout type: NCHW, NHWC, etc.
SnpeUdo_TensorLayout_t layout;
/// Opaque pointer to tensor data. User may be required to re-interpret the pointer
/// based on core-specific definitions.
void* tensorData;
} SnpeUdo_TensorParam_t;
typedef SnpeUdo_TensorParam_t Udo_TensorParam_t;
/**
* @brief A struct which defines tensor information for activation tensors only
*
* It describes an activation tensor object using its name, the intended layout and the datatype
* it will take depending on the intended runtime core. The repeated field indicates that
* that the tensor info describes several input/output activation tensors, which all share the
* aforementioned properties.
*/
typedef struct
{
/// The tensor name
SnpeUdo_String_t tensorName;
/// The tensor layout type: NCHW, NHWC, etc.
SnpeUdo_TensorLayout_t layout;
/// The per core datatype: {SNPE_UDO_DATATYPE, SNPE_UDO_CORE_TYPE}
SnpeUdo_PerCoreDatatype_t* perCoreDatatype;
/// A boolean field indicating that this tensorinfo will be repeated e.x for ops such as Concat or Split
bool repeated;
/// A boolean field indicating whether input is static or not.
bool isStatic;
} SnpeUdo_TensorInfo_t;
typedef SnpeUdo_TensorInfo_t Udo_TensorInfo_t;
/**
* @brief struct which defines a UDO parameter - a union of scalar, tensor and string parameters
*
*/
typedef struct
{
/// Type is scalar or tensor
SnpeUdo_ParamType_t paramType;
/// The param name, for example : "offset", "activation_type"
SnpeUdo_String_t paramName;
union
{
/// scalar param value
SnpeUdo_ScalarParam_t scalarParam;
/// tensor param value
SnpeUdo_TensorParam_t tensorParam;
/// string param value
SnpeUdo_String_t stringParam;
};
} SnpeUdo_Param_t;
typedef SnpeUdo_Param_t Udo_Param_t;
/**
* @brief A struct which defines Operation information which is specific for IP core (CPU, GPU, DSP ...)
*
*/
typedef struct
{
/// The IP Core
SnpeUdo_CoreType_t udoCoreType;
/// Bitmask, defines supported internal calculation types (like FLOAT_32, etc)
/// Based on SnpeUdo_DataType
SnpeUdo_Bitmask_t operationCalculationTypes;
} SnpeUdo_OpCoreInfo_t;
typedef SnpeUdo_OpCoreInfo_t Udo_OpCoreInfo_t;
/**
* @brief A struct which defines the common and core-specific Operation information
*
*/
typedef struct
{
/// Operation type
SnpeUdo_String_t operationType;
/// A bitmask describing which IP Cores (CPU, GPU, DSP ...) support this operation
/// Translated based on SnpeUdo_CoreType
SnpeUdo_Bitmask_t supportedByCores;
/// Number of static parameters defined by the op
uint32_t numOfStaticParams;
/// Array of static parameters. Can be scalar or tensor params
SnpeUdo_Param_t* staticParams;
/// Number of input tensors this op receives
uint32_t numOfInputs;
/// Array of input tensor names to this operation
SnpeUdo_String_t* inputNames;
/// Number of output tensors this op receives
uint32_t numOfOutputs;
/// Array of output tensor names to this operation
SnpeUdo_String_t* outputNames;
/// Number of cores that the op can execute on
uint32_t numOfCoreInfo;
/// Array of per-core information entries
SnpeUdo_OpCoreInfo_t* opPerCoreInfo;
/// Array of input tensor infos for this operation
SnpeUdo_TensorInfo_t* inputInfos;
/// Array of output tensor infos for this operation
SnpeUdo_TensorInfo_t* outputInfos;
} SnpeUdo_OperationInfo_t;
typedef SnpeUdo_OperationInfo_t Udo_OperationInfo_t;
/**
* @brief A struct which provides the implementation library info : type, name
*
*/
typedef struct
{
/// Defines the IP Core that this implementation library is targeting
SnpeUdo_CoreType_t udoCoreType;
/// library name. will be looked at in the standard library path
SnpeUdo_String_t libraryName;
} SnpeUdo_LibraryInfo_t;
typedef SnpeUdo_LibraryInfo_t Udo_LibraryInfo_t;
/**
* @brief A struct returned by the registration library and contains information on the UDO package :
* name, operations, libraries, etc.
*
*/
typedef struct
{
/// A string containing the package name
SnpeUdo_String_t packageName;
/// A bitmask describing supported IP cores (CPU, GPU, DSP ...)
/// Translated based on SnpeUdo_CoreType
SnpeUdo_Bitmask_t supportedCoreTypes;
/// The number of implementation libraries in the package
uint32_t numOfImplementationLib;
/// Array of implementation libraries names/types
SnpeUdo_LibraryInfo_t* implementationLib;
/// A string containing all operation types separated by space
SnpeUdo_String_t operationsString;
/// Number of supported operations
uint32_t numOfOperations;
/// Array of Operation info structs. Each entry describes one
/// Operation (name, params, inputs, outputs)
SnpeUdo_OperationInfo_t* operationsInfo;
} SnpeUdo_RegInfo_t;
typedef SnpeUdo_RegInfo_t Udo_RegInfo_t;
/**
* @brief A struct returned by the implementation library and contains information on the
* specific library: name, IP Core, operations, etc.
*
*/
typedef struct
{
/// Defines the IP Core that this implementation library is targeting
SnpeUdo_CoreType_t udoCoreType;
/// A string containing the package name
SnpeUdo_String_t packageName;
/// A string containing all operation types separated by space
SnpeUdo_String_t operationsString;
/// Number of supported operations
uint32_t numOfOperations;
} SnpeUdo_ImpInfo_t;
typedef SnpeUdo_ImpInfo_t Udo_ImpInfo_t;
/**
* @brief This struct defines an operation. It is used for validation
* or creation of an operation.
* In case of using it for creation, the static params which are tensors
* contain pointers to the real data (weights, for example), and input/output
* tensors also include pointers to the buffers used.
*/
typedef struct
{
/// The IP Core that the operation is defined for - CPU, GPU, DSP...
SnpeUdo_CoreType_t udoCoreType;
/// Operation type
SnpeUdo_String_t operationType;
/// The number of static parameters provided in the staticParams array.
/// this number has to match the number provided by the UDO Registration library information
uint32_t numOfStaticParams;
/// Array of static parameters
SnpeUdo_Param_t* staticParams;
/// 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 numOfInputs;
/// Array of input tensors, providing layout, data type, sizes, etc
/// When used to create an operation, also contains the initial location of the data
SnpeUdo_TensorParam_t* inputs;
/// 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 numOfOutputs;
/// 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_TensorParam_t* outputs;
} SnpeUdo_OpDefinition_t;
typedef SnpeUdo_OpDefinition_t Udo_OpDefinition_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif //SNPE_UDO_BASE_H

View File

@@ -0,0 +1,343 @@
//==============================================================================
//
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef SNPE_UDO_IMPL_H
#define SNPE_UDO_IMPL_H
#include <stdbool.h>
#include "SnpeUdo/UdoShared.h"
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup c_plus_plus_apis C++
@{ */
typedef struct _SnpeUdo_OpFactory_t* SnpeUdo_OpFactory_t;
typedef struct _SnpeUdo_Operation_t* SnpeUdo_Operation_t;
typedef SnpeUdo_OpFactory_t Udo_OpFactory_t;
typedef SnpeUdo_Operation_t Udo_Operation_t;
/**
* @brief Initialize the shared library's data structures. Calling any other
* library function before this one will result in error.
*
* @param[in] globalInfrastructure Global core-specific infrastructure to be
* used by operations created in this library. The definition and
* semantics of this object will be defined in the corresponding
* implementation header for the core type.
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_initImplLibrary(void* globalInfrastructure);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_InitImplLibraryFunction_t)(void*);
/**
* @brief 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.
*
* @param[in, out] version A pointer to struct which contains major, minor, teeny information for
* library and api versions.
*
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_getImplVersion(SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_getImplVersion_t)(SnpeUdo_LibVersion_t** version);
/**
* @brief 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.
*
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_terminateImplLibrary(void);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_TerminateImplLibraryFunction_t)(void);
/**
* @brief 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
*
* @param[in, out] implementationInfo A pointer to struct which contains information
* on the operations
*
* @return error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_getImpInfo(SnpeUdo_ImpInfo_t** implementationInfo);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_GetImpInfoFunction_t)(SnpeUdo_ImpInfo_t** implementationInfo);
typedef SnpeUdo_GetImpInfoFunction_t Udo_GetImpInfoFunction_t;
/**
* @brief A function to create an operation factory.
* The function receives the operation type, and an array of static parameters,
* and returns operation factory handler
*
* @param[in] udoCoreType The Core type to create the operation on. An error will
* be returned if this does not match the core type of the library.
*
* @param[in] perFactoryInfrastructure CreateOpFactory infrastructure appropriate to this
* core type. The definition and semantics of this object will be defined
* in the corresponding implementation header for the core type.
*
* @param[in] operationType A string containing Operation type. for example "MY_CONV"
*
* @param[in] numOfStaticParams The number of static parameters.
*
* @param[in] staticParams Array of static parameters
*
* @param[in,out] opFactory Handler to Operation Factory, to be used when creating operations
*
* @return Error Code
*/
SnpeUdo_ErrorType_t
SnpeUdo_createOpFactory(SnpeUdo_CoreType_t udoCoreType,
void* perFactoryInfrastructure,
SnpeUdo_String_t operationType,
uint32_t numOfStaticParams,
SnpeUdo_Param_t* staticParams,
SnpeUdo_OpFactory_t* opFactory);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_CreateOpFactoryFunction_t)(SnpeUdo_CoreType_t,
void*,
SnpeUdo_String_t,
uint32_t,
SnpeUdo_Param_t*,
SnpeUdo_OpFactory_t*);
typedef SnpeUdo_CreateOpFactoryFunction_t Udo_CreateOpFactoryFunction_t;
/**
* @brief A function to release the resources allocated for an operation factory
* created by this library.
*
* @param[in] factory The operation factory to release. Upon success this handle will be invalidated.
*
* @return Error Code
*/
SnpeUdo_ErrorType_t
SnpeUdo_releaseOpFactory(SnpeUdo_OpFactory_t opFactory);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ReleaseOpFactoryFunction_t)(SnpeUdo_OpFactory_t);
typedef SnpeUdo_ReleaseOpFactoryFunction_t Udo_ReleaseOpFactoryFunction_t;
/**
* @brief 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.
*
* @param[in] opFactory OpFactory instance containing the parameters for this operation.
*
* @param[in] perOpInfrastructure Per-Op infrastructure for this operation. The definition
* and semantics of this object will be defined in the implementation header
* appropriate to this core type.
*
* @param[in] numOfInputs The number of input tensors this operation will receive.
*
* @param[in] inputs Array of input tensors, providing both the sizes and initial
* location of the data.
*
* @param[in] numOfOutputs Number of output tensors this operation will produce.
*
* @param[in] outputs Array of output tensors, providing both the sizes and
* initial location of the data.
*
* @param[in,out] operation Handle for newly created operation instance.
*
* @return Error Code
*/
SnpeUdo_ErrorType_t
SnpeUdo_createOperation(SnpeUdo_OpFactory_t opFactory,
void* perOpInfrastructure,
uint32_t numOfInputs,
SnpeUdo_TensorParam_t* inputs,
uint32_t numOfOutputs,
SnpeUdo_TensorParam_t* outputs,
SnpeUdo_Operation_t* operation);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_CreateOperationFunction_t)(SnpeUdo_OpFactory_t,
void*,
uint32_t,
SnpeUdo_TensorParam_t*,
uint32_t,
SnpeUdo_TensorParam_t*,
SnpeUdo_Operation_t*);
typedef SnpeUdo_CreateOperationFunction_t Udo_CreateOperationFunction_t;
/**
* @brief A pointer to notification function.
*
* The notification function supports the non-blocking (e.g. asynchronous) execution use-case.
* In case an "executeUdoOp" function is called with "blocking" set to zero, and a
* notify function, this function will be called by the implementation library at the
* end of execution. The implementation library will pass the notify function the ID
* that was provided to it when "executeUdoOp" was called.
*
* @param[in] ID 32-bit value, that was provided to executeUdoOp by the calling entity.
* Can be used to track the notifications, in case of multiple execute calls issued.
*
* @return Error code
*
*/
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ExternalNotify_t)(const uint32_t ID);
typedef SnpeUdo_ExternalNotify_t Udo_ExternalNotify_t;
/**
* @brief Operation execution function.
*
* Calling this function will run the operation on set of inputs, generating a set of outputs.
* The call can be blocking (synchronous) or non-blocking (asynchronous). To support the
* non-blocking mode, the calling entity can pass an ID and a notification function.
* At the end of the execution this notification function would be called, passing it the ID.
* <b> NOTE: Asynchronous execution mode not supported in this release. </b>
*
* @param[in] operation handle to the operation on which execute is invoked
* @param[in] blocking flag to indicate execution mode.
* If set, execution is blocking,
* e.g SnpeUdo_executeOp call does not return until execution is done.
* If not set, SnpeUdo_executeOp returns immediately, and the
* library will call the notification function (if set) when execution is done.
*
* @param[in] ID 32-bit number that can be used by the calling entity to track execution
* in case of non-blocking execution.
* For example, it can be a sequence number, increased by one on each call.
*
* @param[in] notifyFunc Pointer to notification function. if the pointer is set, and execution is
* non-blocking, the library will call this function at end of execution,
* passing the number provided as ID
*
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_executeOp(SnpeUdo_Operation_t operation,
bool blocking,
const uint32_t ID,
SnpeUdo_ExternalNotify_t notifyFunc);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ExecuteOpFunction_t)(SnpeUdo_Operation_t,
bool,
const uint32_t,
SnpeUdo_ExternalNotify_t);
typedef SnpeUdo_ExecuteOpFunction_t Udo_ExecuteOpFunction_t;
/**
* @brief A function to setting the inputs & outputs. part of SnpeUdo_Operation struct,
* returned from creation of a new operation instance.
* <b> Not supported in this release. </b>
*
* 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 <b> pointer </b> to the tensor data only.
* Any other change may be rejected by the implementation library, causing
* immediate invalidation of the operation instance
*
* @param[in] operation Operation on which IO tensors are set
*
* @param[in] inputs array of tensor parameters. The calling entity may provide a subset of the
* operation inputs, providing only those that it wants to change.
*
* @param[in] outputs array of tensor parameters. The calling entity may provide a subset of the
* operation outputs, providing only those that it wants to change.
*
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_setOpIO(SnpeUdo_Operation_t operation,
SnpeUdo_TensorParam_t* inputs,
SnpeUdo_TensorParam_t* outputs);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_SetOpIOFunction_t)(SnpeUdo_Operation_t,
SnpeUdo_TensorParam_t*,
SnpeUdo_TensorParam_t*);
typedef SnpeUdo_SetOpIOFunction_t Udo_SetOpIOFunction_t;
/**
* @brief 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
*
* @param[in] operation Handle to operation whose execution time is being profiled
*
* @param[in,out] executionTime pointer to a uint32 value.This function writes the operation
* execution time in usec into this value.
*
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_profileOp(SnpeUdo_Operation_t operation, uint32_t *executionTime);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ProfileOpFunction_t)(SnpeUdo_Operation_t, uint32_t*);
typedef SnpeUdo_ProfileOpFunction_t Udo_ProfileOpFunction_t;
/**
* @brief A function to release the operation instance
* \n When it is called, the implementation library needs to release all resources
* allocated for this operation instance.
* \n Note that all function pointers which are part of SnpeUdo_Operation become
* <b> invalid </b> once releaseUdoOp call returns.
*
* @param[in] operation Handle to operation to be released
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_releaseOp(SnpeUdo_Operation_t operation);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ReleaseOpFunction_t)(SnpeUdo_Operation_t);
typedef SnpeUdo_ReleaseOpFunction_t Udo_ReleaseOpFunction_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#ifdef __cplusplus
} // extern "C"
#endif
#endif //SNPE_UDO_IMPL_H

View File

@@ -0,0 +1,44 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
// Header to be used by a CPU UDO Implementation library
#ifndef SNPE_UDO_IMPL_CPU_H
#define SNPE_UDO_IMPL_CPU_H
#include <stdio.h>
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief This struct provides the infrastructure needed by a developer of
* CPU UDO Implementation library.
*
* 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
*
* @param getData function pointer to retrieve raw tensor data from opaque pointer
* passed into the UDO when creating an instance.
* @param getDataSize function pointer to retrieve tensor data size from opaque pointer
*/
typedef struct
{
/// function pointer to retrieve raw tensor data from opaque pointer
/// passed into the UDO when creating an instance.
float* (*getData)(void*);
/// function pointer to retrieve tensor data size from opaque pointer
size_t (*getDataSize) (void*);
} SnpeUdo_CpuInfrastructure_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // SNPE_UDO_IMPL_CPU_H

View File

@@ -0,0 +1,207 @@
//==============================================================================
//
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
//==============================================================================
/*
* THIS HEADER FILE IS COPIED FROM HEXAGON-NN PROJECT
*
*/
//==============================================================================
// Header to be used by a DSP Hexnn UDO Implementation library
#ifndef SNPE_UDO_IMPL_DSP_H
#define SNPE_UDO_IMPL_DSP_H
#include <stdio.h>
#include "SnpeUdo/UdoImpl.h"
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief 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.
*
* @param[in] operationType Operation type
* @param[in] numOfStaticParams Number of static params defined by the op
* @param[in] staticParams Array of static params to the op
* @return Error code, indicating if the operation can be created on this set of configuration or not.
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_validateOperation (SnpeUdo_String_t operationType,
uint32_t numOfStaticParams,
const SnpeUdo_Param_t* staticParams);
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ValidateOperationFunction_t) (SnpeUdo_String_t,
uint32_t,
const SnpeUdo_Param_t*);
typedef SnpeUdo_ValidateOperationFunction_t Udo_ValidateOperationFunction_t;
// enum used for indicating input/outout tensor data layouts on DSP, plain vs d32
typedef enum {
SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00, UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00,
SNPE_UDO_DSP_TENSOR_LAYOUT_D32 = 0x01, UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
} SnpeUdo_HexNNTensorLayout_t;
typedef SnpeUdo_HexNNTensorLayout_t Udo_HexNNTensorLayout_t;
/**
* @brief 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
*
* @param[in] operationType Operation type
* @param[in] numOfStaticParams Number of static params defined by the op
* @param[in] staticParams Array of static params to the op
* @param[in,out] numOfInputs Number of input tensors to the op
* @param[in,out] inputsQuantTypes Array of Quantization info for each input tensor
* @param[in,out] inputsLayouts Array of layout type for each input tensor
* @param[in,out] numOfOutputs Number of output tensors to the op
* @param[in,out] outputsQuantTypes Array of Quantization info for each output tensor
* @param[in,out] outputsLayouts Array of layout type for each output tensor
* @return error code, indicating status of query
*/
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);
typedef SnpeUdo_ErrorType_t (*SnpeUdo_QueryOperationFunction_t) (SnpeUdo_String_t,
uint32_t,
const SnpeUdo_Param_t*,
uint32_t*,
SnpeUdo_QuantizationType_t**,
SnpeUdo_HexNNTensorLayout_t**,
uint32_t*,
SnpeUdo_QuantizationType_t**,
SnpeUdo_HexNNTensorLayout_t**);
typedef SnpeUdo_QueryOperationFunction_t Udo_QueryOperationFunction_t;
// Global infrastructure functions supported by Hexagon-NN v2
typedef void (*workerThread_t) (void* perOpInfrastructure, void* userData);
typedef int (*udoSetOutputTensorSize_t) (void* perOpInfrastructure, uint32_t outIdx, uint32_t size);
typedef int (*udoGetInputD32Paddings_t) (void* perOpInfrastructure, uint32_t inIdx,
uint32_t* heightPadBefore, uint32_t* heightPadAfter,
uint32_t* widthPadBefore, uint32_t* widthPadAfter,
uint32_t* depthPadBefore, uint32_t* depthPadAfter);
typedef int (*udoSetOutputD32ShapeSizePaddings_t) (void* perOpInfrastructure, uint32_t outIdx,
uint32_t batch,
uint32_t height, uint32_t heightPadBefore, uint32_t heightPadAfter,
uint32_t width, uint32_t widthPadBefore, uint32_t widthPadAfter,
uint32_t depth, uint32_t depthPadBefore, uint32_t depthPadAfter,
SnpeUdo_DataType_t dataType);
typedef void* (*udoMemalign_t) (size_t n, size_t size);
typedef void* (*udoMalloc_t) (size_t size);
typedef void* (*udoCalloc_t) (size_t n, size_t size);
typedef void (*udoFree_t) (void* ptr);
typedef uint32_t (*udoGetVtcmSize_t) (void* perOpInfrastructure);
typedef void* (*udoGetVtcmPtr_t) (void* perOpInfrastructure);
typedef uint32_t (*udoVtcmIsReal_t) (void* perOpInfrastructure);
typedef void (*udoRunWorkerThreads_t) (void* perOpInfrastructure, uint32_t nThreads, workerThread_t w, void* userData);
typedef struct hexNNv2GlobalInfra {
udoSetOutputTensorSize_t udoSetOutputTensorSize;
udoGetInputD32Paddings_t udoGetInputD32Paddings;
udoSetOutputD32ShapeSizePaddings_t udoSetOutputD32ShapeSizePaddings;
udoMemalign_t udoMemalign;
udoMalloc_t udoMalloc;
udoCalloc_t udoCalloc;
udoFree_t udoFree;
udoGetVtcmSize_t udoGetVtcmSize;
udoGetVtcmPtr_t udoGetVtcmPtr;
udoVtcmIsReal_t udoVtcmIsReal;
udoRunWorkerThreads_t udoRunWorkerThreads;
} SnpeUdo_HexNNv2GlobalInfra_t;
typedef SnpeUdo_HexNNv2GlobalInfra_t Udo_HexNNv2GlobalInfra_t;
// hexnn types
typedef enum hexnnInfraType {
UDO_INFRA_HEXNN_V2,
UDO_INFRA_HEXNN_V3 // reserved, do not use
} SnpeUdo_HexNNInfraType_t;
typedef SnpeUdo_HexNNInfraType_t Udo_HexNNInfraType_t;
typedef struct {
Udo_CreateOpFactoryFunction_t create_op_factory;
Udo_CreateOperationFunction_t create_operation;
Udo_ExecuteOpFunction_t execute_op;
Udo_ReleaseOpFunction_t release_op;
Udo_ReleaseOpFactoryFunction_t release_op_factory;
Udo_ValidateOperationFunction_t validate_op;
Udo_QueryOperationFunction_t query_op;
} udo_func_package_t;
/**
* @brief Infrastructures needed by a developer of DSP Hexnn UDO Implementation library.
*
* The framework/runtime which loads the Hexnn UDO implementation library provides
* this infrastructure to the loaded library by calling "SnpeUdo_initImplLibrary"
* function, and passing it (cast to void*). The Hexnn UDO library is expected
* to cast it back to this structure.
*
*/
typedef struct dspGlobalInfrastructure {
SnpeUdo_Version_t dspInfraVersion; // api version
SnpeUdo_HexNNInfraType_t infraType;
SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra;
} SnpeUdo_DspGlobalInfrastructure_t;
typedef SnpeUdo_DspGlobalInfrastructure_t Udo_DspGlobalInfrastructure_t;
/**
* hexnn v2 per op factory infrastructure
*
* The framework/runtime passes per op factory infrastructure as a void pointer
* to HexNN UDO implementation library by calling function "SnpeUdo_createOpFactory".
* UDO implementation library is expected to cast it back to this following struct.
*
*/
typedef struct hexnnv2OpFactoryInfra {
unsigned long graphId;
} SnpeUdo_HexNNv2OpFactoryInfra_t;
typedef SnpeUdo_HexNNv2OpFactoryInfra_t Udo_HexNNv2OpFactoryInfra_t;
/**
* hexnn v2 per operation infrastructure
*
* The framework/runtime passes per operation infrastructure as a void pointer
* to HexNN UDO implementation library by calling function "SnpeUdo_createOperation".
* UDO implementation library is expected to cast it to the following type and save it.
*
* This is needed to be passed back into some functions from global infrastructure.
*
*/
typedef void* SnpeUdo_HexNNv2OpInfra_t;
typedef SnpeUdo_HexNNv2OpInfra_t Udo_HexNNv2OpInfra_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // SNPE_UDO_IMPL_DSP_H

View File

@@ -0,0 +1,112 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
// Header to be used by a GPU UDO Implementation library
#ifndef SNPE_UDO_IMPL_GPU_H
#define SNPE_UDO_IMPL_GPU_H
#include "CL/cl.h"
#include "SnpeUdo/UdoBase.h"
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* 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.
*
*/
/**
* @brief Function to retrieve opencl program from Program Cache repository.
* @param programCache is opaque pointer to Program Cache repository provided by
* SNPE GPU UDO runtime.
* @param programName is name associated with opencl program for UDO.
* @param program is pointer to opencl program which will be populated with
* valid opencl program if found in Program Cache repository.
* @return SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned
* on success.
*/
typedef SnpeUdo_ErrorType_t (*SnpeUdo_getProgram_t)
(void* programCache, const char* programName, cl_program* program);
/**
* @brief Function to store valid opencl program in Program Cache repository.
* @param programCache is opaque pointer to Program Cache repository provided by
* SNPE GPU UDO runtime.
* @param programName is name associated with opencl program for UDO.
* @param program is valid opencl program after program is built.
* @return SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned
* on success.
* */
typedef SnpeUdo_ErrorType_t (*SnpeUdo_storeProgram_t)
(void* programCache, const char * programName, cl_program program);
/**
* @brief Global Infrastructure Definition for GPU UDO Implementations.
*/
typedef struct {
// Infrastructure definition version. This header is 0.0.0
SnpeUdo_Version_t gpuInfraVersion;
SnpeUdo_getProgram_t SnpeUdo_getProgram;
SnpeUdo_storeProgram_t SnpeUdo_storeProgram;
} SnpeUdo_GpuInfrastructure_t;
/**
* @brief Per OpFactory Infrastructure Definition for GPU UDO Implementations.
* @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.
*/
typedef struct
{
cl_context context;
cl_command_queue commandQueue;
void* programCache;
} SnpeUdo_GpuOpFactoryInfrastructure_t;
/**
* @brief Opaque tensorData definition for operation inputs and outputs.
*
* 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.
*
*/
typedef struct
{
cl_mem* mem;
uint32_t memCount;
uint32_t paddedRank;
uint32_t* paddedDimensions;
} SnpeUdo_GpuTensorData_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // SNPE_UDO_IMPL_GPU_H

View File

@@ -0,0 +1,108 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef SNPE_UDO_REG_H
#define SNPE_UDO_REG_H
#include "SnpeUdo/UdoShared.h"
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief Initialize the shared library's data structures. Calling any other
* library function before this one will result in an error being returned.
*
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_initRegLibrary(void);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_InitRegLibraryFunction_t)(void);
/**
* @brief 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.
*
* @param[in, out] version A pointer to struct which contains major, minor, teeny information for
* library and api versions.
*
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_getRegLibraryVersion(SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_getRegLibraryVersion_t)(SnpeUdo_LibVersion_t** version);
/**
* @brief 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.
*
* @return Error code
*/
SnpeUdo_ErrorType_t
SnpeUdo_terminateRegLibrary(void);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_TerminateRegLibraryFunction_t)(void);
/**
* @brief 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.
*
* @param[in, out] registrationInfo A struct which contains information on the set of UDOs
*
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_getRegInfo(SnpeUdo_RegInfo_t** registrationInfo);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_GetRegInfoFunction_t)(SnpeUdo_RegInfo_t** registrationInfo);
/**
* @brief 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)
*
* @param[in] opDefinition A struct of SnpeUdo_OpDefinition type, containing the information needed to
* validate that an operation can be created with this configuration.
*
* @return Error code, indicating is the operation can be created on this set or not.
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_validateOperation(SnpeUdo_OpDefinition_t* opDefinition);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ValidateOperationFunction_t)(SnpeUdo_OpDefinition_t* opDefinition);
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#ifdef __cplusplus
} // extern "C"
#endif
#endif //SNPE_UDO_REG_H

View File

@@ -0,0 +1,48 @@
//==============================================================================
//
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef SNPE_UDO_SHARED_H
#define SNPE_UDO_SHARED_H
#include "SnpeUdo/UdoBase.h"
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief 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
*
* @param[in, out] version A pointer to Version struct of type SnpeUdo_LibVersion_t
*
* @return Error code
*
*/
SnpeUdo_ErrorType_t
SnpeUdo_getVersion (SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_GetVersionFunction_t) (SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_GetVersionFunction_t Udo_GetVersionFunction_t;
#ifdef __cplusplus
} // extern "C"
#endif
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // SNPE_UDO_SHARED_H

View File

@@ -1 +0,0 @@
aarch64-ubuntu-gcc7.5