ArmNN
 24.08
ClSplitterWorkload Class Reference

#include <ClSplitterWorkload.hpp>

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

Public Member Functions

 ClSplitterWorkload (const SplitterQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from ClBaseWorkload< SplitterQueueDescriptor >
 ClBaseWorkload (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 ClBaseWorkload< 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 23 of file ClSplitterWorkload.hpp.

Constructor & Destructor Documentation

◆ ClSplitterWorkload()

ClSplitterWorkload ( const SplitterQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 56 of file ClSplitterWorkload.cpp.

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

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID, 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 117 of file ClSplitterWorkload.cpp.

118 {
119  if (m_Layer)
120  {
121  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClSplitterWorkload_Execute");
122  m_Layer->run();
123  }
124 }

References ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID.


The documentation for this class was generated from the following files:
m_Layer
IConnectableLayer * m_Layer
Definition: SubgraphViewSelector.cpp:257
ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: ClWorkloadUtils.hpp:36
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::ComputeSplitAxis
std::set< unsigned int > ComputeSplitAxis(const armnn::SplitterDescriptor &desc, const TensorShape &input)
Calculates the axis values for split operation.
Definition: WorkloadUtils.cpp:377
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26