summaryrefslogtreecommitdiff
path: root/inference-engine/thirdparty/ade
diff options
context:
space:
mode:
Diffstat (limited to 'inference-engine/thirdparty/ade')
m---------inference-engine/thirdparty/ade0
-rw-r--r--inference-engine/thirdparty/ade/CMakeLists.txt7
-rw-r--r--inference-engine/thirdparty/ade/ade/CMakeLists.txt15
-rw-r--r--inference-engine/thirdparty/ade/ade/include/communication/callback_connector.hpp210
-rw-r--r--inference-engine/thirdparty/ade/ade/include/communication/comm_buffer.hpp204
-rw-r--r--inference-engine/thirdparty/ade/ade/include/communication/comm_interface.hpp82
-rw-r--r--inference-engine/thirdparty/ade/ade/include/edge.hpp50
-rw-r--r--inference-engine/thirdparty/ade/ade/include/execution_engine/backend.hpp52
-rw-r--r--inference-engine/thirdparty/ade/ade/include/execution_engine/executable.hpp30
-rw-r--r--inference-engine/thirdparty/ade/ade/include/execution_engine/execution_engine.hpp425
-rw-r--r--inference-engine/thirdparty/ade/ade/include/graph.hpp149
-rw-r--r--inference-engine/thirdparty/ade/ade/include/graph_listener.hpp38
-rw-r--r--inference-engine/thirdparty/ade/ade/include/handle.hpp108
-rw-r--r--inference-engine/thirdparty/ade/ade/include/helpers/search.hpp98
-rw-r--r--inference-engine/thirdparty/ade/ade/include/helpers/subgraphs.hpp385
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/alloc.hpp18
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_access_listener.hpp88
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_accessor.hpp108
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor.hpp93
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_ref.hpp109
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_view.hpp190
-rw-r--r--inference-engine/thirdparty/ade/ade/include/memory/memory_types.hpp27
-rw-r--r--inference-engine/thirdparty/ade/ade/include/metadata.hpp123
-rw-r--r--inference-engine/thirdparty/ade/ade/include/metatypes/metatypes.hpp135
-rw-r--r--inference-engine/thirdparty/ade/ade/include/node.hpp88
-rw-r--r--inference-engine/thirdparty/ade/ade/include/passes/check_cycles.hpp33
-rw-r--r--inference-engine/thirdparty/ade/ade/include/passes/communications.hpp34
-rw-r--r--inference-engine/thirdparty/ade/ade/include/passes/pass_base.hpp38
-rw-r--r--inference-engine/thirdparty/ade/ade/include/passes/topological_sort.hpp77
-rw-r--r--inference-engine/thirdparty/ade/ade/include/passmanager.hpp164
-rw-r--r--inference-engine/thirdparty/ade/ade/include/typed_graph.hpp212
-rw-r--r--inference-engine/thirdparty/ade/ade/include/typed_metadata.hpp85
-rw-r--r--inference-engine/thirdparty/ade/ade/source/alloc.cpp45
-rw-r--r--inference-engine/thirdparty/ade/ade/source/check_cycles.cpp73
-rw-r--r--inference-engine/thirdparty/ade/ade/source/edge.cpp98
-rw-r--r--inference-engine/thirdparty/ade/ade/source/execution_engine.cpp373
-rw-r--r--inference-engine/thirdparty/ade/ade/source/graph.cpp239
-rw-r--r--inference-engine/thirdparty/ade/ade/source/memory_accessor.cpp175
-rw-r--r--inference-engine/thirdparty/ade/ade/source/memory_descriptor.cpp72
-rw-r--r--inference-engine/thirdparty/ade/ade/source/memory_descriptor_ref.cpp151
-rw-r--r--inference-engine/thirdparty/ade/ade/source/memory_descriptor_view.cpp361
-rw-r--r--inference-engine/thirdparty/ade/ade/source/metadata.cpp96
-rw-r--r--inference-engine/thirdparty/ade/ade/source/metatypes.cpp129
-rw-r--r--inference-engine/thirdparty/ade/ade/source/node.cpp147
-rw-r--r--inference-engine/thirdparty/ade/ade/source/passes/communications.cpp545
-rw-r--r--inference-engine/thirdparty/ade/ade/source/search.cpp80
-rw-r--r--inference-engine/thirdparty/ade/ade/source/subgraphs.cpp296
-rw-r--r--inference-engine/thirdparty/ade/ade/source/topological_sort.cpp89
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/algorithm.hpp127
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/any.hpp145
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/assert.hpp78
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/callonce.hpp43
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/chain_range.hpp169
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/checked_cast.hpp115
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/container_helper.hpp57
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/filter_range.hpp86
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/func_ref.hpp59
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/hash.hpp20
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/intrusive_list.hpp261
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/iota_range.hpp220
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/map_range.hpp94
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/math.hpp34
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/md_cast.hpp27
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/md_io.hpp61
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/md_size.hpp121
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/md_span.hpp249
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/md_view.hpp580
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/memory_range.hpp261
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/range.hpp193
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/range_iterator.hpp89
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/tuple.hpp97
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/type_traits.hpp85
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/variant.hpp342
-rw-r--r--inference-engine/thirdparty/ade/common/include/util/zip_range.hpp92
74 files changed, 0 insertions, 10149 deletions
diff --git a/inference-engine/thirdparty/ade b/inference-engine/thirdparty/ade
new file mode 160000
+Subproject 0ba3b01dae7262f7828dc6fa65ef3a89fb371cd
diff --git a/inference-engine/thirdparty/ade/CMakeLists.txt b/inference-engine/thirdparty/ade/CMakeLists.txt
deleted file mode 100644
index 371dc028a..000000000
--- a/inference-engine/thirdparty/ade/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (C) 2018 Intel Corporation
-# SPDX-License-Identifier: Apache-2.0
-#
-set(CMAKE_CXX_STANDARD 11)
-
-include_directories(common/include)
-add_subdirectory(ade)
diff --git a/inference-engine/thirdparty/ade/ade/CMakeLists.txt b/inference-engine/thirdparty/ade/ade/CMakeLists.txt
deleted file mode 100644
index 23be8c5e8..000000000
--- a/inference-engine/thirdparty/ade/ade/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2018 Intel Corporation
-# SPDX-License-Identifier: Apache-2.0
-#
-project( ade )
-
-file( GLOB_RECURSE sources source/*.cpp )
-file( GLOB_RECURSE include *.hpp )
-
-if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wconversion -Wno-error=cpp" )
-endif()
-
-add_library( ${PROJECT_NAME} STATIC ${include} ${sources} )
-target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
-set_target_properties( ${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE True)
diff --git a/inference-engine/thirdparty/ade/ade/include/communication/callback_connector.hpp b/inference-engine/thirdparty/ade/ade/include/communication/callback_connector.hpp
deleted file mode 100644
index 9157fad0d..000000000
--- a/inference-engine/thirdparty/ade/ade/include/communication/callback_connector.hpp
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef CALLBACK_CONNECTOR_HPP
-#define CALLBACK_CONNECTOR_HPP
-
-#include <vector>
-#include <functional>
-#include <atomic>
-#include <memory>
-
-#include "util/assert.hpp"
-
-namespace ade
-{
-
-/// This is helper class to connect one or more consumers callabaks
-/// with one or more producer callbacks
-///
-/// All consumer callbacks will be notified when after each producer callbacks
-/// was called
-template<typename... Args>
-class CallbackConnector final
-{
-public:
- using CallbackT = std::function<void(Args...)>;
-
- CallbackConnector(int producersCount, int consumersCount);
- CallbackConnector(const CallbackConnector&) = delete;
- CallbackConnector& operator=(const CallbackConnector&) = delete;
-
- /// Add consumer callback to connector
- /// All consumer callbacks must be added before finalization
- ///
- /// @param callback Callback to be added. Must not be null.
- void addConsumerCallback(CallbackT callback);
-
- /// Get producer callback from connector
- /// This method must be called only after finalization
- ///
- /// @returns Callback to be called by producers. Will never be null.
- CallbackT getProducerCallback();
-
- /// Prepares producer callbacks
- /// No more consumers callback can be added after call to this method
- /// Producer callbacks can be retrieved only after call to this method
- ///
- /// @returns Resetter which will be used to reset internal reference counters
- /// or null
- std::function<void()> finalize();
-private:
- const int m_producersCount = 0;
- const int m_consumersCount = 0;
- std::vector<CallbackT> m_consumerCallbacks;
- CallbackT m_producerCallback;
-
- bool isFinalized() const;
-};
-
-template<typename... Args>
-CallbackConnector<Args...>::CallbackConnector(int producersCount, int consumersCount):
- m_producersCount(producersCount), m_consumersCount(consumersCount)
-{
- ASSERT(m_producersCount > 0);
- ASSERT(m_consumersCount > 0);
-}
-
-template<typename... Args>
-void CallbackConnector<Args...>::addConsumerCallback(typename CallbackConnector::CallbackT callback)
-{
- ASSERT(nullptr != callback);
- ASSERT(!isFinalized() && "Can't add callbacks to finalized comm node");
- m_consumerCallbacks.emplace_back(std::move(callback));
-}
-
-template<typename... Args>
-typename CallbackConnector<Args...>::CallbackT CallbackConnector<Args...>::getProducerCallback()
-{
- ASSERT(isFinalized() && "Can't get callbacks from unfinalized comm node");
- return m_producerCallback;
-}
-
-template<typename... Args>
-std::function<void()> CallbackConnector<Args...>::finalize()
-{
- ASSERT(!isFinalized() && "Finalized must called only once");
- ASSERT(!m_consumerCallbacks.empty());
- ASSERT(m_producersCount > 0);
- std::function<void()> resetter;
- if (1 == m_producersCount)
- {
- if (1 == m_consumerCallbacks.size())
- {
- // 1 producer and 1 consumer - connect them directly
- m_producerCallback = std::move(m_consumerCallbacks[0]);
- }
- else
- {
- // 1 producer and multiple consumers - wrap all consumers into functor
- // and assign it to producer
- struct Connector final
- {
- std::vector<CallbackT> consumerCallbacks;
-
- void operator()(Args... args)
- {
- for (auto& func: consumerCallbacks)
- {
- func(args...);
- }
- }
- };
- m_producerCallback = Connector{std::move(m_consumerCallbacks)};
- }
- }
- else
- {
- if (1 == m_consumerCallbacks.size())
- {
- // multiple producers and 1 consumer - wrap consumer into thread-safe reference-counted functor
- struct Connector final
- {
- const int initial;
- std::atomic<int> counter;
- CallbackT consumerCallback;
-
- Connector(int cnt, CallbackT&& func):
- initial(cnt), counter(cnt), consumerCallback(std::move(func)) {}
-
- void reset()
- {
- counter = initial;
- }
-
- void operator()(Args... args)
- {
- auto res = --counter;
- ASSERT(res >= 0);
- if (0 == res)
- {
- consumerCallback(args...);
- }
- }
- };
- auto connector = std::make_shared<Connector>(m_producersCount, std::move(m_consumerCallbacks[0]));
- m_producerCallback = [connector](Args... args)
- {
- (*connector)(args...);
- };
- resetter = [connector]()
- {
- connector->reset();
- };
- }
- else
- {
- // multiple producers and multiple consumers - wrap all consumers into thread-safe reference-counted functor
- struct Connector final
- {
- const int initial;
- std::atomic<int> counter;
- std::vector<CallbackT> consumerCallbacks;
-
- Connector(int cnt, std::vector<CallbackT>&& callbacks):
- initial(cnt), counter(cnt), consumerCallbacks(std::move(callbacks)) {}
-
- void reset()
- {
- counter = initial;
- }
-
- void operator()(Args... args)
- {
- auto res = --counter;
- ASSERT(res >= 0);
- if (0 == res)
- {
- for (auto& func: consumerCallbacks)
- {
- func(args...);
- }
- }
- }
- };
- auto connector = std::make_shared<Connector>(m_producersCount, std::move(m_consumerCallbacks));
- m_producerCallback = [connector](Args... args)
- {
- (*connector)(args...);
- };
- resetter = [connector]()
- {
- connector->reset();
- };
- }
- }
- ASSERT(nullptr != m_producerCallback);
- return std::move(resetter);
-}
-
-template<typename... Args>
-bool CallbackConnector<Args...>::isFinalized() const
-{
- return (nullptr != m_producerCallback);
-}
-
-}
-
-#endif // CALLBACK_CONNECTOR_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/communication/comm_buffer.hpp b/inference-engine/thirdparty/ade/ade/include/communication/comm_buffer.hpp
deleted file mode 100644
index dd0846856..000000000
--- a/inference-engine/thirdparty/ade/ade/include/communication/comm_buffer.hpp
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef COMM_BUFFER_HPP
-#define COMM_BUFFER_HPP
-
-#include "util/assert.hpp"
-
-#include "memory/memory_types.hpp"
-
-namespace ade
-{
-
-/// Interface to access data objects provided by implementations
-/// Beware: Methods of this interface can be called from unspecified threads
-/// Implementations must provide thread-safety
-class IDataBuffer
-{
-public:
- virtual ~IDataBuffer() = default;
-
- using Size = memory::DynMdSize;
- using View = memory::DynMdView<void>;
- using Span = memory::DynMdSpan;
-
- enum Access
- {
- Read,
- Write
- };
-
- struct MapId
- {
- /// View into buffer memory
- View view;
-
- /// Implementation-specific handle
- std::uintptr_t handle;
- };
-
- /// Access buffer memory
- ///
- /// @param span Area which user want to access
- /// @param access Access type (read/write)
- ///
- /// @returns MapId object containg host accessible memory view and
- /// some implementation-specific opaque handle
- virtual MapId map(const Span& span, Access access) = 0;
-
- /// Finish accessing buffer memory
- ///
- /// @param id MapId object obtained from successful call to IDataBuffer::map
- virtual void unmap(const MapId& id) = 0;
-
- /// This method must be called when implementation finished writing to the buffer
- /// during current execution cycle
- ///
- /// It is invalid to access memory for writing for the specified span
- /// during current execution cycle after call to this method
- ///
- /// It is invalid to access memory for reading for the specified span
- /// during current execution cycle before call to this method
- ///
- /// Each producer must call this method for the span received in ICommChannel::setBuffer
- /// before consumers can access it contents
- ///
- /// @param span Span received in ICommChannel::setBuffer
- virtual void finalizeWrite(const Span& span) = 0;
-
- /// This method must be called when implementation finished reading from the buffer
- /// during current execution cycle
- ///
- /// It is invalid to access memory for reading or writing for the specified span
- /// during current execution cycle after call to this method
- ///
- /// Each consumer must call this method for the span received in ICommChannel::setBuffer
- /// before finishing execution
- ///
- /// @param span Span received in ICommChannel::setBuffer
- virtual void finalizeRead(const Span& span) = 0;
-
- /// Returns memory alignment, guaranteed by current implementation
- /// Can be called during compilation and during execution
- ///
- /// @param span Area which alignment we want to query
- ///
- /// @returns Alignment guaranteed for each dimension of specified area
- virtual Size alignment(const Span& span) = 0;
-};
-
-/// Buffer wrapper which automatically applies offset to each buffer method call
-class DataBufferView final
-{
- using Span = memory::DynMdSpan;
- using Size = memory::DynMdSize;
-
- IDataBuffer* m_buffer = nullptr;
- Span m_span;
-
- Span fixSpan(const Span& span) const
- {
- Span ret = span + m_span.origin();
- for (auto i: util::iota(m_span.dims_count()))
- {
- ASSERT(ret[i].begin >= m_span[i].begin);
- ASSERT(ret[i].end <= m_span[i].end);
- }
- return ret;
- }
-public:
- DataBufferView() = default;
- DataBufferView(std::nullptr_t) {}
- DataBufferView(IDataBuffer* buff, const Span& span):
- m_buffer(buff), m_span(span) {}
-
- DataBufferView(const DataBufferView&) = default;
- DataBufferView& operator=(const DataBufferView&) = default;
- DataBufferView& operator=(std::nullptr_t)
- {
- m_buffer = nullptr;
- m_span = Span{};
- return *this;
- }
-
- /// Get original buffer
- ///
- /// @returns Buffer from which this view was created or null for default constructed view
- IDataBuffer* getBuffer() const
- {
- return m_buffer;
- }
-
- /// Get span of this buffer wrapper
- ///
- /// @returns Which part of the original buffer this view references to
- Span getSpan() const
- {
- return m_span;
- }
-
- /// Applies offset to span and calls IDataBuffer::map
- IDataBuffer::MapId map(const Span& span, IDataBuffer::Access access)
- {
- ASSERT(nullptr != m_buffer);
- return m_buffer->map(fixSpan(span), access);
- }
-
- /// Calls IDataBuffer::unmap
- void unmap(const IDataBuffer::MapId& id)
- {
- ASSERT(nullptr != m_buffer);
- m_buffer->unmap(id);
- }
-
- /// Calls IDataBuffer::finalizeWrite with current span
- void finalizeWrite()
- {
- ASSERT(nullptr != m_buffer);
- m_buffer->finalizeWrite(m_span);
- }
-
- /// Calls IDataBuffer::finalizeRead with current span
- void finalizeRead()
- {
- ASSERT(nullptr != m_buffer);
- m_buffer->finalizeRead(m_span);
- }
-
- /// Applies offset to span and calls IDataBuffer::alignment
- Size alignment(const Span& span)
- {
- ASSERT(nullptr != m_buffer);
- return m_buffer->alignment(fixSpan(span));
- }
-};
-
-class DataBufferMapper final
-{
- DataBufferView& m_view;
- IDataBuffer::MapId m_map_id;
-public:
- DataBufferMapper(DataBufferView& view, const memory::DynMdSpan& span, IDataBuffer::Access access):
- m_view(view), m_map_id(view.map(span, access)) {}
-
- DataBufferMapper(const DataBufferMapper&) = delete;
- DataBufferMapper& operator=(const DataBufferMapper&) = delete;
-
- ~DataBufferMapper()
- {
- m_view.unmap(m_map_id);
- }
-
- memory::DynMdView<void> view() const
- {
- ASSERT(nullptr != m_map_id.view);
- return m_map_id.view;
- }
-};
-
-}
-
-#endif // COMM_BUFFER_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/communication/comm_interface.hpp b/inference-engine/thirdparty/ade/ade/include/communication/comm_interface.hpp
deleted file mode 100644
index d18c209ae..000000000
--- a/inference-engine/thirdparty/ade/ade/include/communication/comm_interface.hpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef COMM_INTERFACE_HPP
-#define COMM_INTERFACE_HPP
-
-#include <memory>
-
-#include "memory/memory_types.hpp"
-
-#include "memory/memory_descriptor_ref.hpp"
-
-namespace ade
-{
-
-class IDataBuffer;
-class DataBufferView;
-
-/// Data communication interface between different implementataions
-class ICommChannel
-{
-public:
- virtual ~ICommChannel() = default;
-
- using Size = memory::DynMdSize;
- using View = memory::DynMdView<void>;
- using Span = memory::DynMdSpan;
-
- struct BufferDesc
- {
- /// Writers count for this buffer
- /// always greater than 0
- int writersCount = 0;
-
- /// Readers count for this buffer
- /// always greater than 0
- int readersCount = 0;
-
- /// Reference to memory descriptor
- /// Will never be null
- MemoryDescriptorRef memoryRef;
- };
-
- struct BufferPrefs
- {
- /// Preferred alignment for buffer data
- /// dimensions count must be equal to buffer dimensions count
- /// Each element must be power of two
- /// Implementation can set elements to 1 if it doesn't care about alignment
- Size preferredAlignment;
- };
-
- /// Implementation must return buffer memory preferences
- ///
- /// @param desc Buffer description
- ///
- /// @returns Buffer memory preferences
- virtual BufferPrefs getBufferPrefs(const BufferDesc& desc) = 0;
-
- /// Implementation can return buffer object if it supports efficient implementation or null
- /// If all participants returned nulls buffer will be allocated by framework
- /// Caller takes ownership of this buffer
- ///
- /// @param desc Buffer description
- /// @param prefs Buffer memory preferences
- ///
- /// @returns Buffer object instance or null, caller will take ownership of this object
- virtual std::unique_ptr<IDataBuffer> getBuffer(const BufferDesc& desc, const BufferPrefs& prefs) = 0;
-
- /// Framework will call the method for all participant after appropriate buffer was allocated
- /// (either by one of participants or by framework itself)
- /// Participant must store buffer object to be able to access its data during execution
- ///
- /// @param buffer Buffer object wrapper
- /// @param desc Buffer description
- virtual void setBuffer(const DataBufferView& buffer, const BufferDesc& desc) = 0;
-};
-}
-
-#endif // COMM_INTERFACE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/edge.hpp b/inference-engine/thirdparty/ade/ade/include/edge.hpp
deleted file mode 100644
index 18617729d..000000000
--- a/inference-engine/thirdparty/ade/ade/include/edge.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef EDGE_HPP
-#define EDGE_HPP
-
-#include <memory>
-#include <string>
-
-#include "handle.hpp"
-#include "metadata.hpp"
-
-namespace ade
-{
-
-class Graph;
-class Node;
-class Edge;
-using EdgeHandle = Handle<Edge>;
-using NodeHandle = Handle<Node>;
-
-class Edge final : public std::enable_shared_from_this<Edge>
-{
-public:
- NodeHandle srcNode() const;
- NodeHandle dstNode() const;
-private:
- friend class Graph;
- friend class Node;
-
- Edge(Node* prev, Node* next);
- ~Edge();
- Edge(const Edge&) = delete;
- Edge& operator=(const Edge&) = delete;
-
- Graph* getParent() const;
-
- void unlink();
- void resetPrevNode(Node* newNode);
- void resetNextNode(Node* newNode);
-
- Node* m_prevNode = nullptr;
- Node* m_nextNode = nullptr;
-};
-
-}
-
-#endif // EDGE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/execution_engine/backend.hpp b/inference-engine/thirdparty/ade/ade/include/execution_engine/backend.hpp
deleted file mode 100644
index 73b008dfc..000000000
--- a/inference-engine/thirdparty/ade/ade/include/execution_engine/backend.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef BACKEND_HPP
-#define BACKEND_HPP
-
-#include <memory>
-
-namespace util
-{
- class any;
-}
-
-namespace ade
-{
-
-class Graph;
-class Executable;
-class ExecutionEngineSetupContext;
-
-class BackendExecutable;
-
-class ExecutionBackend
-{
-public:
- virtual ~ExecutionBackend() = default;
-
- virtual void setupExecutionEngine(ExecutionEngineSetupContext& engine) = 0;
- virtual std::unique_ptr<BackendExecutable> createExecutable(const Graph& graph) = 0;
-};
-
-class BackendExecutable
-{
-protected:
- // Backward-compatibility stubs
- virtual void run() {}; // called by run(any)
- virtual void runAsync() {}; // called by runAsync(any)
-
-public:
- virtual ~BackendExecutable() = default;
-
- virtual void run(util::any &opaque); // Triggered by ADE engine
- virtual void runAsync(util::any &opaque); // Triggered by ADE engine
-
- virtual void wait() = 0;
- virtual void cancel() = 0;
-};
-}
-
-#endif // BACKEND_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/execution_engine/executable.hpp b/inference-engine/thirdparty/ade/ade/include/execution_engine/executable.hpp
deleted file mode 100644
index 57d2cc986..000000000
--- a/inference-engine/thirdparty/ade/ade/include/execution_engine/executable.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef EXECUTABLE_HPP
-#define EXECUTABLE_HPP
-
-namespace util
-{
- class any;
-}
-
-namespace ade
-{
-class Executable
-{
-public:
- virtual ~Executable() = default;
- virtual void run() = 0;
- virtual void run(util::any &opaque) = 0; // WARNING: opaque may be accessed from various threads.
-
- virtual void runAsync() = 0;
- virtual void runAsync(util::any &opaque) = 0; // WARNING: opaque may be accessed from various threads.
-
- virtual void wait() = 0;
-};
-}
-
-#endif // EXECUTABLE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/execution_engine/execution_engine.hpp b/inference-engine/thirdparty/ade/ade/include/execution_engine/execution_engine.hpp
deleted file mode 100644
index 4e24fe28f..000000000
--- a/inference-engine/thirdparty/ade/ade/include/execution_engine/execution_engine.hpp
+++ /dev/null
@@ -1,425 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef EXECUTION_ENGINE_HPP
-#define EXECUTION_ENGINE_HPP
-
-#include <memory>
-#include <vector>
-#include <utility>
-#include <functional>
-#include <initializer_list>
-#include <unordered_set>
-
-#include "util/assert.hpp"
-#include "util/map_range.hpp"
-#include "util/algorithm.hpp"
-#include "util/type_traits.hpp"
-
-#include "graph_listener.hpp"
-
-#include "passmanager.hpp"
-#include "passes/pass_base.hpp"
-
-namespace ade
-{
-
-class Graph;
-class Executable;
-class ExecutionBackend;
-
-class ExecutionEngine final
-{
-public:
- struct PassMapper final
- {
- const std::string& operator()(const std::pair<std::string, PassList<passes::PassContext>>& p) const
- {
- return p.first;
- }
- };
-
- using PassMan = PassManager<passes::PassContext>;
- struct PassDesc final
- {
- std::string stage;
- std::string pass;
- };
-
- using PassCallback = std::function<void(const PassDesc&, const passes::PassContext&)>;
-
- using StagesRange = util::MapRange<PassMan::StagesCRange, PassMapper>;
-
-
- ExecutionEngine();
- ExecutionEngine(const ExecutionEngine&) = delete;
- ExecutionEngine& operator=(const ExecutionEngine&) = delete;
- ~ExecutionEngine();
-
- /// Add callback called before each pass execution
- void addPrePassCallback(PassCallback callback);
-
- /// Add callback called after each pass execution
- void addPostPassCallback(PassCallback callback);
-
- /// Add backend to engine
- /// Engine takes ownership of backend object
- void addBackend(std::unique_ptr<ExecutionBackend>&& backend);
-
- /// Call backends initialization function
- void setupBackends();
-
- /// Run all registered passes on graph
- void runPasses(Graph& graph);
-
- /// Create executable from graph
- /// Caller must take ownership of returned executable
- /// Can return null if nothing to execute
- std::unique_ptr<Executable> createExecutable(const Graph& graph);
-
- /// Add lazy pass to engine
- /// Other passes can add lazy passes as dependencies
- /// Lazy pass listen to graph events via checker object (for list of events see IGraphListener)
- /// Checker can return false from event handler to invalidate corresponding pass
- /// Before execution of pass for any invalid lazy passes will be called operator() to make them valid again
- ///
- /// @param passName Name of the pass, must be unique ant not to be empty
- /// @param pass Pass object
- /// @param checker Checker object
- template<typename P, typename C>
- void addLazyPass(const std::string& passName, P&& pass, C&& checker)
- {
- m_lazyPasses.addPass(passName, std::forward<P>(pass), std::forward<C>(checker));
- }
-
- /// Adds lazy pass as final executable dependency
- /// It will be executed even if there are no passes depending on it
- /// @param lazyPassName Name of the pass, must be one the passes added via addLazyPass
- void addExecutableDependency(const std::string& lazyPassName);
-
- /// Add pass stage
- /// @param stageName Name of stage to be added, must not be empty
- void addPassStage(const std::string& stageName);
-
- /// Add pass stage before specified stage
- /// @param stageName Name of stage to be added, must not be empty
- /// @param prevStage Name of the previous stage, must not be empty
- void addPassStage(const std::string& stageName, const std::string& prevStage);
-
- /// Returns range with stages names
- StagesRange passStages() const;
-
- /// Add pass to specified stage
- /// @param stageName Name of the stage pass to be added, must not be empty
- /// @param passName Name of the pass, must not be empty
- /// @param pass Pass object
- template<typename T>
- void addPass(const std::string& stageName, const std::string& passName, T&& pass)
- {
- ASSERT(!stageName.empty());
- ASSERT(!passName.empty());
- addPass(stageName, passName, std::forward<T>(pass), std::initializer_list<const char*>{});
- }
-
- /// Add pass to specified stage
- /// @param stageName Name of the stage pass to be added, must not be empty
- /// @param passName Name of the pass, must not be empty
- /// @param pass Pass object
- /// @param lazyPassesNames List of lasy passes names from which this pass is depends
- template<typename T, typename Range>
- void addPass(const std::string& stageName, const std::string& passName, T&& pass, Range&& lazyPassesNames)
- {
- ASSERT(!stageName.empty());
- ASSERT(!passName.empty());
- m_passManager.addPass(stageName, PassWrapper<T>{{stageName, passName},
- *this,
- std::move(getLazyPasses(std::forward<Range>(lazyPassesNames))),
- std::forward<T>(pass)});
- }
-
- /// Add pass to specified stage
- /// @param stageName Name of the stage pass to be added, must not be empty
- /// @param passName Name of the pass, must not be empty
- /// @param pass Pass object
- /// @param lazyPassesNames List of lasy passes names from which this pass is depends
- template<typename T, typename NameT>
- void addPass(const std::string& stageName, const std::string& passName, T&& pass, std::initializer_list<NameT> lazyPassesNames)
- {
- ASSERT(!stageName.empty());
- ASSERT(!passName.empty());
- m_passManager.addPass(stageName, PassWrapper<T>{{stageName, passName},
- *this,
- std::move(getLazyPasses(lazyPassesNames)),
- std::forward<T>(pass)});
- }
-
-private:
- void prePass(const PassDesc& desc,
- const passes::PassContext& context);
- void postPass(const PassDesc& desc,
- const passes::PassContext& context);
-
- class LazyPassWrapper;
-
- template<typename Func>
- struct PassWrapper final
- {
- PassDesc desc;
- ExecutionEngine& engine;
- std::vector<LazyPassWrapper*> lazy_passes;
- Func func;
- void operator()(passes::PassContext& context) const
- {
- for (auto pass: lazy_passes)
- {
- ASSERT(nullptr != pass);
- pass->process(context);
- }
- engine.prePass(desc, context);
- func(context);
- engine.postPass(desc, context);
- }
- };
-
- struct CallbackList final
- {
- std::vector<PassCallback> callbacks;
-
- void call(const PassDesc& desc,
- const passes::PassContext& context) const;
-
- bool empty() const;
- };
-
- class LazyPassWrapper : public IGraphListener
- {
- protected:
- LazyPassWrapper* m_prev = nullptr;
- bool m_valid = false;
-
- bool isValid() const;
- bool isFirst() const;
- public:
- LazyPassWrapper(LazyPassWrapper* prev);
- virtual ~LazyPassWrapper();
-
- void reset();
-
- virtual void process(passes::PassContext& context) = 0;
- };
-
- template<typename BasePass, typename Checker>
- class LazyPassImpl final : public LazyPassWrapper
- {
- BasePass m_pass;
- Checker m_checker;
- public:
- template<typename P, typename C>
- LazyPassImpl(LazyPassWrapper* prev, P&& pass, C&& checker):
- LazyPassWrapper(prev),
- m_pass(std::forward<P>(pass)),
- m_checker(std::forward<C>(checker))
- {}
-
- LazyPassImpl(const LazyPassImpl&) = delete;
- LazyPassImpl& operator=(const LazyPassImpl&) = delete;
- LazyPassImpl(LazyPassImpl&&) = default;
- LazyPassImpl& operator=(LazyPassImpl&&) = default;
-
- virtual void process(passes::PassContext& context) override
- {
- if (!isValid())
- {
- m_pass(context);
- m_valid = true;
- }
- }
-
- virtual void nodeCreated(const Graph& graph, const NodeHandle& node) override
- {
- if (isValid())
- {
- m_valid = m_checker.nodeCreated(graph, node);
- }
-
- if (!isFirst())
- {
- m_prev->nodeCreated(graph, node);
- }
- }
-
- virtual void nodeAboutToBeDestroyed(const Graph& graph, const NodeHandle& node) override
- {
- if (isValid())
- {
- m_valid = m_checker.nodeAboutToBeDestroyed(graph, node);
- }
-
- if (!isFirst())
- {
- m_prev->nodeAboutToBeDestroyed(graph, node);
- }
- }
-
- virtual void edgeCreated(const Graph& graph, const EdgeHandle& edge) override
- {
- if (isValid())
- {
- m_valid = m_checker.edgeCreated(graph, edge);
- }
-
- if (!isFirst())
- {
- m_prev->edgeCreated(graph, edge);
- }
- }
-
- virtual void edgeAboutToBeDestroyed(const Graph& graph, const EdgeHandle& edge) override
- {
- if (isValid())
- {
- m_valid = m_checker.edgeAboutToBeDestroyed(graph, edge);
- }
-
- if (!isFirst())
- {
- m_prev->edgeAboutToBeDestroyed(graph, edge);
- }
- }
-
- virtual void edgeAboutToBeRelinked(const Graph& graph,
- const EdgeHandle& edge,
- const NodeHandle& newSrcNode,
- const NodeHandle& newDstNode) override
- {
- if (isValid())
- {
- m_valid = m_checker.edgeAboutToBeRelinked(graph, edge, newSrcNode, newDstNode);
- }
-
- if (!isFirst())
- {
- m_prev->edgeAboutToBeRelinked(graph, edge, newSrcNode, newDstNode);
- }
- }
- };
-
- struct LazyPasses final
- {
- LazyPassWrapper* last = nullptr;
- std::unordered_map<std::string, std::unique_ptr<LazyPassWrapper>> passes;
-
- template<typename P, typename C>
- void addPass(const std::string& name, P&& pass, C&& checker)
- {
- ASSERT(!name.empty());
- ASSERT(!util::contains(passes, name));
- std::unique_ptr<LazyPassWrapper> wrapper;
- ASSERT(passes.empty() == (nullptr == last));
- using PassT = LazyPassImpl<util::remove_reference_t<P>,util::remove_reference_t<C> >;
- wrapper.reset(new PassT(last, std::forward<P>(pass), std::forward<C>(checker)));
- auto it = passes.emplace(std::make_pair(name, std::move(wrapper))).first;
- last = it->second.get();
- ASSERT(nullptr != last);
- }
-
- IGraphListener* getListener() const;
- LazyPassWrapper* getPass(const std::string& name) const;
- void reset();
- };
-
- template<typename Range>
- std::vector<LazyPassWrapper*> getLazyPasses(const Range& names) const
- {
- std::vector<LazyPassWrapper*> ret;
- for (auto&& name: names)
- {
- ASSERT(!std::string(name).empty());
- ret.emplace_back(m_lazyPasses.getPass(name));
- }
- return ret;
- }
-
- std::vector<std::unique_ptr<ExecutionBackend>> m_backends;
-
- CallbackList m_prePassCallbacks;
- CallbackList m_postPassCallbacks;
-
- LazyPasses m_lazyPasses;
- std::unordered_set<std::string> m_executableDependencies;
-
- PassMan m_passManager;
-};
-
-class ExecutionEngineSetupContext final
-{
-public:
- using PassCallback = ExecutionEngine::PassCallback;
- using StagesRange = ExecutionEngine::StagesRange;
-
- ExecutionEngineSetupContext(ExecutionEngine& e);
- ExecutionEngineSetupContext(const ExecutionEngineSetupContext&) = delete;
- ExecutionEngineSetupContext& operator=(const ExecutionEngineSetupContext&) = delete;
-
- /// Add pre pass callback to the list
- void addPrePassCallback(PassCallback callback);
-
- /// Add post pass callback to the list
- void addPostPassCallback(PassCallback callback);
-
- /// Add lazy pass to engine
- /// @param passName Name of the pass, must be unique ant not to be empty
- /// @param pass Pass object
- template<typename T>
- void addLazyPass(const std::string& passName, T&& pass)
- {
- m_engine.addLazyPass(passName, std::forward<T>(pass));
- }
-
- /// Adds lazy pass as final executable dependency
- /// It will be executed even if there are no passes depending on it
- /// @param lazyPassName Name of the pass, must be one the passes added via addLazyPass
- void addExecutableDependency(const std::string& lazyPassName);
-
- /// Add pass stage
- /// @param stageName Name of stage to be added, must not be empty
- void addPassStage(const std::string& stageName);
-
- /// Add pass stage before specified stage
- /// @param stageName Name of stage to be added, must not be empty
- /// @param prevStage Name of the previous stage, must not be empty
- void addPassStage(const std::string& stageName, const std::string& prevStage);
-
- /// Returns range with stages names
- StagesRange passStages() const;
-
- /// Add pass to specified stage
- /// @param stageName Name of the stage pass to be added, must not be empty
- /// @param passName Name of the pass, must not be empty
- /// @param pass Pass object
- template<typename T>
- void addPass(const std::string& stageName, const std::string& passName, T&& pass)
- {
- m_engine.addPass(stageName, passName, std::forward<T>(pass));
- }
-
- /// Add pass to specified stage
- /// @param stageName Name of the stage pass to be added, must not be empty
- /// @param passName Name of the pass, must not be empty
- /// @param pass Pass object
- /// @param lazyPassesNames List of lasy passes names from which this pass is depends
- template<typename T, typename Range>
- void addPass(const std::string& stageName, const std::string& passName, T&& pass, Range&& lazyPassesNames)
- {
- m_engine.addPass(stageName, passName, std::forward<T>(pass), std::forward<Range>(lazyPassesNames));
- }
-
-private:
- ExecutionEngine& m_engine;
-};
-
-}
-
-#endif // EXECUTION_ENGINE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/graph.hpp b/inference-engine/thirdparty/ade/ade/include/graph.hpp
deleted file mode 100644
index 202a3c84d..000000000
--- a/inference-engine/thirdparty/ade/ade/include/graph.hpp
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef GRAPH_HPP
-#define GRAPH_HPP
-
-#include <memory>
-#include <vector>
-#include <unordered_map>
-
-#include "util/assert.hpp"
-#include "util/range.hpp"
-#include "util/map_range.hpp"
-
-#include "handle.hpp"
-#include "edge.hpp"
-#include "node.hpp"
-#include "metadata.hpp"
-
-namespace ade
-{
-
-class Node;
-class Edge;
-class IGraphListener;
-
-class Graph final
-{
-public:
- struct HandleMapper
- {
- template<typename T>
- Handle<T> operator()(T* obj) const
- {
- ASSERT(nullptr != obj);
- return Handle<T>(obj->shared_from_this());
- }
-
- template<typename T>
- Handle<T> operator()(const std::shared_ptr<T>& obj) const
- {
- ASSERT(nullptr != obj);
- return Handle<T>(obj);
- }
- };
-
- using EdgePtr = std::shared_ptr<Edge>;
- using EdgeList = std::vector<EdgePtr>;
-
- using NodePtr = std::shared_ptr<Node>;
- using NodesList = std::vector<NodePtr>;
- using NodesListRange = util::MapRange<util::IterRange<NodesList::iterator>, HandleMapper>;
- using NodesListCRange = util::MapRange<util::IterRange<NodesList::const_iterator>, HandleMapper>;
-
- Graph();
- ~Graph();
-
- /// Create new node
- NodeHandle createNode();
-
- /// Delete node and all connected edges from graph and null all handles pointing to it
- void erase(const NodeHandle& node);
-
- /// Delete all edges, connected to this node
- void unlink(const NodeHandle& node);
-
- /// Delete edge from graph and null all handles pointing to it
- void erase(const EdgeHandle& edge);
-
-
- /// Create new edge between src_node and dst_node
- EdgeHandle link(const NodeHandle& src_node, const NodeHandle& dst_node);
-
- /// Change src_edge destination node to dst_node
- /// noop if src_edge destination node is already dst_node
- /// returns src_edge
- EdgeHandle link(const EdgeHandle& src_edge, const NodeHandle& dst_node);
-
- /// Change dst_edge source node to src_node
- /// noop if dst_edge source node is already src_node
- /// returns dst_edge
- EdgeHandle link(const NodeHandle& src_node, const EdgeHandle& dst_edge);
-
- NodesListRange nodes();
- NodesListCRange nodes() const;
-
- MetadataId getMetadataId(const std::string& name) const;
-
- Metadata& metadata();
- const Metadata& metadata() const;
-
- Metadata& metadata(const NodeHandle handle);
- const Metadata& metadata(const NodeHandle handle) const;
-
- Metadata& metadata(const EdgeHandle handle);
- const Metadata& metadata(const EdgeHandle handle) const;
-
- void setListener(IGraphListener* listener);
- IGraphListener* getListener() const;
-private:
- friend class Node;
- friend class Edge;
-
- struct ElemDeleter final
- {
- void operator()(Node* node) const;
- void operator()(Edge* edge) const;
- };
-
- Graph(const Graph&) = delete;
- Graph& operator=(const Graph&) = delete;
-
- EdgeHandle createEdge(Node* src_node, Node* dst_node);
-
- void removeNode(Node* node);
- void removeEdge(Edge* edge);
-
- Metadata& geMetadataImpl(void* handle) const;
-
- NodesList m_nodes;
- EdgeList m_edges;
-
- struct Id
- {
- std::unique_ptr<char> p;
-
- Id():p(new char) {} // enforce identity
- Id(const Id&) = delete;
- Id& operator=(const Id&) = delete;
- Id(Id&&) = default;
- Id& operator=(Id&&) = default;
- };
-
- // To make getMetadataId() const
- mutable std::unordered_map<std::string, Id> m_ids;
-
- // We will create metadata lazily
- // Stores node/edge metadata per object ptr
- // Stores graph metadata per nullptr
- mutable std::unordered_map<void*, std::unique_ptr<Metadata>> m_metadata;
-
- IGraphListener* m_listener = nullptr;
-};
-
-}
-
-#endif // GRAPH_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/graph_listener.hpp b/inference-engine/thirdparty/ade/ade/include/graph_listener.hpp
deleted file mode 100644
index 9bb1eeb28..000000000
--- a/inference-engine/thirdparty/ade/ade/include/graph_listener.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef GRAPH_LISTENER_HPP
-#define GRAPH_LISTENER_HPP
-
-#include "handle.hpp"
-
-namespace ade
-{
-
-class Graph;
-class Node;
-class Edge;
-using EdgeHandle = Handle<Edge>;
-using NodeHandle = Handle<Node>;
-
-class IGraphListener
-{
-public:
- virtual ~IGraphListener() = default;
-
- virtual void nodeCreated(const Graph& graph, const NodeHandle& node) = 0;
- virtual void nodeAboutToBeDestroyed(const Graph& graph, const NodeHandle& node) = 0;
-
- virtual void edgeCreated(const Graph&, const EdgeHandle& edge) = 0;
- virtual void edgeAboutToBeDestroyed(const Graph& graph, const EdgeHandle& edge) = 0;
- virtual void edgeAboutToBeRelinked(const Graph& graph,
- const EdgeHandle& edge,
- const NodeHandle& newSrcNode,
- const NodeHandle& newDstNode) = 0;
-};
-
-}
-
-#endif // GRAPH_LISTENER_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/handle.hpp b/inference-engine/thirdparty/ade/ade/include/handle.hpp
deleted file mode 100644
index 8f4981d72..000000000
--- a/inference-engine/thirdparty/ade/ade/include/handle.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef HANDLE_HPP
-#define HANDLE_HPP
-
-#include <memory>
-#include <iosfwd>
-#include <functional> //std::hash
-
-#include "util/assert.hpp"
-
-namespace ade
-{
-
-// Non owning graph elements pointer
-// Elements owned by graph
-template<typename T>
-class Handle final
-{
- friend class Graph;
-
- std::weak_ptr<T> m_ptr;
-
- Handle(const std::shared_ptr<T>& obj):
- m_ptr(obj)
- {
- ASSERT(nullptr != obj);
- }
-
- static T* check(T* val)
- {
- ASSERT_STRONG(nullptr != val);
- return val;
- }
-
-public:
- Handle() = default;
- Handle(std::nullptr_t) {}
- Handle(const Handle&) = default;
- Handle& operator=(const Handle&) = default;
- Handle& operator=(std::nullptr_t) { m_ptr.reset(); return *this; }
- Handle(Handle&&) = default;
- Handle& operator=(Handle&&) = default;
-
- // Graphs not intended for multithreaded modification so this should be safe
- T* get() const { return m_ptr.lock().get(); }
-
- T& operator*() const { return *check(get()); }
-
- T* operator->() const { return check(get()); }
-
- bool operator==(const Handle& other) const
- {
- return get() == other.get();
- }
-
- bool operator!=(const Handle& other) const
- {
- return get() != other.get();
- }
-
- friend bool operator==(std::nullptr_t, const Handle& other)
- {
- return nullptr == other.get();
- }
-
- friend bool operator==(const Handle& other, std::nullptr_t)
- {
- return nullptr == other.get();
- }
-
- friend bool operator!=(std::nullptr_t, const Handle& other)
- {
- return nullptr != other.get();
- }
-
- friend bool operator!=(const Handle& other, std::nullptr_t)
- {
- return nullptr != other.get();
- }
-};
-
-template<typename T>
-inline std::ostream& operator<<(std::ostream& os, const Handle<T>& arg)
-{
- os << arg.get();
- return os;
-}
-
-/// Generally it is not safe to use handles as keys so we dont provide default
-/// hash, user must use this hasher explicitly if he really want to
-template<typename T>
-struct HandleHasher final
-{
- std::size_t operator()(const ade::Handle<T>& handle) const
- {
- ASSERT(nullptr != handle);
- return std::hash<decltype(handle.get())>()(handle.get());
- }
-};
-
-
-}
-
-#endif // HANDLE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/helpers/search.hpp b/inference-engine/thirdparty/ade/ade/include/helpers/search.hpp
deleted file mode 100644
index db517bcda..000000000
--- a/inference-engine/thirdparty/ade/ade/include/helpers/search.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef SEARCH_HPP
-#define SEARCH_HPP
-
-#include <unordered_set>
-#include <unordered_map>
-
-#include <node.hpp>
-
-#include <util/algorithm.hpp>
-#include <util/assert.hpp>
-#include <util/func_ref.hpp>
-
-namespace ade
-{
-namespace traverse
-{
-using traverse_func_type
- = util::func_ref<void (const Node&,
- util::func_ref<void (const NodeHandle&)>)>;
-inline void forward(const Node& node,
- util::func_ref<void (const NodeHandle&)> visitor)
-{
- for (auto&& next : node.outNodes())
- {
- visitor(next);
- }
-}
-inline void backward(const Node& node,
- util::func_ref<void (const NodeHandle&)> visitor)
-{
- for (auto&& next : node.inNodes())
- {
- visitor(next);
- }
-}
-} // namespace ade::traverse
-
-/// Depth first search through node output edges
-///
-/// @param node - Start node, must not be null
-/// @param visitor - Functor called for each found node,
-/// can return true to continue search though found node output edges
-void dfs(const NodeHandle& node,
- util::func_ref<bool (const NodeHandle&)> visitor,
- traverse::traverse_func_type direction = traverse::forward);
-
-namespace details
-{
-struct TransitiveClosureHelper
-{
- using CacheT =
- std::unordered_map<NodeHandle,
- std::unordered_set<NodeHandle, HandleHasher<Node>>,
- HandleHasher<Node>>;
- void operator()(CacheT& cache,
- const NodeHandle& node,
- traverse::traverse_func_type direction) const;
-};
-}
-
-/// Enumerate all nodes reachable through outputs for each source node in
-/// provided list
-///
-/// @param nodes - List of nodes to check
-/// @param visitor - functor which will be called for pairs of nodes,
-/// first parameted is source node from provided list and
-/// second parameter is node reachable from this source node
-template<typename Nodes, typename Visitor>
-void transitiveClosure(
- Nodes&& nodes,
- Visitor&& visitor,
- traverse::traverse_func_type direction = traverse::forward)
-{
- using Helper = details::TransitiveClosureHelper;
- Helper::CacheT visited;
- for (auto node : nodes)
- {
- ASSERT(nullptr != node);
- if (!util::contains(visited, node))
- {
- Helper()(visited, node, direction);
- }
- ASSERT(util::contains(visited, node));
- for (auto nextNode : visited[node])
- {
- visitor(node, nextNode);
- }
- }
-}
-
-}
-
-#endif // SEARCH_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/helpers/subgraphs.hpp b/inference-engine/thirdparty/ade/ade/include/helpers/subgraphs.hpp
deleted file mode 100644
index 061599ec5..000000000
--- a/inference-engine/thirdparty/ade/ade/include/helpers/subgraphs.hpp
+++ /dev/null
@@ -1,385 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef SUBGRAPHS_HPP
-#define SUBGRAPHS_HPP
-
-#include <vector>
-#include <unordered_set>
-#include <utility>
-
-#include <node.hpp>
-
-#include <helpers/search.hpp>
-
-#include <util/assert.hpp>
-#include <util/algorithm.hpp>
-#include <util/func_ref.hpp>
-
-namespace ade
-{
-namespace details
-{
-template<typename Func>
-inline void enumSubgraphsHelper(const NodeHandle& node, Func&& func)
-{
- ASSERT(nullptr != node);
- for (auto edge: node->inEdges())
- {
- auto connected = edge->srcNode();
- if (func(connected, edge))
- {
- enumSubgraphsHelper(connected, std::forward<Func>(func));
- }
- }
- for (auto edge: node->outEdges())
- {
- auto connected = edge->dstNode();
- if (func(connected, edge))
- {
- enumSubgraphsHelper(connected, std::forward<Func>(func));
- }
- }
-}
-}
-
-/// Scan graph starting from roots and split it to subgraphs, separated by
-/// splitter.
-/// Only nodes accessible from roots through non-splitters will be scaned
-///
-/// @param roots Scan roots
-/// @param splitter Splitter functional object, take edge as parameter
-/// must return true if two nodes should be splitted to different subgraphs
-///
-/// @return list of subgraphs
-template<typename Nodes, typename Splitter>
-inline std::vector<std::vector<NodeHandle>> splitSubgraphs(Nodes&& roots,
- Splitter&& splitter)
-{
- std::vector<std::vector<NodeHandle>> ret;
- if (!roots.empty())
- {
- std::unordered_set<NodeHandle, HandleHasher<Node>> markedNodes;
- for (auto&& node: roots)
- {
- if (util::contains(markedNodes, node))
- {
- continue;
- }
- markedNodes.insert(node);
- std::vector<NodeHandle> nodesToAdd;
- nodesToAdd.emplace_back(node);
- details::enumSubgraphsHelper(node,
- [&](const ade::NodeHandle& connected,
- const ade::EdgeHandle& edge)
- {
- if (util::contains(markedNodes, connected) || splitter(edge))
- {
- return false;
- }
- markedNodes.insert(connected);
- nodesToAdd.emplace_back(connected);
- return true;
- });
- ret.emplace_back(std::move(nodesToAdd));
- }
- }
- return ret;
-}
-
-enum class SubgraphMergeDirection : int
-{
- In, /// Topologically previous node merged in current
- Out, /// Topologically next node merged in current
-};
-
-namespace subgraphs
-{
-using NodesSet = std::unordered_set<NodeHandle, HandleHasher<Node>>;
-}
-
-/// Get node which we are merging to current node
-///
-/// @param edge - edge we are processing
-/// @param dir - merge direction
-///
-/// @return node
-inline NodeHandle getSrcMergeNode(const EdgeHandle& edge,
- SubgraphMergeDirection dir)
-{
- ASSERT(nullptr != edge);
- return (SubgraphMergeDirection::In == dir ?
- edge->dstNode() :
- edge->srcNode());
-}
-
-/// Get node to which we are merging
-///
-/// @param edge - edge we are processing
-/// @param dir - merge direction
-///
-/// @return node
-inline NodeHandle getDstMergeNode(const EdgeHandle& edge,
- SubgraphMergeDirection dir)
-{
- ASSERT(nullptr != edge);
- return (SubgraphMergeDirection::In == dir ?
- edge->srcNode() :
- edge->dstNode());
-}
-
-/// Assemble subgraph starting from specified root node.
-/// Nodes are merged incrementally to root checking 2 conditions:
-/// 1) Node can be merged to adjacent node
-/// 2) Graph still topologically valid
-///
-/// @param root - root node from which we start subgraph assebly
-/// @param mergeChecker - must return true if from provided in edge can be
-/// merged
-/// @param topoChecker - must return true if graph is still topologically valid,
-/// takes 2 lists as parameters:
-/// acceptedNodes - nodes already in graph.
-/// rejectedNodes - nodes which will never be merged in subgraph
-/// Any nodes not in these lists are not yet processed, they will get to one of
-/// the list later
-///
-/// @return list of subgraph nodes, always contains root node
-std::vector<NodeHandle> assembleSubgraph(
- const NodeHandle& root,
- util::func_ref<bool(const EdgeHandle&,
- SubgraphMergeDirection)> mergeChecker,
- util::func_ref<bool(const subgraphs::NodesSet& acceptedNodes,
- const subgraphs::NodesSet& rejectedNodes)> topoChecker);
-
-/// Assemble multiple subgraphs starting from specified root nodes.
-/// Subgraphs can intersect.
-/// Nodes are merged incrementally to root checking 2 conditions:
-/// 1) Node can be merged to adjacent node
-/// 2) Graph still topologically valid
-/// When we can't expand subgraph any further we will start another from next
-/// unprocessed root node.
-/// We will end when there are no uprocessed root nodes remaning.
-///
-/// @param roots - root node from which we can start subgraphs assebly
-/// @param mergeChecker - must return true if from provided in edge can be
-/// merged
-/// @param topoChecker - must return true if graph is still topologically valid,
-/// takes 2 lists as parameters:
-/// acceptedNodes - nodes already in graph.
-/// rejectedNodes - nodes which will never be merged in subgraph
-/// Any nodes not in these lists are not yet processed, they will get to one of
-/// the list later
-///
-/// @return list of subgraphs
-template<typename NodesT, typename MChecker, typename TChecker>
-inline std::vector<std::vector<NodeHandle>> selectSubgraphs(
- NodesT&& roots,
- MChecker&& mergeChecker,
- TChecker&& topoChecker)
-{
- std::vector<std::vector<NodeHandle>> ret;
- subgraphs::NodesSet cannotBeRoots;
- for (auto&& root : roots)
- {
- if (!util::contains(cannotBeRoots, root))
- {
- auto nodes = assembleSubgraph(root,
- std::forward<MChecker>(mergeChecker),
- std::forward<TChecker>(topoChecker));
- if (!nodes.empty())
- {
- ret.emplace_back(std::move(nodes));
- for (auto&& node : ret.back())
- {
- cannotBeRoots.insert(node);
- }
- }
- }
- }
- return ret;
-}
-
-struct SubgraphSelectResult final
-{
- static constexpr const std::size_t NoSubgraph =
- static_cast<std::size_t>(-1);
- std::size_t index = NoSubgraph; /// Slected subgraph index or NoSubgraph
- bool continueSelect = false; /// Should we continue selection
-};
-
-/// Assemble multiple non-intersecting subgraphs starting from specified root
-/// nodes.
-/// Nodes are merged incrementally to root checking 2 conditions:
-/// 1) Node can be merged to adjacent node
-/// 2) Graph still topologically valid
-/// When we can't expand subgraph any further we will start another from next
-/// unprocessed root node.
-/// On each iteration all available subgraphs are passed to selector functor,
-/// selector must select one subgraph or abort selection.
-/// We will end when there are no uprocessed root nodes remaning or when
-/// selector return continueSelect == false.
-///
-/// @param roots - root node from which we can start subgraphs assebly
-/// @param mergeChecker - must return true if from provided in edge can be
-/// merged
-/// @param topoChecker - must return true if graph is still topologically valid,
-/// takes 2 lists as parameters:
-/// acceptedNodes - nodes already in graph.
-/// rejectedNodes - nodes which will never be merged in subgraph
-/// Any nodes not in these lists are not yet processed, they will get to one of
-/// the list later
-/// @param selector - recieves list of available subgraphs,
-/// must return SubgraphSelectResult
-///
-/// @return list of subgraphs
-template<typename NodesT,
- typename MChecker,
- typename TChecker,
- typename Selector>
-inline std::vector<std::vector<NodeHandle>> selectAllSubgraphs(
- NodesT&& roots,
- MChecker&& mergeChecker,
- TChecker&& topoChecker,
- Selector&& selector
- )
-{
- std::vector<std::vector<NodeHandle>> ret;
- subgraphs::NodesSet availableNodes(std::begin(roots), std::end(roots));
- while(true)
- {
- auto subgraphs = selectSubgraphs(
- availableNodes, [&](
- const EdgeHandle& edge,
- SubgraphMergeDirection dir)
- {
- auto dstNode = getDstMergeNode(edge, dir);
- if (!util::contains(availableNodes, dstNode))
- {
- return false;
- }
- return mergeChecker(edge, dir);
- },
- std::forward<TChecker>(topoChecker));
- if (subgraphs.empty())
- {
- break;
- }
- const SubgraphSelectResult res = selector(subgraphs);
- if (SubgraphSelectResult::NoSubgraph == res.index)
- {
- break;
- }
- ASSERT(res.index < subgraphs.size());
- ret.emplace_back(std::move(subgraphs[res.index]));
- if (res.continueSelect)
- {
- for (auto&& node : ret.back())
- {
- ASSERT(nullptr != node);
- availableNodes.erase(node);
- }
- }
- else
- {
- break;
- }
- }
- return ret;
-}
-
-/// Enumerate all paths throuh output edges from src node to dst node
-///
-/// @param src - Source node
-/// @param dst - Destination node
-/// @param visitor - visitor receives paths, should return true to abort
-/// iteration
-void findPaths(const NodeHandle& src, const NodeHandle& dst,
- util::func_ref<bool(const std::vector<NodeHandle>&)> visitor);
-
-/// Enumerate all paths throuh output edges from node1 node to node2 node and
-/// from node2 to node1
-///
-/// @param node1 - Source or destination node
-/// @param node2 - Source or destination node
-/// @param visitor - visitor receives paths, should return true to abort
-/// iteration
-template<typename Visitor>
-inline void findBiPaths(const NodeHandle& node1, const NodeHandle& node2,
- Visitor&& visitor)
-{
- bool found = false;
- (void)found; // Silence klocwork warning
- findPaths(node1, node2, [&](const std::vector<NodeHandle>& path)
- {
- found = visitor(path);
- return found;
- });
- if (!found)
- {
- findPaths(node2, node1, std::forward<Visitor>(visitor));
- }
-}
-
-/// This class checks subgraphs for self references
-struct SubgraphSelfReferenceChecker final
-{
- /// Check if there is self reference in subgraph, when some nodes if some
- /// nodes in subgraph are reachaeble by other nodes in subgraph through
- /// rejected nodes.
- /// Assuming nodes are never removed from rejected list.
- /// Accepts two node lists, first for nodes in subgraph,
- /// second for nodes not in subgraphs, nodes not included in lists
- /// are ignored.
- ///
- /// @param acceptedNodes - subgraph to check
- /// @param rejectedNodes - nodes not in subgraphs
- ///
- /// @return true if there is a self reference in subgraph
- bool operator()(const subgraphs::NodesSet& acceptedNodes,
- const subgraphs::NodesSet& rejectedNodes);
-
- /// Resets internal cache
- /// You must call this function if you are going to remove nodes from
- /// rejected list.
- void reset();
-
- /// Contructor
- ///
- /// @param nodes - all nodes in graph
- template<typename Nodes>
- SubgraphSelfReferenceChecker(Nodes&& nodes)
- {
- transitiveClosure(std::forward<Nodes>(nodes),
- [this](const NodeHandle& src,
- const NodeHandle& dst)
- {
- m_connections[src].insert(dst);
- });
- }
-
-private:
- using Connections =
- std::unordered_map<ade::NodeHandle,
- std::unordered_set<ade::NodeHandle, HandleHasher<Node>>,
- HandleHasher<Node>>;
-
- Connections m_connections;
-
- struct Hasher final
- {
- std::size_t operator()(
- const std::pair<ade::NodeHandle,ade::NodeHandle>& value) const;
- };
- using Cache = std::unordered_map<std::pair<ade::NodeHandle,ade::NodeHandle>,
- subgraphs::NodesSet,
- Hasher>;
- Cache m_cache;
-
- void updateCache(const std::pair<ade::NodeHandle,ade::NodeHandle>& key);
-};
-
-}
-
-#endif // SUBGRAPHS_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/alloc.hpp b/inference-engine/thirdparty/ade/ade/include/memory/alloc.hpp
deleted file mode 100644
index ce6f3d752..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/alloc.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef ALLOC_HPP
-#define ALLOC_HPP
-
-#include <cstddef> //size_t
-
-namespace ade
-{
-void* aligned_alloc(std::size_t size, std::size_t alignment);
-void aligned_free(void* ptr);
-
-}
-
-#endif // ALLOC_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_access_listener.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_access_listener.hpp
deleted file mode 100644
index 5651632da..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_access_listener.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef ADE_MEMORYACCESSLISTENER_HPP
-#define ADE_MEMORYACCESSLISTENER_HPP
-
-#include <memory>
-
-#include "util/assert.hpp"
-
-#include "memory/memory_types.hpp"
-
-namespace ade
-{
-
-class MemoryDescriptor;
-
-enum class MemoryAccessType
-{
- NoAccess,
- Read,
- Write,
- ReadWrite,
-};
-
-/// Listener used to notify internal objects
-/// when graph managed data is being accessed extenally
-class IMemoryAccessListener
-{
-public:
- virtual ~IMemoryAccessListener() {}
-
- using AccessHandle = void*;
-
- struct AccessHandleDeleter
- {
- IMemoryAccessListener* listener;
- void operator()(AccessHandle handle)
- {
- ASSERT(nullptr != listener);
- listener->commitImpl(handle);
- }
- };
-
- using AccessHandlePtr = std::unique_ptr<void, AccessHandleDeleter>;
-
- /// This method is called just before external user will be able to access data
- /// so listener can do required preparations (e.g. do OpenCL map or copy data from device)
- /// Listener can report errors via exceptions
- ///
- /// @param desc The memory descriptor to be accessed
- /// @param span Span that represents a ROI of current view to be accessed
- /// @param accessType Access type for this view, it can be Read, Write or ReadWrite
- /// @returns Listener specific handle which later will be passed to commitImpl
- /// Framework doesn't check this return value in any way
- virtual AccessHandle accessImpl(const MemoryDescriptor& desc, const memory::DynMdSpan& span, MemoryAccessType accessType) = 0;
-
- /// This method is called immediately after external user finished access to data
- /// This method must never throw
- ///
- /// @param handle Handle returned from successuful accessImpl call
- virtual void commitImpl(AccessHandle handle) = 0;
-
- /// This method called when externally accessible data view is about to change
- /// Listener must drop all references to old data and use new
- /// Listener can report errors via exceptions
- ///
- /// @param old_view Previous data, can be null if data wasn't externally accessible previously
- /// @param new_view New data, can be null
- virtual void memoryViewChangedImpl(const memory::DynMdView<void>& old_view,
- const memory::DynMdView<void>& new_view) = 0;
-
- /// This method is called when external memory descriptor is destroyed,
- /// so the listener can remove any objects created for it (OpenCL buffers, etc.)
- virtual void memoryDescriptorDestroyedImpl() = 0;
-
- AccessHandlePtr access(const MemoryDescriptor& desc, const memory::DynMdSpan& span, MemoryAccessType accessType)
- {
- return AccessHandlePtr(accessImpl(desc, span, accessType),
- AccessHandleDeleter{this});
- }
-};
-
-}
-
-#endif // ADE_MEMORYACCESSLISTENER_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_accessor.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_accessor.hpp
deleted file mode 100644
index 41f97aa78..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_accessor.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef ADE_MEMORYACCESSOR_HPP
-#define ADE_MEMORYACCESSOR_HPP
-
-#include <vector>
-#include <list>
-#include <functional>
-
-#include "memory/memory_types.hpp"
-
-#include "memory/memory_access_listener.hpp"
-
-namespace ade
-{
-
-/// This class is used to notify listeners about externally accessible
-/// data state changes
-class MemoryAccessor final
-{
- struct SavedHandles;
-public:
- MemoryAccessor();
- MemoryAccessor(const MemoryAccessor&) = delete;
- MemoryAccessor& operator=(const MemoryAccessor&) = delete;
- ~MemoryAccessor();
-
- /// Add events listener
- ///
- /// @param listener Listener to be added, must not be null
- /// Same listener must not be added twice
- void addListener(IMemoryAccessListener* listener);
-
- /// Remove events listener
- ///
- /// @param listener Listener to be removed, must not be null
- /// Listener must be previously added via addListener call
- void removeListener(IMemoryAccessListener* listener);
-
- using AccessHandle = std::list<SavedHandles>::iterator;
-
- /// Notify all listeners about memory access
- ///
- /// @param desc The memory descriptor to be accessed
- /// @param span Span that represents a ROI of current view to be accessed
- /// @param accessType Access type for this view, it must be Read, Write or ReadWrite
- /// @returns Handle which later will be passed to commit
- AccessHandle access(const MemoryDescriptor& desc, const memory::DynMdSpan& span, MemoryAccessType accessType);
-
- /// Notify all listeners about memory commit
- ///
- /// @param handle Handle returned from successuful access call
- void commit(AccessHandle handle);
-
- /// Update memory view and notify all listeners
- ///
- /// @param mem New memory view
- void setNewView(const memory::DynMdView<void>& mem);
-
- /// Set MemoryAccessor usage errors listener
- ///
- /// @param listener Errors listener with signature void(const char*)
- template<typename F>
- void setErrorListener(F&& listener)
- {
- m_errorListener = std::forward<F>(listener);
- }
-
-private:
- std::vector<IMemoryAccessListener*> m_accessListeners;
-
- memory::DynMdView<void> m_memory;
-
- struct SavedHandles
- {
- SavedHandles(MemoryAccessor* parent,
- const MemoryDescriptor& desc,
- const memory::DynMdSpan& span,
- MemoryAccessType accessType);
- ~SavedHandles();
- SavedHandles(const SavedHandles&) = delete;
- SavedHandles& operator=(const SavedHandles&) = delete;
- SavedHandles(SavedHandles&&) = default;
- SavedHandles& operator=(SavedHandles&&) = default;
-
- // optimization to reduce heap allocation for common case
- IMemoryAccessListener::AccessHandlePtr handle;
- std::vector<IMemoryAccessListener::AccessHandlePtr> handles;
-
- void abandon(IMemoryAccessListener* listener);
- void abandon();
- };
-
- std::list<SavedHandles> m_activeHandles;
-
- std::function<void(const char*)> m_errorListener;
-
- void abandonListenerHandles(IMemoryAccessListener* listener);
- void abandonAllHandles();
- void onError(const char* str);
-};
-
-}
-
-#endif // ADE_MEMORYACCESSOR_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor.hpp
deleted file mode 100644
index 0d4b46b8a..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef MEMORY_DESCRIPTOR_HPP
-#define MEMORY_DESCRIPTOR_HPP
-
-#include <util/memory_range.hpp>
-
-#include "memory/memory_types.hpp"
-#include "memory/memory_accessor.hpp"
-
-namespace ade
-{
-
-class MemoryDescriptorRef;
-class MemoryDescriptorView;
-
-/// This class represents continuous buffer used in graph
-/// It can have optional memory view, accessible to external users
-class MemoryDescriptor final
-{
-public:
- /// MemoryDescriptor constructor
- ///
- /// @param element_size Data element size in bytes
- /// @param dims Memory dimensions in elements
- explicit MemoryDescriptor(size_t element_size,
- const memory::DynMdSize& dims);
- MemoryDescriptor(const MemoryDescriptor&) = delete;
- MemoryDescriptor& operator=(const MemoryDescriptor&) = delete;
- ~MemoryDescriptor();
-
- /// Add events listener
- ///
- /// @param listener Listener to be added, must not be null
- /// Same listener must not be added twice
- void addListener(IMemoryAccessListener* listener);
-
- /// Remove events listener
- ///
- /// @param listener Listener to be removed, must not be null
- /// Listener must be previously added via addListener call
- void removeListener(IMemoryAccessListener* listener);
-
- using AccessHandle = MemoryAccessor::AccessHandle;
-
- /// Notify all listeners about memory access
- ///
- /// @param span Span that represents a ROI of current view to be accessed
- /// @param accessType Access type for this view, it must be Read, Write or ReadWrite
- /// @returns Handle which later will be passed to commit
- AccessHandle access(const memory::DynMdSpan& span, MemoryAccessType accessType);
-
- /// Notify all listeners about memory commit
- ///
- /// @param handle Handle returned from successuful access call
- void commit(AccessHandle handle);
-
- /// Get memory dimensions
- ///
- /// @returns Dimensions
- const memory::DynMdSize& dimensions() const;
-
- /// Get buffer element size
- ///
- /// @returns Size in bytes, always greater than 0
- std::size_t elementSize() const;
-
- /// Update externally accessible memory view and notify all listeners
- ///
- /// @param view New memory view
- void setExternalView(const memory::DynMdView<void>& view);
-
- /// Returns externally accessible memory view if any
- ///
- /// @returns View into externally accessible memory or null view
- memory::DynMdView<void> getExternalView() const;
-
-private:
- friend class MemoryDescriptorView;
-
- const size_t m_elementSize;
- const memory::DynMdSize m_dims;
- memory::DynMdView<void> m_externalView;
-
- MemoryAccessor m_accessor;
-};
-
-}
-
-#endif // MEMORY_DESCRIPTOR_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_ref.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_ref.hpp
deleted file mode 100644
index 3e22dcd13..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_ref.hpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef MEMORY_DESCRIPTOR_REF_HPP
-#define MEMORY_DESCRIPTOR_REF_HPP
-
-#include <iosfwd>
-
-#include "memory/memory_types.hpp"
-
-namespace ade
-{
-
-class MemoryDescriptor;
-class MemoryDescriptorView;
-
-/// Lghtweight reference into MemoryDescriptorView
-/// It can reference to a part of MemoryDescriptorView
-class MemoryDescriptorRef final
-{
-public:
- /// Constructs empty MemoryDescriptorRef
- MemoryDescriptorRef();
-
- /// Consructs MemoryDescriptorRef covering entire view
- ///
- /// @param view Source view
- MemoryDescriptorRef(MemoryDescriptorView& view);
-
- /// Consructs MemoryDescriptorRef covering part view
- ///
- /// @param view Source view
- /// @param span Span into descriptor view, must be inside view dimensions
- MemoryDescriptorRef(MemoryDescriptorView& view, const memory::DynMdSpan& span);
- ~MemoryDescriptorRef();
-
- MemoryDescriptorRef(const MemoryDescriptorRef&) = default;
- MemoryDescriptorRef(MemoryDescriptorRef&&) = default;
- MemoryDescriptorRef& operator=(const MemoryDescriptorRef&) = default;
- MemoryDescriptorRef& operator=(MemoryDescriptorRef&&) = default;
-
- /// Get source view
- ///
- /// @returns Source view
- MemoryDescriptorView* getView();
-
- /// Get source view
- ///
- /// @returns Source view
- const MemoryDescriptorView* getView() const;
-
- /// Get source descriptor
- ///
- /// @returns Source descriptor
- MemoryDescriptor* getDescriptor();
-
- /// Get source descriptor
- ///
- /// @returns Source descriptor
- const MemoryDescriptor* getDescriptor() const;
-
- /// Get span into current view
- ///
- /// @returns span
- const memory::DynMdSpan& span() const;
-
- /// Get span size
- ///
- /// @returns size
- memory::DynMdSize size() const;
-
- /// Get buffer element size
- ///
- /// @returns Size in bytes
- std::size_t elementSize() const;
-
- /// Get span into parent ref
- ///
- /// @returns span
- memory::DynMdSpan originSpan() const;
-
- /// Returns externally accessible memory view if any
- ///
- /// @returns View into externally accessible memory or null view
- memory::DynMdView<void> getExternalView() const;
-
- /// Check whether this object is null
- friend bool operator==(std::nullptr_t, const MemoryDescriptorRef& ref);
-
- /// Check whether this object is null
- friend bool operator==(const MemoryDescriptorRef& ref, std::nullptr_t);
-
- /// Check whether this object is null
- friend bool operator!=(std::nullptr_t, const MemoryDescriptorRef& ref);
-
- /// Check whether this object is null
- friend bool operator!=(const MemoryDescriptorRef& ref, std::nullptr_t);
-private:
- MemoryDescriptorView* m_parent = nullptr;
- memory::DynMdSpan m_span;
-};
-
-std::ostream& operator<<(std::ostream& os, const MemoryDescriptorRef& ref);
-
-}
-
-#endif // MEMORY_DESCRIPTOR_REF_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_view.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_view.hpp
deleted file mode 100644
index 27f5b5f17..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_descriptor_view.hpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef MEMORY_DESCRIPTOR_VIEW_HPP
-#define MEMORY_DESCRIPTOR_VIEW_HPP
-
-#include <memory>
-
-#include "memory/memory_types.hpp"
-#include "memory/memory_accessor.hpp"
-
-namespace ade
-{
-class MemoryDescriptor;
-
-/// MemoryDescriptorView events listener
-class IMemoryDescriptorViewListener
-{
-public:
- virtual ~IMemoryDescriptorViewListener() = default;
-
- /// This method is called when MemoryDescriptorView is about to be retargeted between
- /// different MemoryDescriptor's or between different parts of same descriptor
- ///
- /// @param oldDesc Previous descriptor
- /// @param oldSpan Previous span, always have size equal to span object initially created from
- /// @param newDes New descriptor
- /// @param newSpan New span, always have size equal to span object initially created from
- virtual void retarget(MemoryDescriptor& oldDesc, const memory::DynMdSpan& oldSpan,
- MemoryDescriptor& newDesc, const memory::DynMdSpan& newSpan) = 0;
-
- /// This method is called immediately after successful retarget
- virtual void retargetComplete() = 0;
-
- /// This method is called when MemoryDescriptorView is about to be destroyed
- virtual void destroy() = 0;
-};
-
-/// View into MemoryDescriptor buffer
-/// It can reference to a part of MemoryDescriptor buffer
-/// It can be retargetable, e.g. dynamically switched between different MemoryDescriptor's
-/// or different parts of MemoryDescriptor
-class MemoryDescriptorView final
-{
-public:
- enum RetargetableState
- {
- Retargetable,
- NonRetargetable,
- };
-
- /// Contructs empty MemoryDescriptorView, whick cannot be retargeted
- MemoryDescriptorView();
-
- /// Constructs MemoryDescriptorView from descriptor and span
- ///
- /// @param descriptor Source descriptor
- /// @param span Span into descriptor, must be inside descriptor dimensions
- /// @param retargetable Is this view can be retargeted or not
- MemoryDescriptorView(MemoryDescriptor& descriptor,
- const memory::DynMdSpan& span,
- RetargetableState retargetable = NonRetargetable);
-
- /// Constructs MemoryDescriptorView from another MemoryDescriptorView and span
- /// Retargetable state will be inherited from parent
- ///
- /// @param parent Source view
- /// @param span Span into descriptor, must be inside parent dimensions
- MemoryDescriptorView(MemoryDescriptorView& parent,
- const memory::DynMdSpan& span);
-
- ~MemoryDescriptorView();
-
- /// Retarged MemoryDescriptorView to a new descriptor
- /// MemoryDescriptorView must not be null and must be retargetable
- ///
- /// @param newParent New memory descriptor, can be same as previous
- /// @param newSpan New span must have same size as previous
- void retarget(MemoryDescriptor& newParent,
- const memory::DynMdSpan& newSpan);
-
- /// Retrieve retargetable state
- ///
- /// @returns Retargetable state
- RetargetableState retargetableState() const;
-
- /// Check this object is retargetable
- ///
- /// @returns True if this object is retargetable
- bool isRetargetable() const;
-
- /// Add event listener
- ///
- /// @param listener Listener to be added, must not be null
- /// Same listener must not be added twice
- void addListener(IMemoryDescriptorViewListener* listener);
-
- /// Remove event listener
- ///
- /// @param listener Listener to be removed, must not be null
- /// Listener must be previously added via addListener call
- void removeListener(IMemoryDescriptorViewListener* listener);
-
- /// Get current span
- ///
- /// @returns Current span
- memory::DynMdSpan span() const;
-
- /// Get span size
- ///
- /// @returns size
- memory::DynMdSize size() const;
-
- /// Get buffer element size
- ///
- /// @returns Size in bytes
- std::size_t elementSize() const;
-
- /// Get current descriptor
- ///
- /// @returns Current descriptor
- MemoryDescriptor* getDescriptor();
-
- /// Get current descriptor
- ///
- /// @returns Current descriptor
- const MemoryDescriptor* getDescriptor() const;
-
- /// Get parent view
- ///
- /// @returns Pointer to parent MemoryDescriptorView or null
- MemoryDescriptorView* getParentView();
-
- /// Get parent view
- ///
- /// @returns Pointer to parent MemoryDescriptorView or null
- const MemoryDescriptorView* getParentView() const;
-
- /// Returns externally accessible memory view if any
- ///
- /// @returns View into externally accessible memory or null view
- memory::DynMdView<void> getExternalView() const;
-
- using AccessHandle = MemoryAccessor::AccessHandle;
-
- /// Notify all listeners about memory access
- ///
- /// @param span Span that represents a ROI of current view to be accessed
- /// @param accessType Access type for this view, it must be Read, Write or ReadWrite
- /// @returns Handle which later will be passed to commit
- AccessHandle access(const memory::DynMdSpan& span, MemoryAccessType accessType);
-
- /// Notify all listeners about memory commit
- ///
- /// @param handle Handle returned from successuful access call
- void commit(AccessHandle handle);
-
- /// Check whether this object is null
- friend bool operator==(std::nullptr_t, const MemoryDescriptorView& ref);
-
- /// Check whether this object is null
- friend bool operator==(const MemoryDescriptorView& ref, std::nullptr_t);
-
- /// Check whether this object is null
- friend bool operator!=(std::nullptr_t, const MemoryDescriptorView& ref);
-
- /// Check whether this object is null
- friend bool operator!=(const MemoryDescriptorView& ref, std::nullptr_t);
-private:
- void checkSpans(MemoryDescriptor& descriptor) const;
-
- MemoryDescriptor* m_parent = nullptr;
- MemoryDescriptorView* m_parent_view = nullptr;
- memory::DynMdSpan m_span;
- RetargetableState m_retargetable = NonRetargetable;
-
- struct Connector;
- std::shared_ptr<Connector> m_connector;
-};
-
-void* getViewDataPtr(MemoryDescriptorView& view, std::size_t offset = 0);
-void copyFromViewMemory(void* dst, MemoryDescriptorView& view);
-void copyToViewMemory(const void* src, MemoryDescriptorView& view);
-void copyFromViewMemory(void* dst, memory::DynMdView<void> view);
-void copyToViewMemory(const void* src, memory::DynMdView<void> view);
-}
-
-#endif // MEMORY_DESCRIPTOR_VIEW_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/memory/memory_types.hpp b/inference-engine/thirdparty/ade/ade/include/memory/memory_types.hpp
deleted file mode 100644
index 48c8646bc..000000000
--- a/inference-engine/thirdparty/ade/ade/include/memory/memory_types.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef MEMORY_TYPES_HPP
-#define MEMORY_TYPES_HPP
-
-#include "util/md_size.hpp"
-#include "util/md_span.hpp"
-#include "util/md_view.hpp"
-
-namespace ade
-{
-namespace memory
-{
-static const constexpr std::size_t MaxDimensions = 6;
-using DynMdSize = util::DynMdSize<MaxDimensions>;
-using DynMdSpan = util::DynMdSpan<MaxDimensions>;
-
-template<typename T>
-using DynMdView = util::DynMdView<MaxDimensions, T>;
-
-}
-}
-
-#endif // MEMORY_TYPES_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/metadata.hpp b/inference-engine/thirdparty/ade/ade/include/metadata.hpp
deleted file mode 100644
index 48a3d1a1d..000000000
--- a/inference-engine/thirdparty/ade/ade/include/metadata.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef METADATA_HPP
-#define METADATA_HPP
-
-#include <unordered_map>
-#include <utility>
-
-#include "util/assert.hpp"
-#include "util/any.hpp"
-#include "util/range.hpp"
-
-namespace ade
-{
-
-class Graph;
-class Metadata;
-
-class MetadataId final
-{
- friend class Graph;
- friend class Metadata;
-
- MetadataId(void* id);
-
- void* m_id = nullptr;
-public:
- MetadataId() = default;
- MetadataId(std::nullptr_t) {}
- MetadataId(const MetadataId&) = default;
- MetadataId& operator=(const MetadataId&) = default;
- MetadataId& operator=(std::nullptr_t) { m_id = nullptr; return *this; }
-
- bool operator==(const MetadataId& other) const;
- bool operator!=(const MetadataId& other) const;
-
- bool isNull() const;
-};
-
-bool operator==(std::nullptr_t, const MetadataId& other);
-bool operator==(const MetadataId& other, std::nullptr_t);
-bool operator!=(std::nullptr_t, const MetadataId& other);
-bool operator!=(const MetadataId& other, std::nullptr_t);
-
-class Metadata final
-{
- struct IdHash final
- {
- std::size_t operator()(const MetadataId& id) const;
- };
-public:
- using MetadataStore = std::unordered_map<MetadataId, util::any, IdHash>;
- using MetadataRange = util::IterRange<MetadataStore::iterator>;
- using MetadataCRange = util::IterRange<MetadataStore::const_iterator>;
-
- Metadata();
-
- util::any& operator[](const MetadataId& id);
-
- bool contains(const MetadataId& id) const;
- void erase(const MetadataId& id);
-
- template<typename T>
- void set(const MetadataId& id, T&& val)
- {
- ASSERT(nullptr != id);
- m_data.erase(id);
- m_data.emplace(id, std::forward<T>(val));
- }
-
- template<typename T>
- T& get(const MetadataId& id)
- {
- ASSERT(nullptr != id);
- ASSERT(contains(id));
- auto ret = util::any_cast<T>(&(m_data.find(id)->second));
- ASSERT(nullptr != ret);
- return *ret;
- }
-
- template<typename T>
- const T& get(const MetadataId& id) const
- {
- ASSERT(nullptr != id);
- ASSERT(contains(id));
- auto ret = util::any_cast<T>(&(m_data.find(id)->second));
- ASSERT(nullptr != ret);
- return *ret;
- }
-
- template<typename T>
- T get(const MetadataId& id, T&& def) const
- {
- ASSERT(nullptr != id);
- auto it = m_data.find(id);
- if (m_data.end() == it)
- {
- return std::forward<T>(def);
- }
- auto ret = util::any_cast<T>(&(it->second));
- ASSERT(nullptr != ret);
- return *ret;
- }
-
- MetadataRange all();
- MetadataCRange all() const;
-
- /// This operation rarely needed so do it explicitly
- void copyFrom(const Metadata& data);
-
-private:
- Metadata(const Metadata&) = delete;
- Metadata& operator=(const Metadata&) = delete;
-
- MetadataStore m_data;
-};
-
-}
-
-#endif // METADATA_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/metatypes/metatypes.hpp b/inference-engine/thirdparty/ade/ade/include/metatypes/metatypes.hpp
deleted file mode 100644
index b0e57326b..000000000
--- a/inference-engine/thirdparty/ade/ade/include/metatypes/metatypes.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef METATYPES_HPP
-#define METATYPES_HPP
-
-#include <functional>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <memory/memory_descriptor_ref.hpp>
-
-namespace ade
-{
-class ICommChannel;
-class IDataBuffer;
-
-namespace meta
-{
-struct NodeInfo final
-{
- std::string kernel_name;
- std::string target_name;
-
- using NodeId = void*;
-
- NodeInfo() = default;
- NodeInfo(const std::string& kernel,
- const std::string& target);
- NodeInfo(const NodeInfo&) = default;
- NodeInfo& operator=(const NodeInfo&) = default;
- NodeInfo(NodeInfo&&) = default;
- NodeInfo& operator=(NodeInfo&&) = default;
-
- NodeId getId() const;
-
- void link(NodeInfo& node);
-
- static const char* name();
-private:
- struct IdStruct final
- {
- // Nothing
- };
-
- using IdPtr = std::shared_ptr<IdStruct>;
-
- // mutable to allocate id lazily
- mutable IdPtr m_id;
-
- IdPtr getIdInternal() const;
-};
-
-struct DataObject final
-{
- ade::MemoryDescriptorRef dataRef;
-
- std::string originalFormat; /// Original format of composite object
-
- static const char* name();
-};
-
-struct CommNode final
-{
- CommNode(int producersCount);
- CommNode(const CommNode&) = default;
- CommNode& operator=(const CommNode&) = default;
-
- int producersCount() const { return m_producersCount; }
-
- void addDataBuffer(const std::shared_ptr<ade::IDataBuffer>& buff);
-
- static const char* name();
-private:
- int m_producersCount = 0;
- std::vector<std::shared_ptr<ade::IDataBuffer>> m_buffers;
-};
-
-struct CommChannel final
-{
- std::shared_ptr<ade::ICommChannel> channel;
-
- static const char* name();
-};
-
-/// Backends must set this metadata to their consumer nodes in heterogeneous case.
-struct CommConsumerCallback final
-{
- using Callback = std::function<void(void)>;
-
- Callback callback;
-
- static const char* name();
-};
-
-/// The framework will set this metadata to producers nodes in heterogeneous case.
-/// Backends must use it in their executable representation.
-struct CommProducerCallback final
-{
- using Callback = std::function<void(void)>;
-
- Callback callback;
-
- static const char* name();
-};
-
-/// Store various finalizers which should run after graph execution completion
-struct Finalizers final
-{
- std::vector<std::function<void()>> finalizers;
-
- static const char* name();
-};
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::NodeInfo& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommNode& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommConsumerCallback& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommProducerCallback& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::DataObject& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommChannel& obj);
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::Finalizers& obj);
-
-}
-}
-
-#endif // METATYPES_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/node.hpp b/inference-engine/thirdparty/ade/ade/include/node.hpp
deleted file mode 100644
index 38f2bb33b..000000000
--- a/inference-engine/thirdparty/ade/ade/include/node.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef NODE_HPP
-#define NODE_HPP
-
-#include <vector>
-#include <utility>
-#include <memory>
-
-#include "util/range.hpp"
-#include "util/map_range.hpp"
-
-#include "edge.hpp"
-#include "handle.hpp"
-#include "metadata.hpp"
-
-namespace ade
-{
-
-class Graph;
-class Edge;
-class Node;
-using NodeHandle = Handle<Node>;
-
-class Node final : public std::enable_shared_from_this<Node>
-{
-public:
- struct HandleMapper final
- {
- EdgeHandle operator()(Edge* obj) const;
- };
- struct InEdgeMapper final
- {
- NodeHandle operator()(const EdgeHandle& handle) const;
- };
- struct OutEdgeMapper final
- {
- NodeHandle operator()(const EdgeHandle& handle) const;
- };
-
- using EdgeSet = std::vector<Edge*>;
- using EdgeSetRange = util::MapRange<util::IterRange<EdgeSet::iterator>, HandleMapper>;
- using EdgeSetCRange = util::MapRange<util::IterRange<EdgeSet::const_iterator>, HandleMapper>;
- using InNodeSetRange = util::MapRange<EdgeSetRange, InEdgeMapper>;
- using InNodeSetCRange = util::MapRange<EdgeSetCRange, InEdgeMapper>;
- using OutNodeSetRange = util::MapRange<EdgeSetRange, OutEdgeMapper>;
- using OutNodeSetCRange = util::MapRange<EdgeSetCRange, OutEdgeMapper>;
-
- EdgeSetRange inEdges();
- EdgeSetCRange inEdges() const;
-
- EdgeSetRange outEdges();
- EdgeSetCRange outEdges() const;
-
- InNodeSetRange inNodes();
- InNodeSetCRange inNodes() const;
-
- OutNodeSetRange outNodes();
- OutNodeSetCRange outNodes() const;
-private:
- friend class Graph;
- friend class Edge;
-
- Node(Graph* parent);
- ~Node();
- Node(const Node&) = delete;
- Node& operator=(const Node&) = delete;
-
- Graph* getParent() const;
-
- void unlink();
-
- void addInEdge(Edge* edge);
- void removeInEdge(Edge* edge);
- void addOutEdge(Edge* edge);
- void removeOutEdge(Edge* edge);
-
- Graph* m_parent = nullptr;
- EdgeSet m_inEdges;
- EdgeSet m_outEdges;
-};
-
-}
-
-#endif // NODE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/passes/check_cycles.hpp b/inference-engine/thirdparty/ade/ade/include/passes/check_cycles.hpp
deleted file mode 100644
index 26699a1bb..000000000
--- a/inference-engine/thirdparty/ade/ade/include/passes/check_cycles.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef CHECK_CYCLES_HPP
-#define CHECK_CYCLES_HPP
-
-#include <exception>
-#include <string>
-
-#include "passes/pass_base.hpp"
-
-namespace ade
-{
-
-namespace passes
-{
-class CycleFound : public std::exception
-{
-public:
- virtual const char* what() const noexcept override;
-};
-
-struct CheckCycles
-{
- void operator()(const PassContext& context) const;
- static std::string name();
-};
-}
-}
-
-#endif // CHECK_CYCLES_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/passes/communications.hpp b/inference-engine/thirdparty/ade/ade/include/passes/communications.hpp
deleted file mode 100644
index 601400fd6..000000000
--- a/inference-engine/thirdparty/ade/ade/include/passes/communications.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef COMMUNICATIONS_HPP
-#define COMMUNICATIONS_HPP
-
-#include <passes/pass_base.hpp>
-
-#include <metatypes/metatypes.hpp>
-
-namespace ade
-{
-namespace passes
-{
-
-struct ConnectCommChannels final
-{
- using Context = ade::passes::TypedPassContext<ade::meta::CommNode,
- ade::meta::DataObject,
- ade::meta::CommChannel,
- ade::meta::NodeInfo,
- ade::meta::CommConsumerCallback,
- ade::meta::CommProducerCallback,
- ade::meta::Finalizers>;
- void operator()(Context ctx) const;
- static const char* name();
-};
-
-}
-}
-
-#endif // COMMUNICATIONS_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/passes/pass_base.hpp b/inference-engine/thirdparty/ade/ade/include/passes/pass_base.hpp
deleted file mode 100644
index aefebd6e8..000000000
--- a/inference-engine/thirdparty/ade/ade/include/passes/pass_base.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef PASS_BASE_HPP
-#define PASS_BASE_HPP
-
-namespace ade
-{
-
-class Graph;
-
-template<typename...>
-class TypedGraph;
-
-namespace passes
-{
-struct PassContext
-{
- Graph& graph;
-};
-
-template<typename... Types>
-struct TypedPassContext
-{
- TypedGraph<Types...> graph;
-
- TypedPassContext(PassContext& context):
- graph(context.graph) {}
-};
-
-}
-
-}
-
-
-#endif // PASS_BASE_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/passes/topological_sort.hpp b/inference-engine/thirdparty/ade/ade/include/passes/topological_sort.hpp
deleted file mode 100644
index 27880ad87..000000000
--- a/inference-engine/thirdparty/ade/ade/include/passes/topological_sort.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef TOPOLOGICAL_SORT_HPP
-#define TOPOLOGICAL_SORT_HPP
-
-#include <vector>
-#include "utility"
-
-#include "node.hpp"
-
-#include "typed_graph.hpp"
-#include "passes/pass_base.hpp"
-
-#include "util/range.hpp"
-#include "util/filter_range.hpp"
-
-namespace ade
-{
-namespace passes
-{
-
-struct TopologicalSortData final
-{
- struct NodesFilter final
- {
- bool operator()(const ade::NodeHandle& node) const
- {
- return nullptr != node;
- }
- };
-
- using NodesList = std::vector<NodeHandle>;
- using NodesRange = util::FilterRange<util::IterRange<NodesList::const_iterator>, NodesFilter>;
-
- TopologicalSortData(const NodesList& nodes):
- m_nodes(nodes) {}
-
- TopologicalSortData(NodesList&& nodes):
- m_nodes(std::move(nodes)) {}
-
- NodesRange nodes() const
- {
- return util::filter<NodesFilter>(util::toRange(m_nodes));
- }
-
- static const char* name();
-
-private:
- NodesList m_nodes;
-};
-
-struct TopologicalSort final
-{
- void operator()(TypedPassContext<TopologicalSortData> context) const;
- static const char* name();
-};
-
-struct LazyTopologicalSortChecker final
-{
- bool nodeCreated(const Graph& graph, const NodeHandle& node);
- bool nodeAboutToBeDestroyed(const Graph& graph, const NodeHandle& node);
-
- bool edgeCreated(const Graph&, const EdgeHandle& edge);
- bool edgeAboutToBeDestroyed(const Graph& graph, const EdgeHandle& edge);
- bool edgeAboutToBeRelinked(const Graph& graph,
- const EdgeHandle& edge,
- const NodeHandle& newSrcNode,
- const NodeHandle& newDstNode);
-};
-
-}
-}
-
-#endif // TOPOLOGICAL_SORT_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/passmanager.hpp b/inference-engine/thirdparty/ade/ade/include/passmanager.hpp
deleted file mode 100644
index 381d2f400..000000000
--- a/inference-engine/thirdparty/ade/ade/include/passmanager.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef PASSMANAGER_HPP
-#define PASSMANAGER_HPP
-
-#include <vector>
-#include <list>
-#include <unordered_map>
-#include <string>
-#include <memory>
-#include <utility>
-#include <algorithm>
-
-#include "util/assert.hpp"
-#include "util/range.hpp"
-
-namespace ade
-{
-
-template<typename Context>
-class PassList;
-
-template<typename Context>
-class PassManager final
-{
-public:
- using StageList = std::list<std::pair<std::string, PassList<Context>>>;
- using StagesRange = util::IterRange<typename StageList::iterator>;
- using StagesCRange = util::IterRange<typename StageList::const_iterator>;
-
- PassManager() = default;
- PassManager(PassManager&&) = default;
- PassManager& operator=(PassManager&&) = default;
-
- void addStage(const std::string& stageName, const std::string& prevStage)
- {
- ASSERT(!stageName.empty());
- ASSERT(!prevStage.empty());
- ASSERT(!hasStage(stageName));
- ASSERT(hasStage(prevStage));
- auto it = m_stagesMap.find(prevStage)->second;
-
- ++it;
- m_stages.insert(it, std::make_pair(stageName, PassList<Context>{}));
- --it;
- m_stagesMap.insert(std::make_pair(stageName, it)); //TODO: exception safety
- }
- void addStage(const std::string& stageName)
- {
- ASSERT(!stageName.empty());
- ASSERT(!hasStage(stageName));
- m_stages.emplace_back(std::make_pair(stageName, PassList<Context>{}));
- auto it = m_stages.end();
- --it;
- m_stagesMap.insert(std::make_pair(stageName, it)); //TODO: exception safety
- }
-
- PassList<Context>& getStage(const std::string& stageName)
- {
- auto it = m_stagesMap.find(stageName);
- ASSERT(m_stagesMap.end() != it);
- return (*it->second).second;
- }
-
-
- template<typename T>
- void addPass(const std::string& stageName, T&& pass)
- {
- auto& stage = getStage(stageName);
- stage.addPass(std::forward<T>(pass));
- }
-
- void run(Context& context)
- {
- for (auto& pass: m_stages)
- {
- pass.second.run(context);
- }
- }
-
- StagesRange stages()
- {
- return util::toRange(m_stages);
- }
-
- StagesCRange stages() const
- {
- return util::toRange(m_stages);
- }
-
-private:
- PassManager(const PassManager&) = delete;
- PassManager& operator=(const PassManager&) = delete;
-
- bool hasStage(const std::string& name) const
- {
- return m_stagesMap.end() != m_stagesMap.find(name);
- }
-
- StageList m_stages;
- using StageMap = std::unordered_map<std::string, typename StageList::iterator>;
- StageMap m_stagesMap;
-};
-
-namespace detail
-{
-template<typename Context>
-class PassConceptBase
-{
-public:
- virtual ~PassConceptBase() {}
- virtual void run(Context& context) = 0;
-};
-
-template<typename Context, typename PassT>
-class PassConceptImpl : public PassConceptBase<Context>
-{
- PassT m_pass;
-public:
- template<typename T>
- PassConceptImpl(T&& pass): m_pass(std::forward<T>(pass)) {}
-
- virtual void run(Context& context) override
- {
- m_pass(context);
- }
-};
-}
-
-template<typename Context>
-class PassList final
-{
-public:
- PassList() = default;
- PassList(PassList&&) = default;
- PassList& operator=(PassList&&) = default;
-
- template<typename PassT>
- void addPass(PassT&& pass)
- {
- m_passes.emplace_back(new detail::PassConceptImpl<Context, PassT>(std::forward<PassT>(pass)));
- }
-
- void run(Context& context)
- {
- for (auto& pass: m_passes)
- {
- pass->run(context);
- }
- }
-
-private:
- PassList(const PassList&) = delete;
- PassList& operator=(const PassList&) = delete;
-
- std::vector<std::unique_ptr<detail::PassConceptBase<Context>>> m_passes;
-};
-
-}
-
-#endif // PASSMANAGER_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/typed_graph.hpp b/inference-engine/thirdparty/ade/ade/include/typed_graph.hpp
deleted file mode 100644
index 9c27b7247..000000000
--- a/inference-engine/thirdparty/ade/ade/include/typed_graph.hpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef TYPED_GRAPH_HPP
-#define TYPED_GRAPH_HPP
-
-#include <array>
-
-#include "util/assert.hpp"
-#include "util/memory_range.hpp"
-
-#include "graph.hpp"
-#include "metadata.hpp"
-#include "typed_metadata.hpp"
-
-namespace ade
-{
-
-namespace details
-{
-
-template<typename T, typename... Remaining>
-struct InitIdsArray final
-{
- inline void operator()(const ade::Graph& gr, util::MemoryRange<ade::MetadataId> ids) const
- {
- ASSERT(ids.size == (1 + sizeof...(Remaining)));
- ids[0] = gr.getMetadataId(T::name());
- InitIdsArray<Remaining...>()(gr, ids.Slice(1, ids.size - 1));
- }
-};
-
-template<typename T>
-struct InitIdsArray<T> final
-{
- inline void operator()(const ade::Graph& gr, util::MemoryRange<ade::MetadataId> ids) const
- {
- ASSERT(1 == ids.size);
- ids[0] = gr.getMetadataId(T::name());
- }
-};
-
-}
-
-template<typename... Types>
-class TypedGraph;
-
-template<typename... Types>
-class ConstTypedGraph
-{
-protected:
- static_assert(sizeof...(Types) > 0, "Type list is empty");
-
- // Store graph ptr as uintptr_t to avoid const_casts in derived class
- std::uintptr_t m_srcGraph;
- std::array<ade::MetadataId, sizeof...(Types)> m_ids;
-
- const ade::Graph& getCGraph() const
- {
- return *reinterpret_cast<const ade::Graph*>(m_srcGraph);
- }
-
- void initIds()
- {
- details::InitIdsArray<Types...>()(getCGraph(), util::memory_range(m_ids.data(), m_ids.size()));;
- }
-
-public:
- template<typename... OtherTypes>
- friend class ConstTypedGraph;
-
- using CMetadataT = ade::TypedMetadata<true, Types...>;
-
- ConstTypedGraph(const ade::Graph& graph):
- m_srcGraph(reinterpret_cast<std::uintptr_t>(&graph))
- {
- initIds();
- }
-
- template<typename... OtherTypes>
- ConstTypedGraph(const ConstTypedGraph<OtherTypes...>& other):
- m_srcGraph(other.m_srcGraph)
- {
- initIds();
- }
-
- ConstTypedGraph& operator=(const ConstTypedGraph&) = delete;
-
- ade::Graph::NodesListCRange nodes() const
- {
- return getCGraph().nodes();
- }
-
- CMetadataT metadata() const
- {
- return CMetadataT(m_ids, getCGraph().metadata());
- }
-
- CMetadataT metadata(const ade::NodeHandle& handle) const
- {
- return CMetadataT(m_ids, getCGraph().metadata(handle));
- }
-
- CMetadataT metadata(const ade::EdgeHandle& handle) const
- {
- return CMetadataT(m_ids, getCGraph().metadata(handle));
- }
-};
-
-template<typename... Types>
-class TypedGraph final : public ConstTypedGraph<Types...>
-{
-protected:
- static_assert(sizeof...(Types) > 0, "Type list is empty");
-
- ade::Graph& getGraph() const
- {
- return *reinterpret_cast<ade::Graph*>(this->m_srcGraph);
- }
-
-public:
- using MetadataT = ade::TypedMetadata<false, Types...>;
-
- TypedGraph(ade::Graph& graph):
- ConstTypedGraph<Types...>(graph)
- {
- }
-
- template<typename... OtherTypes>
- TypedGraph(const TypedGraph<OtherTypes...>& other):
- ConstTypedGraph<Types...>(other)
- {
-
- }
-
- TypedGraph& operator=(const TypedGraph&) = delete;
-
- /// Create new node
- ade::NodeHandle createNode()
- {
- return getGraph().createNode();
- }
-
- /// Delete node and all connected edges from graph and null all handles pointing to it
- void erase(const ade::NodeHandle& node)
- {
- getGraph().erase(node);
- }
-
- /// Delete all edges, connected to this node
- void unlink(const ade::NodeHandle& node)
- {
- getGraph().unlink(node);
- }
-
- /// Delete node and all connected edges from graph and null all handles pointing to it
- void erase(const ade::EdgeHandle& edge)
- {
- getGraph().erase(edge);
- }
-
- /// Create new edge between src_node and dst_node
- ade::EdgeHandle link(const ade::NodeHandle& src_node, const ade::NodeHandle& dst_node)
- {
- return getGraph().link(src_node, dst_node);
- }
-
- /// Change src_edge destination node to dst_node
- /// noop if src_edge destination node is already dst_node
- /// returns src_edge
- ade::EdgeHandle link(const ade::EdgeHandle& src_edge, const ade::NodeHandle& dst_node)
- {
- return getGraph().link(src_edge, dst_node);
- }
-
- /// Change dst_edge source node to src_node
- /// noop if dst_edge source node is already src_node
- /// returns dst_edge
- ade::EdgeHandle link(const ade::NodeHandle& src_node, const ade::EdgeHandle& dst_edge)
- {
- return getGraph().link(src_node, dst_edge);
- }
-
- using ConstTypedGraph<Types...>::nodes;
- using ConstTypedGraph<Types...>::metadata;
-
- ade::Graph::NodesListRange nodes()
- {
- return getGraph().nodes();
- }
-
- MetadataT metadata()
- {
- return MetadataT(this->m_ids, getGraph().metadata());
- }
-
- MetadataT metadata(const ade::NodeHandle& handle)
- {
- return MetadataT(this->m_ids, getGraph().metadata(handle));
- }
-
- MetadataT metadata(const ade::EdgeHandle& handle)
- {
- return MetadataT(this->m_ids, getGraph().metadata(handle));
- }
-};
-
-}
-
-#endif // TYPED_GRAPH_HPP
diff --git a/inference-engine/thirdparty/ade/ade/include/typed_metadata.hpp b/inference-engine/thirdparty/ade/ade/include/typed_metadata.hpp
deleted file mode 100644
index be0c03db7..000000000
--- a/inference-engine/thirdparty/ade/ade/include/typed_metadata.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef TYPED_METADATA_HPP
-#define TYPED_METADATA_HPP
-
-#include <array>
-#include <type_traits>
-
-#include "util/algorithm.hpp"
-
-#include "metadata.hpp"
-
-namespace ade
-{
-template<bool IsConst, typename... Types>
-class TypedMetadata
-{
- using IdArray = std::array<ade::MetadataId, sizeof...(Types)>;
- using MetadataT = typename std::conditional<IsConst, const ade::Metadata&, ade::Metadata&>::type;
- const IdArray& m_ids;
- MetadataT m_metadata;
-
- template<typename T>
- ade::MetadataId getId() const
- {
- const auto index = util::type_list_index<typename std::decay<T>::type, Types...>::value;
- return m_ids[index];
- }
-
-public:
- TypedMetadata(const IdArray& ids, MetadataT meta):
- m_ids(ids), m_metadata(meta) {}
-
- TypedMetadata(const TypedMetadata& other):
- m_ids(other.m_ids), m_metadata(other.m_metadata) {}
-
- TypedMetadata& operator=(const TypedMetadata&) = delete;
-
- template<bool, typename...>
- friend class TypedMetadata;
-
- template<typename T>
- bool contains() const
- {
- return m_metadata.contains(getId<T>());
- }
-
- template<typename T>
- void erase()
- {
- m_metadata.erase(getId<T>());
- }
-
- template<typename T>
- void set(T&& val)
- {
- m_metadata.set(getId<T>(), std::forward<T>(val));
- }
-
- template<typename T>
- auto get() const
- ->typename std::conditional<IsConst, const T&, T&>::type
- {
- return m_metadata.template get<T>(getId<T>());
- }
-
- template<typename T>
- T get(T&& def) const
- {
- return m_metadata.get(getId<T>(), std::forward<T>(def));
- }
-
- template<bool IsC, typename... T>
- void copyFrom(const TypedMetadata<IsC, T...>& meta)
- {
- m_metadata.copyFrom(meta.m_metadata);
- }
-};
-
-}
-
-#endif // TYPED_METADATA_HPP
diff --git a/inference-engine/thirdparty/ade/ade/source/alloc.cpp b/inference-engine/thirdparty/ade/ade/source/alloc.cpp
deleted file mode 100644
index 40009526b..000000000
--- a/inference-engine/thirdparty/ade/ade/source/alloc.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <memory/alloc.hpp>
-
-
-#ifndef __APPLE__
-#include <malloc.h>
-#else
-#include <stdlib.h>
-void * memalign(size_t alignment, size_t size) {
- void *buffer;
- posix_memalign(&buffer, alignment, size);
- return buffer;
-}
-#endif
-
-#include <util/math.hpp>
-#include <util/assert.hpp>
-
-namespace ade
-{
-
-void* aligned_alloc(std::size_t size, std::size_t alignment)
-{
- ASSERT(util::is_pow2(alignment));
-#ifdef WIN32
- return _aligned_malloc(size, alignment);
-#else
- return memalign(alignment, size);
-#endif
-}
-
-void aligned_free(void* ptr)
-{
-#ifdef WIN32
- return _aligned_free(ptr);
-#else
- return free(ptr);
-#endif
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/check_cycles.cpp b/inference-engine/thirdparty/ade/ade/source/check_cycles.cpp
deleted file mode 100644
index d69b7395c..000000000
--- a/inference-engine/thirdparty/ade/ade/source/check_cycles.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "passes/check_cycles.hpp"
-
-#include <unordered_map>
-
-#include "util/assert.hpp"
-#include "util/map_range.hpp"
-
-#include "graph.hpp"
-#include "node.hpp"
-
-namespace ade
-{
-namespace passes
-{
-enum class TraverseState
-{
- visiting,
- visited,
-};
-
-using state_t = std::unordered_map<Node*, TraverseState>;
-
-static void visit(state_t& state, const NodeHandle& node)
-{
- ASSERT(nullptr != node);
- state[node.get()] = TraverseState::visiting;
- for (auto adj:
- util::map(node->outEdges(), [](const EdgeHandle& e) { return e->dstNode(); }))
- {
- auto it = state.find(adj.get());
- if (state.end() == it) // not visited
- {
- visit(state, adj);
- }
- else if (TraverseState::visiting == it->second)
- {
- throw_error(CycleFound());
- }
- }
- state[node.get()] = TraverseState::visited;
-
-}
-
-void CheckCycles::operator()(const PassContext& context) const
-{
- state_t state;
- for (auto node: context.graph.nodes())
- {
- if (state.end() == state.find(node.get()))
- {
- // not yet visited during recursion
- visit(state, node);
- }
- }
-}
-
-std::string CheckCycles::name()
-{
- return "CheckCycles";
-}
-
-const char* CycleFound::what() const noexcept
-{
- return "Cycle was detected in graph";
-}
-
-}
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/edge.cpp b/inference-engine/thirdparty/ade/ade/source/edge.cpp
deleted file mode 100644
index 5bed7dd06..000000000
--- a/inference-engine/thirdparty/ade/ade/source/edge.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "edge.hpp"
-
-#include "util/assert.hpp"
-
-#include "node.hpp"
-#include "graph.hpp"
-
-namespace ade
-{
-
-Edge::Edge(Node* prev, Node* next)
-{
- ASSERT(nullptr != prev);
- ASSERT(nullptr != next);
- resetPrevNode(prev);
- resetNextNode(next);
-}
-
-Edge::~Edge()
-{
- unlink();
-}
-
-void Edge::unlink()
-{
- resetPrevNode(nullptr);
- resetNextNode(nullptr);
-}
-
-void Edge::resetPrevNode(Node* newNode)
-{
- if (newNode == m_prevNode)
- {
- return;
- }
-
- if (nullptr != m_prevNode)
- {
- m_prevNode->removeOutEdge(this);
- m_prevNode = nullptr;
- }
- if (nullptr != newNode)
- {
- newNode->addOutEdge(this);
- m_prevNode = newNode;
- }
-}
-
-void Edge::resetNextNode(Node* newNode)
-{
- if (newNode == m_nextNode)
- {
- return;
- }
-
- if (nullptr != m_nextNode)
- {
- m_nextNode->removeInEdge(this);
- m_nextNode = nullptr;
- }
- if (nullptr != newNode)
- {
- newNode->addInEdge(this);
- m_nextNode = newNode;
- }
-}
-
-Graph* Edge::getParent() const
-{
- if (nullptr != m_prevNode)
- {
- return m_prevNode->getParent();
- }
- if (nullptr != m_nextNode)
- {
- return m_nextNode->getParent();
- }
- return nullptr;
-}
-
-NodeHandle Edge::srcNode() const
-{
- ASSERT_STRONG(nullptr != m_prevNode);
- return Graph::HandleMapper()(m_prevNode);
-}
-
-NodeHandle Edge::dstNode() const
-{
- ASSERT_STRONG(nullptr != m_nextNode);
- return Graph::HandleMapper()(m_nextNode);
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/execution_engine.cpp b/inference-engine/thirdparty/ade/ade/source/execution_engine.cpp
deleted file mode 100644
index 8f63912c2..000000000
--- a/inference-engine/thirdparty/ade/ade/source/execution_engine.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "execution_engine/execution_engine.hpp"
-#include "execution_engine/backend.hpp"
-#include "execution_engine/executable.hpp"
-
-#include "graph.hpp"
-
-#include "util/assert.hpp"
-#include "util/range.hpp"
-#include "util/checked_cast.hpp"
-
-namespace ade
-{
-
-class ExecutableImpl final : public Executable
-{
- util::any m_dummy_opaque;
-
-public:
- void addExec(std::unique_ptr<BackendExecutable>&& exec);
-
- virtual void run() override;
- virtual void run(util::any &opaque) override;
-
- virtual void runAsync() override;
- virtual void runAsync(util::any &opaque) override;
- virtual void wait() override;
-
-private:
- std::unique_ptr<BackendExecutable> mainExec;
- std::vector<std::unique_ptr<BackendExecutable>> execs;
-};
-
-void BackendExecutable::run(util::any &)
-{
- // Default implementation calls run() (backward compatibility)
- run();
-}
-
-void BackendExecutable::runAsync(util::any &)
-{
- // Default implementation calls runAsync() (backward compatibility)
- runAsync();
-}
-
-ExecutionEngine::ExecutionEngine()
-{
-
-}
-
-ExecutionEngine::~ExecutionEngine()
-{
-
-}
-
-void ExecutionEngine::addPrePassCallback(ExecutionEngine::PassCallback callback)
-{
- ASSERT(nullptr != callback);
- m_prePassCallbacks.callbacks.emplace_back(std::move(callback));
-}
-
-void ExecutionEngine::addPostPassCallback(ExecutionEngine::PassCallback callback)
-{
- ASSERT(nullptr != callback);
- m_postPassCallbacks.callbacks.emplace_back(std::move(callback));
-}
-
-void ExecutionEngine::addBackend(std::unique_ptr<ExecutionBackend>&& backend)
-{
- ASSERT(nullptr != backend);
- ASSERT(m_backends.end() == std::find(m_backends.begin(), m_backends.end(), backend));
- m_backends.emplace_back(std::move(backend));
-}
-
-void ExecutionEngine::setupBackends()
-{
- ExecutionEngineSetupContext context(*this);
- for (auto& b: m_backends)
- {
- b->setupExecutionEngine(context);
- }
-}
-
-namespace
-{
-struct GraphListenerSetter final
-{
- Graph& graph;
- IGraphListener* listener = nullptr;
- GraphListenerSetter(Graph& gr, IGraphListener* l):
- graph(gr), listener(l)
- {
- ASSERT(nullptr == graph.getListener());
- graph.setListener(listener);
- }
- ~GraphListenerSetter()
- {
- ASSERT(listener == graph.getListener());
- graph.setListener(nullptr);
- }
-
- GraphListenerSetter(const GraphListenerSetter&) = delete;
- GraphListenerSetter& operator=(const GraphListenerSetter&) = delete;
-};
-}
-
-void ExecutionEngine::runPasses(Graph& graph)
-{
- m_lazyPasses.reset();
- GraphListenerSetter setter(graph, m_lazyPasses.getListener());
- passes::PassContext context{graph};
- m_passManager.run(context);
- for (auto& str: m_executableDependencies)
- {
- ASSERT(!str.empty());
- auto pass = m_lazyPasses.getPass(str);
- ASSERT(nullptr != pass);
- pass->process(context);
- }
-}
-
-std::unique_ptr<Executable> ExecutionEngine::createExecutable(const Graph& graph)
-{
- std::unique_ptr<ExecutableImpl> ret;
- for (auto& b : m_backends)
- {
- std::unique_ptr<BackendExecutable> bexec(b->createExecutable(graph));
- if (nullptr != bexec)
- {
- if (nullptr == ret)
- {
- ret.reset(new ExecutableImpl);
- }
- ret->addExec(std::move(bexec));
- }
- }
-
- return std::move(ret);
-}
-
-void ExecutionEngine::addExecutableDependency(const std::string& lazyPassName)
-{
- ASSERT(!lazyPassName.empty());
- ASSERT(m_lazyPasses.getPass(lazyPassName) != nullptr);
- m_executableDependencies.emplace(lazyPassName);
-}
-
-void ExecutionEngine::addPassStage(const std::string& stageName)
-{
- ASSERT(!stageName.empty());
- m_passManager.addStage(stageName);
-}
-
-void ExecutionEngine::addPassStage(const std::string& stageName, const std::string& prevStage)
-{
- ASSERT(!stageName.empty());
- ASSERT(!prevStage.empty());
- m_passManager.addStage(stageName, prevStage);
-}
-
-ExecutionEngine::StagesRange ExecutionEngine::passStages() const
-{
- return util::map<PassMapper>(m_passManager.stages());
-}
-
-void ExecutionEngine::prePass(const PassDesc& desc,
- const passes::PassContext& context)
-{
- m_prePassCallbacks.call(desc, context);
-}
-
-void ExecutionEngine::postPass(const PassDesc& desc,
- const passes::PassContext& context)
-{
- m_postPassCallbacks.call(desc, context);
-}
-
-void ExecutableImpl::addExec(std::unique_ptr<BackendExecutable>&& exec)
-{
- ASSERT(nullptr != exec);
- if (nullptr == mainExec)
- {
- mainExec = std::move(exec);
- }
- else
- {
- execs.emplace_back(std::move(exec));
- }
-}
-
-struct ExecExceptionHandler
-{
- size_t passedCount = 0;
- std::vector<std::unique_ptr<BackendExecutable>> &handledVector;
- ExecExceptionHandler(std::vector<std::unique_ptr<BackendExecutable>> &execs) : handledVector(execs) {}
- ~ExecExceptionHandler()
- {
- ASSERT(handledVector.size() >= passedCount);
- auto count = util::checked_cast<int>(handledVector.size() - passedCount);
- for (auto i = util::checked_cast<int>(handledVector.size()) - 1;
- i >= count;
- i--)
- {
- handledVector[i]->cancel();
- }
- }
-};
-
-void ExecutableImpl::run()
-{
- // Since run() takes a modifiable `any`, reset it before the run
- m_dummy_opaque = util::any();
- run(m_dummy_opaque);
-}
-
-void ExecutableImpl::run(util::any &opaque)
-{
- ASSERT(nullptr != mainExec);
- ExecExceptionHandler handler(execs);
- for (auto& e: util::toRangeReverse(execs))
- {
- e->runAsync(opaque);
- handler.passedCount++;
- }
-
- mainExec->run(opaque);
-
- for (auto& e: util::toRange(execs))
- {
- handler.passedCount--;
- e->wait();
- }
-}
-
-void ExecutableImpl::runAsync()
-{
- // Since runAsync() takes a modifiable `any`, reset it before the run
- m_dummy_opaque = util::any();
- runAsync(m_dummy_opaque);
-}
-
-void ExecutableImpl::runAsync(util::any &opaque)
-{
- ASSERT(nullptr != mainExec);
- for (auto& e: util::toRangeReverse(execs))
- {
- e->runAsync(opaque);
- }
- mainExec->runAsync(opaque);
-}
-
-void ExecutableImpl::wait()
-{
- ASSERT(nullptr != mainExec);
- ExecExceptionHandler handler(execs);
- handler.passedCount = util::checked_cast<decltype(handler.passedCount)>(execs.size());
- mainExec->wait();
- for (auto& e: util::toRange(execs))
- {
- handler.passedCount--;
- e->wait();
- }
-}
-
-ExecutionEngineSetupContext::ExecutionEngineSetupContext(ExecutionEngine& e):
- m_engine(e)
-{
-
-}
-
-void ExecutionEngineSetupContext::addPrePassCallback(PassCallback callback)
-{
- m_engine.addPrePassCallback(std::move(callback));
-}
-
-void ExecutionEngineSetupContext::addPostPassCallback(PassCallback callback)
-{
- m_engine.addPostPassCallback(std::move(callback));
-}
-
-void ExecutionEngineSetupContext::addExecutableDependency(const std::string& lazyPassName)
-{
- m_engine.addExecutableDependency(lazyPassName);
-}
-
-void ExecutionEngineSetupContext::addPassStage(const std::string& stageName)
-{
- m_engine.addPassStage(stageName);
-}
-
-void ExecutionEngineSetupContext::addPassStage(const std::string& stageName, const std::string& prevStage)
-{
- m_engine.addPassStage(stageName, prevStage);
-}
-
-ExecutionEngineSetupContext::StagesRange ExecutionEngineSetupContext::passStages() const
-{
- return m_engine.passStages();
-}
-
-void ExecutionEngine::CallbackList::call(const ExecutionEngine::PassDesc& desc, const passes::PassContext& context) const
-{
- for (auto& callback: callbacks)
- {
- ASSERT(nullptr != callback);
- callback(desc, context);
- }
-}
-
-bool ExecutionEngine::CallbackList::empty() const
-{
- return callbacks.empty();
-}
-
-IGraphListener* ExecutionEngine::LazyPasses::getListener() const
-{
- ASSERT((nullptr == last) == passes.empty());
- return last;
-}
-
-ExecutionEngine::LazyPassWrapper* ExecutionEngine::LazyPasses::getPass(const std::string& name) const
-{
- ASSERT(!name.empty());
- ASSERT(util::contains(passes, name));
- auto it = passes.find(name);
- auto ret = it->second.get();
- ASSERT(nullptr != ret);
- return ret;
-}
-
-void ExecutionEngine::LazyPasses::reset()
-{
- if (nullptr != last)
- {
- last->reset();
- }
-}
-
-ExecutionEngine::LazyPassWrapper::~LazyPassWrapper()
-{
-
-}
-
-bool ExecutionEngine::LazyPassWrapper::isValid() const
-{
- return m_valid;
-}
-
-bool ExecutionEngine::LazyPassWrapper::isFirst() const
-{
- return nullptr == m_prev;
-}
-
-ExecutionEngine::LazyPassWrapper::LazyPassWrapper(ExecutionEngine::LazyPassWrapper* prev):
- m_prev(prev)
-{
-
-}
-
-void ExecutionEngine::LazyPassWrapper::reset()
-{
- m_valid = false;
- if (!isFirst())
- {
- m_prev->reset();
- }
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/graph.cpp b/inference-engine/thirdparty/ade/ade/source/graph.cpp
deleted file mode 100644
index 4be25add4..000000000
--- a/inference-engine/thirdparty/ade/ade/source/graph.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "graph.hpp"
-
-#include <algorithm>
-
-#include "util/assert.hpp"
-#include "util/algorithm.hpp"
-
-#include "edge.hpp"
-#include "node.hpp"
-
-#include "graph_listener.hpp"
-
-namespace ade
-{
-
-Graph::Graph()
-{
-
-}
-
-Graph::~Graph()
-{
-
-}
-
-NodeHandle Graph::createNode()
-{
- NodePtr node(new Node(this), ElemDeleter{});
- NodeHandle ret(node);
- m_nodes.emplace_back(std::move(node));
- if (nullptr != m_listener)
- {
- m_listener->nodeCreated(*this, ret);
- }
- return ret;
-}
-
-void Graph::erase(const NodeHandle& node)
-{
- ASSERT(nullptr != node);
- ASSERT(node->getParent() == this);
- removeNode(node.get());
-}
-
-void Graph::unlink(const NodeHandle& node)
-{
- ASSERT(nullptr != node);
- ASSERT(node->getParent() == this);
- node->unlink();
-}
-
-void Graph::erase(const EdgeHandle& edge)
-{
- ASSERT(nullptr != edge);
- ASSERT(edge->getParent() == this);
- removeEdge(edge.get());
-}
-
-EdgeHandle Graph::link(const NodeHandle& src_node, const NodeHandle& dst_node)
-{
- ASSERT(nullptr != src_node);
- ASSERT(nullptr != dst_node);
- ASSERT(src_node->getParent() == dst_node->getParent());
- ASSERT(src_node->getParent() == this);
- return createEdge(src_node.get(), dst_node.get());
-}
-
-EdgeHandle Graph::link(const EdgeHandle& src_edge, const NodeHandle& dst_node)
-{
- ASSERT(nullptr != src_edge);
- ASSERT(nullptr != dst_node);
- Edge* edge = src_edge.get();
- Node* node = dst_node.get();
- ASSERT_STRONG(edge != nullptr);
- ASSERT_STRONG(node != nullptr);
- if (nullptr != m_listener)
- {
- m_listener->edgeAboutToBeRelinked(*this, src_edge, edge->srcNode(), dst_node);
- }
- edge->resetNextNode(node);
-
- return src_edge;
-}
-
-EdgeHandle Graph::link(const NodeHandle& src_node, const EdgeHandle& dst_edge)
-{
- ASSERT(nullptr != src_node);
- ASSERT(nullptr != dst_edge);
- Edge* edge = dst_edge.get();
- Node* node = src_node.get();
- ASSERT_STRONG(edge != nullptr);
- ASSERT_STRONG(node != nullptr);
- if (nullptr != m_listener)
- {
- m_listener->edgeAboutToBeRelinked(*this, dst_edge, src_node, edge->dstNode());
- }
- edge->resetPrevNode(node);
-
- return dst_edge;
-}
-
-Graph::NodesListRange Graph::nodes()
-{
- return util::map<HandleMapper>(util::toRange(m_nodes));
-}
-
-Graph::NodesListCRange Graph::nodes() const
-{
- return util::map<HandleMapper>(util::toRange(m_nodes));
-}
-
-MetadataId Graph::getMetadataId(const std::string& name) const
-{
- return MetadataId(m_ids[name].p.get());
-}
-
-Metadata& Graph::metadata()
-{
- return geMetadataImpl(nullptr);
-}
-
-const Metadata& Graph::metadata() const
-{
- return geMetadataImpl(nullptr);
-}
-
-Metadata& Graph::metadata(const NodeHandle handle)
-{
- ASSERT(nullptr != handle);
- return geMetadataImpl(handle.get());
-}
-
-const Metadata& Graph::metadata(const NodeHandle handle) const
-{
- ASSERT(nullptr != handle);
- return geMetadataImpl(handle.get());
-}
-
-Metadata& Graph::metadata(const EdgeHandle handle)
-{
- ASSERT(nullptr != handle);
- return geMetadataImpl(handle.get());
-}
-
-const Metadata& Graph::metadata(const EdgeHandle handle) const
-{
- ASSERT(nullptr != handle);
- return geMetadataImpl(handle.get());
-}
-
-void Graph::setListener(IGraphListener* listener)
-{
- m_listener = listener;
-}
-
-IGraphListener* Graph::getListener() const
-{
- return m_listener;
-}
-
-EdgeHandle Graph::createEdge(Node* src_node, Node* dst_node)
-{
- ASSERT(nullptr != src_node);
- ASSERT(nullptr != dst_node);
- ASSERT(this == src_node->getParent());
- ASSERT(this == dst_node->getParent());
- EdgePtr edge(new Edge(src_node, dst_node), ElemDeleter{});
- EdgePtr ret(edge);
- m_edges.emplace_back(edge);
- if (nullptr != m_listener)
- {
- m_listener->edgeCreated(*this, ret);
- }
- return ret;
-}
-
-void Graph::removeNode(Node* node)
-{
- ASSERT(nullptr != node);
- if (nullptr != m_listener)
- {
- m_listener->nodeAboutToBeDestroyed(*this, node->shared_from_this());
- }
- m_metadata.erase(node);
- auto it = std::find_if(m_nodes.begin(), m_nodes.end(), [node](const NodePtr& n)
- {
- return n.get() == node;
- });
- //TODO: get rid of linear search
- ASSERT(m_nodes.end() != it);
- util::unstable_erase(m_nodes, it);
-}
-
-void Graph::removeEdge(Edge* edge)
-{
- ASSERT(nullptr != edge);
- if (nullptr != m_listener)
- {
- m_listener->edgeAboutToBeDestroyed(*this, edge->shared_from_this());
- }
- m_metadata.erase(edge);
- auto it = std::find_if(m_edges.begin(), m_edges.end(), [edge](const EdgePtr& e)
- {
- return e.get() == edge;
- });
- //TODO: get rid of linear search
- ASSERT(m_edges.end() != it);
- util::unstable_erase(m_edges, it);
-}
-
-Metadata& Graph::geMetadataImpl(void* handle) const
-{
- auto it = m_metadata.find(handle);
- if (m_metadata.end() != it)
- {
- return *it->second;
- }
- std::unique_ptr<Metadata> meta(new Metadata);
- auto res = m_metadata.insert(std::make_pair(handle, std::move(meta)));
- ASSERT(res.second);
- return *(res.first->second);
-}
-
-void Graph::ElemDeleter::operator()(Node* node) const
-{
- delete node;
-}
-
-void Graph::ElemDeleter::operator()(Edge* edge) const
-{
- delete edge;
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/memory_accessor.cpp b/inference-engine/thirdparty/ade/ade/source/memory_accessor.cpp
deleted file mode 100644
index 482bd8caf..000000000
--- a/inference-engine/thirdparty/ade/ade/source/memory_accessor.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "memory/memory_accessor.hpp"
-
-#include <algorithm>
-
-#include "util/zip_range.hpp"
-#include "util/assert.hpp"
-
-namespace ade
-{
-
-MemoryAccessor::MemoryAccessor()
-{
-}
-
-MemoryAccessor::~MemoryAccessor()
-{
- if (!m_activeHandles.empty())
- {
- onError("Data wasn't committed");
- abandonAllHandles();
- }
-
- ASSERT(m_activeHandles.empty() && "There are an opened handles");
-
- for (auto listener : m_accessListeners)
- {
- listener->memoryDescriptorDestroyedImpl();
- }
-}
-
-void MemoryAccessor::addListener(IMemoryAccessListener* listener)
-{
- ASSERT(nullptr != listener);
- if (!m_activeHandles.empty())
- {
- onError("Data wasn't committed");
- }
- ASSERT(m_accessListeners.end() == std::find(m_accessListeners.begin(),
- m_accessListeners.end(),
- listener));
- m_accessListeners.push_back(listener);
-}
-
-void MemoryAccessor::removeListener(IMemoryAccessListener* listener)
-{
- ASSERT(nullptr != listener);
- if (!m_activeHandles.empty())
- {
- onError("Data wasn't committed");
- abandonListenerHandles(listener);
- }
- auto it = std::find(m_accessListeners.begin(),
- m_accessListeners.end(),
- listener);
- ASSERT(m_accessListeners.end() != it);
- *it = m_accessListeners.back();
- m_accessListeners.pop_back();
-}
-
-MemoryAccessor::AccessHandle MemoryAccessor::access(const MemoryDescriptor& desc,
- const memory::DynMdSpan& span,
- MemoryAccessType accessType)
-{
- ASSERT(nullptr != m_memory);
- return m_activeHandles.emplace(m_activeHandles.end(), this, desc, span, accessType);
-}
-
-void MemoryAccessor::commit(MemoryAccessor::AccessHandle handle)
-{
- ASSERT(nullptr != m_memory);
- ASSERT(m_activeHandles.end() != handle);
- m_activeHandles.erase(handle);
-}
-
-void MemoryAccessor::setNewView(const memory::DynMdView<void>& mem)
-{
- if (!m_activeHandles.empty())
- {
- onError("Data wasn't committed");
- abandonAllHandles();
- }
- for (auto& listener: m_accessListeners)
- {
- listener->memoryViewChangedImpl(m_memory, mem);
- }
- m_memory = mem;
-}
-
-void MemoryAccessor::abandonListenerHandles(IMemoryAccessListener* listener)
-{
- ASSERT(nullptr != listener);
-
- for (auto& h: m_activeHandles)
- {
- h.abandon(listener);
- }
-}
-
-void MemoryAccessor::abandonAllHandles()
-{
- for (auto& h: m_activeHandles)
- {
- h.abandon();
- }
- m_activeHandles.clear();
-}
-
-void MemoryAccessor::onError(const char* str)
-{
- ASSERT(nullptr != str);
- if (m_errorListener)
- {
- m_errorListener(str);
- }
-}
-
-MemoryAccessor::SavedHandles::SavedHandles(MemoryAccessor* parent,
- const MemoryDescriptor& desc,
- const memory::DynMdSpan& span,
- MemoryAccessType accessType)
-{
- ASSERT(nullptr != parent);
- using namespace util;
-
- // TODO: exception safety
- for (auto&& i: indexed(parent->m_accessListeners))
- {
- auto listener = value(i);
- if (0 == index(i))
- {
- handle = listener->access(desc, span, accessType);
- }
- else
- {
- handles.emplace_back(listener->access(desc, span, accessType));
- }
- }
-}
-
-MemoryAccessor::SavedHandles::~SavedHandles()
-{
-
-}
-
-void MemoryAccessor::SavedHandles::abandon(IMemoryAccessListener* listener)
-{
- ASSERT(nullptr != listener);
-
- if (listener == handle.get_deleter().listener)
- {
- handle.release();
- }
- for (auto& h: handles)
- {
- if (listener == h.get_deleter().listener)
- {
- h.release();
- }
- }
-}
-
-void MemoryAccessor::SavedHandles::abandon()
-{
- handle.release();
- for (auto& h: handles)
- {
- h.release();
- }
-}
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/memory_descriptor.cpp b/inference-engine/thirdparty/ade/ade/source/memory_descriptor.cpp
deleted file mode 100644
index 1aa23544b..000000000
--- a/inference-engine/thirdparty/ade/ade/source/memory_descriptor.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "memory/memory_descriptor.hpp"
-
-#include <algorithm>
-
-#include <util/zip_range.hpp>
-
-namespace ade
-{
-
-MemoryDescriptor::MemoryDescriptor(size_t element_size,
- const memory::DynMdSize& dims):
- m_elementSize(element_size),
- m_dims(dims)
-{
- ASSERT(dims.dims_count() > 0);
- ASSERT(element_size > 0);
-}
-
-MemoryDescriptor::~MemoryDescriptor()
-{
-}
-
-void MemoryDescriptor::addListener(IMemoryAccessListener* listener)
-{
- m_accessor.addListener(listener);
-}
-
-void MemoryDescriptor::removeListener(IMemoryAccessListener* listener)
-{
- m_accessor.removeListener(listener);
-}
-
-MemoryDescriptor::AccessHandle MemoryDescriptor::access(const memory::DynMdSpan& span,
- MemoryAccessType accessType)
-{
- return m_accessor.access(*this, span, accessType);
-}
-
-void MemoryDescriptor::commit(MemoryDescriptor::AccessHandle handle)
-{
- m_accessor.commit(handle);
-}
-
-const memory::DynMdSize& MemoryDescriptor::dimensions() const
-{
- return m_dims;
-}
-
-std::size_t MemoryDescriptor::elementSize() const
-{
- return m_elementSize;
-}
-
-void MemoryDescriptor::setExternalView(const memory::DynMdView<void>& view)
-{
- ASSERT(view.elementSize() == m_elementSize);
- ASSERT(view.count() == m_dims.dims_count());
- m_externalView = view;
- m_accessor.setNewView(view);
-}
-
-memory::DynMdView<void> MemoryDescriptor::getExternalView() const
-{
- return m_externalView;
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/memory_descriptor_ref.cpp b/inference-engine/thirdparty/ade/ade/source/memory_descriptor_ref.cpp
deleted file mode 100644
index ee14490a3..000000000
--- a/inference-engine/thirdparty/ade/ade/source/memory_descriptor_ref.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <ostream>
-
-#include "memory/memory_descriptor_ref.hpp"
-
-#include "memory/memory_descriptor_view.hpp"
-#include "memory/memory_descriptor.hpp"
-
-#include "util/md_io.hpp"
-
-#include <util/iota_range.hpp>
-
-namespace ade
-{
-
-MemoryDescriptorRef::MemoryDescriptorRef()
-{
-
-}
-
-MemoryDescriptorRef::MemoryDescriptorRef(MemoryDescriptorView& view):
- m_parent(&view)
-{
- m_span.redim(view.span().dims_count());
- for (auto i: util::iota(m_span.dims_count()))
- {
- m_span[i] = util::Span(0, view.span()[i].length());
- }
-}
-
-MemoryDescriptorRef::MemoryDescriptorRef(MemoryDescriptorView& view,
- const memory::DynMdSpan& span):
- m_parent(&view),
- m_span(span)
-{
-
-}
-
-MemoryDescriptorRef::~MemoryDescriptorRef()
-{
-
-}
-
-MemoryDescriptorView* MemoryDescriptorRef::getView()
-{
- return m_parent;
-}
-
-const MemoryDescriptorView* MemoryDescriptorRef::getView() const
-{
- return m_parent;
-}
-
-MemoryDescriptor*MemoryDescriptorRef::getDescriptor()
-{
- if (nullptr == m_parent)
- {
- return nullptr;
- }
- return m_parent->getDescriptor();
-}
-
-const MemoryDescriptor* MemoryDescriptorRef::getDescriptor() const
-{
- if (nullptr == m_parent)
- {
- return nullptr;
- }
- return m_parent->getDescriptor();
-}
-
-const memory::DynMdSpan& MemoryDescriptorRef::span() const
-{
- ASSERT(nullptr != *this);
- return m_span;
-}
-
-memory::DynMdSize MemoryDescriptorRef::size() const
-{
- return span().size();
-}
-
-std::size_t MemoryDescriptorRef::elementSize() const
-{
- ASSERT(nullptr != getDescriptor());
- return getDescriptor()->elementSize();
-}
-
-memory::DynMdSpan MemoryDescriptorRef::originSpan() const
-{
- ASSERT(nullptr != *this);
- return m_span + m_parent->span().origin();
-}
-
-memory::DynMdView<void> MemoryDescriptorRef::getExternalView() const
-{
- ASSERT(nullptr != getDescriptor());
- auto srcView = getDescriptor()->getExternalView();
- if (nullptr == srcView)
- {
- return nullptr;
- }
- return srcView.slice(originSpan());
-}
-
-bool operator==(std::nullptr_t, const MemoryDescriptorRef& ref)
-{
- return ref.m_parent == nullptr;
-}
-
-bool operator==(const MemoryDescriptorRef& ref, std::nullptr_t)
-{
- return ref.m_parent == nullptr;
-}
-
-bool operator!=(std::nullptr_t, const MemoryDescriptorRef& ref)
-{
- return ref.m_parent != nullptr;
-}
-
-bool operator!=(const MemoryDescriptorRef& ref, std::nullptr_t)
-{
- return ref.m_parent != nullptr;
-}
-
-std::ostream& operator<<(std::ostream& os, const MemoryDescriptorRef& ref)
-{
- if (nullptr == ref)
- {
- os << static_cast<void*>(nullptr);
- }
- else
- {
- os << "{";
- os << "span: " << ref.span() << ", ";
- if (ref.originSpan() != ref.span())
- {
- os << std::endl << "origin span: " << ref.originSpan() << ", ";
- }
- os << std::endl << "view: " << ref.getView() << " (" << ref.getView()->span() << "), ";
- os << std::endl << "descriptor: " << ref.getDescriptor() << " (" << ref.getDescriptor()->dimensions() << ") ";
- os << "}";
- }
- return os;
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/memory_descriptor_view.cpp b/inference-engine/thirdparty/ade/ade/source/memory_descriptor_view.cpp
deleted file mode 100644
index 1917402cb..000000000
--- a/inference-engine/thirdparty/ade/ade/source/memory_descriptor_view.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "memory/memory_descriptor_view.hpp"
-
-#include <vector>
-
-#include <util/algorithm.hpp>
-#include <util/range.hpp>
-#include <util/zip_range.hpp>
-
-#include "memory/memory_descriptor.hpp"
-
-namespace ade
-{
-
-struct MemoryDescriptorView::Connector final
-{
- // We use linear searches here because number of listeners and views usually
- // will be very small
- struct ListenerDesc final
- {
- MemoryDescriptorView* owner;
- std::vector<IMemoryDescriptorViewListener*> listeners;
- };
-
- std::vector<ListenerDesc> listeners;
-
- struct OwnerComparator final
- {
- const MemoryDescriptorView* owner;
- bool operator()(const ListenerDesc& desc) const
- {
- ASSERT(nullptr != owner);
- ASSERT(nullptr != desc.owner);
- return owner == desc.owner;
- }
- };
-
- void addListener(MemoryDescriptorView* view, IMemoryDescriptorViewListener* listener)
- {
- ASSERT(nullptr != view);
- ASSERT(nullptr != listener);
- ASSERT(!contains(view, listener));
- findDesc(view).listeners.push_back(listener);
- }
-
- void removeListener(MemoryDescriptorView* view, IMemoryDescriptorViewListener* listener)
- {
- ASSERT(nullptr != view);
- ASSERT(nullptr != listener);
- ASSERT(contains(view, listener));
- auto& desc = findDesc(view);
- util::unstable_erase(desc.listeners, util::find(desc.listeners, listener));
- ASSERT(!contains(view, listener));
- }
-
- void onDestroy(MemoryDescriptorView* view)
- {
- ASSERT(nullptr != view);
- auto it = util::find_if(listeners, OwnerComparator{view});
- if (listeners.end() != it)
- {
- for (auto& listener: it->listeners)
- {
- ASSERT(nullptr != listener);
- listener->destroy();
- }
- util::unstable_erase(listeners, it);
- }
- }
-
- bool contains(const MemoryDescriptorView* view, const IMemoryDescriptorViewListener* listener) const
- {
- ASSERT(nullptr != view);
- ASSERT(nullptr != listener);
- auto it = util::find_if(listeners, OwnerComparator{view});
- if (listeners.end() == it)
- {
- return false;
- }
- return it->listeners.end() != util::find(it->listeners, listener);
- }
-
- ListenerDesc& findDesc(MemoryDescriptorView* view)
- {
- ASSERT(nullptr != view);
- auto it = util::find_if(listeners, OwnerComparator{view});
- if(listeners.end() != it)
- {
- return *it;
- }
- listeners.push_back(ListenerDesc{view, {}});
- return listeners.back();
- }
-
- std::size_t listenersCount() const
- {
- std::size_t ret = 0;
- for (auto& desc: listeners)
- {
- ret += desc.listeners.size();
- }
- return ret;
- }
-
- ~Connector()
- {
- ASSERT(0 == listenersCount());
- }
-};
-
-
-MemoryDescriptorView::MemoryDescriptorView()
-{
-
-}
-
-MemoryDescriptorView::MemoryDescriptorView(MemoryDescriptor& descriptor,
- const memory::DynMdSpan& span,
- RetargetableState retargetable):
- m_parent(&descriptor),
- m_span(span),
- m_retargetable(retargetable),
- m_connector(std::make_shared<Connector>())
-{
- checkSpans(descriptor);
-}
-
-MemoryDescriptorView::MemoryDescriptorView(MemoryDescriptorView& parent,
- const memory::DynMdSpan& span):
- m_parent_view(&parent),
- m_span(span),
- m_retargetable(parent.retargetableState()),
- m_connector(parent.m_connector)
-{
-
-}
-
-MemoryDescriptorView::~MemoryDescriptorView()
-{
- if (nullptr != m_connector)
- {
- m_connector->onDestroy(this);
- }
-}
-
-void MemoryDescriptorView::retarget(MemoryDescriptor& newParent,
- const memory::DynMdSpan& newSpan)
-{
- ASSERT(isRetargetable());
- ASSERT(nullptr != m_parent);
- ASSERT(nullptr == m_parent_view);
- ASSERT(nullptr != m_connector);
- const auto size = m_span.size();
- ASSERT(newSpan.size() == size);
- checkSpans(newParent);
-
- for (auto& desc: m_connector->listeners)
- {
- auto owner = desc.owner;
- ASSERT(nullptr != owner);
- for (auto listener: desc.listeners)
- {
- ASSERT(nullptr != listener);
- const auto origSpan = owner->span();
- const auto origin = origSpan.origin();
- const auto updatedSpan = util::make_span(origin, origSpan.size());
- if (owner == this)
- {
- ASSERT(updatedSpan == newSpan);
- }
- listener->retarget(*m_parent, origSpan, newParent, updatedSpan);
- }
- }
-
- m_span = newSpan;
- m_parent = &newParent;
-
- for (auto& desc: m_connector->listeners)
- {
- for (auto listener: desc.listeners)
- {
- ASSERT(nullptr != listener);
- listener->retargetComplete();
- }
- }
-}
-
-MemoryDescriptorView::RetargetableState MemoryDescriptorView::retargetableState() const
-{
- return m_retargetable;
-}
-
-bool MemoryDescriptorView::isRetargetable() const
-{
- return m_retargetable == Retargetable;
-}
-
-void MemoryDescriptorView::addListener(IMemoryDescriptorViewListener* listener)
-{
- ASSERT(nullptr != listener);
- ASSERT(nullptr != m_connector);
- m_connector->addListener(this, listener);
-}
-
-void MemoryDescriptorView::removeListener(IMemoryDescriptorViewListener* listener)
-{
- ASSERT(nullptr != listener);
- ASSERT(nullptr != m_connector);
- m_connector->removeListener(this, listener);
-}
-
-memory::DynMdSpan MemoryDescriptorView::span() const
-{
- ASSERT(nullptr != *this);
- if (nullptr != m_parent_view)
- {
- return m_span + m_parent_view->span().origin();
- }
- return m_span;
-}
-
-memory::DynMdSize MemoryDescriptorView::size() const
-{
- ASSERT(nullptr != *this);
- return m_span.size();
-}
-
-std::size_t MemoryDescriptorView::elementSize() const
-{
- ASSERT(nullptr != getDescriptor());
- return getDescriptor()->elementSize();
-}
-
-MemoryDescriptor* MemoryDescriptorView::getDescriptor()
-{
- if (nullptr != m_parent_view)
- {
- return m_parent_view->getDescriptor();
- }
- return m_parent;
-}
-
-const MemoryDescriptor* MemoryDescriptorView::getDescriptor() const
-{
- if (nullptr != m_parent_view)
- {
- return m_parent_view->getDescriptor();
- }
- return m_parent;
-}
-
-MemoryDescriptorView* MemoryDescriptorView::getParentView()
-{
- return m_parent_view;
-}
-
-const MemoryDescriptorView* MemoryDescriptorView::getParentView() const
-{
- return m_parent_view;
-}
-
-memory::DynMdView<void> MemoryDescriptorView::getExternalView() const
-{
- auto parent = getDescriptor();
- ASSERT(nullptr != parent);
- auto data = parent->getExternalView();
- if (nullptr == data)
- {
- return nullptr;
- }
- return data.slice(span());
-}
-
-MemoryDescriptorView::AccessHandle MemoryDescriptorView::access(const memory::DynMdSpan& span, MemoryAccessType accessType)
-{
- ASSERT(nullptr != getDescriptor());
- return getDescriptor()->access(span + this->span().origin(), accessType);
-}
-
-void MemoryDescriptorView::commit(MemoryDescriptorView::AccessHandle handle)
-{
- ASSERT(nullptr != getDescriptor());
- getDescriptor()->commit(handle);
-}
-
-bool operator==(std::nullptr_t, const MemoryDescriptorView& ref)
-{
- return ref.getDescriptor() == nullptr;
-}
-
-bool operator==(const MemoryDescriptorView& ref, std::nullptr_t)
-{
- return ref.getDescriptor() == nullptr;
-}
-
-bool operator!=(std::nullptr_t, const MemoryDescriptorView& ref)
-{
- return ref.getDescriptor() != nullptr;
-}
-
-bool operator!=(const MemoryDescriptorView& ref, std::nullptr_t)
-{
- return ref.getDescriptor() != nullptr;
-}
-
-void MemoryDescriptorView::checkSpans(MemoryDescriptor& descriptor) const
-{
- ASSERT(descriptor.dimensions().dims_count() == m_span.dims_count());
- for (auto i: util::iota(m_span.dims_count()))
- {
- auto& val = m_span[i];
- ASSERT(val.begin >= 0);
- ASSERT(val.end <= descriptor.dimensions()[i]);
- }
-}
-
-void* getViewDataPtr(ade::MemoryDescriptorView& view, std::size_t offset)
-{
- ASSERT(nullptr != view);
- auto data = view.getExternalView().mem;
- ASSERT(nullptr != data);
- const auto newSize = data.size - offset;
- ASSERT(newSize > 0);
- return data.Slice(offset, newSize).data;
-}
-
-void copyFromViewMemory(void* dst, ade::MemoryDescriptorView& view)
-{
- ASSERT(nullptr != dst);
- ASSERT(nullptr != view);
- copyFromViewMemory(dst, view.getExternalView());
-}
-
-void copyToViewMemory(const void* src, ade::MemoryDescriptorView& view)
-{
- ASSERT(nullptr != src);
- ASSERT(nullptr != view);
- copyToViewMemory(src, view.getExternalView());
-}
-
-void copyFromViewMemory(void* dst, ade::memory::DynMdView<void> view)
-{
- ASSERT(nullptr != dst);
- ASSERT(nullptr != view);
- const auto size = view.sizeInBytes();
- util::raw_copy(view.mem, util::memory_range(dst, size));
-}
-
-void copyToViewMemory(const void* src, ade::memory::DynMdView<void> view)
-{
- ASSERT(nullptr != src);
- ASSERT(nullptr != view);
- const auto size = view.sizeInBytes();
- util::raw_copy(util::memory_range(src, size), view.mem);
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/metadata.cpp b/inference-engine/thirdparty/ade/ade/source/metadata.cpp
deleted file mode 100644
index f8e4b4264..000000000
--- a/inference-engine/thirdparty/ade/ade/source/metadata.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "metadata.hpp"
-
-#include "util/assert.hpp"
-
-namespace ade
-{
-
-Metadata::Metadata()
-{
-
-}
-
-util::any& Metadata::operator[](const MetadataId& id)
-{
- ASSERT(nullptr != id);
- return m_data[id];
-}
-
-bool Metadata::contains(const MetadataId& id) const
-{
- ASSERT(nullptr != id);
- return m_data.end() != m_data.find(id);
-}
-
-void Metadata::erase(const MetadataId& id)
-{
- m_data.erase(id);
-}
-
-Metadata::MetadataRange Metadata::all()
-{
- return util::toRange(m_data);
-}
-
-Metadata::MetadataCRange Metadata::all() const
-{
- return util::toRange(m_data);
-}
-
-void Metadata::copyFrom(const Metadata& data)
-{
- m_data = data.m_data;
-}
-
-std::size_t Metadata::IdHash::operator()(const MetadataId& id) const
-{
- return std::hash<decltype(MetadataId::m_id)>()(id.m_id);
-}
-
-MetadataId::MetadataId(void* id):
- m_id(id)
-{
- ASSERT(nullptr != m_id);
-}
-
-bool MetadataId::operator==(const MetadataId& other) const
-{
- return m_id == other.m_id;
-}
-
-bool MetadataId::operator!=(const MetadataId& other) const
-{
- return m_id != other.m_id;
-}
-
-bool MetadataId::isNull() const
-{
- return nullptr == m_id;
-}
-
-bool operator==(std::nullptr_t, const MetadataId& other)
-{
- return other.isNull();
-}
-
-bool operator==(const MetadataId& other, std::nullptr_t)
-{
- return other.isNull();
-}
-
-bool operator!=(std::nullptr_t, const MetadataId& other)
-{
- return !other.isNull();
-}
-
-bool operator!=(const MetadataId& other, std::nullptr_t)
-{
- return !other.isNull();
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/metatypes.cpp b/inference-engine/thirdparty/ade/ade/source/metatypes.cpp
deleted file mode 100644
index 721ae97bc..000000000
--- a/inference-engine/thirdparty/ade/ade/source/metatypes.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <metatypes/metatypes.hpp>
-#include <sstream>
-
-namespace ade
-{
-namespace meta
-{
-
-NodeInfo::NodeInfo(const std::string& kernel,
- const std::string& target):
- kernel_name(kernel),
- target_name(target)
-{
-
-}
-
-NodeInfo::NodeId NodeInfo::getId() const
-{
- return getIdInternal().get();
-}
-
-void NodeInfo::link(NodeInfo& node)
-{
- m_id = node.getIdInternal();
-}
-
-const char* NodeInfo::name()
-{
- return "VxNodeInfo";
-}
-
-NodeInfo::IdPtr NodeInfo::getIdInternal() const
-{
- if (nullptr == m_id)
- {
- m_id = std::make_shared<IdStruct>();
- }
- return m_id;
-}
-
-const char* DataObject::name()
-{
- return "DataObject";
-}
-
-CommNode::CommNode(int producersCount):
- m_producersCount(producersCount)
-{
- ASSERT(m_producersCount > 0);
-}
-
-void CommNode::addDataBuffer(const std::shared_ptr<ade::IDataBuffer>& buff)
-{
- ASSERT(buff != nullptr);
- m_buffers.emplace_back(buff);
-}
-
-const char* CommNode::name()
-{
- return "CommNode";
-}
-
-const char* CommChannel::name()
-{
- return "CommChannel";
-}
-
-const char* CommConsumerCallback::name()
-{
- return "CommConsumerCallback";
-}
-
-const char* CommProducerCallback::name()
-{
- return "CommProducerCallback";
-}
-
-const char* Finalizers::name()
-{
- return "Finalizers";
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::NodeInfo& obj)
-{
- os << obj.kernel_name << " " << obj.target_name;
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommNode& obj)
-{
- os << "producer_count : " << obj.producersCount();
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommConsumerCallback& /*obj*/)
-{
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommProducerCallback& /*obj*/)
-{
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::DataObject& obj)
-{
- os << "mem descriptor ref: " << obj.dataRef << ", "
- << "originalFormat: " << obj.originalFormat;
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::CommChannel& obj)
-{
- os << obj.channel;
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const ade::meta::Finalizers& /*obj*/)
-{
- return os;
-}
-
-}
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/node.cpp b/inference-engine/thirdparty/ade/ade/source/node.cpp
deleted file mode 100644
index 5388393e8..000000000
--- a/inference-engine/thirdparty/ade/ade/source/node.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "node.hpp"
-
-#include <memory>
-
-#include "util/assert.hpp"
-#include "util/algorithm.hpp"
-
-#include "graph.hpp"
-#include "edge.hpp"
-
-namespace ade
-{
-
-Node::Node(Graph* parent):
- m_parent(parent)
-{
-
-}
-
-Node::~Node()
-{
- unlink();
-}
-
-void Node::unlink()
-{
- ASSERT(nullptr != m_parent);
- for (auto& edge: m_inEdges) //TODO: join ranges
- {
- ASSERT(nullptr != edge);
- ASSERT(this == edge->m_nextNode);
- edge->m_nextNode = nullptr;
- m_parent->removeEdge(edge);
- }
- m_inEdges.clear();
-
- for (auto& edge: m_outEdges) //TODO: join ranges
- {
- ASSERT(nullptr != edge);
- ASSERT(this == edge->m_prevNode);
- edge->m_prevNode = nullptr;
- m_parent->removeEdge(edge);
- }
- m_outEdges.clear();
-}
-
-void Node::addInEdge(Edge* edge)
-{
- ASSERT(nullptr != edge);
- ASSERT(m_inEdges.end() == util::find(m_inEdges, edge));
- m_inEdges.emplace_back(edge);
-}
-
-void Node::removeInEdge(Edge* edge)
-{
- ASSERT(nullptr != edge);
- // Nodes usually have only a small amount of connections so linear search should be fine here
- auto it = util::find(m_inEdges, edge);
- ASSERT(m_inEdges.end() != it);
- util::unstable_erase(m_inEdges, it);
-}
-
-void Node::addOutEdge(Edge* edge)
-{
- ASSERT(nullptr != edge);
- ASSERT(m_outEdges.end() == util::find(m_outEdges, edge));
- m_outEdges.emplace_back(edge);
-}
-
-void Node::removeOutEdge(Edge* edge)
-{
- ASSERT(nullptr != edge);
- // Nodes usually have only a small amount of connections so linear search should be fine here
- auto it = util::find(m_outEdges, edge);
- ASSERT(m_outEdges.end() != it);
- util::unstable_erase(m_outEdges, it);
-}
-
-Graph* Node::getParent() const
-{
- return m_parent;
-}
-
-Node::EdgeSetRange Node::inEdges()
-{
- return util::map<HandleMapper>(util::toRange(m_inEdges));
-}
-
-Node::EdgeSetCRange Node::inEdges() const
-{
- return util::map<HandleMapper>(util::toRange(m_inEdges));
-}
-
-Node::EdgeSetRange Node::outEdges()
-{
- return util::map<HandleMapper>(util::toRange(m_outEdges));
-}
-
-Node::EdgeSetCRange Node::outEdges() const
-{
- return util::map<HandleMapper>(util::toRange(m_outEdges));
-}
-
-Node::InNodeSetRange Node::inNodes()
-{
- return util::map<InEdgeMapper>(inEdges());
-}
-
-Node::InNodeSetCRange Node::inNodes() const
-{
- return util::map<InEdgeMapper>(inEdges());
-}
-
-Node::OutNodeSetRange Node::outNodes()
-{
- return util::map<OutEdgeMapper>(outEdges());
-}
-
-Node::OutNodeSetCRange Node::outNodes() const
-{
- return util::map<OutEdgeMapper>(outEdges());
-}
-
-EdgeHandle Node::HandleMapper::operator()(Edge* obj) const
-{
- ASSERT(nullptr != obj);
- return Graph::HandleMapper()(obj);
-}
-
-NodeHandle Node::InEdgeMapper::operator()(const EdgeHandle& handle) const
-{
- ASSERT(nullptr != handle);
- return handle->srcNode();
-}
-
-NodeHandle Node::OutEdgeMapper::operator()(const EdgeHandle& handle) const
-{
- ASSERT(nullptr != handle);
- return handle->dstNode();
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/passes/communications.cpp b/inference-engine/thirdparty/ade/ade/source/passes/communications.cpp
deleted file mode 100644
index fb0da6323..000000000
--- a/inference-engine/thirdparty/ade/ade/source/passes/communications.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <passes/communications.hpp>
-
-#include <iterator>
-#include <unordered_map>
-#include <unordered_set>
-#include <atomic>
-#include <stdexcept>
-
-#include <typed_graph.hpp>
-
-#include <communication/comm_buffer.hpp>
-#include <communication/comm_interface.hpp>
-#include <communication/callback_connector.hpp>
-
-#include <memory/memory_descriptor.hpp>
-#include <memory/memory_descriptor_view.hpp>
-
-#include <util/algorithm.hpp>
-#include <util/chain_range.hpp>
-
-#include <memory/alloc.hpp>
-
-namespace
-{
-
-using NodeHasher = ade::HandleHasher<ade::Node>;
-
-struct CacheEntry final
-{
- std::unordered_set<ade::NodeHandle, NodeHasher> commNodes;
- std::unordered_set<ade::NodeHandle, NodeHasher> producers;
- std::unordered_set<ade::NodeHandle, NodeHasher> consumers;
-};
-
-using Cache = std::unordered_map<ade::MemoryDescriptorView*, CacheEntry>;
-
-struct CallbackCacheEntry final
-{
- std::unordered_set<ade::NodeHandle, NodeHasher> producers;
- std::unordered_set<ade::NodeHandle, NodeHasher> consumers;
-};
-
-using CallbackCache = std::unordered_map<ade::NodeHandle, CallbackCacheEntry, NodeHasher>;
-
-
-ade::MemoryDescriptorView* findParentView(ade::MemoryDescriptorView* view)
-{
- ASSERT(nullptr != view);
-
- auto parent = view->getParentView();
- if (nullptr != parent)
- {
- return findParentView(parent);
- }
- return view;
-}
-
-void visitProducer(Cache& cache,
- CallbackCache& callbackCache,
- const ade::NodeHandle& commNode,
- const ade::NodeHandle& node,
- ade::passes::ConnectCommChannels::Context& ctx)
-{
- ASSERT(nullptr != node);
- ASSERT(ctx.graph.metadata(node).contains<ade::meta::DataObject>());
- auto memDesc = findParentView(ctx.graph.metadata(node).get<ade::meta::DataObject>().dataRef.getView());
- ASSERT(nullptr != memDesc);
- bool connectedToNode = false;
- for (auto edge: node->inEdges())
- {
- auto srcNode = edge->srcNode();
- if (ctx.graph.metadata(srcNode).contains<ade::meta::NodeInfo>())
- {
- connectedToNode = true;
- callbackCache[commNode].producers.insert(srcNode);
- }
- else if (ctx.graph.metadata(srcNode).contains<ade::meta::DataObject>())
- {
- visitProducer(cache, callbackCache, commNode, srcNode, ctx);
- }
- }
-
- if (connectedToNode)
- {
- cache[memDesc].producers.insert(node);
- cache[memDesc].commNodes.insert(commNode);
- }
-}
-
-void visitConsumer(Cache& cache,
- CallbackCache& callbackCache,
- const ade::NodeHandle& commNode,
- const ade::NodeHandle& node,
- ade::passes::ConnectCommChannels::Context& ctx)
-{
- ASSERT(nullptr != node);
- ASSERT(ctx.graph.metadata(node).contains<ade::meta::DataObject>());
- auto memDesc = findParentView(ctx.graph.metadata(node).get<ade::meta::DataObject>().dataRef.getView());
- ASSERT(nullptr != memDesc);
- bool connectedToNode = false;
- for (auto edge: node->outEdges())
- {
- auto dstNode = edge->dstNode();
- if (ctx.graph.metadata(dstNode).contains<ade::meta::NodeInfo>())
- {
- connectedToNode = true;
- callbackCache[commNode].consumers.insert(dstNode);
- }
- else if (ctx.graph.metadata(dstNode).contains<ade::meta::DataObject>())
- {
- visitConsumer(cache, callbackCache, commNode, dstNode, ctx);
- }
- }
-
- if (connectedToNode)
- {
- cache[memDesc].consumers.insert(node);
- cache[memDesc].commNodes.insert(commNode);
- }
-}
-
-struct DataObject final
-{
- ade::MemoryDescriptorRef memory_ref;
- std::vector<ade::NodeHandle> commNodes;
- std::vector<ade::NodeHandle> producers;
- std::vector<ade::NodeHandle> consumers;
-};
-
-struct CallbackObject final
-{
- ade::NodeHandle commNode;
- std::vector<ade::NodeHandle> producers;
- std::vector<ade::NodeHandle> consumers;
-};
-
-struct CommObjects
-{
- std::vector<DataObject> dataObjects;
- std::vector<CallbackObject> callbackObjects;
-};
-
-CommObjects collectDataObjects(ade::passes::ConnectCommChannels::Context& ctx)
-{
- Cache cache;
- CallbackCache callbackCache;
- for (auto node: ctx.graph.nodes())
- {
- auto meta = ctx.graph.metadata(node);
- if (meta.contains<ade::meta::CommNode>())
- {
- for (auto edge: node->inEdges())
- {
- auto srcNode = edge->srcNode();
- visitProducer(cache, callbackCache, node, srcNode, ctx);
- }
-
- for (auto edge: node->outEdges())
- {
- auto dstNode = edge->dstNode();
- visitConsumer(cache, callbackCache, node, dstNode, ctx);
- }
- }
- }
-
- CommObjects ret;
- for (auto& obj: cache)
- {
- DataObject newObj;
- newObj.memory_ref = *obj.first;
- newObj.commNodes.reserve(obj.second.commNodes.size());
- newObj.producers.reserve(obj.second.producers.size());
- newObj.consumers.reserve(obj.second.consumers.size());
- util::copy(obj.second.commNodes, std::back_inserter(newObj.commNodes));
- util::copy(obj.second.producers, std::back_inserter(newObj.producers));
- util::copy(obj.second.consumers, std::back_inserter(newObj.consumers));
- ASSERT(!newObj.commNodes.empty());
- ASSERT(!newObj.producers.empty());
- ASSERT(!newObj.consumers.empty());
- ret.dataObjects.emplace_back(std::move(newObj));
- }
-
- for (auto& obj: callbackCache)
- {
- CallbackObject newObj;
- newObj.commNode = obj.first;
- newObj.producers.reserve(obj.second.producers.size());
- newObj.consumers.reserve(obj.second.consumers.size());
- util::copy(obj.second.producers, std::back_inserter(newObj.producers));
- util::copy(obj.second.consumers, std::back_inserter(newObj.consumers));
- ASSERT(!newObj.producers.empty());
- ASSERT(!newObj.consumers.empty());
- ret.callbackObjects.emplace_back(std::move(newObj));
- }
- return ret;
-}
-
-/// Fill common part of the BufferDesc
-template<typename T>
-ade::ICommChannel::BufferDesc fillBufferDesc(T& elem)
-{
- auto memRef = elem.memory_ref;
- ASSERT(nullptr != memRef);
- ade::ICommChannel::BufferDesc bufferDesc;
-
- // Fill common part of the BufferDesc
- bufferDesc.writersCount = util::checked_cast<int>(elem.producers.size());
- bufferDesc.readersCount = util::checked_cast<int>(elem.consumers.size());
- bufferDesc.memoryRef = memRef;
- return bufferDesc;
-}
-
-class HostBufferImpl final : public ade::IDataBuffer
-{
-public:
- HostBufferImpl(std::size_t elementSize,
- const ade::memory::DynMdSize& size,
- const ade::memory::DynMdSize& alignment);
-
- HostBufferImpl(const ade::MemoryDescriptorRef& memRef);
-
- ~HostBufferImpl();
-
- // IDataBuffer interface
- virtual MapId map(const Span& span, Access access) override;
- virtual void unmap(const MapId& id) override;
- virtual void finalizeWrite(const ade::IDataBuffer::Span& span) override;
- virtual void finalizeRead(const ade::IDataBuffer::Span& span) override;
- virtual Size alignment(const Span& span) override;
-
-private:
- struct Deleter
- {
- void operator()(void* ptr) const
- {
- ASSERT(nullptr != ptr);
- ade::aligned_free(ptr);
- }
- };
-
- std::atomic<int> m_accessCount = {0};
- ade::memory::DynMdSize m_size;
- ade::memory::DynMdSize m_alignment;
- ade::memory::DynMdView<void> m_view;
- std::unique_ptr<void, Deleter> m_memory;
- ade::MemoryDescriptorRef m_memRef;
-};
-
-HostBufferImpl::HostBufferImpl(std::size_t elementSize,
- const ade::memory::DynMdSize& size,
- const ade::memory::DynMdSize& alignment):
- m_size(size),
- m_alignment(alignment),
- m_view(util::alloc_view<ade::memory::MaxDimensions>
- (elementSize,
- util::memory_range(size.data(), size.dims_count()),
- util::memory_range(alignment.data(), alignment.dims_count()),
- [](std::size_t size, std::size_t align)
- {
- auto ptr = ade::aligned_alloc(size, align);
- if (nullptr == ptr)
- {
- throw_error(std::bad_alloc());
- }
- return ptr;
- })),
- m_memory(m_view.mem.data)
-{
-
-}
-
-HostBufferImpl::HostBufferImpl(const ade::MemoryDescriptorRef& memRef):
- m_size(memRef.span().size()),
- m_memRef(memRef)
-{
-
-}
-
-HostBufferImpl::~HostBufferImpl()
-{
- ASSERT(0 == m_accessCount);
-}
-
-ade::IDataBuffer::MapId HostBufferImpl::map(const Span& span, Access /*access*/)
-{
- auto view = (nullptr != m_view ? m_view : m_memRef.getExternalView());
- ASSERT(nullptr != view);
- ASSERT(span.dims_count() == m_size.dims_count());
- auto accessCount = ++m_accessCount;
- ASSERT(accessCount > 0);
- return MapId{view.slice(span), 0};
-}
-
-void HostBufferImpl::unmap(const MapId& /*id*/)
-{
- auto accessCount = --m_accessCount;
- ASSERT(accessCount >= 0);
-}
-
-void HostBufferImpl::finalizeWrite(const ade::IDataBuffer::Span& /*span*/)
-{
- //Nothing
-}
-
-void HostBufferImpl::finalizeRead(const ade::IDataBuffer::Span& /*span*/)
-{
- //Nothing
-}
-
-ade::IDataBuffer::Size HostBufferImpl::alignment(const Span& span)
-{
- ASSERT(span.dims_count() == m_size.dims_count());
- // TODO: report actual alignment
- Size ret;
- ret.redim(span.dims_count());
- util::fill(ret, 1);
- return ret;
-}
-
-}
-
-void ade::passes::ConnectCommChannels::operator()(ade::passes::ConnectCommChannels::Context ctx) const
-{
- // Step 1:
- // Collect all data objects directly or indirectly connected to comm nodes
- // group them by MemoryDescriptor and by a commnode
- const auto commObjects = collectDataObjects(ctx);
-
- // Step 2:
- // Check comm channels and callbacks validity
- {
- // Step 2.1
- // Check comm channels validity
- for (auto& elem: commObjects.dataObjects)
- {
- for (auto node: util::chain(util::toRange(elem.producers),
- util::toRange(elem.consumers)))
- {
- auto meta = ctx.graph.metadata(node);
- if (!meta.contains<ade::meta::DataObject>() ||
- !meta.contains<ade::meta::CommChannel>() ||
- nullptr == meta.get<ade::meta::CommChannel>().channel)
- {
- throw_error(std::runtime_error("Comm channel wasn't setup properly"));
- }
- }
- }
-
- // Step 2.2
- // Check comm callbacks validity
- for (auto& elem: commObjects.callbackObjects)
- {
- for (auto node: elem.consumers)
- {
- auto meta = ctx.graph.metadata(node);
- if (!meta.contains<ade::meta::CommConsumerCallback>() ||
- nullptr == meta.get<ade::meta::CommConsumerCallback>().callback)
- {
- throw_error(std::runtime_error("Consumer callback metadata error"));
- }
- }
- }
- }
-
- // Step 3:
- // Connect comm channels
- for (auto& elem: commObjects.dataObjects)
- {
- ade::ICommChannel::BufferDesc bufferDesc = fillBufferDesc(elem);
-
- // Step 3.1:
- // Collect buffer preferences
- ade::ICommChannel::BufferPrefs summary;
- summary.preferredAlignment.redim(bufferDesc.memoryRef.span().dims_count());
- util::fill(summary.preferredAlignment, 1);
- for (auto node: util::chain(util::toRange(elem.producers),
- util::toRange(elem.consumers)))
- {
- auto meta = ctx.graph.metadata(node);
- auto channel = meta.get<ade::meta::CommChannel>().channel;
- ASSERT(nullptr != channel);
- ade::ICommChannel::BufferPrefs prefs = channel->getBufferPrefs(bufferDesc);
- ASSERT(prefs.preferredAlignment.dims_count() == summary.preferredAlignment.dims_count());
- for (auto i: util::iota(summary.preferredAlignment.dims_count()))
- {
- ASSERT(prefs.preferredAlignment[i] > 0);
- // TODO: assert alignment is power of 2
- summary.preferredAlignment[i] =
- std::max(summary.preferredAlignment[i],
- prefs.preferredAlignment[i]);
- }
- }
-
- // Step 3.2:
- // Try to get buffer from channels
- std::unique_ptr<ade::IDataBuffer> buffer;
- for (auto node: util::chain(util::toRange(elem.producers),
- util::toRange(elem.consumers)))
- {
- ASSERT(nullptr == buffer);
- auto meta = ctx.graph.metadata(node);
- auto channel = meta.get<ade::meta::CommChannel>().channel;
- ASSERT(nullptr != channel);
- buffer = channel->getBuffer(bufferDesc, summary);
- if (nullptr != buffer)
- {
- break;
- }
- }
-
- if (nullptr == buffer)
- {
- // Step 3.3:
- // Buffer wasn't allocated by plugins, allocate it by framework
- if (nullptr == bufferDesc.memoryRef.getExternalView())
- {
- buffer.reset(new HostBufferImpl(bufferDesc.memoryRef.elementSize(),
- bufferDesc.memoryRef.size(),
- summary.preferredAlignment));
- }
- else
- {
- // Use existing buffer (e.g. from non-virtual object)
- buffer.reset(new HostBufferImpl(bufferDesc.memoryRef));
- }
- }
-
- // Step 3.4:
- // Notify plugins about buffer object
- ASSERT(nullptr != buffer);
- for (auto node: util::chain(util::toRange(elem.producers),
- util::toRange(elem.consumers)))
- {
- auto meta = ctx.graph.metadata(node);
- auto channel = meta.get<ade::meta::CommChannel>().channel;
- channel->setBuffer(ade::DataBufferView(buffer.get(), bufferDesc.memoryRef.span()), bufferDesc);
- }
- std::shared_ptr<ade::IDataBuffer> sharedBuffer(std::move(buffer));
- for (auto commNode: elem.commNodes)
- {
- auto meta = ctx.graph.metadata(commNode);
- meta.get<ade::meta::CommNode>().addDataBuffer(sharedBuffer);
- }
- }
-
- // Step 4
- // Connect comm objects callbacks
- {
- // Multiple comm nodes can be attached to single producer data object
- // so we need to collect and merge them
- std::unordered_map<ade::NodeHandle, std::vector<std::function<void()>>, NodeHasher> producerCallbacks;
- for (auto& elem: commObjects.callbackObjects)
- {
- ASSERT(nullptr != elem.commNode);
- ASSERT(!elem.producers.empty() && !elem.consumers.empty());
-
- ade::CallbackConnector<> connector(util::checked_cast<int>(elem.producers.size()),
- util::checked_cast<int>(elem.consumers.size()));
-
- // Step 4.1
- // Collect callbacks from consumers
- for (auto& consumer: elem.consumers)
- {
- auto meta = ctx.graph.metadata(consumer);
- auto callback = std::move(meta.get<ade::meta::CommConsumerCallback>().callback);
- ASSERT(nullptr != callback);
- connector.addConsumerCallback(std::move(callback));
- }
-
- // Step 4.2
- // Create producer callbacks
- auto resetter = connector.finalize();
- if (nullptr != resetter)
- {
- auto meta = ctx.graph.metadata();
- if (!meta.contains<ade::meta::Finalizers>())
- {
- meta.set(ade::meta::Finalizers());
- }
- meta.get<ade::meta::Finalizers>().finalizers.emplace_back(std::move(resetter));
- }
-
- // Step 4.3
- // Collect producer callbacks
- for (auto& producer: elem.producers)
- {
- auto callback = connector.getProducerCallback();
- ASSERT(nullptr != callback);
- producerCallbacks[producer].emplace_back(std::move(callback));
- }
- }
-
- // Step 4.4
- // Assign producer callbacks
- for (auto& elem: producerCallbacks)
- {
- auto producer = elem.first;
-
- auto callbacks = std::move(elem.second);
- ASSERT(!callbacks.empty());
-
- auto meta = ctx.graph.metadata(producer);
- if (!meta.contains<ade::meta::CommProducerCallback>())
- {
- meta.set(ade::meta::CommProducerCallback());
- }
-
- if (1 == callbacks.size())
- {
- // Assign directly
- meta.get<ade::meta::CommProducerCallback>().callback = callbacks[0];
- }
- else
- {
- // Create wrapper to call all callbacks
- struct Connector final
- {
- std::vector<std::function<void()>> callbacks;
-
- void operator()() const
- {
- ASSERT(!callbacks.empty());
- for (auto& callback: callbacks)
- {
- ASSERT(nullptr != callback);
- callback();
- }
- }
- };
-
- meta.get<ade::meta::CommProducerCallback>().callback = Connector{std::move(callbacks)};
- }
- }
- }
-}
-
-const char* ade::passes::ConnectCommChannels::name()
-{
- return "ade::passes::ConnectCommChannels";
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/search.cpp b/inference-engine/thirdparty/ade/ade/source/search.cpp
deleted file mode 100644
index 3a68ab3df..000000000
--- a/inference-engine/thirdparty/ade/ade/source/search.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <helpers/search.hpp>
-
-namespace ade
-{
-namespace
-{
-template<typename Visitor, typename Traverse>
-void dfsHelper(const NodeHandle& node,
- Visitor&& visitor,
- Traverse&& direction)
-{
- direction(*node, [&](const NodeHandle& nextNode)
- {
- assert(nullptr != nextNode);
- if (visitor(nextNode))
- {
- dfsHelper(nextNode,
- std::forward<Visitor>(visitor),
- std::forward<Traverse>(direction));
- }
- });
-}
-}
-
-void dfs(const NodeHandle& node,
- util::func_ref<bool (const NodeHandle&)> visitor,
- traverse::traverse_func_type direction)
-{
- ASSERT(nullptr != node);
- dfsHelper(node, visitor, direction);
-}
-
-namespace details
-{
-
-namespace
-{
-template<typename Traverse>
-void TransitiveClosureHelperImpl(
- details::TransitiveClosureHelper::CacheT& cache,
- const NodeHandle& node,
- Traverse&& direction)
-{
- ASSERT(nullptr != node);
- ASSERT(!util::contains(cache, node));
- auto& elem = cache[node];
- (void)elem; // Silence klocwork warning
- direction(*node, [&](const NodeHandle& outNode)
- {
- ASSERT(nullptr != outNode);
- if (!util::contains(cache, outNode))
- {
- TransitiveClosureHelperImpl(cache,
- outNode,
- std::forward<Traverse>(direction));
- }
- ASSERT(util::contains(cache, outNode));
- elem.insert(outNode);
- auto& nextNodes = cache[outNode];
- elem.insert(nextNodes.begin(), nextNodes.end());
- });
-}
-}
-
-void details::TransitiveClosureHelper::operator()(
- details::TransitiveClosureHelper::CacheT& cache,
- const NodeHandle& node,
- traverse::traverse_func_type direction) const
-{
- TransitiveClosureHelperImpl(cache, node, direction);
-}
-
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/subgraphs.cpp b/inference-engine/thirdparty/ade/ade/source/subgraphs.cpp
deleted file mode 100644
index 857a5b7fd..000000000
--- a/inference-engine/thirdparty/ade/ade/source/subgraphs.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include <helpers/subgraphs.hpp>
-
-#include <util/hash.hpp>
-
-namespace ade
-{
-
-namespace
-{
-struct Subgraph final
-{
- std::vector<NodeHandle> nodes;
- subgraphs::NodesSet acceptedNodes;
- subgraphs::NodesSet rejectedNodes;
-
- void acceptNode(const NodeHandle& node)
- {
- ASSERT(nullptr != node);
- ASSERT(!util::contains(acceptedNodes, node));
- ASSERT(!util::contains(rejectedNodes, node));
- nodes.push_back(node);
- acceptedNodes.insert(node);
- }
-
- void rejectNode(const NodeHandle& node)
- {
- ASSERT(nullptr != node);
- ASSERT(!util::contains(acceptedNodes, node));
- ASSERT(!util::contains(rejectedNodes, node));
- rejectedNodes.insert(node);
- }
-
- void rollback()
- {
- ASSERT(!nodes.empty());
- auto node = nodes.back();
- ASSERT(util::contains(acceptedNodes, node));
- ASSERT(!util::contains(rejectedNodes, node));
- rejectedNodes.insert(node);
- acceptedNodes.erase(node);
- nodes.pop_back();
- }
-
- bool nodeVisited(const NodeHandle& node) const
- {
- ASSERT(nullptr != node);
- return util::contains(acceptedNodes, node) ||
- util::contains(rejectedNodes, node);
- }
-
- bool nodeRejected(const NodeHandle& node) const
- {
- ASSERT(nullptr != node);
- return util::contains(rejectedNodes, node);
- }
-
- bool empty() const
- {
- return nodes.empty();
- }
-};
-
-template<typename Visitor>
-void visitAdjacent(const NodeHandle& node, Visitor&& visitor)
-{
- ASSERT(nullptr != node);
- for (const auto& prevEdge : node->inEdges())
- {
- ASSERT(nullptr != prevEdge);
- if (visitor(prevEdge, SubgraphMergeDirection::In))
- {
- auto prevNode = prevEdge->srcNode();
- ASSERT(nullptr != prevNode);
- visitAdjacent(prevNode, std::forward<Visitor>(visitor));
- }
- }
- for (const auto& nextEdge : node->outEdges())
- {
- ASSERT(nullptr != nextEdge);
- if (visitor(nextEdge, SubgraphMergeDirection::Out))
- {
- auto nextNode = nextEdge->dstNode();
- ASSERT(nullptr != nextNode);
- visitAdjacent(nextNode, std::forward<Visitor>(visitor));
- }
- }
-}
-
-template<typename Visitor>
-void visitPaths(std::vector<NodeHandle>& path, const NodeHandle& node,
- Visitor&& visitor)
-{
- ASSERT(nullptr != node);
- for (const auto& nextNode : node->outNodes())
- {
- ASSERT(nullptr != nextNode);
- path.push_back(nextNode);
- if (visitor(path, node, nextNode))
- {
- visitPaths(path, nextNode, std::forward<Visitor>(visitor));
- }
- path.pop_back();
- }
-}
-
-}
-
-std::vector<NodeHandle> assembleSubgraph(
- const NodeHandle& root,
- util::func_ref<bool(const EdgeHandle&,
- SubgraphMergeDirection)> mergeChecker,
- util::func_ref<bool(const subgraphs::NodesSet& acceptedNodes,
- const subgraphs::NodesSet& rejectedNodes)> topoChecker)
-{
- ASSERT(nullptr != root);
-
- Subgraph subgraph;
- subgraph.acceptNode(root);
-
- visitAdjacent(root, [&](const EdgeHandle& edge,
- SubgraphMergeDirection direction)
- {
- ASSERT(nullptr != edge);
- auto srcNode = getSrcMergeNode(edge, direction);
- auto dstNode = getDstMergeNode(edge, direction);
- ASSERT(nullptr != srcNode);
- ASSERT(nullptr != dstNode);
- if (subgraph.nodeRejected(srcNode) ||
- subgraph.nodeVisited(dstNode))
- {
- return false;
- }
-
- bool merge = mergeChecker(edge, direction);
- if (merge)
- {
- subgraph.acceptNode(dstNode);
- }
- else
- {
- subgraph.rejectNode(dstNode);
- }
-
- while(!topoChecker(subgraph.acceptedNodes, subgraph.rejectedNodes))
- {
- merge = false;
- if (subgraph.empty())
- {
- return false;
- }
- subgraph.rollback();
- }
- return merge;
- });
-
- return std::move(subgraph.nodes);
-}
-
-void findPaths(const NodeHandle& src, const NodeHandle& dst,
- util::func_ref<bool(const std::vector<NodeHandle>&)> visitor)
-{
- ASSERT(nullptr != src);
- ASSERT(nullptr != dst);
- std::vector<NodeHandle> pathVec{src};
- bool found = false;
- (void)found; // Silence klocwork warning
- visitPaths(pathVec, src, [&](
- const std::vector<NodeHandle>& path,
- const NodeHandle& prev, const NodeHandle& next)
- {
- ASSERT(nullptr != prev);
- ASSERT(nullptr != next);
- if (next == dst)
- {
- found = visitor(path);
- return false;
- }
- return !found;
- });
-}
-namespace
-{
-
-bool hasIntersectionImpl(const subgraphs::NodesSet& nodes1,
- const subgraphs::NodesSet& nodes2)
-{
- for (auto&& node : nodes1)
- {
- ASSERT(nullptr != node);
- if (util::contains(nodes2, node))
- {
- return true;
- }
- }
- return false;
-}
-bool hasIntersection(const subgraphs::NodesSet& nodes1,
- const subgraphs::NodesSet& nodes2)
-{
- if (nodes1.size() < nodes2.size())
- {
- return hasIntersectionImpl(nodes1, nodes2);
- }
- else
- {
- return hasIntersectionImpl(nodes2, nodes1);
- }
-}
-}
-
-bool SubgraphSelfReferenceChecker::operator()(
- const subgraphs::NodesSet& acceptedNodes,
- const subgraphs::NodesSet& rejectedNodes)
-{
- for (auto&& srcNode : acceptedNodes)
- {
- ASSERT(nullptr != srcNode);
- if (srcNode->outEdges().size() > 1)
- {
- for (auto&& dstNode : acceptedNodes)
- {
- ASSERT(nullptr != dstNode);
- if (srcNode == dstNode)
- {
- continue;
- }
-
- if (dstNode->inEdges().size() > 1)
- {
- auto key = std::make_pair(srcNode, dstNode);
- if (!util::contains(m_cache, key))
- {
- updateCache(key);
- ASSERT(util::contains(m_cache, key));
- }
-
- auto& paths = m_cache.find(key)->second;
-
- if (hasIntersection(paths, rejectedNodes))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
-}
-
-void SubgraphSelfReferenceChecker::reset()
-{
- m_cache.clear();
-}
-
-std::size_t SubgraphSelfReferenceChecker::Hasher::operator()(
- const std::pair<NodeHandle, NodeHandle>& value) const
-{
- ASSERT(nullptr != value.first);
- ASSERT(nullptr != value.second);
-
- ade::HandleHasher<ade::Node> h;
- return util::hash_combine(h(value.first), h(value.second));
-}
-
-void SubgraphSelfReferenceChecker::updateCache(
- const std::pair<NodeHandle, NodeHandle>& key)
-{
- ASSERT(nullptr != key.first);
- ASSERT(nullptr != key.second);
- subgraphs::NodesSet nodes;
- auto it = m_connections.find(key.first);
- if (m_connections.end() != it)
- {
- for (auto node : it->second)
- {
- ASSERT(nullptr != node);
- if (key.second != node)
- {
- auto it2 = m_connections.find(node);
- if (m_connections.end() != it2 &&
- util::contains(it2->second, key.second))
- {
- nodes.insert(node);
- }
- }
- }
- }
- m_cache.insert({key, std::move(nodes)});
-}
-
-}
diff --git a/inference-engine/thirdparty/ade/ade/source/topological_sort.cpp b/inference-engine/thirdparty/ade/ade/source/topological_sort.cpp
deleted file mode 100644
index 7bc529519..000000000
--- a/inference-engine/thirdparty/ade/ade/source/topological_sort.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "passes/topological_sort.hpp"
-
-#include <vector>
-#include <unordered_set>
-
-#include "graph.hpp"
-
-namespace ade
-{
-namespace passes
-{
-using sorted_t = std::vector<NodeHandle>;
-using visited_t = std::unordered_set<Node*>;
-
-static void visit(sorted_t& sorted, visited_t& visited, const NodeHandle& node)
-{
- if (visited.end() == visited.find(node.get()))
- {
- for (auto adj:
- util::map(node->inEdges(), [](const EdgeHandle& e) { return e->srcNode(); }))
- {
- visit(sorted, visited, adj);
- }
- sorted.push_back(node);
- visited.insert(node.get());
- }
-}
-
-void TopologicalSort::operator()(TypedPassContext<TopologicalSortData> context) const
-{
- sorted_t sorted;
- visited_t visited;
- for (auto node: context.graph.nodes())
- {
- visit(sorted, visited, node);
- }
- context.graph.metadata().set(TopologicalSortData(std::move(sorted)));
-}
-
-const char* TopologicalSort::name()
-{
- return "TopologicalSort";
-}
-
-const char* TopologicalSortData::name()
-{
- return "TopologicalSortData";
-}
-
-bool LazyTopologicalSortChecker::nodeCreated(const Graph& /*graph*/, const NodeHandle& /*node*/)
-{
- // We need to rebuild nodes list after nodes creation
- return false;
-}
-
-bool LazyTopologicalSortChecker::nodeAboutToBeDestroyed(const Graph& /*graph*/, const NodeHandle& /*node*/)
-{
- // Removing node cannot change topological order and sorter nodes list can correctly handle nodes removal
- return true;
-}
-
-bool LazyTopologicalSortChecker::edgeCreated(const Graph& /*graph*/, const EdgeHandle& /*edge*/)
-{
- // Adding edge CAN change topological order
- return false;
-}
-
-bool LazyTopologicalSortChecker::edgeAboutToBeDestroyed(const Graph& /*graph*/, const EdgeHandle& /*edge*/)
-{
- // Removing edge cannot change topological order
- return true;
-}
-
-bool LazyTopologicalSortChecker::edgeAboutToBeRelinked(const Graph& /*graph*/,
- const EdgeHandle& /*edge*/,
- const NodeHandle& /*newSrcNode*/,
- const NodeHandle& /*newDstNode*/)
-{
- // Relinking edge CAN change topological order
- return false;
-}
-
-}
-}
diff --git a/inference-engine/thirdparty/ade/common/include/util/algorithm.hpp b/inference-engine/thirdparty/ade/common/include/util/algorithm.hpp
deleted file mode 100644
index d161b6c8c..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/algorithm.hpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_ALGORITHM_HPP
-#define UTIL_ALGORITHM_HPP
-
-#include <algorithm>
-#include <utility>
-#include <iterator>
-#include "util/type_traits.hpp"
-#include "util/checked_cast.hpp"
-
-namespace util
-{
-template <typename container_t, typename predicate_t>
-inline bool any_of(container_t&& c, predicate_t&& p)
-{
- return std::any_of(std::begin(c), std::end(c), std::forward<predicate_t>(p));
-}
-
-template <typename container_t, typename predicate_t>
-inline bool all_of(container_t&& c, predicate_t&& p)
-{
- return std::all_of(std::begin(c), std::end(c), std::forward<predicate_t>(p));
-}
-
-template<typename container_t, typename predicate_t>
-inline decltype(std::begin(std::declval<container_t>())) find_if(container_t&& c, predicate_t&& p)
-{
- return std::find_if(std::begin(c), std::end(c), std::forward<predicate_t>(p));
-}
-
-template<typename container_t, typename value_t>
-inline decltype(std::begin(std::declval<container_t>())) find(container_t&& c, const value_t& val)
-{
- return std::find(std::begin(c), std::end(c), val);
-}
-
-template<typename C, typename T>
-inline bool contains(const C& cont, const T& val)
-{
- return cont.end() != cont.find(val);
-}
-
-template<typename container_t, typename iterator_t>
-void unstable_erase(container_t&& c, iterator_t&& it)
-{
- *it = std::move(c.back());
- c.pop_back();
-}
-
-template<typename container_t, typename output_iterator_t>
-inline remove_reference_t<output_iterator_t> copy(container_t &&c, output_iterator_t &&it)
-{
- return std::copy(std::begin(c), std::end(c), std::forward<output_iterator_t>(it));
-}
-
-template<typename container_t, typename output_iterator_t, typename predicate_t>
-inline remove_reference_t<output_iterator_t> copy_if(container_t &&c, output_iterator_t &&it, predicate_t&& p)
-{
- return std::copy_if(std::begin(c), std::end(c), std::forward<output_iterator_t>(it), std::forward<predicate_t>(p));
-}
-
-template<typename container_t, typename output_iterator_t, typename predicate_t>
-inline remove_reference_t<output_iterator_t> transform(container_t &&c, output_iterator_t &&it, predicate_t&& p)
-{
- return std::transform(std::begin(c), std::end(c), std::forward<output_iterator_t>(it), std::forward<predicate_t>(p));
-}
-
-template<typename container_t, typename predicate_t>
-inline decltype(std::begin(std::declval<container_t>())) max_element(container_t&& c, predicate_t&& p)
-{
- return std::max_element(std::begin(c), std::end(c), std::forward<predicate_t>(p));
-}
-
-template<typename IterIn, typename IterOut>
-inline void convert(IterIn inFirst, IterIn inLast, IterOut outFirst)
-{
- typedef typename std::iterator_traits<IterIn>::value_type InT;
- typedef typename std::iterator_traits<IterOut>::value_type OutT;
- std::transform(inFirst, inLast, outFirst, [](InT v) {
- return checked_cast<OutT>(v);
- });
-}
-
-template<typename IterIn, typename N, typename IterOut>
-inline void convert_n(IterIn inFirst, N n, IterOut outFirst)
-{
- util::convert(inFirst, inFirst+n, outFirst);
-}
-
-template<typename container_t, typename value_t>
-void fill(container_t&& c, value_t&& val)
-{
- std::fill(std::begin(c), std::end(c), std::forward<value_t>(val));
-}
-
-namespace details
-{
-
-template<std::size_t I, typename Target, typename First, typename... Remaining>
-struct type_list_index_helper
-{
- static const constexpr bool is_same = std::is_same<Target, First>::value;
- static const constexpr std::size_t value =
- std::conditional<is_same, std::integral_constant<std::size_t, I>, type_list_index_helper<I + 1, Target, Remaining...>>::type::value;
-};
-
-template<std::size_t I, typename Target, typename First>
-struct type_list_index_helper<I, Target, First>
-{
- static_assert(std::is_same<Target, First>::value, "Type not found");
- static const constexpr std::size_t value = I;
-};
-
-}
-
-template<typename Target, typename... Types>
-struct type_list_index
-{
- static const constexpr std::size_t value = ::util::details::type_list_index_helper<0, Target, Types...>::value;
-};
-} // namespace util
-
-#endif // UTIL_ALGORITHM_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/any.hpp b/inference-engine/thirdparty/ade/common/include/util/any.hpp
deleted file mode 100644
index de1d43ed8..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/any.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_ANY_HPP
-#define UTIL_ANY_HPP
-
-#include <memory>
-#include <type_traits>
-#include <utility>
-#include <typeinfo>
-
-#include "assert.hpp"
-
-//TODO - drop any from ADE metadata, using only typed graph
-//and to introduce bind() instead
-
-namespace internal
-{
- template <class T, class Source>
- T down_cast(Source operand)
- {
-#if defined(__GXX_RTTI) || defined(_CPPRTTI)
- return dynamic_cast<T>(operand);
-#else
- #warning used static cast instead of dynamic because RTTI is disabled
- return static_cast<T>(operand);
-#endif
- }
-}
-
-namespace util
-{
- class bad_any_cast : public std::bad_cast
- {
- public:
- virtual const char* what() const noexcept override
- {
- return "Bad any cast";
- }
- };
-
- //modeled against C++17 std::any
- class any
- {
- private:
- struct holder;
- using holder_ptr = std::unique_ptr<holder>;
- struct holder
- {
- virtual holder_ptr clone() = 0;
- virtual ~holder() = default;
- };
-
- template <typename value_t>
- struct holder_impl : holder
- {
- value_t v;
- template<typename arg_t>
- holder_impl(arg_t&& a) : v(std::forward<arg_t>(a)) {}
- holder_ptr clone() override { return holder_ptr(new holder_impl (v));}
- };
-
- holder_ptr hldr;
- public:
- template<class value_t>
- any(value_t&& arg) : hldr(new holder_impl<typename std::decay<value_t>::type>( std::forward<value_t>(arg))) {}
-
- any(any const& src) : hldr( src.hldr ? src.hldr->clone() : nullptr) {}
- //simple hack in order not to write enable_if<not any> for the template constructor
- any(any & src) : any (const_cast<any const&>(src)) {}
-
- any() = default;
- any(any&& ) = default;
-
- any& operator=(any&&) = default;
-
- any& operator=(any const& src)
- {
- any copy(src);
- swap(*this, copy);
- return *this;
- }
-
- template<class value_t>
- friend value_t* any_cast(any* operand);
-
- template<class value_t>
- friend const value_t* any_cast(const any* operand);
-
- friend void swap(any & lhs, any& rhs)
- {
- swap(lhs.hldr, rhs.hldr);
- }
-
- };
-
- template<class value_t>
- value_t* any_cast(any* operand)
- {
- auto casted = internal::down_cast<any::holder_impl<typename std::decay<value_t>::type> *>(operand->hldr.get());
- if (casted){
- return & (casted->v);
- }
- return nullptr;
- }
-
- template<class value_t>
- const value_t* any_cast(const any* operand)
- {
- auto casted = internal::down_cast<any::holder_impl<typename std::decay<value_t>::type> *>(operand->hldr.get());
- if (casted){
- return & (casted->v);
- }
- return nullptr;
- }
-
- template<class value_t>
- value_t& any_cast(any& operand)
- {
- auto ptr = any_cast<value_t>(&operand);
- if (ptr)
- {
- return *ptr;
- }
-
- throw_error(bad_any_cast());
- }
-
-
- template<class value_t>
- const value_t& any_cast(const any& operand)
- {
- auto ptr = any_cast<value_t>(&operand);
- if (ptr)
- {
- return *ptr;
- }
-
- throw_error(bad_any_cast());
- }
-}
-
-#endif // UTIL_ANY_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/assert.hpp b/inference-engine/thirdparty/ade/common/include/util/assert.hpp
deleted file mode 100644
index 07481849c..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/assert.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_ASSERT_HPP
-#define UTIL_ASSERT_HPP
-
-#include <cassert>
-#include <utility>
-
-#if !defined(__EXCEPTIONS)
-#include <stdlib.h>
-#include <stdio.h>
-#endif
-
-#if defined(_MSC_VER)
-#define unreachable() __assume(0)
-#elif defined(__GNUC__)
-#define unreachable() __builtin_unreachable()
-#else
-#define unreachable() do{}while(false)
-#endif
-
-#ifdef DEVELOPMENT_MODE
-#include <cstdio>
-#include <cstdlib> // abort()
-inline void dev_assert(bool val, const char* str, int line, const char* file)
-{
- if (!val)
- {
- fprintf(stderr, "%s:%d: Assertion \"%s\" failed\n", file, line, str);
- fflush(stderr);
- abort();
- }
-}
-#define ASSERT(arg) dev_assert(static_cast<bool>(arg), #arg, __LINE__, __FILE__)
-#else
-#define ASSERT(arg) do { \
- constexpr bool _assert_tmp = false && (arg); \
- (void) _assert_tmp; \
- assert(arg); \
-} while(false)
-#endif
-
-/// Stronger version of assert which translates to compiler hint in optimized
-/// builds. Do not use it if you have subsequent error recovery code because
-/// this code can be optimized away.
-/// Expression is always evaluated, avoid functions calls in it.
-/// Static analyzers friendly and can silence "possible null pointer
-/// dereference" warnings.
-#if defined(DEVELOPMENT_MODE) || !defined(NDEBUG)
-#define ASSERT_STRONG(expr) ASSERT(expr)
-#else
-#define ASSERT_STRONG(expr) do{ if(!(expr)) { unreachable(); } }while(false)
-#endif
-
-#define UNREACHABLE(str) ASSERT_STRONG(!str)
-
-template <class ExceptionType>
-[[noreturn]] void throw_error(ExceptionType &&e)
-{
-#if defined(__EXCEPTIONS) || defined(_CPPUNWIND)
- throw std::forward<ExceptionType>(e);
-#else
- fprintf(stderr, "An exception thrown! %s\n" , e.what());
- fflush(stderr);
- abort();
-#endif
-}
-
-#if (defined NDEBUG) && !(defined DEVELOPMENT_MODE)
-#define ASSERT_OR_THROW_ON_FAIL(expr) if (!expr) throw_error(std::runtime_error("Assertion failed!"))
-#else
-#define ASSERT_OR_THROW_ON_FAIL(expr) ASSERT(expr);
-#endif
-
-#endif // UTIL_ASSERT_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/callonce.hpp b/inference-engine/thirdparty/ade/common/include/util/callonce.hpp
deleted file mode 100644
index 6ec574267..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/callonce.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_CALL_ONCE_HPP
-#define UTIL_CALL_ONCE_HPP
-
-#include <type_traits>
-#include <mutex>
-
-namespace util
-{
-// Special helper for thread-safe call once per graph execution
-class CallOnce
-{
- using Storage = typename std::aligned_storage<sizeof(std::once_flag), alignof(std::once_flag)>::type;
-
- Storage m_flagStorage;
-
- CallOnce(const CallOnce&) = delete;
- CallOnce& operator=(const CallOnce&) = delete;
- CallOnce(const CallOnce&&) = delete;
- CallOnce& operator=(const CallOnce&&) = delete;
-
-public:
-
- CallOnce() { reset(); }
-
- template<typename F> void operator()(F&& f)
- {
- std::call_once(*reinterpret_cast<std::once_flag*>(&m_flagStorage), std::forward<F>(f));
- }
-
- void reset()
- {
- new (&m_flagStorage) std::once_flag;
- }
-};
-
-} // namespace DMIP
-
-#endif // UTIL_CALL_ONCE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/chain_range.hpp b/inference-engine/thirdparty/ade/common/include/util/chain_range.hpp
deleted file mode 100644
index 93e146fc0..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/chain_range.hpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_CHAIN_RANGE_HPP
-#define UTIL_CHAIN_RANGE_HPP
-
-#include <utility>
-#include <type_traits>
-
-#include "util/range.hpp"
-#include "util/type_traits.hpp"
-#include "util/assert.hpp"
-#include "util/range_iterator.hpp"
-
-namespace util
-{
-inline namespace Range
-{
-template<typename Range1, typename Range2>
-struct ChainRange : public IterableRange<ChainRange<Range1, Range2>>
-{
- Range1 range1;
- Range2 range2;
-
- ChainRange() = default;
- ChainRange(const ChainRange&) = default;
- ChainRange(ChainRange&&) = default;
- ChainRange& operator=(const ChainRange&) = default;
- ChainRange& operator=(ChainRange&&) = default;
-
- template<typename R1, typename R2>
- ChainRange(R1&& r1, R2&& r2):
- range1(std::forward<R1>(r1)),
- range2(std::forward<R2>(r2))
- {
-
- }
-
- // common_type will strip references from types but we want to retain them
- // if types exactly the same
- template<typename First, typename Second>
- using return_type_helper_t = typename std::conditional<
- std::is_same<First, Second>::value,
- First,
- util::common_type_t<First, Second>
- >::type;
-
- bool empty() const
- {
- return range1.empty() && range2.empty();
- }
-
- void popFront()
- {
- ASSERT(!empty());
- if (!range1.empty())
- {
- range1.popFront();
- }
- else
- {
- range2.popFront();
- }
- }
-
- auto front()
- ->return_type_helper_t<decltype(this->range1.front()),decltype(this->range2.front())>
- {
- ASSERT(!empty());
- if (!range1.empty())
- {
- return range1.front();
- }
- return range2.front();
- }
-
- auto front() const
- ->return_type_helper_t<decltype(this->range1.front()),decltype(this->range2.front())>
- {
- ASSERT(!empty());
- if (!range1.empty())
- {
- return range1.front();
- }
- return range2.front();
- }
-
- template<typename R1 = Range1, typename R2 = Range2,
- util::enable_b_t<(details::has_size_fun<R1>::value &&
- details::has_size_fun<R2>::value)> = true> //SFINAE
- auto size() const
- ->util::common_type_t<decltype(details::range_size_wrapper(std::declval<R1>())),
- decltype(details::range_size_wrapper(std::declval<R2>()))>
- {
- return details::range_size_wrapper(range1) + details::range_size_wrapper(range2);
- }
-
- template<typename R1 = Range1, typename R2 = Range2,
- util::enable_b_t<(sizeof(std::declval<R1>()[0]) > 0 &&
- sizeof(std::declval<R2>()[0]) > 0)> = true> //SFINAE
- auto operator[](std::size_t index)
- ->return_type_helper_t<decltype(std::declval<R1>()[0]),decltype(std::declval<R2>()[0])>
- {
- ASSERT(index < size());
- const auto size1 = details::range_size_wrapper(range1);
- if (index < size1)
- {
- return range1[index];
- }
- return range2[index - size1];
- }
-
- template<typename R1 = Range1, typename R2 = Range2,
- util::enable_b_t<(sizeof(std::declval<const R1>()[0]) > 0 &&
- sizeof(std::declval<const R2>()[0]) > 0)> = true> //SFINAE
- auto operator[](std::size_t index) const
- ->return_type_helper_t<decltype(std::declval<const R1>()[0]),decltype(std::declval<const R2>()[0])>
- {
- ASSERT(index < size());
- const auto size1 = details::range_size_wrapper(range1);
- if (index < size1)
- {
- return range1[index];
- }
- return range2[index - size1];
- }
-};
-
-template<typename Range1, typename Range2>
-inline auto size(const ChainRange<Range1, Range2>& range)
-->decltype(range.size())
-{
- return range.size();
-}
-
-template <typename Range1, typename... Ranges>
-struct chain_type;
-
-template <typename Range1>
-struct chain_type<Range1> { using type = remove_reference_t<Range1>; };
-
-template <typename Range1, typename Range2, typename... Ranges>
-struct chain_type<Range1, Range2, Ranges...>
-{
- using type = ChainRange<remove_reference_t<Range1>,
- typename chain_type<remove_reference_t<Range2>, remove_reference_t<Ranges>...>::type>;
-};
-
-template<typename Range>
-auto chain(Range&& r)
-->typename chain_type<Range>::type
-{
- return std::forward<Range>(r);
-}
-
-template<typename Range1, typename Range2, typename... Ranges>
-auto chain(Range1&& r1, Range2&& r2, Ranges&&... ranges)
-->typename chain_type<Range1, Range2, Ranges...>::type
-{
- using RangeT = typename chain_type<Range1, Range2, Ranges...>::type;
- return RangeT(std::forward<Range1>(r1), chain(std::forward<Range2>(r2), std::forward<Ranges>(ranges)...));
-}
-
-}
-}
-
-#endif // UTIL_CHAIN_RANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/checked_cast.hpp b/inference-engine/thirdparty/ade/common/include/util/checked_cast.hpp
deleted file mode 100644
index c63626323..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/checked_cast.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_CHECKED_CAST_HPP
-#define UTIL_CHECKED_CAST_HPP
-
-#include <limits>
-#include <type_traits>
-
-#include "util/assert.hpp"
-
-#undef min
-#undef max
-
-namespace util
-{
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if< std::is_same<I, J>::value, I >::type
-checked_cast_impl(J value, Handler&& /*handler*/)
-{
- return value;
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_integral<I>::value && std::is_integral<J>::value &&
- std::is_signed<I>::value && std::is_signed<J>::value &&
- !std::is_same<I,J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
- handler(value >= std::numeric_limits<I>::lowest() && value <= std::numeric_limits<I>::max(), value);
- return static_cast<I>(value);
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_integral<I>::value && std::is_integral<J>::value &&
- std::is_signed<I>::value && std::is_unsigned<J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
- handler(value <= static_cast<typename std::make_unsigned<I>::type>(std::numeric_limits<I>::max()), value);
- return static_cast<I>(value);
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_integral<I>::value && std::is_integral<J>::value &&
- std::is_unsigned<I>::value && std::is_signed<J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
- handler(value >= 0 && static_cast<typename std::make_unsigned<J>::type>(value) <= std::numeric_limits<I>::max(), value);
- return static_cast<I>(value);
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_integral<I>::value && std::is_integral<J>::value &&
- std::is_unsigned<I>::value && std::is_unsigned<J>::value &&
- !std::is_same<I,J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
- handler(value <= std::numeric_limits<I>::max(), value);
- return static_cast<I>(value);
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_integral<I>::value && std::is_floating_point<J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
-// This criterion may fail in the following corner cases: (1) if I=int32_t, J=float, and value=2^31 (2) if I=int64_t, J=float, and value=2^63 (3) ...etc...
-// For example, consider I=int and J=float and value=2^31 Due to rounding, (float)INT32_MAX equals 2^31, not 2^31-1 So checking if value <= INT32_MAX would incorrectly pass
-// Well, I am not sure if we should especially address this corner case If you think we should,
-// we may need especial floating-point constants for upper boundaries Note that this problem does not impact the lower boundaries, which are exactly -2^31, -2^63, etc
- handler(value <= static_cast<J>(std::numeric_limits<I>::max()) && value >= static_cast<J>(std::numeric_limits<I>::lowest()), value);
- return static_cast<I>(value);
-}
-
-template <typename I, typename J, typename Handler>
-inline typename std::enable_if<
- std::is_same<float, I>::value && std::is_same<double, J>::value,
- I
->::type checked_cast_impl(J value, Handler&& handler)
-{
- handler(static_cast<double>(static_cast<float>(value)) == value, value);
- return static_cast<I>(value);
-}
-
-struct CheckedCastDefHandler final
-{
- template<typename T>
- void operator()(bool valid, T&& /*value*/) const
- {
- ASSERT(valid);
- }
-};
-
-template <typename I, typename J>
-I checked_cast(J value)
-{
- return checked_cast_impl<I>(value, CheckedCastDefHandler{});
-}
-
-} // util
-
-#endif // UTIL_CHECKED_CAST_HPP
-
diff --git a/inference-engine/thirdparty/ade/common/include/util/container_helper.hpp b/inference-engine/thirdparty/ade/common/include/util/container_helper.hpp
deleted file mode 100644
index 80f1bc02a..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/container_helper.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_CONTAINER_HELPER_HPP
-#define UTIL_CONTAINER_HELPER_HPP
-
-#include <vector>
-#include <array>
-
-#include "util/memory_range.hpp"
-
-namespace util
-{
-
-template<typename T>
-inline auto data(const std::vector<T>& vector) -> decltype(vector.data())
-{
- return vector.data();
-}
-
-template<typename T>
-inline std::size_t size(const std::vector<T>& vector)
-{
- return vector.size();
-}
-
-template<typename T>
-inline auto slice(const std::vector<T>& vector, const std::size_t start, const std::size_t newSize)
-->decltype(memory_range(data(vector), size(vector)).Slice(start, newSize))
-{
- return memory_range(data(vector), size(vector)).Slice(start, newSize);
-}
-
-template<typename T, std::size_t Size>
-inline auto data(const std::array<T, Size>& arr) -> decltype(arr.data())
-{
- return arr.data();
-}
-
-template<typename T, std::size_t Size>
-inline std::size_t size(const std::array<T, Size>& arr)
-{
- return arr.size();
-}
-
-template<typename T, std::size_t Size>
-inline auto slice(const std::array<T, Size>& arr, const std::size_t start, const std::size_t newSize)
-->decltype(memory_range(data(arr), size(arr)).Slice(start, newSize))
-{
- return memory_range(data(arr), size(arr)).Slice(start, newSize);
-}
-
-}
-
-#endif
diff --git a/inference-engine/thirdparty/ade/common/include/util/filter_range.hpp b/inference-engine/thirdparty/ade/common/include/util/filter_range.hpp
deleted file mode 100644
index d8506ca00..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/filter_range.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_FILTER_RANGE_HPP
-#define UTIL_FILTER_RANGE_HPP
-
-#include "util/tuple.hpp"
-#include "util/range.hpp"
-#include "util/assert.hpp"
-#include "util/iota_range.hpp"
-#include "util/range_iterator.hpp"
-
-namespace util
-{
-
-inline namespace Range
-{
-
-template<typename PrevRange, typename Filter>
-struct FilterRange : public IterableRange<FilterRange<PrevRange, Filter>>
-{
- PrevRange prevRange;
- Filter filter; // TODO: implement size optimization for empty objects
-
- FilterRange() = default;
- FilterRange(const FilterRange&) = default;
- FilterRange(FilterRange&&) = default;
- FilterRange& operator=(const FilterRange&) = default;
- FilterRange& operator=(FilterRange&&) = default;
- template<typename PR, typename F>
- FilterRange(PR&& pr, F&& f):
- prevRange(std::forward<PR>(pr)),
- filter(std::forward<F>(f))
- {
- while (!prevRange.empty() && !filter(prevRange.front()))
- {
- prevRange.popFront();
- }
- }
-
- bool empty() const
- {
- return prevRange.empty();
- }
-
- void popFront()
- {
- ASSERT(!empty());
- prevRange.popFront();
- while (!prevRange.empty() && !filter(prevRange.front()))
- {
- prevRange.popFront();
- }
- }
-
- auto front() -> decltype(this->prevRange.front())
- {
- ASSERT(!empty());
- return prevRange.front();
- }
-
- auto front() const -> decltype(this->prevRange.front())
- {
- ASSERT(!empty());
- return prevRange.front();
- }
-};
-
-template<typename Filter, typename PrevRange>
-FilterRange<PrevRange, Filter> filter(PrevRange&& prevRange, Filter&& filter_)
-{
- return FilterRange<PrevRange, Filter>(std::forward<PrevRange>(prevRange), std::forward<Filter>(filter_));
-}
-
-template<typename Filter, typename PrevRange>
-FilterRange<PrevRange, Filter> filter(PrevRange&& prevRange)
-{
- return FilterRange<PrevRange, Filter>(std::forward<PrevRange>(prevRange), Filter());
-}
-
-}
-}
-
-#endif // UTIL_FILTER_RANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/func_ref.hpp b/inference-engine/thirdparty/ade/common/include/util/func_ref.hpp
deleted file mode 100644
index 83f47f42b..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/func_ref.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_FUNC_REF_HPP
-#define UTIL_FUNC_REF_HPP
-
-#include <cstdint>
-#include <utility>
-
-#include "util/type_traits.hpp"
-#include "util/assert.hpp"
-
-namespace util
-{
-template<typename>
-class func_ref; // undefined
-
-/// Non-owning callable wrapper
-template<typename R, typename... Args>
-class func_ref<R(Args...)>
-{
- using func_t = R(*)(uintptr_t, Args...);
- uintptr_t m_context = 0;
- func_t m_func = nullptr;
-
- template<typename T>
- static R thunk(uintptr_t context, Args... args)
- {
- T* obj = reinterpret_cast<T*>(context);
- return (*obj)(std::forward<Args>(args)...);
- }
-
-public:
- template<typename Callable>
- func_ref(Callable&& callable):
- m_context(reinterpret_cast<uintptr_t>(&callable)),
- m_func(&thunk<util::remove_reference_t<Callable>>)
- {
- using actual_result_type = util::result_of_t<Callable(Args...)>;
-
- // If this condition doesn't hold, then thunk will return a reference
- // to the temporary returned by callable.
- static_assert(
- !std::is_reference<R>::value || std::is_reference<actual_result_type>::value,
- "If R is a reference, callable must also return a reference");
- }
-
- R operator()(Args... args) const
- {
- ASSERT(0 != m_context);
- ASSERT(nullptr != m_func);
- return m_func(m_context, std::forward<Args>(args)...);
- }
-};
-}
-
-#endif // UTIL_FUNC_REF_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/hash.hpp b/inference-engine/thirdparty/ade/common/include/util/hash.hpp
deleted file mode 100644
index 7dd59902c..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/hash.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef HASH_HPP
-#define HASH_HPP
-
-#include <cstddef> //size_t
-
-namespace util
-{
-inline std::size_t hash_combine(std::size_t seed, std::size_t val)
-{
- // Hash combine formula from boost
- return seed ^ (val + 0x9e3779b9 + (seed << 6) + (seed >> 2));
-}
-} // namespace util
-
-#endif // HASH_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/intrusive_list.hpp b/inference-engine/thirdparty/ade/common/include/util/intrusive_list.hpp
deleted file mode 100644
index b9b3de2dc..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/intrusive_list.hpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_INTRUSIVE_LIST_HPP
-#define UTIL_INTRUSIVE_LIST_HPP
-
-#include <utility>
-#include <cstddef>
-#include <iterator>
-
-#include "util/type_traits.hpp"
-#include "util/assert.hpp"
-
-namespace util
-{
-
-/// Intrusive list node
-/// It will unlink itself from any list during destruction
-/// TODO: Add autoremove policy as template parameter?
-class intrusive_list_node final
-{
- intrusive_list_node* prev = nullptr;
- intrusive_list_node* next = nullptr;
-
-public:
- template<typename T, intrusive_list_node T::* Elem>
- friend class intrusive_list;
-
- intrusive_list_node() = default;
- ~intrusive_list_node()
- {
- if (linked())
- {
- unlink();
- }
- }
-
- intrusive_list_node(const intrusive_list_node&) = delete;
- intrusive_list_node& operator=(const intrusive_list_node&) = delete;
-
- bool linked() const
- {
- ASSERT((nullptr == prev) == (nullptr == next));
- return nullptr != prev;
- }
-
- /// Link self before node
- void link_before(intrusive_list_node& node)
- {
- ASSERT(&node != this);
- ASSERT(!linked());
- ASSERT(node.linked());
- prev = node.prev;
- next = &node;
- node.prev->next = this;
- node.prev = this;
- }
-
- /// Link self after node
- void link_after(intrusive_list_node& node)
- {
- ASSERT(&node != this);
- ASSERT(!linked());
- ASSERT(node.linked());
- prev = &node;
- next = node.next;
- node.next->prev = this;
- node.next = this;
- }
-
- void unlink()
- {
- ASSERT(linked());
- ASSERT(this == prev->next);
- ASSERT(this == next->prev);
- prev->next = next;
- next->prev = prev;
- prev = nullptr;
- next = nullptr;
- }
-};
-
-/// Non-owning intrusive list container with std::list like interface
-/// (except it don't have "size()" method)
-template<typename T, intrusive_list_node T::* Elem>
-class intrusive_list final
-{
-public:
- intrusive_list()
- {
- // Root is special case, linked to itself
- root.next = &root;
- root.prev = &root;
- }
- ~intrusive_list()
- {
- clear();
- }
-
- intrusive_list(const intrusive_list&) = delete;
- intrusive_list& operator=(const intrusive_list&) = delete;
-
- template<bool IsConst>
- struct iter final
- {
- using value_type = util::conditional_t<IsConst, const T, T>;
- using pointer = value_type*;
- using reference = value_type&;
- using iterator_category = std::bidirectional_iterator_tag;
- using difference_type = std::ptrdiff_t;
-
- friend class intrusive_list<T, Elem>;
-
- using node_t = util::conditional_t<IsConst, const intrusive_list_node*, intrusive_list_node*>;
-
- iter() = default;
- iter(node_t node): current(node)
- {
- ASSERT(nullptr != current);
- }
- iter(const iter&) = default;
- iter& operator=(const iter&) = default;
-
- reference& operator*()
- {
- ASSERT(valid());
- return get_object(*current);
- }
-
- inline iter& operator++() { to_next(); return *this; }
- inline iter& operator--() { to_prev(); return *this; }
- inline iter operator++(int) { auto tmp(*this); to_next(); return tmp; }
- inline iter operator--(int) { auto tmp(*this); to_prev(); return tmp; }
-
- template<bool C>
- inline bool operator==(const iter<C>& other) const { return current == other.current; }
-
- template<bool C>
- inline bool operator!=(const iter<C>& other) const { return current != other.current; }
-
- private:
- node_t current = nullptr;
-
- bool valid() const
- {
- return nullptr != current;
- }
-
- void to_next()
- {
- ASSERT(valid());
- current = current->next;
- ASSERT(valid());
- }
-
- void to_prev()
- {
- ASSERT(valid());
- current = current->prev;
- ASSERT(valid());
- }
- };
-
- using iterator = iter<false>;
- using const_iterator = iter<true>;
-
- iterator begin()
- {
- return iterator(root.next);
- }
-
- iterator end()
- {
- return iterator(&root);
- }
-
- const_iterator begin() const
- {
- return iterator(root.next);
- }
-
- const_iterator end() const
- {
- return iterator(&root);
- }
-
- bool empty() const
- {
- ASSERT((root.next == &root) == (root.prev == &root));
- return root.next == &root;
- }
-
- iterator insert(iterator pos, T& item)
- {
- ASSERT(pos.valid());
- auto& node = (item.*Elem);
- ASSERT(!node.linked());
- node.link_before(*(pos.current));
- return iterator(&node);
- }
-
- iterator erase(iterator pos)
- {
- ASSERT(pos.valid());
- iterator iter(pos.current->next);
- pos.current->unlink();
- return iter;
- }
-
- void clear()
- {
- // Unlink all nodes
- auto node = root.next;
- while (&root != node)
- {
- ASSERT(nullptr != node);
- auto nextNode = node->next;
- node->unlink();
- node = nextNode;
- }
- }
-
- void push_back(T& item)
- {
- auto& node = (item.*Elem);
- ASSERT(!node.linked());
- node.link_before(root);
- }
-
- void push_front(T& item)
- {
- auto& node = (item.*Elem);
- ASSERT(!node.linked());
- node.link_after(root);
- }
-
-private:
- // All list nodes are cyclically linked through this root
- intrusive_list_node root;
-
- static T& get_object(intrusive_list_node& node)
- {
- return *reinterpret_cast<T*>(reinterpret_cast<char*>(&node) - get_offset());
- }
-
- static const T& get_object(const intrusive_list_node& node)
- {
- return *reinterpret_cast<const T*>(reinterpret_cast<const char*>(&node) - get_offset());
- }
-
- static ptrdiff_t get_offset()
- {
- return (((ptrdiff_t)&(reinterpret_cast<T*>(0x1000)->*Elem)) - 0x1000);
- }
-};
-
-}
-
-#endif // UTIL_INTRUSIVE_LIST_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/iota_range.hpp b/inference-engine/thirdparty/ade/common/include/util/iota_range.hpp
deleted file mode 100644
index 197311c87..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/iota_range.hpp
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_IOTA_RANGE_HPP
-#define UTIL_IOTA_RANGE_HPP
-
-#include <type_traits>
-#include <cassert>
-#include <cinttypes>
-#include <limits>
-
-namespace util
-{
-
-inline namespace Range
-{
-
-template<typename T, std::int32_t step = 0>
-struct IotaRange
-{
- static_assert(std::is_integral<T>::value,"T must be integral");
-
- inline void check() const
- {
- if ( step > 0)
- {
- assert(to >= from);
- }
- else if (step < 0)
- {
- assert(from >= to);
- }
- else assert(!"Zero step");
-
- assert(0 == ((to - from) % step));
- }
-
- struct iterator
- {
- inline bool operator==(iterator const& other) const
- {
- return value == other.value;
- }
-
- inline bool operator!=(iterator const& other) const
- {
- return value != other.value;
- }
-
- inline T const& operator*() const
- {
- return value;
- }
-
- inline iterator& operator++()
- {
- value += step;
- return *this;
- }
-
- T value;
- };
-
- bool empty() const
- {
- return to == from;
- }
-
- const T& front() const
- {
- assert(!empty());
- return from;
- }
-
- void popFront()
- {
- assert(!empty());
- from += step;
- }
-
- inline iterator begin() const
- {
- check();
- return {from};
- }
-
- inline iterator end() const
- {
- check();
- return {to};
- }
-
- bool operator==(const IotaRange<T,step>& rhs) const
- {
- return from == rhs.from && to == rhs.to;
- }
- bool operator!=(const IotaRange<T,step>& rhs) const
- {
- return !(*this == rhs);
- }
-
- /*const*/ T from;
- const T to;
-};
-
-template<typename T>
-struct IotaRange<T,0>
-{
- static_assert(std::is_integral<T>::value,"T must be integral");
-
- inline void check() const
- {
- if ( step > 0)
- {
- assert(to >= from);
- }
- else if (step < 0)
- {
- assert(from >= to);
- }
- else assert(!"Zero step");
-
- assert(0 == ((to - from) % step));
- }
-
- struct iterator
- {
- inline bool operator==(iterator const& other) const
- {
- assert(step == other.step);
- return value == other.value;
- }
-
- inline bool operator!=(iterator const& other) const
- {
- assert(step == other.step);
- return value != other.value;
- }
-
- inline T const& operator*() const
- {
- return value;
- }
-
- inline iterator& operator++()
- {
- value += step;
- return *this;
- }
-
- T value;
- T step;
- };
-
- bool empty() const
- {
- return to == from;
- }
-
- const T& front() const
- {
- assert(!empty());
- return from;
- }
-
- void popFront()
- {
- assert(!empty());
- from += step;
- }
-
- inline iterator begin() const
- {
- check();
- return {from, step};
- }
-
- inline iterator end() const
- {
- check();
- return {to, step};
- }
-
- bool operator==(const IotaRange<T,0>& rhs) const
- {
- return from == rhs.from && to == rhs.to && step == rhs.step;
- }
- bool operator!=(const IotaRange<T,0>& rhs) const
- {
- return !(*this == rhs);
- }
-
- /*const*/ T from;
- const T to;
- const T step;
-};
-
-template<typename T>
-inline IotaRange<T, 1> iota()
-{ return { 0, std::numeric_limits<T>::max()}; }
-
-template<typename T>
-inline IotaRange<T, 1> iota(const T to)
-{ return { 0, to}; }
-
-template<typename T>
-inline IotaRange<T, 1> iota(const T from, const T to)
-{ return {from, to}; }
-
-template<typename T>
-inline IotaRange<T> iota(const T from, const T to, const T step)
-{ return {from, to, step}; }
-
-}
-}
-
-
-#endif // UTIL_IOTA_RANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/map_range.hpp b/inference-engine/thirdparty/ade/common/include/util/map_range.hpp
deleted file mode 100644
index 14c462425..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/map_range.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MAP_RANGE_HPP
-#define UTIL_MAP_RANGE_HPP
-
-#include <type_traits>
-#include <utility>
-#include <tuple>
-
-#include "util/type_traits.hpp"
-#include "util/range.hpp"
-#include "util/assert.hpp"
-#include "util/range_iterator.hpp"
-
-namespace util
-{
-
-inline namespace Range
-{
-
-template<typename PrevRange, typename Mapper>
-struct MapRange : public IterableRange<MapRange<PrevRange, Mapper>>
-{
- PrevRange prevRange;
- Mapper mapper; // TODO: implement size optimization for empty objects
-
- MapRange() = default;
- MapRange(const MapRange&) = default;
- MapRange(MapRange&&) = default;
- MapRange& operator=(const MapRange&) = default;
- MapRange& operator=(MapRange&&) = default;
- template<typename PR, typename M>
- MapRange(PR&& pr, M&& m):
- prevRange(std::forward<PR>(pr)),
- mapper(std::forward<M>(m)) {}
-
- bool empty() const
- {
- return prevRange.empty();
- }
-
- void popFront()
- {
- ASSERT(!empty());
- prevRange.popFront();
- }
-
- auto front() -> typename std::decay<decltype(mapper(prevRange.front()))>::type
- {
- ASSERT(!empty());
- return mapper(prevRange.front());
- }
-
- auto front() const -> typename std::decay<decltype(mapper(prevRange.front()))>::type
- {
- ASSERT(!empty());
- return mapper(prevRange.front());
- }
-
- template<typename R = PrevRange,
- util::enable_b_t<details::has_size_fun<R>::value> = true> //SFINAE
- auto size() const
- ->decltype(details::range_size_wrapper(std::declval<R>()))
- {
- return details::range_size_wrapper(prevRange);
- }
-};
-
-template<typename PrevRange, typename Mapper>
-inline auto size(const MapRange<PrevRange, Mapper>& range)
-->decltype(range.size())
-{
- return range.size();
-}
-
-template<typename Mapper, typename PrevRange>
-MapRange<PrevRange, Mapper> map(PrevRange&& prevRange, Mapper&& mapper)
-{
- return MapRange<PrevRange, Mapper>(std::forward<PrevRange>(prevRange), std::forward<Mapper>(mapper));
-}
-
-template<typename Mapper, typename PrevRange>
-MapRange<PrevRange, Mapper> map(PrevRange&& prevRange)
-{
- return MapRange<PrevRange, Mapper>(std::forward<PrevRange>(prevRange), Mapper());
-}
-
-}
-}
-
-#endif // UTIL_MAP_RANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/math.hpp b/inference-engine/thirdparty/ade/common/include/util/math.hpp
deleted file mode 100644
index f6c4bfd19..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/math.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MATH_HPP
-#define UTIL_MATH_HPP
-
-#include <type_traits>
-
-#include "util/assert.hpp"
-
-namespace util
-{
-template<typename T>
-inline auto is_pow2(T val)
-->typename std::enable_if<std::is_integral<T>::value, bool>::type
-{
- return (val & (val - 1)) == 0;
-}
-
-template<typename T>
-inline auto align_size(T size, T align)
-->typename std::enable_if<std::is_integral<T>::value, T>::type
-{
- ASSERT(size > 0);
- ASSERT(align > 0);
- ASSERT(is_pow2(align));
- return (size + (align - 1)) & ~(align - 1);
-}
-
-}
-
-#endif // UTIL_MATH_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/md_cast.hpp b/inference-engine/thirdparty/ade/common/include/util/md_cast.hpp
deleted file mode 100644
index c6d9f85cd..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/md_cast.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MD_CAST_HPP
-#define UTIL_MD_CAST_HPP
-
-namespace util
-{
-// TODO: find a proper place for this
-constexpr static const std::size_t MaxDimensions = 6;
-
-namespace detail
-{
-template<typename Target>
-struct md_cast_helper; // Undefined
-}
-
-template<typename Dst, typename Src>
-Dst md_cast(const Src& src)
-{
- return detail::md_cast_helper<Dst>(src);
-}
-}
-
-#endif // UTIL_MD_CAST_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/md_io.hpp b/inference-engine/thirdparty/ade/common/include/util/md_io.hpp
deleted file mode 100644
index a22115023..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/md_io.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MD_IO_HPP
-#define UTIL_MD_IO_HPP
-
-#include <ostream>
-
-#include "util/md_size.hpp"
-#include "util/md_span.hpp"
-
-// md_* stream operators
-
-namespace util
-{
-
-inline std::ostream& operator<<(std::ostream& os, const Span& span)
-{
- os << "{" << span.begin << ", " << span.end << "}";
- return os;
-}
-
-template <std::size_t MaxDimensions>
-inline std::ostream& operator<<(std::ostream& os, const DynMdSize<MaxDimensions>& size)
-{
- os << "{";
- for (auto i: util::iota(size.dims_count()))
- {
- // TODO: join range
- if (0 != i)
- {
- os << ", ";
- }
- os << size[i];
- }
- os << "}";
- return os;
-}
-
-template <std::size_t MaxDimensions>
-inline std::ostream& operator<<(std::ostream& os, const DynMdSpan<MaxDimensions>& span)
-{
- os << "{";
- for (auto i: util::iota(span.dims_count()))
- {
- // TODO: join range
- if (0 != i)
- {
- os << ", ";
- }
- os << span[i];
- }
- os << "}";
- return os;
-}
-
-}
-
-#endif // UTIL_MD_IO_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/md_size.hpp b/inference-engine/thirdparty/ade/common/include/util/md_size.hpp
deleted file mode 100644
index 01db3d975..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/md_size.hpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MD_SIZE_HPP
-#define UTIL_MD_SIZE_HPP
-
-#include <algorithm>
-#include <array>
-#include <initializer_list>
-
-#include "util/assert.hpp"
-#include "util/iota_range.hpp"
-#include "util/checked_cast.hpp"
-
-namespace util
-{
-
-/// Dinamically sized arbitrary dimensional size
-template <std::size_t MaxDimensions>
-struct DynMdSize final
-{
- using SizeT = int;
- std::array<SizeT, MaxDimensions> sizes;
- std::size_t dims_cnt = 0;
-
- DynMdSize() = default;
-
- DynMdSize(std::initializer_list<SizeT> d):
- dims_cnt(util::checked_cast<decltype(this->dims_cnt)>(d.size()))
- {
- ASSERT(d.size() <= MaxDimensions);
- std::copy(d.begin(), d.end(), sizes.begin());
- }
-
- DynMdSize(const DynMdSize&) = default;
- DynMdSize& operator=(const DynMdSize&) = default;
-
- bool operator==(const DynMdSize& other) const
- {
- if (dims_count() != other.dims_count())
- {
- return false;
- }
-
- for (auto i: util::iota(dims_count()))
- {
- if ((*this)[i] != other[i])
- {
- return false;
- }
- }
- return true;
- }
-
- bool operator!=(const DynMdSize& other) const
- {
- return !(*this == other);
- }
-
- SizeT& operator[](std::size_t index)
- {
- ASSERT(index < dims_count());
- return sizes[index];
- }
-
- const SizeT& operator[](std::size_t index) const
- {
- ASSERT(index < dims_count());
- return sizes[index];
- }
-
- SizeT* data()
- {
- return sizes.data();
- }
-
- const SizeT* data() const
- {
- return sizes.data();
- }
-
- std::size_t dims_count() const
- {
- return dims_cnt;
- }
-
- void redim(std::size_t count)
- {
- ASSERT(count <= MaxDimensions);
- dims_cnt = count;
- }
-
- auto begin()
- ->decltype(this->sizes.begin())
- {
- return sizes.begin();
- }
-
- auto end()
- ->decltype(this->sizes.begin() + this->dims_count())
- {
- return sizes.begin() + dims_count();
- }
-
- auto begin() const
- ->decltype(this->sizes.begin())
- {
- return sizes.begin();
- }
-
- auto end() const
- ->decltype(this->sizes.begin() + this->dims_count())
- {
- return sizes.begin() + dims_count();
- }
-};
-}
-
-#endif // UTIL_MD_SIZE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/md_span.hpp b/inference-engine/thirdparty/ade/common/include/util/md_span.hpp
deleted file mode 100644
index 298dee69b..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/md_span.hpp
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MD_SPAN_HPP
-#define UTIL_MD_SPAN_HPP
-
-#include <algorithm>
-#include <array>
-#include <initializer_list>
-
-#include "util/assert.hpp"
-#include "util/iota_range.hpp"
-#include "util/md_size.hpp"
-#include "util/checked_cast.hpp"
-
-namespace util {
-
-struct Span final
-{
- int begin = 0;
- int end = 0;
-
- Span() = default;
-
- Span(int b, int e) : begin(b), end(e)
- {
- ASSERT(b <= e);
- }
-
- int length() const
- {
- return end - begin;
- }
-
- bool operator==(const Span& other) const
- {
- return begin == other.begin &&
- end == other.end;
- }
-
- bool operator!=(const Span& other) const
- {
- return !(*this == other);
- }
-
- bool intersectsWith(const Span& other) const
- {
- auto s = std::max(begin, other.begin);
- auto e = std::min(end, other.end);
- return (s < e);
- }
-};
-
-/// Dinamically sized arbitrary dimensional span
-template <size_t MaxDimensions>
-struct DynMdSpan final
-{
- std::array<Span, MaxDimensions> spans;
- std::size_t dims_cnt = 0;
-
- DynMdSpan() = default;
-
- DynMdSpan(std::initializer_list<Span> d):
- dims_cnt(util::checked_cast<decltype(this->dims_cnt)>(d.size()))
- {
- ASSERT(d.size() <= MaxDimensions);
- std::copy(d.begin(), d.end(), spans.begin());
- }
-
- DynMdSpan(const DynMdSpan&) = default;
- DynMdSpan& operator=(const DynMdSpan&) = default;
-
- bool operator==(const DynMdSpan& other) const
- {
- if (dims_count() != other.dims_count())
- {
- return false;
- }
-
- for (auto i: util::iota(dims_count()))
- {
- if ((*this)[i] != other[i])
- {
- return false;
- }
- }
- return true;
- }
-
- bool operator!=(const DynMdSpan& other) const
- {
- return !(*this == other);
- }
-
- Span& operator[](std::size_t index)
- {
- ASSERT(index < dims_count());
- return spans[index];
- }
-
- const Span& operator[](std::size_t index) const
- {
- ASSERT(index < dims_count());
- return spans[index];
- }
-
- Span* data()
- {
- return spans.data();
- }
-
- const Span* data() const
- {
- return spans.data();
- }
-
- std::size_t dims_count() const
- {
- return dims_cnt;
- }
-
- void redim(std::size_t count)
- {
- ASSERT(count <= MaxDimensions);
- dims_cnt = count;
- }
-
- auto begin() -> decltype(spans.begin())
- {
- return spans.begin();
- }
-
- auto end() -> decltype(spans.begin())
- {
- return spans.begin() + dims_count();
- }
-
- auto begin() const -> decltype(spans.begin())
- {
- return spans.begin();
- }
-
- auto end() const -> decltype(spans.begin())
- {
- return spans.begin() + dims_count();
- }
-
- auto cbegin() const -> decltype(spans.cbegin())
- {
- return spans.cbegin();
- }
-
- auto cend() const -> decltype(spans.cbegin())
- {
- return spans.cbegin() + dims_count();
- }
-
- DynMdSize<MaxDimensions> size() const
- {
- DynMdSize<MaxDimensions> ret;
- ret.redim(dims_count());
- std::transform(begin(), end(), ret.begin(), [](const Span& s)
- {
- return s.length();
- });
- return ret;
- }
-
- DynMdSize<MaxDimensions> origin() const
- {
- DynMdSize<MaxDimensions> ret;
- ret.redim(dims_count());
- std::transform(begin(), end(), ret.begin(), [](const Span& s)
- {
- return s.begin;
- });
- return ret;
- }
-};
-
-template<size_t MaxDimensions>
-DynMdSpan<MaxDimensions> make_span(const DynMdSize<MaxDimensions>& origin,
- const DynMdSize<MaxDimensions>& size)
-{
- ASSERT(origin.dims_count() == size.dims_count());
- const auto dims_count = origin.dims_count();
- DynMdSpan<MaxDimensions> ret;
- ret.redim(dims_count);
- for (auto i: util::iota(dims_count))
- {
- ret[i] = Span(origin[i], origin[i] + size[i]);
- }
- return ret;
-}
-
-template <size_t MaxDimensions1, size_t MaxDimensions2>
-bool spanIntersects(const DynMdSpan<MaxDimensions1>& span1, const DynMdSpan<MaxDimensions2>& span2)
-{
- if (span1.dims_count() != span2.dims_count())
- return false;
-
- for (auto i : util::iota(span1.dims_count()))
- {
- if (!span1[i].intersectsWith(span2[i]))
- return false;
- }
-
- return true;
-}
-
-template<size_t MaxDimensions>
-inline DynMdSpan<MaxDimensions> operator+(const DynMdSpan<MaxDimensions>& s1, const DynMdSize<MaxDimensions>& s2)
-{
- ASSERT(s1.dims_count() == s2.dims_count());
- DynMdSpan<MaxDimensions> ret;
- ret.redim(s1.dims_count());
- for (auto i: util::iota(ret.dims_count()))
- {
- ret[i].begin = s1[i].begin + s2[i];
- ret[i].end = s1[i].end + s2[i];
- }
- return ret;
-}
-
-template<size_t MaxDimensions>
-inline DynMdSpan<MaxDimensions> operator+(const DynMdSize<MaxDimensions>& s1, const DynMdSpan<MaxDimensions>& s2)
-{
- return s2 + s1;
-}
-
-template<size_t MaxDimensions>
-inline DynMdSpan<MaxDimensions> operator-(const DynMdSpan<MaxDimensions>& s1, const DynMdSize<MaxDimensions>& s2)
-{
- ASSERT(s1.dims_count() == s2.dims_count());
- DynMdSpan<MaxDimensions> ret;
- ret.redim(s1.dims_count());
- for (auto i: util::iota(ret.dims_count()))
- {
- ret[i].begin = s1[i].begin - s2[i];
- ret[i].end = s1[i].end - s2[i];
- }
- return ret;
-}
-
-}
-
-#endif // UTIL_MD_SPAN_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/md_view.hpp b/inference-engine/thirdparty/ade/common/include/util/md_view.hpp
deleted file mode 100644
index 43d105c69..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/md_view.hpp
+++ /dev/null
@@ -1,580 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MD_VIEW_HPP
-#define UTIL_MD_VIEW_HPP
-
-#include <array>
-#include <iterator>
-#include <algorithm>
-#include <numeric>
-
-#include "util/math.hpp"
-#include "util/assert.hpp"
-#include "util/memory_range.hpp"
-#include "util/checked_cast.hpp"
-#include "util/md_size.hpp"
-#include "util/md_span.hpp"
-#include "util/iota_range.hpp"
-#include "util/algorithm.hpp"
-
-namespace util
-{
-
-/// Actual dimension spec (length + step)
-struct SliceDimension final
-{
- int length = 0;
- int step = 0;
-};
-
-inline SliceDimension make_dimension(int l, int s) //TODO: move to C++14
-{
- SliceDimension ret;
- ret.length = l;
- ret.step = s;
- return ret;
-}
-
-template<typename ParentT, typename DiffT = int>
-class MdViewIteratorImpl final : public std::iterator<std::random_access_iterator_tag, DiffT>
-{
- ParentT* m_parent = nullptr;
- int m_currentPos = -1;
- inline int checkPos(int pos) const
- {
- assert(nullptr != m_parent);
- assert(pos >= 0);
- assert(pos <= m_parent->dimensions.back().length); // equality for end iterators
- return pos;
- }
- inline void check() const
- {
- checkPos(m_currentPos);
- }
-
- using this_t = MdViewIteratorImpl<ParentT, DiffT>;
- inline static void check(const this_t& a1, const this_t& a2)
- {
- a1.check();
- a2.check();
- assert(a1.m_parent == a2.m_parent);
- }
-
- using diff_t = DiffT;
- using val_t = decltype(ParentT()[0]);
-public:
-
- MdViewIteratorImpl() = default;
- MdViewIteratorImpl(ParentT* parent, int pos): m_parent(parent), m_currentPos(checkPos(pos)) {}
- MdViewIteratorImpl(const MdViewIteratorImpl&) = default;
- MdViewIteratorImpl& operator=(const MdViewIteratorImpl&) = default;
-
- inline this_t& operator+=(diff_t rhs) { check(); m_currentPos = checkPos(m_currentPos + rhs); return *this;}
- inline this_t& operator-=(diff_t rhs) { check(); m_currentPos = checkPos(m_currentPos - rhs); return *this;}
- inline val_t operator*() const { check(); return (*m_parent)[m_currentPos];}
- // TODO: Implement this using internally stored object
- // inline val_t* operator->() const { check(); return &((*m_parent)[m_currentPos]);}
- inline val_t& operator[](diff_t rhs) const { check(); return (*m_parent)[checkPos(m_currentPos + rhs)];}
-
- inline this_t& operator++() { check(); m_currentPos = checkPos(m_currentPos + 1); return *this; }
- inline this_t& operator--() { check(); m_currentPos = checkPos(m_currentPos - 1); return *this; }
- inline this_t operator++(int) const { check(); this_t tmp(*this); m_currentPos = checkPos(m_currentPos + 1); return tmp; }
- inline this_t operator--(int) const { check(); this_t tmp(*this); m_currentPos = checkPos(m_currentPos - 1); return tmp; }
- inline diff_t operator+(const this_t& rhs) const { check(*this, rhs); return m_currentPos + rhs.m_currentPos; }
- inline diff_t operator-(const this_t& rhs) const { check(*this, rhs); return m_currentPos - rhs.m_currentPos; }
- inline this_t operator+(diff_t rhs) const { check(); return this_t(m_parent,m_currentPos + rhs); }
- inline this_t operator-(diff_t rhs) const { check(); return this_t(m_parent,m_currentPos - rhs); }
- friend inline this_t operator+(diff_t lhs, const this_t& rhs) { rhs.check(); return this_t(rhs.m_parent,rhs.m_currentPos + lhs); }
- friend inline this_t operator-(diff_t lhs, const this_t& rhs) { rhs.check(); return this_t(rhs.m_parent,rhs.m_currentPos - lhs); }
-
- inline bool operator==(const this_t& rhs) const { check(*this, rhs); return m_currentPos == rhs.m_currentPos; }
- inline bool operator!=(const this_t& rhs) const { check(*this, rhs); return m_currentPos != rhs.m_currentPos; }
- inline bool operator>(const this_t& rhs) const { check(*this, rhs); return m_currentPos > rhs.m_currentPos; }
- inline bool operator<(const this_t& rhs) const { check(*this, rhs); return m_currentPos < rhs.m_currentPos; }
- inline bool operator>=(const this_t& rhs) const { check(*this, rhs); return m_currentPos >= rhs.m_currentPos; }
- inline bool operator<=(const this_t& rhs) const { check(*this, rhs); return m_currentPos <= rhs.m_currentPos; }
-};
-
-namespace details
-{
-template<typename T>
-inline bool view_check_elem_size(std::size_t size)
-{
- return size == sizeof(T);
-}
-
-template<>
-inline bool view_check_elem_size<void>(std::size_t /*size*/)
-{
- return true;
-}
-
-inline void mdview_copy_helper(std::size_t depth,
- util::MemoryRange<void> src, const util::MemoryRange<const SliceDimension>& srcDims,
- util::MemoryRange<void> dst, const util::MemoryRange<const SliceDimension>& dstDims)
-{
- ASSERT(depth > 0);
- ASSERT(!srcDims.empty());
- ASSERT(srcDims.size == dstDims.size);
- ASSERT(srcDims.back().length == dstDims.back().length);
- if (srcDims.size > depth)
- {
- const auto srcStep = static_cast<std::size_t>(srcDims.back().step);
- const auto dstStep = static_cast<std::size_t>(dstDims.back().step);
- const auto len = static_cast<std::size_t>(srcDims.back().length);
- const auto& prevSrcDim = srcDims[srcDims.size - 2];
- const auto& prevDstDim = dstDims[dstDims.size - 2];
- const auto srcSliceSize = static_cast<std::size_t>(prevSrcDim.length * prevSrcDim.step);
- const auto dstSliceSize = static_cast<std::size_t>(prevDstDim.length * prevDstDim.step);
- for (auto i: util::iota(len))
- {
- mdview_copy_helper(depth,
- util::slice(src, i * srcStep, srcSliceSize), util::slice(srcDims,0, srcDims.size - 1),
- util::slice(dst, i * dstStep, dstSliceSize), util::slice(dstDims,0, dstDims.size - 1));
- }
-
- }
- else
- {
- util::raw_copy(src, dst);
- }
-}
-}
-
-template<std::size_t MaxDimensions, typename DataT>
-struct DynMdView;
-
-/// Wrapper used to interpret raw memory range as arbitrary dimensional data (array, image, etc)
-template<int Dimensions, typename DataT>
-struct MdView final
-{
- static_assert(Dimensions > 0, "Invalid dimensions");
- using this_t = MdView<Dimensions, DataT>;
- using const_this_t = MdView<Dimensions, const DataT>;
- using value_type = DataT;
- using dimensions_t = std::array<SliceDimension, Dimensions>;
- dimensions_t dimensions = {};
- util::MemoryRange<void> data;
-
- MdView() = default;
- MdView(const MdView&) = default;
- MdView& operator=(const MdView&) = default;
-
- MdView(std::nullptr_t) {}
-
- MdView(const util::MemoryRange<void>& data_, const dimensions_t& dims):
- dimensions(dims), data(data_) {}
-
- template<std::size_t MaxDimensions, typename T>
- MdView(const DynMdView<MaxDimensions, T>& view)
- {
- ASSERT(nullptr != view);
- ASSERT(view.count() == Dimensions);
- ASSERT(details::view_check_elem_size<DataT>(view.elementSize()));
- std::copy(view.dimensions.begin(),
- view.dimensions.begin() + Dimensions,
- dimensions.begin());
- data = view.mem;
- }
-
- /// Single element size
- size_t ElementSize() const
- {
- return checked_cast<size_t>(dimensions[0].step);
- }
-
- /// Access raw data
- DataT* Data()
- {
- return static_cast<DataT*>(data.data);
- }
-
- /// Access raw data
- const DataT* Data() const
- {
- return static_cast<const DataT*>(data.data);
- }
-
- int Size() const
- {
- return std::accumulate(dimensions.begin(), dimensions.end(), int{1},
- [](const int acc, const SliceDimension& dim){return acc*dim.length;});
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::enable_if<(2 == Dimensions), typename std::conditional<true, int, Dummy>::type >::type
- Step() const
- {
- return dimensions[1].step;
- }
-
- int Width() const
- {
- return dimensions[0].length;
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::enable_if<(Dimensions >= 2), typename std::conditional<true, int, Dummy>::type >::type
- Height() const
- {
- return dimensions[1].length;
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::enable_if<(Dimensions >= 3), typename std::conditional<true, int, Dummy>::type >::type
- Depth() const
- {
- return dimensions[2].length;
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::enable_if<(Dimensions > 1), typename std::conditional<true, MdView<Dimensions - 1, DataT>, Dummy>::type >::type
- operator[](int pos)
- {
- assert(pos >= 0);
- const auto& dim = dimensions.back();
- const auto& prevDim = dimensions[dimensions.size() - 2];
- assert(pos < dim.length);
- MdView<Dimensions - 1, DataT> ret;
- std::copy_n(dimensions.begin(), Dimensions - 1, ret.dimensions.begin());
- const auto dataSize = ElementSize() + (prevDim.length - 1) * prevDim.step;
- ret.data = data.Slice(dim.step * pos, dataSize);
- return ret;
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::enable_if<(Dimensions > 1), typename std::conditional<true, MdView<Dimensions - 1, const DataT>, Dummy>::type >::type
- operator[](int pos) const
- {
- assert(pos >= 0);
- const auto& dim = dimensions.back();
- const auto& prevDim = dimensions[dimensions.size() - 2];
- assert(pos < dim.length);
- MdView<Dimensions - 1, const DataT> ret;
- std::copy_n(dimensions.begin(), Dimensions - 1, ret.dimensions.begin());
- const auto dataSize = ElementSize() + (prevDim.length - 1) * prevDim.step;
- ret.data = data.Slice(dim.step * pos, dataSize);
- return ret;
- }
-
- template<typename Dummy = DataT> // hack for sfinae
- typename std::enable_if<(Dimensions == 1 && sizeof(Dummy) > 0), Dummy& >::type
- operator[](int pos)
- {
- assert(pos >= 0);
- assert(pos < dimensions.back().length);
- return data.reinterpret<DataT>()[pos];
- }
-
- template<typename Dummy = DataT> // hack for sfinae
- typename std::enable_if<(Dimensions == 1 && sizeof(Dummy) > 0), const Dummy& >::type
- operator[](int pos) const
- {
- assert(pos >= 0);
- assert(pos < dimensions.back().length);
- return data.reinterpret<DataT>()[pos];
- }
-
-
- template<typename Dummy = void> // hack for sfinae
- using iterator = MdViewIteratorImpl<MdView<Dimensions, DataT>>;
-
- template<typename Dummy = void> // hack for sfinae
- using const_iterator = MdViewIteratorImpl<const MdView<Dimensions, const DataT>>;
-
- template<typename Dummy = void> // hack for sfinae
- typename std::conditional<true, MdViewIteratorImpl<MdView<Dimensions, DataT>>, Dummy>::type
- begin()
- {
- return iterator<void>(this, 0);
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::conditional<true, MdViewIteratorImpl<MdView<Dimensions, DataT>>, Dummy>::type
- end()
- {
- return iterator<void>(this, dimensions.back().length);
- }
-
-
- template<typename Dummy = void> // hack for sfinae
- typename std::conditional<true, MdViewIteratorImpl<const MdView<Dimensions, const DataT>>, Dummy>::type
- begin() const
- {
- return const_iterator<void>(this, 0);
- }
-
- template<typename Dummy = void> // hack for sfinae
- typename std::conditional<true, MdViewIteratorImpl<const MdView<Dimensions, const DataT>>, Dummy>::type
- end() const
- {
- return const_iterator<void>(this, dimensions.back().length);
- }
-};
-
-template<int Dimensions, typename DataT>
-inline bool operator==(const MdView<Dimensions,DataT>& view, std::nullptr_t)
-{
- return view.data == nullptr;
-}
-
-template<int Dimensions, typename DataT>
-inline bool operator==(std::nullptr_t, const MdView<Dimensions,DataT>& view)
-{
- return view.data == nullptr;
-}
-
-template<int Dimensions, typename DataT>
-inline bool operator!=(const MdView<Dimensions,DataT>& view, std::nullptr_t)
-{
- return view.data != nullptr;
-}
-
-template<int Dimensions, typename DataT>
-inline bool operator!=(std::nullptr_t, const MdView<Dimensions,DataT>& view)
-{
- return view.data != nullptr;
-}
-
-/// View typedef for scalar data (as one-element array)
-template<typename DataT>
-using ScalarView = MdView<1, DataT>;
-
-/// View typedef for array data
-template<typename DataT>
-using ArrayView = MdView<1, DataT>;
-
-/// View typedef for image data
-template<typename DataT>
-using ImageView = MdView<2, DataT>;
-
-/// Dynamically sized memory view
-template<std::size_t MaxDimensions, typename DataT>
-struct DynMdView final
-{
- using dimensions_t = std::array<SliceDimension, MaxDimensions>;
- dimensions_t dimensions;
- std::size_t dims_count = 0;
- util::MemoryRange<void> mem;
-
- DynMdView() = default;
- DynMdView(const DynMdView&) = default;
- DynMdView& operator=(const DynMdView&) = default;
-
- DynMdView(std::nullptr_t) {}
-
- DynMdView(const util::MemoryRange<void>& mem_,
- std::initializer_list<SliceDimension> dims):
- dims_count(util::checked_cast<decltype(this->dims_count)>(dims.size())),
- mem(mem_)
- {
- ASSERT(dims.size() <= MaxDimensions);
- std::copy(dims.begin(), dims.end(), dimensions.begin());
- }
-
- template<int Dimensions>
- DynMdView(const MdView<Dimensions, DataT>& src):
- dims_count(Dimensions)
- {
- static_assert(Dimensions <= MaxDimensions, "Invalid dimensions count");
- std::copy(src.dimensions.begin(),
- src.dimensions.end(),
- dimensions.begin());
- mem = src.data;
- }
-
- DataT* data()
- {
- ASSERT(nullptr != mem);
- return mem.data;
- }
-
- const DataT* data() const
- {
- ASSERT(nullptr != mem);
- return mem.data;
- }
-
- std::size_t count() const
- {
- return dims_count;
- }
-
- size_t elementSize() const
- {
- ASSERT(count() > 0);
- return checked_cast<size_t>(dimensions[0].step);
- }
-
- util::DynMdSize<MaxDimensions> size() const
- {
- util::DynMdSize<MaxDimensions> ret;
- ret.resize(count());
- for (auto i: util::iota(count()))
- {
- ret[i] = dimensions[i].length;
- }
- return ret;
- }
-
- DynMdView<MaxDimensions, DataT> slice(const DynMdSpan<MaxDimensions>& span) const
- {
- ASSERT(count() > 0);
- ASSERT(span.dims_count() == count());
- for (auto i: util::iota(count()))
- {
- ASSERT(span[i].begin <= span[i].end);
- ASSERT(span[i].begin >= 0 && span[i].end <= dimensions[i].length);
- }
- DynMdView<MaxDimensions, DataT> ret;
- ret.dims_count = count();
-
- std::size_t dataSize = elementSize();
- std::size_t dataOffset = 0;
- for (auto i: util::iota(count()))
- {
- dataOffset += dimensions[i].step * span[i].begin;
- ret.dimensions[i].length = span[i].length();
- ret.dimensions[i].step = dimensions[i].step;
- dataSize += (span[i].length() - 1) * dimensions[i].step;
- }
- ret.mem = mem.Slice(dataOffset, dataSize);
- return ret;
- }
-
- std::size_t sizeInBytes() const
- {
- ASSERT(nullptr != *this);
- ASSERT(count() > 0);
- std::size_t dataSize = elementSize();
- for (auto i: util::iota(count()))
- {
- dataSize += (dimensions[i].length - 1) * dimensions[i].step;
- }
- ASSERT(mem.size >= dataSize);
- return dataSize;
- }
-
- template<typename T>
- DynMdView<MaxDimensions, T> reinterpret() const
- {
- if (nullptr == *this)
- {
- return nullptr;
- }
- if (!std::is_void<T>::value)
- {
- const std::size_t new_elem_size = sizeof(util::conditional_t< std::is_void<T>::value, char, T >);
- ASSERT(elementSize() == new_elem_size);
- }
- DynMdView<MaxDimensions, T> ret;
- ret.dims_count = count();
- std::copy(dimensions.begin(), dimensions.begin() + count(), ret.dimensions.begin());
- ret.mem = mem;
- return ret;
- }
-};
-
-template<std::size_t MaxDimensions, typename DataT>
-inline bool operator==(const DynMdView<MaxDimensions, DataT>& view, std::nullptr_t)
-{
- return view.mem == nullptr;
-}
-
-template<std::size_t MaxDimensions, typename DataT>
-inline bool operator==(std::nullptr_t, const DynMdView<MaxDimensions, DataT>& view)
-{
- return view.mem == nullptr;
-}
-
-template<std::size_t MaxDimensions, typename DataT>
-inline bool operator!=(const DynMdView<MaxDimensions, DataT>& view, std::nullptr_t)
-{
- return view.mem != nullptr;
-}
-
-template<std::size_t MaxDimensions, typename DataT>
-inline bool operator!=(std::nullptr_t, const DynMdView<MaxDimensions, DataT>& view)
-{
- return view.mem != nullptr;
-}
-
-template<std::size_t MaxDimensions, typename Allocator, typename DimT, typename AlignT>
-inline DynMdView<MaxDimensions, void> alloc_view(std::size_t elementSize,
- const MemoryRange<DimT>& dimensions,
- const MemoryRange<AlignT>& alignment,
- Allocator&& alloc)
-{
- ASSERT(elementSize > 0);
- ASSERT(size(dimensions) == size(alignment));
- ASSERT(util::all_of(dimensions, [](DimT dim)
- {
- return dim > 0;
- }));
- ASSERT(util::all_of(alignment, [](AlignT align)
- {
- return align > 0;
- }));
- const auto dims_count = size(dimensions);
- ASSERT(dims_count > 0);
- ASSERT(dims_count <= MaxDimensions);
-
- auto blockAlign = checked_cast<std::size_t>(alignment[0]);
- auto blockSize = checked_cast<std::size_t>(dimensions[0] * elementSize);
- DynMdView<MaxDimensions, void> ret;
- ret.dims_count = util::checked_cast<decltype(ret.dims_count)>(dims_count);
- using LengthT = decltype(ret.dimensions[0].length);
- using StepT = decltype(ret.dimensions[0].step);
- ret.dimensions[0].length = util::checked_cast<LengthT>(dimensions[0]);
- ret.dimensions[0].step = util::checked_cast<StepT>(elementSize);
- for (auto i: util::iota(static_cast<decltype(dims_count)>(1), dims_count))
- {
- blockAlign = std::max(blockAlign, static_cast<std::size_t>(alignment[i]));
- const auto step = align_size(blockSize, static_cast<std::size_t>(alignment[i]));
- blockSize = step * dimensions[i];
- ret.dimensions[i].length = util::checked_cast<LengthT>(dimensions[i]);
- ret.dimensions[i].step = util::checked_cast<StepT>(step);
- }
-
- ret.mem = memory_range(static_cast<void*>(alloc(blockSize, blockAlign)), blockSize);
- return ret;
-}
-
-/// Copy data from one view to other
-/// Both viewvs must have same dimensions
-template<std::size_t MaxDimensions, typename DataT>
-inline void view_copy(const DynMdView<MaxDimensions, DataT>& src, const DynMdView<MaxDimensions, DataT>& dst)
-{
- ASSERT(src.count() > 0);
- ASSERT(src.count() == dst.count());
- ASSERT(nullptr != src);
- ASSERT(nullptr != dst);
- ASSERT(src.elementSize() == dst.elementSize());
- ASSERT(src.dimensions[0].length == dst.dimensions[0].length);
- auto elemSize = src.elementSize() * src.dimensions[0].length;
-
- for (auto i: util::iota(static_cast<decltype(src.count())>(1), src.count()))
- {
- if (elemSize != src.dimensions[i].step ||
- elemSize != dst.dimensions[i].step)
- {
- //First bad stride, copy all previous dimesions as single buffer
- details::mdview_copy_helper(i,
- src.mem, util::memory_range(src.dimensions.data(), src.count()),
- dst.mem, util::memory_range(dst.dimensions.data(), dst.count()));
- return;
- }
- ASSERT(src.dimensions[i].length == dst.dimensions[i].length);
- elemSize *= src.dimensions[i].length;
- }
- // All strides were good, copy entire buffer
- details::mdview_copy_helper(src.count(),
- src.mem, util::memory_range(src.dimensions.data(), src.count()),
- dst.mem, util::memory_range(dst.dimensions.data(), dst.count()));
-}
-
-}
-#endif // UTIL_MD_VIEW_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/memory_range.hpp b/inference-engine/thirdparty/ade/common/include/util/memory_range.hpp
deleted file mode 100644
index 6d9598395..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/memory_range.hpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_MEMORYRANGE_HPP
-#define UTIL_MEMORYRANGE_HPP
-
-#include <type_traits>
-#include <cstring> //size_t
-#include <algorithm>
-#include <array>
-
-#include "util/type_traits.hpp"
-#include "util/assert.hpp"
-
-namespace util
-{
-
-/// Non owning view over the data in another container
-/// T can be cv-qualified object or cv-qualified void
-template<typename T>
-struct MemoryRange
-{
- static_assert(std::is_object<T>::value || std::is_void<T>::value, "Invalid type");
- using value_type = T;
- T* data = nullptr;
- size_t size = 0;
-
- MemoryRange() = default;
- MemoryRange(const MemoryRange&) = default;
- MemoryRange& operator=(const MemoryRange&) = default;
-
- MemoryRange(T* data_, size_t size_):
- data(data_), size(size_)
- {
- ASSERT((nullptr != data) || (0 == size)); //size must be 0 for null data
- }
-
- /// Slice view
- /// if T is void start and newSize addressable in bytes
- /// otherwise in elements
- MemoryRange<T> Slice(size_t start, size_t newSize) const
- {
- ASSERT(nullptr != data);
- ASSERT((start + newSize) <= size);
- using temp_t = typename std::conditional<std::is_void<T>::value, char, T>::type;
- return MemoryRange<T>(static_cast<temp_t*>(data) + start, newSize);
- }
-
- template<typename Dummy = void>
- typename std::enable_if<!std::is_void<T>::value, typename std::conditional<true, T*, Dummy>::type >::type
- begin()
- {
- return data;
- }
-
- template<typename Dummy = void>
- typename std::enable_if<!std::is_void<T>::value, typename std::conditional<true, T*, Dummy>::type >::type
- end()
- {
- return data + size;
- }
-
- template<typename Dummy = void>
- typename std::enable_if<!std::is_void<T>::value, typename std::conditional<true, const T*, Dummy>::type >::type
- begin() const
- {
- return data;
- }
-
- template<typename Dummy = void>
- typename std::enable_if<!std::is_void<T>::value, typename std::conditional<true, const T*, Dummy>::type >::type
- end() const
- {
- return data + size;
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), Dummy& >::type
- operator[](size_t index)
- {
- ASSERT(index < size);
- return data[index];
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), const Dummy& >::type
- operator[](size_t index) const
- {
- ASSERT(index < size);
- return data[index];
- }
-
- template<typename NewT>
- MemoryRange<NewT> reinterpret() const
- {
- const size_t elem_size = sizeof(util::conditional_t< std::is_void<T>::value, char, T >);
- const size_t elem_size_new = sizeof(util::conditional_t< std::is_void<NewT>::value, char, NewT >);
- const size_t newSize = (size * elem_size) / elem_size_new;
- return MemoryRange<NewT>(static_cast<NewT*>(data), newSize);
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), Dummy& >::type
- front()
- {
- ASSERT(size > 0);
- return data[0];
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), const Dummy& >::type
- front() const
- {
- ASSERT(size > 0);
- return data[0];
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), Dummy& >::type
- back()
- {
- ASSERT(size > 0);
- return data[size - 1];
- }
-
- template<typename Dummy = T> // hack for sfinae
- typename std::enable_if<(sizeof(Dummy) > 0), const Dummy& >::type
- back() const
- {
- ASSERT(size > 0);
- return data[size - 1];
- }
-
- bool empty() const
- {
- return 0 == size;
- }
-
- void popFront()
- {
- ASSERT(!empty());
- *this = Slice(1, size - 1);
- }
-};
-
-template<typename T>
-inline MemoryRange<T> memory_range(T* ptr, const std::size_t size)
-{
- return {ptr, size};
-}
-
-template<typename T, std::size_t size_>
-inline MemoryRange<T> memory_range(T (&range)[size_])
-{
- return memory_range(&range[0], size_);
-}
-
-template<typename T, std::size_t size_>
-inline MemoryRange<T> memory_range(std::array<T, size_>& arr)
-{
- return memory_range(arr.data(), size_);
-}
-
-template<typename T>
-inline T* data(const MemoryRange<T>& range)
-{
- return range.data;
-}
-
-template<typename T, std::size_t size>
-inline T* data(T (&range)[size])
-{
- return &(range[0]);
-}
-
-template<typename T>
-inline std::size_t size(const MemoryRange<T>& range)
-{
- return range.size;
-}
-
-template<typename T, std::size_t size_>
-inline std::size_t size(T (&)[size_])
-{
- return size_;
-}
-
-template<typename T>
-inline bool operator==(const MemoryRange<T>& range, std::nullptr_t)
-{
- return range.data == nullptr;
-}
-
-template<typename T>
-inline bool operator==(std::nullptr_t, const MemoryRange<T>& range)
-{
- return range.data == nullptr;
-}
-
-template<typename T>
-inline bool operator!=(const MemoryRange<T>& range, std::nullptr_t)
-{
- return range.data != nullptr;
-}
-
-template<typename T>
-inline bool operator!=(std::nullptr_t, const MemoryRange<T>& range)
-{
- return range.data != nullptr;
-}
-
-template<typename T>
-inline MemoryRange<T> slice(const MemoryRange<T>& range, const std::size_t start, const std::size_t newSize)
-{
- return range.Slice(start, newSize);
-}
-
-template<typename T, std::size_t size>
-inline MemoryRange<T> slice(T (&range)[size], const std::size_t start, const std::size_t newSize)
-{
- return memory_range(&range[0], size).Slice(start, newSize);
-}
-
-template<typename SrcRange, typename DstRange>
-inline auto raw_copy(const SrcRange& src, DstRange&& dst)
--> decltype(slice(dst, size(src), size(dst) - size(src)))
-{
- static_assert(std::is_same< util::decay_t<decltype(*data(src))>,
- util::decay_t<decltype(*data(dst))> >::value, "Types must be same");
- static_assert(std::is_pod< util::decay_t<decltype(*data(src))> >::value, "Types must be pod");
- static_assert(sizeof(src[std::size_t{}]) == sizeof(dst[std::size_t{}]), "Size mismatch");
- const auto src_size = size(src);
- const auto dst_size = size(dst);
- ASSERT(nullptr != src);
- ASSERT(nullptr != dst);
- ASSERT(dst_size >= src_size);
- auto src_data = data(src);
- auto dst_data = data(dst);
- // Check overlap
- ASSERT(((src_data < dst_data) || (src_data >= (dst_data + dst_size))) &&
- ((dst_data < src_data) || (dst_data >= (src_data + src_size))));
- std::copy_n(src_data, src_size, dst_data);
-
- return slice(dst, size(src), size(dst) - size(src));
-}
-
-inline MemoryRange<void> raw_copy(const MemoryRange<void>& src, MemoryRange<void> dst)
-{
- return raw_copy(src.reinterpret<const char>(), dst.reinterpret<char>()).reinterpret<void>();
-}
-
-inline MemoryRange<void> raw_copy(const MemoryRange<const void>& src, MemoryRange<void> dst)
-{
- return raw_copy(src.reinterpret<const char>(), dst.reinterpret<char>()).reinterpret<void>();
-}
-
-} // util
-
-#endif // UTIL_MEMORYRANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/range.hpp b/inference-engine/thirdparty/ade/common/include/util/range.hpp
deleted file mode 100644
index 2d5f8d63f..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/range.hpp
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_RANGE_HPP
-#define UTIL_RANGE_HPP
-
-#include <iterator>
-#include <utility>
-
-#include "util/assert.hpp"
-#include "util/type_traits.hpp"
-
-namespace util
-{
-
-namespace details
-{
-struct RangeIncrementer
-{
- template<typename Rng>
- void operator()(Rng& range) const
- {
- range.popFront();
- }
-};
-struct RangeChecker
-{
- bool empty = false;
-
- template<typename Rng>
- void operator()(Rng& range)
- {
- empty = empty || range.empty();
- }
-};
-struct RangeCleaner
-{
- template<typename Rng>
- void operator()(Rng& range) const
- {
- range.clear();
- }
-};
-
-//SFINAE and decltype doesn't work wery well together
-// so this additional wrapper is needed
-template<typename T>
-struct range_size_wrapper_helper
-{
- using type = decltype(size(std::declval<T>()));
-};
-
-template<typename T>
-inline auto range_size_wrapper(const T& r)
-->typename range_size_wrapper_helper<T>::type
-{
- return size(r);
-}
-
-template<typename T>
-class has_size_fun
-{
- using y = char;
- using n = long;
-
- template<typename C>
- static y test(decltype(size(std::declval<C>()))*);
- template<typename C>
- static n test(...);
-public:
- static const constexpr bool value = (sizeof(test<T>(0)) == sizeof(y));
-};
-
-}
-inline namespace Range
-{
-template<typename BeginT, typename EndT = BeginT>
-struct IterRange
-{
- BeginT beginIter;
- EndT endIter;
-
- BeginT begin() const
- {
- return beginIter;
- }
-
- EndT end() const
- {
- return endIter;
- }
-
- bool empty() const
- {
- return beginIter == endIter;
- }
-
- void popFront()
- {
- ASSERT(!empty());
- ++beginIter;
- }
-
- auto front() -> decltype(*beginIter)
- {
- ASSERT(!empty());
- return *beginIter;
- }
-
- auto front() const -> decltype(*beginIter)
- {
- ASSERT(!empty());
- return *beginIter;
- }
-
- bool operator==(const IterRange<BeginT, EndT>& rhs) const
- {
- return beginIter == rhs.beginIter && endIter == rhs.endIter;
- }
-
- bool operator!=(const IterRange<BeginT, EndT>& rhs) const
- {
- return !(*this == rhs);
- }
-
- template<typename I1 = BeginT, typename I2 = EndT,
- util::enable_b_t<(sizeof(std::declval<I2>() - std::declval<I1>()) > 0)> = true> //SFINAE
- auto size() const
- ->decltype(std::declval<I2>() - std::declval<I1>())
- {
- return endIter - beginIter;
- }
-
- // TODO: bidirectional and random access ranges
-};
-
-template<typename BeginT, typename EndT>
-inline auto size(const IterRange<BeginT, EndT>& range)
-->decltype(range.size())
-{
- return range.size();
-}
-
-template<typename T>
-inline auto toRange(T&& val) -> IterRange<decltype(std::begin(val)), decltype(std::end(val))>
-{
- return {std::begin(val), std::end(val)};
-}
-
-template<typename T>
-inline auto toRangeReverse(T&& val) -> IterRange<decltype(val.rbegin()), decltype(val.rbegin())>
-{
- // TODO: use c++14 std::rbegin, std::rend
- return {val.rbegin(), val.rend()};
-}
-
-template<typename Iter>
-inline auto toRange(const std::pair<Iter,Iter>& val) -> IterRange<decltype(val.first), decltype(val.second)>
-{
- return {val.first, val.second};
-}
-
-template<typename Iter>
-inline auto toRange(Iter&& val, std::size_t count) -> IterRange<remove_reference_t<Iter>, remove_reference_t<Iter>>
-{
- return {std::forward<Iter>(val), std::next(val, count)};
-}
-
-template<typename T>
-inline auto index(T&& val)->decltype(std::get<0>(std::forward<T>(val)))
-{
- return std::get<0>(std::forward<T>(val));
-}
-
-template<int I = 0, typename T>
-inline auto value(T&& val)->decltype(std::get<I + 1>(std::forward<T>(val)))
-{
- static_assert(I >= 0,"Invalid I");
- return std::get<I + 1>(std::forward<T>(val));
-}
-
-template<typename Range>
-inline void advance_range(Range&& range)
-{
- range.popFront();
-}
-
-}
-}
-
-#endif // UTIL_RANGE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/range_iterator.hpp b/inference-engine/thirdparty/ade/common/include/util/range_iterator.hpp
deleted file mode 100644
index 658d688d3..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/range_iterator.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_RANGE_ITERATOR_HPP
-#define UTIL_RANGE_ITERATOR_HPP
-
-#include <iterator>
-#include <type_traits>
-
-#include "util/assert.hpp"
-
-namespace util
-{
-
-inline namespace Range
-{
-
-template<typename R>
-struct IterableRange
-{
- // This iterator suitable only for range for, handle with care
- struct iterator
- {
- R range;
- bool end /*= false*/; // Need C++14
-
- using value_type = typename std::remove_reference<decltype(range.front())>::type;
- using pointer = value_type*;
- using reference = value_type&;
- using iterator_category = std::input_iterator_tag;
- using difference_type = std::ptrdiff_t;
-
- bool operator==(iterator const& other) const
- {
- if((range.empty() && other.end) ||
- (end && other.range.empty()))
- {
- return true;
- }
- return false;
- }
-
- bool operator!=(iterator const& other) const
- {
- return !(*this == other);
- }
-
- auto operator*() -> decltype(range.front())
- {
- ASSERT(!range.empty());
- ASSERT(!end);
- return range.front();
- }
-
- auto operator*() const -> decltype(range.front())
- {
- ASSERT(!range.empty());
- ASSERT(!end);
- return range.front();
- }
-
- iterator& operator++()
- {
- ASSERT(!range.empty());
- ASSERT(!end);
- range.popFront();
- return *this;
- }
- };
-
- iterator begin()
- {
- auto& src = *static_cast<R*>(this);
- return iterator{src, false};
- }
-
- iterator end()
- {
- auto& src = *static_cast<R*>(this);
- return iterator{src, true};
- }
-};
-
-}
-
-}
-#endif // UTIL_RANGE_ITERATOR_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/tuple.hpp b/inference-engine/thirdparty/ade/common/include/util/tuple.hpp
deleted file mode 100644
index c060e82e2..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/tuple.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_TUPLE_HPP
-#define UTIL_TUPLE_HPP
-
-#include <tuple>
-#include <utility>
-#include <type_traits>
-
-namespace util
-{
-
-namespace details
-{
-template<int...>
-struct Seq { };
-
-template<int N, int... S>
-struct Gens : Gens<N-1, N-1, S...> { };
-
-template<int... S>
-struct Gens<0, S...>
-{
- typedef Seq<S...> type;
-};
-
-template<int N>
-using gen_t = typename Gens<N>::type;
-
-template<std::size_t I = 0, typename F, typename... TupleTypes>
-inline auto tupleForeachImpl(const std::tuple<TupleTypes...>& /*tup*/, F&& /*fun*/) -> typename std::enable_if<(I == sizeof...(TupleTypes))>::type
-{
-}
-
-template<std::size_t I = 0, typename F, typename... TupleTypes>
-inline auto tupleForeachImpl(const std::tuple<TupleTypes...>& tup, F&& fun) -> typename std::enable_if<(I < sizeof...(TupleTypes))>::type
-{
- fun(std::get<I>(tup));
- tupleForeachImpl<I + 1, F, TupleTypes...>(tup, std::forward<F>(fun));
-}
-
-template<std::size_t I = 0, typename F, typename... TupleTypes>
-inline auto tupleForeachImpl(std::tuple<TupleTypes...>& tup, F&& fun) -> typename std::enable_if<(I < sizeof...(TupleTypes))>::type
-{
- fun(std::get<I>(tup));
- tupleForeachImpl<I + 1, F, TupleTypes...>(tup, std::forward<F>(fun));
-}
-
-template<typename T>
-struct fix_rval
-{
- using type = typename std::remove_reference<T>::type;
-};
-
-template<typename T>
-struct fix_rval<T&>
-{
- using type = T&;
-};
-
-
-template<typename T>
-using fix_rval_t = typename fix_rval<T>::type;
-
-}
-
-inline namespace Range
-{
-
-/// Converts rvalue refs to values
-/// but preserves lvalue refs
-template<typename... Elements>
-inline auto tuple_remove_rvalue_refs(Elements&&... args)->
- std::tuple<details::fix_rval_t<Elements>...>
-{
- return std::tuple<details::fix_rval_t<Elements>...>(std::forward<Elements>(args)...);
-}
-
-template<typename F, typename... TupleTypes>
-inline void tupleForeach(const std::tuple<TupleTypes...>& tup, F&& fun)
-{
- details::tupleForeachImpl(tup, std::forward<F>(fun));
-}
-
-template<typename F, typename... TupleTypes>
-inline void tupleForeach(std::tuple<TupleTypes...>& tup, F&& fun)
-{
- details::tupleForeachImpl(tup, std::forward<F>(fun));
-}
-
-}
-}
-
-#endif // UTIL_TUPLE_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/type_traits.hpp b/inference-engine/thirdparty/ade/common/include/util/type_traits.hpp
deleted file mode 100644
index b3a0472fa..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/type_traits.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_TYPE_TRAITS_HPP
-#define UTIL_TYPE_TRAITS_HPP
-
-#include <type_traits>
-
-namespace util {
-
-template<bool value>
-using bool_c = std::integral_constant<bool, value>;
-
-template<typename T>
-using not_ = bool_c<!T::value>;
-
-template<typename...>
-struct or_;
-
-template<>
-struct or_<> : std::true_type {};
-
-template<typename T>
-struct or_<T> : T {};
-
-template<typename T0, typename T1>
-struct or_<T0, T1> : bool_c< T0::value || T1::value > {};
-
-template<typename T0, typename ...T>
-struct or_<T0, T...> : or_< T0, or_<T...> > {};
-
-template<typename...>
-struct and_;
-
-template<>
-struct and_<> : std::true_type {};
-
-template<typename T>
-struct and_<T> : T {};
-
-template<typename T0, typename T1>
-struct and_<T0, T1> : bool_c< T0::value && T1::value > {};
-
-template<typename T0, typename ...T>
-struct and_<T0, T...> : and_< T0, and_<T...> > {};
-
-
-template<typename T, typename ...Ts>
-struct is_one_of : or_< std::is_same<T,Ts>... > {};
-
-template<bool v>
-using enable_b_t = typename std::enable_if< v, bool >::type;
-
-template<typename ...Ts>
-using require_t = enable_b_t< and_<Ts...>::value >;
-
-template<typename T, typename ...Ts>
-using enable_t = typename std::enable_if< and_<Ts...>::value, T >::type;
-
-template<bool B, class T = void >
-using enable_if_t = typename std::enable_if<B, T>::type;
-
-template<typename T>
-using decay_t = typename std::decay<T>::type;
-
-template< class T >
-using remove_reference_t = typename std::remove_reference<T>::type;
-
-template< class T >
-using remove_pointer_t = typename std::remove_pointer<T>::type;
-
-template< bool B, class T, class F >
-using conditional_t = typename std::conditional<B,T,F>::type;
-
-template<typename... Types>
-using common_type_t = typename std::common_type<Types...>::type;
-
-template<class T>
-using result_of_t = typename std::result_of<T>::type;
-
-} // namespace util
-
-#endif // UTIL_TYPE_TRAITS_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/variant.hpp b/inference-engine/thirdparty/ade/common/include/util/variant.hpp
deleted file mode 100644
index 7b3c1c9d4..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/variant.hpp
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_VARIANT_HPP
-#define UTIL_VARIANT_HPP
-
-#include <array>
-#include <type_traits>
-
-#include <util/algorithm.hpp>
-
-// A poor man's `variant` implementation, incompletely modeled against C++17 spec.
-
-namespace util
-{
- namespace detail
- {
- template<class T, class U, class V> using are_different =
- std::enable_if<!std::is_same<typename std::decay<T>::type,
- typename std::decay<U>::type>::value,
- V>;
- }
-
- class bad_variant_access: public std::exception
- {
- public:
- virtual const char *what() const noexcept override
- {
- return "Bad variant access";
- }
- };
-
- // Interface ///////////////////////////////////////////////////////////////
- struct monostate {};
-
- template<typename... Ts> // FIXME: no references, arrays, and void
- class variant
- {
- typedef typename std::aligned_union<16, Ts...>::type Memory[1];
-
- template<typename T> struct cctr_h {
- static void help(Memory memory, const Memory from) {
- new (memory) T(*reinterpret_cast<const T*>(from));
- }
- };
-
- template<typename T> struct vctr_h {
- static void help(Memory memory, const void* pval) {
- new (memory) T(*reinterpret_cast<const T*>(pval));
- }
- };
-
- template<typename T> struct mctr_h {
- static void help(Memory memory, void *pval) {
- new (memory) T(std::move(*reinterpret_cast<T*>(pval)));
- }
- };
-
- template<typename T> struct copy_h {
- static void help(Memory to, const Memory from) {
- *reinterpret_cast<T*>(to) = *reinterpret_cast<const T*>(from);
- }
- };
-
- template<typename T> struct move_h {
- static void help(Memory to, const Memory from) {
- *reinterpret_cast<T*>(to) = std::move(*reinterpret_cast<const T*>(from));
- }
- };
-
- template<typename T> struct swap_h {
- static void help(Memory to, Memory from) {
- std::swap(*reinterpret_cast<T*>(to), *reinterpret_cast<T*>(from));
- }
- };
-
- template<typename T> struct dtor_h {
- static void help(Memory memory) {
- reinterpret_cast<T*>(memory)->~T();
- }
- };
-
- template<typename T> struct equal_h {
- static bool help(const Memory lhs, const Memory rhs) {
- const T& t_lhs = *reinterpret_cast<const T*>(lhs);
- const T& t_rhs = *reinterpret_cast<const T*>(rhs);
- return t_lhs == t_rhs;
- }
- };
-
- typedef void (*CCtr) (Memory, const Memory); // Copy c-tor (variant)
- typedef void (*VCtr) (Memory, const void*); // Copy c-tor (value)
- typedef void (*MCtr) (Memory, void*); // Generic move c-tor
- typedef void (*Copy) (Memory, const Memory); // Copy assignment
- typedef void (*Move) (Memory, const Memory); // Move assignment
- typedef void (*Swap) (Memory, Memory); // Swap
- typedef void (*Dtor) (Memory); // Destructor
-
- typedef bool (*Equal)(const Memory, const Memory); // Equality test (external)
-
- const std::array<CCtr, sizeof...(Ts)> cctrs = {{(&cctr_h<Ts>::help)...}};
- const std::array<VCtr, sizeof...(Ts)> vctrs = {{(&vctr_h<Ts>::help)...}};
- const std::array<MCtr, sizeof...(Ts)> mctrs = {{(&mctr_h<Ts>::help)...}};
- const std::array<Copy, sizeof...(Ts)> cpyrs = {{(&copy_h<Ts>::help)...}};
- const std::array<Move, sizeof...(Ts)> mvers = {{(&move_h<Ts>::help)...}};
- const std::array<Swap, sizeof...(Ts)> swprs = {{(&swap_h<Ts>::help)...}};
- const std::array<Dtor, sizeof...(Ts)> dtors = {{(&dtor_h<Ts>::help)...}};
-
- std::size_t m_index = 0;
-
- protected:
- template<typename T, typename... Us> friend T& get(variant<Us...> &v);
- template<typename T, typename... Us> friend const T& get(const variant<Us...> &v);
- template<typename... Us> friend bool operator==(const variant<Us...> &lhs,
- const variant<Us...> &rhs);
- Memory memory;
-
- public:
- // Constructors
- variant() noexcept;
- variant(const variant& other);
- variant(variant&& other) noexcept;
- template<typename T> explicit variant(const T& t);
- // are_different is a SFINAE trick to avoid variant(T &&t) with T=variant
- // for some reason, this version is called instead of variant(variant&& o) when
- // variant is used in STL containers (examples: vector assignment)
- template<typename T> explicit variant(T&& t, typename detail::are_different<variant, T, int>::type = 0);
- // template<class T, class... Args> explicit variant(Args&&... args);
- // FIXME: other constructors
-
- // Destructor
- ~variant();
-
- // Assignment
- variant& operator=(const variant& rhs);
- variant& operator=(variant &&rhs) noexcept;
-
- // SFINAE trick to avoid operator=(T&&) with T=variant<>, see comment above
- template<class T>
- typename detail::are_different<variant, T, variant&>
- ::type operator=(T&& t) noexcept;
-
- // Observers
- std::size_t index() const noexcept;
- // FIXME: valueless_by_exception()
-
- // Modifiers
- // FIXME: emplace()
- void swap(variant &rhs) noexcept;
-
- // Non-C++17x!
- template<typename T> static constexpr std::size_t index_of();
- };
-
- // FIMXE: visit
-
- template<typename T, typename... Types>
- T& get(util::variant<Types...> &v);
-
- template<typename T, typename... Types>
- const T& get(const util::variant<Types...> &v);
-
- template<typename T, typename... Types>
- bool holds_alternative(const util::variant<Types...> &v) noexcept;
-
- // FIXME: T&&, const TT&& versions.
-
- // Implementation //////////////////////////////////////////////////////////
- template<typename... Ts>
- variant<Ts...>::variant() noexcept
- {
- typedef typename std::tuple_element<0, std::tuple<Ts...> >::type TFirst;
- new (memory) TFirst();
- }
-
- template<typename... Ts>
- variant<Ts...>::variant(const variant &other)
- : m_index(other.m_index)
- {
- (cctrs[m_index])(memory, other.memory);
- }
-
- template<typename... Ts>
- variant<Ts...>::variant(variant &&other) noexcept
- : m_index(other.m_index)
- {
- (mctrs[m_index])(memory, other.memory);
- }
-
- template<typename... Ts>
- template<class T>
- variant<Ts...>::variant(const T& t)
- : m_index(util::type_list_index<T, Ts...>::value)
- {
- (vctrs[m_index])(memory, &t);
- }
-
- template<typename... Ts>
- template<class T>
- variant<Ts...>::variant(T&& t, typename detail::are_different<variant, T, int>::type)
- : m_index(util::type_list_index<typename std::remove_reference<T>::type, Ts...>::value)
- {
- (mctrs[m_index])(memory, &t);
- }
-
- template<typename... Ts>
- variant<Ts...>::~variant()
- {
- (dtors[m_index])(memory);
- }
-
- template<typename... Ts>
- variant<Ts...>& variant<Ts...>::operator=(const variant<Ts...> &rhs)
- {
- if (m_index != rhs.m_index)
- {
- (dtors[ m_index])(memory);
- (cctrs[rhs.m_index])(memory, rhs.memory);
- m_index = rhs.m_index;
- }
- else
- {
- (cpyrs[rhs.m_index])(memory, rhs.memory);
- }
- return *this;
- }
-
- template<typename... Ts>
- variant<Ts...>& variant<Ts...>::operator=(variant<Ts...> &&rhs) noexcept
- {
- if (m_index != rhs.m_index)
- {
- (dtors[ m_index])(memory);
- (mctrs[rhs.m_index])(memory, rhs.memory);
- m_index = rhs.m_index;
- }
- else
- {
- (mvers[rhs.m_index])(memory, rhs.memory);
- }
- return *this;
- }
-
- template<typename... Ts>
- template<class T> typename detail::are_different<variant<Ts...>, T, variant<Ts...>&>
- ::type variant<Ts...>::operator=(T&& t) noexcept
- {
- // FIXME: No version with implicit type conversion available!
- static const constexpr std::size_t t_index =
- util::type_list_index<T, Ts...>::value;
-
- if (t_index == m_index)
- {
- util::get<T>(*this) = std::move(t);
- return *this;
- }
- else return (*this = variant(std::move(t)));
- }
-
- template<typename... Ts>
- std::size_t util::variant<Ts...>::index() const noexcept
- {
- return m_index;
- }
-
- template<typename... Ts>
- void variant<Ts...>::swap(variant<Ts...> &rhs) noexcept
- {
- if (m_index == rhs.index())
- {
- (swprs[m_index](memory, rhs.memory));
- }
- else
- {
- variant<Ts...> tmp(std::move(*this));
- *this = std::move(rhs);
- rhs = std::move(tmp);
- }
- }
-
- template<typename... Ts>
- template<typename T>
- constexpr std::size_t variant<Ts...>::index_of()
- {
- return util::type_list_index<T, Ts...>::value; // FIXME: tests!
- }
-
- template<typename T, typename... Types>
- T& get(util::variant<Types...> &v)
- {
- const constexpr std::size_t t_index =
- util::type_list_index<T, Types...>::value;
-
- if (v.index() == t_index)
- return reinterpret_cast<T&>(v.memory);
- else
- throw_error(bad_variant_access());
- }
-
- template<typename T, typename... Types>
- const T& get(const util::variant<Types...> &v)
- {
- const constexpr std::size_t t_index =
- util::type_list_index<T, Types...>::value;
-
- if (v.index() == t_index)
- return reinterpret_cast<const T&>(v.memory);
- else
- throw_error(bad_variant_access());
- }
-
- template<typename T, typename... Types>
- bool holds_alternative(const util::variant<Types...> &v) noexcept
- {
- return v.index() == util::variant<Types...>::template index_of<T>();
- }
-
- template<typename... Us> bool operator==(const variant<Us...> &lhs,
- const variant<Us...> &rhs)
- {
- using V = variant<Us...>;
-
- // Instantiate table only here since it requires operator== for <Us...>
- // <Us...> should have operator== only if this one is used, not in general
- static const std::array<typename V::Equal, sizeof...(Us)> eqs = {
- {(&V::template equal_h<Us>::help)...}
- };
- if (lhs.index() != rhs.index())
- return false;
- return (eqs[lhs.index()])(lhs.memory, rhs.memory);
- }
-
- template<typename... Us> bool operator!=(const variant<Us...> &lhs,
- const variant<Us...> &rhs)
- {
- return !(lhs == rhs);
- }
-}
-
-#endif // UTIL_VARIANT_HPP
diff --git a/inference-engine/thirdparty/ade/common/include/util/zip_range.hpp b/inference-engine/thirdparty/ade/common/include/util/zip_range.hpp
deleted file mode 100644
index a6a324657..000000000
--- a/inference-engine/thirdparty/ade/common/include/util/zip_range.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2018 Intel Corporation
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#ifndef UTIL_ZIP_RANGE_HPP
-#define UTIL_ZIP_RANGE_HPP
-
-#include "util/tuple.hpp"
-#include "util/range.hpp"
-#include "util/assert.hpp"
-#include "util/iota_range.hpp"
-#include "util/range_iterator.hpp"
-
-namespace util
-{
-
-inline namespace Range
-{
-
-template<typename... Ranges>
-struct ZipRange : public IterableRange<ZipRange<Ranges...>>
-{
- using tuple_t = decltype(std::make_tuple(toRange(std::declval<Ranges>())...));
- tuple_t ranges;
-
- ZipRange() = default;
- ZipRange(const ZipRange&) = default;
- ZipRange(ZipRange&&) = default;
- ZipRange& operator=(const ZipRange&) = default;
- ZipRange& operator=(ZipRange&&) = default;
- ZipRange(Ranges&& ...r): ranges{toRange(std::forward<Ranges>(r))...} {}
-
- template<int... S>
- auto unpackTuple(details::Seq<S...>) ->
- decltype(tuple_remove_rvalue_refs(std::get<S>(ranges).front()...))
- {
- return tuple_remove_rvalue_refs(std::get<S>(ranges).front()...);
- }
-
- template<int... S>
- auto unpackTuple(details::Seq<S...>) const ->
- decltype(tuple_remove_rvalue_refs(std::get<S>(ranges).front()...))
- {
- return tuple_remove_rvalue_refs(std::get<S>(ranges).front()...);
- }
-
- bool empty() const
- {
- ::util::details::RangeChecker checker;
- tupleForeach(ranges, checker);
- return checker.empty;
- }
-
- void popFront()
- {
- ASSERT(!empty());
- tupleForeach(ranges, ::util::details::RangeIncrementer());
- }
-
- auto front()->decltype(this->unpackTuple(details::gen_t<static_cast<int>(sizeof...(Ranges))>{}))
- {
- ASSERT(!empty());
- return unpackTuple(details::gen_t<static_cast<int>(sizeof...(Ranges))>{});
- }
-
- auto front() const->decltype(this->unpackTuple(details::gen_t<static_cast<int>(sizeof...(Ranges))>{}))
- {
- ASSERT(!empty());
- return unpackTuple(details::gen_t<static_cast<int>(sizeof...(Ranges))>{});
- }
-
-
-};
-
-template<typename... Ranges>
-inline ZipRange<Ranges...> zip(Ranges&&... ranges)
-{
- return {std::forward<Ranges>(ranges)...};
-}
-
-template<typename... Containers>
-inline auto indexed(Containers&&... conts) ->
-decltype(zip(iota<std::size_t>(), std::forward<Containers>(conts)...))
-{
- return zip(iota<std::size_t>(), std::forward<Containers>(conts)...);
-}
-
-}
-}
-
-#endif // UTIL_ZIP_RANGE_HPP