telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 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 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 6 | #include "ClLayerSupport.hpp" |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame^] | 7 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | #include "InternalTypes.hpp" |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame^] | 9 | #include "LayerSupportCommon.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 10 | |
| 11 | #include <boost/core/ignore_unused.hpp> |
| 12 | |
| 13 | #ifdef ARMCOMPUTECL_ENABLED |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 14 | #include "workloads/ClAdditionWorkload.hpp" |
| 15 | #include "workloads/ClActivationFloatWorkload.hpp" |
| 16 | #include "workloads/ClBatchNormalizationFloatWorkload.hpp" |
| 17 | #include "workloads/ClConvertFp16ToFp32Workload.hpp" |
| 18 | #include "workloads/ClConvertFp32ToFp16Workload.hpp" |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 19 | #include "workloads/ClConvolution2dWorkload.hpp" |
Matthew Bentham | d877739 | 2018-10-08 09:38:55 +0100 | [diff] [blame] | 20 | #include "workloads/ClDepthwiseConvolutionWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 21 | #include "workloads/ClDivisionFloatWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 22 | #include "workloads/ClFullyConnectedWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 23 | #include "workloads/ClL2NormalizationFloatWorkload.hpp" |
| 24 | #include "workloads/ClLstmFloatWorkload.hpp" |
| 25 | #include "workloads/ClMultiplicationWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 26 | #include "workloads/ClNormalizationFloatWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 27 | #include "workloads/ClPadWorkload.hpp" |
| 28 | #include "workloads/ClPermuteWorkload.hpp" |
| 29 | #include "workloads/ClPooling2dBaseWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 30 | #include "workloads/ClSoftmaxBaseWorkload.hpp" |
| 31 | #include "workloads/ClSubtractionWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 32 | #endif |
| 33 | |
| 34 | using namespace boost; |
| 35 | |
| 36 | namespace armnn |
| 37 | { |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame^] | 38 | |
| 39 | bool ClLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 40 | const TensorInfo& output, |
| 41 | const ActivationDescriptor& descriptor, |
| 42 | Optional<std::string&> reasonIfUnsupported) const |
| 43 | { |
| 44 | return armnn::IsActivationSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 45 | } |
| 46 | |
| 47 | bool ClLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 48 | const TensorInfo& input1, |
| 49 | const TensorInfo& output, |
| 50 | Optional<std::string&> reasonIfUnsupported) const |
| 51 | { |
| 52 | return armnn::IsAdditionSupportedCl(input0, input1, output, reasonIfUnsupported); |
| 53 | } |
| 54 | |
| 55 | bool ClLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 56 | const TensorInfo& output, |
| 57 | const TensorInfo& mean, |
| 58 | const TensorInfo& var, |
| 59 | const TensorInfo& beta, |
| 60 | const TensorInfo& gamma, |
| 61 | const BatchNormalizationDescriptor& descriptor, |
| 62 | Optional<std::string&> reasonIfUnsupported) const |
| 63 | { |
| 64 | return armnn::IsBatchNormalizationSupportedCl(input, |
| 65 | output, |
| 66 | mean, |
| 67 | var, |
| 68 | beta, |
| 69 | gamma, |
| 70 | descriptor, |
| 71 | reasonIfUnsupported); |
| 72 | } |
| 73 | |
| 74 | bool ClLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 75 | Optional<std::string&> reasonIfUnsupported) const |
| 76 | { |
| 77 | return armnn::IsConstantSupportedCl(output, reasonIfUnsupported); |
| 78 | } |
| 79 | |
| 80 | bool ClLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 81 | const TensorInfo& output, |
| 82 | Optional<std::string&> reasonIfUnsupported) const |
| 83 | { |
| 84 | return armnn::IsConvertFp16ToFp32SupportedCl(input, output, reasonIfUnsupported); |
| 85 | } |
| 86 | |
| 87 | bool ClLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 88 | const TensorInfo& output, |
| 89 | Optional<std::string&> reasonIfUnsupported) const |
| 90 | { |
| 91 | return armnn::IsConvertFp32ToFp16SupportedCl(input, output, reasonIfUnsupported); |
| 92 | } |
| 93 | |
| 94 | bool ClLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 95 | const TensorInfo& output, |
| 96 | const Convolution2dDescriptor& descriptor, |
| 97 | const TensorInfo& weights, |
| 98 | const Optional<TensorInfo>& biases, |
| 99 | Optional<std::string&> reasonIfUnsupported) const |
| 100 | { |
| 101 | return armnn::IsConvolution2dSupportedCl(input, |
| 102 | output, |
| 103 | descriptor, |
| 104 | weights, |
| 105 | biases, |
| 106 | reasonIfUnsupported); |
| 107 | } |
| 108 | |
| 109 | bool ClLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 110 | const TensorInfo& output, |
| 111 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 112 | const TensorInfo& weights, |
| 113 | const Optional<TensorInfo>& biases, |
| 114 | Optional<std::string&> reasonIfUnsupported) const |
| 115 | { |
| 116 | return armnn::IsDepthwiseConvolutionSupportedCl(input, |
| 117 | output, |
| 118 | descriptor, |
| 119 | weights, |
| 120 | biases, |
| 121 | reasonIfUnsupported); |
| 122 | } |
| 123 | |
| 124 | bool ClLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 125 | const TensorInfo& input1, |
| 126 | const TensorInfo& output, |
| 127 | Optional<std::string&> reasonIfUnsupported) const |
| 128 | { |
| 129 | return armnn::IsDivisionSupportedCl(input0, input1, output, reasonIfUnsupported); |
| 130 | } |
| 131 | |
| 132 | bool ClLayerSupport::IsFakeQuantizationSupported(const TensorInfo& input, |
| 133 | const FakeQuantizationDescriptor& descriptor, |
| 134 | Optional<std::string&> reasonIfUnsupported) const |
| 135 | { |
| 136 | return armnn::IsFakeQuantizationSupportedCl(input, descriptor, reasonIfUnsupported); |
| 137 | } |
| 138 | |
| 139 | bool ClLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 140 | const TensorInfo& output, |
| 141 | Optional<std::string&> reasonIfUnsupported) const |
| 142 | { |
| 143 | return armnn::IsFloorSupportedCl(input, output, reasonIfUnsupported); |
| 144 | } |
| 145 | |
| 146 | bool ClLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 147 | const TensorInfo& output, |
| 148 | const TensorInfo& weights, |
| 149 | const TensorInfo& biases, |
| 150 | const FullyConnectedDescriptor& descriptor, |
| 151 | Optional<std::string&> reasonIfUnsupported) const |
| 152 | { |
| 153 | return armnn::IsFullyConnectedSupportedCl(input, |
| 154 | output, |
| 155 | weights, |
| 156 | biases, |
| 157 | descriptor, |
| 158 | reasonIfUnsupported); |
| 159 | } |
| 160 | |
| 161 | bool ClLayerSupport::IsInputSupported(const TensorInfo& input, |
| 162 | Optional<std::string&> reasonIfUnsupported) const |
| 163 | { |
| 164 | return armnn::IsInputSupportedCl(input, reasonIfUnsupported); |
| 165 | } |
| 166 | |
| 167 | bool ClLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 168 | const TensorInfo& output, |
| 169 | const L2NormalizationDescriptor& descriptor, |
| 170 | Optional<std::string&> reasonIfUnsupported) const |
| 171 | { |
| 172 | return armnn::IsL2NormalizationSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 173 | } |
| 174 | |
| 175 | bool ClLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 176 | const TensorInfo& outputStateIn, |
| 177 | const TensorInfo& cellStateIn, |
| 178 | const TensorInfo& scratchBuffer, |
| 179 | const TensorInfo& outputStateOut, |
| 180 | const TensorInfo& cellStateOut, |
| 181 | const TensorInfo& output, |
| 182 | const LstmDescriptor& descriptor, |
| 183 | const TensorInfo& inputToForgetWeights, |
| 184 | const TensorInfo& inputToCellWeights, |
| 185 | const TensorInfo& inputToOutputWeights, |
| 186 | const TensorInfo& recurrentToForgetWeights, |
| 187 | const TensorInfo& recurrentToCellWeights, |
| 188 | const TensorInfo& recurrentToOutputWeights, |
| 189 | const TensorInfo& forgetGateBias, |
| 190 | const TensorInfo& cellBias, |
| 191 | const TensorInfo& outputGateBias, |
| 192 | const TensorInfo* inputToInputWeights, |
| 193 | const TensorInfo* recurrentToInputWeights, |
| 194 | const TensorInfo* cellToInputWeights, |
| 195 | const TensorInfo* inputGateBias, |
| 196 | const TensorInfo* projectionWeights, |
| 197 | const TensorInfo* projectionBias, |
| 198 | const TensorInfo* cellToForgetWeights, |
| 199 | const TensorInfo* cellToOutputWeights, |
| 200 | Optional<std::string&> reasonIfUnsupported) const |
| 201 | { |
| 202 | return armnn::IsLstmSupportedCl(input, |
| 203 | outputStateIn, |
| 204 | cellStateIn, |
| 205 | scratchBuffer, |
| 206 | outputStateOut, |
| 207 | cellStateOut, |
| 208 | output, |
| 209 | descriptor, |
| 210 | inputToForgetWeights, |
| 211 | inputToCellWeights, |
| 212 | inputToOutputWeights, |
| 213 | recurrentToForgetWeights, |
| 214 | recurrentToCellWeights, |
| 215 | recurrentToOutputWeights, |
| 216 | forgetGateBias, |
| 217 | cellBias, |
| 218 | outputGateBias, |
| 219 | inputToInputWeights, |
| 220 | recurrentToInputWeights, |
| 221 | cellToInputWeights, |
| 222 | inputGateBias, |
| 223 | projectionWeights, |
| 224 | projectionBias, |
| 225 | cellToForgetWeights, |
| 226 | cellToOutputWeights, |
| 227 | reasonIfUnsupported); |
| 228 | } |
| 229 | |
| 230 | bool ClLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 231 | const TensorInfo& output, |
| 232 | const MeanDescriptor& descriptor, |
| 233 | Optional<std::string&> reasonIfUnsupported) const |
| 234 | { |
| 235 | return armnn::IsMeanSupportedCl(input, output, descriptor,reasonIfUnsupported); |
| 236 | } |
| 237 | |
| 238 | bool ClLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
| 239 | const OriginsDescriptor& descriptor, |
| 240 | Optional<std::string&> reasonIfUnsupported) const |
| 241 | { |
| 242 | return armnn::IsMergerSupportedCl(inputs, descriptor, reasonIfUnsupported); |
| 243 | } |
| 244 | |
| 245 | bool ClLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 246 | const TensorInfo& input1, |
| 247 | const TensorInfo& output, |
| 248 | Optional<std::string&> reasonIfUnsupported) const |
| 249 | { |
| 250 | return armnn::IsMultiplicationSupportedCl(input0, input1, output, reasonIfUnsupported); |
| 251 | } |
| 252 | |
| 253 | bool ClLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 254 | const TensorInfo& output, |
| 255 | const NormalizationDescriptor& descriptor, |
| 256 | Optional<std::string&> reasonIfUnsupported) const |
| 257 | { |
| 258 | return armnn::IsNormalizationSupportedCl(input, |
| 259 | output, |
| 260 | descriptor, |
| 261 | reasonIfUnsupported); |
| 262 | } |
| 263 | |
| 264 | bool ClLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 265 | Optional<std::string&> reasonIfUnsupported) const |
| 266 | { |
| 267 | return armnn::IsOutputSupportedCl(output, reasonIfUnsupported); |
| 268 | } |
| 269 | |
| 270 | bool ClLayerSupport::IsPadSupported(const TensorInfo& input, |
| 271 | const TensorInfo& output, |
| 272 | const PadDescriptor& descriptor, |
| 273 | Optional<std::string&> reasonIfUnsupported) const |
| 274 | { |
| 275 | return armnn::IsPadSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 276 | } |
| 277 | |
| 278 | bool ClLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 279 | const TensorInfo& output, |
| 280 | const PermuteDescriptor& descriptor, |
| 281 | Optional<std::string&> reasonIfUnsupported) const |
| 282 | { |
| 283 | return armnn::IsPermuteSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 284 | } |
| 285 | |
| 286 | bool ClLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 287 | const TensorInfo& output, |
| 288 | const Pooling2dDescriptor& descriptor, |
| 289 | Optional<std::string&> reasonIfUnsupported) const |
| 290 | { |
| 291 | return armnn::IsPooling2dSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 292 | } |
| 293 | |
| 294 | bool ClLayerSupport::IsReshapeSupported(const TensorInfo& input, |
| 295 | Optional<std::string&> reasonIfUnsupported) const |
| 296 | { |
| 297 | return armnn::IsReshapeSupportedCl(input, reasonIfUnsupported); |
| 298 | } |
| 299 | |
| 300 | bool ClLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
| 301 | Optional<std::string&> reasonIfUnsupported) const |
| 302 | { |
| 303 | return armnn::IsResizeBilinearSupportedCl(input, reasonIfUnsupported); |
| 304 | } |
| 305 | |
| 306 | bool ClLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 307 | const TensorInfo& output, |
| 308 | const SoftmaxDescriptor& descriptor, |
| 309 | Optional<std::string&> reasonIfUnsupported) const |
| 310 | { |
| 311 | return armnn::IsSoftmaxSupportedCl(input, output, descriptor, reasonIfUnsupported); |
| 312 | } |
| 313 | |
| 314 | bool ClLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 315 | const ViewsDescriptor& descriptor, |
| 316 | Optional<std::string&> reasonIfUnsupported) const |
| 317 | { |
| 318 | return armnn::IsSplitterSupportedCl(input, descriptor, reasonIfUnsupported); |
| 319 | } |
| 320 | |
| 321 | bool ClLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 322 | const TensorInfo& input1, |
| 323 | const TensorInfo& output, |
| 324 | Optional<std::string&> reasonIfUnsupported) const |
| 325 | { |
| 326 | return armnn::IsSubtractionSupportedCl(input0, input1, output, reasonIfUnsupported); |
| 327 | } |
| 328 | |
| 329 | // |
| 330 | // Implementation functions |
| 331 | // |
| 332 | // TODO: Functions kept for backward compatibility. Remove redundant functions |
| 333 | // once transition to plugable backends is complete. |
| 334 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 335 | namespace |
| 336 | { |
| 337 | template<unsigned int FilterSize> |
| 338 | bool IsMatchingSize2d(const TensorInfo& weightInfo) |
| 339 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 340 | // Width & Height must match. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 341 | return (weightInfo.GetShape()[3] == FilterSize) && (weightInfo.GetShape()[2] == FilterSize); |
| 342 | } |
| 343 | |
| 344 | template<uint32_t ValidStride> |
| 345 | bool IsMatchingStride(uint32_t actualStride) |
| 346 | { |
| 347 | return ValidStride == actualStride; |
| 348 | } |
| 349 | |
| 350 | template<uint32_t FirstStride, uint32_t SecondStride, uint32_t... ValidStrides> |
| 351 | bool IsMatchingStride(uint32_t actualStride) |
| 352 | { |
| 353 | return IsMatchingStride<FirstStride>(actualStride) || IsMatchingStride<SecondStride, ValidStrides...>(actualStride); |
| 354 | }; |
| 355 | |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 356 | bool IsClBackendSupported(Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 357 | { |
| 358 | #if ARMCOMPUTECL_ENABLED |
| 359 | return true; |
| 360 | #else |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 361 | if (reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 362 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 363 | reasonIfUnsupported.value() = "The armnn library has been built without CL support"; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 364 | } |
| 365 | return false; |
| 366 | #endif |
| 367 | } |
| 368 | |
| 369 | #if ARMCOMPUTECL_ENABLED |
| 370 | #define FORWARD_CL_LAYER_SUPPORT_FUNC(expr) (expr) |
| 371 | #else |
| 372 | #define FORWARD_CL_LAYER_SUPPORT_FUNC(expr) IsClBackendSupported(reasonIfUnsupported) |
| 373 | #endif |
| 374 | |
| 375 | #if ARMCOMPUTECL_ENABLED |
| 376 | template<class FuncType, class... Args> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 377 | inline bool IsWorkloadSupported(FuncType&& func, Optional<std::string&> reasonIfUnsupported, Args&&... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 378 | { |
| 379 | arm_compute::Status aclStatus = func(std::forward<Args>(args)...); |
| 380 | const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK); |
| 381 | if (!supported && reasonIfUnsupported) |
| 382 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 383 | reasonIfUnsupported.value() = aclStatus.error_description(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 384 | } |
| 385 | return supported; |
| 386 | } |
| 387 | |
| 388 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 389 | return IsWorkloadSupported(func, reasonIfUnsupported, __VA_ARGS__); |
| 390 | #else |
| 391 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 392 | return IsClBackendSupported(reasonIfUnsupported); |
| 393 | #endif |
| 394 | |
| 395 | } //namespace |
| 396 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 397 | template<typename FloatFunc, typename Uint8Func, typename ... Params> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 398 | bool IsSupportedForDataTypeCl(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 399 | DataType dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 400 | FloatFunc floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 401 | Uint8Func uint8FuncPtr, |
| 402 | Params&&... params) |
| 403 | { |
| 404 | return IsClBackendSupported(reasonIfUnsupported) && |
| 405 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 406 | dataType, |
| 407 | floatFuncPtr, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 408 | floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 409 | uint8FuncPtr, |
| 410 | std::forward<Params>(params)...); |
| 411 | } |
| 412 | |
| 413 | bool IsActivationSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 414 | const TensorInfo& output, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 415 | const ActivationDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 416 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 417 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 418 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClActivationWorkloadValidate, |
| 419 | reasonIfUnsupported, |
| 420 | input, |
| 421 | output, |
| 422 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | bool IsAdditionSupportedCl(const TensorInfo& input0, |
| 426 | const TensorInfo& input1, |
| 427 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 428 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 429 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 430 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClAdditionValidate, |
| 431 | reasonIfUnsupported, |
| 432 | input0, |
| 433 | input1, |
| 434 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | bool IsBatchNormalizationSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 438 | const TensorInfo& output, |
| 439 | const TensorInfo& mean, |
| 440 | const TensorInfo& var, |
| 441 | const TensorInfo& beta, |
| 442 | const TensorInfo& gamma, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 443 | const BatchNormalizationDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 444 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 445 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 446 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClBatchNormalizationValidate, |
| 447 | reasonIfUnsupported, |
| 448 | input, |
| 449 | output, |
| 450 | mean, |
| 451 | var, |
| 452 | beta, |
| 453 | gamma, |
| 454 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | bool IsConstantSupportedCl(const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 458 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 459 | { |
| 460 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 461 | output.GetDataType(), |
| 462 | &TrueFunc<>, |
| 463 | &FalseFuncU8<>); |
| 464 | } |
| 465 | |
| 466 | bool IsClDirectConvolution2dSupported(const TensorInfo& weightInfo, const Convolution2dDescriptor& desc) |
| 467 | { |
| 468 | bool isSupported = false; |
| 469 | |
| 470 | bool strideXIsOneOrTwo = IsMatchingStride<1, 2>(desc.m_StrideX); |
| 471 | bool strideXIsThree = IsMatchingStride<3>(desc.m_StrideX); |
| 472 | |
| 473 | bool strideYIsOneOrTwo = IsMatchingStride<1, 2>(desc.m_StrideY); |
| 474 | bool strideYIsThree = IsMatchingStride<3>(desc.m_StrideY); |
| 475 | |
| 476 | bool strideIsOneOrTwo = strideXIsOneOrTwo && strideYIsOneOrTwo; |
| 477 | bool strideIsOneOrTwoOrThree = ( strideXIsOneOrTwo || strideXIsThree ) && ( strideYIsOneOrTwo || strideYIsThree ); |
| 478 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 479 | // 1x1 convolution with strides of 1,2,3. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 480 | isSupported |= IsMatchingSize2d<1>(weightInfo) && ( strideIsOneOrTwoOrThree ); |
| 481 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 482 | // 3x3 convolution with strides of 1,2. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 483 | isSupported |= IsMatchingSize2d<3>(weightInfo) && ( strideIsOneOrTwo ); |
| 484 | |
| 485 | // 5x5 convolution with strides of 1,2 |
| 486 | isSupported |= IsMatchingSize2d<5>(weightInfo) && ( strideIsOneOrTwo ); |
| 487 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 488 | //Fall back to normal convolution for the asymmetric padding case. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 489 | if (desc.m_PadLeft != desc.m_PadRight || |
| 490 | desc.m_PadTop != desc.m_PadBottom) |
| 491 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 492 | //Direct convolution does not support asymmetric padding yet. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 493 | isSupported = false; |
| 494 | } |
| 495 | |
| 496 | return isSupported; |
| 497 | } |
| 498 | |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 499 | bool IsDirectConvolution2dParamsSupportedCl(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 500 | const Convolution2dDescriptor& parameters, |
| 501 | const TensorInfo& weightInfo) |
| 502 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 503 | ignore_unused(reasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 504 | return IsClDirectConvolution2dSupported(weightInfo, parameters); |
| 505 | } |
| 506 | |
| 507 | bool IsConvolution2dSupportedCl(const TensorInfo& input, |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 508 | const TensorInfo& output, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 509 | const Convolution2dDescriptor& descriptor, |
| 510 | const TensorInfo& weights, |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 511 | const Optional<TensorInfo>& biases, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 512 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 513 | { |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 514 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvolution2dWorkloadValidate, |
| 515 | reasonIfUnsupported, |
| 516 | input, |
| 517 | output, |
| 518 | descriptor, |
| 519 | weights, |
| 520 | biases); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | bool IsDepthwiseConvolutionSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 524 | const TensorInfo& output, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 525 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 526 | const TensorInfo& weights, |
David Beck | 5eec11d | 2018-10-04 15:43:17 +0100 | [diff] [blame] | 527 | const Optional<TensorInfo>& biases, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 528 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 529 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 530 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDepthwiseConvolutionWorkloadValidate, |
| 531 | reasonIfUnsupported, |
| 532 | input, |
| 533 | output, |
| 534 | descriptor, |
| 535 | weights, |
| 536 | biases); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 537 | } |
| 538 | |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 539 | bool IsDivisionSupportedCl(const TensorInfo& input0, |
| 540 | const TensorInfo& input1, |
| 541 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 542 | Optional<std::string&> reasonIfUnsupported) |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 543 | { |
| 544 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDivisionWorkloadValidate, |
| 545 | reasonIfUnsupported, |
| 546 | input0, |
| 547 | input1, |
| 548 | output); |
| 549 | } |
| 550 | |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 551 | bool IsSubtractionSupportedCl(const TensorInfo& input0, |
| 552 | const TensorInfo& input1, |
| 553 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 554 | Optional<std::string&> reasonIfUnsupported) |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 555 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 556 | |
| 557 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSubtractionValidate, |
| 558 | reasonIfUnsupported, |
| 559 | input0, |
| 560 | input1, |
| 561 | output); |
David Beck | c2044fe | 2018-09-05 15:00:38 +0100 | [diff] [blame] | 562 | } |
| 563 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 564 | bool IsFullyConnectedSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 565 | const TensorInfo& output, |
| 566 | const TensorInfo& weights, |
| 567 | const TensorInfo& biases, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 568 | const FullyConnectedDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 569 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 570 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 571 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClFullyConnectedWorkloadValidate, |
| 572 | reasonIfUnsupported, |
| 573 | input, |
| 574 | output, |
| 575 | weights, |
| 576 | biases, |
| 577 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | bool IsInputSupportedCl(const TensorInfo& input, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 581 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 582 | { |
| 583 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 584 | input.GetDataType(), |
| 585 | &TrueFunc<>, |
| 586 | &TrueFunc<>); |
| 587 | } |
| 588 | |
| 589 | bool IsL2NormalizationSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 590 | const TensorInfo& output, |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 591 | const L2NormalizationDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 592 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 593 | { |
Matteo Martincigh | bcd3c85 | 2018-09-28 14:14:12 +0100 | [diff] [blame] | 594 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClL2NormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 595 | } |
| 596 | |
| 597 | bool IsMergerSupportedCl(const std::vector<const TensorInfo*> inputs, |
| 598 | const OriginsDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 599 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 600 | { |
| 601 | ignore_unused(descriptor); |
| 602 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 603 | inputs[0]->GetDataType(), |
| 604 | &TrueFunc<>, |
| 605 | &FalseFuncU8<>); |
| 606 | } |
| 607 | |
| 608 | bool IsMultiplicationSupportedCl(const TensorInfo& input0, |
| 609 | const TensorInfo& input1, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 610 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 611 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 612 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 613 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClMultiplicationWorkloadValidate, |
| 614 | reasonIfUnsupported, |
| 615 | input0, |
| 616 | input1, |
| 617 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 618 | } |
| 619 | |
| 620 | bool IsNormalizationSupportedCl(const TensorInfo& input, |
| 621 | const TensorInfo& output, |
| 622 | const NormalizationDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 623 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 624 | { |
| 625 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClNormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 626 | } |
| 627 | |
| 628 | bool IsOutputSupportedCl(const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 629 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 630 | { |
| 631 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 632 | output.GetDataType(), |
| 633 | &TrueFunc<>, |
| 634 | &TrueFunc<>); |
| 635 | } |
| 636 | |
| 637 | bool IsPermuteSupportedCl(const TensorInfo& input, |
| 638 | const TensorInfo& output, |
| 639 | const PermuteDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 640 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 641 | { |
| 642 | ignore_unused(input); |
| 643 | ignore_unused(output); |
| 644 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPermuteWorkloadValidate, reasonIfUnsupported, descriptor); |
| 645 | } |
| 646 | |
| 647 | bool IsPooling2dSupportedCl(const TensorInfo& input, |
| 648 | const TensorInfo& output, |
| 649 | const Pooling2dDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 650 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 651 | { |
| 652 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPooling2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 653 | } |
| 654 | |
| 655 | bool IsResizeBilinearSupportedCl(const TensorInfo& input, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 656 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 657 | { |
| 658 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 659 | input.GetDataType(), |
| 660 | &TrueFunc<>, |
| 661 | &FalseFuncU8<>); |
| 662 | } |
| 663 | |
| 664 | bool IsSoftmaxSupportedCl(const TensorInfo& input, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 665 | const TensorInfo& output, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 666 | const SoftmaxDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 667 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 668 | { |
| 669 | ignore_unused(descriptor); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 670 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSoftmaxWorkloadValidate, reasonIfUnsupported, input, output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 671 | } |
| 672 | |
| 673 | bool IsSplitterSupportedCl(const TensorInfo& input, |
| 674 | const ViewsDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 675 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 676 | { |
| 677 | ignore_unused(descriptor); |
| 678 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 679 | input.GetDataType(), |
| 680 | &TrueFunc<>, |
| 681 | &TrueFunc<>); |
| 682 | } |
| 683 | |
| 684 | bool IsFakeQuantizationSupportedCl(const TensorInfo& input, |
| 685 | const FakeQuantizationDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 686 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 687 | { |
| 688 | ignore_unused(input); |
| 689 | ignore_unused(descriptor); |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 690 | ignore_unused(reasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 691 | return false; |
| 692 | } |
| 693 | |
| 694 | bool IsReshapeSupportedCl(const TensorInfo& input, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 695 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 696 | { |
| 697 | ignore_unused(input); |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 698 | ignore_unused(reasonIfUnsupported); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 699 | return true; |
| 700 | } |
| 701 | |
| 702 | bool IsFloorSupportedCl(const TensorInfo& input, |
| 703 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 704 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 705 | { |
| 706 | ignore_unused(output); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 707 | return IsClBackendSupported(reasonIfUnsupported) && |
| 708 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 709 | input.GetDataType(), |
| 710 | &FalseFuncF16<>, |
| 711 | &TrueFunc<>, |
| 712 | &FalseFuncU8<>); |
| 713 | } |
| 714 | |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 715 | bool IsLstmSupportedCl(const TensorInfo& input, |
| 716 | const TensorInfo& outputStateIn, |
| 717 | const TensorInfo& cellStateIn, |
| 718 | const TensorInfo& scratchBuffer, |
| 719 | const TensorInfo& outputStateOut, |
| 720 | const TensorInfo& cellStateOut, |
| 721 | const TensorInfo& output, |
| 722 | const LstmDescriptor& descriptor, |
| 723 | const TensorInfo& inputToForgetWeights, |
| 724 | const TensorInfo& inputToCellWeights, |
| 725 | const TensorInfo& inputToOutputWeights, |
| 726 | const TensorInfo& recurrentToForgetWeights, |
| 727 | const TensorInfo& recurrentToCellWeights, |
| 728 | const TensorInfo& recurrentToOutputWeights, |
| 729 | const TensorInfo& forgetGateBias, |
| 730 | const TensorInfo& cellBias, |
| 731 | const TensorInfo& outputGateBias, |
| 732 | const TensorInfo* inputToInputWeights, |
| 733 | const TensorInfo* recurrentToInputWeights, |
| 734 | const TensorInfo* cellToInputWeights, |
| 735 | const TensorInfo* inputGateBias, |
| 736 | const TensorInfo* projectionWeights, |
| 737 | const TensorInfo* projectionBias, |
| 738 | const TensorInfo* cellToForgetWeights, |
| 739 | const TensorInfo* cellToOutputWeights, |
| 740 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 741 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 742 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLstmFloatWorkloadValidate, |
| 743 | reasonIfUnsupported, |
| 744 | input, |
| 745 | outputStateIn, |
| 746 | cellStateIn, |
| 747 | scratchBuffer, |
| 748 | outputStateOut, |
| 749 | cellStateOut, |
| 750 | output, |
| 751 | descriptor, |
| 752 | inputToForgetWeights, |
| 753 | inputToCellWeights, |
| 754 | inputToOutputWeights, |
| 755 | recurrentToForgetWeights, |
| 756 | recurrentToCellWeights, |
| 757 | recurrentToOutputWeights, |
| 758 | forgetGateBias, |
| 759 | cellBias, |
| 760 | outputGateBias, |
| 761 | inputToInputWeights, |
| 762 | recurrentToInputWeights, |
| 763 | cellToInputWeights, |
| 764 | inputGateBias, |
| 765 | projectionWeights, |
| 766 | projectionBias, |
| 767 | cellToForgetWeights, |
| 768 | cellToOutputWeights); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | bool IsConvertFp16ToFp32SupportedCl(const TensorInfo& input, |
| 772 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 773 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 774 | { |
| 775 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvertFp16ToFp32WorkloadValidate, |
| 776 | reasonIfUnsupported, |
| 777 | input, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 778 | output); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | bool IsConvertFp32ToFp16SupportedCl(const TensorInfo& input, |
| 782 | const TensorInfo& output, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 783 | Optional<std::string&> reasonIfUnsupported) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 784 | { |
| 785 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvertFp32ToFp16WorkloadValidate, |
| 786 | reasonIfUnsupported, |
| 787 | input, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 788 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 789 | } |
| 790 | |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 791 | bool IsMeanSupportedCl(const TensorInfo& input, |
| 792 | const TensorInfo& output, |
| 793 | const MeanDescriptor& descriptor, |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 794 | Optional<std::string&> reasonIfUnsupported) |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 795 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 796 | ignore_unused(input); |
| 797 | ignore_unused(output); |
| 798 | ignore_unused(descriptor); |
| 799 | ignore_unused(reasonIfUnsupported); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 800 | return false; |
| 801 | } |
| 802 | |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 803 | bool IsPadSupportedCl(const TensorInfo& input, |
| 804 | const TensorInfo& output, |
| 805 | const PadDescriptor& descriptor, |
| 806 | Optional<std::string&> reasonIfUnsupported) |
| 807 | { |
| 808 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPadValidate, |
| 809 | reasonIfUnsupported, |
| 810 | input, |
| 811 | output, |
| 812 | descriptor); |
| 813 | } |
| 814 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 815 | } |