aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL')
-rw-r--r--src/runtime/CL/functions/CLScale.cpp45
-rw-r--r--src/runtime/CL/tuners/BifrostTuner.cpp11
2 files changed, 28 insertions, 28 deletions
diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp
index 9862d0a1b3..cbd93c1086 100644
--- a/src/runtime/CL/functions/CLScale.cpp
+++ b/src/runtime/CL/functions/CLScale.cpp
@@ -23,17 +23,26 @@
*/
#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 "arm_compute/core/KernelDescriptors.h"
+#include "src/core/CL/ICLKernel.h"
+#include "src/runtime/gpu/cl/operators/ClScale.h"
namespace arm_compute
{
+struct CLScale::Impl
+{
+ const ICLTensor *src{ nullptr };
+ ICLTensor *dst{ nullptr };
+ std::unique_ptr<opencl::ClScale> op{ nullptr };
+};
+
CLScale::CLScale()
- : _border_handler(std::make_unique<CLFillBorderKernel>()), _kernel()
+ : _impl(std::make_unique<Impl>())
{
}
+CLScale::~CLScale() = default;
void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
@@ -42,33 +51,23 @@ void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelIn
void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info)
{
- auto k = std::make_unique<CLScaleKernel>();
- k->set_target(CLScheduler::get().target());
- k->configure(compile_context, input, output, info);
- _kernel = std::move(k);
+ _impl->src = input;
+ _impl->dst = output;
- // Tune kernels
- CLScheduler::get().tune_kernel_static(*_kernel);
-
- const DataLayout data_layout = info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : info.data_layout;
- if(data_layout == DataLayout::NCHW && !_kernel->border_size().empty())
- {
- _border_handler->configure(compile_context, input, _kernel->border_size(), info.border_mode, info.constant_border_value);
- }
+ _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, const ScaleKernelInfo &info)
{
- return CLScaleKernel::validate(input, output, info);
+ return opencl::ClScale::validate(input, output, info);
}
void CLScale::run()
{
- if(!_kernel->border_size().empty())
- {
- CLScheduler::get().enqueue(*_border_handler, false);
- }
- CLScheduler::get().enqueue(*_kernel);
+ 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
diff --git a/src/runtime/CL/tuners/BifrostTuner.cpp b/src/runtime/CL/tuners/BifrostTuner.cpp
index 7a06de6d1c..fe95829cca 100644
--- a/src/runtime/CL/tuners/BifrostTuner.cpp
+++ b/src/runtime/CL/tuners/BifrostTuner.cpp
@@ -28,6 +28,7 @@
#include "support/Cast.h"
#include "src/core/gpu/cl/kernels/ClPoolingKernel.h"
+#include "src/core/gpu/cl/kernels/ClScaleKernel.h"
namespace arm_compute
{
@@ -234,18 +235,18 @@ void tune_pooling_kernel(opencl::kernels::ClPoolingKernel &k)
k.set_lws_hint(lws_hint);
}
-void tune_scale_kernel(CLScaleKernel &k)
+void tune_scale_kernel(opencl::kernels::ClScaleKernel &k)
{
cl::NDRange lws_hint = k.lws_hint();
const GPUTarget gpu_target = k.get_target();
- const DataType dt = k.input()->info()->data_type();
+ const DataType dt = k.get_data_type();
const InterpolationPolicy interpolation = k.get_interpolation_policy();
// Configure the local work size for Bifrost, interpolation (bilinear) and datatype F32.
// The value are obtained via exhaustive autotuning.
if(gpu_target_is_in(gpu_target, GPUTarget::G71, GPUTarget::G72) && (dt == DataType::F32) && (interpolation == InterpolationPolicy::BILINEAR))
{
- auto dim_0 = k.output()->info()->dimension(0);
+ const auto dim_0 = k.get_output_x_dim();
if(dim_0 == 480)
{
lws_hint = cl::NDRange(2, 1);
@@ -285,9 +286,9 @@ void BifrostTuner::tune_kernel_static(ICLKernel &kernel)
{
tune_pooling_kernel(*utils::cast::polymorphic_downcast<opencl::kernels::ClPoolingKernel *>(&kernel));
}
- else if(dynamic_cast<CLScaleKernel *>(&kernel) != nullptr)
+ else if(dynamic_cast<opencl::kernels::ClScaleKernel *>(&kernel) != nullptr)
{
- tune_scale_kernel(*utils::cast::polymorphic_downcast<CLScaleKernel *>(&kernel));
+ tune_scale_kernel(*utils::cast::polymorphic_downcast<opencl::kernels::ClScaleKernel *>(&kernel));
}
}