From bef7fa27b0d231a8649952f60808132d109b6345 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Wed, 21 Oct 2020 15:58:54 +0100 Subject: COMPMID-3639: (3RDPARTY_UPDATE) Move CL kernels to src Change-Id: I10d27db788e5086adae1841e3e2441cd9b76ef84 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4310 Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/runtime/CL/functions/CLSoftmaxLayer.cpp | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 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 759c8706a1..4caf91488e 100644 --- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp +++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp @@ -24,24 +24,38 @@ #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" #include "arm_compute/core/CL/CLHelpers.h" -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/core/CL/kernels/CLSoftmaxLayerKernel.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" #include "arm_compute/core/Utils.h" #include "arm_compute/core/utils/misc/ShapeCalculator.h" #include "arm_compute/runtime/CL/CLScheduler.h" +#include "src/core/CL/ICLKernel.h" +#include "src/core/CL/kernels/CLFillBorderKernel.h" +#include "src/core/CL/kernels/CLSoftmaxLayerKernel.h" #include "src/core/helpers/SoftmaxHelpers.h" +#include "support/MemorySupport.h" namespace arm_compute { template CLSoftmaxLayerGeneric::CLSoftmaxLayerGeneric(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _permute_input(), _permute_output(), _max_shift_exp_sum_kernel(), _norm_kernel(), _max(), _sum(), _tmp(), _input_permuted(), _output_permuted(), + : _memory_group(std::move(memory_manager)), + _permute_input(), + _permute_output(), + _max_shift_exp_sum_kernel(support::cpp14::make_unique()), + _norm_kernel(support::cpp14::make_unique()), + _max(), + _sum(), + _tmp(), + _input_permuted(), + _output_permuted(), _needs_permute() { } +template +CLSoftmaxLayerGeneric::~CLSoftmaxLayerGeneric() = default; + template void CLSoftmaxLayerGeneric::configure(const ICLTensor *input, ICLTensor *output, float beta, int32_t axis) { @@ -78,7 +92,7 @@ void CLSoftmaxLayerGeneric::configure(const CLCompileContext &compile_co _sum.allocator()->init(tmp_input->info()->clone()->set_tensor_shape(max_sum_shape).set_data_type(tmp_data_type)); // Set GPU target to kernels - _max_shift_exp_sum_kernel.set_target(CLScheduler::get().target()); + _max_shift_exp_sum_kernel->set_target(CLScheduler::get().target()); // Manage intermediate buffers _memory_group.manage(&_tmp); @@ -91,8 +105,8 @@ void CLSoftmaxLayerGeneric::configure(const CLCompileContext &compile_co softmax_info.input_data_type = tmp_input->info()->data_type(); // Configure kernels - _max_shift_exp_sum_kernel.configure(compile_context, tmp_input, &_max, &_tmp, &_sum, softmax_info); - _norm_kernel.configure(compile_context, &_tmp, &_sum, tmp_output, softmax_info); + _max_shift_exp_sum_kernel->configure(compile_context, tmp_input, &_max, &_tmp, &_sum, softmax_info); + _norm_kernel->configure(compile_context, &_tmp, &_sum, tmp_output, softmax_info); // Allocate intermediate buffers _tmp.allocator()->allocate(); @@ -156,8 +170,8 @@ void CLSoftmaxLayerGeneric::run() _permute_input.run(); } - CLScheduler::get().enqueue(_max_shift_exp_sum_kernel, false); - CLScheduler::get().enqueue(_norm_kernel, !_needs_permute); + CLScheduler::get().enqueue(*_max_shift_exp_sum_kernel, false); + CLScheduler::get().enqueue(*_norm_kernel, !_needs_permute); if(_needs_permute) { -- cgit v1.2.1