aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-04-02 17:27:03 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-04-08 11:47:38 +0000
commitda953f2e17b401ff595ac88008cd5e90440ebf74 (patch)
treed27b1a731fdabea773bd97e7ce6808e32e5539d1
parent4335a8c163ada987dfc88f8be4575fb6b68d64d9 (diff)
downloadComputeLibrary-da953f2e17b401ff595ac88008cd5e90440ebf74.tar.gz
COMPMID-2098: Scope handling of memory group resources.
Change-Id: Ie945526bd7845301458039edf3129253c1808505 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-on: https://review.mlplatform.org/c/938 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/runtime/IMemoryGroup.h33
-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
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp4
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.cpp6
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCGEMM.cpp6
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.cpp4
-rw-r--r--src/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NEArgMinMaxLayer.cpp4
-rw-r--r--src/runtime/NEON/functions/NECannyEdge.cpp6
-rw-r--r--src/runtime/NEON/functions/NEConvolution.cpp6
-rw-r--r--src/runtime/NEON/functions/NEDeconvolutionLayer.cpp4
-rw-r--r--src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp4
-rw-r--r--src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp5
-rw-r--r--src/runtime/NEON/functions/NEFastCorners.cpp6
-rw-r--r--src/runtime/NEON/functions/NEFullyConnectedLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NEGEMM.cpp8
-rw-r--r--src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp3
-rw-r--r--src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp4
-rw-r--r--src/runtime/NEON/functions/NEGEMMLowpAssemblyMatrixMultiplyCore.cpp7
-rw-r--r--src/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.cpp4
-rw-r--r--src/runtime/NEON/functions/NEGaussian5x5.cpp6
-rw-r--r--src/runtime/NEON/functions/NEHOGDescriptor.cpp6
-rw-r--r--src/runtime/NEON/functions/NEHOGGradient.cpp6
-rw-r--r--src/runtime/NEON/functions/NEHOGMultiDetection.cpp6
-rw-r--r--src/runtime/NEON/functions/NEHarrisCorners.cpp6
-rw-r--r--src/runtime/NEON/functions/NEL2NormalizeLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NELSTMLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NELocallyConnectedLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NENormalizationLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NEOpticalFlow.cpp6
-rw-r--r--src/runtime/NEON/functions/NERNNLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NEReduceMean.cpp3
-rw-r--r--src/runtime/NEON/functions/NESobel5x5.cpp6
-rw-r--r--src/runtime/NEON/functions/NESobel7x7.cpp6
-rw-r--r--src/runtime/NEON/functions/NESoftmaxLayer.cpp4
-rw-r--r--src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.cpp4
-rw-r--r--src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp3
65 files changed, 138 insertions, 233 deletions
diff --git a/arm_compute/runtime/IMemoryGroup.h b/arm_compute/runtime/IMemoryGroup.h
index be03ea4a0..159e99aeb 100644
--- a/arm_compute/runtime/IMemoryGroup.h
+++ b/arm_compute/runtime/IMemoryGroup.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -41,5 +41,36 @@ public:
/** Gets the memory mapping of the group */
virtual MemoryMappings &mappings() = 0;
};
+
+/** Memory group resources scope handling class */
+class MemoryGroupResourceScope
+{
+public:
+ /** Constructor
+ *
+ * @param[in] memory_group Memory group to handle
+ */
+ explicit MemoryGroupResourceScope(IMemoryGroup &memory_group)
+ : _memory_group(memory_group)
+ {
+ _memory_group.acquire();
+ }
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ MemoryGroupResourceScope(const MemoryGroupResourceScope &) = delete;
+ /** Default move constructor */
+ MemoryGroupResourceScope(MemoryGroupResourceScope &&) = default;
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ MemoryGroupResourceScope &operator=(const MemoryGroupResourceScope &) = delete;
+ /** Default move assignment operator */
+ MemoryGroupResourceScope &operator=(MemoryGroupResourceScope &&) = default;
+ /** Destructor */
+ ~MemoryGroupResourceScope()
+ {
+ _memory_group.release();
+ }
+
+private:
+ IMemoryGroup &_memory_group;
+};
} // arm_compute
#endif /*__ARM_COMPUTE_IMEMORYGROUP_H__ */
diff --git a/src/runtime/CL/functions/CLCannyEdge.cpp b/src/runtime/CL/functions/CLCannyEdge.cpp
index 84e87092f..4c7458d1e 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 013180167..2f43ce197 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 15cbfcedf..65d3f5ffe 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 ee76248e3..721054dcf 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 6b6735ae5..d893cd3d1 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 d6cda91ce..fe2a18cd3 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 6a2aac645..add5e1649 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 e91038f9a..2ac6f815a 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 8f7a62157..40ce6b4e0 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 b2545228c..c0bd85dcb 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 f30eee1df..ea803e479 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 c50132ea0..d712a2332 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 1470d5cdc..09314439a 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 51aeaed5c..e509fd8e3 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 8012c2f60..0865f50fd 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 65ce7de49..342d1cad4 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 2e3c6d776..136cb5ede 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 13c487114..4606a66bf 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 5c6bef995..3e99dde25 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 157f306d0..8517b59e7 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 d00b1b509..7ef1c83d0 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 63f00ac8e..19eb69ffc 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 b2d0f81f5..702ce34a4 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 3d82e3f0d..bb285d7cc 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 d4bc85524..22fbef17e 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 60830905d..9b38f6928 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 d6718467d..7e41dba8a 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 52973bac7..d3c3f9803 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()
diff --git a/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp
index a35a18a3d..61c074093 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.cpp
@@ -201,7 +201,7 @@ void GCConvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run im2col
GCScheduler::get().dispatch(_fill_border);
@@ -216,8 +216,6 @@ void GCConvolutionLayer::run()
GCScheduler::get().dispatch(_output_col2im_kernel, false);
GCScheduler::get().memory_barrier();
- _memory_group.release();
-
// Run Activation Layer
if(_is_activationlayer_enabled)
{
diff --git a/src/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.cpp
index 6b8e341b1..a208545a9 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -150,7 +150,7 @@ void GCFullyConnectedLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Linearize input if it comes from a convolutional layer
if(_is_fc_after_conv)
@@ -173,8 +173,6 @@ void GCFullyConnectedLayer::run()
GCScheduler::get().dispatch(_accumulate_biases_kernel);
}
-
- _memory_group.release();
}
void GCFullyConnectedLayer::prepare()
diff --git a/src/runtime/GLES_COMPUTE/functions/GCGEMM.cpp b/src/runtime/GLES_COMPUTE/functions/GCGEMM.cpp
index 8ae91ee82..ddfe590ee 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCGEMM.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCGEMM.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -162,7 +162,7 @@ void GCGEMM::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_is_interleaved_transposed)
{
@@ -187,8 +187,6 @@ void GCGEMM::run()
GCScheduler::get().memory_barrier();
GCScheduler::get().dispatch(_ma_kernel);
}
-
- _memory_group.release();
}
void GCGEMM::prepare()
diff --git a/src/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.cpp
index 2569365dc..8f602792a 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.cpp
@@ -56,13 +56,11 @@ void GCNormalizationLayer::configure(const IGCTensor *input, IGCTensor *output,
void GCNormalizationLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
GCScheduler::get().dispatch(_multiply_kernel, false);
GCScheduler::get().memory_barrier();
GCScheduler::get().dispatch(_border_handler, false);
GCScheduler::get().memory_barrier();
GCScheduler::get().dispatch(_norm_kernel, true);
-
- _memory_group.release();
}
diff --git a/src/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.cpp
index dad42cd7e..0645ae7f8 100644
--- a/src/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.cpp
+++ b/src/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -69,13 +69,11 @@ void GCSoftmaxLayer::configure(const IGCTensor *input, IGCTensor *output, float
void GCSoftmaxLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
GCScheduler::get().dispatch(_max_kernel, false);
GCScheduler::get().memory_barrier();
GCScheduler::get().dispatch(_shift_exp_sum_kernel, false);
GCScheduler::get().memory_barrier();
GCScheduler::get().dispatch(_norm_kernel);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEArgMinMaxLayer.cpp b/src/runtime/NEON/functions/NEArgMinMaxLayer.cpp
index d33e1342b..6863bb0b3 100644
--- a/src/runtime/NEON/functions/NEArgMinMaxLayer.cpp
+++ b/src/runtime/NEON/functions/NEArgMinMaxLayer.cpp
@@ -57,15 +57,13 @@ Status NEArgMinMaxLayer::validate(const ITensorInfo *input, int axis, const ITen
void NEArgMinMaxLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_run_fill_border)
{
NEScheduler::get().schedule(&_fill_border_kernel, Window::DimY);
}
NEScheduler::get().schedule(&_reduction_kernel, Window::DimY);
-
- _memory_group.release();
}
} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/NEON/functions/NECannyEdge.cpp b/src/runtime/NEON/functions/NECannyEdge.cpp
index 0e5d50fd2..032e617b1 100644
--- a/src/runtime/NEON/functions/NECannyEdge.cpp
+++ b/src/runtime/NEON/functions/NECannyEdge.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -162,7 +162,7 @@ void NECannyEdge::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function");
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run sobelNxN
_sobel->run();
@@ -184,6 +184,4 @@ void NECannyEdge::run()
// Run edge tracing
NEScheduler::get().schedule(&_edge_trace, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEConvolution.cpp b/src/runtime/NEON/functions/NEConvolution.cpp
index b84dfd344..973855e12 100644
--- a/src/runtime/NEON/functions/NEConvolution.cpp
+++ b/src/runtime/NEON/functions/NEConvolution.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -103,12 +103,10 @@ void NEConvolutionSquare<matrix_size>::run()
if(_is_separable)
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_kernel_hor, Window::DimY);
NEScheduler::get().schedule(&_kernel_vert, Window::DimY);
-
- _memory_group.release();
}
else
{
diff --git a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
index 44d7197a6..fdc959c4a 100644
--- a/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEDeconvolutionLayer.cpp
@@ -159,12 +159,10 @@ void NEDeconvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_upsample_f.run();
_conv_f.run();
-
- _memory_group.release();
}
void NEDeconvolutionLayer::prepare()
diff --git a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
index 5db94a67c..4f632a20a 100644
--- a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
@@ -296,7 +296,7 @@ void NEDepthwiseConvolutionLayer3x3::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Permute input
if(_permute)
@@ -311,8 +311,6 @@ void NEDepthwiseConvolutionLayer3x3::run()
{
_activationlayer_function.run();
}
-
- _memory_group.release();
}
void NEDepthwiseConvolutionLayer3x3::prepare()
diff --git a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp
index 40e40c8ff..322bb2c42 100644
--- a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -105,7 +105,7 @@ void NEDirectConvolutionLayer::run()
{
NEScheduler::get().schedule(&_input_border_handler, Window::DimZ);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_conv_kernel, _dim_split);
if(_has_bias)
@@ -117,5 +117,4 @@ void NEDirectConvolutionLayer::run()
{
_activationlayer_function.run();
}
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEFastCorners.cpp b/src/runtime/NEON/functions/NEFastCorners.cpp
index 4137b1d13..af3530151 100644
--- a/src/runtime/NEON/functions/NEFastCorners.cpp
+++ b/src/runtime/NEON/functions/NEFastCorners.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -93,7 +93,7 @@ void NEFastCorners::run()
{
NEScheduler::get().schedule(&_border_handler, Window::DimZ);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_fast_corners_kernel, Window::DimY);
@@ -103,6 +103,4 @@ void NEFastCorners::run()
}
NEScheduler::get().schedule(&_fill_kernel, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp b/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp
index 45e21b53d..273da278e 100644
--- a/src/runtime/NEON/functions/NEFullyConnectedLayer.cpp
+++ b/src/runtime/NEON/functions/NEFullyConnectedLayer.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 NEFullyConnectedLayer::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 NEFullyConnectedLayer::run()
NEScheduler::get().schedule(&_accumulate_biases_kernel, Window::DimY);
}
}
-
- _memory_group.release();
}
void NEFullyConnectedLayer::prepare()
diff --git a/src/runtime/NEON/functions/NEGEMM.cpp b/src/runtime/NEON/functions/NEGEMM.cpp
index 914f088bf..55bcc45d1 100644
--- a/src/runtime/NEON/functions/NEGEMM.cpp
+++ b/src/runtime/NEON/functions/NEGEMM.cpp
@@ -238,16 +238,14 @@ void NEGEMM::run()
{
prepare();
+ MemoryGroupResourceScope scope_mg(_memory_group);
+
if(_asm_glue.is_configured())
{
- _memory_group.acquire();
_asm_glue.run();
- _memory_group.release();
}
else
{
- _memory_group.acquire();
-
if(!_run_vector_matrix_multiplication)
{
// Run interleave kernel
@@ -262,8 +260,6 @@ void NEGEMM::run()
NEScheduler::get().schedule(&_mm_kernel, _run_vector_matrix_multiplication ? Window::DimX : Window::DimY);
- _memory_group.release();
-
// Run matrix addition kernel
if(_run_addition)
{
diff --git a/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp b/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp
index 470e9220a..fe1f2da45 100644
--- a/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp
+++ b/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp
@@ -375,7 +375,7 @@ bool NEGEMMAssemblyDispatch::is_configured() const
void NEGEMMAssemblyDispatch::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_function != nullptr)
{
_function->run();
@@ -385,6 +385,5 @@ void NEGEMMAssemblyDispatch::run()
ARM_COMPUTE_ERROR_ON(_arm_gemm == nullptr);
_arm_gemm->run();
}
- _memory_group.release();
}
} //namespace arm_compute
diff --git a/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp b/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp
index b6c37349c..beac4ffe5 100644
--- a/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp
@@ -546,7 +546,7 @@ void NEGEMMConvolutionLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(!_skip_im2col)
{
@@ -589,8 +589,6 @@ void NEGEMMConvolutionLayer::run()
{
_activationlayer_function.run();
}
-
- _memory_group.release();
}
void NEGEMMConvolutionLayer::prepare()
diff --git a/src/runtime/NEON/functions/NEGEMMLowpAssemblyMatrixMultiplyCore.cpp b/src/runtime/NEON/functions/NEGEMMLowpAssemblyMatrixMultiplyCore.cpp
index 47c33587a..ede89bf55 100644
--- a/src/runtime/NEON/functions/NEGEMMLowpAssemblyMatrixMultiplyCore.cpp
+++ b/src/runtime/NEON/functions/NEGEMMLowpAssemblyMatrixMultiplyCore.cpp
@@ -1,4 +1,5 @@
-/* Copyright (c) 2017-2018 ARM Limited.
+/*
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -116,7 +117,7 @@ void NEGEMMLowpAssemblyMatrixMultiplyCore::configure(const ITensor *a, const ITe
void NEGEMMLowpAssemblyMatrixMultiplyCore::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_mtx_a_reshape_kernel)
{
NEScheduler::get().schedule(_mtx_a_reshape_kernel.get(), Window::DimY);
@@ -135,6 +136,4 @@ void NEGEMMLowpAssemblyMatrixMultiplyCore::run()
{
NEScheduler::get().schedule(_mm_kernel.get(), Window::DimY);
}
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.cpp b/src/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.cpp
index 0247a3942..5ce7bc5f2 100644
--- a/src/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.cpp
+++ b/src/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.cpp
@@ -340,7 +340,7 @@ void NEGEMMLowpMatrixMultiplyCore::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Reshape inputs
if(_mtx_a_reshape_kernel)
@@ -384,8 +384,6 @@ void NEGEMMLowpMatrixMultiplyCore::run()
// Run offset contribution kernel
NEScheduler::get().schedule(&_offset_contribution_kernel, Window::DimY);
}
-
- _memory_group.release();
}
void NEGEMMLowpMatrixMultiplyCore::prepare()
diff --git a/src/runtime/NEON/functions/NEGaussian5x5.cpp b/src/runtime/NEON/functions/NEGaussian5x5.cpp
index b010ca010..3c7411e2d 100644
--- a/src/runtime/NEON/functions/NEGaussian5x5.cpp
+++ b/src/runtime/NEON/functions/NEGaussian5x5.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -59,10 +59,8 @@ void NEGaussian5x5::run()
{
NEScheduler::get().schedule(&_border_handler, Window::DimZ);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_kernel_hor, Window::DimY);
NEScheduler::get().schedule(&_kernel_vert, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEHOGDescriptor.cpp b/src/runtime/NEON/functions/NEHOGDescriptor.cpp
index 5e98269f4..8efc091d0 100644
--- a/src/runtime/NEON/functions/NEHOGDescriptor.cpp
+++ b/src/runtime/NEON/functions/NEHOGDescriptor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -95,7 +95,7 @@ void NEHOGDescriptor::configure(ITensor *input, ITensor *output, const IHOG *hog
void NEHOGDescriptor::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run gradient
_gradient.run();
@@ -105,6 +105,4 @@ void NEHOGDescriptor::run()
// Run block normalization kernel
NEScheduler::get().schedule(&_block_norm, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEHOGGradient.cpp b/src/runtime/NEON/functions/NEHOGGradient.cpp
index efc8690ed..90785fe30 100644
--- a/src/runtime/NEON/functions/NEHOGGradient.cpp
+++ b/src/runtime/NEON/functions/NEHOGGradient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -80,13 +80,11 @@ void NEHOGGradient::configure(ITensor *input, ITensor *output_magnitude, ITensor
void NEHOGGradient::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run derivative
_derivative.run();
// Run magnitude/phase kernel
NEScheduler::get().schedule(_mag_phase.get(), Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEHOGMultiDetection.cpp b/src/runtime/NEON/functions/NEHOGMultiDetection.cpp
index 8c834e2a9..6a6d04573 100644
--- a/src/runtime/NEON/functions/NEHOGMultiDetection.cpp
+++ b/src/runtime/NEON/functions/NEHOGMultiDetection.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -225,7 +225,7 @@ void NEHOGMultiDetection::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();
@@ -256,6 +256,4 @@ void NEHOGMultiDetection::run()
{
NEScheduler::get().schedule(_non_maxima_kernel.get(), Window::DimY);
}
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEHarrisCorners.cpp b/src/runtime/NEON/functions/NEHarrisCorners.cpp
index db5e9265b..15cecc25a 100644
--- a/src/runtime/NEON/functions/NEHarrisCorners.cpp
+++ b/src/runtime/NEON/functions/NEHarrisCorners.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -184,7 +184,7 @@ void NEHarrisCorners::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;
@@ -207,6 +207,4 @@ void NEHarrisCorners::run()
// Run sort & euclidean distance
NEScheduler::get().schedule(&_sort_euclidean, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEL2NormalizeLayer.cpp b/src/runtime/NEON/functions/NEL2NormalizeLayer.cpp
index 56da966ab..c9ab5c98e 100644
--- a/src/runtime/NEON/functions/NEL2NormalizeLayer.cpp
+++ b/src/runtime/NEON/functions/NEL2NormalizeLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -68,11 +68,9 @@ Status NEL2NormalizeLayer::validate(const ITensorInfo *input, const ITensorInfo
void NEL2NormalizeLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_reduce_func.run();
NEScheduler::get().schedule(&_normalize_kernel, Window::DimY);
-
- _memory_group.release();
}
} // namespace arm_compute
diff --git a/src/runtime/NEON/functions/NELSTMLayer.cpp b/src/runtime/NEON/functions/NELSTMLayer.cpp
index a0adbb0f4..3d3c6a12f 100644
--- a/src/runtime/NEON/functions/NELSTMLayer.cpp
+++ b/src/runtime/NEON/functions/NELSTMLayer.cpp
@@ -92,7 +92,7 @@ void NELSTMLayer::configure(const ITensor *input,
scratch_buffer->info(), output_state_out->info(), cell_state_out->info(), output->info(),
lstm_params_info, activation_info, cell_threshold, projection_threshold));
- const TensorShape cell_state_shape = cell_state_in->info()->tensor_shape();
+ const TensorShape cell_state_shape = cell_state_in->info()->tensor_shape();
// Configure block that calculates the forget gate
// forget_gate = Activation(input * input_to_forget_weights + output_state_in * recurrent_to_forget_weights + PixelWiseMul(cell_state, cell_to_forget_weights) + forget_gate_bias)
@@ -493,7 +493,7 @@ void NELSTMLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_concat_inputs_forget_gate.run();
_fully_connected_forget_gate.run();
@@ -567,8 +567,6 @@ void NELSTMLayer::run()
NEScheduler::get().schedule(&_copy_output, Window::DimY);
_concat_scratch_buffer.run();
-
- _memory_group.release();
}
void NELSTMLayer::prepare()
diff --git a/src/runtime/NEON/functions/NELocallyConnectedLayer.cpp b/src/runtime/NEON/functions/NELocallyConnectedLayer.cpp
index 80a254117..d08202dd2 100644
--- a/src/runtime/NEON/functions/NELocallyConnectedLayer.cpp
+++ b/src/runtime/NEON/functions/NELocallyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -168,7 +168,7 @@ void NELocallyConnectedLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Run input reshaping
NEScheduler::get().schedule(&_input_im2col_kernel, Window::DimY);
@@ -178,8 +178,6 @@ void NELocallyConnectedLayer::run()
// Reshape output matrix
NEScheduler::get().schedule(&_output_col2im_kernel, Window::DimY);
-
- _memory_group.release();
}
void NELocallyConnectedLayer::prepare()
diff --git a/src/runtime/NEON/functions/NENormalizationLayer.cpp b/src/runtime/NEON/functions/NENormalizationLayer.cpp
index f00114f93..d52e92828 100644
--- a/src/runtime/NEON/functions/NENormalizationLayer.cpp
+++ b/src/runtime/NEON/functions/NENormalizationLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -69,11 +69,9 @@ Status NENormalizationLayer::validate(const ITensorInfo *input, const ITensorInf
void NENormalizationLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_multiply_kernel, Window::DimY);
NEScheduler::get().schedule(&_border_handler, Window::DimY);
NEScheduler::get().schedule(&_norm_kernel, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NEOpticalFlow.cpp b/src/runtime/NEON/functions/NEOpticalFlow.cpp
index e90d8f627..db77629ef 100644
--- a/src/runtime/NEON/functions/NEOpticalFlow.cpp
+++ b/src/runtime/NEON/functions/NEOpticalFlow.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -121,7 +121,7 @@ void NEOpticalFlow::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)
{
@@ -131,6 +131,4 @@ void NEOpticalFlow::run()
// Run Lucas-Kanade kernel
NEScheduler::get().schedule(_kernel_tracker.get() + level - 1, Window::DimX);
}
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NERNNLayer.cpp b/src/runtime/NEON/functions/NERNNLayer.cpp
index 995d5eed8..9ca7ded3b 100644
--- a/src/runtime/NEON/functions/NERNNLayer.cpp
+++ b/src/runtime/NEON/functions/NERNNLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -104,7 +104,7 @@ void NERNNLayer::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
_fully_connected_kernel.run();
@@ -115,8 +115,6 @@ void NERNNLayer::run()
// copy hidden out to output
NEScheduler::get().schedule(&_copy_kernel, Window::DimY);
-
- _memory_group.release();
}
void NERNNLayer::prepare()
diff --git a/src/runtime/NEON/functions/NEReduceMean.cpp b/src/runtime/NEON/functions/NEReduceMean.cpp
index 014895f02..98d3ab943 100644
--- a/src/runtime/NEON/functions/NEReduceMean.cpp
+++ b/src/runtime/NEON/functions/NEReduceMean.cpp
@@ -137,7 +137,7 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis,
void NEReduceMean::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
for(unsigned int i = 0; i < _reduction_ops; ++i)
{
@@ -148,5 +148,4 @@ void NEReduceMean::run()
{
_reshape.run();
}
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NESobel5x5.cpp b/src/runtime/NEON/functions/NESobel5x5.cpp
index d8f4eda2f..2ddfee502 100644
--- a/src/runtime/NEON/functions/NESobel5x5.cpp
+++ b/src/runtime/NEON/functions/NESobel5x5.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 NESobel5x5::run()
{
NEScheduler::get().schedule(&_border_handler, Window::DimZ);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_sobel_hor, Window::DimY);
NEScheduler::get().schedule(&_sobel_vert, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NESobel7x7.cpp b/src/runtime/NEON/functions/NESobel7x7.cpp
index 5b6f60b33..b47a37aed 100644
--- a/src/runtime/NEON/functions/NESobel7x7.cpp
+++ b/src/runtime/NEON/functions/NESobel7x7.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 NESobel7x7::run()
{
NEScheduler::get().schedule(&_border_handler, Window::DimZ);
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().schedule(&_sobel_hor, Window::DimY);
NEScheduler::get().schedule(&_sobel_vert, Window::DimY);
-
- _memory_group.release();
}
diff --git a/src/runtime/NEON/functions/NESoftmaxLayer.cpp b/src/runtime/NEON/functions/NESoftmaxLayer.cpp
index 36b7d47d2..79a94961d 100644
--- a/src/runtime/NEON/functions/NESoftmaxLayer.cpp
+++ b/src/runtime/NEON/functions/NESoftmaxLayer.cpp
@@ -180,7 +180,7 @@ Status NESoftmaxLayer::validate(const ITensorInfo *input, const ITensorInfo *out
void NESoftmaxLayer::run()
{
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(_needs_flattening)
{
@@ -195,7 +195,5 @@ void NESoftmaxLayer::run()
{
NEScheduler::get().schedule(&_reshape_kernel, Window::DimY);
}
-
- _memory_group.release();
}
} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp b/src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp
index e37f8abfa..1d9247116 100644
--- a/src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -513,7 +513,7 @@ void NEWinogradConvolutionLayer::run()
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
if(data_layout == DataLayout::NCHW)
{
@@ -539,8 +539,6 @@ void NEWinogradConvolutionLayer::run()
{
_activationlayer_function.run();
}
-
- _memory_group.release();
}
Status NEWinogradConvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
diff --git a/src/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.cpp b/src/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.cpp
index a64426500..d9b2bff81 100644
--- a/src/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.cpp
+++ b/src/runtime/NEON/functions/assembly/NEDepthwiseConvolutionAssemblyDispatch.cpp
@@ -299,7 +299,7 @@ void NEDepthwiseConvolutionAssemblyDispatch::run()
// Prepare assembly kernel
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
// Setup inputs/outputs
ARM_COMPUTE_ERROR_ON(_workspace.buffer() == nullptr);
@@ -323,8 +323,6 @@ void NEDepthwiseConvolutionAssemblyDispatch::run()
// Schedule assembly kernel
NEScheduler::get().schedule(&_dwc_acl_kernel, Window::DimX);
-
- _memory_group.release();
}
void NEDepthwiseConvolutionAssemblyDispatch::prepare()
diff --git a/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp b/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp
index 34aaea0ef..e207ab007 100644
--- a/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp
+++ b/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp
@@ -183,9 +183,8 @@ void NEGEMMInterleavedWrapper::run()
{
prepare();
- _memory_group.acquire();
+ MemoryGroupResourceScope scope_mg(_memory_group);
NEScheduler::get().run_tagged_workloads(_workloads, _tag.c_str());
- _memory_group.release();
}
void NEGEMMInterleavedWrapper::prepare()