Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 2 | // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 5 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 6 | #include "NeonBackendId.hpp" |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 7 | #include "NeonBackendModelContext.hpp" |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 8 | #include "NeonTensorHandle.hpp" |
| 9 | #include "NeonWorkloadFactory.hpp" |
| 10 | |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 11 | #include <Layer.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 12 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 13 | #include <armnn/Utils.hpp> |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 14 | #include <armnn/utility/IgnoreUnused.hpp> |
Matthew Sloyan | 171214c | 2020-09-09 09:07:37 +0100 | [diff] [blame] | 15 | #include <armnn/utility/NumericCast.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 16 | #include <armnn/utility/PolymorphicDowncast.hpp> |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 17 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 18 | #include <backendsCommon/MakeWorkloadHelper.hpp> |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 19 | #include <armnn/backends/MemCopyWorkload.hpp> |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 20 | #include <backendsCommon/MemImportWorkload.hpp> |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 21 | #include <armnn/backends/TensorHandle.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 22 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 23 | #include <neon/workloads/NeonWorkloadUtils.hpp> |
| 24 | #include <neon/workloads/NeonWorkloads.hpp> |
| 25 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 26 | namespace armnn |
| 27 | { |
| 28 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 29 | namespace |
| 30 | { |
| 31 | static const BackendId s_Id{NeonBackendId()}; |
| 32 | } |
| 33 | |
David Beck | 29c75de | 2018-10-23 13:35:58 +0100 | [diff] [blame] | 34 | bool NeonWorkloadFactory::IsLayerSupported(const Layer& layer, |
| 35 | Optional<DataType> dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 36 | std::string& outReasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 37 | { |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 38 | return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported); |
| 39 | } |
| 40 | |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 41 | bool NeonWorkloadFactory::IsLayerSupported(const IConnectableLayer& layer, |
| 42 | Optional<DataType> dataType, |
| 43 | std::string& outReasonIfUnsupported, |
| 44 | const ModelOptions& modelOptions) |
| 45 | { |
| 46 | return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported, modelOptions); |
| 47 | } |
| 48 | |
David Beck | 79141b9 | 2018-10-23 16:09:36 +0100 | [diff] [blame] | 49 | const BackendId& NeonWorkloadFactory::GetBackendId() const |
| 50 | { |
| 51 | return s_Id; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Matthew Sloyan | 0a7dc6b | 2021-02-10 16:50:53 +0000 | [diff] [blame] | 54 | void NeonWorkloadFactory::SetNumberOfThreads() |
| 55 | { |
| 56 | if (m_ModelContextPtr) |
| 57 | { |
| 58 | const unsigned int MIN_THREADS = 1; |
| 59 | const unsigned int MAX_THREADS = 64; |
| 60 | |
| 61 | // Set the number of threads to be used if the user has set NumberOfThreads param |
| 62 | // Only set if within limit or valid input |
| 63 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 64 | auto numberOfThreads = modelOptions->GetNumberOfThreads(); |
| 65 | |
| 66 | if (numberOfThreads != 0 && numberOfThreads >= MIN_THREADS && numberOfThreads <= MAX_THREADS) |
| 67 | { |
| 68 | arm_compute::Scheduler::get().set_num_threads(numberOfThreads); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 73 | NeonWorkloadFactory::NeonWorkloadFactory(const std::shared_ptr<NeonMemoryManager>& memoryManager) |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 74 | : m_MemoryManager(memoryManager), m_ModelContextPtr(IBackendInternal::IBackendSpecificModelContextPtr{}) |
| 75 | { |
Matthew Sloyan | 0a7dc6b | 2021-02-10 16:50:53 +0000 | [diff] [blame] | 76 | SetNumberOfThreads(); |
Sadik Armagan | 04a7297 | 2020-09-14 15:44:18 +0100 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | NeonWorkloadFactory::NeonWorkloadFactory(const std::shared_ptr<NeonMemoryManager>& memoryManager, |
| 80 | const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) |
| 81 | : m_MemoryManager(memoryManager), m_ModelContextPtr(modelContextPtr) |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 82 | { |
Matthew Sloyan | 0a7dc6b | 2021-02-10 16:50:53 +0000 | [diff] [blame] | 83 | SetNumberOfThreads(); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 84 | } |
| 85 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 86 | std::unique_ptr<ITensorHandle> NeonWorkloadFactory::CreateSubTensorHandle(ITensorHandle& parent, |
| 87 | TensorShape const& subTensorShape, |
| 88 | unsigned int const* subTensorOrigin) const |
| 89 | { |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 90 | const arm_compute::TensorShape shape = armcomputetensorutils::BuildArmComputeTensorShape(subTensorShape); |
| 91 | |
| 92 | arm_compute::Coordinates coords; |
| 93 | coords.set_num_dimensions(subTensorShape.GetNumDimensions()); |
| 94 | for (unsigned int i = 0; i < subTensorShape.GetNumDimensions(); i++) |
| 95 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 96 | // Arm compute indexes tensor coords in reverse order. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 97 | unsigned int revertedIndex = subTensorShape.GetNumDimensions() - i - 1; |
Matthew Sloyan | 171214c | 2020-09-09 09:07:37 +0100 | [diff] [blame] | 98 | coords.set(i, armnn::numeric_cast<int>(subTensorOrigin[revertedIndex])); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 99 | } |
| 100 | |
Derek Lamberti | 0790dce | 2019-04-15 18:37:35 +0100 | [diff] [blame] | 101 | const arm_compute::TensorShape parentShape = armcomputetensorutils::BuildArmComputeTensorShape(parent.GetShape()); |
| 102 | if (!::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, parentShape, coords, shape)) |
| 103 | { |
| 104 | return nullptr; |
| 105 | } |
| 106 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 107 | return std::make_unique<NeonSubTensorHandle>( |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 108 | PolymorphicDowncast<IAclTensorHandle*>(&parent), shape, coords); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 109 | } |
| 110 | |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 111 | std::unique_ptr<ITensorHandle> NeonWorkloadFactory::CreateTensorHandle(const TensorInfo& tensorInfo, |
| 112 | const bool IsMemoryManaged) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 113 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 114 | auto tensorHandle = std::make_unique<NeonTensorHandle>(tensorInfo); |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 115 | if (IsMemoryManaged) |
| 116 | { |
| 117 | tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup()); |
| 118 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 119 | return tensorHandle; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 120 | } |
| 121 | |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 122 | std::unique_ptr<ITensorHandle> NeonWorkloadFactory::CreateTensorHandle(const TensorInfo& tensorInfo, |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 123 | DataLayout dataLayout, |
| 124 | const bool IsMemoryManaged) const |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 125 | { |
| 126 | auto tensorHandle = std::make_unique<NeonTensorHandle>(tensorInfo, dataLayout); |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 127 | if (IsMemoryManaged) |
| 128 | { |
| 129 | tensorHandle->SetMemoryGroup(m_MemoryManager->GetInterLayerMemoryGroup()); |
| 130 | } |
Francis Murtagh | 351d13d | 2018-09-24 15:01:18 +0100 | [diff] [blame] | 131 | return tensorHandle; |
| 132 | } |
| 133 | |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 134 | std::unique_ptr<IWorkload> NeonWorkloadFactory::CreateWorkload(LayerType type, |
| 135 | const QueueDescriptor& descriptor, |
| 136 | const WorkloadInfo& info) const |
| 137 | { |
| 138 | switch(type) |
| 139 | { |
| 140 | case LayerType::Activation : |
| 141 | { |
| 142 | auto activationQueueDescriptor = PolymorphicDowncast<const ActivationQueueDescriptor*>(&descriptor); |
| 143 | return std::make_unique<NeonActivationWorkload>(*activationQueueDescriptor, info); |
| 144 | } |
| 145 | case LayerType::Addition : |
| 146 | { |
| 147 | auto additionQueueDescriptor = PolymorphicDowncast<const AdditionQueueDescriptor*>(&descriptor); |
| 148 | return std::make_unique<NeonAdditionWorkload>(*additionQueueDescriptor, info); |
| 149 | } |
| 150 | case LayerType::ArgMinMax : |
| 151 | { |
| 152 | auto argMinMaxQueueDescriptor = PolymorphicDowncast<const ArgMinMaxQueueDescriptor*>(&descriptor); |
| 153 | return std::make_unique<NeonArgMinMaxWorkload>(*argMinMaxQueueDescriptor, info); |
| 154 | } |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 155 | case LayerType::BatchMatMul : |
| 156 | { |
| 157 | auto batchMatMulQueueDescriptor = PolymorphicDowncast<const BatchMatMulQueueDescriptor*>(&descriptor); |
Teresa Charlin | 1fe6c81 | 2022-11-01 15:59:50 +0000 | [diff] [blame] | 158 | bool isFastMathEnabled = false; |
| 159 | if (m_ModelContextPtr) |
| 160 | { |
| 161 | if (m_ModelContextPtr.get() != nullptr) |
| 162 | { |
| 163 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 164 | if (modelOptions) |
| 165 | { |
| 166 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | return std::make_unique<NeonBatchMatMulWorkload>(*batchMatMulQueueDescriptor, info, isFastMathEnabled); |
Teresa Charlin | 0f86ecf | 2022-10-13 15:47:08 +0100 | [diff] [blame] | 171 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 172 | case LayerType::BatchNormalization : |
| 173 | { |
| 174 | auto batchNormalizationQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 175 | = PolymorphicDowncast<const BatchNormalizationQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 176 | return std::make_unique<NeonBatchNormalizationWorkload>(*batchNormalizationQueueDescriptor, info); |
| 177 | } |
| 178 | case LayerType::BatchToSpaceNd : |
| 179 | { |
| 180 | auto batchToSpaceNdQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 181 | = PolymorphicDowncast<const BatchToSpaceNdQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 182 | return std::make_unique<NeonBatchToSpaceNdWorkload>(*batchToSpaceNdQueueDescriptor, info); |
| 183 | } |
| 184 | case LayerType::Cast : |
| 185 | { |
| 186 | auto castQueueDescriptor = PolymorphicDowncast<const CastQueueDescriptor*>(&descriptor); |
| 187 | return std::make_unique<NeonCastWorkload>(*castQueueDescriptor, info); |
| 188 | } |
| 189 | case LayerType::ChannelShuffle : |
| 190 | { |
| 191 | auto channelShuffleQueueDescriptor = PolymorphicDowncast<const ChannelShuffleQueueDescriptor*>(&descriptor); |
| 192 | return std::make_unique<NeonChannelShuffleWorkload>(*channelShuffleQueueDescriptor, info); |
| 193 | } |
| 194 | case LayerType::Comparison : |
| 195 | { |
| 196 | auto comparisonQueueDescriptor = PolymorphicDowncast<const ComparisonQueueDescriptor*>(&descriptor); |
| 197 | return std::make_unique<NeonComparisonWorkload>(*comparisonQueueDescriptor, info); |
| 198 | } |
| 199 | case LayerType::Concat : |
| 200 | { |
| 201 | auto concatQueueDescriptor = PolymorphicDowncast<const ConcatQueueDescriptor*>(&descriptor); |
| 202 | return std::make_unique<NeonConcatWorkload>(*concatQueueDescriptor, info); |
| 203 | } |
| 204 | case LayerType::Constant : |
| 205 | { |
| 206 | auto constantQueueDescriptor = PolymorphicDowncast<const ConstantQueueDescriptor*>(&descriptor); |
| 207 | return std::make_unique<NeonConstantWorkload>(*constantQueueDescriptor, info); |
| 208 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 209 | case LayerType::ConvertFp16ToFp32 : |
| 210 | { |
| 211 | auto convertFp16ToFp32QueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 212 | = PolymorphicDowncast<const ConvertFp16ToFp32QueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 213 | return std::make_unique<NeonConvertFp16ToFp32Workload>(*convertFp16ToFp32QueueDescriptor, info); |
| 214 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 215 | case LayerType::ConvertFp32ToFp16 : |
| 216 | { |
| 217 | auto convertFp32ToFp16QueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 218 | = PolymorphicDowncast<const ConvertFp32ToFp16QueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 219 | return std::make_unique<NeonConvertFp32ToFp16Workload>(*convertFp32ToFp16QueueDescriptor, info); |
| 220 | } |
| 221 | case LayerType::Convolution2d : |
| 222 | { |
| 223 | auto convolution2dQueueDescriptor = PolymorphicDowncast<const Convolution2dQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 224 | bool isFastMathEnabled = false; |
| 225 | if (m_ModelContextPtr) |
| 226 | { |
| 227 | if (m_ModelContextPtr.get() != nullptr) |
| 228 | { |
| 229 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 230 | if (modelOptions) |
| 231 | { |
| 232 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | return std::make_unique<NeonConvolution2dWorkload>(*convolution2dQueueDescriptor, |
| 237 | info, |
| 238 | m_MemoryManager->GetIntraLayerManager(), |
| 239 | isFastMathEnabled); |
| 240 | } |
| 241 | case LayerType::Convolution3d : |
| 242 | { |
| 243 | auto convolution3dQueueDescriptor = PolymorphicDowncast<const Convolution3dQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 244 | bool isFastMathEnabled = false; |
| 245 | if (m_ModelContextPtr) |
| 246 | { |
| 247 | if (m_ModelContextPtr.get() != nullptr) |
| 248 | { |
| 249 | auto modelOptions = dynamic_cast<NeonBackendModelContext*>(m_ModelContextPtr.get()); |
| 250 | if (modelOptions) |
| 251 | { |
| 252 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | return std::make_unique<NeonConvolution3dWorkload>(*convolution3dQueueDescriptor, |
| 257 | info, |
| 258 | m_MemoryManager->GetIntraLayerManager(), |
| 259 | isFastMathEnabled); |
| 260 | } |
| 261 | case LayerType::Debug : |
| 262 | { |
| 263 | auto debugQueueDescriptor = PolymorphicDowncast<const DebugQueueDescriptor*>(&descriptor); |
| 264 | return MakeWorkloadHelper<NullWorkload, NullWorkload>(*debugQueueDescriptor, info); |
| 265 | } |
| 266 | case LayerType::DepthToSpace : |
| 267 | { |
| 268 | auto depthToSpaceQueueDescriptor = PolymorphicDowncast<const DepthToSpaceQueueDescriptor*>(&descriptor); |
| 269 | return std::make_unique<NeonDepthToSpaceWorkload>(*depthToSpaceQueueDescriptor, info); |
| 270 | } |
| 271 | case LayerType::DepthwiseConvolution2d : |
| 272 | { |
| 273 | auto depthwiseConvolution2dQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 274 | = PolymorphicDowncast<const DepthwiseConvolution2dQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 275 | return std::make_unique<NeonDepthwiseConvolutionWorkload>(*depthwiseConvolution2dQueueDescriptor, info); |
| 276 | } |
| 277 | case LayerType::Dequantize : |
| 278 | { |
| 279 | auto dequantizeQueueDescriptor = PolymorphicDowncast<const DequantizeQueueDescriptor*>(&descriptor); |
| 280 | return std::make_unique<NeonDequantizeWorkload>(*dequantizeQueueDescriptor, info); |
| 281 | } |
| 282 | case LayerType::DetectionPostProcess : |
| 283 | { |
| 284 | auto detectionPostProcessQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 285 | = PolymorphicDowncast<const DetectionPostProcessQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 286 | return MakeWorkloadHelper<NullWorkload, NullWorkload>(*detectionPostProcessQueueDescriptor, info); |
| 287 | } |
| 288 | case LayerType::Division : |
| 289 | { |
| 290 | auto divisionQueueDescriptor = PolymorphicDowncast<const DivisionQueueDescriptor*>(&descriptor); |
| 291 | return std::make_unique<NeonDivisionWorkload>(*divisionQueueDescriptor, info); |
| 292 | } |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 293 | case LayerType::ElementwiseBinary : |
| 294 | { |
| 295 | auto elementwiseBinaryQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 296 | = PolymorphicDowncast<const ElementwiseBinaryQueueDescriptor*>(&descriptor); |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 297 | switch (elementwiseBinaryQueueDescriptor->m_Parameters.m_Operation) |
| 298 | { |
| 299 | case BinaryOperation::Add: |
| 300 | { |
| 301 | AdditionQueueDescriptor additionQueueDescriptor; |
| 302 | additionQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 303 | additionQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 304 | return std::make_unique<NeonAdditionWorkload>(additionQueueDescriptor, info); |
| 305 | } |
| 306 | case BinaryOperation::Div: |
| 307 | { |
| 308 | DivisionQueueDescriptor divisionQueueDescriptor; |
| 309 | divisionQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 310 | divisionQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 311 | return std::make_unique<NeonDivisionWorkload>(divisionQueueDescriptor, info); |
| 312 | } |
| 313 | case BinaryOperation::Maximum: |
| 314 | { |
| 315 | MaximumQueueDescriptor maximumQueueDescriptor; |
| 316 | maximumQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 317 | maximumQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 318 | return std::make_unique<NeonMaximumWorkload>(maximumQueueDescriptor, info); |
| 319 | } |
| 320 | case BinaryOperation::Minimum: |
| 321 | { |
| 322 | MinimumQueueDescriptor minimumQueueDescriptor; |
| 323 | minimumQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 324 | minimumQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 325 | return std::make_unique<NeonMinimumWorkload>(minimumQueueDescriptor, info); |
| 326 | } |
| 327 | case BinaryOperation::Mul: |
| 328 | { |
| 329 | MultiplicationQueueDescriptor multiplicationQueueDescriptor; |
| 330 | multiplicationQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 331 | multiplicationQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 332 | return std::make_unique<NeonMultiplicationWorkload>(multiplicationQueueDescriptor, info); |
| 333 | } |
John Mcloughlin | 34c1c38 | 2023-05-17 15:08:36 +0100 | [diff] [blame] | 334 | case BinaryOperation::Power: |
| 335 | case BinaryOperation::SqDiff: |
| 336 | { |
| 337 | return std::make_unique<NeonElementwiseBinaryWorkload>(*elementwiseBinaryQueueDescriptor, info); |
| 338 | } |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 339 | case BinaryOperation::Sub: |
| 340 | { |
| 341 | SubtractionQueueDescriptor subtractionQueueDescriptor; |
| 342 | subtractionQueueDescriptor.m_Inputs = descriptor.m_Inputs; |
| 343 | subtractionQueueDescriptor.m_Outputs = descriptor.m_Outputs; |
| 344 | return std::make_unique<NeonSubtractionWorkload>(subtractionQueueDescriptor, info); |
| 345 | } |
| 346 | default: |
| 347 | return nullptr; |
| 348 | } |
| 349 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 350 | case LayerType::ElementwiseUnary : |
| 351 | { |
| 352 | auto elementwiseUnaryQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 353 | = PolymorphicDowncast<const ElementwiseUnaryQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 354 | switch(elementwiseUnaryQueueDescriptor->m_Parameters.m_Operation) |
| 355 | { |
| 356 | case UnaryOperation::Abs: |
| 357 | { |
| 358 | AbsQueueDescriptor absQueueDescriptor; |
| 359 | absQueueDescriptor.m_Inputs = elementwiseUnaryQueueDescriptor->m_Inputs; |
| 360 | absQueueDescriptor.m_Outputs = elementwiseUnaryQueueDescriptor->m_Outputs; |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 361 | return std::make_unique<NeonAbsWorkload>(absQueueDescriptor, info); |
| 362 | } |
| 363 | case UnaryOperation::Exp: |
| 364 | return std::make_unique<NeonExpWorkload>(*elementwiseUnaryQueueDescriptor, info); |
| 365 | case UnaryOperation::LogicalNot: |
| 366 | return std::make_unique<NeonLogicalNotWorkload>(*elementwiseUnaryQueueDescriptor, info); |
| 367 | case UnaryOperation::Log: |
| 368 | return std::make_unique<NeonLogWorkload>(*elementwiseUnaryQueueDescriptor, info); |
| 369 | case UnaryOperation::Neg: |
| 370 | return std::make_unique<NeonNegWorkload>(*elementwiseUnaryQueueDescriptor, info); |
| 371 | case UnaryOperation::Rsqrt: |
| 372 | { |
| 373 | RsqrtQueueDescriptor rsqrtQueueDescriptor; |
| 374 | rsqrtQueueDescriptor.m_Inputs = elementwiseUnaryQueueDescriptor->m_Inputs; |
| 375 | rsqrtQueueDescriptor.m_Outputs = elementwiseUnaryQueueDescriptor->m_Outputs; |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 376 | return std::make_unique<NeonRsqrtWorkload>(rsqrtQueueDescriptor, info); |
| 377 | } |
| 378 | case UnaryOperation::Sin: |
| 379 | return std::make_unique<NeonSinWorkload>(*elementwiseUnaryQueueDescriptor, info); |
Teresa Charlin | 0302723 | 2022-05-09 17:27:08 +0100 | [diff] [blame] | 380 | case UnaryOperation::Sqrt: |
| 381 | return std::make_unique<NeonSqrtWorkload>(*elementwiseUnaryQueueDescriptor, info); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 382 | default: |
| 383 | return nullptr; |
| 384 | } |
| 385 | } |
| 386 | case LayerType::Fill : |
| 387 | { |
| 388 | auto fillQueueDescriptor = PolymorphicDowncast<const FillQueueDescriptor*>(&descriptor); |
| 389 | return std::make_unique<NeonFillWorkload>(*fillQueueDescriptor, info); |
| 390 | } |
| 391 | case LayerType::Floor : |
| 392 | { |
| 393 | auto floorQueueDescriptor = PolymorphicDowncast<const FloorQueueDescriptor*>(&descriptor); |
| 394 | return MakeWorkloadHelper<NeonFloorFloatWorkload, NullWorkload>(*floorQueueDescriptor, info); |
| 395 | } |
| 396 | case LayerType::FullyConnected : |
| 397 | { |
| 398 | auto fullyConnectedQueueDescriptor = PolymorphicDowncast<const FullyConnectedQueueDescriptor*>(&descriptor); |
| 399 | return std::make_unique<NeonFullyConnectedWorkload>(*fullyConnectedQueueDescriptor, |
| 400 | info, |
| 401 | m_MemoryManager->GetIntraLayerManager()); |
| 402 | } |
Teresa Charlin | 9145e38 | 2023-08-17 18:44:58 +0100 | [diff] [blame] | 403 | case LayerType::Fused : |
| 404 | { |
| 405 | auto fusedQueueDescriptor = PolymorphicDowncast<const FusedQueueDescriptor*>(&descriptor); |
| 406 | return std::make_unique<NeonFusedWorkload>(*fusedQueueDescriptor, info); |
| 407 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 408 | case LayerType::Gather : |
| 409 | { |
| 410 | auto gatherQueueDescriptor = PolymorphicDowncast<const GatherQueueDescriptor*>(&descriptor); |
| 411 | return std::make_unique<NeonGatherWorkload>(*gatherQueueDescriptor, info); |
| 412 | } |
Teresa Charlin | bd22c7d | 2022-04-26 18:14:12 +0100 | [diff] [blame] | 413 | case LayerType::GatherNd : |
| 414 | { |
| 415 | auto gatherNdQueueDescriptor = PolymorphicDowncast<const GatherNdQueueDescriptor*>(&descriptor); |
| 416 | return std::make_unique<NeonGatherNdWorkload>(*gatherNdQueueDescriptor, info); |
| 417 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 418 | case LayerType::Input : |
| 419 | { |
| 420 | auto inputQueueDescriptor = PolymorphicDowncast<const InputQueueDescriptor*>(&descriptor); |
| 421 | return std::make_unique<CopyMemGenericWorkload>(*inputQueueDescriptor, info); |
| 422 | } |
| 423 | case LayerType::InstanceNormalization : |
| 424 | { |
| 425 | auto instanceNormalizationQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 426 | = PolymorphicDowncast<const InstanceNormalizationQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 427 | return std::make_unique<NeonInstanceNormalizationWorkload>(*instanceNormalizationQueueDescriptor, info); |
| 428 | } |
| 429 | case LayerType::L2Normalization : |
| 430 | { |
| 431 | auto l2NormalizationQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 432 | = PolymorphicDowncast<const L2NormalizationQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 433 | return MakeWorkloadHelper<NeonL2NormalizationFloatWorkload, NullWorkload> |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 434 | (*l2NormalizationQueueDescriptor, info, m_MemoryManager->GetIntraLayerManager()); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 435 | } |
| 436 | case LayerType::LogSoftmax : |
| 437 | { |
| 438 | auto logSoftmaxQueueDescriptor = PolymorphicDowncast<const LogSoftmaxQueueDescriptor*>(&descriptor); |
| 439 | return std::make_unique<NeonLogSoftmaxWorkload>(*logSoftmaxQueueDescriptor, |
| 440 | info, |
| 441 | m_MemoryManager->GetIntraLayerManager()); |
| 442 | } |
| 443 | case LayerType::LogicalBinary : |
| 444 | { |
| 445 | auto logicalBinaryQueueDescriptor = PolymorphicDowncast<const LogicalBinaryQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 446 | switch(logicalBinaryQueueDescriptor->m_Parameters.m_Operation) |
| 447 | { |
| 448 | case LogicalBinaryOperation::LogicalAnd: |
| 449 | return std::make_unique<NeonLogicalAndWorkload>(*logicalBinaryQueueDescriptor, info); |
| 450 | case LogicalBinaryOperation::LogicalOr: |
| 451 | return std::make_unique<NeonLogicalOrWorkload>(*logicalBinaryQueueDescriptor, info); |
| 452 | default: |
| 453 | return nullptr; |
| 454 | } |
| 455 | } |
| 456 | case LayerType::Lstm : |
| 457 | { |
| 458 | auto lstmQueueDescriptor = PolymorphicDowncast<const LstmQueueDescriptor*>(&descriptor); |
| 459 | return MakeWorkloadHelper<NeonLstmFloatWorkload, NullWorkload>(*lstmQueueDescriptor, info); |
| 460 | } |
| 461 | case LayerType::Maximum : |
| 462 | { |
| 463 | auto maximumQueueDescriptor = PolymorphicDowncast<const MaximumQueueDescriptor*>(&descriptor); |
| 464 | return std::make_unique<NeonMaximumWorkload>(*maximumQueueDescriptor, info); |
| 465 | } |
| 466 | case LayerType::Mean : |
| 467 | { |
| 468 | auto meanQueueDescriptor = PolymorphicDowncast<const MeanQueueDescriptor*>(&descriptor); |
| 469 | return std::make_unique<NeonMeanWorkload>(*meanQueueDescriptor, info); |
| 470 | } |
| 471 | case LayerType::MemCopy : |
| 472 | { |
| 473 | auto memCopyQueueDescriptor = PolymorphicDowncast<const MemCopyQueueDescriptor*>(&descriptor); |
| 474 | if (memCopyQueueDescriptor->m_Inputs.empty() || !memCopyQueueDescriptor->m_Inputs[0]) |
| 475 | { |
| 476 | throw InvalidArgumentException("NeonWorkloadFactory: Invalid null input for MemCopy workload"); |
| 477 | } |
| 478 | return MakeWorkloadHelper<CopyMemGenericWorkload, CopyMemGenericWorkload>(*memCopyQueueDescriptor, info); |
| 479 | } |
| 480 | case LayerType::MemImport : |
| 481 | { |
| 482 | auto memImportQueueDescriptor = PolymorphicDowncast<const MemImportQueueDescriptor*>(&descriptor); |
| 483 | if (memImportQueueDescriptor->m_Inputs.empty() || !memImportQueueDescriptor->m_Inputs[0]) |
| 484 | { |
| 485 | throw InvalidArgumentException("NeonWorkloadFactory: Invalid null input for MemImport workload"); |
| 486 | } |
| 487 | return std::make_unique<ImportMemGenericWorkload>(*memImportQueueDescriptor, info); |
| 488 | } |
| 489 | case LayerType::Minimum : |
| 490 | { |
| 491 | auto minimumQueueDescriptor = PolymorphicDowncast<const MinimumQueueDescriptor*>(&descriptor); |
| 492 | return std::make_unique<NeonMinimumWorkload>(*minimumQueueDescriptor, info); |
| 493 | } |
| 494 | case LayerType::Multiplication : |
| 495 | { |
| 496 | auto multiplicationQueueDescriptor = PolymorphicDowncast<const MultiplicationQueueDescriptor*>(&descriptor); |
| 497 | return std::make_unique<NeonMultiplicationWorkload>(*multiplicationQueueDescriptor, info); |
| 498 | } |
| 499 | case LayerType::Normalization : |
| 500 | { |
| 501 | auto normalizationQueueDescriptor = PolymorphicDowncast<const NormalizationQueueDescriptor*>(&descriptor); |
| 502 | return MakeWorkloadHelper<NeonNormalizationFloatWorkload, NullWorkload> |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 503 | (*normalizationQueueDescriptor, info, m_MemoryManager->GetIntraLayerManager()); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 504 | } |
| 505 | case LayerType::Output : |
| 506 | { |
| 507 | auto outputQueueDescriptor = PolymorphicDowncast<const OutputQueueDescriptor*>(&descriptor); |
| 508 | return std::make_unique<CopyMemGenericWorkload>(*outputQueueDescriptor, info); |
| 509 | } |
| 510 | case LayerType::Pad : |
| 511 | { |
| 512 | auto padQueueDescriptor = PolymorphicDowncast<const PadQueueDescriptor*>(&descriptor); |
| 513 | return std::make_unique<NeonPadWorkload>(*padQueueDescriptor, info); |
| 514 | } |
| 515 | case LayerType::Permute : |
| 516 | { |
| 517 | auto permuteQueueDescriptor = PolymorphicDowncast<const PermuteQueueDescriptor*>(&descriptor); |
| 518 | return std::make_unique<NeonPermuteWorkload>(*permuteQueueDescriptor, info); |
| 519 | } |
| 520 | case LayerType::Pooling2d : |
| 521 | { |
| 522 | auto pooling2dQueueDescriptor = PolymorphicDowncast<const Pooling2dQueueDescriptor*>(&descriptor); |
| 523 | return std::make_unique<NeonPooling2dWorkload>(*pooling2dQueueDescriptor, info); |
| 524 | } |
Ryan OShea | 19e7942 | 2022-05-04 00:38:03 +0100 | [diff] [blame] | 525 | case LayerType::Pooling3d : |
| 526 | { |
| 527 | auto pooling3dQueueDescriptor = PolymorphicDowncast<const Pooling3dQueueDescriptor*>(&descriptor); |
| 528 | return std::make_unique<NeonPooling3dWorkload>(*pooling3dQueueDescriptor, info); |
| 529 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 530 | case LayerType::PreCompiled : |
| 531 | { |
| 532 | auto preCompiledQueueDescriptor = PolymorphicDowncast<const PreCompiledQueueDescriptor*>(&descriptor); |
| 533 | return MakeWorkloadHelper<NullWorkload, NullWorkload>(*preCompiledQueueDescriptor, info); |
| 534 | } |
| 535 | case LayerType::Prelu : |
| 536 | { |
| 537 | auto preluQueueDescriptor = PolymorphicDowncast<const PreluQueueDescriptor*>(&descriptor); |
| 538 | return std::make_unique<NeonPreluWorkload>(*preluQueueDescriptor, info); |
| 539 | } |
| 540 | case LayerType::QLstm : |
| 541 | { |
| 542 | auto qLstmQueueDescriptor = PolymorphicDowncast<const QLstmQueueDescriptor*>(&descriptor); |
| 543 | return std::make_unique<NeonQLstmWorkload>(*qLstmQueueDescriptor, info); |
| 544 | } |
| 545 | case LayerType::Quantize : |
| 546 | { |
| 547 | auto quantizeQueueDescriptor = PolymorphicDowncast<const QuantizeQueueDescriptor*>(&descriptor); |
| 548 | return std::make_unique<NeonQuantizeWorkload>(*quantizeQueueDescriptor, info); |
| 549 | } |
| 550 | case LayerType::QuantizedLstm : |
| 551 | { |
| 552 | auto quantizedLstmQueueDescriptor = PolymorphicDowncast<const QuantizedLstmQueueDescriptor*>(&descriptor); |
| 553 | return std::make_unique<NeonQuantizedLstmWorkload>(*quantizedLstmQueueDescriptor, info); |
| 554 | } |
| 555 | case LayerType::Rank : |
| 556 | { |
| 557 | auto rankQueueDescriptor = PolymorphicDowncast<const RankQueueDescriptor*>(&descriptor); |
| 558 | return std::make_unique<NeonRankWorkload>(*rankQueueDescriptor, info); |
| 559 | } |
| 560 | case LayerType::Reduce : |
| 561 | { |
| 562 | auto reduceQueueDescriptor = PolymorphicDowncast<const ReduceQueueDescriptor*>(&descriptor); |
| 563 | return std::make_unique<NeonReduceWorkload>(*reduceQueueDescriptor, info); |
| 564 | } |
| 565 | case LayerType::Reshape : |
| 566 | { |
| 567 | auto reshapeQueueDescriptor = PolymorphicDowncast<const ReshapeQueueDescriptor*>(&descriptor); |
| 568 | return std::make_unique<NeonReshapeWorkload>(*reshapeQueueDescriptor, info); |
| 569 | } |
| 570 | case LayerType::Resize : |
| 571 | { |
| 572 | auto resizeQueueDescriptor = PolymorphicDowncast<const ResizeQueueDescriptor*>(&descriptor); |
| 573 | return std::make_unique<NeonResizeWorkload>(*resizeQueueDescriptor, info); |
| 574 | } |
| 575 | case LayerType::Slice : |
| 576 | { |
| 577 | auto sliceQueueDescriptor = PolymorphicDowncast<const SliceQueueDescriptor*>(&descriptor); |
| 578 | return std::make_unique<NeonSliceWorkload>(*sliceQueueDescriptor, info); |
| 579 | } |
| 580 | case LayerType::Softmax : |
| 581 | { |
| 582 | auto softmaxQueueDescriptor = PolymorphicDowncast<const SoftmaxQueueDescriptor*>(&descriptor); |
| 583 | return std::make_unique<NeonSoftmaxWorkload>(*softmaxQueueDescriptor, |
| 584 | info, |
| 585 | m_MemoryManager->GetIntraLayerManager()); |
| 586 | } |
| 587 | case LayerType::SpaceToBatchNd : |
| 588 | { |
| 589 | auto spaceToBatchNdQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 590 | = PolymorphicDowncast<const SpaceToBatchNdQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 591 | return std::make_unique<NeonSpaceToBatchNdWorkload>(*spaceToBatchNdQueueDescriptor, info); |
| 592 | } |
| 593 | case LayerType::SpaceToDepth : |
| 594 | { |
| 595 | auto spaceToDepthQueueDescriptor = PolymorphicDowncast<const SpaceToDepthQueueDescriptor*>(&descriptor); |
| 596 | return std::make_unique<NeonSpaceToDepthWorkload>(*spaceToDepthQueueDescriptor, info); |
| 597 | } |
| 598 | case LayerType::Splitter : |
| 599 | { |
| 600 | auto splitterQueueDescriptor = PolymorphicDowncast<const SplitterQueueDescriptor*>(&descriptor); |
| 601 | return std::make_unique<NeonSplitterWorkload>(*splitterQueueDescriptor, info); |
| 602 | } |
| 603 | case LayerType::Stack : |
| 604 | { |
| 605 | auto stackQueueDescriptor = PolymorphicDowncast<const StackQueueDescriptor*>(&descriptor); |
| 606 | return std::make_unique<NeonStackWorkload>(*stackQueueDescriptor, info); |
| 607 | } |
| 608 | case LayerType::StridedSlice : |
| 609 | { |
| 610 | auto stridedSliceQueueDescriptor = PolymorphicDowncast<const StridedSliceQueueDescriptor*>(&descriptor); |
| 611 | return std::make_unique<NeonStridedSliceWorkload>(*stridedSliceQueueDescriptor, info); |
| 612 | } |
| 613 | case LayerType::Subtraction : |
| 614 | { |
| 615 | auto subtractionQueueDescriptor = PolymorphicDowncast<const SubtractionQueueDescriptor*>(&descriptor); |
| 616 | return std::make_unique<NeonSubtractionWorkload>(*subtractionQueueDescriptor, info); |
| 617 | } |
David Monahan | 36e6eae | 2023-07-26 18:37:45 +0100 | [diff] [blame] | 618 | case LayerType::Tile: |
| 619 | { |
| 620 | auto tileQueueDescriptor = PolymorphicDowncast<const TileQueueDescriptor*>(&descriptor); |
| 621 | return std::make_unique<NeonTileWorkload>(*tileQueueDescriptor, info); |
| 622 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 623 | case LayerType::Transpose : |
| 624 | { |
| 625 | auto transposeQueueDescriptor = PolymorphicDowncast<const TransposeQueueDescriptor*>(&descriptor); |
| 626 | return std::make_unique<NeonTransposeWorkload>(*transposeQueueDescriptor, info); |
| 627 | } |
| 628 | case LayerType::TransposeConvolution2d : |
| 629 | { |
| 630 | auto transposeConvolution2dQueueDescriptor |
Cian McGriskin | 7894ef9 | 2023-08-01 14:04:09 +0100 | [diff] [blame] | 631 | = PolymorphicDowncast<const TransposeConvolution2dQueueDescriptor*>(&descriptor); |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 632 | return std::make_unique<NeonTransposeConvolution2dWorkload>(*transposeConvolution2dQueueDescriptor, |
| 633 | info, |
| 634 | m_MemoryManager->GetIntraLayerManager()); |
| 635 | } |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 636 | case LayerType::UnidirectionalSequenceLstm : |
| 637 | { |
| 638 | auto desc = PolymorphicDowncast<const UnidirectionalSequenceLstmQueueDescriptor*>(&descriptor); |
Mike Kelly | 1299496 | 2022-04-21 11:57:09 +0100 | [diff] [blame] | 639 | if ((info.m_InputTensorInfos[0].GetDataType() == armnn::DataType::Float32) && |
| 640 | (info.m_InputTensorInfos[1].GetDataType() == armnn::DataType::Float32) && |
| 641 | (info.m_InputTensorInfos[2].GetDataType() == armnn::DataType::Float32) && |
| 642 | (info.m_OutputTensorInfos[0].GetDataType() == armnn::DataType::Float32) && |
| 643 | (info.m_OutputTensorInfos[1].GetDataType() == armnn::DataType::Float32) && |
| 644 | (info.m_OutputTensorInfos[2].GetDataType() == armnn::DataType::Float32)) |
| 645 | { |
| 646 | return std::make_unique<NeonUnidirectionalSequenceLstmFloatWorkload>(*desc, info); |
| 647 | } |
| 648 | else |
| 649 | { |
| 650 | return std::make_unique<NeonUnidirectionalSequenceLstmWorkload>(*desc, info); |
| 651 | } |
Cathal Corbett | fd5bec4 | 2022-03-03 15:13:23 +0000 | [diff] [blame] | 652 | } |
Teresa Charlin | 611c7fb | 2022-01-07 09:47:29 +0000 | [diff] [blame] | 653 | default: |
| 654 | return nullptr; |
| 655 | } |
| 656 | } |
| 657 | |
Aron Virginas-Tar | 5605519 | 2018-11-12 18:10:43 +0000 | [diff] [blame] | 658 | } // namespace armnn |