aboutsummaryrefslogtreecommitdiff
path: root/src/graph/backends
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph/backends')
-rw-r--r--src/graph/backends/GLES/GCDeviceBackend.cpp163
-rw-r--r--src/graph/backends/GLES/GCFunctionsFactory.cpp275
-rw-r--r--src/graph/backends/GLES/GCNodeValidator.cpp147
-rw-r--r--src/graph/backends/GLES/GCTensorHandle.cpp103
4 files changed, 0 insertions, 688 deletions
diff --git a/src/graph/backends/GLES/GCDeviceBackend.cpp b/src/graph/backends/GLES/GCDeviceBackend.cpp
deleted file mode 100644
index dcab2a5697..0000000000
--- a/src/graph/backends/GLES/GCDeviceBackend.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2018-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/graph/backends/GLES/GCDeviceBackend.h"
-
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/GraphContext.h"
-#include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Logger.h"
-#include "arm_compute/graph/Tensor.h"
-#include "arm_compute/graph/backends/BackendRegistrar.h"
-#include "arm_compute/graph/backends/GLES/GCFunctionFactory.h"
-#include "arm_compute/graph/backends/GLES/GCNodeValidator.h"
-#include "arm_compute/graph/backends/GLES/GCTensorHandle.h"
-
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/runtime/BlobLifetimeManager.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h"
-#include "arm_compute/runtime/MemoryGroup.h"
-#include "arm_compute/runtime/MemoryManagerOnDemand.h"
-#include "arm_compute/runtime/PoolManager.h"
-
-#include "support/ToolchainSupport.h"
-
-namespace arm_compute
-{
-namespace graph
-{
-namespace backends
-{
-/** Register GLES backend */
-static detail::BackendRegistrar<GCDeviceBackend> GCDeviceBackend_registrar(Target::GC);
-
-GCDeviceBackend::GCDeviceBackend()
- : _initialized(false), _allocator()
-{
-}
-
-void GCDeviceBackend::initialize_backend()
-{
- // Setup Scheduler
- GCScheduler::get().default_init();
-}
-
-void GCDeviceBackend::release_backend_context(GraphContext &ctx)
-{
- //Nothing to do
- ARM_COMPUTE_UNUSED(ctx);
-}
-
-void GCDeviceBackend::setup_backend_context(GraphContext &ctx)
-{
- // Force backend initialization
- if(!_initialized)
- {
- initialize_backend();
- _initialized = true;
- }
-
- // Setup a management backend
- if(ctx.memory_management_ctx(Target::GC) == nullptr)
- {
- MemoryManagerContext mm_ctx;
- mm_ctx.target = Target::GC;
- mm_ctx.intra_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
- mm_ctx.cross_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
- mm_ctx.cross_group = std::make_shared<MemoryGroup>(mm_ctx.cross_mm);
- mm_ctx.allocator = &_allocator;
-
- ctx.insert_memory_management_ctx(std::move(mm_ctx));
- }
-}
-
-bool GCDeviceBackend::is_backend_supported()
-{
- return arm_compute::opengles31_is_available();
-}
-
-IAllocator *GCDeviceBackend::backend_allocator()
-{
- return &_allocator;
-}
-
-std::unique_ptr<ITensorHandle> GCDeviceBackend::create_tensor(const Tensor &tensor)
-{
- // Get tensor descriptor
- const TensorDescriptor &tensor_desc = tensor.desc();
- ARM_COMPUTE_ERROR_ON(tensor_desc.target != Target::GC);
-
- // Create backend tensor handle
- TensorInfo info(tensor_desc.shape, 1, tensor_desc.data_type, tensor_desc.quant_info);
- info.set_data_layout(tensor_desc.layout);
-
- return std::make_unique<GCTensorHandle>(info);
-}
-
-std::unique_ptr<ITensorHandle> GCDeviceBackend::create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent)
-{
- ARM_COMPUTE_UNUSED(parent, shape, coords, extend_parent);
- ARM_COMPUTE_ERROR("GLES backend has no sub-tensor support!");
- return nullptr;
-}
-
-std::unique_ptr<arm_compute::IFunction> GCDeviceBackend::configure_node(INode &node, GraphContext &ctx)
-{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE("Configuring GC node with ID : " << node.id() << std::endl);
- ARM_COMPUTE_ERROR_ON(node.assigned_target() != Target::GC);
-
- // Configure node
- return GCFunctionFactory::create(&node, ctx);
-}
-
-arm_compute::Status GCDeviceBackend::validate_node(INode &node)
-{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating GC node with ID : " << node.id() << std::endl);
- ARM_COMPUTE_ERROR_ON(node.assigned_target() != Target::GC);
-
- return GCNodeValidator::validate(&node);
-}
-
-std::shared_ptr<arm_compute::IMemoryManager> GCDeviceBackend::create_memory_manager(MemoryManagerAffinity affinity)
-{
- if(affinity == MemoryManagerAffinity::Offset)
- {
- ARM_COMPUTE_LOG_GRAPH_WARNING("GC Backend does not support offset affinity memory management!");
- return nullptr;
- }
-
- auto lifetime_mgr = std::make_shared<BlobLifetimeManager>();
- auto pool_mgr = std::make_shared<PoolManager>();
- auto mm = std::make_shared<MemoryManagerOnDemand>(lifetime_mgr, pool_mgr);
-
- return mm;
-}
-
-std::shared_ptr<arm_compute::IWeightsManager> GCDeviceBackend::create_weights_manager()
-{
- return nullptr;
-}
-} // namespace backends
-} // namespace graph
-} // namespace arm_compute
diff --git a/src/graph/backends/GLES/GCFunctionsFactory.cpp b/src/graph/backends/GLES/GCFunctionsFactory.cpp
deleted file mode 100644
index ac14425ad4..0000000000
--- a/src/graph/backends/GLES/GCFunctionsFactory.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (c) 2018-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/graph/backends/GLES/GCFunctionFactory.h"
-
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/GraphContext.h"
-#include "arm_compute/graph/backends/FunctionHelpers.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCFunctions.h"
-#include "support/Cast.h"
-
-using namespace arm_compute::utils::cast;
-
-namespace arm_compute
-{
-namespace graph
-{
-namespace backends
-{
-/** Target specific information structure used to pass information to the layer templates */
-struct GCTargetInfo
-{
- using TensorType = arm_compute::IGCTensor;
- using SrcTensorType = TensorType;
- static Target TargetType;
-};
-
-Target GCTargetInfo::TargetType = Target::GC;
-
-/** Collection of GC convolution functions */
-struct GCConvolutionLayerFunctions
-{
- using GenericConvolutionLayer = GCConvolutionLayer;
- using GEMMConvolutionLayer = GCConvolutionLayer;
- using DirectConvolutionLayer = GCDirectConvolutionLayer;
-};
-
-/** Collection of GC depthwise convolution functions */
-struct GCDepthwiseConvolutionLayerFunctions
-{
- using DepthwiseConvolutionLayer3x3 = GCDepthwiseConvolutionLayer3x3;
-};
-
-/** Collection of GC element-wise functions */
-struct GCEltwiseFunctions
-{
- using Addition = GCArithmeticAddition;
- using Multiplication = GCPixelWiseMultiplication;
-};
-
-namespace detail
-{
-template <>
-std::unique_ptr<IFunction> create_convolution_layer<GCConvolutionLayerFunctions, GCTargetInfo>(ConvolutionLayerNode &node, GraphContext &ctx)
-{
- validate_node<GCTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */);
-
- // Extract IO and info
- GCTargetInfo::TensorType *input = get_backing_tensor<GCTargetInfo>(node.input(0));
- GCTargetInfo::TensorType *weights = get_backing_tensor<GCTargetInfo>(node.input(1));
- GCTargetInfo::TensorType *biases = get_backing_tensor<GCTargetInfo>(node.input(2));
- GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0));
-
- if(is_data_type_quantized_asymmetric(input->info()->data_type()))
- {
- biases->info()->set_data_type(DataType::S32);
- }
-
- const PadStrideInfo conv_info = node.convolution_info();
- const ConvolutionMethod conv_algorithm = node.convolution_method();
- const ActivationLayerInfo fused_act = node.fused_activation();
-
- // Create and configure function (we assume that functions have been validated before creation)
- std::shared_ptr<IMemoryManager> mm = get_memory_manager(ctx, GCTargetInfo::TargetType);
- std::unique_ptr<IFunction> func;
- std::string func_name;
-
- if(conv_algorithm == ConvolutionMethod::Direct)
- {
- std::tie(func, func_name) = create_named_function<GCConvolutionLayerFunctions::DirectConvolutionLayer>(
- std::string("DirectConvolutionLayer"),
- input, weights, biases, output, conv_info, fused_act);
- }
- else
- {
- std::tie(func, func_name) = create_named_memory_managed_function<GCConvolutionLayerFunctions::GenericConvolutionLayer>(
- std::string("ConvolutionLayer"), mm,
- input, weights, biases, output, conv_info, WeightsInfo(), Size2D(1U, 1U), fused_act);
- }
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
- << node.name()
- << " Type: " << func_name
- << " Data Type: " << input->info()->data_type()
- << " Input QuantInfo: " << input->info()->quantization_info()
- << " Weights QuantInfo: " << weights->info()->quantization_info()
- << " Input shape: " << input->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Output shape: " << output->info()->tensor_shape()
- << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "")
- << std::endl);
- return std::move(func);
-}
-
-template <>
-std::unique_ptr<IFunction> create_depthwise_convolution_layer<GCDepthwiseConvolutionLayerFunctions, GCTargetInfo>(DepthwiseConvolutionLayerNode &node)
-{
- validate_node<GCTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */);
-
- // Extract IO and info
- GCTargetInfo::TensorType *input = get_backing_tensor<GCTargetInfo>(node.input(0));
- GCTargetInfo::TensorType *weights = get_backing_tensor<GCTargetInfo>(node.input(1));
- GCTargetInfo::TensorType *biases = get_backing_tensor<GCTargetInfo>(node.input(2));
- GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0));
-
- if(is_data_type_quantized_asymmetric(input->info()->data_type()))
- {
- biases->info()->set_data_type(DataType::S32);
- }
-
- const PadStrideInfo conv_info = node.convolution_info();
- const DepthwiseConvolutionMethod dwc_algorithm = node.depthwise_convolution_method();
- const ActivationLayerInfo fused_act = node.fused_activation();
- const int depth_multiplier = node.depth_multiplier();
-
- // Create and configure function (we assume that functions have been validated before creation)
- std::unique_ptr<IFunction> func;
- std::string func_name;
- if(dwc_algorithm == DepthwiseConvolutionMethod::Optimized3x3)
- {
- std::tie(func, func_name) = create_named_function<GCDepthwiseConvolutionLayerFunctions::DepthwiseConvolutionLayer3x3>(
- std::string("DepthwiseConvolutionLayer3x3"),
- input, weights, biases, output, conv_info, depth_multiplier, fused_act);
- }
- else
- {
- ARM_COMPUTE_ERROR("Generic DepthwiseConvolutionLayer is not supported in GLES backend");
- }
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
- << node.name()
- << " Type: " << func_name
- << " Target " << GCTargetInfo::TargetType
- << " Data Type: " << input->info()->data_type()
- << " Input QuantInfo: " << input->info()->quantization_info()
- << " Weights QuantInfo: " << weights->info()->quantization_info()
- << " Input shape: " << input->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Output shape: " << output->info()->tensor_shape()
- << " Depth multiplier: " << depth_multiplier
- << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "")
- << std::endl);
- return std::move(func);
-}
-
-template <>
-std::unique_ptr<IFunction> create_eltwise_layer<GCEltwiseFunctions, GCTargetInfo>(EltwiseLayerNode &node)
-{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE(
- "Creating GC EltwiseLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
- ARM_COMPUTE_ERROR_ON(node.num_inputs() != 2);
- ARM_COMPUTE_ERROR_ON(node.num_outputs() != 1);
-
- // Extract IO and info
- GCTargetInfo::TensorType *input1 = get_backing_tensor<GCTargetInfo>(node.input(0));
- GCTargetInfo::TensorType *input2 = get_backing_tensor<GCTargetInfo>(node.input(1));
- GCTargetInfo::TensorType *output = get_backing_tensor<GCTargetInfo>(node.output(0));
- const EltwiseOperation eltwise_op = node.eltwise_operation();
- const ConvertPolicy convert_policy = node.convert_policy();
- ARM_COMPUTE_ERROR_ON(input1 == nullptr);
- ARM_COMPUTE_ERROR_ON(input2 == nullptr);
- ARM_COMPUTE_ERROR_ON(output == nullptr);
-
- std::unique_ptr<IFunction> func = nullptr;
- std::string func_name;
- if(eltwise_op == EltwiseOperation::Add)
- {
- std::tie(func, func_name) = create_named_function<GCEltwiseFunctions::Addition>(
- std::string("GCArithmeticAddition"),
- input1, input2, output, convert_policy);
- }
- else if(eltwise_op == EltwiseOperation::Sub)
- {
- ARM_COMPUTE_ERROR("Arithmetic subtraction is not supported in GLES backend");
- }
- else if(eltwise_op == EltwiseOperation::Mul)
- {
- std::tie(func, func_name) = create_named_function<GCEltwiseFunctions::Multiplication>(
- std::string("PixelWiseMultiplication"),
- input1, input2, output, 1.f);
- }
- else
- {
- ARM_COMPUTE_ERROR("Unsupported element-wise operation!");
- }
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
- << node.name()
- << " Type: " << node.type()
- << " Target: " << GCTargetInfo::TargetType
- << " Operation: " << func_name
- << " Data Type: " << input1->info()->data_type()
- << " Shape: " << input1->info()->tensor_shape()
- << std::endl);
-
- return std::move(func);
-}
-} //namespace detail
-
-std::unique_ptr<IFunction> GCFunctionFactory::create(INode *node, GraphContext &ctx)
-{
- if(node == nullptr)
- {
- return nullptr;
- }
-
- NodeType type = node->type();
- switch(type)
- {
- case NodeType::ActivationLayer:
- return detail::create_activation_layer<GCActivationLayer, GCTargetInfo>(*polymorphic_downcast<ActivationLayerNode *>(node));
- case NodeType::BatchNormalizationLayer:
- return detail::create_batch_normalization_layer<GCBatchNormalizationLayer, GCTargetInfo>(*polymorphic_downcast<BatchNormalizationLayerNode *>(node));
- case NodeType::ConvolutionLayer:
- return detail::create_convolution_layer<GCConvolutionLayerFunctions, GCTargetInfo>(*polymorphic_downcast<ConvolutionLayerNode *>(node), ctx);
- case NodeType::ConcatenateLayer:
- return detail::create_concatenate_layer<GCConcatenateLayer, GCTargetInfo>(*polymorphic_downcast<ConcatenateLayerNode *>(node));
- case NodeType::DepthwiseConvolutionLayer:
- return detail::create_depthwise_convolution_layer<GCDepthwiseConvolutionLayerFunctions, GCTargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node));
- case NodeType::EltwiseLayer:
- return detail::create_eltwise_layer<GCEltwiseFunctions, GCTargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node));
- case NodeType::FullyConnectedLayer:
- return detail::create_fully_connected_layer<GCFullyConnectedLayer, GCTargetInfo>(*polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx);
- case NodeType::NormalizationLayer:
- return detail::create_normalization_layer<GCNormalizationLayer, GCTargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx);
- case NodeType::NormalizePlanarYUVLayer:
- return detail::create_normalize_planar_yuv_layer<GCNormalizePlanarYUVLayer, GCTargetInfo>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node));
- case NodeType::PoolingLayer:
- return detail::create_pooling_layer<GCPoolingLayer, GCTargetInfo>(*polymorphic_downcast<PoolingLayerNode *>(node));
- case NodeType::PrintLayer:
- return detail::create_print_layer<GCTargetInfo>(*polymorphic_downcast<PrintLayerNode *>(node));
- case NodeType::ResizeLayer:
- return detail::create_resize_layer<GCScale, GCTargetInfo>(*polymorphic_downcast<ResizeLayerNode *>(node));
- case NodeType::SoftmaxLayer:
- return detail::create_softmax_layer<GCSoftmaxLayer, GCTargetInfo>(*polymorphic_downcast<SoftmaxLayerNode *>(node), ctx);
- default:
- return nullptr;
- }
-}
-} // namespace backends
-} // namespace graph
-} // namespace arm_compute
diff --git a/src/graph/backends/GLES/GCNodeValidator.cpp b/src/graph/backends/GLES/GCNodeValidator.cpp
deleted file mode 100644
index a83c1a3506..0000000000
--- a/src/graph/backends/GLES/GCNodeValidator.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2018-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/graph/backends/GLES/GCNodeValidator.h"
-
-#include "arm_compute/graph/backends/ValidateHelpers.h"
-#include "arm_compute/graph/nodes/Nodes.h"
-
-#include "arm_compute/runtime/GLES_COMPUTE/GCFunctions.h"
-#include "support/Cast.h"
-
-using namespace arm_compute::utils::cast;
-
-namespace arm_compute
-{
-namespace graph
-{
-namespace backends
-{
-namespace
-{
-/** Validates a Depthwise Convolution layer node
- *
- * @param[in] node Node to validate
- *
- * @return Status
- */
-Status validate_depthwise_convolution_layer(DepthwiseConvolutionLayerNode &node)
-{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating GCDepthwiseConvolutionLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
- ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 3);
- ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1);
-
- // Extract IO and info
- arm_compute::ITensorInfo *weights = detail::get_backing_tensor_info(node.input(1));
- ARM_COMPUTE_ERROR_ON(weights == nullptr);
-
- // TODO (geopin01) : Switch when validation is implemented
- // Validate function
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(weights->tensor_shape().x() != 3 && weights->tensor_shape().y() != 3, "Unsupported depthwise convolution");
-
- return Status{};
-}
-/** Validates a Convolution layer node
- *
- * @param[in] node Node to validate
- *
- * @return Status
- */
-Status validate_convolution_layer(ConvolutionLayerNode &node)
-{
- ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating ConvolutionLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
- ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 3);
- ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1);
-
- // Extract IO and info
- arm_compute::ITensorInfo *weights = detail::get_backing_tensor_info(node.input(1));
- const PadStrideInfo conv_info = node.convolution_info();
- const ConvolutionMethod conv_algorithm = node.convolution_method();
-
- // Validate function
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(node.num_groups() != 1, "Grouping is not supported by ConvolutionLayer!");
- if(conv_algorithm == ConvolutionMethod::Direct)
- {
- bool is_square = weights->tensor_shape().x() == weights->tensor_shape().y();
- bool is_direct = (weights->tensor_shape().x() == 1) || (weights->tensor_shape().x() == 3) || (weights->tensor_shape().x() == 5);
- bool is_correct_stride = (conv_info.stride().first) <= 2 && (conv_info.stride().second <= 2);
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(!(is_square && is_direct && is_correct_stride), "Direct convolution is not supported for given configuration");
- }
-
- return Status{};
-}
-} // namespace
-
-Status GCNodeValidator::validate(INode *node)
-{
- if(node == nullptr)
- {
- return Status{};
- }
-
- NodeType type = node->type();
- switch(type)
- {
- case NodeType::BoundingBoxTransformLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : BoundingBoxTransformLayer");
- case NodeType::ChannelShuffleLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ChannelShuffleLayer");
- case NodeType::ConvolutionLayer:
- return validate_convolution_layer(*polymorphic_downcast<ConvolutionLayerNode *>(node));
- case NodeType::DepthwiseConvolutionLayer:
- return validate_depthwise_convolution_layer(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node));
- case NodeType::DequantizationLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : DequantizationLayer");
- case NodeType::DetectionOutputLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : DetectionOutputLayer");
- case NodeType::DetectionPostProcessLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : DetectionPostProcessLayer");
- case NodeType::FlattenLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : FlattenLayer");
- case NodeType::GenerateProposalsLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : GenerateProposalsLayer");
- case NodeType::NormalizePlanarYUVLayer:
- return detail::validate_normalize_planar_yuv_layer<GCNormalizePlanarYUVLayer>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node));
- case NodeType::PadLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : PadLayer");
- case NodeType::PermuteLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : PermuteLayer");
- case NodeType::PriorBoxLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : PriorBoxLayer");
- case NodeType::QuantizationLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : QuantizationLayer");
- case NodeType::ReorgLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ReorgLayer");
- case NodeType::ReshapeLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ReshapeLayer");
- case NodeType::ROIAlignLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ROIAlignLayer");
- case NodeType::SliceLayer:
- return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : SliceLayer");
- default:
- return Status{};
- }
-}
-} // namespace backends
-} // namespace graph
-} // namespace arm_compute
diff --git a/src/graph/backends/GLES/GCTensorHandle.cpp b/src/graph/backends/GLES/GCTensorHandle.cpp
deleted file mode 100644
index 94e8813246..0000000000
--- a/src/graph/backends/GLES/GCTensorHandle.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2018-2019 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/graph/backends/GLES/GCTensorHandle.h"
-
-#include "arm_compute/runtime/IMemoryGroup.h"
-
-namespace arm_compute
-{
-namespace graph
-{
-namespace backends
-{
-GCTensorHandle::GCTensorHandle(const ITensorInfo &info)
- : _tensor()
-{
- _tensor.allocator()->init(info);
-}
-
-void GCTensorHandle::allocate()
-{
- _tensor.allocator()->allocate();
-}
-
-void GCTensorHandle::free()
-{
- _tensor.allocator()->free();
-}
-
-void GCTensorHandle::manage(IMemoryGroup *mg)
-{
- if(mg != nullptr)
- {
- mg->manage(&_tensor);
- }
-}
-
-void GCTensorHandle::map(bool blocking)
-{
- _tensor.map(blocking);
-}
-
-void GCTensorHandle::unmap()
-{
- _tensor.unmap();
-}
-
-void GCTensorHandle::release_if_unused()
-{
- // TODO (geopin01): Release tensor only if all sub-tensors are marked as not used
- if(!_tensor.is_used())
- {
- _tensor.allocator()->free();
- }
-}
-
-const arm_compute::ITensor &GCTensorHandle::tensor() const
-{
- return _tensor;
-}
-
-arm_compute::ITensor &GCTensorHandle::tensor()
-{
- return _tensor;
-}
-
-ITensorHandle *GCTensorHandle::parent_handle()
-{
- return this;
-}
-
-bool GCTensorHandle::is_subtensor() const
-{
- return false;
-}
-
-Target GCTensorHandle::target() const
-{
- return Target::GC;
-}
-} // namespace backends
-} // namespace graph
-} // namespace arm_compute \ No newline at end of file