Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [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. |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClRsqrtWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 11 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 12 | |
| 13 | #include <cl/ClTensorHandle.hpp> |
| 14 | |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | arm_compute::Status ClRsqrtWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 22 | |
| 23 | return arm_compute::CLRsqrtLayer::validate(&aclInput, &aclOutput); |
| 24 | } |
| 25 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 26 | ClRsqrtWorkload::ClRsqrtWorkload(const RsqrtQueueDescriptor& descriptor, |
| 27 | const WorkloadInfo& info, |
| 28 | const arm_compute::CLCompileContext& clCompileContext) |
Teresa Charlin | 588cbdf | 2022-01-19 15:55:37 +0000 | [diff] [blame] | 29 | : ClBaseWorkload<RsqrtQueueDescriptor>(descriptor, info) |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 30 | { |
| 31 | m_Data.ValidateInputsOutputs("ClRsqrtWorkload", 1, 1); |
| 32 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 33 | arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 34 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 35 | |
Kevin May | 9f6862d | 2021-10-22 15:42:28 +0100 | [diff] [blame] | 36 | { |
| 37 | ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClRsqrtWorkload_configure"); |
| 38 | m_RsqrtLayer.configure(clCompileContext, &input, &output); |
| 39 | } |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | void ClRsqrtWorkload::Execute() const |
| 43 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 44 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClRsqrtWorkload_Execute", this->GetGuid()); |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 45 | RunClFunction(m_RsqrtLayer, CHECK_LOCATION()); |
| 46 | } |
| 47 | |
| 48 | } // namespace armnn |