Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 1 | // |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonComparisonWorkload.hpp" |
| 7 | #include <aclCommon/ArmComputeUtils.hpp> |
| 8 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Jan Eilers | 3c9e045 | 2020-04-10 13:00:44 +0100 | [diff] [blame] | 9 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 10 | #include <armnn/backends/TensorHandle.hpp> |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | using namespace armcomputetensorutils; |
| 15 | |
| 16 | arm_compute::Status NeonComparisonWorkloadValidate(const TensorInfo& input0, |
| 17 | const TensorInfo& input1, |
| 18 | const TensorInfo& output, |
| 19 | const ComparisonDescriptor& descriptor) |
| 20 | { |
| 21 | const arm_compute::TensorInfo aclInput0 = BuildArmComputeTensorInfo(input0); |
| 22 | const arm_compute::TensorInfo aclInput1 = BuildArmComputeTensorInfo(input1); |
| 23 | const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output); |
| 24 | |
| 25 | const arm_compute::ComparisonOperation comparisonOperation = ConvertComparisonOperationToAcl(descriptor); |
| 26 | |
| 27 | const arm_compute::Status aclStatus = arm_compute::NEElementwiseComparison::validate(&aclInput0, |
| 28 | &aclInput1, |
| 29 | &aclOutput, |
| 30 | comparisonOperation); |
| 31 | return aclStatus; |
| 32 | } |
| 33 | |
| 34 | NeonComparisonWorkload::NeonComparisonWorkload(const ComparisonQueueDescriptor& descriptor, const WorkloadInfo& info) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 35 | : NeonBaseWorkload<ComparisonQueueDescriptor>(descriptor, info) |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 36 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 37 | // Report Profiling Details |
| 38 | ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonComparisonWorkload_Construct", |
| 39 | descriptor.m_Parameters, |
| 40 | info, |
| 41 | this->GetGuid()); |
| 42 | |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 43 | m_Data.ValidateInputsOutputs("NeonComparisonWorkload", 2, 1); |
| 44 | |
Jan Eilers | 3c9e045 | 2020-04-10 13:00:44 +0100 | [diff] [blame] | 45 | arm_compute::ITensor& input0 = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 46 | arm_compute::ITensor& input1 = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 47 | arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 48 | |
| 49 | const arm_compute::ComparisonOperation comparisonOperation = ConvertComparisonOperationToAcl(m_Data.m_Parameters); |
| 50 | |
| 51 | m_ComparisonLayer.configure(&input0, &input1, &output, comparisonOperation); |
| 52 | } |
| 53 | |
| 54 | void NeonComparisonWorkload::Execute() const |
| 55 | { |
Keith Davis | 2d0679f | 2021-08-05 11:35:00 +0100 | [diff] [blame] | 56 | ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonComparisonWorkload_Execute", this->GetGuid()); |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 57 | m_ComparisonLayer.run(); |
| 58 | } |
| 59 | |
| 60 | } //namespace armnn |