diff options
Diffstat (limited to 'src/runtime/CL/functions/CLScale.cpp')
-rw-r--r-- | src/runtime/CL/functions/CLScale.cpp | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp index a9395bdc3d..abff0724e4 100644 --- a/src/runtime/CL/functions/CLScale.cpp +++ b/src/runtime/CL/functions/CLScale.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 ARM Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -23,45 +23,54 @@ */ #include "arm_compute/runtime/CL/functions/CLScale.h" +#include "arm_compute/core/CL/CLKernelLibrary.h" #include "arm_compute/core/CL/ICLTensor.h" -#include "arm_compute/core/CL/kernels/CLScaleKernel.h" -#include "arm_compute/core/Error.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/CL/CLScheduler.h" -#include "support/MemorySupport.h" +#include "arm_compute/core/KernelDescriptors.h" -using namespace arm_compute; +#include "src/core/CL/ICLKernel.h" +#include "src/gpu/cl/operators/ClScale.h" -void CLScale::configure(ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding, - bool align_corners) +namespace arm_compute { - configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners); +struct CLScale::Impl +{ + const ICLTensor *src{nullptr}; + ICLTensor *dst{nullptr}; + std::unique_ptr<opencl::ClScale> op{nullptr}; +}; + +CLScale::CLScale() : _impl(std::make_unique<Impl>()) +{ +} +CLScale::~CLScale() = default; + +void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info) +{ + configure(CLKernelLibrary::get().get_compile_context(), input, output, info); } -void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, - SamplingPolicy sampling_policy, bool use_padding, bool align_corners) +void CLScale::configure(const CLCompileContext &compile_context, + ICLTensor *input, + ICLTensor *output, + const ScaleKernelInfo &info) { - ARM_COMPUTE_UNUSED(use_padding); - auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>(); - k->set_target(CLScheduler::get().target()); - k->configure(compile_context, input, output, policy, border_mode, sampling_policy, align_corners); - _kernel = std::move(k); + _impl->src = input; + _impl->dst = output; - // Tune kernels - CLScheduler::get().tune_kernel_static(*_kernel); + _impl->op = std::make_unique<opencl::ClScale>(); + _impl->op->configure(compile_context, input->info(), output->info(), info); +} - // In the case of NHWC we can't have undefined border mode as this would require to access elements outside z dimension, - // so we treat it like border constant. - if(border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC) - { - border_mode = BorderMode::CONSTANT; - } - _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode, constant_border_value); +Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info) +{ + return opencl::ClScale::validate(input, output, info); } -Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, - bool use_padding, bool align_corners) +void CLScale::run() { - ARM_COMPUTE_UNUSED(constant_border_value, use_padding); - return CLScaleKernel::validate(input, output, policy, border_mode, sampling_policy, align_corners); + ITensorPack pack; + pack.add_tensor(TensorType::ACL_SRC, _impl->src); + pack.add_tensor(TensorType::ACL_DST, _impl->dst); + _impl->op->run(pack); } +} // namespace arm_compute |