aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-02-05 19:58:15 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:47:40 +0000
commit7ef90180584d2994ae43f222818e2bbd5288ffa4 (patch)
tree5e9fb3e56850a3fb7da020fe760c33569c3b43b0
parent1a03d76786a59a7d20deabb02f047516e98680d4 (diff)
downloadComputeLibrary-7ef90180584d2994ae43f222818e2bbd5288ffa4.tar.gz
COMPMID-765: Add Winograd Convolution Hint for NEON Convolution
Change-Id: I6ca59689df2b196de4960a62216c37780a04684e Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118959 Reviewed-by: Pablo Tello <pablo.tello@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/graph/Types.h5
-rw-r--r--src/graph/nodes/ConvolutionLayer.cpp19
2 files changed, 20 insertions, 4 deletions
diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h
index a5d6ae8459..db5bbb8604 100644
--- a/arm_compute/graph/Types.h
+++ b/arm_compute/graph/Types.h
@@ -83,8 +83,9 @@ enum class TargetHint
/** Convolution method hint to the graph executor */
enum class ConvolutionMethodHint
{
- GEMM, /**< Convolution using GEMM */
- DIRECT /**< Direct convolution */
+ GEMM, /**< Convolution using GEMM */
+ DIRECT, /**< Direct convolution */
+ WINOGRAD /**< Winograd convolution */
};
/** Supported layer operations */
diff --git a/src/graph/nodes/ConvolutionLayer.cpp b/src/graph/nodes/ConvolutionLayer.cpp
index f292b893ed..d8089d804d 100644
--- a/src/graph/nodes/ConvolutionLayer.cpp
+++ b/src/graph/nodes/ConvolutionLayer.cpp
@@ -29,6 +29,7 @@
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h"
+#include "arm_compute/runtime/NEON/functions/NEWinogradLayer.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphTypePrinter.h"
#include "utils/TypePrinter.h"
@@ -125,8 +126,22 @@ std::unique_ptr<arm_compute::IFunction> instantiate<TargetHint::NEON>(arm_comput
const WeightsInfo &weights_info,
ConvolutionMethodHint conv_method)
{
- if((conv_method == ConvolutionMethodHint::DIRECT)
- && arm_compute::NEDirectConvolutionLayer::validate(input->info(), weights->info(), biases != nullptr ? biases->info() : nullptr, output->info(), conv_info)) // NOLINT
+ const unsigned int kernel_size_x = weights->info()->tensor_shape().x();
+ const unsigned int kernel_size_y = weights->info()->tensor_shape().y();
+ const unsigned int conv_stride_x = conv_info.stride().first;
+ const unsigned int conv_stride_y = conv_info.stride().second;
+
+ bool is_square_kernel = (kernel_size_x == kernel_size_y);
+ bool has_same_stride = (conv_stride_x == conv_stride_y);
+
+ // TODO (COMPID-765) : Winograd should have a validate function
+ if(conv_method == ConvolutionMethodHint::WINOGRAD && is_square_kernel && ((kernel_size_x == 3) || (kernel_size_x == 5)) && has_same_stride && (conv_info.stride().first == 1))
+ {
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEWinogradConvolutionLayer");
+ return instantiate_direct_function<arm_compute::NEWinogradLayer, arm_compute::ITensor, TargetHint::NEON>(input, weights, biases, output, conv_info);
+ }
+ else if((conv_method == ConvolutionMethodHint::DIRECT)
+ && arm_compute::NEDirectConvolutionLayer::validate(input->info(), weights->info(), biases != nullptr ? biases->info() : nullptr, output->info(), conv_info)) // NOLINT
{
ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEDirectConvolutionLayer");
return instantiate_direct_function<arm_compute::NEDirectConvolutionLayer, arm_compute::ITensor, TargetHint::NEON>(input, weights, biases, output, conv_info);