diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-07-16 17:46:51 +0100 |
---|---|---|
committer | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-07-21 16:22:21 +0000 |
commit | f20d6d6ae5a0da2c856294e93341cdc065db58f9 (patch) | |
tree | 0e11a924371691fb9d345cd9362cd8cc06662432 /src/runtime/CL/functions/CLSlice.cpp | |
parent | c6eaec3610fa27651582f6c1acad35afffe360f6 (diff) | |
download | ComputeLibrary-f20d6d6ae5a0da2c856294e93341cdc065db58f9.tar.gz |
COMPMID-3390: Async support to CLStridedSliceLayerKernel kernels/functions
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Change-Id: I9ff7e8d2fb4d36c4b7c44e885abf34ff6d4c577c
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3587
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLSlice.cpp')
-rw-r--r-- | src/runtime/CL/functions/CLSlice.cpp | 53 |
1 files changed, 48 insertions, 5 deletions
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<experimental::CLSlice> op{ nullptr }; +}; + +CLSlice::CLSlice() + : _impl(support::cpp14::make_unique<Impl>()) +{ +} +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<experimental::CLSlice>(); + _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 |