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.cpp50
1 files changed, 42 insertions, 8 deletions
diff --git a/src/runtime/CL/functions/CLFill.cpp b/src/runtime/CL/functions/CLFill.cpp
index 30843d8cc0..b22d79fea4 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,56 @@
*/
#include "arm_compute/runtime/CL/functions/CLFill.h"
+#include "arm_compute/core/CL/CLKernelLibrary.h"
+#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/Types.h"
-#include "src/core/CL/kernels/CLMemsetKernel.h"
+#include "arm_compute/core/Validate.h"
+#include "src/core/CL/ICLKernel.h"
+#include "src/runtime/gpu/cl/operators/ClFill.h"
#include <utility>
namespace arm_compute
{
-void CLFill::configure(ICLTensor *tensor, PixelValue constant_value)
+struct CLFill::Impl
{
- configure(CLKernelLibrary::get().get_compile_context(), tensor, constant_value);
+ 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)
+{
+ 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 = std::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