diff --git a/inference-engine/include/gpu/gpu_context_api_va.hpp b/inference-engine/include/gpu/gpu_context_api_va.hpp index 93ba0fd7388..0784c729db1 100644 --- a/inference-engine/include/gpu/gpu_context_api_va.hpp +++ b/inference-engine/include/gpu/gpu_context_api_va.hpp @@ -22,17 +22,17 @@ namespace InferenceEngine { namespace gpu { /** -* @brief This class represents an abstraction for GPU plugin remote context -* which is shared with VA display object. -* The plugin object derived from this class can be obtained either with -* GetContext() method of Executable network or using CreateContext() Core call. -* @note User can also obtain OpenCL context handle from this class. -*/ + * @brief This class represents an abstraction for GPU plugin remote context + * which is shared with VA display object. + * The plugin object derived from this class can be obtained either with + * GetContext() method of Executable network or using CreateContext() Core call. + * @note User can also obtain OpenCL context handle from this class. + */ class VAContext : public ClContext { public: /** - * @brief A smart pointer to the VAContext object - */ + * @brief A smart pointer to the VAContext object + */ using Ptr = std::shared_ptr; /** @@ -47,16 +47,16 @@ public: }; /** -* @brief This class represents an abstraction for GPU plugin remote blob -* which is shared with VA output surface. -* The plugin object derived from this class can be obtained with CreateBlob() call. -* @note User can also obtain OpenCL 2D image handle from this class. -*/ + * @brief This class represents an abstraction for GPU plugin remote blob + * which is shared with VA output surface. + * The plugin object derived from this class can be obtained with CreateBlob() call. + * @note User can also obtain OpenCL 2D image handle from this class. + */ class VASurfaceBlob : public ClImage2DBlob { public: /** - * @brief A smart pointer to the VASurfaceBlob object - */ + * @brief A smart pointer to the VASurfaceBlob object + */ using Ptr = std::shared_ptr; /** diff --git a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp index 31f77f93e0c..496f0974ad5 100644 --- a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp +++ b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp @@ -11,8 +11,8 @@ #pragma once /** -* @brief Definitions required by Khronos headers -*/ + * @brief Definitions required by Khronos headers + */ #ifndef CL_HPP_ENABLE_EXCEPTIONS # define CL_HPP_ENABLE_EXCEPTIONS diff --git a/inference-engine/include/gpu/gpu_params.hpp b/inference-engine/include/gpu/gpu_params.hpp index f7ccc86dcb0..eac4cd3f409 100644 --- a/inference-engine/include/gpu/gpu_params.hpp +++ b/inference-engine/include/gpu/gpu_params.hpp @@ -44,63 +44,65 @@ namespace GPUContextParams { #define DECLARE_GPU_PARAM_KEY(name, ...) \ static constexpr auto PARAM_##name = #name /** -* @brief Shared device context type: can be either pure OpenCL (OCL) -* or shared video decoder (VA_SHARED) context -*/ + * @brief Shared device context type: can be either pure OpenCL (OCL) + * or shared video decoder (VA_SHARED) context + */ DECLARE_GPU_PARAM_KEY(CONTEXT_TYPE, std::string); /** -* @brief Pure OpenCL device context -*/ + * @brief Pure OpenCL device context + */ DECLARE_GPU_PARAM_VALUE(OCL); /** -* @brief Shared context (video decoder or D3D) -*/ + * @brief Shared context (video decoder or D3D) + */ DECLARE_GPU_PARAM_VALUE(VA_SHARED); /** -* @brief This key identifies OpenCL context handle -* in a shared context or shared memory blob parameter map -*/ + * @brief This key identifies OpenCL context handle + * in a shared context or shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(OCL_CONTEXT, gpu_handle_param); /** -* @brief This key identifies video acceleration device/display handle -* in a shared context or shared memory blob parameter map -*/ + * @brief This key identifies video acceleration device/display handle + * in a shared context or shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(VA_DEVICE, gpu_handle_param); /** -* @brief This key identifies type of internal shared memory -* in a shared memory blob parameter map. -*/ + * @brief This key identifies type of internal shared memory + * in a shared memory blob parameter map. + */ DECLARE_GPU_PARAM_KEY(SHARED_MEM_TYPE, std::string); /** -* @brief Shared OpenCL buffer blob -*/ + * @brief Shared OpenCL buffer blob + */ DECLARE_GPU_PARAM_VALUE(OCL_BUFFER); /** -* @brief Shared OpenCL 2D image blob -*/ + * @brief Shared OpenCL 2D image blob + */ DECLARE_GPU_PARAM_VALUE(OCL_IMAGE2D); + /** -* @brief Shared video decoder surface or D3D 2D texture blob -*/ + * @brief Shared video decoder surface or D3D 2D texture blob + */ DECLARE_GPU_PARAM_VALUE(VA_SURFACE); + /** -* @brief Shared D3D buffer blob -*/ + * @brief Shared D3D buffer blob + */ DECLARE_GPU_PARAM_VALUE(DX_BUFFER); /** -* @brief This key identifies OpenCL memory handle -* in a shared memory blob parameter map -*/ + * @brief This key identifies OpenCL memory handle + * in a shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(MEM_HANDLE, gpu_handle_param); /** -* @brief This key identifies video decoder surface handle -* in a shared memory blob parameter map -*/ + * @brief This key identifies video decoder surface handle + * in a shared memory blob parameter map + */ #ifdef _WIN32 DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, gpu_handle_param); #else @@ -108,9 +110,9 @@ DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, uint32_t); #endif /** -* @brief This key identifies video decoder surface plane -* in a shared memory blob parameter map -*/ + * @brief This key identifies video decoder surface plane + * in a shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(VA_PLANE, uint32_t); } // namespace GPUContextParams diff --git a/inference-engine/include/ie_blob.h b/inference-engine/include/ie_blob.h index 4e1d2cd873a..2342d4cbcf5 100644 --- a/inference-engine/include/ie_blob.h +++ b/inference-engine/include/ie_blob.h @@ -335,12 +335,9 @@ public: return size() * element_size(); } - /** - * @brief Provides the number of bytes per element. - * Abstract method. - * @return The number of bytes per element. - */ - size_t element_size() const noexcept override = 0; + size_t element_size() const noexcept override { + return tensorDesc.getPrecision().size(); + } /** * @brief Allocates memory to store the data. @@ -569,10 +566,6 @@ public: */ virtual ~TBlob(); - size_t element_size() const noexcept override { - return sizeof(T); - } - /** * @brief Creates an new empty rvalue LockedMemory object. * diff --git a/inference-engine/include/ie_icnn_network.hpp b/inference-engine/include/ie_icnn_network.hpp index 55b98ba58c6..ec640691ecc 100644 --- a/inference-engine/include/ie_icnn_network.hpp +++ b/inference-engine/include/ie_icnn_network.hpp @@ -200,12 +200,30 @@ public: virtual StatusCode serialize(const std::string& xmlPath, const std::string& binPath, ResponseDesc* resp) const noexcept = 0; + /** + * @deprecated Use InferenceEngine::CNNNetwork wrapper instead + * @brief Serialize network to IR and weights files. + * + * @param xmlStream A stream for xml content (.xml file) + * @param binStream A stream for weights content (.bin file) + * @param resp Pointer to the response message that holds a description of an error if any occurred + * @return Status code of the operation + */ INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::CNNNetwork wrapper instead") - virtual StatusCode serialize(std::ostream& xmlFile, std::ostream& binFile, ResponseDesc* resp) const + virtual StatusCode serialize(std::ostream& xmlStream, std::ostream& binStream, ResponseDesc* resp) const noexcept = 0; + /** + * @deprecated Use InferenceEngine::CNNNetwork wrapper instead + * @brief Serialize network to IR and weights files. + * + * @param xmlStream A stream for xml content (.xml file) + * @param binData A blob for weights content (.bin file) + * @param resp Pointer to the response message that holds a description of an error if any occurred + * @return Status code of the operation + */ INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::CNNNetwork wrapper instead") - virtual StatusCode serialize(std::ostream& xmlPath, Blob::Ptr& binPath, ResponseDesc* resp) const + virtual StatusCode serialize(std::ostream& xmlStream, Blob::Ptr& binData, ResponseDesc* resp) const noexcept = 0; /** diff --git a/inference-engine/include/ie_precision.hpp b/inference-engine/include/ie_precision.hpp index e632d177235..28a7cf36abc 100644 --- a/inference-engine/include/ie_precision.hpp +++ b/inference-engine/include/ie_precision.hpp @@ -109,11 +109,6 @@ public: template bool hasStorageType(const char* typeName = nullptr) const noexcept { try { - if (precisionInfo.value != BIN) { - if (sizeof(T) != size()) { - return false; - } - } #define CASE(x, y) \ case x: \ return std::is_same() @@ -247,14 +242,14 @@ public: } /** - * @brief Returns size of single element of that precision in bits + * @brief Returns size of single element of that precision in bytes * @returns Number of bytes per element */ size_t size() const { if (precisionInfo.bitsSize == 0) { IE_THROW() << " cannot estimate element if precision is " << precisionInfo.name; } - return precisionInfo.bitsSize >> 3; + return (precisionInfo.bitsSize + 7) / 8; } /** @@ -461,7 +456,7 @@ inline Precision::PrecisionInfo Precision::makePrecisionInfo(const char* name) { Precision::PrecisionInfo info; info.name = name; - size_t nBits = precision == BIN ? 1 : 8; + size_t nBits = precision == BIN ? 1 : (precision == U4 || precision == I4) ? 4 : 8; info.bitsSize = nBits * type_size_or_zero::value_type>(); info.isFloat = PrecisionTrait::is_float; info.value = precision; diff --git a/inference-engine/include/ie_remote_context.hpp b/inference-engine/include/ie_remote_context.hpp index 960452b12c1..a6116fe6c0d 100644 --- a/inference-engine/include/ie_remote_context.hpp +++ b/inference-engine/include/ie_remote_context.hpp @@ -46,10 +46,6 @@ public: */ explicit RemoteBlob(const TensorDesc& tensorDesc): MemoryBlob(tensorDesc) {} - size_t element_size() const noexcept override { - return tensorDesc.getPrecision().size(); - } - /** * @brief Returns a map of device-specific parameters required for low-level * operations with underlying object. @@ -194,3 +190,4 @@ inline RemoteBlob::Ptr make_shared_blob(const TensorDesc& desc, RemoteContext::P } } // namespace InferenceEngine + diff --git a/inference-engine/src/gna_plugin/frontend/precision_ex.hpp b/inference-engine/src/gna_plugin/frontend/precision_ex.hpp index c29ec5e48a0..a5f86262deb 100644 --- a/inference-engine/src/gna_plugin/frontend/precision_ex.hpp +++ b/inference-engine/src/gna_plugin/frontend/precision_ex.hpp @@ -65,17 +65,6 @@ class TPrecision : public Precision { explicit TPrecision(const Precision::ePrecision value) : Precision(value) {} }; -template TPrecision createTPrecision() { - TPrecision cnt(InferenceEngine::Precision::fromType()); - return cnt; -} - -template -TPrecision::value_type> createTPrecision() { - TPrecision::value_type> cnt(T); - return cnt; -} - // special case for Mixed, or undefined precisions template <>