From 0c47974f1800e8770904aecaef15d6f105758c4e Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Fri, 10 Dec 2021 12:43:54 +0000 Subject: IVGCVSW-6626 Promote backend headers in backendCommon to armnn/backends Move the following header files from backendsCommon to armnn/backends. * MemCopyWorkload.hpp * TensorHandle.hpp * Workload.hpp * WorkloadData.hpp * WorkloadFactory.hpp Replace them with forwarding headers and a pragma deprecation message. Resolve the deprecation messages in Arm NN code. Signed-off-by: Colm Donelan Change-Id: I47f116b30f86e478c9057795bc518c391a8ae514 --- src/backends/backendsCommon/Workload.hpp | 219 +------------------------------ 1 file changed, 4 insertions(+), 215 deletions(-) (limited to 'src/backends/backendsCommon/Workload.hpp') diff --git a/src/backends/backendsCommon/Workload.hpp b/src/backends/backendsCommon/Workload.hpp index 87869c9841..00b6bfe4a7 100644 --- a/src/backends/backendsCommon/Workload.hpp +++ b/src/backends/backendsCommon/Workload.hpp @@ -1,219 +1,8 @@ // -// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // -#pragma once -#include "WorkloadData.hpp" -#include "WorkloadInfo.hpp" -#include "WorkingMemDescriptor.hpp" - -#include -#include -#include - -#include - -namespace armnn -{ - -// NullWorkload used to denote an unsupported workload when used by the MakeWorkload<> template -// in the various workload factories. -// There should never be an instantiation of a NullWorkload. -class NullWorkload : public IWorkload -{ - NullWorkload()=delete; -}; - -template -class BaseWorkload : public IWorkload -{ -public: - - BaseWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) - : m_Data(descriptor), - m_Guid(profiling::ProfilingService::GetNextGuid()) - { - m_Data.Validate(info); - } - - void ExecuteAsync(WorkingMemDescriptor& workingMemDescriptor) override - { - ARMNN_LOG(info) << "Using default async workload execution, this will network affect performance"; - std::lock_guard lockGuard(m_AsyncWorkloadMutex); - - m_Data.m_Inputs = workingMemDescriptor.m_Inputs; - m_Data.m_Outputs = workingMemDescriptor.m_Outputs; - - Execute(); - }; - - void PostAllocationConfigure() override {} - - const QueueDescriptor& GetData() const { return m_Data; } - - profiling::ProfilingGuid GetGuid() const final { return m_Guid; } - -protected: - QueueDescriptor m_Data; - const profiling::ProfilingGuid m_Guid; - -private: - std::mutex m_AsyncWorkloadMutex; -}; - -// TypedWorkload used -template -class TypedWorkload : public BaseWorkload -{ -public: - - TypedWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) - : BaseWorkload(descriptor, info) - { - std::vector dataTypes = {DataTypes...}; - armnn::DataType expectedInputType; - - if (!info.m_InputTensorInfos.empty()) - { - expectedInputType = info.m_InputTensorInfos.front().GetDataType(); - - if (std::find(dataTypes.begin(), dataTypes.end(), expectedInputType) == dataTypes.end()) - { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); - } - ARMNN_ASSERT_MSG(std::all_of(std::next(info.m_InputTensorInfos.begin()), - info.m_InputTensorInfos.end(), - [&](auto it){ - return it.GetDataType() == expectedInputType; - }), - "Trying to create workload with incorrect type"); - } - armnn::DataType expectedOutputType; - - if (!info.m_OutputTensorInfos.empty()) - { - expectedOutputType = info.m_OutputTensorInfos.front().GetDataType(); - - if (!info.m_InputTensorInfos.empty()) - { - if (expectedOutputType != expectedInputType) - { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); - } - } - else if (std::find(dataTypes.begin(), dataTypes.end(), expectedOutputType) == dataTypes.end()) - { - ARMNN_ASSERT_MSG(false, "Trying to create workload with incorrect type"); - } - ARMNN_ASSERT_MSG(std::all_of(std::next(info.m_OutputTensorInfos.begin()), - info.m_OutputTensorInfos.end(), - [&](auto it){ - return it.GetDataType() == expectedOutputType; - }), - "Trying to create workload with incorrect type"); - } - } -}; - -template -class MultiTypedWorkload : public BaseWorkload -{ -public: - - MultiTypedWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) - : BaseWorkload(descriptor, info) - { - ARMNN_ASSERT_MSG(std::all_of(info.m_InputTensorInfos.begin(), - info.m_InputTensorInfos.end(), - [&](auto it){ - return it.GetDataType() == InputDataType; - }), - "Trying to create workload with incorrect type"); - - ARMNN_ASSERT_MSG(std::all_of(info.m_OutputTensorInfos.begin(), - info.m_OutputTensorInfos.end(), - [&](auto it){ - return it.GetDataType() == OutputDataType; - }), - "Trying to create workload with incorrect type"); - } -}; - -// FirstInputTypedWorkload used to check type of the first input -template -class FirstInputTypedWorkload : public BaseWorkload -{ -public: - - FirstInputTypedWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) - : BaseWorkload(descriptor, info) - { - if (!info.m_InputTensorInfos.empty()) - { - ARMNN_ASSERT_MSG(info.m_InputTensorInfos.front().GetDataType() == DataType, - "Trying to create workload with incorrect type"); - } - - ARMNN_ASSERT_MSG(std::all_of(info.m_OutputTensorInfos.begin(), - info.m_OutputTensorInfos.end(), - [&](auto it){ - return it.GetDataType() == DataType; - }), - "Trying to create workload with incorrect type"); - } -}; - -template -using FloatWorkload = TypedWorkload; - -template -using Float32Workload = TypedWorkload; - -template -using Uint8Workload = TypedWorkload; - -template -using Int32Workload = TypedWorkload; - -template -using BooleanWorkload = TypedWorkload; - -template -using BaseFloat32ComparisonWorkload = MultiTypedWorkload; - -template -using BaseUint8ComparisonWorkload = MultiTypedWorkload; - -template -using BFloat16ToFloat32Workload = MultiTypedWorkload; - -template -using Float32ToBFloat16Workload = MultiTypedWorkload; - -template -using Float16ToFloat32Workload = MultiTypedWorkload; - -template -using Float32ToFloat16Workload = MultiTypedWorkload; - -template -using Uint8ToFloat32Workload = MultiTypedWorkload; - -} //namespace armnn +#include +#pragma message("src/backends/backendsCommon/Workload.hpp has been deprecated, it is due for removal in"\ + " 22.08 release. Please use public interface include/armnn/backends/Workload.hpp") -- cgit v1.2.1