From 9e9cbafa9e6cc6b543c89a96d52fc9c5fde04ceb Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 15 Mar 2018 14:41:34 +0000 Subject: COMPMID-1004 GLES: Add memory manager to GLES functions Change-Id: I80fc9c0dd02afd79b501abde751036f9599b7bf2 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/125103 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp') diff --git a/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp index 5689722340..f4c073668a 100644 --- a/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp +++ b/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp @@ -91,9 +91,9 @@ void GCConvolutionLayerReshapeWeights::run() } } -GCConvolutionLayer::GCConvolutionLayer() - : _reshape_weights(), _input_im2col_kernel(), _input_interleave_kernel(), _mm_kernel(), _output_col2im_kernel(), _fill_border(), _input_im2col_reshaped(), _input_interleaved_reshaped(), - _weights_reshaped(), _weights_transposed(), _gemm_output(), _tmp_output(), _append_bias(false), _is_fully_connected_convolution(false), _are_weights_reshaped(false) +GCConvolutionLayer::GCConvolutionLayer(std::shared_ptr memory_manager) + : _memory_group(std::move(memory_manager)), _reshape_weights(), _input_im2col_kernel(), _input_interleave_kernel(), _mm_kernel(), _output_col2im_kernel(), _fill_border(), _input_im2col_reshaped(), + _input_interleaved_reshaped(), _weights_reshaped(), _weights_transposed(), _gemm_output(), _tmp_output(), _append_bias(false), _is_fully_connected_convolution(false), _are_weights_reshaped(false) { } @@ -196,6 +196,7 @@ void GCConvolutionLayer::configure(const IGCTensor *input, const IGCTensor *weig // FIXME: input->clone() doesn't work with subtensors for grouped convolutions. TensorInfo im2col_reshaped_info(shape_im2col, 1, dt, input->info()->fixed_point_position()); _input_im2col_reshaped.allocator()->init(im2col_reshaped_info); + _memory_group.manage(&_input_im2col_reshaped); // Create tensor (interleave) to prepare input tensor for GEMM if(run_interleaved) @@ -207,6 +208,7 @@ void GCConvolutionLayer::configure(const IGCTensor *input, const IGCTensor *weig // FIXME: input->clone() doesn't work with subtensors for grouped convolutions. TensorInfo interleaved_info(shape_interleaved, 1, dt, input->info()->fixed_point_position()); _input_interleaved_reshaped.allocator()->init(interleaved_info); + _memory_group.manage(&_input_interleaved_reshaped); } // Create GEMM output tensor @@ -218,6 +220,7 @@ void GCConvolutionLayer::configure(const IGCTensor *input, const IGCTensor *weig // FIXME: input->clone() doesn't work with subtensors for grouped convolutions. TensorInfo info_gemm(shape_gemm, 1, gemm_data_type, input->info()->fixed_point_position()); _gemm_output.allocator()->init(info_gemm); + _memory_group.manage(&_gemm_output); // Configure kernels if(dt == DataType::F16) @@ -263,6 +266,8 @@ void GCConvolutionLayer::run() _reshape_weights.run(); } + _memory_group.acquire(); + // Run im2col GCScheduler::get().dispatch(_fill_border); GCScheduler::get().memory_barrier(); @@ -282,4 +287,6 @@ void GCConvolutionLayer::run() GCScheduler::get().memory_barrier(); // Reshape output matrix GCScheduler::get().dispatch(_output_col2im_kernel, false); + + _memory_group.release(); } -- cgit v1.2.1