ArmNN
 24.02
NeonFusedWorkload Class Reference

#include <NeonFusedWorkload.hpp>

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

Public Member Functions

 NeonFusedWorkload (const FusedQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< FusedQueueDescriptor >
 NeonBaseWorkload (const FusedQueueDescriptor &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< FusedQueueDescriptor >
 BaseWorkload (const FusedQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const FusedQueueDescriptorGetData () 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< FusedQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< FusedQueueDescriptor >
FusedQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 22 of file NeonFusedWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonFusedWorkload()

NeonFusedWorkload ( const FusedQueueDescriptor descriptor,
const WorkloadInfo info 
)

Definition at line 63 of file NeonFusedWorkload.cpp.

64  : NeonBaseWorkload<FusedQueueDescriptor>(descriptor, info)
65 {
66  m_Data.ValidateInputsOutputs("NeonFusedWorkload",
67  static_cast<unsigned int>(info.m_InputTensorInfos.size()),
68  static_cast<unsigned int>(info.m_OutputTensorInfos.size()));
69 
70  std::vector<arm_compute::ITensor*> inputs;
71  inputs.reserve(info.m_InputTensorInfos.size());
72  for (auto input : m_Data.m_Inputs)
73  {
74  inputs.emplace_back(&PolymorphicDowncast<IAclTensorHandle*>(input)->GetTensor());
75  }
76 
77  std::vector<arm_compute::ITensor*> outputs;
78  outputs.reserve(info.m_OutputTensorInfos.size());
79  for (auto output : m_Data.m_Outputs)
80  {
81  outputs.emplace_back(&PolymorphicDowncast<IAclTensorHandle*>(output)->GetTensor());
82  }
83 
84  const arm_compute::ActivationLayerInfo activationInfo =
86 
87  switch (descriptor.m_Parameters.m_FusedKernelType)
88  {
90  {
91  auto layer = std::make_unique<arm_compute::NEAddMulAdd>();
92  layer->configure(inputs[0],
93  inputs[1],
94  inputs[2], // bn_mul
95  inputs[3], // bn_add
96  outputs.size() == 1 ? nullptr : outputs[0], // add_output
97  outputs.size() == 1 ? outputs[0] : outputs[1], // final_output
98  arm_compute::ConvertPolicy::SATURATE,
99  activationInfo);
100  m_FusedLayer.reset(layer.release());
101  break;
102  }
103  default:
104  throw Exception("NeonFusedWorkload: no valid kernel type.");
105  }
106 }

References armnn::AddMulAdd, armnn::ConvertAdditionalInfoToAclActivationLayerInfo(), armnn::info, BaseWorkload< FusedQueueDescriptor >::m_Data, FusedDescriptor::m_FusedKernelType, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 108 of file NeonFusedWorkload.cpp.

109 {
110  ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonFusedWorkload_Execute", this->GetGuid());
111  m_FusedLayer->run();
112 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID, and BaseWorkload< FusedQueueDescriptor >::GetGuid().


The documentation for this class was generated from the following files:
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::ConvertAdditionalInfoToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
Definition: ArmComputeUtils.hpp:105
armnn::FusedKernelType::AddMulAdd
@ AddMulAdd
ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID(name, guid)
Definition: NeonWorkloadUtils.hpp:24
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::BaseWorkload< FusedQueueDescriptor >::GetGuid
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:67
armnn::BaseWorkload< FusedQueueDescriptor >::m_Data
FusedQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26