From 0f7ef8ab2171093855a8f21bd39c8fd7066dd629 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Sun, 10 Jan 2021 04:23:52 +0000 Subject: Make memset/copy functions state-less Port following functions: - NECopy - NEFill - NEPermute - NEReshapeLayer Signed-off-by: Georgios Pinitas Change-Id: I75f3f837012abab79c7dde9a20a34f64f75571d8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4800 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- src/runtime/NEON/functions/NEFill.cpp | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/runtime/NEON/functions/NEFill.cpp') diff --git a/src/runtime/NEON/functions/NEFill.cpp b/src/runtime/NEON/functions/NEFill.cpp index 74e366ab49..ee539fdfc8 100644 --- a/src/runtime/NEON/functions/NEFill.cpp +++ b/src/runtime/NEON/functions/NEFill.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -23,18 +23,40 @@ */ #include "arm_compute/runtime/NEON/functions/NEFill.h" -#include "arm_compute/core/Window.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEMemsetKernel.h" +#include "arm_compute/core/Validate.h" +#include "src/runtime/cpu/operators/CpuFill.h" #include namespace arm_compute { +struct NEFill::Impl +{ + ITensor *tensor{ nullptr }; + std::unique_ptr op{ nullptr }; +}; + +NEFill::NEFill() + : _impl(std::make_unique()) +{ +} +NEFill::NEFill(NEFill &&) = default; +NEFill &NEFill::operator=(NEFill &&) = default; +NEFill::~NEFill() = default; + void NEFill::configure(ITensor *tensor, PixelValue constant_value) { - auto k = std::make_unique(); - k->configure(tensor, constant_value); - _kernel = std::move(k); + ARM_COMPUTE_ERROR_ON_NULLPTR(tensor); + + _impl->tensor = tensor; + _impl->op = std::make_unique(); + _impl->op->configure(tensor->info(), constant_value); +} + +void NEFill::run() +{ + ITensorPack pack; + pack.add_tensor(TensorType::ACL_SRC_DST, _impl->tensor); + _impl->op->run(pack); } } // namespace arm_compute -- cgit v1.2.1