openpilot v0.9.6 release

date: 2024-01-12T10:13:37
master commit: ba792d576a49a0899b88a753fa1c52956bedf9e6
This commit is contained in:
FrogAi
2024-01-12 22:39:28 -07:00
commit 08e9fb1edc
1881 changed files with 653708 additions and 0 deletions

View File

@@ -0,0 +1,234 @@
//==============================================================================
//
// Copyright (c) 2014-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _DL_ENUMS_HPP_
#define _DL_ENUMS_HPP_
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl {
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* Enumeration of supported target runtimes.
*/
enum class Runtime_t
{
/// Run the processing on Snapdragon CPU.
/// Data: float 32bit
/// Math: float 32bit
CPU_FLOAT32 = 0,
/// Run the processing on the Adreno GPU.
/// Data: float 16bit
/// Math: float 32bit
GPU_FLOAT32_16_HYBRID = 1,
/// Run the processing on the Hexagon DSP.
/// Data: 8bit fixed point Tensorflow style format
/// Math: 8bit fixed point Tensorflow style format
DSP_FIXED8_TF = 2,
/// Run the processing on the Adreno GPU.
/// Data: float 16bit
/// Math: float 16bit
GPU_FLOAT16 = 3,
/// Run the processing on Snapdragon AIX+HVX.
/// Data: 8bit fixed point Tensorflow style format
/// Math: 8bit fixed point Tensorflow style format
AIP_FIXED8_TF = 5,
AIP_FIXED_TF = AIP_FIXED8_TF,
/// Default legacy enum to retain backward compatibility.
/// CPU = CPU_FLOAT32
CPU = CPU_FLOAT32,
/// Default legacy enum to retain backward compatibility.
/// GPU = GPU_FLOAT32_16_HYBRID
GPU = GPU_FLOAT32_16_HYBRID,
/// Default legacy enum to retain backward compatibility.
/// DSP = DSP_FIXED8_TF
DSP = DSP_FIXED8_TF,
/// Special value indicating the property is unset.
UNSET = -1
};
/**
* Enumeration of runtime available check options.
*/
enum class RuntimeCheckOption_t
{
/// Perform standard runtime available check
DEFAULT = 0,
/// Perform standard runtime available check
NORMAL_CHECK = 0,
/// Perform basic runtime available check, may be runtime specific
BASIC_CHECK = 1,
/// Perform unsignedPD runtime available check
UNSIGNEDPD_CHECK = 2,
};
/**
* Enumeration of various performance profiles that can be requested.
*/
enum class PerformanceProfile_t
{
/// Run in a standard mode.
/// This mode will be deprecated in the future and replaced with BALANCED.
DEFAULT = 0,
/// Run in a balanced mode.
BALANCED = 0,
/// Run in high performance mode
HIGH_PERFORMANCE = 1,
/// Run in a power sensitive mode, at the expense of performance.
POWER_SAVER = 2,
/// Use system settings. SNPE makes no calls to any performance related APIs.
SYSTEM_SETTINGS = 3,
/// Run in sustained high performance mode
SUSTAINED_HIGH_PERFORMANCE = 4,
/// Run in burst mode
BURST = 5,
/// Run in lower clock than POWER_SAVER, at the expense of performance.
LOW_POWER_SAVER = 6,
/// Run in higher clock and provides better performance than POWER_SAVER.
HIGH_POWER_SAVER = 7,
/// Run in lower balanced mode
LOW_BALANCED = 8,
};
/**
* Enumeration of various profilngLevels that can be requested.
*/
enum class ProfilingLevel_t
{
/// No profiling.
/// Collects no runtime stats in the DiagLog
OFF = 0,
/// Basic profiling
/// Collects some runtime stats in the DiagLog
BASIC = 1,
/// Detailed profiling
/// Collects more runtime stats in the DiagLog, including per-layer statistics
/// Performance may be impacted
DETAILED = 2,
/// Moderate profiling
/// Collects more runtime stats in the DiagLog, no per-layer statistics
MODERATE = 3
};
/**
* Enumeration of various execution priority hints.
*/
enum class ExecutionPriorityHint_t
{
/// Normal priority
NORMAL = 0,
/// Higher than normal priority
HIGH = 1,
/// Lower priority
LOW = 2
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++*/
/**
* Enumeration that lists the supported image encoding formats.
*/
enum class ImageEncoding_t
{
/// For unknown image type. Also used as a default value for ImageEncoding_t.
UNKNOWN = 0,
/// The RGB format consists of 3 bytes per pixel: one byte for
/// Red, one for Green, and one for Blue. The byte ordering is
/// endian independent and is always in RGB byte order.
RGB = 1,
/// The ARGB32 format consists of 4 bytes per pixel: one byte for
/// Red, one for Green, one for Blue, and one for the alpha channel.
/// The alpha channel is ignored. The byte ordering depends on the
/// underlying CPU. For little endian CPUs, the byte order is BGRA.
/// For big endian CPUs, the byte order is ARGB.
ARGB32 = 2,
/// The RGBA format consists of 4 bytes per pixel: one byte for
/// Red, one for Green, one for Blue, and one for the alpha channel.
/// The alpha channel is ignored. The byte ordering is endian independent
/// and is always in RGBA byte order.
RGBA = 3,
/// The GRAYSCALE format is for 8-bit grayscale.
GRAYSCALE = 4,
/// NV21 is the Android version of YUV. The Chrominance is down
/// sampled and has a subsampling ratio of 4:2:0. Note that this
/// image format has 3 channels, but the U and V channels
/// are subsampled. For every four Y pixels there is one U and one V pixel. @newpage
NV21 = 5,
/// The BGR format consists of 3 bytes per pixel: one byte for
/// Red, one for Green and one for Blue. The byte ordering is
/// endian independent and is always BGR byte order.
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
#endif

View File

@@ -0,0 +1,259 @@
//==============================================================================
//
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _DL_ERROR_HPP_
#define _DL_ERROR_HPP_
#include <stdint.h>
#include <limits> // numeric_limits
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl {
namespace DlSystem {
// clang and arm gcc different in how ZDL_EXPORT is used with enum class
#if !defined (__clang__)
enum class ErrorCode : uint32_t ZDL_EXPORT {
#else
enum class ZDL_EXPORT ErrorCode : uint32_t {
#endif // ARM64V8A
NONE = 0,
// System config errors
SNPE_CONFIG_MISSING_PARAM = 100,
SNPE_CONFIG_INVALID_PARAM = 101,
SNPE_CONFIG_MISSING_FILE = 102,
SNPE_CONFIG_NNCONFIG_NOT_SET = 103,
SNPE_CONFIG_NNCONFIG_INVALID = 104,
SNPE_CONFIG_WRONG_INPUT_NAME = 105,
SNPE_CONFIG_INCORRECT_INPUT_DIMENSIONS = 106,
SNPE_CONFIG_DIMENSIONS_MODIFICATION_NOT_SUPPORTED = 107,
SNPE_CONFIG_BOTH_OUTPUT_LAYER_TENSOR_NAMES_SET = 108,
SNPE_CONFIG_NNCONFIG_ONLY_TENSOR_SUPPORTED = 120,
SNPE_CONFIG_NNCONFIG_ONLY_USER_BUFFER_SUPPORTED = 121,
// DlSystem errors
SNPE_DLSYSTEM_MISSING_BUFFER = 200,
SNPE_DLSYSTEM_TENSOR_CAST_FAILED = 201,
SNPE_DLSYSTEM_FIXED_POINT_PARAM_INVALID = 202,
SNPE_DLSYSTEM_SIZE_MISMATCH = 203,
SNPE_DLSYSTEM_NAME_NOT_FOUND = 204,
SNPE_DLSYSTEM_VALUE_MISMATCH = 205,
SNPE_DLSYSTEM_INSERT_FAILED = 206,
SNPE_DLSYSTEM_TENSOR_FILE_READ_FAILED = 207,
SNPE_DLSYSTEM_DIAGLOG_FAILURE = 208,
SNPE_DLSYSTEM_LAYER_NOT_SET = 209,
SNPE_DLSYSTEM_WRONG_NUMBER_INPUT_BUFFERS = 210,
SNPE_DLSYSTEM_RUNTIME_TENSOR_SHAPE_MISMATCH = 211,
SNPE_DLSYSTEM_TENSOR_MISSING = 212,
SNPE_DLSYSTEM_TENSOR_ITERATION_UNSUPPORTED = 213,
SNPE_DLSYSTEM_BUFFER_MANAGER_MISSING = 214,
SNPE_DLSYSTEM_RUNTIME_BUFFER_SOURCE_UNSUPPORTED = 215,
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,
// DlContainer errors
SNPE_DLCONTAINER_MODEL_PARSING_FAILED = 300,
SNPE_DLCONTAINER_UNKNOWN_LAYER_CODE = 301,
SNPE_DLCONTAINER_MISSING_LAYER_PARAM = 302,
SNPE_DLCONTAINER_LAYER_PARAM_NOT_SUPPORTED = 303,
SNPE_DLCONTAINER_LAYER_PARAM_INVALID = 304,
SNPE_DLCONTAINER_TENSOR_DATA_MISSING = 305,
SNPE_DLCONTAINER_MODEL_LOAD_FAILED = 306,
SNPE_DLCONTAINER_MISSING_RECORDS = 307,
SNPE_DLCONTAINER_INVALID_RECORD = 308,
SNPE_DLCONTAINER_WRITE_FAILURE = 309,
SNPE_DLCONTAINER_READ_FAILURE = 310,
SNPE_DLCONTAINER_BAD_CONTAINER = 311,
SNPE_DLCONTAINER_BAD_DNN_FORMAT_VERSION = 312,
SNPE_DLCONTAINER_UNKNOWN_AXIS_ANNOTATION = 313,
SNPE_DLCONTAINER_UNKNOWN_SHUFFLE_TYPE = 314,
SNPE_DLCONTAINER_TEMP_FILE_FAILURE = 315,
// Network errors
SNPE_NETWORK_EMPTY_NETWORK = 400,
SNPE_NETWORK_CREATION_FAILED = 401,
SNPE_NETWORK_PARTITION_FAILED = 402,
SNPE_NETWORK_NO_OUTPUT_DEFINED = 403,
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,
// CPU runtime errors
SNPE_CPU_LAYER_NOT_SUPPORTED = 600,
SNPE_CPU_LAYER_PARAM_NOT_SUPPORTED = 601,
SNPE_CPU_LAYER_PARAM_INVALID = 602,
SNPE_CPU_LAYER_PARAM_COMBINATION_INVALID = 603,
SNPE_CPU_BUFFER_NOT_FOUND = 604,
SNPE_CPU_NETWORK_NOT_SUPPORTED = 605,
SNPE_CPU_UDO_OPERATION_FAILED = 606,
// CPU fixed-point runtime errors
SNPE_CPU_FXP_LAYER_NOT_SUPPORTED = 700,
SNPE_CPU_FXP_LAYER_PARAM_NOT_SUPPORTED = 701,
SNPE_CPU_FXP_LAYER_PARAM_INVALID = 702,
// GPU runtime errors
SNPE_GPU_LAYER_NOT_SUPPORTED = 800,
SNPE_GPU_LAYER_PARAM_NOT_SUPPORTED = 801,
SNPE_GPU_LAYER_PARAM_INVALID = 802,
SNPE_GPU_LAYER_PARAM_COMBINATION_INVALID = 803,
SNPE_GPU_KERNEL_COMPILATION_FAILED = 804,
SNPE_GPU_CONTEXT_NOT_SET = 805,
SNPE_GPU_KERNEL_NOT_SET = 806,
SNPE_GPU_KERNEL_PARAM_INVALID = 807,
SNPE_GPU_OPENCL_CHECK_FAILED = 808,
SNPE_GPU_OPENCL_FUNCTION_ERROR = 809,
SNPE_GPU_BUFFER_NOT_FOUND = 810,
SNPE_GPU_TENSOR_DIM_INVALID = 811,
SNPE_GPU_MEMORY_FLAGS_INVALID = 812,
SNPE_GPU_UNEXPECTED_NUMBER_OF_IO = 813,
SNPE_GPU_LAYER_PROXY_ERROR = 814,
SNPE_GPU_BUFFER_IN_USE = 815,
SNPE_GPU_BUFFER_MODIFICATION_ERROR = 816,
SNPE_GPU_DATA_ARRANGEMENT_INVALID = 817,
SNPE_GPU_UDO_OPERATION_FAILED = 818,
// DSP runtime errors
SNPE_DSP_LAYER_NOT_SUPPORTED = 900,
SNPE_DSP_LAYER_PARAM_NOT_SUPPORTED = 901,
SNPE_DSP_LAYER_PARAM_INVALID = 902,
SNPE_DSP_LAYER_PARAM_COMBINATION_INVALID = 903,
SNPE_DSP_STUB_NOT_PRESENT = 904,
SNPE_DSP_LAYER_NAME_TRUNCATED = 905,
SNPE_DSP_LAYER_INPUT_BUFFER_NAME_TRUNCATED = 906,
SNPE_DSP_LAYER_OUTPUT_BUFFER_NAME_TRUNCATED = 907,
SNPE_DSP_RUNTIME_COMMUNICATION_ERROR = 908,
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,
SNPE_MODEL_VALIDATION_LAYER_PARAM_NOT_SUPPORTED = 1001,
SNPE_MODEL_VALIDATION_LAYER_PARAM_INVALID = 1002,
SNPE_MODEL_VALIDATION_LAYER_PARAM_MISSING = 1003,
SNPE_MODEL_VALIDATION_LAYER_PARAM_COMBINATION_INVALID = 1004,
SNPE_MODEL_VALIDATION_LAYER_ORDERING_INVALID = 1005,
SNPE_MODEL_VALIDATION_INVALID_CONSTRAINT = 1006,
SNPE_MODEL_VALIDATION_MISSING_BUFFER = 1007,
SNPE_MODEL_VALIDATION_BUFFER_REUSE_NOT_SUPPORTED = 1008,
SNPE_MODEL_VALIDATION_LAYER_COULD_NOT_BE_ASSIGNED = 1009,
SNPE_MODEL_VALIDATION_UDO_LAYER_FAILED = 1010,
// UDL errors
SNPE_UDL_LAYER_EMPTY_UDL_NETWORK = 1100,
SNPE_UDL_LAYER_PARAM_INVALID = 1101,
SNPE_UDL_LAYER_INSTANCE_MISSING = 1102,
SNPE_UDL_LAYER_SETUP_FAILED = 1103,
SNPE_UDL_EXECUTE_FAILED = 1104,
SNPE_UDL_BUNDLE_INVALID = 1105,
SNPE_UDO_REGISTRATION_FAILED = 1106,
SNPE_UDO_GET_PACKAGE_FAILED = 1107,
SNPE_UDO_GET_IMPLEMENTATION_FAILED = 1108,
// Dependent library errors
SNPE_STD_LIBRARY_ERROR = 1200,
// Unknown exception (catch (...)), Has no component attached to this
SNPE_UNKNOWN_EXCEPTION = 1210,
// Storage Errors
SNPE_STORAGE_INVALID_KERNEL_REPO = 1300,
// AIP runtime errors
SNPE_AIP_LAYER_NOT_SUPPORTED = 1400,
SNPE_AIP_LAYER_PARAM_NOT_SUPPORTED = 1401,
SNPE_AIP_LAYER_PARAM_INVALID = 1402,
SNPE_AIP_LAYER_PARAM_COMBINATION_INVALID = 1403,
SNPE_AIP_STUB_NOT_PRESENT = 1404,
SNPE_AIP_LAYER_NAME_TRUNCATED = 1405,
SNPE_AIP_LAYER_INPUT_BUFFER_NAME_TRUNCATED = 1406,
SNPE_AIP_LAYER_OUTPUT_BUFFER_NAME_TRUNCATED = 1407,
SNPE_AIP_RUNTIME_COMMUNICATION_ERROR = 1408,
SNPE_AIP_RUNTIME_INVALID_PARAM_ERROR = 1409,
SNPE_AIP_RUNTIME_SYSTEM_ERROR = 1410,
SNPE_AIP_RUNTIME_TENSOR_MISSING = 1411,
SNPE_AIP_RUNTIME_TENSOR_SHAPE_MISMATCH = 1412,
SNPE_AIP_RUNTIME_BAD_AIX_RECORD = 1413,
// DlCaching errors
SNPE_DLCACHING_INVALID_METADATA = 1500,
SNPE_DLCACHING_INVALID_INITBLOB = 1501,
// Infrastructure Errors
SNPE_INFRA_CLUSTERMGR_INSTANCE_INVALID = 1600,
SNPE_INFRA_CLUSTERMGR_EXECUTE_SYNC_FAILED = 1601,
// Memory Errors
SNPE_MEMORY_CORRUPTION_ERROR = 1700
};
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* Returns the error code of the last error encountered.
*
* @return The error code.
*
* @note The returned error code is significant only when the return
* value of the call indicated an error.
*/
ZDL_EXPORT ErrorCode getLastErrorCode();
/**
* Returns the error string of the last error encountered.
*
* @return The error string.
*
* @note The returned error string is significant only when the return
* value of the call indicated an error.
*/
ZDL_EXPORT const char* getLastErrorString();
/**
* Returns the info string of the last error encountered.
*/
ZDL_EXPORT const char* getLastInfoString();
/**
* Returns the uint32_t representation of the error code enum.
*
* @param[in] code The error code to be converted.
*
* @return uint32_t representation of the error code.
*/
ZDL_EXPORT uint32_t enumToUInt32(zdl::DlSystem::ErrorCode code);
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
} // DlSystem
} // zdl
#endif // _DL_ERROR_HPP_

View File

@@ -0,0 +1,225 @@
//==============================================================================
//
// Copyright (c) 2016, 2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _DL_SYSTEM_OPTIONAL_HPP_
#define _DL_SYSTEM_OPTIONAL_HPP_
#include <cstdio>
#include <utility>
#include <stdexcept>
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl {
namespace DlSystem {
template <typename T>
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* Class to manage a value that may or may not exist. The boolean value
* of the Optional class is true if the object contains a value and false
* if it does not contain a value.
*
* The class must be evaluated and confirmed as true (containing a value)
* before being dereferenced.
*/
class ZDL_EXPORT Optional final {
public:
enum class LIFECYCLE {
NONE = 0,
REFERENCE_OWNED = 1,
POINTER_OWNED = 2,
POINTER_NOT_OWNED = 3
};
struct ReferenceCount {
size_t count = 0;
void increment() { count++; }
size_t decrement() {
if (count > 0) {
count--;
}
return count;
}
};
using U = typename std::remove_pointer<T>::type;
/**
* The default constructor is set to not have any value, and is
* therefore evaluated as false.
*/
// Do not explicit it so we can return {}
Optional() {
m_Type = LIFECYCLE::NONE;
}
/**
* Construct an Optional class using an object.
* @param[in] Reference to an object v
* @param[out] Optional instance of object v
*/
template <typename Q = T>
Optional (const T& v, typename std::enable_if<!std::is_pointer<Q>::value>::type* = 0)
: m_Type(LIFECYCLE::REFERENCE_OWNED) {
try {
m_StoragePtr = new T(v);
} catch (...) {
m_StoragePtr = nullptr;
m_Type = LIFECYCLE::NONE;
}
}
template <typename Q = T>
Optional(U* v, LIFECYCLE type, typename std::enable_if<std::is_pointer<Q>::value>::type* = 0)
: m_Type(type) {
switch (m_Type) {
case LIFECYCLE::POINTER_OWNED:
m_StoragePtr = v;
m_Count = new ReferenceCount();
m_Count->increment();
break;
case LIFECYCLE::POINTER_NOT_OWNED:
m_StoragePtr = v;
break;
case LIFECYCLE::REFERENCE_OWNED:
throw std::bad_exception();
case LIFECYCLE::NONE:
break;
}
}
Optional(const Optional &other) : m_Type(other.m_Type), m_Count(other.m_Count) {
if (isReference()) {
m_StoragePtr = new U(*other.m_StoragePtr);
} else if (isPointer()) {
m_StoragePtr = other.m_StoragePtr;
if (isOwned()) {
m_Count->increment();
}
}
}
Optional& operator=(const Optional& other) noexcept {
Optional tmp(other);
swap(std::move(tmp));
return *this;
}
Optional(Optional&& other) noexcept {
swap(std::move(other));
}
Optional& operator=(Optional&& other) noexcept {
swap(std::move(other));
return *this;
}
~Optional() {
if (isOwned()) {
if (isReference() || (isPointer() && m_Count->decrement() == 0)) {
delete m_StoragePtr;
delete m_Count;
}
}
}
/**
* Boolean value of Optional class is only true when there exists a value.
*/
operator bool() const noexcept { return isValid(); }
bool operator!() const noexcept { return !isValid(); }
/**
* Get reference of Optional object
* @warning User must validate Optional has value before.
*/
const T& operator*() { return this->GetReference(); }
/**
* Get reference of Optional object
* @warning User must validate Optional has value before.
*/
const T& operator*() const { return this->GetReference(); }
operator T&() { return this->GetReference(); }
T operator->() {
T self = this->GetReference();
return self;
}
private:
void swap(Optional&& other) {
m_Type = other.m_Type;
m_StoragePtr = other.m_StoragePtr;
m_Count = other.m_Count;
other.m_Type = LIFECYCLE::NONE;
other.m_StoragePtr = nullptr;
other.m_Count = nullptr;
}
template <typename Q = T>
typename std::enable_if<std::is_same<U, Q>::value, const Q&>::type GetReference() const noexcept {
if (!isReference()) std::terminate();
return *static_cast<const Q*>(m_StoragePtr);
}
template <typename Q = T>
typename std::enable_if<std::is_same<U*, Q>::value, const Q&>::type GetReference() const noexcept {
if (!isPointer()) std::terminate();
return static_cast<const Q&>(m_StoragePtr);
}
template <typename Q = T>
typename std::enable_if<std::is_same<U, Q>::value, Q&>::type GetReference() noexcept {
if (!isReference()) std::terminate();
return *m_StoragePtr;
}
template <typename Q = T>
typename std::enable_if<std::is_same<U*, Q>::value, Q&>::type GetReference() noexcept {
if (!isPointer()) std::terminate();
return m_StoragePtr;
}
bool isPointer() const {
return m_Type == LIFECYCLE::POINTER_OWNED || m_Type == LIFECYCLE::POINTER_NOT_OWNED;
}
bool isOwned() const {
return m_Type == LIFECYCLE::REFERENCE_OWNED || m_Type == LIFECYCLE::POINTER_OWNED;
}
bool isReference() const {
return m_Type == LIFECYCLE::REFERENCE_OWNED;
}
bool isValid() const {
return m_Type != LIFECYCLE::NONE;
}
U* m_StoragePtr = nullptr;
LIFECYCLE m_Type;
ReferenceCount *m_Count = nullptr;
};
} // ns DlSystem
} // ns zdl
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // _DL_SYSTEM_OPTIONAL_HPP_

View File

@@ -0,0 +1,78 @@
//==============================================================================
//
// Copyright (c) 2014-2015 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _DL_VERSION_HPP_
#define _DL_VERSION_HPP_
#include "ZdlExportDefine.hpp"
#include <stdint.h>
#include <string>
#include "DlSystem/String.hpp"
namespace zdl {
namespace DlSystem
{
class Version_t;
}}
namespace zdl { namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* A class that contains the different portions of a version number.
*/
class ZDL_EXPORT Version_t
{
public:
/// Holds the major version number. Changes in this value indicate
/// major changes that break backward compatibility.
int32_t Major;
/// Holds the minor version number. Changes in this value indicate
/// minor changes made to library that are backwards compatible
/// (such as additions to the interface).
int32_t Minor;
/// Holds the teeny version number. Changes in this value indicate
/// changes such as bug fixes and patches made to the library that
/// do not affect the interface.
int32_t Teeny;
/// This string holds information about the build version.
///
std::string Build;
static zdl::DlSystem::Version_t fromString(const std::string &stringValue);
static zdl::DlSystem::Version_t fromString(const zdl::DlSystem::String &stringValue);
/**
* @brief Returns a string in the form Major.Minor.Teeny.Build
*
* @return A formatted string holding the version information.
*/
const std::string toString() const;
/**
* @brief Returns a string in the form Major.Minor.Teeny.Build
*
* @return A formatted string holding the version information.
*/
const zdl::DlSystem::String asString() const;
};
}}
/** @} */ /* end_addtogroup c_plus_plus_apis */
#endif

View File

@@ -0,0 +1,86 @@
//==============================================================================
//
// Copyright (c) 2017-2019 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _IBUFFER_ATTRIBUTES_HPP
#define _IBUFFER_ATTRIBUTES_HPP
#include "IUserBuffer.hpp"
#include "TensorShape.hpp"
#include "ZdlExportDefine.hpp"
namespace zdl {
namespace DlSystem {
class UserBufferEncoding;
}
}
namespace zdl {
namespace DlSystem {
/**
* @brief IBufferAttributes returns a buffer's dimension and alignment
* requirements, along with info on its encoding type
*/
class ZDL_EXPORT IBufferAttributes {
public:
/**
* @brief Gets the buffer's element size, in bytes
*
* This can be used to compute the memory size required
* to back this buffer.
*
* @return Element size, in bytes
*/
virtual size_t getElementSize() const noexcept = 0;
/**
* @brief Gets the element's encoding type
*
* @return encoding type
*/
virtual zdl::DlSystem::UserBufferEncoding::ElementType_t getEncodingType() const noexcept = 0;
/**
* @brief Gets the number of elements in each dimension
*
* @return Dimension size, in terms of number of elements
*/
virtual const TensorShape getDims() const noexcept = 0;
/**
* @brief Gets the alignment requirement of each dimension
*
* Alignment per each dimension is expressed as an multiple, for
* example, if one particular dimension can accept multiples of 8,
* the alignment will be 8.
*
* @return Alignment in each dimension, in terms of multiple of
* number of elements
*/
virtual const TensorShape getAlignments() const noexcept = 0;
/**
* @brief Gets the buffer encoding returned from the network responsible
* for generating this buffer. Depending on the encoding type, this will
* be an instance of an encoding type specific derived class.
*
* @return Derived user buffer encoding object.
*/
virtual zdl::DlSystem::UserBufferEncoding* getEncoding() const noexcept = 0;
virtual ~IBufferAttributes() {}
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
}
}
#endif

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

@@ -0,0 +1,146 @@
//=============================================================================
//
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _ITENSOR_HPP_
#define _ITENSOR_HPP_
#include "ITensorItr.hpp"
#include "ITensorItrImpl.hpp"
#include "TensorShape.hpp"
#include "ZdlExportDefine.hpp"
#include <memory>
#include <ostream>
#include <cmath>
namespace zdl {
namespace DlSystem
{
class ITensor;
}}
namespace zdl { namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* Represents a tensor which holds n-dimensional data. It is important to
* understand how the tensor data is represented in memory
* relative to the tensor dimensions. Tensors store data in
* memory in row-major order (i.e. the last tensor dimension is
* the fastest varying one). For example, if you have a two
* dimensional tensor with 3 rows and 2 columns (i.e. the tensor
* dimensions are 3,2 as returned in tensor dimension vectors)
* with the following data in terms rows and columns:
*
* | 1 2 | <br/>
* | 3 4 | <br/>
* | 5 6 | <br/>
*
* This data would be stored in memory as 1,2,3,4,5,6.
*/
class ZDL_EXPORT ITensor
{
public:
typedef zdl::DlSystem::ITensorItr<false> iterator;
typedef zdl::DlSystem::ITensorItr<true> const_iterator;
virtual ~ITensor() {}
/**
* Returns a tensor iterator pointing to the beginning
* of the data in the tensor.
*
* @return A tensor iterator that points to the first data
* element in the tensor.
*/
virtual iterator begin() = 0;
/**
* Returns the const version of a tensor iterator
* pointing to the beginning of the data in the tensor.
*
* @return A tensor const iterator that points to the first data
* element in the tensor.
*/
virtual const_iterator cbegin() const = 0;
/**
* Returns a tensor iterator pointing to the end of the
* data in the tensor. This tensor should not be
* dereferenced.
*
* @return A tensor iterator that points to the end of the data
* (one past the last element) in the tensor.
*/
virtual iterator end() = 0;
/**
* Returns the const version of a tensor iterator
* pointing to the end of the data in the tensor. This
* tensor should not be dereferenced.
*
* @return A tensor const iterator that points to the end of the
* data (one past the last element) in the tensor.
*/
virtual const_iterator cend() const = 0;
/**
* @brief Gets the shape of this tensor.
*
* The last element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying dimension, etc.
*
* @return A shape class holding the tensor dimensions.
*/
virtual TensorShape getShape() const = 0;
/**
* Returns the element size of the data in the tensor
* (discounting strides). This is how big a buffer would
* need to be to hold the tensor data contiguously in
* memory.
*
* @return The size of the tensor (in elements).
*/
virtual size_t getSize() const = 0;
/**
* @brief Serializes the tensor to an output stream.
*
* @param[in] output The output stream to which to write the tensor
*
* @throw std::runtime_error If the stream is ever in a bad
* state before the tensor is fully serialized.
*/
virtual void serialize(std::ostream &output) const = 0;
friend iterator;
friend const_iterator;
virtual bool isQuantized() {return false;}
virtual float GetDelta() {return NAN;};
virtual float GetOffset() {return NAN;};
protected:
/**
* Returns the tensor iterator implementation.
*
* @return A pointer to the tensor iterator implementation.
*/
virtual std::unique_ptr<::DlSystem::ITensorItrImpl> getItrImpl() const = 0;
};
}}
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif

View File

@@ -0,0 +1,92 @@
//=============================================================================
//
// Copyright (c) 2015-2016 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _ITENSOR_FACTORY_HPP
#define _ITENSOR_FACTORY_HPP
#include "ITensor.hpp"
#include "TensorShape.hpp"
#include "ZdlExportDefine.hpp"
#include <istream>
namespace zdl {
namespace DlSystem
{
class ITensor;
class TensorShape;
}
}
namespace zdl { namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* Factory interface class to create ITensor objects.
*/
class ZDL_EXPORT ITensorFactory
{
public:
virtual ~ITensorFactory() = default;
/**
* Creates a new ITensor with uninitialized data.
*
* The strides for the tensor will match the tensor dimensions
* (i.e., the tensor data is contiguous in memory).
*
* @param[in] shape The dimensions for the tensor in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
* @return A pointer to the created tensor or nullptr if creating failed.
*/
virtual std::unique_ptr<ITensor>
createTensor(const TensorShape &shape) noexcept = 0;
/**
* Creates a new ITensor by loading it from a file.
*
* @param[in] input The input stream from which to read the tensor
* data.
*
* @return A pointer to the created tensor or nullptr if creating failed.
*
*/
virtual std::unique_ptr<ITensor> createTensor(std::istream &input) noexcept = 0;
/**
* Create a new ITensor with specific data.
* (i.e. the tensor data is contiguous in memory). This tensor is
* primarily used to create a tensor where tensor size can't be
* computed directly from dimension. One such example is
* NV21-formatted image, or any YUV formatted image
*
* @param[in] shape The dimensions for the tensor in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
* @param[in] data The actual data with which the Tensor object is filled.
*
* @param[in] dataSize The size of data
*
* @return A pointer to the created tensor
*/
virtual std::unique_ptr<ITensor>
createTensor(const TensorShape &shape, const unsigned char *data, size_t dataSize) noexcept = 0;
};
}}
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif

View File

@@ -0,0 +1,182 @@
//=============================================================================
//
// Copyright (c) 2015 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _ITENSOR_ITR_HPP_
#define _ITENSOR_ITR_HPP_
#include "ZdlExportDefine.hpp"
#include "ITensorItrImpl.hpp"
#include <memory>
#include <iterator>
#include <iostream>
namespace zdl {
namespace DlSystem
{
template<bool IS_CONST> class ITensorItr;
class ITensor;
void ZDL_EXPORT fill(ITensorItr<false> first, ITensorItr<false> end, float val);
template<class InItr, class OutItr> OutItr ZDL_EXPORT copy(InItr first, InItr last, OutItr result)
{
return std::copy(first, last, result);
}
}}
namespace DlSystem
{
class ITensorItrImpl;
}
namespace zdl { namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* A bidirectional iterator (with limited random access
* capabilities) for the zdl::DlSystem::ITensor class.
*
* This is a standard bidrectional iterator and is compatible
* with standard algorithm functions that operate on bidirectional
* access iterators (e.g., std::copy, std::fill, etc.). It uses a
* template parameter to create const and non-const iterators
* from the same code. Iterators are easiest to declare via the
* typedefs iterator and const_iterator in the ITensor class
* (e.g., zdl::DlSystem::ITensor::iterator).
*
* Note that if the tensor the iterator is traversing was
* created with nondefault (i.e., nontrivial) strides, the
* iterator will obey the strides when traversing the tensor
* data.
*
* Also note that nontrivial strides dramatically affect the
* performance of the iterator (on the order of 20x slower).
*/
template<bool IS_CONST=true>
class ZDL_EXPORT ITensorItr : public std::iterator<std::bidirectional_iterator_tag, float>
{
public:
typedef typename std::conditional<IS_CONST, const float&, float&>::type VALUE_REF;
ITensorItr() = delete;
virtual ~ITensorItr() {}
ITensorItr(std::unique_ptr<::DlSystem::ITensorItrImpl> impl,
bool isTrivial = false,
float* data = nullptr)
: m_Impl(impl->clone())
, m_IsTrivial(isTrivial)
, m_Data(data)
, m_DataStart(data) {}
ITensorItr(const ITensorItr<IS_CONST>& itr)
: m_Impl(itr.m_Impl->clone()),
m_IsTrivial(itr.m_IsTrivial),
m_Data(itr.m_Data),
m_DataStart(itr.m_DataStart) {}
zdl::DlSystem::ITensorItr<IS_CONST>& operator=(const ITensorItr<IS_CONST>& other)
{
if (this == &other) return *this;
m_Impl = std::move(other.m_Impl->clone());
m_IsTrivial = other.m_IsTrivial;
m_Data = other.m_Data;
m_DataStart = other.m_DataStart;
return *this;
}
inline zdl::DlSystem::ITensorItr<IS_CONST>& operator++()
{
if (m_IsTrivial) m_Data++; else m_Impl->increment();
return *this;
}
inline zdl::DlSystem::ITensorItr<IS_CONST> operator++(int)
{
ITensorItr tmp(*this);
operator++();
return tmp;
}
inline zdl::DlSystem::ITensorItr<IS_CONST>& operator--()
{
if (m_IsTrivial) m_Data--; else m_Impl->decrement();
return *this;
}
inline zdl::DlSystem::ITensorItr<IS_CONST> operator--(int)
{
ITensorItr tmp(*this);
operator--();
return tmp;
}
inline zdl::DlSystem::ITensorItr<IS_CONST>& operator+=(int rhs)
{
if (m_IsTrivial) m_Data += rhs; else m_Impl->increment(rhs);
return *this;
}
inline friend zdl::DlSystem::ITensorItr<IS_CONST> operator+(zdl::DlSystem::ITensorItr<IS_CONST> lhs, int rhs)
{ lhs += rhs; return lhs; }
inline zdl::DlSystem::ITensorItr<IS_CONST>& operator-=(int rhs)
{
if (m_IsTrivial) m_Data -= rhs; else m_Impl->decrement(rhs);
return *this;
}
inline friend zdl::DlSystem::ITensorItr<IS_CONST> operator-(zdl::DlSystem::ITensorItr<IS_CONST> lhs, int rhs)
{ lhs -= rhs; return lhs; }
inline size_t operator-(const zdl::DlSystem::ITensorItr<IS_CONST>& rhs)
{
if (m_IsTrivial) return (m_Data - m_DataStart) - (rhs.m_Data - rhs.m_DataStart);
return m_Impl->getPosition() - rhs.m_Impl->getPosition();
}
inline friend bool operator<(const ITensorItr<IS_CONST>& lhs, const ITensorItr<IS_CONST>& rhs)
{
if (lhs.m_IsTrivial) return lhs.m_Data < rhs.m_Data;
return lhs.m_Impl->dataPointer() < rhs.m_Impl->dataPointer();
}
inline friend bool operator>(const ITensorItr<IS_CONST>& lhs, const ITensorItr<IS_CONST>& rhs)
{ return rhs < lhs; }
inline friend bool operator<=(const ITensorItr<IS_CONST>& lhs, const ITensorItr<IS_CONST>& rhs)
{ return !(lhs > rhs); }
inline friend bool operator>=(const ITensorItr<IS_CONST>& lhs, const ITensorItr<IS_CONST>& rhs)
{ return !(lhs < rhs); }
inline bool operator==(const ITensorItr<IS_CONST>& rhs) const
{
if (m_IsTrivial) return m_Data == rhs.m_Data;
return m_Impl->dataPointer() == rhs.m_Impl->dataPointer();
}
inline bool operator!=(const ITensorItr<IS_CONST>& rhs) const
{ return !operator==(rhs); }
inline VALUE_REF operator[](size_t idx)
{
if (m_IsTrivial) return *(m_DataStart + idx);
return m_Impl->getReferenceAt(idx);
}
inline VALUE_REF operator*()
{ if (m_IsTrivial) return *m_Data; else return m_Impl->getReference(); }
inline VALUE_REF operator->()
{ return *(*this); }
inline float* dataPointer() const
{ if (m_IsTrivial) return m_Data; else return m_Impl->dataPointer(); }
protected:
std::unique_ptr<::DlSystem::ITensorItrImpl> m_Impl;
bool m_IsTrivial = false;
float* m_Data = nullptr;
float* m_DataStart = nullptr;
};
}}
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif

View File

@@ -0,0 +1,42 @@
//=============================================================================
//
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _ITENSOR_ITR_IMPL_HPP_
#define _ITENSOR_ITR_IMPL_HPP_
#include "ZdlExportDefine.hpp"
#include <memory>
#include <iterator>
namespace DlSystem
{
class ITensorItrImpl;
}
class ZDL_EXPORT DlSystem::ITensorItrImpl
{
public:
ITensorItrImpl() {}
virtual ~ITensorItrImpl() {}
virtual float getValue() const = 0;
virtual float& getReference() = 0;
virtual float& getReferenceAt(size_t idx) = 0;
virtual float* dataPointer() const = 0;
virtual void increment(int incVal = 1) = 0;
virtual void decrement(int decVal = 1) = 0;
virtual size_t getPosition() = 0;
virtual std::unique_ptr<DlSystem::ITensorItrImpl> clone() = 0;
private:
ITensorItrImpl& operator=(const ITensorItrImpl& other) = delete;
ITensorItrImpl(const ITensorItrImpl& other) = delete;
};
#endif

View File

@@ -0,0 +1,105 @@
//=============================================================================
//
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _DL_SYSTEM_IUDL_HPP_
#define _DL_SYSTEM_IUDL_HPP_
#include "ZdlExportDefine.hpp"
namespace zdl {
namespace DlSystem {
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Base class user concrete UDL implementation.
*
* All functions are marked as:
*
* - virtual
* - noexcept
*
* User should make sure no exceptions are propagated outside of
* their module. Errors can be communicated via return values.
*/
class ZDL_EXPORT IUDL {
public:
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Destructor
*/
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
* user defined layers.
*
* @param cookie User provided opaque data returned by the SNPE
* runtime
*
* @param insz How many elements in input size array
* @param indim Pointer to a buffer that holds input dimension
* array
* @param indimsz Input dimension size array of the buffer
* 'indim'. Corresponds to indim
*
* @param outsz How many elements in output size array
* @param outdim Pointer to a buffer that holds output
* dimension array
* @param outdimsz Output dimension size of the buffer 'oudim'.
* Corresponds to indim
*
* @return true on success, false otherwise
*/
virtual bool setup(void *cookie,
size_t insz, const size_t **indim, const size_t *indimsz,
size_t outsz, const size_t **outdim, const size_t *outdimsz) = 0;
/**
* 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.
*
* @param cookie - User provided opaque data returned by the SNPE runtime
*/
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
* runtime
*
* @param input Const pointer to a float buffer that contains
* the input
*
* @param output Float pointer to a buffer that would hold
* the user defined layer's output. This buffer
* is allocated and owned by SNPE runtime.
*/
virtual bool execute(void *cookie, const float **input, float **output) = 0;
};
} // ns DlSystem
} // ns zdl
#endif // _DL_SYSTEM_IUDL_HPP_

View File

@@ -0,0 +1,358 @@
//==============================================================================
//
// Copyright (c) 2017-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _IUSER_BUFFER_HPP
#define _IUSER_BUFFER_HPP
#include "TensorShape.hpp"
#include "ZdlExportDefine.hpp"
#include <math.h>
namespace zdl {
namespace DlSystem {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A base class buffer encoding type
*/
class ZDL_EXPORT UserBufferEncoding {
public:
/**
* @brief .
*
* An enum class of all supported element types in a IUserBuffer
*/
enum class ElementType_t
{
/// Unknown element type.
UNKNOWN = 0,
/// Each element is presented by float.
FLOAT = 1,
/// Each element is presented by an unsigned int.
UNSIGNED8BIT = 2,
/// Each element is presented by an 8-bit quantized value.
TF8 = 10,
/// Each element is presented by an 16-bit quantized value.
TF16 = 11
};
/**
* @brief Retrieves the size of the element, in bytes.
*
* @return Size of the element, in bytes.
*/
virtual size_t getElementSize() const noexcept = 0;
/**
* @brief Retrieves the element type
*
* @return Element type
*/
ElementType_t getElementType() const noexcept {return m_ElementType;};
virtual ~UserBufferEncoding() {}
protected:
UserBufferEncoding(ElementType_t elementType) : m_ElementType(elementType) {};
private:
const ElementType_t m_ElementType;
};
/**
* @brief .
*
* A base class buffer source type
*
* @note User buffer from CPU support all kinds of runtimes;
* User buffer from GLBUFFER support only GPU runtime.
*/
class ZDL_EXPORT UserBufferSource {
public:
enum class SourceType_t
{
/// Unknown buffer source type.
UNKNOWN = 0,
/// The network inputs are from CPU buffer.
CPU = 1,
/// The network inputs are from OpenGL buffer.
GLBUFFER = 2
};
/**
* @brief Retrieves the source type
*
* @return Source type
*/
SourceType_t getSourceType() const noexcept {return m_SourceType;};
protected:
UserBufferSource(SourceType_t sourceType): m_SourceType(sourceType) {};
private:
const SourceType_t m_SourceType;
};
/**
* @brief .
*
* An source type where input data is delivered from OpenGL buffer
*/
class ZDL_EXPORT UserBufferSourceGLBuffer : public UserBufferSource{
public:
UserBufferSourceGLBuffer() : UserBufferSource(SourceType_t::GLBUFFER) {};
};
/**
* @brief .
*
* An encoding type where each element is represented by an unsigned int
*/
class ZDL_EXPORT UserBufferEncodingUnsigned8Bit : public UserBufferEncoding {
public:
UserBufferEncodingUnsigned8Bit() : UserBufferEncoding(ElementType_t::UNSIGNED8BIT) {};
size_t getElementSize() const noexcept override;
protected:
UserBufferEncodingUnsigned8Bit(ElementType_t elementType) : UserBufferEncoding(elementType) {};
};
/**
* @brief .
*
* An encoding type where each element is represented by a float
*/
class ZDL_EXPORT UserBufferEncodingFloat : public UserBufferEncoding {
public:
UserBufferEncodingFloat() : UserBufferEncoding(ElementType_t::FLOAT) {};
size_t getElementSize() const noexcept override;
};
/**
* @brief .
*
* 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 UserBufferEncodingTfN : public UserBufferEncoding {
public:
UserBufferEncodingTfN() = delete;
UserBufferEncodingTfN(uint64_t stepFor0, float stepSize, uint8_t bWidth=8):
UserBufferEncoding(getTypeFromWidth(bWidth)),
bitWidth(bWidth),
m_StepExactly0(stepFor0),
m_QuantizedStepSize(stepSize){};
UserBufferEncodingTfN(const zdl::DlSystem::UserBufferEncoding &ubEncoding) : UserBufferEncoding(ubEncoding.getElementType()){
const zdl::DlSystem::UserBufferEncodingTfN* ubEncodingTfN
= dynamic_cast <const zdl::DlSystem::UserBufferEncodingTfN*> (&ubEncoding);
if (ubEncodingTfN) {
m_StepExactly0 = ubEncodingTfN->getStepExactly0();
m_QuantizedStepSize = ubEncodingTfN->getQuantizedStepSize();
bitWidth = ubEncodingTfN->bitWidth;
}
}
size_t getElementSize() const noexcept override;
/**
* @brief Sets the step value that represents 0
*
* @param[in] stepExactly0 The step value that represents 0
*
*/
void setStepExactly0(uint64_t 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
*/
uint64_t 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 static_cast<float>(m_QuantizedStepSize * (0 - (double)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 static_cast<float>(m_QuantizedStepSize * (pow(2,bitWidth)-1 - (double)m_StepExactly0));
};
/**
* @brief Retrieves the step size
*
* @return Step size
*/
float getQuantizedStepSize() const {
return m_QuantizedStepSize;
}
ElementType_t getTypeFromWidth(uint8_t width);
uint8_t bitWidth;
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.
*/
class ZDL_EXPORT IUserBuffer {
public:
virtual ~IUserBuffer() = default;
/**
* @brief Retrieves the total number of bytes between elements in each dimension if
* the buffer were to be interpreted as a multi-dimensional array.
*
* @return Number of bytes between elements in each dimension.
* e.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would
* return strides of [24, 8, 4].
*/
virtual const TensorShape& getStrides() const = 0;
/**
* @brief Retrieves the size of the buffer, in bytes.
*
* @return Size of the underlying buffer, in bytes.
*/
virtual size_t getSize() const = 0;
/**
* @brief Retrieves the size of the inference data in the buffer, in bytes.
*
* The inference results from a dynamic-sized model may not be exactly the same size
* as the UserBuffer provided to SNPE. This function can be used to get the amount
* of output inference data, which may be less or greater than the size of the UserBuffer.
*
* If the inference results fit in the UserBuffer, getOutputSize() would be less than
* or equal to getSize(). But if the inference results were more than the capacity of
* the provided UserBuffer, the results would be truncated to fit the UserBuffer. But,
* getOutputSize() would be greater than getSize(), which indicates a bigger buffer
* needs to be provided to SNPE to hold all of the inference results.
*
* @return Size required for the buffer to hold all inference results, which can be less
* or more than the size of the buffer, in bytes.
*/
virtual size_t getOutputSize() const = 0;
/**
* @brief Changes the underlying memory that backs the UserBuffer.
*
* This can be used to avoid creating multiple UserBuffer objects
* when the only thing that differs is the memory location.
*
* @param[in] buffer Pointer to the memory location
*
* @return Whether the set succeeds.
*/
virtual bool setBufferAddress(void *buffer) noexcept = 0;
/**
* @brief Gets a const reference to the data encoding object of
* the underlying buffer
*
* This is necessary when the UserBuffer is filled by SNPE with
* data types such as TF8, where the caller needs to know the quantization
* parameters in order to interpret the data properly
*
* @return A read-only encoding object
*/
virtual const UserBufferEncoding& getEncoding() const noexcept = 0;
/**
* @brief Gets a reference to the data encoding object of
* the underlying buffer
*
* This is necessary when the UserBuffer is re-used, and the encoding
* parameters can change. For example, each input can be quantized with
* different step sizes.
*
* @return Data encoding meta-data
*/
virtual UserBufferEncoding& getEncoding() noexcept = 0;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
}
}
#endif

View File

@@ -0,0 +1,81 @@
//=============================================================================
//
// Copyright (c) 2017 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _IUSERBUFFER_FACTORY_HPP
#define _IUSERBUFFER_FACTORY_HPP
#include "IUserBuffer.hpp"
#include "TensorShape.hpp"
#include "ZdlExportDefine.hpp"
#include "DlEnums.hpp"
namespace zdl {
namespace DlSystem {
class IUserBuffer;
class TensorShape;
}
}
namespace zdl {
namespace DlSystem {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* Factory interface class to create IUserBuffer objects.
*/
class ZDL_EXPORT IUserBufferFactory {
public:
virtual ~IUserBufferFactory() = default;
/**
* @brief Creates a UserBuffer
*
* @param[in] buffer Pointer to the buffer that the caller supplies
*
* @param[in] bufSize Buffer size, in bytes
*
* @param[in] strides Total number of bytes between elements in each dimension.
* E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4].
*
* @param[in] userBufferEncoding Reference to an UserBufferEncoding object
*
* @note Caller has to ensure that memory pointed to by buffer stays accessible
* for the lifetime of the object created
*/
virtual std::unique_ptr<IUserBuffer>
createUserBuffer(void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding* userBufferEncoding) noexcept = 0;
/**
* @brief Creates a UserBuffer
*
* @param[in] buffer Pointer to the buffer that the caller supplies
*
* @param[in] bufSize Buffer size, in bytes
*
* @param[in] strides Total number of bytes between elements in each dimension.
* E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4].
*
* @param[in] userBufferEncoding Reference to an UserBufferEncoding object
*
* @param[in] userBufferSource Reference to an UserBufferSource object
*
* @note Caller has to ensure that memory pointed to by buffer stays accessible
* for the lifetime of the object created
*/
virtual std::unique_ptr<IUserBuffer>
createUserBuffer(void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding* userBufferEncoding, zdl::DlSystem::UserBufferSource* userBufferSource) noexcept = 0;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
}
}
#endif

View File

@@ -0,0 +1,230 @@
//=============================================================================
//
// Copyright (c) 2017-2018,2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef _DL_SYSTEM_PLATFORM_CONFIG_HPP_
#define _DL_SYSTEM_PLATFORM_CONFIG_HPP_
#include "DlSystem/ZdlExportDefine.hpp"
#include <string>
namespace zdl{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A structure OpenGL configuration
*
* @note When certain OpenGL context and display are provided to UserGLConfig for using
* GPU buffer as input directly, the user MUST ensure the particular OpenGL
* context and display remain vaild throughout the execution of neural network models.
*/
struct ZDL_EXPORT UserGLConfig
{
/// Holds user EGL context.
///
void* userGLContext = nullptr;
/// Holds user EGL display.
void* userGLDisplay = nullptr;
};
/**
* @brief .
*
* A structure Gpu configuration
*/
struct ZDL_EXPORT UserGpuConfig{
/// Holds user OpenGL configuration.
///
UserGLConfig userGLConfig;
};
/**
* @brief .
*
* A class user platform configuration
*/
class ZDL_EXPORT PlatformConfig
{
public:
/**
* @brief .
*
* An enum class of all supported platform types
*/
enum class PlatformType_t
{
/// Unknown platform type.
UNKNOWN = 0,
/// Snapdragon CPU.
CPU = 1,
/// Adreno GPU.
GPU = 2,
/// Hexagon DSP.
DSP = 3
};
/**
* @brief .
*
* A union class user platform configuration information
*/
union PlatformConfigInfo
{
/// Holds user GPU Configuration.
///
UserGpuConfig userGpuConfig;
PlatformConfigInfo(){};
};
PlatformConfig() : m_PlatformType(PlatformType_t::UNKNOWN),
m_PlatformOptions("") {};
/**
* @brief Retrieves the platform type
*
* @return Platform type
*/
PlatformType_t getPlatformType() const {return m_PlatformType;};
/**
* @brief Indicates whther the plaform configuration is valid.
*
* @return True if the platform configuration is valid; false otherwise.
*/
bool isValid() const {return (PlatformType_t::UNKNOWN != m_PlatformType);};
/**
* @brief Retrieves the Gpu configuration
*
* @param[out] userGpuConfig The passed in userGpuConfig populated with the Gpu configuration on return.
*
* @return True if Gpu configuration was retrieved; false otherwise.
*/
bool getUserGpuConfig(UserGpuConfig& userGpuConfig) const
{
if(m_PlatformType == PlatformType_t::GPU)
{
userGpuConfig = m_PlatformConfigInfo.userGpuConfig;
return true;
}
else
{
return false;
}
}
/**
* @brief Sets the Gpu configuration
*
* @param[in] userGpuConfig Gpu Configuration
*
* @return True if Gpu configuration was successfully set; false otherwise.
*/
bool setUserGpuConfig(UserGpuConfig& userGpuConfig)
{
if((userGpuConfig.userGLConfig.userGLContext != nullptr) && (userGpuConfig.userGLConfig.userGLDisplay != nullptr))
{
switch (m_PlatformType)
{
case PlatformType_t::GPU:
m_PlatformConfigInfo.userGpuConfig = userGpuConfig;
return true;
case PlatformType_t::UNKNOWN:
m_PlatformType = PlatformType_t::GPU;
m_PlatformConfigInfo.userGpuConfig = userGpuConfig;
return true;
default:
return false;
}
}
else
return false;
}
/**
* @brief Sets the platform options
*
* @param[in] options Options as a string in the form of "keyword:options"
*
* @return True if options are pass validation; otherwise false. If false, the options are not updated.
*/
bool setPlatformOptions(std::string options) {
std::string oldOptions = m_PlatformOptions;
m_PlatformOptions = options;
if (isOptionsValid()) {
return true;
} else {
m_PlatformOptions = oldOptions;
return false;
}
}
/**
* @brief Indicates whther the plaform configuration is valid.
*
* @return True if the platform configuration is valid; false otherwise.
*/
bool isOptionsValid() const;
/**
* @brief Gets the platform options
*
* @return Options as a string
*/
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++ */
}} //namespace end
#endif

View File

@@ -0,0 +1,154 @@
//=============================================================================
//
// Copyright (c) 2019 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include "ZdlExportDefine.hpp"
#include "DlSystem/DlEnums.hpp"
#include "DlSystem/StringList.hpp"
#include <cstddef>
#include <memory>
#ifndef DL_SYSTEM_RUNTIME_LIST_HPP
#define DL_SYSTEM_RUNTIME_LIST_HPP
namespace DlSystem
{
// Forward declaration of Runtime List implementation.
class RuntimeListImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing list of runtimes
*/
class ZDL_EXPORT RuntimeList final
{
public:
/**
* @brief .
*
* Creates a new runtime list
*
*/
RuntimeList();
/**
* @brief .
*
* copy constructor.
* @param[in] other object to copy.
*/
RuntimeList(const RuntimeList& other);
/**
* @brief .
*
* constructor with single Runtime_t object
* @param[in] Runtime_t object
*/
RuntimeList(const zdl::DlSystem::Runtime_t& runtime);
/**
* @brief .
*
* assignment operator.
*/
RuntimeList& operator=(const RuntimeList& other);
/**
* @brief .
*
* subscript operator.
*/
Runtime_t& operator[](size_t index);
/**
* @brief Adds runtime to the end of the runtime list
* order of precedence is former followed by latter entry
*
* @param[in] runtime to add
*
* Ruturns false If the runtime already exists
*/
bool add(const zdl::DlSystem::Runtime_t& runtime);
/**
* @brief Removes the runtime from the list
*
* @param[in] runtime to be removed
*
* @note If the runtime is not found, nothing is done.
*/
void remove(const zdl::DlSystem::Runtime_t runtime) noexcept;
/**
* @brief Returns the number of runtimes in the list
*/
size_t size() const noexcept;
/**
* @brief Returns true if the list is empty
*/
bool empty() const noexcept;
/**
* @brief .
*
* Removes all runtime from the list
*/
void clear() noexcept;
/**
* @brief .
*
* Returns a StringList of names from the runtime list in
* order of precedence
*/
zdl::DlSystem::StringList getRuntimeListNames() const;
/**
* @brief .
*
* @param[in] runtime string
* Returns a Runtime enum corresponding to the in param string
*
*/
static zdl::DlSystem::Runtime_t stringToRuntime(const char* runtimeStr);
/**
* @brief .
*
* @param[in] runtime
* Returns a string corresponding to the in param runtime enum
*
*/
static const char* runtimeToString(const zdl::DlSystem::Runtime_t runtime);
~RuntimeList();
private:
void deepCopy(const RuntimeList &other);
std::unique_ptr<::DlSystem::RuntimeListImpl> m_RuntimeListImpl;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_RUNTIME_LIST_HPP

View File

@@ -0,0 +1,104 @@
//=============================================================================
//
// Copyright (c) 2017, 2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#ifndef PLATFORM_STANDARD_STRING_HPP
#define PLATFORM_STANDARD_STRING_HPP
#include <cstdio>
#include <string>
#include <ostream>
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* Class for wrapping char * as a really stripped down std::string replacement.
*/
class ZDL_EXPORT String final
{
public:
String() = delete;
/**
* Construct a string from std::string reference.
* @param str Reference to a std::string
*/
explicit String(const std::string& str);
/**
* Construct a string from char* reference.
* @param a char*
*/
explicit String(const char* str);
/**
* move constructor.
*/
String(String&& other) noexcept;
/**
* copy constructor.
*/
String(const String& other) = delete;
/**
* assignment operator.
*/
String& operator=(const String&) = delete;
/**
* move assignment operator.
*/
String& operator=(String&&) = delete;
/**
* class comparators
*/
bool operator<(const String& rhs) const noexcept;
bool operator>(const String& rhs) const noexcept;
bool operator<=(const String& rhs) const noexcept;
bool operator>=(const String& rhs) const noexcept;
bool operator==(const String& rhs) const noexcept;
bool operator!=(const String& rhs) const noexcept;
/**
* class comparators against std::string
*/
bool operator<(const std::string& rhs) const noexcept;
bool operator>(const std::string& rhs) const noexcept;
bool operator<=(const std::string& rhs) const noexcept;
bool operator>=(const std::string& rhs) const noexcept;
bool operator==(const std::string& rhs) const noexcept;
bool operator!=(const std::string& rhs) const noexcept;
const char* c_str() const noexcept;
~String();
private:
char* m_string;
};
/**
* overloaded << operator
*/
ZDL_EXPORT std::ostream& operator<<(std::ostream& os, const String& str) noexcept;
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // PLATFORM_STANDARD_STRING_HPP

View File

@@ -0,0 +1,107 @@
//=============================================================================
//
// Copyright (c) 2016 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <cstdio>
#include "ZdlExportDefine.hpp"
#ifndef DL_SYSTEM_STRINGLIST_HPP
#define DL_SYSTEM_STRINGLIST_HPP
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* Class for holding an order list of null-terminated ASCII strings.
*/
class ZDL_EXPORT StringList final
{
public:
StringList() {}
/**
* Construct a string list with some pre-allocated memory.
* @warning Contents of the list will be uninitialized
* @param[in] length Number of elements for which to pre-allocate space.
*/
explicit StringList(size_t length);
/**
* Append a string to the list.
* @param[in] str Null-terminated ASCII string to append to the list.
*/
void append(const char* str);
/**
* Returns the string at the indicated position,
* or an empty string if the positions is greater than the size
* of the list.
* @param[in] idx Position in the list of the desired string
*/
const char* at(size_t idx) const noexcept;
/**
* Pointer to the first string in the list.
* Can be used to iterate through the list.
*/
const char** begin() const noexcept;
/**
* Pointer to one after the last string in the list.
* Can be used to iterate through the list.
*/
const char** end() const noexcept;
/**
* Return the number of valid string pointers held by this list.
*/
size_t size() const noexcept;
/**
* assignment operator.
*/
StringList& operator=(const StringList&) noexcept;
/**
* copy constructor.
* @param[in] other object to copy.
*/
StringList(const StringList& other);
/**
* move constructor.
* @param[in] other object to move.
*/
StringList(StringList&& other) noexcept;
~StringList();
private:
void copy(const StringList& other);
void resize(size_t length);
void clear();
static const char* s_Empty;
const char** m_Strings = nullptr;
const char** m_End = nullptr;
size_t m_Size = 0;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_STRINGLIST_HPP

View File

@@ -0,0 +1,120 @@
//=============================================================================
//
// Copyright (c) 2016 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <memory>
#include "ZdlExportDefine.hpp"
#include "ITensor.hpp"
#include "StringList.hpp"
#ifndef DL_SYSTEM_TENSOR_MAP_HPP
#define DL_SYSTEM_TENSOR_MAP_HPP
namespace DlSystem
{
// Forward declaration of tensor map implementation.
class TensorMapImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing the map of tensor.
*/
class ZDL_EXPORT TensorMap final
{
public:
/**
* @brief .
*
* Creates a new empty tensor map
*/
TensorMap();
/**
* copy constructor.
* @param[in] other object to copy.
*/
TensorMap(const TensorMap& other);
/**
* assignment operator.
*/
TensorMap& operator=(const TensorMap& other);
/**
* @brief Adds a name and the corresponding tensor pointer
* to the map
*
* @param[in] name The name of the tensor
* @param[out] tensor The pointer to the tensor
*
* @note If a tensor with the same name already exists, the
* tensor is replaced with the existing tensor.
*/
void add(const char *name, zdl::DlSystem::ITensor *tensor);
/**
* @brief Removes a mapping of tensor and its name by its name
*
* @param[in] name The name of tensor to be removed
*
* @note If no tensor with the specified name is found, nothing
* is done.
*/
void remove(const char *name) noexcept;
/**
* @brief Returns the number of tensors in the map
*/
size_t size() const noexcept;
/**
* @brief .
*
* Removes all tensors from the map
*/
void clear() noexcept;
/**
* @brief Returns the tensor given its name.
*
* @param[in] name The name of the tensor to get.
*
* @return nullptr if no tensor with the specified name is
* found; otherwise, a valid pointer to the tensor.
*/
zdl::DlSystem::ITensor* getTensor(const char *name) const noexcept;
/**
* @brief .
*
* Returns the names of all tensors
*/
zdl::DlSystem::StringList getTensorNames() const;
~TensorMap();
private:
void swap(const TensorMap &other);
std::unique_ptr<::DlSystem::TensorMapImpl> m_TensorMapImpl;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_TENSOR_MAP_HPP

View File

@@ -0,0 +1,203 @@
//=============================================================================
//
// Copyright (c) 2016 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <initializer_list>
#include <cstdio>
#include <memory>
#include <vector>
#include "ZdlExportDefine.hpp"
#ifndef DL_SYSTEM_TENSOR_SHAPE_HPP
#define DL_SYSTEM_TENSOR_SHAPE_HPP
namespace DlSystem
{
// Forward declaration of tensor shape implementation.
class TensorShapeImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* Convenient typedef to represent dimension
*/
using Dimension = size_t;
/**
* @brief .
*
* A class representing the shape of tensor. It is used at the
* time of creation of tensor.
*/
class ZDL_EXPORT TensorShape final
{
public:
/**
* @brief .
*
* Creates a new shape with a list of dims specified in
* initializer list fashion.
*
* @param[in] dims The dimensions are specified in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
*/
TensorShape(std::initializer_list<Dimension> dims);
/**
* @brief .
*
* Creates a new shape with a list of dims specified in array
*
* @param[in] dims The dimensions are specified in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
* @param[in] size Size of the array.
*
*/
TensorShape(const Dimension *dims, size_t size);
/**
* @brief .
*
* Creates a new shape with a vector of dims specified in
* vector fashion.
*
* @param[in] dims The dimensions are specified in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
*/
TensorShape(std::vector<Dimension> dims);
/**
* @brief .
*
* copy constructor.
* @param[in] other object to copy.
*/
TensorShape(const TensorShape& other);
/**
* @brief .
*
* assignment operator.
*/
TensorShape& operator=(const TensorShape& other);
/**
* @brief .
*
* Creates a new shape with no dims. It can be extended later
* by invoking concatenate.
*/
TensorShape();
/**
* @brief .
*
* Concatenates additional dimensions specified in
* initializer list fashion to the existing dimensions.
*
* @param[in] dims The dimensions are specified in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
*/
void concatenate(std::initializer_list<Dimension> dims);
/**
* @brief .
*
* Concatenates additional dimensions specified in
* the array to the existing dimensions.
*
* @param[in] dims The dimensions are specified in which the last
* element of the vector represents the fastest varying
* dimension and the zeroth element represents the slowest
* varying, etc.
*
* @param[in] size Size of the array.
*
*/
void concatenate(const Dimension *dims, size_t size);
/**
* @brief .
*
* Concatenates an additional dimension to the existing
* dimensions.
*
* @param[in] dim The dimensions are specified in which the last element
* of the vector represents the fastest varying dimension and the
* zeroth element represents the slowest varying, etc.
*
*/
void concatenate(const Dimension &dim);
/**
* @brief .
*
* Retrieves a single dimension, based on its index.
*
* @return The value of dimension
*
* @throws std::out_of_range if the index is >= the number of
* dimensions (or rank).
*/
Dimension& operator[](size_t index);
Dimension& operator[](size_t index) const;
/**
* @brief .
*
* Retrieves the rank i.e. number of dimensions.
*
* @return The rank
*/
size_t rank() const;
/**
* @brief .
*
* Retrieves a pointer to the first dimension of shape
*
* @return nullptr if no dimension exists; otherwise, points to
* the first dimension.
*
*/
const Dimension* getDimensions() const;
~TensorShape();
private:
void swap(const TensorShape &other);
std::unique_ptr<::DlSystem::TensorShapeImpl> m_TensorShapeImpl;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_TENSOR_SHAPE_HPP

View File

@@ -0,0 +1,127 @@
//=============================================================================
//
// Copyright (c) 2017-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <initializer_list>
#include <cstdio>
#include <memory>
#include "ZdlExportDefine.hpp"
#include "DlSystem/TensorShape.hpp"
#include "DlSystem/StringList.hpp"
#ifndef DL_SYSTEM_TENSOR_SHAPE_MAP_HPP
#define DL_SYSTEM_TENSOR_SHAPE_MAP_HPP
namespace DlSystem
{
// Forward declaration of tensor shape map implementation.
class TensorShapeMapImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing the map of names and tensorshapes.
*/
class ZDL_EXPORT TensorShapeMap final
{
public:
/**
* @brief .
*
* Creates a new tensor shape map
*
*/
TensorShapeMap();
/**
* @brief .
*
* copy constructor.
* @param[in] other object to copy.
*/
TensorShapeMap(const TensorShapeMap& other);
/**
* @brief .
*
* assignment operator.
*/
TensorShapeMap& operator=(const TensorShapeMap& other);
/**
* @brief Adds a name and the corresponding tensor pointer
* to the map
*
* @param[in] name The name of the tensor
* @param[out] tensor The pointer to the tensor
*
* @note If a tensor with the same name already exists, no new
* tensor is added.
*/
void add(const char *name, const zdl::DlSystem::TensorShape& tensorShape);
/**
* @brief Removes a mapping of tensor and its name by its name
*
* @param[in] name The name of tensor to be removed
*
* @note If no tensor with the specified name is found, nothing
* is done.
*/
void remove(const char *name) noexcept;
/**
* @brief Returns the number of tensors in the map
*/
size_t size() const noexcept;
/**
* @brief .
*
* Removes all tensors from the map
*/
void clear() noexcept;
/**
* @brief Returns the tensor given its name.
*
* @param[in] name The name of the tensor to get.
*
* @return nullptr if no tensor with the specified name is
* found; otherwise, a valid pointer to the tensor.
*/
zdl::DlSystem::TensorShape getTensorShape(const char *name) const noexcept;
/**
* @brief .
*
* Returns the names of all tensor shapes
*/
zdl::DlSystem::StringList getTensorShapeNames() const;
~TensorShapeMap();
private:
void swap(const TensorShapeMap &other);
std::unique_ptr<::DlSystem::TensorShapeMapImpl> m_TensorShapeMapImpl;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_TENSOR_SHAPE_MAP_HPP

View File

@@ -0,0 +1,243 @@
//==============================================================================
//
// Copyright (c) 2016-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef UDL_CONTEXT_HPP
#define UDL_CONTEXT_HPP
#include <cstring> // memset
#include <tuple>
#include "ZdlExportDefine.hpp"
namespace zdl { namespace DlSystem {
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* UDLContext holds the user defined layer context which
* consists of a layer name, layer ID, blob and blob size.
*
* An instance of UDLContext is passed as an argument to the
* UDLFactoryFunc provided by the user every time the SNPE
* runtime encounters an unknown layer descriptor. The instance
* of a UDLContext is created by the SNPE runtime and is
* consumed by the user's factory function. The user should
* obtain a copy of this class and should not assume any
* prolonged object lifetime beyond the UDLFactoryFunction.
*/
class ZDL_EXPORT UDLContext final {
public:
/**
* @brief Constructor
*
* @param[in] name name of the layer
*
* @param[in] type layer type
*
* @param[in] id identifier for the layer
*
* @param[in] id Blob/bytes as packed by the user code as part of
* the Python converter script
*/
UDLContext(const std::string& name,
const std::string& type,
int32_t id,
const std::string& blob) :
m_Name(name), m_Type(type), m_Size(blob.size()), m_Id(id) {
// FIXME not dealing with alloc error
m_Buffer = new uint8_t[m_Size];
std::memcpy(m_Buffer, blob.data(), m_Size);
}
/**
* @brief .
*
* Empty constructor is useful for
* creating an empty UDLContext and then run copy constructor
* from a fully initialized one.
*/
explicit UDLContext() {}
/**
* @brief .
*
* destructor Deallocates any internal allocated memory
*/
~UDLContext() { release(); }
/**
* @brief .
*
* Deallocate any internally allocated memory
*/
void release() {
if (m_Buffer && m_Size)
std::memset(m_Buffer, 0, m_Size);
delete []m_Buffer;
m_Buffer = nullptr;
m_Size = 0;
}
/**
* @brief .
*
* Copy Constructor - makes a copy from ctx
*
* @param[in] ctx Source UDLContext to copy from
*/
UDLContext(const UDLContext& ctx) : m_Name(ctx.m_Name),
m_Type(ctx.m_Type),
m_Id(ctx.m_Id) {
std::tuple<uint8_t*, size_t> cpy = ctx.getCopy();
// current compiler does not support get<type>
m_Buffer = std::get<0>(cpy);
m_Size = std::get<1>(cpy);
}
/**
* @brief
*
* Assignment operator - makes a copy from ctx
*
* @param[in] ctx Source UDLContext to copy from
*
* @return this
*/
UDLContext& operator=(const UDLContext& ctx) {
UDLContext c (ctx);
this->swap(c); // non throwing swap
return *this;
}
/**
* @brief .
*
* Move Constructor - Move internals from ctx into this
*
* @param[in] ctx Source UDLContext to move from
*/
UDLContext(UDLContext&& ctx) :
m_Name(std::move(ctx.m_Name)),
m_Type(std::move(ctx.m_Type)),
m_Buffer(ctx.m_Buffer),
m_Size(ctx.m_Size),
m_Id(ctx.m_Id) {
ctx.clear();
}
/**
* @brief .
*
* Assignment move - Move assignment operator from ctx
*
* @param[in] ctx Source UDLContext to move from
*
* @return this
*/
UDLContext& operator=(UDLContext&& ctx) {
m_Name = std::move(ctx.m_Name);
m_Type = std::move(ctx.m_Type);
m_Buffer = ctx.m_Buffer;
m_Size = ctx.m_Size;
m_Id = ctx.m_Id;
ctx.clear();
return *this;
}
/**
* @brief .
*
* Obtain the name of the layer
*
* @return const reference to the name of the layer
*/
const std::string& getName() const noexcept { return m_Name; }
/**
* @brief .
*
* Obtain the type of the layer
*
* @return const reference to the type of the layer
*/
const std::string& getType() const noexcept { return m_Type; }
/**
* @brief .
*
* Obtain the Id of the layer
*
* @return The id of the layer
*/
int32_t getId() const noexcept { return m_Id; }
/**
* @brief .
*
* Obtain the size of the blob
*
* @return Size of the internal blob
*/
size_t getSize() const noexcept { return m_Size; }
/**
* @brief .
*
* Get a const pointer to the internal blob
*
* @return Const pointer to the internal blob
*/
const uint8_t* getBlob() const noexcept { return m_Buffer; }
/**
* @brief .
*
* Get a copy of the blob/size into a tuple
*
* @return A tuple with a pointer to a copy of the blob and a
* size
*/
std::tuple<uint8_t*, size_t> getCopy() const {
uint8_t* buf = new uint8_t[m_Size];
// FIXME missing memcpy
std::memcpy(buf, m_Buffer, m_Size);
return std::make_tuple(buf, m_Size);
}
/**
* @brief .
*
* Set zeros in the internals members
*/
void clear() {
m_Name.clear();
m_Type.clear();
m_Buffer = 0;
m_Size = 0;
m_Id = -1;
}
private:
void swap(UDLContext& c) noexcept {
std::swap(m_Name, c.m_Name);
std::swap(m_Type, c.m_Type);
std::swap(m_Id, c.m_Id);
std::swap(m_Buffer, c.m_Buffer);
std::swap(m_Size, c.m_Size);
}
std::string m_Name; // name of the layer instance
std::string m_Type; // The actual layer type
uint8_t* m_Buffer = nullptr;
size_t m_Size = 0;
int32_t m_Id = -1;
};
}}
#endif /* UDL_CONTEXT_HPP */

View File

@@ -0,0 +1,87 @@
//==============================================================================
//
// Copyright (c) 2015-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef _UDL_FUNC_HPP_
#define _UDL_FUNC_HPP_
#include <functional>
#include "ZdlExportDefine.hpp"
#include <DlSystem/IUDL.hpp>
namespace zdl {
namespace DlSystem {
class UDLContext;
}
}
namespace zdl { namespace DlSystem {
/**
* NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE.
*
* @brief .
*
* Definition of UDLFactoyFunc, using/typedef and default FactoryFunction
* UDLBundle - a simple way to bundle func and cookie into one type
*/
/**
* @brief .
*
* Convenient typedef for user defined layer creation factory
*
* @param[out] void* Cookie - a user opaque data that was passed during SNPE's runtime's
* CreateInstance. SNPE's runtime is passing this back to the user.
*
* @param[out] DlSystem::UDLContext* - The specific Layer Description context what is passe
* SNPE runtime.
*
* @return IUDL* - a Concrete instance of IUDL derivative
*/
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
*
* @param[out] DlSystem::UDLContext* - The specific Layer Description context what is passe
* SNPE runtime.
*
* @param[out] void* Cookie - a user opaque data that was passed during SNPE's runtime's
* CreateInstance. SNPE's runtime is passing this back to the user.
*
* @return IUDL* - nullptr to indicate SNPE's runtime that there is no specific
* implementation for UDL. When SNPE's runtime sees nullptr as a return
* value from the factory, it will halt execution if model has an unknown layer
*
*/
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.
* A user defined cookie that would be returned for each
* IUDL call. The user can place anything there and the
* SNPE runtime will provide it back
*/
struct ZDL_EXPORT UDLBundle {
void *cookie = nullptr;
UDLFactoryFunc func = DefaultUDLFunc;
};
}}
#endif // _UDL_FUNC_HPP_

View File

@@ -0,0 +1,122 @@
//=============================================================================
//
// Copyright (c) 2017 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <memory>
#include "ZdlExportDefine.hpp"
#include "StringList.hpp"
#ifndef DL_SYSTEM_USER_BUFFER_MAP_HPP
#define DL_SYSTEM_USER_BUFFER_MAP_HPP
namespace DlSystem
{
// Forward declaration of UserBuffer map implementation.
class UserBufferMapImpl;
}
namespace zdl
{
namespace DlSystem
{
class IUserBuffer;
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing the map of UserBuffer.
*/
class ZDL_EXPORT UserBufferMap final
{
public:
/**
* @brief .
*
* Creates a new empty UserBuffer map
*/
UserBufferMap();
/**
* copy constructor.
* @param[in] other object to copy.
*/
UserBufferMap(const UserBufferMap& other);
/**
* assignment operator.
*/
UserBufferMap& operator=(const UserBufferMap& other);
/**
* @brief Adds a name and the corresponding UserBuffer pointer
* to the map
*
* @param[in] name The name of the UserBuffer
* @param[in] userBuffer The pointer to the UserBuffer
*
* @note If a UserBuffer with the same name already exists, the new
* UserBuffer pointer would be updated.
*/
void add(const char *name, zdl::DlSystem::IUserBuffer *buffer);
/**
* @brief Removes a mapping of one UserBuffer and its name by its name
*
* @param[in] name The name of UserBuffer 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 UserBuffers in the map
*/
size_t size() const noexcept;
/**
* @brief .
*
* Removes all UserBuffers from the map
*/
void clear() noexcept;
/**
* @brief Returns the UserBuffer given its name.
*
* @param[in] name The name of the UserBuffer to get.
*
* @return nullptr if no UserBuffer with the specified name is
* found; otherwise, a valid pointer to the UserBuffer.
*/
zdl::DlSystem::IUserBuffer* getUserBuffer(const char *name) const noexcept;
/**
* @brief .
*
* Returns the names of all UserBuffers
*
* @return A list of UserBuffer names.
*/
zdl::DlSystem::StringList getUserBufferNames() const;
~UserBufferMap();
private:
void swap(const UserBufferMap &other);
std::unique_ptr<::DlSystem::UserBufferMapImpl> m_UserBufferMapImpl;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
} // DlSystem namespace
} // zdl namespace
#endif // DL_SYSTEM_TENSOR_MAP_HPP

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

@@ -0,0 +1,13 @@
//=============================================================================
//
// Copyright (c) 2015, 2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#pragma once
#ifndef ZDL_EXPORT
#define ZDL_EXPORT
#endif