ArmNN
 24.02
NeonSplitterWorkload Class Reference

#include <NeonSplitterWorkload.hpp>

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

Public Member Functions

 NeonSplitterWorkload (const SplitterQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< SplitterQueueDescriptor >
 NeonBaseWorkload (const SplitterQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from BaseWorkload< SplitterQueueDescriptor >
 BaseWorkload (const SplitterQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const SplitterQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const 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 Member Functions inherited from NeonBaseWorkload< SplitterQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< SplitterQueueDescriptor >
SplitterQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 22 of file NeonSplitterWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonSplitterWorkload()

NeonSplitterWorkload ( const SplitterQueueDescriptor descriptor,
const WorkloadInfo info 
)

Definition at line 56 of file NeonSplitterWorkload.cpp.

57  : NeonBaseWorkload<SplitterQueueDescriptor>(descriptor, info)
58 {
59  // Report Profiling Details
60  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonSplitterWorkload_Construct",
61  descriptor.m_Parameters,
62  info,
63  this->GetGuid());
64 
65  bool allOutputsAreSubtensors = true;
66 
67  // Check that all outputs are sub-tensors
68  for (auto output : m_Data.m_Outputs)
69  {
70  if (output && !output->GetParent())
71  {
72  // Non sub-tensor input found so we need to execute the split function
73  allOutputsAreSubtensors = false;
74  break;
75  }
76  }
77 
78  if (allOutputsAreSubtensors)
79  {
80  // Can skip configuring the split function since it's not executed
81  return;
82  }
83 
84  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
85 
86  std::vector<arm_compute::ITensor *> aclOutputs;
87  for (auto output : m_Data.m_Outputs)
88  {
89  arm_compute::ITensor& aclOutput = PolymorphicPointerDowncast<IAclTensorHandle>(output)->GetTensor();
90  aclOutputs.emplace_back(&aclOutput);
91  }
92 
93  // Create the layer function
94  std::unique_ptr<arm_compute::NESplit> layer(new arm_compute::NESplit());
95 
96  // Configure input and output tensors
97  std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor.m_Parameters, m_Data.m_Inputs[0]->GetShape());
98  if (splitAxis.size() != 1)
99  {
100  throw InvalidArgumentException("Cannot derive split axis from SplitterDescriptor");
101  }
102 
103  unsigned int aclAxis = CalcAclAxis(descriptor.m_Parameters.GetNumDimensions(), *splitAxis.begin());
104  layer->configure(&input, aclOutputs, aclAxis);
105 
106  // Prepare
107  layer->prepare();
108  m_Layer.reset(layer.release());
109 }

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::ComputeSplitAxis(), ViewsDescriptor::GetNumDimensions(), armnn::info, BaseWorkload< SplitterQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 111 of file NeonSplitterWorkload.cpp.

112 {
113  if (m_Layer)
114  {
115  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonSplitterWorkload_Execute");
116  m_Layer->run();
117  }
118 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.


The documentation for this class was generated from the following files:
armnn::ComputeSplitAxis
std::set< unsigned int > ComputeSplitAxis(const armnn::SplitterDescriptor &desc, const TensorShape &input)
Definition: ArmComputeUtils.hpp:246
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::BaseWorkload< SplitterQueueDescriptor >::m_Data
SplitterQueueDescriptor m_Data
Definition: Workload.hpp:89
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:32
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26