ArmNN
 24.02
CopyMemGenericWorkload Class Reference

#include <MemCopyWorkload.hpp>

Inheritance diagram for CopyMemGenericWorkload:
[legend]
Collaboration diagram for CopyMemGenericWorkload:
[legend]

Public Member Functions

 CopyMemGenericWorkload (const MemCopyQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void Execute () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
- Public Member Functions inherited from BaseWorkload< MemCopyQueueDescriptor >
 BaseWorkload (const MemCopyQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const MemCopyQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const override
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual arm::pipe::ProfilingGuid GetGuid () const =0
 
virtual bool SupportsTensorHandleReplacement () const =0
 
virtual const std::string & GetName () const =0
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 
virtual armnn::Optional< armnn::MemoryRequirementsGetMemoryRequirements ()
 

Additional Inherited Members

- Protected Attributes inherited from BaseWorkload< MemCopyQueueDescriptor >
MemCopyQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 15 of file MemCopyWorkload.hpp.

Constructor & Destructor Documentation

◆ CopyMemGenericWorkload()

CopyMemGenericWorkload ( const MemCopyQueueDescriptor descriptor,
const WorkloadInfo info 
)

Definition at line 44 of file MemCopyWorkload.cpp.

46  : BaseWorkload<MemCopyQueueDescriptor>(descriptor, info)
47 {
48  GatherTensorHandlePairs(descriptor, m_TensorHandlePairs);
49 }

References armnn::GatherTensorHandlePairs(), and armnn::info.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 51 of file MemCopyWorkload.cpp.

52 {
53  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "CopyMemGeneric_Execute");
54 
55  auto copyFunc = [](void* dst, const void* src, size_t size)
56  {
57  memcpy(dst, src, size);
58  };
59 
60  for (const auto& pair : m_TensorHandlePairs)
61  {
62  CopyTensorContentsGeneric(pair.first, pair.second, copyFunc);
63  }
64 }

References ARMNN_SCOPED_PROFILING_EVENT, armnn::CopyTensorContentsGeneric(), and armnn::Undefined.

◆ ExecuteAsync()

void ExecuteAsync ( ExecutionData executionData)
overridevirtual

Implements IWorkload.

Definition at line 66 of file MemCopyWorkload.cpp.

67 {
68  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "CopyMemGeneric_Execute_WorkingMemDescriptor");
69 
70  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
71  std::vector<TensorHandlePair> tensorHandlePairs;
72 
73  GatherTensorHandlePairs(*workingMemDescriptor, tensorHandlePairs);
74 
75  auto copyFunc = [](void* dst, const void* src, size_t size)
76  {
77  memcpy(dst, src, size);
78  };
79 
80  for (const auto& pair : tensorHandlePairs)
81  {
82  CopyTensorContentsGeneric(pair.first, pair.second, copyFunc);
83  }
84 }

References ARMNN_SCOPED_PROFILING_EVENT, armnn::CopyTensorContentsGeneric(), armnn::GatherTensorHandlePairs(), ExecutionData::m_Data, and armnn::Undefined.


The documentation for this class was generated from the following files:
armnn::Compute::Undefined
@ Undefined
ARMNN_SCOPED_PROFILING_EVENT
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
armnn::GatherTensorHandlePairs
void GatherTensorHandlePairs(const DescriptorType &descriptor, std::vector< std::pair< SrcTensorHandleType *, DstTensorHandleType * >> &tensorHandlePairs)
Definition: WorkloadUtils.hpp:204
armnn::CopyTensorContentsGeneric
void CopyTensorContentsGeneric(const ITensorHandle *srcTensor, ITensorHandle *dstTensor, CopyFunc copy)
Definition: WorkloadUtils.hpp:46