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: 40cf4a7498
taco
George Hotz 3 years ago committed by GitHub
parent 6dde52671b
commit 7921b2d197
  1. 2
      release/files_tici
  2. 3
      selfdrive/modeld/SConscript
  3. 3
      third_party/snpe/aarch64-linux-gcc4.9/libPlatformValidatorShared.so
  4. 3
      third_party/snpe/aarch64-linux-gcc4.9/libSNPE.so
  5. 3
      third_party/snpe/aarch64-linux-gcc4.9/libatomic.so.1
  6. 3
      third_party/snpe/aarch64-linux-gcc4.9/libcalculator.so
  7. 3
      third_party/snpe/aarch64-linux-gcc4.9/libcalculator_domains.so
  8. 3
      third_party/snpe/aarch64-linux-gcc4.9/libsnpe_adsp.so
  9. 3
      third_party/snpe/aarch64-linux-gcc4.9/libsnpe_dsp_domains_v2.so
  10. 3
      third_party/snpe/aarch64-linux-gcc4.9/libsymphony-cpu.so
  11. 3
      third_party/snpe/aarch64-ubuntu-gcc7.5/libPlatformValidatorShared.so
  12. 3
      third_party/snpe/aarch64-ubuntu-gcc7.5/libSNPE.so
  13. 3
      third_party/snpe/aarch64-ubuntu-gcc7.5/libcalculator.so
  14. 3
      third_party/snpe/aarch64-ubuntu-gcc7.5/libhta.so
  15. 3
      third_party/snpe/aarch64-ubuntu-gcc7.5/libsnpe_dsp_domains_v2.so
  16. 3
      third_party/snpe/dsp/libcalculator_domains_skel.so
  17. 4
      third_party/snpe/dsp/libcalculator_skel.so
  18. 3
      third_party/snpe/dsp/libsnpe_dsp_domains_skel.so
  19. 3
      third_party/snpe/dsp/libsnpe_dsp_skel.so
  20. 4
      third_party/snpe/dsp/libsnpe_dsp_v65_domains_v2_skel.so
  21. 4
      third_party/snpe/dsp/libsnpe_dsp_v66_domains_v2_skel.so
  22. 3
      third_party/snpe/dsp/libsnpe_dsp_v68_domains_v3_skel.so
  23. 34
      third_party/snpe/include/DlSystem/DlEnums.hpp
  24. 16
      third_party/snpe/include/DlSystem/DlError.hpp
  25. 127
      third_party/snpe/include/DlSystem/IOBufferDataTypeMap.hpp
  26. 15
      third_party/snpe/include/DlSystem/IUDL.hpp
  27. 129
      third_party/snpe/include/DlSystem/IUserBuffer.hpp
  28. 29
      third_party/snpe/include/DlSystem/PlatformConfig.hpp
  29. 7
      third_party/snpe/include/DlSystem/UDLContext.hpp
  30. 11
      third_party/snpe/include/DlSystem/UDLFunc.hpp
  31. 129
      third_party/snpe/include/DlSystem/UserMemoryMap.hpp
  32. 31
      third_party/snpe/include/PlatformValidator/PlatformValidator.hpp
  33. 25
      third_party/snpe/include/SNPE/PSNPE.hpp
  34. 20
      third_party/snpe/include/SNPE/SNPE.hpp
  35. 25
      third_party/snpe/include/SNPE/SNPEBuilder.hpp
  36. 95
      third_party/snpe/include/SNPE/SNPEFactory.hpp
  37. 156
      third_party/snpe/include/SnpeUdo/UdoBase.h
  38. 22
      third_party/snpe/include/SnpeUdo/UdoImpl.h
  39. 28
      third_party/snpe/include/SnpeUdo/UdoImplDsp.h
  40. 4
      third_party/snpe/include/SnpeUdo/UdoShared.h
  41. 2
      third_party/snpe/larch64
  42. 3
      third_party/snpe/x86_64-linux-clang/libHtpPrepare.so
  43. 4
      third_party/snpe/x86_64-linux-clang/libSNPE.so
  44. 2
      third_party/snpe/x86_64-linux-clang/libomp.so
  45. 3
      third_party/snpe/x86_64-linux-clang/libsymphony-cpu.so

@ -1,5 +1,5 @@
third_party/snpe/larch64** 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/* third_party/mapbox-gl-native-qt/include/*
selfdrive/timezoned.py selfdrive/timezoned.py

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:282c2b7490834ff1daae1f1e567bd9553ee78e7cd532e06f960f5f11a77a2cd5
size 1114072

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47c77da6a5002e3100e7bec4aee72c5ae0f25ba9b3f7cb967b756dde6ee98a13
size 9447816

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0841acd6dc55213906c8532b866e475e494c50635ef379f5986e2323db137c2a
size 123705

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a61ee40b3bfd9099a7fb342228be98f838c170c44ba15f7a3f6d57f6e5685a19
size 12832

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9553e076de8016e8d8b8800f95fc1be8dd342a5455914eb6a136e40a6c01e58b
size 12832

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:14de0b1a5775fb17ac266919523eaf8ddc4cb960ddfe4e34a6505b84c4ad69b6
size 19392

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad7ff523977263e5c89b5299d63990594a2de02435ff309851b6f676ba42a322
size 20192

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c8a1bd8aa6d5977896562b61083b3cd26247d54d52456a2ddf333d010c21685
size 648120

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fb3b1fd29d958e9a3a6625eac9fac9e7cd6eb40309b285ad973324761db0b4c9
size 1202792

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:161a5d0bf7347465b53ae49690a38fbacf03d606ef204147b3b148a5f59188da
size 9008016

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e0e66c12a1eb3b5b4b2b2694831ca51e5132818f400dad789adbcc30e0e0793
size 14032

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:784f2e80fa3534cf7934c5ecbbda37db633104380f2b41d896b4721ad6006eb2
size 2420312

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:33afe465e74bbe2c409350d2ca8e86cfadf050ceb8feac75a86adc19ff1f9c48
size 26016

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c2f2d3bf9fd0562d6d84cf3d004bf5ab19e5e613692f2757468251158f91fa0
size 20828

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:90a36a16943fbb6c1a6e09cefd552878047daa20d1d5cbb8f08e32f67ea721e4 oid sha256:7bee94d38195478ffdd0ce15292a2dfa7813377f4c3b7d99c270e05079d1746b
size 20816 size 20828

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b1a93ade8c97a82e51d5fad809f5b024e0dab013e1a06d05fb57d566204c5648
size 1434132

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:73439783c54e02a66a10280023b9fd6fa0f2f420f57da58b131756da4877739c
size 1431408

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:5fdb14a91986b001cb5b517ec0595411e09a37d60e0bdab2cfbd72b22274eb3e oid sha256:4e040c87072aa915c47859c8c7f74076b98c6919b83ddd5dc4bb555870d586a7
size 1492098 size 1813866

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:868616a42ddaef80b605078ae8864d05635349283527d665fcc5a7639b87a28a oid sha256:838bc58ac0094ba9593cf7c44ab6e8a94ae3dbbe176e320d9fbe86ceead53c5e
size 1492098 size 1817962

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:77d025d59521e13e4ed012f0d9d2b684cdb858208d70426078df51219eaeb9bd
size 10098673

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2014-2020 Qualcomm Technologies, Inc. // Copyright (c) 2014-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -76,6 +76,8 @@ enum class RuntimeCheckOption_t
NORMAL_CHECK = 0, NORMAL_CHECK = 0,
/// Perform basic runtime available check, may be runtime specific /// Perform basic runtime available check, may be runtime specific
BASIC_CHECK = 1, BASIC_CHECK = 1,
/// Perform unsignedPD runtime available check
UNSIGNEDPD_CHECK = 2,
}; };
/** /**
@ -196,6 +198,36 @@ enum class ImageEncoding_t
BGR = 6 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 }} // namespaces end

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2016-2020 Qualcomm Technologies, Inc. // Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // 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_BUFFER_CAST_FAILED = 216,
SNPE_DLSYSTEM_WRONG_TRANSITION_TYPE = 217, SNPE_DLSYSTEM_WRONG_TRANSITION_TYPE = 217,
SNPE_DLSYSTEM_LAYER_ALREADY_REGISTERED = 218, SNPE_DLSYSTEM_LAYER_ALREADY_REGISTERED = 218,
SNPE_DLSYSTEM_TENSOR_DIM_INVALID = 219,
SNPE_DLSYSTEM_BUFFERENCODING_UNKNOWN = 240, SNPE_DLSYSTEM_BUFFERENCODING_UNKNOWN = 240,
SNPE_DLSYSTEM_BUFFER_INVALID_PARAM = 241, 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_MISMATCH_BETWEEN_NAMES_AND_DIMS = 404,
SNPE_NETWORK_MISSING_INPUT_NAMES = 405, SNPE_NETWORK_MISSING_INPUT_NAMES = 405,
SNPE_NETWORK_MISSING_OUTPUT_NAMES = 406, SNPE_NETWORK_MISSING_OUTPUT_NAMES = 406,
SNPE_NETWORK_EXECUTION_FAILED = 407,
// Host runtime errors // Host runtime errors
SNPE_HOST_RUNTIME_TARGET_UNAVAILABLE = 500, 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_INVALID_PARAM_ERROR = 909,
SNPE_DSP_RUNTIME_SYSTEM_ERROR = 910, SNPE_DSP_RUNTIME_SYSTEM_ERROR = 910,
SNPE_DSP_RUNTIME_CRASHED_ERROR = 911, 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 // Model validataion errors
SNPE_MODEL_VALIDATION_LAYER_NOT_SUPPORTED = 1000, SNPE_MODEL_VALIDATION_LAYER_NOT_SUPPORTED = 1000,
@ -196,7 +205,10 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
// Infrastructure Errors // Infrastructure Errors
SNPE_INFRA_CLUSTERMGR_INSTANCE_INVALID = 1600, 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
}; };

@ -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

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

@ -151,101 +151,6 @@ public:
* An encoding type where each element is represented by tf8, which is an * 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 * 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 { class ZDL_EXPORT UserBufferEncodingTfN : public UserBufferEncoding {
public: public:
UserBufferEncodingTfN() = delete; UserBufferEncodingTfN() = delete;
@ -327,12 +232,44 @@ public:
ElementType_t getTypeFromWidth(uint8_t width); ElementType_t getTypeFromWidth(uint8_t width);
uint8_t bitWidth; uint8_t bitWidth;
private: protected:
uint64_t m_StepExactly0; uint64_t m_StepExactly0;
float m_QuantizedStepSize; 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. * @brief UserBuffer contains a pointer and info on how to walk it and interpret its content.
*/ */

@ -1,6 +1,6 @@
//============================================================================= //=============================================================================
// //
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc. // Copyright (c) 2017-2018,2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -190,10 +190,37 @@ public:
*/ */
std::string getPlatformOptions() const { return m_PlatformOptions; } 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: private:
PlatformType_t m_PlatformType; PlatformType_t m_PlatformType;
PlatformConfigInfo m_PlatformConfigInfo; PlatformConfigInfo m_PlatformConfigInfo;
std::string m_PlatformOptions; std::string m_PlatformOptions;
static bool m_IsUserGLBuffer;
}; };
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */

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

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

@ -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

@ -1,6 +1,6 @@
// ============================================================================= // =============================================================================
// //
// Copyright (c) 2018-2019 Qualcomm Technologies, Inc. // Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -10,7 +10,32 @@
#define SNPE_PLATFORMVALIDATOR_HPP #define SNPE_PLATFORMVALIDATOR_HPP
#include "DlSystem/DlEnums.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") SNPE_DISABLE_WARNINGS("-Wdelete-non-virtual-dtor","-Wdelete-non-virtual-dtor")
#include <string> #include <string>
#include <memory> #include <memory>
@ -34,7 +59,7 @@ namespace zdl
* *
*/ */
class zdl::SNPE::PlatformValidator class ZDL_EXPORT zdl::SNPE::PlatformValidator
{ {
public: public:
/** /**

@ -1,6 +1,6 @@
// ============================================================================= // =============================================================================
// //
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc. // Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -54,8 +54,9 @@ struct ZDL_EXPORT OutputAsyncCallbackParam
{ {
size_t dataIndex; size_t dataIndex;
bool executeStatus; bool executeStatus;
OutputAsyncCallbackParam(size_t _index,bool _status) std::string errorMsg;
: dataIndex(_index),executeStatus(_status){}; 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 * @brief A structure representing parameters of callback function of Async Input/Output mode
@ -65,12 +66,13 @@ struct ZDL_EXPORT InputOutputAsyncCallbackParam
size_t dataIndex; size_t dataIndex;
const ApplicationBufferMap& outputMap; const ApplicationBufferMap& outputMap;
bool executeStatus; 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) : dataIndex(_index)
, outputMap(output_map) , 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 * @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 BuildMode buildMode = BuildMode::SERIAL; ///< Specify build in serial mode or parallel mode
zdl::DlContainer::IDlContainer* container;///< The opened container ptr zdl::DlContainer::IDlContainer* container;///< The opened container ptr
zdl::DlSystem::StringList outputBufferNames;///< Specify the output layer name 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 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 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 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 zdl::DlSystem::ProfilingLevel_t profilingLevel = zdl::DlSystem::ProfilingLevel_t::OFF;///< Specify profiling level for Diaglog
uint64_t encode[2] = {0, 0}; uint64_t encode[2] = {0, 0};
bool enableInitCache = false; bool enableInitCache = false;
std::string platformOptions;
std::string diaglogOutputDir = "./diaglogs/"; ///< Specify a diaglog output directory to save the generated Diaglog files.
}; };
/** /**
* @brief . * @brief .
@ -170,6 +175,8 @@ class ZDL_EXPORT PSNPE final
*/ */
const zdl::DlSystem::TensorShape getInputDimensions() const noexcept; const zdl::DlSystem::TensorShape getInputDimensions() const noexcept;
const zdl::DlSystem::TensorShape getInputDimensions(const char *name) const noexcept;
/** /**
* @brief Returns attributes of buffers. * @brief Returns attributes of buffers.
* *
@ -180,6 +187,10 @@ class ZDL_EXPORT PSNPE final
const zdl::DlSystem::TensorShape getBufferAttributesDims(const char *name) const noexcept; const zdl::DlSystem::TensorShape getBufferAttributesDims(const char *name) const noexcept;
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes(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: private:
PSNPE(const PSNPE&) = delete; PSNPE(const PSNPE&) = delete;

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc. // Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -19,6 +19,7 @@
#include "DlSystem/StringList.hpp" #include "DlSystem/StringList.hpp"
#include "DlSystem/IUserBuffer.hpp" #include "DlSystem/IUserBuffer.hpp"
#include "DlSystem/UserBufferMap.hpp" #include "DlSystem/UserBufferMap.hpp"
#include "DlSystem/UserMemoryMap.hpp"
#include "DlSystem/ZdlExportDefine.hpp" #include "DlSystem/ZdlExportDefine.hpp"
namespace zdl { namespace zdl {
@ -147,6 +148,21 @@ public:
bool execute(const zdl::DlSystem::UserBufferMap &input, bool execute(const zdl::DlSystem::UserBufferMap &input,
const zdl::DlSystem::UserBufferMap &output) noexcept; 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 * @brief Returns the version string embedded at model conversion
* time. * time.
@ -215,8 +231,6 @@ public:
*/ */
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes(const char *name) const noexcept; 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 . * @brief .
* *

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2017-2019 Qualcomm Technologies, Inc. // Copyright (c) 2017-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -15,6 +15,7 @@
#include "DlSystem/DlOptional.hpp" #include "DlSystem/DlOptional.hpp"
#include "DlSystem/TensorShapeMap.hpp" #include "DlSystem/TensorShapeMap.hpp"
#include "DlSystem/PlatformConfig.hpp" #include "DlSystem/PlatformConfig.hpp"
#include "DlSystem/IOBufferDataTypeMap.hpp"
#include "DlSystem/RuntimeList.hpp" #include "DlSystem/RuntimeList.hpp"
namespace zdl { namespace zdl {
@ -275,6 +276,28 @@ public:
SNPEBuilder& setUnconsumedTensorsAsOutputs( SNPEBuilder& setUnconsumedTensorsAsOutputs(
bool setOutput); 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++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc. // Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -47,8 +47,6 @@ public:
* *
* @param[in] runtime The target runtime to check. * @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, * @return True if the supplied runtime is available; false,
* otherwise. * otherwise.
*/ */
@ -122,6 +120,97 @@ public:
* otherwise. * otherwise.
*/ */
static bool isGLCLInteropSupported(); 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++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc. // Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -13,7 +13,7 @@
// Provide values to use for API version. // Provide values to use for API version.
#define API_VERSION_MAJOR 1 #define API_VERSION_MAJOR 1
#define API_VERSION_MINOR 5 #define API_VERSION_MINOR 6
#define API_VERSION_TEENY 0 #define API_VERSION_TEENY 0
/** @addtogroup c_plus_plus_apis C++ /** @addtogroup c_plus_plus_apis C++
@ -21,10 +21,12 @@
// Defines a bitmask of enum values. // Defines a bitmask of enum values.
typedef uint32_t SnpeUdo_Bitmask_t; typedef uint32_t SnpeUdo_Bitmask_t;
typedef SnpeUdo_Bitmask_t Udo_Bitmask_t;
// A string of characters, rather than an array of bytes. // A string of characters, rather than an array of bytes.
// Assumed to be UTF-8. // Assumed to be UTF-8.
typedef char* SnpeUdo_String_t; typedef char* SnpeUdo_String_t;
typedef SnpeUdo_String_t Udo_String_t;
// The maximum allowable length of a SnpeUdo_String_t in bytes, // The maximum allowable length of a SnpeUdo_String_t in bytes,
// including null terminator. SNPE will truncate strings longer // including null terminator. SNPE will truncate strings longer
@ -41,32 +43,34 @@ typedef char* SnpeUdo_String_t;
typedef enum typedef enum
{ {
/// No Error /// No Error
SNPE_UDO_NO_ERROR = 0, SNPE_UDO_NO_ERROR = 0, UDO_NO_ERROR = 0,
/// Unsupported value for core type /// 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 /// Invalid attribute/argument passed into UDO API
SNPE_UDO_INVALID_ARGUMENT = 2, SNPE_UDO_INVALID_ARGUMENT = 2, UDO_INVALID_ARGUMENT = 2,
/// Unsupported feature error /// Unsupported feature error
SNPE_UDO_UNSUPPORTED_FEATURE = 3, SNPE_UDO_UNSUPPORTED_FEATURE = 3, UDO_UNSUPPORTED_FEATURE = 3,
/// Error relating to memory allocation /// 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 */ /* Configuration Specific errors */
/// No op with given attributes available in library /// 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 /// 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 /// 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 /// 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 /// 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 /// Wrong number of output tensors in UDO definition
SNPE_UDO_WRONG_NUM_OF_OUTPUTS = 105, SNPE_UDO_WRONG_NUM_OF_OUTPUTS = 105, UDO_WRONG_NUM_OF_OUTPUTS = 105,
SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106, SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106, UDO_PROGRAM_CACHE_NOT_FOUND = 106,
SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF, UDO_UNKNOWN_ERROR = 0xFFFFFFFF
} SnpeUdo_ErrorType_t; } SnpeUdo_ErrorType_t;
typedef SnpeUdo_ErrorType_t Udo_ErrorType_t;
/** /**
* An enum which holds the various data types. * An enum which holds the various data types.
* Designed to be used as single values or combined into a bitfield parameter * Designed to be used as single values or combined into a bitfield parameter
@ -77,32 +81,34 @@ typedef enum
typedef enum typedef enum
{ {
/// data type: 16-bit floating point /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// data type: 32-bit signed integer
SNPE_UDO_DATATYPE_INT_32 = 0x4000, SNPE_UDO_DATATYPE_INT_32 = 0x4000, UDO_DATATYPE_INT_32 = 0x4000,
SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF, UDO_DATATYPE_LAST = 0xFFFFFFFF
} SnpeUdo_DataType_t; } SnpeUdo_DataType_t;
typedef SnpeUdo_DataType_t Udo_DataType_t;
/** /**
* An enum which holds the various layouts. * An enum which holds the various layouts.
* Designed to be used as single values or combined into a bitfield parameter * Designed to be used as single values or combined into a bitfield parameter
@ -111,21 +117,23 @@ typedef enum
typedef enum typedef enum
{ {
/// data layout (4D): NHWC (batch-height-width-channel) /// 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) /// 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) /// data layout (5D): NDHWC (batch-dimension-height-width-channel)
SNPE_UDO_LAYOUT_NDHWC = 0x04, SNPE_UDO_LAYOUT_NDHWC = 0x04, UDO_LAYOUT_NDHWC = 0x04,
SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08, SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08, UDO_LAYOUT_GPU_OPTIMAL1 = 0x08,
SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10, SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10, UDO_LAYOUT_GPU_OPTIMAL2 = 0x10,
SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11, SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11, UDO_LAYOUT_DSP_OPTIMAL1 = 0x11,
SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12, SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12, UDO_LAYOUT_DSP_OPTIMAL2 = 0x12,
// Indicates no data will be allocated for this tensor. // Indicates no data will be allocated for this tensor.
// Used to specify optional inputs/outputs positionally. // Used to specify optional inputs/outputs positionally.
SNPE_UDO_LAYOUT_NULL = 0x13, SNPE_UDO_LAYOUT_NULL = 0x13, UDO_LAYOUT_NULL = 0x13,
SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF, UDO_LAYOUT_LAST = 0xFFFFFFFF
} SnpeUdo_TensorLayout_t; } SnpeUdo_TensorLayout_t;
typedef SnpeUdo_TensorLayout_t Udo_TensorLayout_t;
/** /**
* An enum which holds the UDO library Core type . * An enum which holds the UDO library Core type .
* Designed to be used as single values or combined into a bitfield parameter * Designed to be used as single values or combined into a bitfield parameter
@ -134,43 +142,49 @@ typedef enum
typedef enum typedef enum
{ {
/// Library target IP Core is undefined /// 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 /// 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 /// 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 /// Library target IP Core is DSP
SNPE_UDO_CORETYPE_DSP = 0x04, SNPE_UDO_CORETYPE_DSP = 0x04, UDO_CORETYPE_DSP = 0x04,
SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF, UDO_CORETYPE_LAST = 0xFFFFFFFF
} SnpeUdo_CoreType_t; } SnpeUdo_CoreType_t;
typedef SnpeUdo_CoreType_t Udo_CoreType_t;
/** /**
* An enum to specify the parameter type : Scalar or Tensor * An enum to specify the parameter type : Scalar or Tensor
*/ */
typedef enum typedef enum
{ {
/// UDO static param type: scalar /// UDO static param type: scalar
SNPE_UDO_PARAMTYPE_SCALAR, SNPE_UDO_PARAMTYPE_SCALAR = 0x00, UDO_PARAMTYPE_SCALAR = 0x00,
/// UDO static param type: string /// UDO static param type: string
SNPE_UDO_PARAMTYPE_STRING, SNPE_UDO_PARAMTYPE_STRING = 0x01, UDO_PARAMTYPE_STRING = 0x01,
/// UDO static param type: tensor /// UDO static param type: tensor
SNPE_UDO_PARAMTYPE_TENSOR, SNPE_UDO_PARAMTYPE_TENSOR = 0x02, UDO_PARAMTYPE_TENSOR = 0x02,
SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF, UDO_PARAMTYPE_LAST = 0xFFFFFFFF
} SnpeUdo_ParamType_t; } SnpeUdo_ParamType_t;
typedef SnpeUdo_ParamType_t Udo_ParamType_t;
/** /**
* An enum to specify quantization type * An enum to specify quantization type
*/ */
typedef enum typedef enum
{ {
/// Tensor Quantization type: NONE. Signifies unquantized tensor data /// 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 /// Tensor Quantization type: Tensorflow-style
SNPE_UDO_QUANTIZATION_TF, SNPE_UDO_QUANTIZATION_TF = 0x01, UDO_QUANTIZATION_TF = 0x01,
SNPE_UDO_QUANTIZATION_QMN, SNPE_UDO_QUANTIZATION_QMN = 0x02, UDO_QUANTIZATION_QMN = 0x02,
SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF, UDO_QUANTIZATION_LAST = 0xFFFFFFFF
} SnpeUdo_QuantizationType_t; } 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 * @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; uint32_t teeny;
} SnpeUdo_Version_t; } SnpeUdo_Version_t;
typedef SnpeUdo_Version_t Udo_Version_t;
/** /**
* @brief A struct returned from version query, contains the Library version and API version * @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_Version_t apiVersion;
} SnpeUdo_LibVersion_t; } 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 * @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. * 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; int8_t int8Value;
} SnpeUdo_Value_t; } 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 * @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_Value_t dataValue;
} SnpeUdo_ScalarParam_t; } SnpeUdo_ScalarParam_t;
typedef SnpeUdo_ScalarParam_t Udo_ScalarParam_t;
/** /**
* @brief A struct which defines the quantization parameters in case of Tensorflow style quantization * @brief A struct which defines the quantization parameters in case of Tensorflow style quantization
* *
@ -244,6 +274,8 @@ typedef struct
float maxValue; float maxValue;
} SnpeUdo_TFQuantize_t; } SnpeUdo_TFQuantize_t;
typedef SnpeUdo_TFQuantize_t Udo_TFQuantize_t;
/** /**
* @brief A struct which defines the quantization type, and union of supported quantization structs * @brief A struct which defines the quantization type, and union of supported quantization structs
* *
@ -259,6 +291,8 @@ typedef struct
}; };
} SnpeUdo_QuantizeParams_t; } SnpeUdo_QuantizeParams_t;
typedef SnpeUdo_QuantizeParams_t Udo_QuantizeParams_t;
/** /**
* @brief A struct which defines the datatype associated with a specified core-type * @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 * 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_DataType_t dataType;
} SnpeUdo_PerCoreDatatype_t; } SnpeUdo_PerCoreDatatype_t;
typedef SnpeUdo_PerCoreDatatype_t Udo_PerCoreDatatype_t;
/** /**
* @brief A struct which defines a tensor parameter : name, data type, layout, quantization, more. * @brief A struct which defines a tensor parameter : name, data type, layout, quantization, more.
* Also holds a pointer to the tensor data. * Also holds a pointer to the tensor data.
@ -303,6 +339,8 @@ typedef struct
void* tensorData; void* tensorData;
} SnpeUdo_TensorParam_t; } SnpeUdo_TensorParam_t;
typedef SnpeUdo_TensorParam_t Udo_TensorParam_t;
/** /**
* @brief A struct which defines tensor information for activation tensors only * @brief A struct which defines tensor information for activation tensors only
* *
@ -321,9 +359,11 @@ typedef struct
SnpeUdo_PerCoreDatatype_t* perCoreDatatype; SnpeUdo_PerCoreDatatype_t* perCoreDatatype;
/// A boolean field indicating that this tensorinfo will be repeated e.x for ops such as Concat or Split /// A boolean field indicating that this tensorinfo will be repeated e.x for ops such as Concat or Split
bool repeated; bool repeated;
/// A boolean field indicating whether input is static or not.
bool isStatic;
} SnpeUdo_TensorInfo_t; } 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 * @brief struct which defines a UDO parameter - a union of scalar, tensor and string parameters
@ -346,6 +386,8 @@ typedef struct
}; };
} SnpeUdo_Param_t; } 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 ...) * @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_Bitmask_t operationCalculationTypes;
} SnpeUdo_OpCoreInfo_t; } SnpeUdo_OpCoreInfo_t;
typedef SnpeUdo_OpCoreInfo_t Udo_OpCoreInfo_t;
/** /**
* @brief A struct which defines the common and core-specific Operation information * @brief A struct which defines the common and core-specific Operation information
* *
@ -392,6 +436,8 @@ typedef struct
SnpeUdo_TensorInfo_t* outputInfos; SnpeUdo_TensorInfo_t* outputInfos;
} SnpeUdo_OperationInfo_t; } SnpeUdo_OperationInfo_t;
typedef SnpeUdo_OperationInfo_t Udo_OperationInfo_t;
/** /**
* @brief A struct which provides the implementation library info : type, name * @brief A struct which provides the implementation library info : type, name
* *
@ -404,6 +450,8 @@ typedef struct
SnpeUdo_String_t libraryName; SnpeUdo_String_t libraryName;
} SnpeUdo_LibraryInfo_t; } 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 : * @brief A struct returned by the registration library and contains information on the UDO package :
* name, operations, libraries, etc. * name, operations, libraries, etc.
@ -429,6 +477,8 @@ typedef struct
SnpeUdo_OperationInfo_t* operationsInfo; SnpeUdo_OperationInfo_t* operationsInfo;
} SnpeUdo_RegInfo_t; } SnpeUdo_RegInfo_t;
typedef SnpeUdo_RegInfo_t Udo_RegInfo_t;
/** /**
* @brief A struct returned by the implementation library and contains information on the * @brief A struct returned by the implementation library and contains information on the
* specific library: name, IP Core, operations, etc. * specific library: name, IP Core, operations, etc.
@ -446,6 +496,8 @@ typedef struct
uint32_t numOfOperations; uint32_t numOfOperations;
} SnpeUdo_ImpInfo_t; } SnpeUdo_ImpInfo_t;
typedef SnpeUdo_ImpInfo_t Udo_ImpInfo_t;
/** /**
* @brief This struct defines an operation. It is used for validation * @brief This struct defines an operation. It is used for validation
* or creation of an operation. * or creation of an operation.
@ -478,6 +530,8 @@ typedef struct
SnpeUdo_TensorParam_t* outputs; SnpeUdo_TensorParam_t* outputs;
} SnpeUdo_OpDefinition_t; } SnpeUdo_OpDefinition_t;
typedef SnpeUdo_OpDefinition_t Udo_OpDefinition_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif //SNPE_UDO_BASE_H #endif //SNPE_UDO_BASE_H

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc. // Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -24,6 +24,9 @@ extern "C"
typedef struct _SnpeUdo_OpFactory_t* SnpeUdo_OpFactory_t; typedef struct _SnpeUdo_OpFactory_t* SnpeUdo_OpFactory_t;
typedef struct _SnpeUdo_Operation_t* SnpeUdo_Operation_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 * @brief Initialize the shared library's data structures. Calling any other
* library function before this one will result in error. * library function before this one will result in error.
@ -92,6 +95,8 @@ SnpeUdo_getImpInfo(SnpeUdo_ImpInfo_t** implementationInfo);
typedef SnpeUdo_ErrorType_t typedef SnpeUdo_ErrorType_t
(*SnpeUdo_GetImpInfoFunction_t)(SnpeUdo_ImpInfo_t** implementationInfo); (*SnpeUdo_GetImpInfoFunction_t)(SnpeUdo_ImpInfo_t** implementationInfo);
typedef SnpeUdo_GetImpInfoFunction_t Udo_GetImpInfoFunction_t;
/** /**
* @brief A function to create an operation factory. * @brief A function to create an operation factory.
* The function receives the operation type, and an array of static parameters, * The function receives the operation type, and an array of static parameters,
@ -130,6 +135,7 @@ typedef SnpeUdo_ErrorType_t
SnpeUdo_Param_t*, SnpeUdo_Param_t*,
SnpeUdo_OpFactory_t*); SnpeUdo_OpFactory_t*);
typedef SnpeUdo_CreateOpFactoryFunction_t Udo_CreateOpFactoryFunction_t;
/** /**
* @brief A function to release the resources allocated for an operation factory * @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 typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ReleaseOpFactoryFunction_t)(SnpeUdo_OpFactory_t); (*SnpeUdo_ReleaseOpFactoryFunction_t)(SnpeUdo_OpFactory_t);
typedef SnpeUdo_ReleaseOpFactoryFunction_t Udo_ReleaseOpFactoryFunction_t;
/** /**
* @brief A function to create an operation from the factory. * @brief A function to create an operation from the factory.
* The function receives array of inputs and array of outputs, and creates an operation * 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_TensorParam_t*,
SnpeUdo_Operation_t*); SnpeUdo_Operation_t*);
typedef SnpeUdo_CreateOperationFunction_t Udo_CreateOperationFunction_t;
/** /**
* @brief A pointer to notification function. * @brief A pointer to notification function.
* *
@ -206,6 +216,8 @@ typedef SnpeUdo_ErrorType_t
typedef SnpeUdo_ErrorType_t typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ExternalNotify_t)(const uint32_t ID); (*SnpeUdo_ExternalNotify_t)(const uint32_t ID);
typedef SnpeUdo_ExternalNotify_t Udo_ExternalNotify_t;
/** /**
* @brief Operation execution function. * @brief Operation execution function.
* *
@ -245,6 +257,8 @@ typedef SnpeUdo_ErrorType_t
const uint32_t, const uint32_t,
SnpeUdo_ExternalNotify_t); SnpeUdo_ExternalNotify_t);
typedef SnpeUdo_ExecuteOpFunction_t Udo_ExecuteOpFunction_t;
/** /**
* @brief A function to setting the inputs & outputs. part of SnpeUdo_Operation struct, * @brief A function to setting the inputs & outputs. part of SnpeUdo_Operation struct,
* returned from creation of a new operation instance. * returned from creation of a new operation instance.
@ -277,6 +291,8 @@ typedef SnpeUdo_ErrorType_t
SnpeUdo_TensorParam_t*, SnpeUdo_TensorParam_t*,
SnpeUdo_TensorParam_t*); SnpeUdo_TensorParam_t*);
typedef SnpeUdo_SetOpIOFunction_t Udo_SetOpIOFunction_t;
/** /**
* @brief A function to return execution times. * @brief A function to return execution times.
* *
@ -297,6 +313,8 @@ SnpeUdo_profileOp(SnpeUdo_Operation_t operation, uint32_t *executionTime);
typedef SnpeUdo_ErrorType_t typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ProfileOpFunction_t)(SnpeUdo_Operation_t, uint32_t*); (*SnpeUdo_ProfileOpFunction_t)(SnpeUdo_Operation_t, uint32_t*);
typedef SnpeUdo_ProfileOpFunction_t Udo_ProfileOpFunction_t;
/** /**
* @brief A function to release the operation instance * @brief A function to release the operation instance
* \n When it is called, the implementation library needs to release all resources * \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 typedef SnpeUdo_ErrorType_t
(*SnpeUdo_ReleaseOpFunction_t)(SnpeUdo_Operation_t); (*SnpeUdo_ReleaseOpFunction_t)(SnpeUdo_Operation_t);
typedef SnpeUdo_ReleaseOpFunction_t Udo_ReleaseOpFunction_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#ifdef __cplusplus #ifdef __cplusplus

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc. // Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -45,13 +45,16 @@ typedef SnpeUdo_ErrorType_t (*SnpeUdo_ValidateOperationFunction_t) (SnpeUdo_Stri
uint32_t, uint32_t,
const SnpeUdo_Param_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 // enum used for indicating input/outout tensor data layouts on DSP, plain vs d32
typedef enum { typedef enum {
SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN, SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00, UDO_DSP_TENSOR_LAYOUT_PLAIN = 0x00,
SNPE_UDO_DSP_TENSOR_LAYOUT_D32 SNPE_UDO_DSP_TENSOR_LAYOUT_D32 = 0x01, UDO_DSP_TENSOR_LAYOUT_D32 = 0x01
} SnpeUdo_HexNNTensorLayout_t; } SnpeUdo_HexNNTensorLayout_t;
typedef SnpeUdo_HexNNTensorLayout_t Udo_HexNNTensorLayout_t;
/** /**
* @brief A function to query numbers of inputs and outputs, * @brief A function to query numbers of inputs and outputs,
* quantization type of each input and each output as arrays, * 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_QuantizationType_t**,
SnpeUdo_HexNNTensorLayout_t**); SnpeUdo_HexNNTensorLayout_t**);
typedef SnpeUdo_QueryOperationFunction_t Udo_QueryOperationFunction_t;
// Global infrastructure functions supported by Hexagon-NN v2 // Global infrastructure functions supported by Hexagon-NN v2
typedef void (*workerThread_t) (void* perOpInfrastructure, void* userData); typedef void (*workerThread_t) (void* perOpInfrastructure, void* userData);
@ -134,12 +137,25 @@ typedef struct hexNNv2GlobalInfra {
udoRunWorkerThreads_t udoRunWorkerThreads; udoRunWorkerThreads_t udoRunWorkerThreads;
} SnpeUdo_HexNNv2GlobalInfra_t; } SnpeUdo_HexNNv2GlobalInfra_t;
typedef SnpeUdo_HexNNv2GlobalInfra_t Udo_HexNNv2GlobalInfra_t;
// hexnn types // hexnn types
typedef enum hexnnInfraType { typedef enum hexnnInfraType {
UDO_INFRA_HEXNN_V2, UDO_INFRA_HEXNN_V2,
UDO_INFRA_HEXNN_V3 // reserved, do not use UDO_INFRA_HEXNN_V3 // reserved, do not use
} SnpeUdo_HexNNInfraType_t; } 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. * @brief Infrastructures needed by a developer of DSP Hexnn UDO Implementation library.
@ -156,6 +172,7 @@ typedef struct dspGlobalInfrastructure {
SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra; SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra;
} SnpeUdo_DspGlobalInfrastructure_t; } SnpeUdo_DspGlobalInfrastructure_t;
typedef SnpeUdo_DspGlobalInfrastructure_t Udo_DspGlobalInfrastructure_t;
/** /**
* hexnn v2 per op factory infrastructure * hexnn v2 per op factory infrastructure
@ -169,6 +186,7 @@ typedef struct hexnnv2OpFactoryInfra {
unsigned long graphId; unsigned long graphId;
} SnpeUdo_HexNNv2OpFactoryInfra_t; } SnpeUdo_HexNNv2OpFactoryInfra_t;
typedef SnpeUdo_HexNNv2OpFactoryInfra_t Udo_HexNNv2OpFactoryInfra_t;
/** /**
* hexnn v2 per operation infrastructure * hexnn v2 per operation infrastructure
@ -182,6 +200,8 @@ typedef struct hexnnv2OpFactoryInfra {
*/ */
typedef void* SnpeUdo_HexNNv2OpInfra_t; typedef void* SnpeUdo_HexNNv2OpInfra_t;
typedef SnpeUdo_HexNNv2OpInfra_t Udo_HexNNv2OpInfra_t;
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ /** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // SNPE_UDO_IMPL_DSP_H #endif // SNPE_UDO_IMPL_DSP_H

@ -1,6 +1,6 @@
//============================================================================== //==============================================================================
// //
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc. // Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
@ -37,6 +37,8 @@ SnpeUdo_getVersion (SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_ErrorType_t typedef SnpeUdo_ErrorType_t
(*SnpeUdo_GetVersionFunction_t) (SnpeUdo_LibVersion_t** version); (*SnpeUdo_GetVersionFunction_t) (SnpeUdo_LibVersion_t** version);
typedef SnpeUdo_GetVersionFunction_t Udo_GetVersionFunction_t;
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4c33680010a8c7b2eef33e809844c0ad1d5ab0f0ec37abd49d924204670b357
size 13556072

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:0cf6f53b7581e264b7070bdbbd95449cf913b9651cb7c83c6c647f9536d0a388 oid sha256:024891d2e4e4e265a1e7e72b27bad41ee6ae077d2197f45959bb32f8071dc8cf
size 5467528 size 5350008

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:558fcdaf12bc2fb267c918bbc3e531dbfdb38ec68a677d5e1de34e025c4caca4 oid sha256:f4784aa68e7ebdbe97db732eab87618b0a5fb73abeab4daed5476e01829b0e6e
size 759208 size 759208

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e680b2a32b1f0f756624747ed0f9728f32442d0227384c41371426017e512ff9
size 484048
Loading…
Cancel
Save