// // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once namespace armnn { namespace { // Make a workload of the specified WorkloadType. template struct MakeWorkloadForType { template static std::unique_ptr Func(const QueueDescriptorType& descriptor, const WorkloadInfo& info, Args&&... args) { return std::make_unique(descriptor, info, std::forward(args)...); } }; // Specialization for void workload type used for unsupported workloads. template<> struct MakeWorkloadForType { template static std::unique_ptr Func(const QueueDescriptorType& descriptor, const WorkloadInfo& info, Args&&... args) { boost::ignore_unused(descriptor); boost::ignore_unused(info); boost::ignore_unused(args...); return nullptr; } }; // Makes a workload for one the specified types based on the data type requirements of the tensorinfo. // Specify type void as the WorkloadType for unsupported DataType/WorkloadType combos. template std::unique_ptr MakeWorkloadHelper(const QueueDescriptorType& descriptor, const WorkloadInfo& info, Args&&... args) { const DataType dataType = !info.m_InputTensorInfos.empty() ? info.m_InputTensorInfos[0].GetDataType() : info.m_OutputTensorInfos[0].GetDataType(); switch (dataType) { case DataType::Float16: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::Float32: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::QAsymmU8: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::QSymmS8: case DataType::QAsymmS8: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::Signed32: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::Boolean: return MakeWorkloadForType::Func(descriptor, info, std::forward(args)...); case DataType::QSymmS16: return nullptr; default: BOOST_ASSERT_MSG(false, "Unknown DataType."); return nullptr; } } // Makes a workload for one the specified types based on the data type requirements of the tensorinfo. // Calling this method is the equivalent of calling the five typed MakeWorkload method with . // Specify type void as the WorkloadType for unsupported DataType/WorkloadType combos. template std::unique_ptr MakeWorkloadHelper(const QueueDescriptorType& descriptor, const WorkloadInfo& info, Args&&... args) { return MakeWorkloadHelper( descriptor, info, std::forward(args)...); } } //namespace } //namespace armnn