From 72219330fd85b1271e714d4ba894d6d8e26340c9 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 5 Jun 2018 14:56:06 +0100 Subject: COMPMID-1145: (API) Introduce prepare() stage (NEON/CL/GLES) Change-Id: I5b46764f9c3154ec3e3b9c951cc9e6dfbcb81dfb Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/134255 Reviewed-by: Anthony Barbier Tested-by: Jenkins Reviewed-by: Pablo Tello Reviewed-by: Michele DiGiorgio --- .../runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h | 4 ++-- .../runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h | 10 ++++++++++ arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h | 13 +++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'arm_compute/runtime/GLES_COMPUTE') diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h index fa29f447c8..45a883948c 100644 --- a/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h +++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h @@ -63,7 +63,6 @@ public: private: GCWeightsReshapeKernel _weights_reshape_kernel; - GCTensor _weights_reshaped; }; /** Basic function to compute the convolution layer. This function calls the following GLES kernels: @@ -128,6 +127,7 @@ public: // Inherited methods overridden: void run() override; + void prepare() override; private: /** Configures the appropriate matrix multiply routine @@ -166,8 +166,8 @@ private: GCTensor _gemm_output; GCTensor _tmp_output; - bool _is_first_run; bool _is_activationlayer_enabled; + bool _is_prepared; }; } diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h index 1f8dc3e1a0..cd108c3eab 100644 --- a/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h +++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h @@ -65,6 +65,14 @@ class GCFullyConnectedLayer : public IFunction public: /** Constructor */ GCFullyConnectedLayer(std::shared_ptr memory_manager = nullptr); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GCFullyConnectedLayer(const GCFullyConnectedLayer &) = delete; + /** Default move constructor */ + GCFullyConnectedLayer(GCFullyConnectedLayer &&) = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GCFullyConnectedLayer &operator=(const GCFullyConnectedLayer &) = delete; + /** Default move assignment operator */ + GCFullyConnectedLayer &operator=(GCFullyConnectedLayer &&) = default; /** Set the input and output tensors. * * @param[in] input Source tensor. Data type supported: F16/F32. @@ -81,6 +89,7 @@ public: //Inherited methods override void run() override; + void prepare() override; private: void configure_fc_fc(const IGCTensor *input, const IGCTensor *weights, IGCTensor *output); @@ -93,6 +102,7 @@ private: GCGEMMMatrixAccumulateBiasesKernel _accumulate_biases_kernel; GCTensor _im2col_output; GCTensor _reshape_weights_output; + const IGCTensor *_original_weights; bool _are_weights_reshaped; bool _is_fc_after_conv; bool _accumulate_biases; diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h index a1d6c8a438..2db254527f 100644 --- a/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h +++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h @@ -50,7 +50,14 @@ class GCGEMM : public IFunction public: /** Default constructor. */ GCGEMM(std::shared_ptr memory_manager = nullptr); - + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GCGEMM(const GCGEMM &) = delete; + /** Default move constructor */ + GCGEMM(GCGEMM &&) = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GCGEMM &operator=(const GCGEMM &) = delete; + /** Default move assignment operator */ + GCGEMM &operator=(GCGEMM &&) = default; /** Initialise the kernel's inputs and output * * @note GEMM: General Matrix Multiply - [alpha * A * B + beta * C]. @@ -86,6 +93,7 @@ public: // Inherited methods overridden: void run() override; + void prepare() override; private: GCMemoryGroup _memory_group; @@ -95,10 +103,11 @@ private: GCGEMMMatrixAdditionKernel _ma_kernel; GCTensor _tmp_a; GCTensor _tmp_b; + const IGCTensor *_original_b; bool _is_interleaved_transposed; bool _run_addition; - bool _is_first_run; bool _reshape_b_only_on_first_run; + bool _is_prepared; }; } -- cgit v1.2.1