aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLHOGMultiDetection.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-15 19:06:47 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit8a94e7cec7b09a417a278425e2b56e7af5bf45d9 (patch)
treee952f39903d4624bbd6445c9cc6c7dbcc1114026 /src/runtime/CL/functions/CLHOGMultiDetection.cpp
parent658039bc4e06be34272eccf559a516a6b52f75f5 (diff)
downloadComputeLibrary-8a94e7cec7b09a417a278425e2b56e7af5bf45d9.tar.gz
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 <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLHOGMultiDetection.cpp')
-rw-r--r--src/runtime/CL/functions/CLHOGMultiDetection.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/runtime/CL/functions/CLHOGMultiDetection.cpp b/src/runtime/CL/functions/CLHOGMultiDetection.cpp
index 9eed355710..8012c2f60a 100644
--- a/src/runtime/CL/functions/CLHOGMultiDetection.cpp
+++ b/src/runtime/CL/functions/CLHOGMultiDetection.cpp
@@ -34,8 +34,9 @@
using namespace arm_compute;
-CLHOGMultiDetection::CLHOGMultiDetection() // NOLINT
- : _gradient_kernel(),
+CLHOGMultiDetection::CLHOGMultiDetection(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT
+ : _memory_group(std::move(memory_manager)),
+ _gradient_kernel(),
_orient_bin_kernel(),
_block_norm_kernel(),
_hog_detect_kernel(),
@@ -141,6 +142,10 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h
TensorInfo info_phase(shape_img, Format::U8);
_phase.allocator()->init(info_phase);
+ // Manage intermediate buffers
+ _memory_group.manage(&_mag);
+ _memory_group.manage(&_phase);
+
// Initialise gradient kernel
_gradient_kernel.configure(input, &_mag, &_phase, phase_type, border_mode, constant_border_value);
@@ -166,10 +171,17 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h
TensorInfo info_space(shape_hog_space, num_bins, DataType::F32);
_hog_space[i].allocator()->init(info_space);
+ // Manage intermediate buffers
+ _memory_group.manage(_hog_space.get() + i);
+
// Initialise orientation binning kernel
_orient_bin_kernel[i].configure(&_mag, &_phase, _hog_space.get() + i, multi_hog->model(idx_multi_hog)->info());
}
+ // Allocate intermediate tensors
+ _mag.allocator()->allocate();
+ _phase.allocator()->allocate();
+
// Configure CLTensor for the normalized HOG space and block normalization kernel
for(size_t i = 0; i < _num_block_norm_kernel; ++i)
{
@@ -180,10 +192,19 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h
TensorInfo tensor_info(*(multi_hog->model(idx_multi_hog)->info()), width, height);
_hog_norm_space[i].allocator()->init(tensor_info);
+ // Manage intermediate buffers
+ _memory_group.manage(_hog_norm_space.get() + i);
+
// Initialize block normalization kernel
_block_norm_kernel[i].configure(_hog_space.get() + idx_orient_bin, _hog_norm_space.get() + i, multi_hog->model(idx_multi_hog)->info());
}
+ // Allocate intermediate tensors
+ for(size_t i = 0; i < _num_orient_bin_kernel; ++i)
+ {
+ _hog_space[i].allocator()->allocate();
+ }
+
detection_window_strides->map(CLScheduler::get().queue(), true);
// Configure HOG detector kernel
@@ -200,14 +221,6 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h
_non_maxima_kernel->configure(_detection_windows, min_distance);
// Allocate intermediate tensors
- _mag.allocator()->allocate();
- _phase.allocator()->allocate();
-
- for(size_t i = 0; i < _num_orient_bin_kernel; ++i)
- {
- _hog_space[i].allocator()->allocate();
- }
-
for(size_t i = 0; i < _num_block_norm_kernel; ++i)
{
_hog_norm_space[i].allocator()->allocate();
@@ -218,6 +231,8 @@ void CLHOGMultiDetection::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_detection_windows == nullptr, "Unconfigured function");
+ _memory_group.acquire();
+
// Reset detection window
_detection_windows->clear();
@@ -250,4 +265,6 @@ void CLHOGMultiDetection::run()
Scheduler::get().schedule(_non_maxima_kernel.get(), Window::DimY);
_detection_windows->unmap(CLScheduler::get().queue());
}
+
+ _memory_group.release();
}