aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/functions')
-rw-r--r--src/runtime/CL/functions/CLCannyEdge.cpp6
-rw-r--r--src/runtime/CL/functions/CLConvolution.cpp6
-rw-r--r--src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp4
-rw-r--r--src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp4
-rw-r--r--src/runtime/CL/functions/CLFFT1D.cpp4
-rw-r--r--src/runtime/CL/functions/CLFastCorners.cpp6
-rw-r--r--src/runtime/CL/functions/CLFullyConnectedLayer.cpp6
-rw-r--r--src/runtime/CL/functions/CLGEMM.cpp4
-rw-r--r--src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp4
-rw-r--r--src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp4
-rw-r--r--src/runtime/CL/functions/CLGaussian5x5.cpp6
-rw-r--r--src/runtime/CL/functions/CLGenerateProposalsLayer.cpp5
-rw-r--r--src/runtime/CL/functions/CLHOGDescriptor.cpp6
-rw-r--r--src/runtime/CL/functions/CLHOGGradient.cpp6
-rw-r--r--src/runtime/CL/functions/CLHOGMultiDetection.cpp6
-rw-r--r--src/runtime/CL/functions/CLHarrisCorners.cpp6
-rw-r--r--src/runtime/CL/functions/CLL2NormalizeLayer.cpp6
-rw-r--r--src/runtime/CL/functions/CLLSTMLayer.cpp4
-rw-r--r--src/runtime/CL/functions/CLLocallyConnectedLayer.cpp6
-rw-r--r--src/runtime/CL/functions/CLMeanStdDev.cpp6
-rw-r--r--src/runtime/CL/functions/CLOpticalFlow.cpp6
-rw-r--r--src/runtime/CL/functions/CLRNNLayer.cpp6
-rw-r--r--src/runtime/CL/functions/CLReduceMean.cpp3
-rw-r--r--src/runtime/CL/functions/CLReductionOperation.cpp4
-rw-r--r--src/runtime/CL/functions/CLSobel5x5.cpp6
-rw-r--r--src/runtime/CL/functions/CLSobel7x7.cpp6
-rw-r--r--src/runtime/CL/functions/CLSoftmaxLayer.cpp7
-rw-r--r--src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp4
28 files changed, 45 insertions, 102 deletions
diff --git a/src/runtime/CL/functions/CLCannyEdge.cpp b/src/runtime/CL/functions/CLCannyEdge.cpp
index 84e87092f9..4c7458d1ed 100644
--- a/src/runtime/CL/functions/CLCannyEdge.cpp
+++ b/src/runtime/CL/functions/CLCannyEdge.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -177,7 +177,7 @@ void CLCannyEdge::configure(ICLTensor *input, ICLTensor *output, int32_t upper_t
void CLCannyEdge::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run sobel
_sobel->run();
@@ -199,6 +199,4 @@ void CLCannyEdge::run()
_l1_list_counter.clear(CLScheduler::get().queue());
_l1_stack.clear(CLScheduler::get().queue());
CLScheduler::get().enqueue(_edge_trace, true);
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLConvolution.cpp b/src/runtime/CL/functions/CLConvolution.cpp
index 0131801679..2f43ce1974 100644
--- a/src/runtime/CL/functions/CLConvolution.cpp
+++ b/src/runtime/CL/functions/CLConvolution.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -96,12 +96,10 @@ void CLConvolutionSquare<matrix_size>::run()
if(_is_separable)
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_kernel_hor, false);
CLScheduler::get().enqueue(_kernel_vert);
-
- _memory_group.release();
}
else
{
diff --git a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
index 15cbfcedfb..65d3f5ffe4 100644
--- a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
@@ -179,7 +179,7 @@ void CLDepthwiseConvolutionLayer3x3::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_needs_permute)
{
@@ -192,8 +192,6 @@ void CLDepthwiseConvolutionLayer3x3::run()
{
_permute_output_to_nhwc.run();
}
-
- _memory_group.release();
}
void CLDepthwiseConvolutionLayer3x3::prepare()
diff --git a/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp b/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
index ee76248e35..721054dcf3 100644
--- a/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLDirectDeconvolutionLayer.cpp
@@ -170,12 +170,10 @@ void CLDirectDeconvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_scale_f.run();
_conv_f.run();
-
- _memory_group.release();
}
void CLDirectDeconvolutionLayer::prepare()
diff --git a/src/runtime/CL/functions/CLFFT1D.cpp b/src/runtime/CL/functions/CLFFT1D.cpp
index 6b6735ae58..d893cd3d1b 100644
--- a/src/runtime/CL/functions/CLFFT1D.cpp
+++ b/src/runtime/CL/functions/CLFFT1D.cpp
@@ -105,7 +105,7 @@ Status CLFFT1D::validate(const ITensorInfo *input, const ITensorInfo *output, co
void CLFFT1D::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_digit_reverse_kernel, false);
@@ -113,7 +113,5 @@ void CLFFT1D::run()
{
CLScheduler::get().enqueue(_fft_kernels[i], i == (_num_ffts - 1));
}
-
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLFastCorners.cpp b/src/runtime/CL/functions/CLFastCorners.cpp
index d6cda91cea..fe2a18cd30 100644
--- a/src/runtime/CL/functions/CLFastCorners.cpp
+++ b/src/runtime/CL/functions/CLFastCorners.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -97,7 +97,7 @@ void CLFastCorners::run()
{
cl::CommandQueue q = CLScheduler::get().queue();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_non_max)
{
@@ -129,6 +129,4 @@ void CLFastCorners::run()
}
q.flush();
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLFullyConnectedLayer.cpp b/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
index 6a2aac6457..add5e16498 100644
--- a/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
+++ b/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -333,7 +333,7 @@ void CLFullyConnectedLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Linearize input if it comes from a convolutional layer
if(_is_fc_after_conv)
@@ -363,8 +363,6 @@ void CLFullyConnectedLayer::run()
CLScheduler::get().enqueue(_accumulate_biases_kernel);
}
}
-
- _memory_group.release();
}
void CLFullyConnectedLayer::prepare()
diff --git a/src/runtime/CL/functions/CLGEMM.cpp b/src/runtime/CL/functions/CLGEMM.cpp
index e91038f9a2..2ac6f815a4 100644
--- a/src/runtime/CL/functions/CLGEMM.cpp
+++ b/src/runtime/CL/functions/CLGEMM.cpp
@@ -352,7 +352,7 @@ void CLGEMM::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_is_interleaved_transposed)
{
@@ -381,8 +381,6 @@ void CLGEMM::run()
{
CLScheduler::get().enqueue(_ma_kernel);
}
-
- _memory_group.release();
}
void CLGEMM::prepare()
diff --git a/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp b/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp
index 8f7a62157f..40ce6b4e0f 100644
--- a/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp
@@ -526,7 +526,7 @@ void CLGEMMConvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run im2col
if(!_skip_im2col)
@@ -562,8 +562,6 @@ void CLGEMMConvolutionLayer::run()
{
_activationlayer_function.run();
}
-
- _memory_group.release();
}
void CLGEMMConvolutionLayer::prepare()
diff --git a/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp b/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp
index b2545228c4..c0bd85dcb5 100644
--- a/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp
+++ b/src/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.cpp
@@ -350,7 +350,7 @@ void CLGEMMLowpMatrixMultiplyCore::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_is_gemm_reshaped)
{
@@ -396,8 +396,6 @@ void CLGEMMLowpMatrixMultiplyCore::run()
// Run offset contribution kernel
CLScheduler::get().enqueue(_offset_contribution_kernel, true);
}
-
- _memory_group.release();
}
void CLGEMMLowpMatrixMultiplyCore::prepare()
diff --git a/src/runtime/CL/functions/CLGaussian5x5.cpp b/src/runtime/CL/functions/CLGaussian5x5.cpp
index f30eee1df7..ea803e4796 100644
--- a/src/runtime/CL/functions/CLGaussian5x5.cpp
+++ b/src/runtime/CL/functions/CLGaussian5x5.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -62,10 +62,8 @@ void CLGaussian5x5::run()
{
CLScheduler::get().enqueue(_border_handler, false);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_kernel_hor, false);
CLScheduler::get().enqueue(_kernel_vert);
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLGenerateProposalsLayer.cpp b/src/runtime/CL/functions/CLGenerateProposalsLayer.cpp
index c50132ea04..d712a23325 100644
--- a/src/runtime/CL/functions/CLGenerateProposalsLayer.cpp
+++ b/src/runtime/CL/functions/CLGenerateProposalsLayer.cpp
@@ -256,7 +256,7 @@ void CLGenerateProposalsLayer::run_cpp_nms_kernel()
void CLGenerateProposalsLayer::run()
{
// Acquire all the temporaries
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Compute all the anchors
CLScheduler::get().enqueue(_compute_anchors_kernel, false);
@@ -277,8 +277,5 @@ void CLGenerateProposalsLayer::run()
// Add dummy batch indexes
CLScheduler::get().enqueue(_memset_kernel, true);
CLScheduler::get().enqueue(_padded_copy_kernel, true);
-
- // Release all the temporaries
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLHOGDescriptor.cpp b/src/runtime/CL/functions/CLHOGDescriptor.cpp
index 1470d5cdc1..09314439a8 100644
--- a/src/runtime/CL/functions/CLHOGDescriptor.cpp
+++ b/src/runtime/CL/functions/CLHOGDescriptor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -95,7 +95,7 @@ void CLHOGDescriptor::configure(ICLTensor *input, ICLTensor *output, const IHOG
void CLHOGDescriptor::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run gradient
_gradient.run();
@@ -105,6 +105,4 @@ void CLHOGDescriptor::run()
// Run block normalization
CLScheduler::get().enqueue(_block_norm);
-
- _memory_group.release();
} \ No newline at end of file
diff --git a/src/runtime/CL/functions/CLHOGGradient.cpp b/src/runtime/CL/functions/CLHOGGradient.cpp
index 51aeaed5cf..e509fd8e36 100644
--- a/src/runtime/CL/functions/CLHOGGradient.cpp
+++ b/src/runtime/CL/functions/CLHOGGradient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -71,13 +71,11 @@ void CLHOGGradient::configure(ICLTensor *input, ICLTensor *output_magnitude, ICL
void CLHOGGradient::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run derivative
_derivative.run();
// Run magnitude/phase kernel
CLScheduler::get().enqueue(_mag_phase);
-
- _memory_group.release();
} \ No newline at end of file
diff --git a/src/runtime/CL/functions/CLHOGMultiDetection.cpp b/src/runtime/CL/functions/CLHOGMultiDetection.cpp
index 8012c2f60a..0865f50fd5 100644
--- a/src/runtime/CL/functions/CLHOGMultiDetection.cpp
+++ b/src/runtime/CL/functions/CLHOGMultiDetection.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -231,7 +231,7 @@ void CLHOGMultiDetection::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_detection_windows == nullptr, "Unconfigured function");
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Reset detection window
_detection_windows->clear();
@@ -265,6 +265,4 @@ void CLHOGMultiDetection::run()
Scheduler::get().schedule(_non_maxima_kernel.get(), Window::DimY);
_detection_windows->unmap(CLScheduler::get().queue());
}
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLHarrisCorners.cpp b/src/runtime/CL/functions/CLHarrisCorners.cpp
index 65ce7de490..342d1cad49 100644
--- a/src/runtime/CL/functions/CLHarrisCorners.cpp
+++ b/src/runtime/CL/functions/CLHarrisCorners.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -159,7 +159,7 @@ void CLHarrisCorners::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function");
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Init to 0 number of corner candidates
_num_corner_candidates = 0;
@@ -185,6 +185,4 @@ void CLHarrisCorners::run()
_corners->map(CLScheduler::get().queue(), true);
Scheduler::get().schedule(&_sort_euclidean, Window::DimY);
_corners->unmap(CLScheduler::get().queue());
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLL2NormalizeLayer.cpp b/src/runtime/CL/functions/CLL2NormalizeLayer.cpp
index 2e3c6d7763..136cb5edef 100644
--- a/src/runtime/CL/functions/CLL2NormalizeLayer.cpp
+++ b/src/runtime/CL/functions/CLL2NormalizeLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -74,11 +74,9 @@ Status CLL2NormalizeLayer::validate(const ITensorInfo *input, const ITensorInfo
void CLL2NormalizeLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_reduce_func.run();
CLScheduler::get().enqueue(_normalize_kernel, true);
-
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLLSTMLayer.cpp b/src/runtime/CL/functions/CLLSTMLayer.cpp
index 13c4871148..4606a66bf2 100644
--- a/src/runtime/CL/functions/CLLSTMLayer.cpp
+++ b/src/runtime/CL/functions/CLLSTMLayer.cpp
@@ -505,7 +505,7 @@ void CLLSTMLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_concat_inputs_forget_gate);
@@ -574,8 +574,6 @@ void CLLSTMLayer::run()
CLScheduler::get().enqueue(_copy_output);
_concat_scratch_buffer.run();
-
- _memory_group.release();
}
void CLLSTMLayer::prepare()
diff --git a/src/runtime/CL/functions/CLLocallyConnectedLayer.cpp b/src/runtime/CL/functions/CLLocallyConnectedLayer.cpp
index 5c6bef995f..3e99dde253 100644
--- a/src/runtime/CL/functions/CLLocallyConnectedLayer.cpp
+++ b/src/runtime/CL/functions/CLLocallyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -176,7 +176,7 @@ void CLLocallyConnectedLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run input reshaping
CLScheduler::get().enqueue(_input_im2col_kernel);
@@ -186,8 +186,6 @@ void CLLocallyConnectedLayer::run()
// Reshape output matrix
CLScheduler::get().enqueue(_output_col2im_kernel, false);
-
- _memory_group.release();
}
void CLLocallyConnectedLayer::prepare()
diff --git a/src/runtime/CL/functions/CLMeanStdDev.cpp b/src/runtime/CL/functions/CLMeanStdDev.cpp
index 157f306d0c..8517b59e7a 100644
--- a/src/runtime/CL/functions/CLMeanStdDev.cpp
+++ b/src/runtime/CL/functions/CLMeanStdDev.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -104,7 +104,7 @@ void CLMeanStdDev::configure(ICLImage *input, float *mean, float *stddev)
template <typename T>
void CLMeanStdDev::run_float()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Perform reduction on x-axis
_reduction_operation_mean.run();
@@ -140,8 +140,6 @@ void CLMeanStdDev::run_float()
_reduction_output_stddev.unmap();
}
_reduction_output_mean.unmap();
-
- _memory_group.release();
}
void CLMeanStdDev::run_int()
diff --git a/src/runtime/CL/functions/CLOpticalFlow.cpp b/src/runtime/CL/functions/CLOpticalFlow.cpp
index d00b1b5099..7ef1c83d04 100644
--- a/src/runtime/CL/functions/CLOpticalFlow.cpp
+++ b/src/runtime/CL/functions/CLOpticalFlow.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -149,7 +149,7 @@ void CLOpticalFlow::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_num_levels == 0, "Unconfigured function");
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
for(unsigned int level = _num_levels; level > 0; --level)
{
@@ -167,6 +167,4 @@ void CLOpticalFlow::run()
}
CLScheduler::get().enqueue(_tracker_finalize_kernel, true);
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLRNNLayer.cpp b/src/runtime/CL/functions/CLRNNLayer.cpp
index 63f00ac8ef..19eb69ffc8 100644
--- a/src/runtime/CL/functions/CLRNNLayer.cpp
+++ b/src/runtime/CL/functions/CLRNNLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -105,7 +105,7 @@ void CLRNNLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_fully_connected_kernel.run();
_gemm_state_f.run();
@@ -114,8 +114,6 @@ void CLRNNLayer::run()
// copy hidden out to output
CLScheduler::get().enqueue(_copy_kernel);
-
- _memory_group.release();
}
void CLRNNLayer::prepare()
diff --git a/src/runtime/CL/functions/CLReduceMean.cpp b/src/runtime/CL/functions/CLReduceMean.cpp
index b2d0f81f50..702ce34a4d 100644
--- a/src/runtime/CL/functions/CLReduceMean.cpp
+++ b/src/runtime/CL/functions/CLReduceMean.cpp
@@ -140,7 +140,7 @@ Status CLReduceMean::validate(const ITensorInfo *input, const Coordinates &reduc
void CLReduceMean::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
for(unsigned int i = 0; i < _reduction_ops; ++i)
{
@@ -151,6 +151,5 @@ void CLReduceMean::run()
{
_reshape.run();
}
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLReductionOperation.cpp b/src/runtime/CL/functions/CLReductionOperation.cpp
index 3d82e3f0d9..bb285d7cc8 100644
--- a/src/runtime/CL/functions/CLReductionOperation.cpp
+++ b/src/runtime/CL/functions/CLReductionOperation.cpp
@@ -206,7 +206,7 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign
void CLReductionOperation::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_is_serial)
{
@@ -220,6 +220,4 @@ void CLReductionOperation::run()
CLScheduler::get().enqueue(_reduction_kernels_vector[i], false);
}
}
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLSobel5x5.cpp b/src/runtime/CL/functions/CLSobel5x5.cpp
index d4bc85524e..22fbef17eb 100644
--- a/src/runtime/CL/functions/CLSobel5x5.cpp
+++ b/src/runtime/CL/functions/CLSobel5x5.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -81,10 +81,8 @@ void CLSobel5x5::run()
{
CLScheduler::get().enqueue(_border_handler, false);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_sobel_hor, false);
CLScheduler::get().enqueue(_sobel_vert);
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLSobel7x7.cpp b/src/runtime/CL/functions/CLSobel7x7.cpp
index 60830905df..9b38f6928f 100644
--- a/src/runtime/CL/functions/CLSobel7x7.cpp
+++ b/src/runtime/CL/functions/CLSobel7x7.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -81,10 +81,8 @@ void CLSobel7x7::run()
{
CLScheduler::get().enqueue(_border_handler, false);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
CLScheduler::get().enqueue(_sobel_hor, false);
CLScheduler::get().enqueue(_sobel_vert);
-
- _memory_group.release();
}
diff --git a/src/runtime/CL/functions/CLSoftmaxLayer.cpp b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
index d6718467d5..7e41dba8ab 100644
--- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp
+++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -191,7 +191,7 @@ Status CLSoftmaxLayer::validate(const ITensorInfo *input, const ITensorInfo *out
void CLSoftmaxLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_needs_flattening)
{
@@ -205,9 +205,6 @@ void CLSoftmaxLayer::run()
{
CLScheduler::get().enqueue(_reshape_kernel, true);
}
-
- // Relase intermediate buffers
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp b/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp
index 52973bac78..d3c3f9803e 100644
--- a/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp
@@ -204,7 +204,7 @@ void CLWinogradConvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run input transform
_input_transform.run();
@@ -214,8 +214,6 @@ void CLWinogradConvolutionLayer::run()
// Run output transform
CLScheduler::get().enqueue(_output_transform);
-
- _memory_group.release();
}
void CLWinogradConvolutionLayer::prepare()