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/NEPermute.cpp | 45 +++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'src/runtime/NEON/functions/NEPermute.cpp') diff --git a/src/runtime/NEON/functions/NEPermute.cpp b/src/runtime/NEON/functions/NEPermute.cpp index cceb22f8c6..257c1a2e44 100644 --- a/src/runtime/NEON/functions/NEPermute.cpp +++ b/src/runtime/NEON/functions/NEPermute.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -23,19 +23,52 @@ */ #include "arm_compute/runtime/NEON/functions/NEPermute.h" -#include "src/core/NEON/kernels/NEPermuteKernel.h" +#include "arm_compute/core/Validate.h" +#include "src/runtime/cpu/operators/CpuPermute.h" namespace arm_compute { +struct NEPermute::Impl +{ + const ITensor *src{ nullptr }; + ITensor *dst{ nullptr }; + std::unique_ptr op{ nullptr }; +}; + +NEPermute::NEPermute() + : _impl(std::make_unique()) +{ +} + +NEPermute::NEPermute(NEPermute &&) = default; + +NEPermute &NEPermute::operator=(NEPermute &&) = default; + +NEPermute::~NEPermute() = default; + void NEPermute::configure(const ITensor *input, ITensor *output, const PermutationVector &perm) { - auto k = std::make_unique(); - k->configure(input, output, perm); - _kernel = std::move(k); + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + + _impl->src = input; + _impl->dst = output; + _impl->op = std::make_unique(); + _impl->op->configure(input->info(), output->info(), perm); } Status NEPermute::validate(const ITensorInfo *input, const ITensorInfo *output, const PermutationVector &perm) { - return NEPermuteKernel::validate(input, output, perm); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ON_ERROR(cpu::CpuPermute::validate(input, output, perm)); + + return Status{}; +} + +void NEPermute::run() +{ + 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 -- cgit v1.2.1