josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 1 | // |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame^] | 2 | // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonSliceWorkload.hpp" |
| 7 | |
| 8 | #include "NeonWorkloadUtils.hpp" |
| 9 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
| 11 | |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 12 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 13 | |
| 14 | #include <neon/NeonTensorHandle.hpp> |
| 15 | |
| 16 | #include <arm_compute/core/Error.h> |
| 17 | |
| 18 | namespace armnn |
| 19 | { |
| 20 | |
| 21 | arm_compute::Status NeonSliceWorkloadValidate(const TensorInfo& input, |
| 22 | const TensorInfo& output, |
| 23 | const SliceDescriptor& descriptor) |
| 24 | { |
| 25 | const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 26 | const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 27 | |
| 28 | arm_compute::Coordinates starts; |
| 29 | arm_compute::Coordinates ends; |
| 30 | |
| 31 | std::tie(starts, ends) = SetNeonSliceData(descriptor.m_Begin, descriptor.m_Size); |
| 32 | |
| 33 | return arm_compute::NESlice::validate(&aclInputInfo, &aclOutputInfo, starts, ends); |
| 34 | } |
| 35 | |
| 36 | NeonSliceWorkload::NeonSliceWorkload(const SliceQueueDescriptor& descriptor, |
| 37 | const WorkloadInfo& info) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame^] | 38 | : NeonBaseWorkload<SliceQueueDescriptor>(descriptor, info) |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 39 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 40 | // Report Profiling Details |
| 41 | ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonSliceWorkload_Construct", |
| 42 | descriptor.m_Parameters, |
| 43 | info, |
| 44 | this->GetGuid()); |
| 45 | |
| 46 | |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 47 | m_Data.ValidateInputsOutputs("NeonSliceWorkload", 1, 1); |
| 48 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 49 | arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 50 | arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 51 | |
| 52 | arm_compute::Coordinates starts; |
| 53 | arm_compute::Coordinates ends; |
| 54 | |
| 55 | std::tie(starts, ends) = SetNeonSliceData(m_Data.m_Parameters.m_Begin, m_Data.m_Parameters.m_Size); |
| 56 | |
| 57 | m_SliceFunction.configure(&input, &output, starts, ends); |
| 58 | } |
| 59 | |
| 60 | void NeonSliceWorkload::Execute() const |
| 61 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 62 | ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonSliceWorkload_Execute", this->GetGuid()); |
josh minor | 036f02d | 2019-11-15 14:53:22 -0600 | [diff] [blame] | 63 | m_SliceFunction.run(); |
| 64 | } |
| 65 | |
| 66 | } // namespace armnn |