aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-06-09 12:09:24 +0100
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-06-12 14:51:37 +0000
commitccd94966cc58ef5148577e71ba1a4ff5aae1f3bb (patch)
tree17efa87eff3cee7d5c2f0cfe04614b2c6d87a8fc /src/runtime/CL/functions
parente1536a82dd872651551e3ce25b2bae5da8abaf14 (diff)
downloadComputeLibrary-ccd94966cc58ef5148577e71ba1a4ff5aae1f3bb.tar.gz
COMPMID-3364: use ScaleKernelInfo for Scale on OpenCL and GLES
- Make Scale and ScaleKernel (on CL and GLES) use ScaleKernelInfo - Deprecate previous configure/validate functions on NEON, CL and GLES - Make adjustments required by deprecation Change-Id: I7e81f4ee9ae919392137b92f91e9bc002b7ae277 Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3317 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'src/runtime/CL/functions')
-rw-r--r--src/runtime/CL/functions/CLCropResize.cpp2
-rw-r--r--src/runtime/CL/functions/CLGaussianPyramid.cpp2
-rw-r--r--src/runtime/CL/functions/CLLaplacianReconstruct.cpp2
-rw-r--r--src/runtime/CL/functions/CLScale.cpp37
4 files changed, 29 insertions, 14 deletions
diff --git a/src/runtime/CL/functions/CLCropResize.cpp b/src/runtime/CL/functions/CLCropResize.cpp
index 17fc80e146..aa6f1f913d 100644
--- a/src/runtime/CL/functions/CLCropResize.cpp
+++ b/src/runtime/CL/functions/CLCropResize.cpp
@@ -135,7 +135,7 @@ void CLCropResize::configure(const CLCompileContext &compile_context, const ICLT
configure_crop(_input, _boxes, _box_ind, _crop_results[num_box].get(), num_box, start, end, batch_index);
auto scale_kernel = support::cpp14::make_unique<CLScale>();
- scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT);
+ scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), ScaleKernelInfo{ _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT });
_scale.emplace_back(std::move(scale_kernel));
Window win = calculate_max_window(*_output->info());
diff --git a/src/runtime/CL/functions/CLGaussianPyramid.cpp b/src/runtime/CL/functions/CLGaussianPyramid.cpp
index 1ac98787ac..5dd1aacef1 100644
--- a/src/runtime/CL/functions/CLGaussianPyramid.cpp
+++ b/src/runtime/CL/functions/CLGaussianPyramid.cpp
@@ -175,7 +175,7 @@ void CLGaussianPyramidOrb::configure(const CLCompileContext &compile_context, IC
_gauss5x5[i].configure(compile_context, _pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
/* Configure scale image kernel */
- _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, SamplingPolicy::CENTER);
+ _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, PixelValue(), SamplingPolicy::CENTER });
}
_tmp.allocate();
diff --git a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
index ea6a3f9a98..113a2b9e54 100644
--- a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
+++ b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp
@@ -77,7 +77,7 @@ void CLLaplacianReconstruct::configure(const CLCompileContext &compile_context,
// Scale levels n-1 to 1, and add levels n-2 to 0
for(size_t l = 0; l < last_level; ++l)
{
- _scalef[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value);
+ _scalef[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), ScaleKernelInfo{ arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value });
_addf[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE);
}
diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp
index a9395bdc3d..7e58b76f8d 100644
--- a/src/runtime/CL/functions/CLScale.cpp
+++ b/src/runtime/CL/functions/CLScale.cpp
@@ -30,38 +30,53 @@
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "support/MemorySupport.h"
-using namespace arm_compute;
+namespace arm_compute
+{
+void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
+{
+ configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
+}
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)
{
- configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners);
+ configure(CLKernelLibrary::get().get_compile_context(), input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
}
-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);
+ 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(border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
+ if(info.border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC)
{
- border_mode = BorderMode::CONSTANT;
+ border_mode_to_use = BorderMode::CONSTANT;
}
- _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode, constant_border_value);
+ _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode_to_use, info.constant_border_value);
+}
+
+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)
+{
+ configure(compile_context, input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
}
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)
{
- ARM_COMPUTE_UNUSED(constant_border_value, use_padding);
- return CLScaleKernel::validate(input, output, policy, border_mode, sampling_policy, align_corners);
+ return CLScale::validate(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners });
+}
+
+Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info)
+{
+ return CLScaleKernel::validate(input, output, info);
}
+} // namespace arm_compute