diff options
author | Nattapat Chaimanowong <nattapat.chaimanowong@arm.com> | 2018-12-05 15:17:18 +0000 |
---|---|---|
committer | Les Bell <les.bell@arm.com> | 2018-12-06 08:36:56 +0000 |
commit | ac5aa1faef759e704d369e8164ea91c6d7049946 (patch) | |
tree | 4202198355c149afdaa72e20e3a299e8b8974256 | |
parent | 8174f3629d4b0dc0af7a75d2a201d756bc9e9d5b (diff) | |
download | armnn-ac5aa1faef759e704d369e8164ea91c6d7049946.tar.gz |
IVGCVSW-2315 Add descriptor for Debug
Change-Id: I6b26c681989ef815752186f027a245ef8da7aea2
-rw-r--r-- | include/armnn/Descriptors.hpp | 15 | ||||
-rw-r--r-- | include/armnn/DescriptorsFwd.hpp | 1 | ||||
-rw-r--r-- | include/armnn/ILayerSupport.hpp | 1 | ||||
-rw-r--r-- | include/armnn/LayerSupport.hpp | 1 | ||||
-rw-r--r-- | src/armnn/LayerSupport.cpp | 3 | ||||
-rw-r--r-- | src/armnn/layers/DebugLayer.cpp | 7 | ||||
-rw-r--r-- | src/armnn/layers/DebugLayer.hpp | 6 | ||||
-rw-r--r-- | src/backends/backendsCommon/ILayerSupport.cpp | 1 | ||||
-rw-r--r-- | src/backends/backendsCommon/WorkloadData.hpp | 2 | ||||
-rw-r--r-- | src/backends/backendsCommon/WorkloadFactory.cpp | 4 | ||||
-rw-r--r-- | src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp | 2 |
11 files changed, 35 insertions, 8 deletions
diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index c905eb2c97..8fbd32a76e 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -464,4 +464,19 @@ struct StridedSliceDescriptor DataLayout m_DataLayout; }; +struct DebugDescriptor +{ + DebugDescriptor() + : m_SlotIndex(0) + {} + + DebugDescriptor(const std::string name, unsigned int index) + : m_LayerName(name) + , m_SlotIndex(index) + {} + + std::string m_LayerName; + unsigned int m_SlotIndex; +}; + } diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index a2acc0717e..729f739b3d 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -27,6 +27,7 @@ struct SoftmaxDescriptor; struct OriginsDescriptor; struct ViewsDescriptor; struct StridedSliceDescriptor; +struct DebugDescriptor; using MergerDescriptor = OriginsDescriptor; using SplitterDescriptor = ViewsDescriptor; diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index 859eee25f8..2498aa945d 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -66,6 +66,7 @@ public: virtual bool IsDebugSupported(const TensorInfo& input, const TensorInfo& output, + const DebugDescriptor& descriptor, Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const; virtual bool IsDepthwiseConvolutionSupported(const TensorInfo& input, diff --git a/include/armnn/LayerSupport.hpp b/include/armnn/LayerSupport.hpp index 45ba4979c9..53efc15649 100644 --- a/include/armnn/LayerSupport.hpp +++ b/include/armnn/LayerSupport.hpp @@ -82,6 +82,7 @@ bool IsConvolution2dSupported(const BackendId& backend, bool IsDebugSupported(const BackendId& backend, const TensorInfo& input, const TensorInfo& output, + const DebugDescriptor& descriptor, char* reasonIfUnsupported = nullptr, size_t reasonIfUnsupportedMaxLength = 1024); diff --git a/src/armnn/LayerSupport.cpp b/src/armnn/LayerSupport.cpp index bdcd58a063..298b25c284 100644 --- a/src/armnn/LayerSupport.cpp +++ b/src/armnn/LayerSupport.cpp @@ -170,10 +170,11 @@ bool IsConvolution2dSupported(const BackendId& backend, bool IsDebugSupported(const BackendId& backend, const TensorInfo& input, const TensorInfo& output, + const DebugDescriptor& descriptor, char* reasonIfUnsupported, size_t reasonIfUnsupportedMaxLength) { - FORWARD_LAYER_SUPPORT_FUNC(backend, IsDebugSupported, input, output); + FORWARD_LAYER_SUPPORT_FUNC(backend, IsDebugSupported, input, output, descriptor); } bool IsDivisionSupported(const BackendId& backend, diff --git a/src/armnn/layers/DebugLayer.cpp b/src/armnn/layers/DebugLayer.cpp index c407643742..e83b17ee64 100644 --- a/src/armnn/layers/DebugLayer.cpp +++ b/src/armnn/layers/DebugLayer.cpp @@ -12,20 +12,23 @@ namespace armnn { -DebugLayer::DebugLayer(const char* name) : Layer(1, 1, LayerType::Debug, name) +DebugLayer::DebugLayer(const DebugDescriptor& param, const char* name) + : LayerWithParameters(1, 1, LayerType::Debug, param, name) {} std::unique_ptr<IWorkload> DebugLayer::CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const { DebugQueueDescriptor descriptor; + descriptor.m_Parameters.m_LayerName = m_Param.m_LayerName; + descriptor.m_Parameters.m_SlotIndex = m_Param.m_SlotIndex; return factory.CreateDebug(descriptor, PrepInfoAndDesc(descriptor, graph)); } DebugLayer* DebugLayer::Clone(Graph& graph) const { - return CloneBase<DebugLayer>(graph, GetName()); + return CloneBase<DebugLayer>(graph, m_Param, GetName()); } void DebugLayer::ValidateTensorShapesFromInputs() diff --git a/src/armnn/layers/DebugLayer.hpp b/src/armnn/layers/DebugLayer.hpp index 39ef9c7ae0..6aaa271807 100644 --- a/src/armnn/layers/DebugLayer.hpp +++ b/src/armnn/layers/DebugLayer.hpp @@ -4,12 +4,12 @@ // #pragma once -#include <Layer.hpp> +#include "LayerWithParameters.hpp" namespace armnn { -class DebugLayer : public Layer +class DebugLayer : public LayerWithParameters<DebugDescriptor> { public: virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph, @@ -20,7 +20,7 @@ public: void ValidateTensorShapesFromInputs() override; protected: - DebugLayer(const char* name); + DebugLayer(const DebugDescriptor& param, const char* name); ~DebugLayer() = default; }; diff --git a/src/backends/backendsCommon/ILayerSupport.cpp b/src/backends/backendsCommon/ILayerSupport.cpp index 26dc06ddd2..3f2636c61a 100644 --- a/src/backends/backendsCommon/ILayerSupport.cpp +++ b/src/backends/backendsCommon/ILayerSupport.cpp @@ -99,6 +99,7 @@ bool ILayerSupport::IsConvolution2dSupported(const TensorInfo& input, bool ILayerSupport::IsDebugSupported(const TensorInfo& input, const TensorInfo& output, + const DebugDescriptor& descriptor, Optional<std::string&> reasonIfUnsupported) const { return DefaultLayerSupport(__func__, __FILE__, __LINE__, reasonIfUnsupported); diff --git a/src/backends/backendsCommon/WorkloadData.hpp b/src/backends/backendsCommon/WorkloadData.hpp index b0c1e6a857..b4bcfb0104 100644 --- a/src/backends/backendsCommon/WorkloadData.hpp +++ b/src/backends/backendsCommon/WorkloadData.hpp @@ -357,7 +357,7 @@ struct MinimumQueueDescriptor : QueueDescriptor void Validate(const WorkloadInfo& workloadInfo) const; }; -struct DebugQueueDescriptor : QueueDescriptor +struct DebugQueueDescriptor : QueueDescriptorWithParameters<DebugDescriptor> { void Validate(const WorkloadInfo& workloadInfo) const; }; diff --git a/src/backends/backendsCommon/WorkloadFactory.cpp b/src/backends/backendsCommon/WorkloadFactory.cpp index fc79018aa5..915d667fed 100644 --- a/src/backends/backendsCommon/WorkloadFactory.cpp +++ b/src/backends/backendsCommon/WorkloadFactory.cpp @@ -201,11 +201,15 @@ bool IWorkloadFactory::IsLayerSupported(const BackendId& backendId, } case LayerType::Debug: { + auto cLayer = boost::polymorphic_downcast<const DebugLayer*>(&layer); + const DebugDescriptor& descriptor = cLayer->GetParameters(); + const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo(); const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo(); result = layerSupportObject->IsDebugSupported(OverrideDataType(input, dataType), OverrideDataType(output, dataType), + descriptor, reason); break; } diff --git a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp index f25ba09624..e267988786 100644 --- a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp +++ b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp @@ -332,7 +332,7 @@ DECLARE_LAYER_POLICY_2_PARAM(Convolution2d) DECLARE_LAYER_POLICY_1_PARAM(MemCopy) -DECLARE_LAYER_POLICY_1_PARAM(Debug) +DECLARE_LAYER_POLICY_2_PARAM(Debug) DECLARE_LAYER_POLICY_2_PARAM(DepthwiseConvolution2d) |