James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 1 | // |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 2 | // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved. |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClLogicalAndWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <armnn/utility/PolymorphicDowncast.hpp> |
| 11 | |
| 12 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 13 | |
| 14 | #include <cl/ClTensorHandle.hpp> |
| 15 | |
| 16 | namespace armnn |
| 17 | { |
| 18 | using namespace armcomputetensorutils; |
| 19 | |
| 20 | arm_compute::Status ClLogicalAndWorkloadValidate(const TensorInfo& input0, |
| 21 | const TensorInfo& input1, |
| 22 | const TensorInfo& output) |
| 23 | { |
| 24 | const arm_compute::TensorInfo aclInputInfo0 = BuildArmComputeTensorInfo(input0); |
| 25 | const arm_compute::TensorInfo aclInputInfo1 = BuildArmComputeTensorInfo(input1); |
| 26 | const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output); |
| 27 | |
| 28 | const arm_compute::Status aclStatus = arm_compute::CLLogicalAnd::validate(&aclInputInfo0, |
| 29 | &aclInputInfo1, |
| 30 | &aclOutputInfo); |
| 31 | return aclStatus; |
| 32 | } |
| 33 | |
| 34 | ClLogicalAndWorkload::ClLogicalAndWorkload(const LogicalBinaryQueueDescriptor& descriptor, |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 35 | const WorkloadInfo& info, |
| 36 | const arm_compute::CLCompileContext& clCompileContext) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 37 | : ClBaseWorkload<LogicalBinaryQueueDescriptor>(descriptor, info) |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 38 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 39 | // Report Profiling Details |
| 40 | ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClLogicalAndWorkload_Construct", |
| 41 | descriptor.m_Parameters, |
| 42 | info, |
| 43 | this->GetGuid()); |
| 44 | |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 45 | m_Data.ValidateInputsOutputs("ClLogicalAndWorkload", 2, 1); |
| 46 | |
| 47 | arm_compute::ICLTensor& input0 = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 48 | arm_compute::ICLTensor& input1 = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 49 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 50 | |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 51 | { |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 52 | ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClLogicalAndWorkload_configure"); |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 53 | m_LogicalAndLayer.configure(clCompileContext, &input0, &input1, &output); |
| 54 | } |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | void ClLogicalAndWorkload::Execute() const |
| 58 | { |
Mike Kelly | 7cbe781 | 2023-07-25 17:37:33 +0100 | [diff] [blame] | 59 | ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClLogicalAndWorkload_Execute"); |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 60 | m_LogicalAndLayer.run(); |
| 61 | } |
| 62 | |
| 63 | } // namespace armnn |