aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLFill.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/functions/CLFill.cpp')
-rw-r--r--src/runtime/CL/functions/CLFill.cpp53
1 files changed, 45 insertions, 8 deletions
diff --git a/src/runtime/CL/functions/CLFill.cpp b/src/runtime/CL/functions/CLFill.cpp
index 7b96ed1592..9bd96a975e 100644
--- a/src/runtime/CL/functions/CLFill.cpp
+++ b/src/runtime/CL/functions/CLFill.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 ARM Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,22 +23,59 @@
*/
#include "arm_compute/runtime/CL/functions/CLFill.h"
-#include "arm_compute/core/CL/kernels/CLMemsetKernel.h"
+#include "arm_compute/core/CL/CLKernelLibrary.h"
+#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/Types.h"
+#include "arm_compute/core/Validate.h"
+
+#include "src/core/CL/ICLKernel.h"
+#include "src/gpu/cl/operators/ClFill.h"
#include <utility>
namespace arm_compute
{
-void CLFill::configure(ICLTensor *tensor, PixelValue constant_value)
+struct CLFill::Impl
+{
+ const ICLTensor *src{nullptr};
+ ICLTensor *dst{nullptr};
+ std::unique_ptr<opencl::ClFill> op{nullptr};
+};
+
+CLFill::CLFill() : _impl(std::make_unique<Impl>())
+{
+}
+CLFill::CLFill(CLFill &&) = default;
+CLFill &CLFill::operator=(CLFill &&) = default;
+CLFill::~CLFill() = default;
+
+void CLFill::configure(ICLTensor *tensor, const PixelValue &constant_value, Window *dst_window)
+{
+ configure(CLKernelLibrary::get().get_compile_context(), tensor, constant_value, dst_window);
+}
+
+void CLFill::configure(const CLCompileContext &compile_context,
+ ICLTensor *tensor,
+ const PixelValue &constant_value,
+ Window *dst_window)
+{
+ ARM_COMPUTE_ERROR_ON_NULLPTR(tensor);
+
+ _impl->src = tensor;
+
+ _impl->op = std::make_unique<opencl::ClFill>();
+ _impl->op->configure(compile_context, _impl->src->info(), constant_value, dst_window);
+}
+
+Status CLFill::validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *dst_window)
{
- configure(CLKernelLibrary::get().get_compile_context(), tensor, constant_value);
+ return opencl::ClFill::validate(tensor, constant_value, dst_window);
}
-void CLFill::configure(const CLCompileContext &compile_context, ICLTensor *tensor, PixelValue constant_value)
+void CLFill::run()
{
- auto k = arm_compute::support::cpp14::make_unique<CLMemsetKernel>();
- k->configure(compile_context, tensor, constant_value);
- _kernel = std::move(k);
+ ITensorPack pack;
+ pack.add_tensor(TensorType::ACL_SRC, _impl->src);
+ _impl->op->run(pack);
}
} // namespace arm_compute