Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd. 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 | // |
| 5 | #pragma once |
| 6 | |
Matteo Martincigh | e5b8eb9 | 2019-11-28 15:45:42 +0000 | [diff] [blame] | 7 | #include <armnn/backends/CpuTensorHandleFwd.hpp> |
| 8 | #include <armnn/backends/ITensorHandle.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 10 | #include <InternalTypes.hpp> |
| 11 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 12 | #include <armnn/Deprecated.hpp> |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 13 | #include <armnn/Descriptors.hpp> |
| 14 | #include <armnn/Exceptions.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 15 | #include <armnn/Types.hpp> |
| 16 | #include <armnn/Tensor.hpp> |
David Beck | 0dbe0ee | 2018-09-24 15:59:27 +0100 | [diff] [blame] | 17 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 18 | #include <backendsCommon/WorkloadInfo.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 19 | |
| 20 | namespace armnn |
| 21 | { |
| 22 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 23 | //A helper function that returns the bias data type required for given input data type. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | DataType GetBiasDataType(DataType inputDataType); |
| 25 | |
| 26 | struct WorkloadInfo; |
| 27 | |
| 28 | struct QueueDescriptor |
| 29 | { |
| 30 | std::vector<ITensorHandle*> m_Inputs; |
| 31 | std::vector<ITensorHandle*> m_Outputs; |
| 32 | |
| 33 | void ValidateInputsOutputs(const std::string& descName, |
Narumol Prangnawarat | 867eba5 | 2020-02-03 12:29:56 +0000 | [diff] [blame] | 34 | unsigned int numExpectedIn, |
| 35 | unsigned int numExpectedOut) const; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 36 | |
| 37 | |
| 38 | protected: |
| 39 | ~QueueDescriptor() = default; |
| 40 | QueueDescriptor() = default; |
| 41 | QueueDescriptor(QueueDescriptor const&) = default; |
| 42 | QueueDescriptor& operator=(QueueDescriptor const&) = default; |
| 43 | }; |
| 44 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 45 | // Base class for queue descriptors which contain parameters. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 46 | template <typename LayerDescriptor> |
| 47 | struct QueueDescriptorWithParameters : public QueueDescriptor |
| 48 | { |
| 49 | LayerDescriptor m_Parameters; |
| 50 | |
| 51 | protected: |
| 52 | ~QueueDescriptorWithParameters() = default; |
| 53 | QueueDescriptorWithParameters() = default; |
| 54 | QueueDescriptorWithParameters(QueueDescriptorWithParameters const&) = default; |
| 55 | QueueDescriptorWithParameters& operator=(QueueDescriptorWithParameters const&) = default; |
| 56 | }; |
| 57 | |
| 58 | struct MemCopyQueueDescriptor : QueueDescriptor |
| 59 | { |
| 60 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 61 | }; |
| 62 | |
| 63 | using InputQueueDescriptor = MemCopyQueueDescriptor; |
| 64 | using OutputQueueDescriptor = MemCopyQueueDescriptor; |
| 65 | |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame] | 66 | struct MemImportQueueDescriptor : QueueDescriptor |
| 67 | { |
| 68 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 69 | }; |
| 70 | |
| 71 | struct MemSyncQueueDescriptor : QueueDescriptor |
| 72 | { |
| 73 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 74 | }; |
| 75 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 76 | // Softmax layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 77 | struct SoftmaxQueueDescriptor : QueueDescriptorWithParameters<SoftmaxDescriptor> |
| 78 | { |
| 79 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 80 | }; |
| 81 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 82 | // Splitter layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 83 | struct SplitterQueueDescriptor : QueueDescriptorWithParameters<ViewsDescriptor> |
| 84 | { |
| 85 | struct ViewOrigin |
| 86 | { |
| 87 | ViewOrigin() {} |
| 88 | ViewOrigin(std::vector<unsigned int> const& origin) : m_Origin(origin) {} |
| 89 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 90 | //View origin (size of the vector is the same as number of dimensions of the view). |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 91 | std::vector<unsigned int> m_Origin; |
| 92 | }; |
| 93 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 94 | //View defines a tensor that will be carved from the input tensor. |
| 95 | //View origins are stored here, the extents are defined by sizes of the output tensors. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 96 | std::vector<ViewOrigin> m_ViewOrigins; |
| 97 | |
| 98 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 99 | }; |
| 100 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 101 | // Concat layer workload data. |
| 102 | struct ConcatQueueDescriptor : QueueDescriptorWithParameters<OriginsDescriptor> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 103 | { |
| 104 | struct ViewOrigin |
| 105 | { |
| 106 | ViewOrigin() {} |
| 107 | ViewOrigin(const std::vector<unsigned int>& origin) : m_Origin(origin) {} |
| 108 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 109 | //View origin (size of the vector is the same as number of dimensions of the view). |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 110 | std::vector<unsigned int> m_Origin; |
| 111 | }; |
| 112 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 113 | //View defines a sub-area of the output tensor that will be filled with the corresponding input tensor. |
| 114 | //View origins are stored here, the extents are defined by sizes of the input tensors. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 115 | std::vector<ViewOrigin> m_ViewOrigins; |
| 116 | |
| 117 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 118 | }; |
| 119 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 120 | // Deprecated. Use ConcatQueueDescriptor instead |
| 121 | using MergerQueueDescriptor = ConcatQueueDescriptor; |
| 122 | |
Matthew Jackson | 2b8c1da | 2019-07-04 14:59:16 +0100 | [diff] [blame] | 123 | // Stack layer workload data. |
| 124 | struct StackQueueDescriptor : QueueDescriptorWithParameters<StackDescriptor> |
| 125 | { |
| 126 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 127 | }; |
| 128 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 129 | // Activation layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 130 | struct ActivationQueueDescriptor : QueueDescriptorWithParameters<ActivationDescriptor> |
| 131 | { |
| 132 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 133 | }; |
| 134 | |
Nikhil Raj | ee391d5 | 2019-09-05 17:50:44 +0100 | [diff] [blame] | 135 | struct ArgMinMaxQueueDescriptor : QueueDescriptorWithParameters<ArgMinMaxDescriptor> |
| 136 | { |
| 137 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 138 | }; |
| 139 | |
Ryan OShea | ec6c680 | 2020-06-05 17:17:06 +0100 | [diff] [blame] | 140 | // Fill layer workload data. |
| 141 | struct FillQueueDescriptor : QueueDescriptorWithParameters<FillDescriptor> |
| 142 | { |
Ryan OShea | ec6c680 | 2020-06-05 17:17:06 +0100 | [diff] [blame] | 143 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 144 | }; |
| 145 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 146 | // Fully connected layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 147 | struct FullyConnectedQueueDescriptor : QueueDescriptorWithParameters<FullyConnectedDescriptor> |
| 148 | { |
| 149 | FullyConnectedQueueDescriptor() |
| 150 | : m_Weight(nullptr) |
| 151 | , m_Bias(nullptr) |
| 152 | { |
| 153 | } |
| 154 | |
| 155 | const ConstCpuTensorHandle* m_Weight; |
| 156 | const ConstCpuTensorHandle* m_Bias; |
| 157 | |
| 158 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 159 | }; |
| 160 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 161 | // Permute layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 162 | struct PermuteQueueDescriptor : QueueDescriptorWithParameters<PermuteDescriptor> |
| 163 | { |
| 164 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 165 | }; |
| 166 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 167 | // Pooling 2D layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 168 | struct Pooling2dQueueDescriptor : QueueDescriptorWithParameters<Pooling2dDescriptor> |
| 169 | { |
| 170 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 171 | }; |
| 172 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 173 | // Convolution 2D layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 174 | struct Convolution2dQueueDescriptor : QueueDescriptorWithParameters<Convolution2dDescriptor> |
| 175 | { |
| 176 | Convolution2dQueueDescriptor() |
| 177 | : m_Weight(nullptr) |
| 178 | , m_Bias(nullptr) |
| 179 | { |
| 180 | } |
| 181 | |
| 182 | const ConstCpuTensorHandle* m_Weight; |
| 183 | const ConstCpuTensorHandle* m_Bias; |
| 184 | |
| 185 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 186 | }; |
| 187 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 188 | // Depthwise Convolution 2D layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 189 | struct DepthwiseConvolution2dQueueDescriptor : QueueDescriptorWithParameters<DepthwiseConvolution2dDescriptor> |
| 190 | { |
| 191 | DepthwiseConvolution2dQueueDescriptor() |
| 192 | : m_Weight(nullptr) |
| 193 | , m_Bias(nullptr) |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | const ConstCpuTensorHandle* m_Weight; |
| 198 | const ConstCpuTensorHandle* m_Bias; |
| 199 | |
| 200 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 201 | }; |
| 202 | |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 203 | struct DetectionPostProcessQueueDescriptor : QueueDescriptorWithParameters<DetectionPostProcessDescriptor> |
| 204 | { |
Narumol Prangnawarat | bc67cef | 2019-01-31 15:31:54 +0000 | [diff] [blame] | 205 | DetectionPostProcessQueueDescriptor() |
| 206 | : m_Anchors(nullptr) |
| 207 | { |
| 208 | } |
| 209 | |
| 210 | const ConstCpuTensorHandle* m_Anchors; |
| 211 | |
Narumol Prangnawarat | 94dd5d8 | 2019-01-23 18:06:26 +0000 | [diff] [blame] | 212 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 213 | }; |
| 214 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 215 | // Normalization layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 216 | struct NormalizationQueueDescriptor : QueueDescriptorWithParameters<NormalizationDescriptor> |
| 217 | { |
| 218 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 219 | }; |
| 220 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 221 | // Add layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 222 | struct AdditionQueueDescriptor : QueueDescriptor |
| 223 | { |
| 224 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 225 | }; |
| 226 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 227 | // Multiplication layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 228 | struct MultiplicationQueueDescriptor : QueueDescriptor |
| 229 | { |
| 230 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 231 | }; |
| 232 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 233 | // Division layer workload data. |
| 234 | struct DivisionQueueDescriptor : QueueDescriptor |
| 235 | { |
| 236 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 237 | }; |
| 238 | |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 239 | // Subtraction layer workload data. |
| 240 | struct SubtractionQueueDescriptor : QueueDescriptor |
| 241 | { |
| 242 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 243 | }; |
| 244 | |
Nattapat Chaimanowong | 5a4304a | 2018-11-28 10:44:37 +0000 | [diff] [blame] | 245 | // Maximum layer workload data. |
| 246 | struct MaximumQueueDescriptor : QueueDescriptor |
| 247 | { |
| 248 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 249 | }; |
| 250 | |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 251 | // Mean layer workload data. |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 252 | struct MeanQueueDescriptor : QueueDescriptorWithParameters<MeanDescriptor> |
narpra01 | a6bf912 | 2018-09-10 09:50:09 +0100 | [diff] [blame] | 253 | { |
| 254 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 255 | }; |
| 256 | |
jimfly01 | 2c9322a | 2018-09-19 10:59:49 +0100 | [diff] [blame] | 257 | // Pad layer workload data |
| 258 | struct PadQueueDescriptor : QueueDescriptorWithParameters<PadDescriptor> |
| 259 | { |
| 260 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 261 | }; |
| 262 | |
Derek Lamberti | a9cca6a | 2019-03-25 15:41:58 +0000 | [diff] [blame] | 263 | struct QuantizeQueueDescriptor : QueueDescriptor |
| 264 | { |
| 265 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 266 | }; |
| 267 | |
Teresa Charlin | cedd34f | 2020-03-30 11:17:30 +0100 | [diff] [blame] | 268 | // Deprecated use ComparisonQueueDescriptor instead |
FrancisMurtagh | 2099595 | 2018-12-17 12:11:36 +0000 | [diff] [blame] | 269 | struct EqualQueueDescriptor : QueueDescriptor |
| 270 | { |
| 271 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 272 | }; |
| 273 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 274 | // Batch norm layer workload data. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 275 | struct BatchNormalizationQueueDescriptor : QueueDescriptorWithParameters<BatchNormalizationDescriptor> |
| 276 | { |
| 277 | BatchNormalizationQueueDescriptor() |
| 278 | : m_Mean(nullptr) |
| 279 | , m_Variance(nullptr) |
| 280 | , m_Beta(nullptr) |
| 281 | , m_Gamma(nullptr) |
| 282 | { |
| 283 | } |
| 284 | |
| 285 | const ConstCpuTensorHandle* m_Mean; |
| 286 | const ConstCpuTensorHandle* m_Variance; |
| 287 | const ConstCpuTensorHandle* m_Beta; |
| 288 | const ConstCpuTensorHandle* m_Gamma; |
| 289 | |
| 290 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 291 | }; |
| 292 | |
| 293 | struct ResizeBilinearQueueDescriptor : QueueDescriptorWithParameters<ResizeBilinearDescriptor> |
| 294 | { |
| 295 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 296 | }; |
| 297 | |
Teresa Charlin | a9075df | 2019-06-27 15:41:57 +0100 | [diff] [blame] | 298 | struct ResizeQueueDescriptor : QueueDescriptorWithParameters<ResizeDescriptor> |
| 299 | { |
| 300 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 301 | }; |
| 302 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 303 | struct FakeQuantizationQueueDescriptor : QueueDescriptorWithParameters<FakeQuantizationDescriptor> |
| 304 | { |
| 305 | FakeQuantizationQueueDescriptor() |
| 306 | : m_Min(nullptr) |
| 307 | , m_Max(nullptr) |
| 308 | { |
| 309 | } |
| 310 | |
| 311 | const ConstCpuTensorHandle* m_Min; |
| 312 | const ConstCpuTensorHandle* m_Max; |
| 313 | |
| 314 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 315 | }; |
| 316 | |
Kevin May | ce5045a | 2019-10-02 14:07:47 +0100 | [diff] [blame] | 317 | struct InstanceNormalizationQueueDescriptor : QueueDescriptorWithParameters<InstanceNormalizationDescriptor> |
| 318 | { |
Kevin May | ce5045a | 2019-10-02 14:07:47 +0100 | [diff] [blame] | 319 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 320 | }; |
| 321 | |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 322 | struct L2NormalizationQueueDescriptor : QueueDescriptorWithParameters<L2NormalizationDescriptor> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 323 | { |
| 324 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 325 | }; |
| 326 | |
Aron Virginas-Tar | f982dea | 2019-10-11 14:07:53 +0100 | [diff] [blame] | 327 | struct LogSoftmaxQueueDescriptor : QueueDescriptorWithParameters<LogSoftmaxDescriptor> |
| 328 | { |
| 329 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 330 | }; |
| 331 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 332 | struct ConstantQueueDescriptor : QueueDescriptor |
| 333 | { |
| 334 | ConstantQueueDescriptor() |
| 335 | : m_LayerOutput(nullptr) |
| 336 | { |
| 337 | } |
| 338 | |
| 339 | const ConstCpuTensorHandle* m_LayerOutput; |
| 340 | |
| 341 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 342 | }; |
| 343 | |
| 344 | struct ReshapeQueueDescriptor : QueueDescriptorWithParameters<ReshapeDescriptor> |
| 345 | { |
| 346 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 347 | }; |
| 348 | |
Nattapat Chaimanowong | 207ef9a | 2018-11-02 10:57:25 +0000 | [diff] [blame] | 349 | struct SpaceToBatchNdQueueDescriptor : QueueDescriptorWithParameters<SpaceToBatchNdDescriptor> |
| 350 | { |
| 351 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 352 | }; |
| 353 | |
Aron Virginas-Tar | 972af15 | 2019-06-11 14:14:03 +0100 | [diff] [blame] | 354 | struct SpaceToDepthQueueDescriptor : QueueDescriptorWithParameters<SpaceToDepthDescriptor> |
| 355 | { |
| 356 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 357 | }; |
| 358 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 359 | struct FloorQueueDescriptor : QueueDescriptor |
| 360 | { |
| 361 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 362 | }; |
| 363 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 364 | struct LstmQueueDescriptor : QueueDescriptorWithParameters<LstmDescriptor> |
| 365 | { |
| 366 | LstmQueueDescriptor() |
| 367 | : m_InputToInputWeights(nullptr) |
| 368 | , m_InputToForgetWeights(nullptr) |
| 369 | , m_InputToCellWeights(nullptr) |
| 370 | , m_InputToOutputWeights(nullptr) |
| 371 | , m_RecurrentToInputWeights(nullptr) |
| 372 | , m_RecurrentToForgetWeights(nullptr) |
| 373 | , m_RecurrentToCellWeights(nullptr) |
| 374 | , m_RecurrentToOutputWeights(nullptr) |
| 375 | , m_CellToInputWeights(nullptr) |
| 376 | , m_CellToForgetWeights(nullptr) |
| 377 | , m_CellToOutputWeights(nullptr) |
| 378 | , m_InputGateBias(nullptr) |
| 379 | , m_ForgetGateBias(nullptr) |
| 380 | , m_CellBias(nullptr) |
| 381 | , m_OutputGateBias(nullptr) |
| 382 | , m_ProjectionWeights(nullptr) |
| 383 | , m_ProjectionBias(nullptr) |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 384 | , m_InputLayerNormWeights(nullptr) |
| 385 | , m_ForgetLayerNormWeights(nullptr) |
| 386 | , m_CellLayerNormWeights(nullptr) |
| 387 | , m_OutputLayerNormWeights(nullptr) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 388 | { |
| 389 | } |
| 390 | |
| 391 | const ConstCpuTensorHandle* m_InputToInputWeights; |
| 392 | const ConstCpuTensorHandle* m_InputToForgetWeights; |
| 393 | const ConstCpuTensorHandle* m_InputToCellWeights; |
| 394 | const ConstCpuTensorHandle* m_InputToOutputWeights; |
| 395 | const ConstCpuTensorHandle* m_RecurrentToInputWeights; |
| 396 | const ConstCpuTensorHandle* m_RecurrentToForgetWeights; |
| 397 | const ConstCpuTensorHandle* m_RecurrentToCellWeights; |
| 398 | const ConstCpuTensorHandle* m_RecurrentToOutputWeights; |
| 399 | const ConstCpuTensorHandle* m_CellToInputWeights; |
| 400 | const ConstCpuTensorHandle* m_CellToForgetWeights; |
| 401 | const ConstCpuTensorHandle* m_CellToOutputWeights; |
| 402 | const ConstCpuTensorHandle* m_InputGateBias; |
| 403 | const ConstCpuTensorHandle* m_ForgetGateBias; |
| 404 | const ConstCpuTensorHandle* m_CellBias; |
| 405 | const ConstCpuTensorHandle* m_OutputGateBias; |
| 406 | const ConstCpuTensorHandle* m_ProjectionWeights; |
| 407 | const ConstCpuTensorHandle* m_ProjectionBias; |
Jan Eilers | 38e05bd | 2019-06-26 13:10:09 +0100 | [diff] [blame] | 408 | const ConstCpuTensorHandle* m_InputLayerNormWeights; |
| 409 | const ConstCpuTensorHandle* m_ForgetLayerNormWeights; |
| 410 | const ConstCpuTensorHandle* m_CellLayerNormWeights; |
| 411 | const ConstCpuTensorHandle* m_OutputLayerNormWeights; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 412 | |
| 413 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 414 | }; |
| 415 | |
Narumol Prangnawarat | 7ddbbae | 2020-03-13 10:26:05 +0000 | [diff] [blame] | 416 | struct ConvertBf16ToFp32QueueDescriptor : QueueDescriptor |
| 417 | { |
| 418 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 419 | }; |
| 420 | |
Narumol Prangnawarat | ea54a01 | 2020-03-16 16:36:10 +0000 | [diff] [blame] | 421 | struct ConvertFp32ToBf16QueueDescriptor : QueueDescriptor |
| 422 | { |
| 423 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 424 | }; |
| 425 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 426 | struct ConvertFp16ToFp32QueueDescriptor : QueueDescriptor |
| 427 | { |
| 428 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 429 | }; |
| 430 | |
| 431 | struct ConvertFp32ToFp16QueueDescriptor : QueueDescriptor |
| 432 | { |
| 433 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 434 | }; |
| 435 | |
Éanna Ó Catháin | 4e1e136 | 2018-11-12 11:36:34 +0000 | [diff] [blame] | 436 | struct BatchToSpaceNdQueueDescriptor : QueueDescriptorWithParameters<BatchToSpaceNdDescriptor> |
| 437 | { |
| 438 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 439 | }; |
Conor Kennedy | 430b5d8 | 2018-11-14 15:28:28 +0000 | [diff] [blame] | 440 | |
| 441 | struct StridedSliceQueueDescriptor : QueueDescriptorWithParameters<StridedSliceDescriptor> |
| 442 | { |
| 443 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 444 | }; |
| 445 | |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 446 | // Minimum layer workload data. |
kevmay01 | 9053969 | 2018-11-29 08:40:19 +0000 | [diff] [blame] | 447 | struct MinimumQueueDescriptor : QueueDescriptor |
| 448 | { |
| 449 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 450 | }; |
| 451 | |
Teresa Charlin | 2b030d9 | 2020-03-27 16:40:56 +0000 | [diff] [blame] | 452 | // Deprecated use ComparisonQueueDescriptor instead |
Matteo Martincigh | 59a950c | 2018-12-13 12:48:25 +0000 | [diff] [blame] | 453 | struct GreaterQueueDescriptor : QueueDescriptor |
| 454 | { |
| 455 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 456 | }; |
| 457 | |
Nattapat Chaimanowong | 964e955 | 2019-03-26 11:03:26 +0000 | [diff] [blame] | 458 | struct DebugQueueDescriptor : QueueDescriptor |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 459 | { |
janeil01 | 3fec1ea | 2019-11-07 09:47:20 +0000 | [diff] [blame] | 460 | DebugQueueDescriptor() : m_Guid(0) {} |
| 461 | |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 462 | void Validate(const WorkloadInfo& workloadInfo) const; |
Nattapat Chaimanowong | 964e955 | 2019-03-26 11:03:26 +0000 | [diff] [blame] | 463 | |
| 464 | LayerGuid m_Guid; |
| 465 | std::string m_LayerName; |
| 466 | unsigned int m_SlotIndex; |
Nattapat Chaimanowong | a9a1cf1 | 2018-12-03 16:06:49 +0000 | [diff] [blame] | 467 | }; |
| 468 | |
Mohamed Nour Abouelseoud | a1d3c6a | 2018-12-27 12:39:16 +0000 | [diff] [blame] | 469 | struct RsqrtQueueDescriptor : QueueDescriptor |
| 470 | { |
| 471 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 472 | }; |
| 473 | |
narpra01 | b89b05f | 2019-01-16 09:53:09 +0000 | [diff] [blame] | 474 | struct GatherQueueDescriptor : QueueDescriptor |
| 475 | { |
| 476 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 477 | }; |
| 478 | |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 479 | struct PreCompiledQueueDescriptor : QueueDescriptorWithParameters<PreCompiledDescriptor> |
| 480 | { |
| 481 | PreCompiledQueueDescriptor() |
| 482 | : m_PreCompiledObject(nullptr) |
| 483 | { |
| 484 | } |
| 485 | |
Matteo Martincigh | 7997a35 | 2019-04-17 15:37:30 +0100 | [diff] [blame] | 486 | void* m_PreCompiledObject; |
Matteo Martincigh | 4912402 | 2019-01-11 13:25:59 +0000 | [diff] [blame] | 487 | |
| 488 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 489 | }; |
| 490 | |
Nattapat Chaimanowong | e4294fd | 2019-03-28 09:56:53 +0000 | [diff] [blame] | 491 | struct DequantizeQueueDescriptor : QueueDescriptor |
| 492 | { |
| 493 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 494 | }; |
| 495 | |
Nattapat Chaimanowong | 1f88630 | 2019-04-05 13:37:19 +0100 | [diff] [blame] | 496 | struct MergeQueueDescriptor : QueueDescriptor |
| 497 | { |
| 498 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 499 | }; |
| 500 | |
Sadik Armagan | eff363d | 2019-04-05 15:25:46 +0100 | [diff] [blame] | 501 | struct SwitchQueueDescriptor : QueueDescriptor |
| 502 | { |
| 503 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 504 | }; |
| 505 | |
Matteo Martincigh | 0e406ee | 2019-06-12 15:42:18 +0100 | [diff] [blame] | 506 | struct PreluQueueDescriptor : QueueDescriptor |
| 507 | { |
| 508 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 509 | }; |
| 510 | |
Aron Virginas-Tar | 639fb04 | 2019-06-20 14:28:19 +0100 | [diff] [blame] | 511 | struct TransposeConvolution2dQueueDescriptor : QueueDescriptorWithParameters<TransposeConvolution2dDescriptor> |
| 512 | { |
| 513 | TransposeConvolution2dQueueDescriptor() : |
| 514 | m_Weight(nullptr), |
| 515 | m_Bias(nullptr) |
| 516 | {} |
| 517 | |
| 518 | const ConstCpuTensorHandle* m_Weight; |
| 519 | const ConstCpuTensorHandle* m_Bias; |
| 520 | |
| 521 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 522 | }; |
| 523 | |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 524 | struct TransposeQueueDescriptor : QueueDescriptorWithParameters<TransposeDescriptor> |
| 525 | { |
| 526 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 527 | }; |
| 528 | |
James Conroy | 586a9aa | 2020-03-20 08:49:33 +0000 | [diff] [blame] | 529 | struct QLstmQueueDescriptor : QueueDescriptorWithParameters<QLstmDescriptor> |
| 530 | { |
| 531 | QLstmQueueDescriptor() |
| 532 | : m_InputToInputWeights(nullptr) |
| 533 | , m_InputToForgetWeights(nullptr) |
| 534 | , m_InputToCellWeights(nullptr) |
| 535 | , m_InputToOutputWeights(nullptr) |
| 536 | , m_RecurrentToInputWeights(nullptr) |
| 537 | , m_RecurrentToForgetWeights(nullptr) |
| 538 | , m_RecurrentToCellWeights(nullptr) |
| 539 | , m_RecurrentToOutputWeights(nullptr) |
| 540 | , m_CellToInputWeights(nullptr) |
| 541 | , m_CellToForgetWeights(nullptr) |
| 542 | , m_CellToOutputWeights(nullptr) |
| 543 | , m_InputGateBias(nullptr) |
| 544 | , m_ForgetGateBias(nullptr) |
| 545 | , m_CellBias(nullptr) |
| 546 | , m_OutputGateBias(nullptr) |
| 547 | , m_ProjectionWeights(nullptr) |
| 548 | , m_ProjectionBias(nullptr) |
| 549 | , m_InputLayerNormWeights(nullptr) |
| 550 | , m_ForgetLayerNormWeights(nullptr) |
| 551 | , m_CellLayerNormWeights(nullptr) |
| 552 | , m_OutputLayerNormWeights(nullptr) |
| 553 | { |
| 554 | } |
| 555 | |
| 556 | const ConstCpuTensorHandle* m_InputToInputWeights; |
| 557 | const ConstCpuTensorHandle* m_InputToForgetWeights; |
| 558 | const ConstCpuTensorHandle* m_InputToCellWeights; |
| 559 | const ConstCpuTensorHandle* m_InputToOutputWeights; |
| 560 | const ConstCpuTensorHandle* m_RecurrentToInputWeights; |
| 561 | const ConstCpuTensorHandle* m_RecurrentToForgetWeights; |
| 562 | const ConstCpuTensorHandle* m_RecurrentToCellWeights; |
| 563 | const ConstCpuTensorHandle* m_RecurrentToOutputWeights; |
| 564 | const ConstCpuTensorHandle* m_CellToInputWeights; |
| 565 | const ConstCpuTensorHandle* m_CellToForgetWeights; |
| 566 | const ConstCpuTensorHandle* m_CellToOutputWeights; |
| 567 | const ConstCpuTensorHandle* m_InputGateBias; |
| 568 | const ConstCpuTensorHandle* m_ForgetGateBias; |
| 569 | const ConstCpuTensorHandle* m_CellBias; |
| 570 | const ConstCpuTensorHandle* m_OutputGateBias; |
| 571 | const ConstCpuTensorHandle* m_ProjectionWeights; |
| 572 | const ConstCpuTensorHandle* m_ProjectionBias; |
| 573 | const ConstCpuTensorHandle* m_InputLayerNormWeights; |
| 574 | const ConstCpuTensorHandle* m_ForgetLayerNormWeights; |
| 575 | const ConstCpuTensorHandle* m_CellLayerNormWeights; |
| 576 | const ConstCpuTensorHandle* m_OutputLayerNormWeights; |
| 577 | |
| 578 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 579 | }; |
| 580 | |
James Conroy | ee18dc8 | 2019-07-17 11:27:46 +0100 | [diff] [blame] | 581 | struct QuantizedLstmQueueDescriptor : QueueDescriptor |
| 582 | { |
| 583 | QuantizedLstmQueueDescriptor() |
| 584 | : m_InputToInputWeights(nullptr) |
| 585 | , m_InputToForgetWeights(nullptr) |
| 586 | , m_InputToCellWeights(nullptr) |
| 587 | , m_InputToOutputWeights(nullptr) |
| 588 | |
| 589 | , m_RecurrentToInputWeights(nullptr) |
| 590 | , m_RecurrentToForgetWeights(nullptr) |
| 591 | , m_RecurrentToCellWeights(nullptr) |
| 592 | , m_RecurrentToOutputWeights(nullptr) |
| 593 | |
| 594 | , m_InputGateBias(nullptr) |
| 595 | , m_ForgetGateBias(nullptr) |
| 596 | , m_CellBias(nullptr) |
| 597 | , m_OutputGateBias(nullptr) |
| 598 | {} |
| 599 | |
| 600 | const ConstCpuTensorHandle* m_InputToInputWeights; |
| 601 | const ConstCpuTensorHandle* m_InputToForgetWeights; |
| 602 | const ConstCpuTensorHandle* m_InputToCellWeights; |
| 603 | const ConstCpuTensorHandle* m_InputToOutputWeights; |
| 604 | |
| 605 | const ConstCpuTensorHandle* m_RecurrentToInputWeights; |
| 606 | const ConstCpuTensorHandle* m_RecurrentToForgetWeights; |
| 607 | const ConstCpuTensorHandle* m_RecurrentToCellWeights; |
| 608 | const ConstCpuTensorHandle* m_RecurrentToOutputWeights; |
| 609 | |
| 610 | const ConstCpuTensorHandle* m_InputGateBias; |
| 611 | const ConstCpuTensorHandle* m_ForgetGateBias; |
| 612 | const ConstCpuTensorHandle* m_CellBias; |
| 613 | const ConstCpuTensorHandle* m_OutputGateBias; |
| 614 | |
| 615 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 616 | }; |
| 617 | |
Kevin May | 868eb14 | 2019-09-04 17:29:31 +0100 | [diff] [blame] | 618 | struct AbsQueueDescriptor : QueueDescriptor |
| 619 | { |
| 620 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 621 | }; |
| 622 | |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 623 | struct SliceQueueDescriptor : QueueDescriptorWithParameters<SliceDescriptor> |
| 624 | { |
| 625 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 626 | }; |
| 627 | |
Aron Virginas-Tar | dd6247f | 2019-09-19 14:31:17 +0100 | [diff] [blame] | 628 | struct DepthToSpaceQueueDescriptor : QueueDescriptorWithParameters<DepthToSpaceDescriptor> |
| 629 | { |
| 630 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 631 | }; |
| 632 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 633 | struct ComparisonQueueDescriptor : QueueDescriptorWithParameters<ComparisonDescriptor> |
| 634 | { |
| 635 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 636 | }; |
| 637 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 638 | struct ElementwiseUnaryQueueDescriptor : QueueDescriptorWithParameters<ElementwiseUnaryDescriptor> |
| 639 | { |
| 640 | void Validate(const WorkloadInfo& workloadInfo) const; |
| 641 | }; |
| 642 | |
Aron Virginas-Tar | 636ab40 | 2019-09-16 14:27:45 +0100 | [diff] [blame] | 643 | } // namespace armnn |