saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 1 | // |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClMinimumWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeUtils.hpp> |
| 11 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 12 | |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 13 | #include <armnn/backends/TensorHandle.hpp> |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 14 | |
| 15 | #include <cl/ClLayerSupport.hpp> |
| 16 | #include <cl/ClTensorHandle.hpp> |
| 17 | #include <cl/ClLayerSupport.hpp> |
| 18 | |
| 19 | namespace armnn |
| 20 | { |
| 21 | |
| 22 | using namespace armcomputetensorutils; |
| 23 | |
| 24 | arm_compute::Status ClMinimumWorkloadValidate(const TensorInfo& input0, |
| 25 | const TensorInfo& input1, |
| 26 | const TensorInfo& output) |
| 27 | { |
| 28 | const arm_compute::TensorInfo aclInput0Info = BuildArmComputeTensorInfo(input0); |
| 29 | const arm_compute::TensorInfo aclInput1Info = BuildArmComputeTensorInfo(input1); |
| 30 | const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output); |
| 31 | |
| 32 | const arm_compute::Status aclStatus = arm_compute::CLElementwiseMin::validate(&aclInput0Info, |
| 33 | &aclInput1Info, |
| 34 | &aclOutputInfo); |
| 35 | |
| 36 | return aclStatus; |
| 37 | } |
| 38 | |
| 39 | ClMinimumWorkload::ClMinimumWorkload(const MinimumQueueDescriptor& descriptor, |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 40 | const WorkloadInfo& info, |
| 41 | const arm_compute::CLCompileContext& clCompileContext) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 42 | : ClBaseWorkload<MinimumQueueDescriptor>(descriptor, info) |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 43 | { |
| 44 | m_Data.ValidateInputsOutputs("ClMinimumWorkload", 2, 1); |
| 45 | |
| 46 | arm_compute::ICLTensor& input0 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 47 | arm_compute::ICLTensor& input1 = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor(); |
| 48 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 49 | |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 50 | { |
| 51 | ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClMinimumWorkload_configure"); |
| 52 | m_MinimumLayer.configure(clCompileContext, &input0, &input1, &output); |
| 53 | } |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | void ClMinimumWorkload::Execute() const |
| 57 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 58 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClMinimumWorkload_Execute", this->GetGuid()); |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 59 | RunClFunction(m_MinimumLayer, CHECK_LOCATION()); |
| 60 | } |
| 61 | |
| 62 | } //namespace armnn |