From 8a94e7cec7b09a417a278425e2b56e7af5bf45d9 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 15 Sep 2017 19:06:47 +0100 Subject: COMPMID-534: Add MemoryManager support in OpenCL functions Adds support for: -CLConvolution -CLGEMM -CLGEMMLowp -CLHOGDescriptor -CLHOGGradient -CLHOGMultiDetection -CLL2Normalize -CLLocallyConnectedLayer -CLOpticalFlow -CLReductionOperation Change-Id: Ib13354d274ccf32ae933f3fbbad3ac3896cfd3bd Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87938 Tested-by: Kaizen Reviewed-by: Pablo Tello --- src/runtime/CL/functions/CLReductionOperation.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/runtime/CL/functions/CLReductionOperation.cpp') diff --git a/src/runtime/CL/functions/CLReductionOperation.cpp b/src/runtime/CL/functions/CLReductionOperation.cpp index 5bb33205ca..6643c9bd46 100644 --- a/src/runtime/CL/functions/CLReductionOperation.cpp +++ b/src/runtime/CL/functions/CLReductionOperation.cpp @@ -35,8 +35,8 @@ using namespace arm_compute; -CLReductionOperation::CLReductionOperation() - : _sums_vector(), _reduction_kernels_vector(), _border_handlers_vector(), _num_of_stages() +CLReductionOperation::CLReductionOperation(std::shared_ptr memory_manager) + : _memory_group(std::move(memory_manager)), _sums_vector(), _reduction_kernels_vector(), _border_handlers_vector(), _num_of_stages() { } @@ -59,6 +59,7 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign shape.set(0, ceil(shape.x() / 128.f)); auto *tensor = new CLTensor; tensor->allocator()->init(TensorInfo(shape, input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position())); + _memory_group.manage(tensor); _sums_vector.push_back(tensor); } @@ -76,9 +77,13 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign void CLReductionOperation::run() { + _memory_group.acquire(); + for(unsigned int i = 0; i < _num_of_stages; ++i) { CLScheduler::get().enqueue(_border_handlers_vector[i], false); CLScheduler::get().enqueue(_reduction_kernels_vector[i], false); } + + _memory_group.release(); } \ No newline at end of file -- cgit v1.2.1