diff options
Diffstat (limited to 'src/runtime/CL/functions/CLPermute.cpp')
-rw-r--r-- | src/runtime/CL/functions/CLPermute.cpp | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/src/runtime/CL/functions/CLPermute.cpp b/src/runtime/CL/functions/CLPermute.cpp index 31b152c553..eeb0169241 100644 --- a/src/runtime/CL/functions/CLPermute.cpp +++ b/src/runtime/CL/functions/CLPermute.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -23,12 +23,30 @@ */ #include "arm_compute/runtime/CL/functions/CLPermute.h" +#include "arm_compute/core/CL/CLKernelLibrary.h" #include "arm_compute/core/CL/ICLTensor.h" -#include "arm_compute/core/Error.h" -#include "src/core/CL/kernels/CLPermuteKernel.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/core/Validate.h" +#include "src/core/CL/ICLKernel.h" +#include "src/runtime/gpu/cl/operators/ClPermute.h" namespace arm_compute { +struct CLPermute::Impl +{ + const ICLTensor *src{ nullptr }; + ICLTensor *dst{ nullptr }; + std::unique_ptr<opencl::ClPermute> op{ nullptr }; +}; + +CLPermute::CLPermute() + : _impl(std::make_unique<Impl>()) +{ +} +CLPermute::CLPermute(CLPermute &&) = default; +CLPermute &CLPermute::operator=(CLPermute &&) = default; +CLPermute::~CLPermute() = default; + void CLPermute::configure(const ICLTensor *input, ICLTensor *output, const PermutationVector &perm) { configure(CLKernelLibrary::get().get_compile_context(), input, output, perm); @@ -36,14 +54,25 @@ void CLPermute::configure(const ICLTensor *input, ICLTensor *output, const Permu void CLPermute::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const PermutationVector &perm) { - auto k = std::make_unique<CLPermuteKernel>(); - k->configure(compile_context, 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<opencl::ClPermute>(); + _impl->op->configure(compile_context, _impl->src->info(), _impl->dst->info(), perm); } Status CLPermute::validate(const ITensorInfo *input, const ITensorInfo *output, const PermutationVector &perm) { - ARM_COMPUTE_RETURN_ON_ERROR(CLPermuteKernel::validate(input, output, perm)); - return Status{}; + return opencl::ClPermute::validate(input, output, perm); +} + +void CLPermute::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 +} // namespace arm_compute
\ No newline at end of file |