• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClLogicalOrWorkload.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 
ClLogicalOrWorkloadValidate(const TensorInfo & input0,const TensorInfo & input1,const TensorInfo & output)20 arm_compute::Status ClLogicalOrWorkloadValidate(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::CLLogicalOr::validate(&aclInputInfo0,
29                                                                              &aclInputInfo1,
30                                                                              &aclOutputInfo);
31     return aclStatus;
32 }
33 
ClLogicalOrWorkload(const LogicalBinaryQueueDescriptor & descriptor,const WorkloadInfo & info,const arm_compute::CLCompileContext & clCompileContext)34 ClLogicalOrWorkload::ClLogicalOrWorkload(const LogicalBinaryQueueDescriptor& descriptor,
35                                          const WorkloadInfo& info,
36                                          const arm_compute::CLCompileContext& clCompileContext)
37     : ClBaseWorkload<LogicalBinaryQueueDescriptor>(descriptor, info)
38 {
39     // Report Profiling Details
40     ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClLogicalOrWorkload_Construct",
41                                          descriptor.m_Parameters,
42                                          info,
43                                          this->GetGuid());
44 
45     m_Data.ValidateInputsOutputs("ClLogicalOrWorkload", 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 
51     {
52         ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClLogicalOrWorkload_configure");
53         m_LogicalOrLayer.configure(clCompileContext, &input0, &input1, &output);
54     }
55 }
56 
Execute() const57 void ClLogicalOrWorkload::Execute() const
58 {
59     ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClLogicalOrWorkload_Execute", this->GetGuid());
60     m_LogicalOrLayer.run();
61 }
62 
63 } // namespace armnn
64