ArmNN
 24.02
NeonConstantWorkload Class Reference

#include <NeonConstantWorkload.hpp>

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

Public Member Functions

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

Detailed Description

Definition at line 16 of file NeonConstantWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonConstantWorkload()

NeonConstantWorkload ( const ConstantQueueDescriptor descriptor,
const WorkloadInfo info 
)

Definition at line 47 of file NeonConstantWorkload.cpp.

49  : NeonBaseWorkload<ConstantQueueDescriptor>(descriptor, info)
50  , m_RanOnce(false)
51 {
52 }

References armnn::info.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 54 of file NeonConstantWorkload.cpp.

55 {
56  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonConstantWorkload_Execute");
57 
58  using namespace armcomputetensorutils;
59 
60  // The intermediate tensor held by the corresponding layer output handler can be initialised with the
61  // given data on the first inference, then reused for subsequent inferences.
62  // The initialisation cannot happen at workload construction time since the ACL kernel for the next layer
63  // may not have been configured at the time.
64  if (!m_RanOnce)
65  {
66  const ConstantQueueDescriptor& data = this->m_Data;
67 
68  ARMNN_ASSERT(data.m_LayerOutput != nullptr);
69  arm_compute::ITensor& output =
70  PolymorphicDowncast<NeonTensorHandle*>(data.m_Outputs[0])->GetTensor();
71  arm_compute::DataType computeDataType =
72  PolymorphicDowncast<NeonTensorHandle*>(data.m_Outputs[0])->GetDataType();
73 
74  switch (computeDataType)
75  {
76  case arm_compute::DataType::BFLOAT16:
77  {
78  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<BFloat16>(), output);
79  break;
80  }
81  case arm_compute::DataType::F16:
82  {
83  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<Half>(), output);
84  break;
85  }
86  case arm_compute::DataType::F32:
87  {
88  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<float>(), output);
89  break;
90  }
91  case arm_compute::DataType::QASYMM8:
92  {
93  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<uint8_t>(), output);
94  break;
95  }
96  case arm_compute::DataType::QASYMM8_SIGNED:
97  {
98  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<int8_t>(), output);
99  break;
100  }
101  case arm_compute::DataType::QSYMM16:
102  {
103  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<int16_t>(), output);
104  break;
105  }
106  case arm_compute::DataType::QSYMM8:
107  case arm_compute::DataType::QSYMM8_PER_CHANNEL:
108  {
109  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<int8_t>(), output);
110  break;
111  }
112  case arm_compute::DataType::S32:
113  {
114  CopyArmComputeITensorData(data.m_LayerOutput->GetConstTensor<int32_t>(), output);
115  break;
116  }
117  default:
118  {
119  ARMNN_ASSERT_MSG(false, "Unknown data type");
120  break;
121  }
122  }
123 
124  m_RanOnce = true;
125  }
126 }

References ARMNN_ASSERT, ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID, BaseWorkload< ConstantQueueDescriptor >::m_Data, ConstantQueueDescriptor::m_LayerOutput, and QueueDescriptor::m_Outputs.


The documentation for this class was generated from the following files:
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::Half
half_float::half Half
Definition: Half.hpp:22
ARMNN_ASSERT_MSG
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
armnn::DataType
DataType
Definition: Types.hpp:48
armnn::BaseWorkload< ConstantQueueDescriptor >::m_Data
ConstantQueueDescriptor 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