diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-07-02 12:43:53 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-07-03 17:15:00 +0000 |
commit | 2aad21a900a21f467b3ec6b37420f892f0d80221 (patch) | |
tree | 7973bbf13d2bc7ea88ab0bf9d7c51e6b2d3e6907 /src/runtime/CL/functions/CLReshapeLayer.cpp | |
parent | d13931d05b0d5ccea4265c342c6a3bf40a3b85cc (diff) | |
download | ComputeLibrary-2aad21a900a21f467b3ec6b37420f892f0d80221.tar.gz |
COMPMID-3388: Async support to CLReshapeLayerKernel kernels/functions
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Change-Id: I141a943dfd691069317860e852ecdd0ba7391604
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3501
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLReshapeLayer.cpp')
-rw-r--r-- | src/runtime/CL/functions/CLReshapeLayer.cpp | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/src/runtime/CL/functions/CLReshapeLayer.cpp b/src/runtime/CL/functions/CLReshapeLayer.cpp index 13baedb3f9..6fc8608552 100644 --- a/src/runtime/CL/functions/CLReshapeLayer.cpp +++ b/src/runtime/CL/functions/CLReshapeLayer.cpp @@ -28,7 +28,43 @@ #include "support/MemorySupport.h" /** [CLReshapeLayer snippet] **/ -using namespace arm_compute; +namespace arm_compute +{ +namespace experimental +{ +void CLReshapeLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) +{ + auto k = arm_compute::support::cpp14::make_unique<CLReshapeLayerKernel>(); + k->configure(compile_context, input, output); + _kernel = std::move(k); +} + +Status CLReshapeLayer::validate(const ITensorInfo *input, const ITensorInfo *output) +{ + return arm_compute::CLReshapeLayerKernel::validate(input, output); +} + +MemoryRequirements CLReshapeLayer::workspace() const +{ + return MemoryRequirements{}; +} +} // namespace experimental + +struct CLReshapeLayer::Impl +{ + const ICLTensor *src{ nullptr }; + ICLTensor *dst{ nullptr }; + std::unique_ptr<experimental::CLReshapeLayer> op{ nullptr }; +}; + +CLReshapeLayer::CLReshapeLayer() + : _impl(support::cpp14::make_unique<Impl>()) +{ +} + +CLReshapeLayer::CLReshapeLayer(CLReshapeLayer &&) = default; +CLReshapeLayer &CLReshapeLayer::operator=(CLReshapeLayer &&) = default; +CLReshapeLayer::~CLReshapeLayer() = default; void CLReshapeLayer::configure(const ICLTensor *input, ICLTensor *output) { @@ -37,13 +73,26 @@ void CLReshapeLayer::configure(const ICLTensor *input, ICLTensor *output) void CLReshapeLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) { - auto k = arm_compute::support::cpp14::make_unique<CLReshapeLayerKernel>(); - k->configure(compile_context, input, output); - _kernel = std::move(k); + _impl->src = input; + _impl->dst = output; + _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLReshapeLayer>(); + _impl->op->configure(compile_context, input->info(), output->info()); } Status CLReshapeLayer::validate(const ITensorInfo *input, const ITensorInfo *output) { - return CLReshapeLayerKernel::validate(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ON_ERROR(experimental::CLReshapeLayer::validate(input, output)); + + return Status{}; +} + +void CLReshapeLayer::run() +{ + const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; + const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; + + _impl->op->run(src, dst, {}); } +} // namespace arm_compute /** [CLReshapeLayer snippet] **/ |