aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/Layer.hpp
diff options
context:
space:
mode:
authorDerek Lamberti <derek.lamberti@arm.com>2019-06-13 11:40:08 +0100
committerDerek Lamberti <derek.lamberti@arm.com>2019-06-24 15:00:15 +0000
commit84da38b0f11ca3db0a439e510514be780f3933ff (patch)
tree56532f4842abc1ad00ae57bc20ddc72cada59b4c /src/armnn/Layer.hpp
parent9515c7ec4f4535fff2c8f2d3f88974474d3f3468 (diff)
downloadarmnn-84da38b0f11ca3db0a439e510514be780f3933ff.tar.gz
IVGCVSW-3277 Refactor TensorHandle factory API
* Added backend support for multiple types of TensorHandle factories * Refactored the backend API to enable new tensor strategies * Added mechanism to determine memory strategies during optimization * Perform mem-copy only when Direct access is not found * Explicitly deleted the copy-constructor from OutputSlot to prevent accidental local copies that would cause the DisconnectAll to be called by the destructor Change-Id: I7e812c8e5e6c1c20db1c5932749ac70fd93db7f8 Signed-off-by: Derek Lamberti <derek.lamberti@arm.com> Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/armnn/Layer.hpp')
-rw-r--r--src/armnn/Layer.hpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/armnn/Layer.hpp b/src/armnn/Layer.hpp
index cbb1771668..1ddbc00bc7 100644
--- a/src/armnn/Layer.hpp
+++ b/src/armnn/Layer.hpp
@@ -6,7 +6,9 @@
#include "LayerFwd.hpp"
+#include <backendsCommon/ITensorHandleFactory.hpp>
#include <backendsCommon/OutputHandler.hpp>
+#include <backendsCommon/TensorHandleFactoryRegistry.hpp>
#include <backendsCommon/WorkloadDataCollector.hpp>
#include <backendsCommon/WorkloadInfo.hpp>
#include "InternalTypes.hpp"
@@ -84,8 +86,15 @@ public:
explicit OutputSlot(Layer& owner, OutputHandler& outputHandler)
: m_OwningLayer(owner)
, m_OutputHandler(outputHandler)
+ , m_TensorHandleFactoryId(ITensorHandleFactory::LegacyFactoryId)
{}
+ OutputSlot(const OutputSlot&) = delete;
+ OutputSlot& operator=(const OutputSlot&) = delete;
+
+ OutputSlot(OutputSlot&&) = default;
+ OutputSlot& operator=(OutputSlot&&) = default;
+
~OutputSlot()
{
try
@@ -147,12 +156,21 @@ public:
bool operator==(const OutputSlot& other) const;
+ void SetTensorHandleFactory(const ITensorHandleFactory::FactoryId& id);
+ ITensorHandleFactory::FactoryId GetTensorHandleFactoryId() const;
+
+ void SetMemoryStrategy(unsigned int connectionIndex, MemoryStrategy strategy);
+ MemoryStrategy GetMemoryStrategyForConnection(unsigned int connectionIdx) const;
+
private:
void ValidateConnectionIndex(unsigned int index) const;
Layer& m_OwningLayer;
OutputHandler& m_OutputHandler;
std::vector<InputSlot*> m_Connections;
+
+ ITensorHandleFactory::FactoryId m_TensorHandleFactoryId;
+ std::vector<MemoryStrategy> m_MemoryStrategies;
};
// InputSlot inlines that need OutputSlot declaration.
@@ -248,7 +266,7 @@ public:
virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const = 0;
- virtual void CreateTensorHandles(Graph& graph, const IWorkloadFactory& factory);
+ virtual void CreateTensorHandles(const TensorHandleFactoryRegistry& registry, const IWorkloadFactory& factory);
/// Creates a dynamically-allocated copy of this layer.
/// @param graph - The Graph into which this Layer is being cloned.