Cian McGriskin | 3b3dcbf | 2023-07-26 11:52:47 +0100 | [diff] [blame^] | 1 | // |
| 2 | // Copyright © 2023 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClTileWorkload.hpp" |
| 7 | #include "ClWorkloadUtils.hpp" |
| 8 | #include <aclCommon/ArmComputeUtils.hpp> |
| 9 | #include <cl/ClTensorHandle.hpp> |
| 10 | #include <vector> |
| 11 | #include <algorithm> |
| 12 | |
| 13 | using namespace armnn::armcomputetensorutils; |
| 14 | namespace armnn |
| 15 | { |
| 16 | arm_compute::Status ClTileWorkloadValidate(const TensorInfo& input, |
| 17 | const TensorInfo& output, |
| 18 | const TileDescriptor& descriptor) |
| 19 | { |
| 20 | const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output); |
| 22 | |
| 23 | std::vector<uint32_t> aclMultiples = descriptor.m_Multiples; |
| 24 | std::reverse(aclMultiples.begin(),aclMultiples.end()); |
| 25 | |
| 26 | return arm_compute::CLTile::validate(&aclInput, &aclOutput, aclMultiples); |
| 27 | } |
| 28 | |
| 29 | ClTileWorkload::ClTileWorkload(const armnn::TileQueueDescriptor& descriptor, |
| 30 | const armnn::WorkloadInfo& info, |
| 31 | const arm_compute::CLCompileContext& clCompileContext) |
| 32 | : BaseWorkload<TileQueueDescriptor>(descriptor, info) |
| 33 | { |
| 34 | m_Data.ValidateInputsOutputs("ClTileWorkload", 1, 1); |
| 35 | |
| 36 | std::vector<uint32_t> aclMultiples = descriptor.m_Parameters.m_Multiples; |
| 37 | std::reverse(aclMultiples.begin(),aclMultiples.end()); |
| 38 | |
| 39 | arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 40 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 41 | m_Layer.configure(clCompileContext, &input, &output, aclMultiples); |
| 42 | } |
| 43 | |
| 44 | void ClTileWorkload::Execute() const |
| 45 | { |
| 46 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClTileWorkload_Execute", this->GetGuid()); |
| 47 | m_Layer.run(); |
| 48 | } |
| 49 | |
| 50 | } //namespace armnn |