Update SNPE to 1.61.0.3358 (#24253)

* update snpe to snpe-1.61.0.3358

* fix new snpe build

* fix snpe dir in files_tici

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 40cf4a7498686665cde255841f139bdfb1351566
This commit is contained in:
George Hotz
2022-04-18 19:31:10 -07:00
committed by GitHub
parent 6dde52671b
commit 7921b2d197
45 changed files with 750 additions and 235 deletions

View File

@@ -1,5 +1,5 @@
third_party/snpe/larch64**
third_party/snpe/aarch64-linux-gcc4.9/*
third_party/snpe/aarch64-ubuntu-gcc7.5/*
third_party/mapbox-gl-native-qt/include/*
selfdrive/timezoned.py

View File

@@ -4,7 +4,7 @@ Import('env', 'arch', 'cereal', 'messaging', 'common', 'gpucommon', 'visionipc')
lenv = env.Clone()
libs = [cereal, messaging, common, visionipc, gpucommon,
'OpenCL', 'SNPE', 'symphony-cpu', 'capnp', 'zmq', 'kj', 'yuv']
'OpenCL', 'SNPE', 'capnp', 'zmq', 'kj', 'yuv']
def get_dlsym_offset():
"""Returns the offset between dlopen and dlsym in libdl.so"""
@@ -57,7 +57,6 @@ else:
# no SNPE on Mac
del libs[libs.index('SNPE')]
del libs[libs.index('symphony-cpu')]
del common_src[common_src.index('runners/snpemodel.cc')]
common_model = lenv.Object(common_src)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2014-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2014-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -76,6 +76,8 @@ enum class RuntimeCheckOption_t
NORMAL_CHECK = 0,
/// Perform basic runtime available check, may be runtime specific
BASIC_CHECK = 1,
/// Perform unsignedPD runtime available check
UNSIGNEDPD_CHECK = 2,
};
/**
@@ -196,6 +198,36 @@ enum class ImageEncoding_t
BGR = 6
};
/**
* Enumeration that lists the supported LogLevels that can be set by users.
*/
enum class LogLevel_t
{
/// Enumeration variable to be used by user to set logging level to FATAL.
LOG_FATAL = 0,
/// Enumeration variable to be used by user to set logging level to ERROR.
LOG_ERROR = 1,
/// Enumeration variable to be used by user to set logging level to WARN.
LOG_WARN = 2,
/// Enumeration variable to be used by user to set logging level to INFO.
LOG_INFO = 3,
/// Enumeration variable to be used by user to set logging level to VERBOSE.
LOG_VERBOSE = 4
};
typedef enum : int
{
UNSPECIFIED = 0,
FLOATING_POINT_32 = 1,
FLOATING_POINT_16 = 2,
FIXED_POINT_8 = 3,
FIXED_POINT_16 = 4
} IOBufferDataType_t;
}} // namespaces end

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2016-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -59,6 +59,7 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
SNPE_DLSYSTEM_BUFFER_CAST_FAILED = 216,
SNPE_DLSYSTEM_WRONG_TRANSITION_TYPE = 217,
SNPE_DLSYSTEM_LAYER_ALREADY_REGISTERED = 218,
SNPE_DLSYSTEM_TENSOR_DIM_INVALID = 219,
SNPE_DLSYSTEM_BUFFERENCODING_UNKNOWN = 240,
SNPE_DLSYSTEM_BUFFER_INVALID_PARAM = 241,
@@ -89,6 +90,7 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
SNPE_NETWORK_MISMATCH_BETWEEN_NAMES_AND_DIMS = 404,
SNPE_NETWORK_MISSING_INPUT_NAMES = 405,
SNPE_NETWORK_MISSING_OUTPUT_NAMES = 406,
SNPE_NETWORK_EXECUTION_FAILED = 407,
// Host runtime errors
SNPE_HOST_RUNTIME_TARGET_UNAVAILABLE = 500,
@@ -140,6 +142,13 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
SNPE_DSP_RUNTIME_INVALID_PARAM_ERROR = 909,
SNPE_DSP_RUNTIME_SYSTEM_ERROR = 910,
SNPE_DSP_RUNTIME_CRASHED_ERROR = 911,
SNPE_DSP_BUFFER_SIZE_ERROR = 912,
SNPE_DSP_UDO_EXECUTE_ERROR = 913,
SNPE_DSP_UDO_LIB_NOT_REGISTERED_ERROR = 914,
SNPE_DSP_UDO_INVALID_QUANTIZATION_TYPE_ERROR = 915,
SNPE_DSP_RUNTIME_INVALID_RPC_DRIVER = 916,
SNPE_DSP_RUNTIME_RPC_PERMISSION_ERROR = 917,
SNPE_DSP_RUNTIME_DSP_FILE_OPEN_ERROR = 918,
// Model validataion errors
SNPE_MODEL_VALIDATION_LAYER_NOT_SUPPORTED = 1000,
@@ -196,7 +205,10 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
// Infrastructure Errors
SNPE_INFRA_CLUSTERMGR_INSTANCE_INVALID = 1600,
SNPE_INFRA_CLUSTERMGR_EXECUTE_SYNC_FAILED = 1601
SNPE_INFRA_CLUSTERMGR_EXECUTE_SYNC_FAILED = 1601,
// Memory Errors
SNPE_MEMORY_CORRUPTION_ERROR = 1700
};

View File

@@ -0,0 +1,127 @@
//=============================================================================
//
// Copyright (c) 2021-2022 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP
#define DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP
#include <cstddef>
#include <memory>
#include "DlSystem/DlEnums.hpp"
namespace DlSystem
{
// Forward declaration of IOBufferDataTypeMapImpl implementation.
class IOBufferDataTypeMapImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* The IoBufferDataTypeMap class definition
*/
class ZDL_EXPORT IOBufferDataTypeMap final
{
public:
/**
* @brief .
*
* Creates a new Buffer Data type map
*
*/
IOBufferDataTypeMap();
/**
* @brief Adds a name and the corresponding buffer data type
* to the map
*
* @param[name] name The name of the buffer
* @param[bufferDataType] buffer Data Type of the buffer
*
* @note If a buffer with the same name already exists, no new
* buffer is added.
*/
void add(const char* name, zdl::DlSystem::IOBufferDataType_t bufferDataType);
/**
* @brief Removes a buffer name from the map
*
* @param[name] name The name of the buffer
*
*/
void remove(const char* name);
/**
* @brief Returns the type of the named buffer
*
* @param[name] name The name of the buffer
*
* @return The type of the buffer, or UNSPECIFIED if the buffer does not exist
*
*/
zdl::DlSystem::IOBufferDataType_t getBufferDataType(const char* name);
/**
* @brief Returns the type of the first buffer
*
* @return The type of the first buffer, or UNSPECIFIED if the map is empty.
*
*/
zdl::DlSystem::IOBufferDataType_t getBufferDataType();
/**
* @brief Returns the size of the buffer type map.
*
* @return The size of the map
*
*/
size_t size();
/**
* @brief Checks the existence of the named buffer in the map
*
* @return True if the named buffer exists, false otherwise.
*
*/
bool find(const char* name);
/**
* @brief Resets the map
*
*/
void clear();
/**
* @brief Checks whether the map is empty
*
* @return True if the map is empty, false otherwise.
*
*/
bool empty();
/**
* @brief Destroys the map
*
*/
~IOBufferDataTypeMap();
private:
std::shared_ptr<::DlSystem::IOBufferDataTypeMapImpl> m_IOBufferDataTypeMapImpl;
};
}
}
#endif

View File

@@ -1,6 +1,6 @@
//=============================================================================
//
// Copyright (c) 2016-2017 Qualcomm Technologies, Inc.
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -13,10 +13,10 @@
namespace zdl {
namespace DlSystem {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Base class user concrete UDL implementation.
@@ -32,6 +32,8 @@ namespace DlSystem {
class ZDL_EXPORT IUDL {
public:
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Destructor
@@ -39,6 +41,8 @@ public:
virtual ~IUDL() = default;
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief 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
@@ -66,6 +70,8 @@ public:
size_t outsz, const size_t **outdim, const size_t *outdimsz) = 0;
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief Close the instance. Invoked by the SNPE
* framework to allow the user the opportunity to release any resources
* allocated during setup.
@@ -75,6 +81,8 @@ public:
virtual void close(void *cookie) noexcept = 0;
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief Execute the user defined layer
*
* @param cookie User provided opaque data returned by the SNPE
@@ -89,7 +97,6 @@ public:
*/
virtual bool execute(void *cookie, const float **input, float **output) = 0;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
} // ns DlSystem

View File

@@ -151,101 +151,6 @@ public:
* 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
*/
class ZDL_EXPORT UserBufferEncodingTf8 : public UserBufferEncodingUnsigned8Bit {
public:
UserBufferEncodingTf8() = delete;
UserBufferEncodingTf8(unsigned char stepFor0, float stepSize) :
UserBufferEncodingUnsigned8Bit(ElementType_t::TF8),
m_StepExactly0(stepFor0),
m_QuantizedStepSize(stepSize) {};
UserBufferEncodingTf8(const zdl::DlSystem::UserBufferEncoding &ubEncoding) : UserBufferEncodingUnsigned8Bit(ubEncoding.getElementType()){
const zdl::DlSystem::UserBufferEncodingTf8* ubEncodingTf8
= dynamic_cast <const zdl::DlSystem::UserBufferEncodingTf8*> (&ubEncoding);
if (ubEncodingTf8) {
m_StepExactly0 = ubEncodingTf8->getStepExactly0();
m_QuantizedStepSize = ubEncodingTf8->getQuantizedStepSize();
}
}
/**
* @brief Sets the step value that represents 0
*
* @param[in] stepExactly0 The step value that represents 0
*
*/
void setStepExactly0(const unsigned char stepExactly0) {
m_StepExactly0 = stepExactly0;
}
/**
* @brief Sets the float value that each step represents
*
* @param[in] quantizedStepSize The float value of each step size
*
*/
void setQuantizedStepSize(const float quantizedStepSize) {
m_QuantizedStepSize = quantizedStepSize;
}
/**
* @brief Retrieves the step that represents 0.0
*
* @return Step value
*/
unsigned char getStepExactly0() const {
return m_StepExactly0;
}
/**
* Calculates the minimum floating point value that
* can be represented with this encoding.
*
* @return Minimum representable floating point value
*/
float getMin() const {
return m_QuantizedStepSize * (0 - m_StepExactly0);
}
/**
* Calculates the maximum floating point value that
* can be represented with this encoding.
*
* @return Maximum representable floating point value
*/
float getMax() const {
return m_QuantizedStepSize * (255 - m_StepExactly0);
}
/**
* @brief Retrieves the step size
*
* @return Step size
*/
float getQuantizedStepSize() const {
return m_QuantizedStepSize;
}
private:
unsigned char m_StepExactly0;
float m_QuantizedStepSize;
};
class ZDL_EXPORT UserBufferEncodingTfN : public UserBufferEncoding {
public:
UserBufferEncodingTfN() = delete;
@@ -327,12 +232,44 @@ public:
ElementType_t getTypeFromWidth(uint8_t width);
uint8_t bitWidth;
private:
protected:
uint64_t m_StepExactly0;
float m_QuantizedStepSize;
};
class ZDL_EXPORT UserBufferEncodingTf8 : public UserBufferEncodingTfN {
public:
UserBufferEncodingTf8() = delete;
UserBufferEncodingTf8(unsigned char stepFor0, float stepSize) :
UserBufferEncodingTfN(stepFor0, stepSize) {};
UserBufferEncodingTf8(const zdl::DlSystem::UserBufferEncoding &ubEncoding) : UserBufferEncodingTfN(ubEncoding){}
/**
* @brief Sets the step value that represents 0
*
* @param[in] stepExactly0 The step value that represents 0
*
*/
void setStepExactly0(const unsigned char stepExactly0) {
UserBufferEncodingTfN::m_StepExactly0 = stepExactly0;
}
/**
* @brief Retrieves the step that represents 0.0
*
* @return Step value
*/
unsigned char getStepExactly0() const {
return UserBufferEncodingTfN::m_StepExactly0;
}
};
/**
* @brief UserBuffer contains a pointer and info on how to walk it and interpret its content.
*/

View File

@@ -1,6 +1,6 @@
//=============================================================================
//
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// Copyright (c) 2017-2018,2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -190,10 +190,37 @@ public:
*/
std::string getPlatformOptions() const { return m_PlatformOptions; }
/**
* @brief Sets the platform options
*
* @param[in] optionName Name of platform options"
* @param[in] value Value of specified optionName
*
* @return If true, add "optionName:value" to platform options if optionName don't exist, otherwise update the
* value of specified optionName.
* If false, the platform options will not be changed.
*/
bool setPlatformOptionValue(const std::string& optionName, const std::string& value);
/**
* @brief Removes the platform options
*
* @param[in] optionName Name of platform options"
* @param[in] value Value of specified optionName
*
* @return If true, removed "optionName:value" to platform options if optionName don't exist, do nothing.
* If false, the platform options will not be changed.
*/
bool removePlatformOptionValue(const std::string& optionName, const std::string& value);
static void SetIsUserGLBuffer(bool isUserGLBuffer);
static bool GetIsUserGLBuffer();
private:
PlatformType_t m_PlatformType;
PlatformConfigInfo m_PlatformConfigInfo;
std::string m_PlatformOptions;
static bool m_IsUserGLBuffer;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2016 Qualcomm Technologies, Inc.
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -15,10 +15,10 @@
#include "ZdlExportDefine.hpp"
namespace zdl { namespace DlSystem {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* UDLContext holds the user defined layer context which
@@ -237,7 +237,6 @@ private:
size_t m_Size = 0;
int32_t m_Id = -1;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
}}

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2015 Qualcomm Technologies, Inc.
// Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -21,9 +21,9 @@ namespace zdl {
}
namespace zdl { namespace DlSystem {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Definition of UDLFactoyFunc, using/typedef and default FactoryFunction
@@ -47,6 +47,8 @@ namespace zdl { namespace DlSystem {
using UDLFactoryFunc = std::function<zdl::DlSystem::IUDL* (void*, const zdl::DlSystem::UDLContext*)>;
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* default UDL factory implementation
@@ -65,6 +67,8 @@ using UDLFactoryFunc = std::function<zdl::DlSystem::IUDL* (void*, const zdl::DlS
inline ZDL_EXPORT zdl::DlSystem::IUDL* DefaultUDLFunc(void*, const zdl::DlSystem::UDLContext*) { return nullptr; }
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Simple struct to bundle 2 elements.
@@ -77,7 +81,6 @@ struct ZDL_EXPORT UDLBundle {
UDLFactoryFunc func = DefaultUDLFunc;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
}}

View File

@@ -0,0 +1,129 @@
//=============================================================================
//
// Copyright (c) 2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <memory>
#include "ZdlExportDefine.hpp"
#include "StringList.hpp"
#ifndef DL_SYSTEM_USER_MEMORY_MAP_HPP
#define DL_SYSTEM_USER_MEMORY_MAP_HPP
namespace DlSystem
{
// Forward declaration of UserMemory map implementation.
class UserMemoryMapImpl;
}
namespace zdl
{
namespace DlSystem
{
class IUserBuffer;
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing the map of UserMemory.
*/
class ZDL_EXPORT UserMemoryMap final
{
public:
/**
* @brief .
*
* Creates a new empty UserMemory map
*/
UserMemoryMap();
/**
* copy constructor.
* @param[in] other object to copy.
*/
UserMemoryMap(const UserMemoryMap& other);
/**
* assignment operator.
*/
UserMemoryMap& operator=(const UserMemoryMap& other);
/**
* @brief Adds a name and the corresponding buffer address
* to the map
*
* @param[in] name The name of the UserMemory
* @param[in] address The pointer to the Buffer Memory
*
* @note If a UserBuffer with the same name already exists, the new
* address would be updated.
*/
void add(const char *name, void *address);
/**
* @brief Removes a mapping of one Buffer address and its name by its name
*
* @param[in] name The name of Memory address to be removed
*
* @note If no UserBuffer with the specified name is found, nothing
* is done.
*/
void remove(const char *name) noexcept;
/**
* @brief Returns the number of User Memory addresses in the map
*/
size_t size() const noexcept;
/**
* @brief .
*
* Removes all User Memory from the map
*/
void clear() noexcept;
/**
* @brief .
*
* Returns the names of all User Memory
*
* @return A list of Buffer names.
*/
zdl::DlSystem::StringList getUserBufferNames() const;
/**
* @brief Returns the no of UserMemory addresses mapped to the buffer
*
* @param[in] name The name of the UserMemory
*
*/
size_t getUserMemoryAddressCount(const char *name) const noexcept;
/**
* @brief Returns address at a specified index corresponding to a UserMemory buffer name
*
* @param[in] name The name of the buffer
* @param[in] index The index in the list of addresses
*
*/
void* getUserMemoryAddressAtIndex(const char *name, uint32_t index) const noexcept;
~UserMemoryMap();
private:
void swap(const UserMemoryMap &other);
std::unique_ptr<::DlSystem::UserMemoryMapImpl> m_UserMemoryMapImpl;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
} // DlSystem namespace
} // zdl namespace
#endif // DL_SYSTEM_TENSOR_MAP_HPP

View File

@@ -1,6 +1,6 @@
// =============================================================================
//
// Copyright (c) 2018-2019 Qualcomm Technologies, Inc.
// Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -10,7 +10,32 @@
#define SNPE_PLATFORMVALIDATOR_HPP
#include "DlSystem/DlEnums.hpp"
#include "DlSystem/DlMacros.hpp"
#include "DlSystem/ZdlExportDefine.hpp"
#define DO_PRAGMA(s) _Pragma(#s)
#define NO_WARNING "-Wunused-variable"
#ifdef __clang__
#define SNPE_DISABLE_WARNINGS(clang_warning,gcc_warning) \
_Pragma("clang diagnostic push") \
DO_PRAGMA(clang diagnostic ignored clang_warning)
#define SNPE_ENABLE_WARNINGS \
_Pragma("clang diagnostic pop")
#elif defined __GNUC__
#define SNPE_DISABLE_WARNINGS(clang_warning,gcc_warning) \
_Pragma("GCC diagnostic push") \
DO_PRAGMA(GCC diagnostic ignored gcc_warning)
#define SNPE_ENABLE_WARNINGS \
_Pragma("GCC diagnostic pop")
#else
#define SNPE_DISABLE_WARNINGS(...)
#define SNPE_ENABLE_WARNINGS
#endif
SNPE_DISABLE_WARNINGS("-Wdelete-non-virtual-dtor","-Wdelete-non-virtual-dtor")
#include <string>
#include <memory>
@@ -34,7 +59,7 @@ namespace zdl
*
*/
class zdl::SNPE::PlatformValidator
class ZDL_EXPORT zdl::SNPE::PlatformValidator
{
public:
/**

View File

@@ -1,6 +1,6 @@
// =============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -54,8 +54,9 @@ struct ZDL_EXPORT OutputAsyncCallbackParam
{
size_t dataIndex;
bool executeStatus;
OutputAsyncCallbackParam(size_t _index,bool _status)
: dataIndex(_index),executeStatus(_status){};
std::string errorMsg;
OutputAsyncCallbackParam(size_t _index,bool _status, const std::string& _errorMsg = std::string())
: dataIndex(_index),executeStatus(_status), errorMsg(_errorMsg){};
};
/**
* @brief A structure representing parameters of callback function of Async Input/Output mode
@@ -65,12 +66,13 @@ struct ZDL_EXPORT InputOutputAsyncCallbackParam
size_t dataIndex;
const ApplicationBufferMap& outputMap;
bool executeStatus;
InputOutputAsyncCallbackParam(size_t _index, const ApplicationBufferMap& output_map,bool _status)
std::string errorMsg;
InputOutputAsyncCallbackParam(size_t _index, const ApplicationBufferMap& output_map,bool _status,
const std::string _ErrorMsg = std::string())
: dataIndex(_index)
, outputMap(output_map)
,executeStatus(_status){
};
, executeStatus(_status)
, errorMsg(_ErrorMsg){};
};
/**
* @brief This callback is called when the output data is ready, only use for Output Async mode
@@ -96,6 +98,7 @@ struct ZDL_EXPORT BuildConfig final
BuildMode buildMode = BuildMode::SERIAL; ///< Specify build in serial mode or parallel mode
zdl::DlContainer::IDlContainer* container;///< The opened container ptr
zdl::DlSystem::StringList outputBufferNames;///< Specify the output layer name
zdl::DlSystem::StringList outputTensors;///< Specify the output layer name
RuntimeConfigList runtimeConfigList;///< The runtime config list for PSNPE, @see RuntimeConfig
size_t inputThreadNumbers = 1;///< Specify the number of threads used in the execution phase to process input data, only used in inputOutputAsync mode
size_t outputThreadNumbers = 1;///< Specify the number of threads used in the execution phase to process output data, only used in inputOutputAsync and outputAsync mode
@@ -106,6 +109,8 @@ struct ZDL_EXPORT BuildConfig final
zdl::DlSystem::ProfilingLevel_t profilingLevel = zdl::DlSystem::ProfilingLevel_t::OFF;///< Specify profiling level for Diaglog
uint64_t encode[2] = {0, 0};
bool enableInitCache = false;
std::string platformOptions;
std::string diaglogOutputDir = "./diaglogs/"; ///< Specify a diaglog output directory to save the generated Diaglog files.
};
/**
* @brief .
@@ -170,6 +175,8 @@ class ZDL_EXPORT PSNPE final
*/
const zdl::DlSystem::TensorShape getInputDimensions() const noexcept;
const zdl::DlSystem::TensorShape getInputDimensions(const char *name) const noexcept;
/**
* @brief Returns attributes of buffers.
*
@@ -180,6 +187,10 @@ class ZDL_EXPORT PSNPE final
const zdl::DlSystem::TensorShape getBufferAttributesDims(const char *name) const noexcept;
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes(const char *name) const noexcept;
bool registerIonBuffers(const zdl::DlSystem::UserMemoryMap& ionBufferMap) const noexcept;
bool deregisterIonBuffers(const zdl::DlSystem::StringList& ionBufferNames) const noexcept;
const char* getLastErrorString();
private:
PSNPE(const PSNPE&) = delete;

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -19,6 +19,7 @@
#include "DlSystem/StringList.hpp"
#include "DlSystem/IUserBuffer.hpp"
#include "DlSystem/UserBufferMap.hpp"
#include "DlSystem/UserMemoryMap.hpp"
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl {
@@ -147,6 +148,21 @@ public:
bool execute(const zdl::DlSystem::UserBufferMap &input,
const zdl::DlSystem::UserBufferMap &output) noexcept;
/**
* @brief Regiter Client ION Buffers
* @param[in] A UserMemoryMap of virtual addresses
*
*/
bool registerIonBuffers(const zdl::DlSystem::UserMemoryMap& ionBufferMap) noexcept;
/**
* @brief Regiter Client ION Buffers
* @param[in] A StringList of ION Buffer names
*
*/
bool deregisterIonBuffers(const zdl::DlSystem::StringList& ionBufferNames) noexcept;
/**
* @brief Returns the version string embedded at model conversion
* time.
@@ -215,8 +231,6 @@ public:
*/
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes(const char *name) const noexcept;
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributesTf8(const char *name) const noexcept;
/**
* @brief .
*

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2017-2019 Qualcomm Technologies, Inc.
// Copyright (c) 2017-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -15,6 +15,7 @@
#include "DlSystem/DlOptional.hpp"
#include "DlSystem/TensorShapeMap.hpp"
#include "DlSystem/PlatformConfig.hpp"
#include "DlSystem/IOBufferDataTypeMap.hpp"
#include "DlSystem/RuntimeList.hpp"
namespace zdl {
@@ -275,6 +276,28 @@ public:
SNPEBuilder& setUnconsumedTensorsAsOutputs(
bool setOutput);
/**
* @brief Execution terminated when exceeding time limit.
* Only valid for dsp runtime currently.
*
* @param[in] timeout Time limit value
*
* @return The current instance of SNPEBuilder.
*/
SNPEBuilder& setTimeOut(
uint64_t timeout);
/**
* @brief Sets the datatype of the buffer.
* Only valid for dsp runtime currently.
*
* @param[in] Map of the buffer names and the datatype that needs to be set.
*
* @return The current instance of SNPEBuilder.
*/
SNPEBuilder& setBufferDataType(const zdl::DlSystem::IOBufferDataTypeMap& dataTypeMap);
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -47,8 +47,6 @@ public:
*
* @param[in] runtime The target runtime to check.
*
* @param[in] option Extent to perform runtime available check.
*
* @return True if the supplied runtime is available; false,
* otherwise.
*/
@@ -122,6 +120,97 @@ public:
* otherwise.
*/
static bool isGLCLInteropSupported();
static const char* getLastError();
/**
* Initializes logging with the specified log level.
* initializeLogging with level, is used on Android platforms
* and after successful initialization, SNPE
* logs are printed in android logcat logs.
*
* It is recommended to initializeLogging before creating any
* SNPE instances, in order to capture information related to
* core initialization. If this is called again after first
* time initialization, subsequent calls are ignored.
* Also, Logging can be re-initialized after a call to
* terminateLogging API by calling initializeLogging again.
*
* A typical usage of Logging life cycle can be
* initializeLogging()
* any other SNPE API like isRuntimeAvailable()
* * setLogLevel() - optional - can be called anytime
* between initializeLogging & terminateLogging
* SNPE instance creation, inference, destroy
* terminateLogging().
*
* Please note, enabling logging can have performance impact.
*
* @param[in] LogLevel_t Log level (LOG_INFO, LOG_WARN, etc.).
*
* @return True if successful, False otherwise.
*/
static bool initializeLogging(const zdl::DlSystem::LogLevel_t& level);
/**
* Initializes logging with the specified log level and log path.
* initializeLogging with level & log path, is used on non Android
* platforms and after successful initialization, SNPE
* logs are printed in std output & into log files created in the
* log path.
*
* It is recommended to initializeLogging before creating any
* SNPE instances, in order to capture information related to
* core initialization. If this is called again after first
* time initialization, subsequent calls are ignored.
* Also, Logging can be re-initialized after a call to
* terminateLogging API by calling initializeLogging again.
*
* A typical usage of Logging life cycle can be
* initializeLogging()
* any other SNPE API like isRuntimeAvailable()
* * setLogLevel() - optional - can be called anytime
* between initializeLogging & terminateLogging
* SNPE instance creation, inference, destroy
* terminateLogging()
*
* Please note, enabling logging can have performance impact
*
* @param[in] LogLevel_t Log level (LOG_INFO, LOG_WARN, etc.).
*
* @param[in] Path of directory to store logs.
* If path is empty, the default path is "./Log".
* For android, the log path is ignored.
*
* @return True if successful, False otherwise.
*/
static bool initializeLogging(const zdl::DlSystem::LogLevel_t& level, const std::string& logPath);
/**
* Updates the current logging level with the specified level.
* setLogLevel is optional, called anytime after initializeLogging
* and before terminateLogging, to update the log level set.
* Log levels can be updated multiple times by calling setLogLevel
* A call to setLogLevel() is ignored if it is made before
* initializeLogging() or after terminateLogging()
*
* @param[in] LogLevel_t Log level (LOG_INFO, LOG_WARN, etc.).
*
* @return True if successful, False otherwise.
*/
static bool setLogLevel(const zdl::DlSystem::LogLevel_t& level);
/**
* Terminates logging.
*
* It is recommended to terminateLogging after initializeLogging
* in order to disable logging information.
* If this is called before initialization or after first time termination,
* calls are ignored.
*
* @return True if successful, False otherwise.
*/
static bool terminateLogging(void);
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -13,7 +13,7 @@
// Provide values to use for API version.
#define API_VERSION_MAJOR 1
#define API_VERSION_MINOR 5
#define API_VERSION_MINOR 6
#define API_VERSION_TEENY 0
/** @addtogroup c_plus_plus_apis C++
@@ -21,10 +21,12 @@
// 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
@@ -41,32 +43,34 @@ typedef char* SnpeUdo_String_t;
typedef enum
{
/// No Error
SNPE_UDO_NO_ERROR = 0,
SNPE_UDO_NO_ERROR = 0, UDO_NO_ERROR = 0,
/// Unsupported value for core type
SNPE_UDO_WRONG_CORE = 1,
SNPE_UDO_WRONG_CORE = 1, UDO_WRONG_CORE = 1,
/// Invalid attribute/argument passed into UDO API
SNPE_UDO_INVALID_ARGUMENT = 2,
SNPE_UDO_INVALID_ARGUMENT = 2, UDO_INVALID_ARGUMENT = 2,
/// Unsupported feature error
SNPE_UDO_UNSUPPORTED_FEATURE = 3,
SNPE_UDO_UNSUPPORTED_FEATURE = 3, UDO_UNSUPPORTED_FEATURE = 3,
/// Error relating to memory allocation
SNPE_UDO_MEM_ALLOC_ERROR = 4,
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,
SNPE_UDO_WRONG_OPERATION = 100, UDO_WRONG_OPERATION = 100,
/// Unsupported value for core type in UDO configuration
SNPE_UDO_WRONG_CORE_TYPE = 101,
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,
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,
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,
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,
SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106,
SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF
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
@@ -77,32 +81,34 @@ typedef enum
typedef enum
{
/// data type: 16-bit floating point
SNPE_UDO_DATATYPE_FLOAT_16 = 0x01,
SNPE_UDO_DATATYPE_FLOAT_16 = 0x01, UDO_DATATYPE_FLOAT_16 = 0x01,
/// data type: 32-bit floating point
SNPE_UDO_DATATYPE_FLOAT_32 = 0x02,
SNPE_UDO_DATATYPE_FLOAT_32 = 0x02, UDO_DATATYPE_FLOAT_32 = 0x02,
/// data type: 4-bit fixed point
SNPE_UDO_DATATYPE_FIXED_4 = 0x04,
SNPE_UDO_DATATYPE_FIXED_4 = 0x04, UDO_DATATYPE_FIXED_4 = 0x04,
/// data type: 8-bit fixed point
SNPE_UDO_DATATYPE_FIXED_8 = 0x08,
SNPE_UDO_DATATYPE_FIXED_8 = 0x08, UDO_DATATYPE_FIXED_8 = 0x08,
/// data type: 16-bit fixed point
SNPE_UDO_DATATYPE_FIXED_16 = 0x10,
SNPE_UDO_DATATYPE_FIXED_16 = 0x10, UDO_DATATYPE_FIXED_16 = 0x10,
/// data type: 32-bit fixed point
SNPE_UDO_DATATYPE_FIXED_32 = 0x20,
SNPE_UDO_DATATYPE_FIXED_32 = 0x20, UDO_DATATYPE_FIXED_32 = 0x20,
/// data type: 8-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_8 = 0x100,
SNPE_UDO_DATATYPE_UINT_8 = 0x100, UDO_DATATYPE_UINT_8 = 0x100,
/// data type: 16-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_16 = 0x200,
SNPE_UDO_DATATYPE_UINT_16 = 0x200, UDO_DATATYPE_UINT_16 = 0x200,
/// data type: 32-bit unsigned integer
SNPE_UDO_DATATYPE_UINT_32 = 0x400,
SNPE_UDO_DATATYPE_UINT_32 = 0x400, UDO_DATATYPE_UINT_32 = 0x400,
/// data type: 8-bit signed integer
SNPE_UDO_DATATYPE_INT_8 = 0x1000,
SNPE_UDO_DATATYPE_INT_8 = 0x1000, UDO_DATATYPE_INT_8 = 0x1000,
/// data type: 16-bit signed integer
SNPE_UDO_DATATYPE_INT_16 = 0x2000,
SNPE_UDO_DATATYPE_INT_16 = 0x2000, UDO_DATATYPE_INT_16 = 0x2000,
/// data type: 32-bit signed integer
SNPE_UDO_DATATYPE_INT_32 = 0x4000,
SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF
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
@@ -111,21 +117,23 @@ typedef enum
typedef enum
{
/// data layout (4D): NHWC (batch-height-width-channel)
SNPE_UDO_LAYOUT_NHWC = 0x01,
SNPE_UDO_LAYOUT_NHWC = 0x01, UDO_LAYOUT_NHWC = 0x01,
/// data layout (4D): NCHW (batch-channel-height-width)
SNPE_UDO_LAYOUT_NCHW = 0x02,
SNPE_UDO_LAYOUT_NCHW = 0x02, UDO_LAYOUT_NCHW = 0x02,
/// data layout (5D): NDHWC (batch-dimension-height-width-channel)
SNPE_UDO_LAYOUT_NDHWC = 0x04,
SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08,
SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10,
SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11,
SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12,
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,
SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF
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
@@ -134,43 +142,49 @@ typedef enum
typedef enum
{
/// Library target IP Core is undefined
SNPE_UDO_CORETYPE_UNDEFINED = 0x00,
SNPE_UDO_CORETYPE_UNDEFINED = 0x00, UDO_CORETYPE_UNDEFINED = 0x00,
/// Library target IP Core is CPU
SNPE_UDO_CORETYPE_CPU = 0x01,
SNPE_UDO_CORETYPE_CPU = 0x01, UDO_CORETYPE_CPU = 0x01,
/// Library target IP Core is GPU
SNPE_UDO_CORETYPE_GPU = 0x02,
SNPE_UDO_CORETYPE_GPU = 0x02, UDO_CORETYPE_GPU = 0x02,
/// Library target IP Core is DSP
SNPE_UDO_CORETYPE_DSP = 0x04,
SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF
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,
SNPE_UDO_PARAMTYPE_SCALAR = 0x00, UDO_PARAMTYPE_SCALAR = 0x00,
/// UDO static param type: string
SNPE_UDO_PARAMTYPE_STRING,
SNPE_UDO_PARAMTYPE_STRING = 0x01, UDO_PARAMTYPE_STRING = 0x01,
/// UDO static param type: tensor
SNPE_UDO_PARAMTYPE_TENSOR,
SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF
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,
SNPE_UDO_QUANTIZATION_NONE = 0x00, UDO_QUANTIZATION_NONE = 0x00,
/// Tensor Quantization type: Tensorflow-style
SNPE_UDO_QUANTIZATION_TF,
SNPE_UDO_QUANTIZATION_QMN,
SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF
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
*
@@ -185,6 +199,8 @@ typedef struct
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
*
@@ -197,6 +213,16 @@ typedef struct
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.
@@ -220,6 +246,8 @@ typedef union
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
*
@@ -232,6 +260,8 @@ typedef struct
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
*
@@ -244,6 +274,8 @@ typedef struct
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
*
@@ -259,6 +291,8 @@ typedef struct
};
} 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
@@ -273,6 +307,8 @@ typedef struct
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.
@@ -303,6 +339,8 @@ typedef struct
void* tensorData;
} SnpeUdo_TensorParam_t;
typedef SnpeUdo_TensorParam_t Udo_TensorParam_t;
/**
* @brief A struct which defines tensor information for activation tensors only
*
@@ -321,9 +359,11 @@ typedef struct
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
@@ -346,6 +386,8 @@ typedef struct
};
} 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 ...)
*
@@ -359,6 +401,8 @@ typedef struct
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
*
@@ -392,6 +436,8 @@ typedef struct
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
*
@@ -404,6 +450,8 @@ typedef struct
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.
@@ -429,6 +477,8 @@ typedef struct
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.
@@ -446,6 +496,8 @@ typedef struct
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.
@@ -478,6 +530,8 @@ typedef struct
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

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -24,6 +24,9 @@ extern "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.
@@ -92,6 +95,8 @@ 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,
@@ -130,6 +135,7 @@ typedef SnpeUdo_ErrorType_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
@@ -145,6 +151,8 @@ 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
@@ -188,6 +196,8 @@ typedef SnpeUdo_ErrorType_t
SnpeUdo_TensorParam_t*,
SnpeUdo_Operation_t*);
typedef SnpeUdo_CreateOperationFunction_t Udo_CreateOperationFunction_t;
/**
* @brief A pointer to notification function.
*
@@ -206,6 +216,8 @@ typedef SnpeUdo_ErrorType_t
typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ExternalNotify_t)(const uint32_t ID);
typedef SnpeUdo_ExternalNotify_t Udo_ExternalNotify_t;
/**
* @brief Operation execution function.
*
@@ -245,6 +257,8 @@ typedef SnpeUdo_ErrorType_t
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.
@@ -277,6 +291,8 @@ typedef SnpeUdo_ErrorType_t
SnpeUdo_TensorParam_t*,
SnpeUdo_TensorParam_t*);
typedef SnpeUdo_SetOpIOFunction_t Udo_SetOpIOFunction_t;
/**
* @brief A function to return execution times.
*
@@ -297,6 +313,8 @@ 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
@@ -314,6 +332,8 @@ 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

View File

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -45,13 +45,16 @@ typedef SnpeUdo_ErrorType_t (*SnpeUdo_ValidateOperationFunction_t) (SnpeUdo_Stri
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,
SNPE_UDO_DSP_TENSOR_LAYOUT_D32
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,
@@ -96,7 +99,7 @@ typedef SnpeUdo_ErrorType_t (*SnpeUdo_QueryOperationFunction_t) (SnpeUdo_String_
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);
@@ -134,12 +137,25 @@ typedef struct hexNNv2GlobalInfra {
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.
@@ -156,6 +172,7 @@ typedef struct dspGlobalInfrastructure {
SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra;
} SnpeUdo_DspGlobalInfrastructure_t;
typedef SnpeUdo_DspGlobalInfrastructure_t Udo_DspGlobalInfrastructure_t;
/**
* hexnn v2 per op factory infrastructure
@@ -169,6 +186,7 @@ typedef struct hexnnv2OpFactoryInfra {
unsigned long graphId;
} SnpeUdo_HexNNv2OpFactoryInfra_t;
typedef SnpeUdo_HexNNv2OpFactoryInfra_t Udo_HexNNv2OpFactoryInfra_t;
/**
* hexnn v2 per operation infrastructure
@@ -182,6 +200,8 @@ typedef struct hexnnv2OpFactoryInfra {
*/
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

@@ -1,6 +1,6 @@
//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
@@ -37,6 +37,8 @@ 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

View File

@@ -1 +1 @@
aarch64-linux-gcc4.9
aarch64-ubuntu-gcc7.5

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.