From 2aad21a900a21f467b3ec6b37420f892f0d80221 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 2 Jul 2020 12:43:53 +0100 Subject: COMPMID-3388: Async support to CLReshapeLayerKernel kernels/functions Signed-off-by: Michalis Spyrou Change-Id: I141a943dfd691069317860e852ecdd0ba7391604 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3501 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/runtime/CL/functions/CLSoftmaxLayer.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 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 71ccf9fa01..52fac4f846 100644 --- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp +++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp @@ -36,7 +36,7 @@ namespace arm_compute { template CLSoftmaxLayerGeneric::CLSoftmaxLayerGeneric(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _max_shift_exp_sum_kernel(), _norm_kernel(), _flatten_kernel_ptr(), _reshape_kernel(), _max(), _sum(), _tmp(), _input_flattened(), _output_flattened(), + : _memory_group(std::move(memory_manager)), _max_shift_exp_sum_kernel(), _norm_kernel(), _flatten_ptr(), _reshape(), _max(), _sum(), _tmp(), _input_flattened(), _output_flattened(), _needs_flattening(false) { } @@ -64,15 +64,15 @@ void CLSoftmaxLayerGeneric::configure_reshape_input_kernel(const CLCompi // 2. first_n_reduce_axes == 4: Reduce all 4 dimensions. This can only be handled by CLReshapeKernel instead of CLFlattenKernel. if(first_n_reduce_axes == 3) { - auto flatten_kernel_ptr = support::cpp14::make_unique(); - flatten_kernel_ptr->configure(compile_context, input, &_input_flattened); - _flatten_kernel_ptr = std::move(flatten_kernel_ptr); + auto flatten = support::cpp14::make_unique(); + flatten->configure(compile_context, input, &_input_flattened); + _flatten_ptr = std::move(flatten); } else { - auto reshape_kernel_ptr = support::cpp14::make_unique(); - reshape_kernel_ptr->configure(compile_context, input, &_input_flattened); - _flatten_kernel_ptr = std::move(reshape_kernel_ptr); + auto reshape_ptr = support::cpp14::make_unique(); + reshape_ptr->configure(compile_context, input, &_input_flattened); + _flatten_ptr = std::move(reshape_ptr); } // We need to init the output tensor here. Indeed, the reshape kernel expects @@ -152,7 +152,7 @@ void CLSoftmaxLayerGeneric::configure(const CLCompileContext &compile_co _norm_kernel.configure(compile_context, &_tmp, &_sum, &_output_flattened, softmax_info); // Reshape the flat output into a the requested (4D) output - _reshape_kernel.configure(compile_context, &_output_flattened, output); + _reshape.configure(compile_context, &_output_flattened, output); // Allocate the intermediate flat tensors _input_flattened.allocator()->allocate(); @@ -199,11 +199,11 @@ Status CLSoftmaxLayerGeneric::validate(const ITensorInfo *input, const I if(first_n_reduce_axes == 3) { - ARM_COMPUTE_RETURN_ON_ERROR(CLFlattenLayerKernel::validate(input, &tensor_info_flat)); + ARM_COMPUTE_RETURN_ON_ERROR(CLFlattenLayer::validate(input, &tensor_info_flat)); } else { - ARM_COMPUTE_RETURN_ON_ERROR(CLReshapeLayerKernel::validate(input, &tensor_info_flat)); + ARM_COMPUTE_RETURN_ON_ERROR(CLReshapeLayer::validate(input, &tensor_info_flat)); } } @@ -231,7 +231,7 @@ void CLSoftmaxLayerGeneric::run() if(_needs_flattening) { - CLScheduler::get().enqueue(*_flatten_kernel_ptr, false); + _flatten_ptr->run(); } CLScheduler::get().enqueue(_max_shift_exp_sum_kernel, false); @@ -239,7 +239,7 @@ void CLSoftmaxLayerGeneric::run() if(_needs_flattening) { - CLScheduler::get().enqueue(_reshape_kernel, true); + _reshape.run(); } } -- cgit v1.2.1