aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NECannyEdge.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-15 16:30:50 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit658039bc4e06be34272eccf559a516a6b52f75f5 (patch)
tree7ab17a9cb5dad7b18f7e3a67b731f2c462b1ac24 /src/runtime/NEON/functions/NECannyEdge.cpp
parent9e40cf7c21ed0136150101d6c930417d475ecff1 (diff)
downloadComputeLibrary-658039bc4e06be34272eccf559a516a6b52f75f5.tar.gz
COMPMID-534: Add MemoryManager support in NEON functions
Adds support for: -NECannyEdge -NEConvolution -NEDirectConvolution -NEGEMM -NEGEMMLowp -NEGaussian5x5 -NEHOGDescriptor -NEHOGGradient -NEL2Normalize -NELocallyConnectedLayer -NENormalizationLayer -NEScale -NESobel5x5 -NESobel7x7 Change-Id: I68e05aa6054372fa873a882633a15fb97882c00d Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87926 Reviewed-by: Pablo Tello <pablo.tello@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NECannyEdge.cpp')
-rw-r--r--src/runtime/NEON/functions/NECannyEdge.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/runtime/NEON/functions/NECannyEdge.cpp b/src/runtime/NEON/functions/NECannyEdge.cpp
index 318cea2342..9be1df6ea4 100644
--- a/src/runtime/NEON/functions/NECannyEdge.cpp
+++ b/src/runtime/NEON/functions/NECannyEdge.cpp
@@ -41,8 +41,9 @@
using namespace arm_compute;
-NECannyEdge::NECannyEdge() // NOLINT
- : _sobel(),
+NECannyEdge::NECannyEdge(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT
+ : _memory_group(std::move(memory_manager)),
+ _sobel(),
_gradient(),
_non_max_suppr(),
_edge_trace(),
@@ -93,6 +94,10 @@ void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr,
_phase.allocator()->init(info);
_nonmax.allocator()->init(info);
+ // Manage intermediate buffers
+ _memory_group.manage(&_gx);
+ _memory_group.manage(&_gy);
+
// Configure/Init sobelNxN
if(gradient_size == 3)
{
@@ -117,6 +122,10 @@ void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr,
ARM_COMPUTE_ERROR("Gradient size not supported\n");
}
+ // Manage intermediate buffers
+ _memory_group.manage(&_magnitude);
+ _memory_group.manage(&_phase);
+
// Configure gradient
if(use_fp16)
{
@@ -131,6 +140,13 @@ void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr,
_gradient = std::move(k);
}
+ // Allocate intermediate tensors
+ _gx.allocator()->allocate();
+ _gy.allocator()->allocate();
+
+ // Manage intermediate buffers
+ _memory_group.manage(&_nonmax);
+
// Configure non-maxima suppression
_non_max_suppr.configure(&_magnitude, &_phase, &_nonmax, upper_thr, lower_thr, border_mode == BorderMode::UNDEFINED);
@@ -138,6 +154,10 @@ void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr,
// it. If border mode is undefined filling the border is a nop.
_border_mag_gradient.configure(&_magnitude, _non_max_suppr.border_size(), border_mode, constant_border_value);
+ // Allocate intermediate tensors
+ _phase.allocator()->allocate();
+ _magnitude.allocator()->allocate();
+
// Configure edge tracing
_edge_trace.configure(&_nonmax, output);
@@ -145,10 +165,6 @@ void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr,
_border_edge_trace.configure(&_nonmax, _edge_trace.border_size(), BorderMode::CONSTANT, 0);
// Allocate intermediate tensors
- _gx.allocator()->allocate();
- _gy.allocator()->allocate();
- _phase.allocator()->allocate();
- _magnitude.allocator()->allocate();
_nonmax.allocator()->allocate();
}
@@ -157,6 +173,8 @@ void NECannyEdge::run()
ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function");
ARM_COMPUTE_ERROR_ON(_output == nullptr);
+ _memory_group.acquire();
+
// Run sobelNxN
_sobel->run();
@@ -177,4 +195,6 @@ void NECannyEdge::run()
// Run edge tracing
NEScheduler::get().schedule(&_edge_trace, Window::DimY);
+
+ _memory_group.release();
}