From baf174e85ddb5399355281cd34d0f459d92124a7 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 8 Sep 2017 19:47:30 +0100 Subject: COMPMID-485: Memory Manager Change-Id: Ib421b7622838f050038cd81e7426bb1413a7d6e6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87376 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- src/runtime/CL/functions/CLSoftmaxLayer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/runtime/CL/functions/CLSoftmaxLayer.cpp') diff --git a/src/runtime/CL/functions/CLSoftmaxLayer.cpp b/src/runtime/CL/functions/CLSoftmaxLayer.cpp index 850eb2c6f8..7505a2c974 100644 --- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp +++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp @@ -25,12 +25,13 @@ #include "arm_compute/core/CL/kernels/CLSoftmaxLayerKernel.h" #include "arm_compute/core/Helpers.h" +#include "arm_compute/runtime/CL/CLMemoryGroup.h" #include "arm_compute/runtime/CL/CLScheduler.h" using namespace arm_compute; -CLSoftmaxLayer::CLSoftmaxLayer() - : _max_kernel(), _shift_exp_sum_kernel(), _norm_kernel(), _max(), _sum(), _tmp() +CLSoftmaxLayer::CLSoftmaxLayer(std::shared_ptr memory_manager) + : _memory_group(std::move(memory_manager)), _max_kernel(), _shift_exp_sum_kernel(), _norm_kernel(), _max(), _sum(), _tmp() { } @@ -47,6 +48,11 @@ void CLSoftmaxLayer::configure(const ICLTensor *input, ICLTensor *output) _max.allocator()->init(tensor_info_max_sum); _sum.allocator()->init(tensor_info_max_sum); + // Manage intermediate buffers + _memory_group.manage(&_tmp); + _memory_group.manage(&_max); + _memory_group.manage(&_sum); + // Configure Kernels _max_kernel.configure(input, &_max); _shift_exp_sum_kernel.configure(input, &_max, &_tmp, &_sum); @@ -60,7 +66,11 @@ void CLSoftmaxLayer::configure(const ICLTensor *input, ICLTensor *output) void CLSoftmaxLayer::run() { + _memory_group.acquire(); + CLScheduler::get().enqueue(_max_kernel, false); CLScheduler::get().enqueue(_shift_exp_sum_kernel, false); CLScheduler::get().enqueue(_norm_kernel); + + _memory_group.release(); } -- cgit v1.2.1