13 template<
typename WorkloadType>
14 struct MakeWorkloadForType
16 template<
typename QueueDescriptorType,
typename... Args>
17 static std::unique_ptr<WorkloadType> Func(
const QueueDescriptorType& descriptor,
18 const WorkloadInfo& info,
21 return std::make_unique<WorkloadType>(descriptor, info, std::forward<Args>(args)...);
27 struct MakeWorkloadForType<NullWorkload>
29 template<
typename QueueDescriptorType,
typename... Args>
30 static std::unique_ptr<NullWorkload> Func(
const QueueDescriptorType& descriptor,
31 const WorkloadInfo& info,
44 typename BooleanWorkload,
typename Int8Workload,
typename QueueDescriptorType,
typename... Args>
45 std::unique_ptr<IWorkload> MakeWorkloadHelper(
const QueueDescriptorType& descriptor,
46 const WorkloadInfo& info,
49 const DataType dataType = !
info.m_InputTensorInfos.empty() ?
50 info.m_InputTensorInfos[0].GetDataType()
51 :
info.m_OutputTensorInfos[0].GetDataType();
57 return MakeWorkloadForType<Float16Workload>::Func(descriptor, info, std::forward<Args>(args)...);
59 return MakeWorkloadForType<Float32Workload>::Func(descriptor, info, std::forward<Args>(args)...);
61 return MakeWorkloadForType<Uint8Workload>::Func(descriptor, info, std::forward<Args>(args)...);
64 return MakeWorkloadForType<Int8Workload>::Func(descriptor, info, std::forward<Args>(args)...);
66 return MakeWorkloadForType<Int32Workload>::Func(descriptor, info, std::forward<Args>(args)...);
68 return MakeWorkloadForType<BooleanWorkload>::Func(descriptor, info, std::forward<Args>(args)...);
73 throw InvalidArgumentException(
"Unknown data type passed to MakeWorkloadHelper");
82 std::unique_ptr<IWorkload> MakeWorkloadHelper(
const QueueDescriptorType& descriptor,
83 const WorkloadInfo& info,
86 return MakeWorkloadHelper<FloatWorkload, FloatWorkload, Uint8Workload, NullWorkload, NullWorkload, NullWorkload>(
89 std::forward<Args>(args)...);