aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLScale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/functions/CLScale.cpp')
-rw-r--r--src/runtime/CL/functions/CLScale.cpp69
1 files changed, 31 insertions, 38 deletions
diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp
index 383b0cc305..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,61 +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/Error.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "src/core/CL/kernels/CLFillBorderKernel.h"
-#include "src/core/CL/kernels/CLScaleKernel.h"
-#include "support/MemorySupport.h"
+#include "arm_compute/core/KernelDescriptors.h"
+
+#include "src/core/CL/ICLKernel.h"
+#include "src/gpu/cl/operators/ClScale.h"
namespace arm_compute
{
-void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
+struct CLScale::Impl
{
- configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
-}
+ const ICLTensor *src{nullptr};
+ ICLTensor *dst{nullptr};
+ std::unique_ptr<opencl::ClScale> op{nullptr};
+};
-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)
+CLScale::CLScale() : _impl(std::make_unique<Impl>())
{
- configure(CLKernelLibrary::get().get_compile_context(), input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
}
+CLScale::~CLScale() = default;
-void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
+void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
- auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>();
- k->set_target(CLScheduler::get().target());
- k->configure(compile_context, input, output, info);
- _kernel = std::move(k);
-
- // Tune kernels
- CLScheduler::get().tune_kernel_static(*_kernel);
-
- auto border_mode_to_use = info.border_mode;
- // 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(info.border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
- {
- border_mode_to_use = BorderMode::CONSTANT;
- }
- _border_handler->configure(compile_context, input, _kernel->border_size(), border_mode_to_use, info.constant_border_value);
+ 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)
{
- configure(compile_context, input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
+ _impl->src = input;
+ _impl->dst = output;
+
+ _impl->op = std::make_unique<opencl::ClScale>();
+ _impl->op->configure(compile_context, input->info(), output->info(), 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)
+Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
{
- return CLScale::validate(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
+ return opencl::ClScale::validate(input, output, info);
}
-Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
+void CLScale::run()
{
- return CLScaleKernel::validate(input, output, info);
+ 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