aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-04-17 15:37:30 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-04-18 08:50:28 +0100
commit7997a3527218ed821ec933ef3a5e6a3f07409b21 (patch)
treeeeb2db8e8bdebf7f2661b68890ff6d31def7f620
parentc2ebc63baf19ab6c3da6ae7a982c9eba0c0d85be (diff)
downloadarmnn-7997a3527218ed821ec933ef3a5e6a3f07409b21.tar.gz
IVGCVSW-2980 Build ArmNN with the latest version of the driver stack library
* Changed the pre-compiled object held by the pre-compiled layer into a unique pointer, so that now the layer has the ownership of it * Changed the pre-compiled object held by the descriptor and the workload into a naked pointer, to leave the ownership to the layer Change-Id: I4a582e45ca0aa3978e8e40b786c743a6eddce852 Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
-rw-r--r--src/armnn/ISubGraphConverter.hpp12
-rw-r--r--src/armnn/layers/PreCompiledLayer.cpp14
-rw-r--r--src/armnn/layers/PreCompiledLayer.hpp10
-rw-r--r--src/backends/backendsCommon/WorkloadData.hpp2
4 files changed, 19 insertions, 19 deletions
diff --git a/src/armnn/ISubGraphConverter.hpp b/src/armnn/ISubGraphConverter.hpp
index 1d40c6737a..3a6866e102 100644
--- a/src/armnn/ISubGraphConverter.hpp
+++ b/src/armnn/ISubGraphConverter.hpp
@@ -6,17 +6,21 @@
#pragma once
#include <memory>
+#include <vector>
+#include <functional>
namespace armnn
{
+using CompiledBlobDeleter = std::function<void(const void*)>;
+using CompiledBlobPtr = std::unique_ptr<void, CompiledBlobDeleter>;
+
class ISubGraphConverter
{
public:
- virtual ~ISubGraphConverter() {};
+ virtual ~ISubGraphConverter() {}
- virtual std::shared_ptr<void> GetOutput() = 0;
+ virtual std::vector<CompiledBlobPtr> GetOutput() = 0;
};
-}
-
+} // namespace armnn
diff --git a/src/armnn/layers/PreCompiledLayer.cpp b/src/armnn/layers/PreCompiledLayer.cpp
index 11064216ee..29b35147f6 100644
--- a/src/armnn/layers/PreCompiledLayer.cpp
+++ b/src/armnn/layers/PreCompiledLayer.cpp
@@ -16,7 +16,6 @@ namespace armnn
PreCompiledLayer::PreCompiledLayer(const PreCompiledDescriptor& param, const char* name)
: LayerWithParameters(param.m_NumInputSlots, param.m_NumOutputSlots, LayerType::PreCompiled, param, name)
- , m_PreCompiledObject(nullptr)
{}
PreCompiledLayer::~PreCompiledLayer()
@@ -25,7 +24,7 @@ PreCompiledLayer::~PreCompiledLayer()
PreCompiledLayer* PreCompiledLayer::Clone(Graph& graph) const
{
PreCompiledLayer* clone = CloneBase<PreCompiledLayer>(graph, m_Param, GetName());
- clone->m_PreCompiledObject = this->m_PreCompiledObject;
+ clone->m_PreCompiledObject.reset(const_cast<PreCompiledLayer*>(this)->m_PreCompiledObject.release());
return clone;
}
@@ -33,7 +32,7 @@ std::unique_ptr<IWorkload> PreCompiledLayer::CreateWorkload(const armnn::Graph&
const armnn::IWorkloadFactory& factory) const
{
PreCompiledQueueDescriptor descriptor;
- descriptor.m_PreCompiledObject = m_PreCompiledObject;
+ descriptor.m_PreCompiledObject = m_PreCompiledObject.get();
return factory.CreatePreCompiled(descriptor, PrepInfoAndDesc(descriptor, graph));
}
@@ -43,14 +42,9 @@ void PreCompiledLayer::ValidateTensorShapesFromInputs()
// we do not need to validate its input shapes
}
-std::shared_ptr<void> PreCompiledLayer::GetPreCompiledObject() const
+void PreCompiledLayer::SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject)
{
- return m_PreCompiledObject;
-}
-
-void PreCompiledLayer::SetPreCompiledObject(const std::shared_ptr<void>& preCompiledObject)
-{
- m_PreCompiledObject = preCompiledObject;
+ m_PreCompiledObject = std::move(preCompiledObject);
}
void PreCompiledLayer::Accept(ILayerVisitor& visitor) const
diff --git a/src/armnn/layers/PreCompiledLayer.hpp b/src/armnn/layers/PreCompiledLayer.hpp
index 854a78c29a..ec5a9d6478 100644
--- a/src/armnn/layers/PreCompiledLayer.hpp
+++ b/src/armnn/layers/PreCompiledLayer.hpp
@@ -11,10 +11,14 @@
#include <armnn/Descriptors.hpp>
#include <memory>
+#include <functional>
namespace armnn
{
+using PreCompiledObjectDeleter = std::function<void(const void*)>;
+using PreCompiledObjectPtr = std::unique_ptr<void, PreCompiledObjectDeleter>;
+
class PreCompiledLayer : public LayerWithParameters<PreCompiledDescriptor>
{
public:
@@ -28,9 +32,7 @@ public:
void ValidateTensorShapesFromInputs() override;
- std::shared_ptr<void> GetPreCompiledObject() const;
-
- void SetPreCompiledObject(const std::shared_ptr<void>& preCompiledObject);
+ void SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject);
void Accept(ILayerVisitor& visitor) const override;
@@ -38,7 +40,7 @@ private:
PreCompiledLayer(const PreCompiledLayer& other) = delete;
PreCompiledLayer& operator=(const PreCompiledLayer& other) = delete;
- std::shared_ptr<void> m_PreCompiledObject;
+ PreCompiledObjectPtr m_PreCompiledObject;
};
} // namespace armnn
diff --git a/src/backends/backendsCommon/WorkloadData.hpp b/src/backends/backendsCommon/WorkloadData.hpp
index 1b5f86dde7..689c6d26c6 100644
--- a/src/backends/backendsCommon/WorkloadData.hpp
+++ b/src/backends/backendsCommon/WorkloadData.hpp
@@ -411,7 +411,7 @@ struct PreCompiledQueueDescriptor : QueueDescriptorWithParameters<PreCompiledDes
{
}
- std::shared_ptr<void> m_PreCompiledObject;
+ void* m_PreCompiledObject;
void Validate(const WorkloadInfo& workloadInfo) const;
};