From f20d6d6ae5a0da2c856294e93341cdc065db58f9 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 16 Jul 2020 17:46:51 +0100 Subject: COMPMID-3390: Async support to CLStridedSliceLayerKernel kernels/functions Signed-off-by: Michalis Spyrou Change-Id: I9ff7e8d2fb4d36c4b7c44e885abf34ff6d4c577c Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3587 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- src/runtime/CL/functions/CLSlice.cpp | 53 ++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) (limited to 'src/runtime/CL/functions/CLSlice.cpp') diff --git a/src/runtime/CL/functions/CLSlice.cpp b/src/runtime/CL/functions/CLSlice.cpp index 129d97afeb..b60daeee44 100644 --- a/src/runtime/CL/functions/CLSlice.cpp +++ b/src/runtime/CL/functions/CLSlice.cpp @@ -31,12 +31,9 @@ namespace arm_compute { -void CLSlice::configure(const ICLTensor *input, ICLTensor *output, const Coordinates &starts, const Coordinates &ends) +namespace experimental { - configure(CLKernelLibrary::get().get_compile_context(), input, output, starts, ends); -} - -void CLSlice::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const Coordinates &starts, const Coordinates &ends) +void CLSlice::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output, const Coordinates &starts, const Coordinates &ends) { ARM_COMPUTE_ERROR_ON_NULLPTR(input); @@ -63,4 +60,50 @@ Status CLSlice::validate(const ITensorInfo *input, const ITensorInfo *output, co return CLStridedSliceKernel::validate(input, output, starts, ends, BiStrides(), 0, slice_end_mask, 0); } + +MemoryRequirements CLSlice::workspace() const +{ + return MemoryRequirements{}; +} +} // namespace experimental + +struct CLSlice::Impl +{ + const ICLTensor *src{ nullptr }; + ICLTensor *dst{ nullptr }; + std::unique_ptr op{ nullptr }; +}; + +CLSlice::CLSlice() + : _impl(support::cpp14::make_unique()) +{ +} +CLSlice::CLSlice(CLSlice &&) = default; +CLSlice &CLSlice::operator=(CLSlice &&) = default; +CLSlice::~CLSlice() = default; + +Status CLSlice::validate(const ITensorInfo *input, const ITensorInfo *output, const Coordinates &starts, const Coordinates &ends) +{ + return experimental::CLSlice::validate(input, output, starts, ends); +} + +void CLSlice::configure(const ICLTensor *input, ICLTensor *output, const Coordinates &starts, const Coordinates &ends) +{ + configure(CLKernelLibrary::get().get_compile_context(), input, output, starts, ends); +} + +void CLSlice::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const Coordinates &starts, const Coordinates &ends) +{ + _impl->src = input; + _impl->dst = output; + _impl->op = arm_compute::support::cpp14::make_unique(); + _impl->op->configure(compile_context, input->info(), output->info(), starts, ends); +} + +void CLSlice::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 -- cgit v1.2.1