ArmNN
 24.08
GpuFsaConstantWorkload Class Reference

#include <GpuFsaConstantWorkload.hpp>

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

Public Member Functions

 GpuFsaConstantWorkload (const ConstantQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from GpuFsaBaseWorkload< ConstantQueueDescriptor >
 GpuFsaBaseWorkload (const ConstantQueueDescriptor &descriptor, const WorkloadInfo &info)
 
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 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
 
- 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< ConstantQueueDescriptor >
ConstantQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 17 of file GpuFsaConstantWorkload.hpp.

Constructor & Destructor Documentation

◆ GpuFsaConstantWorkload()

GpuFsaConstantWorkload ( const ConstantQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 43 of file GpuFsaConstantWorkload.cpp.

46  : GpuFsaBaseWorkload<ConstantQueueDescriptor>(descriptor, info)
47  , m_RanOnce(false)
48 {
49 }

References armnn::info.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 51 of file GpuFsaConstantWorkload.cpp.

52 {
53  // The intermediate tensor held by the corresponding layer output handler can be initialised with the given data
54  // on the first inference, then reused for subsequent inferences.
55  // The initialisation cannot happen at workload construction time since the ACL kernel for the next layer may not
56  // have been configured at the time.
57  if (!m_RanOnce)
58  {
59  const ConstantQueueDescriptor& data = this->m_Data;
60  arm_compute::CLTensor& output = static_cast<GpuFsaTensorHandle*>(data.m_Outputs[0])->GetTensor();
61  arm_compute::DataType computeDataType = static_cast<GpuFsaTensorHandle*>(data.m_Outputs[0])->GetDataType();
62 
63  switch (computeDataType)
64  {
65  case arm_compute::DataType::F16:
66  {
67  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<Half>());
68  break;
69  }
70  case arm_compute::DataType::F32:
71  {
72  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<float>());
73  break;
74  }
75  case arm_compute::DataType::QASYMM8:
76  {
77  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<uint8_t>());
78  break;
79  }
80  case arm_compute::DataType::QASYMM8_SIGNED:
81  {
82  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int8_t>());
83  break;
84  }
85  case arm_compute::DataType::QSYMM16:
86  {
87  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int16_t>());
88  break;
89  }
90  case arm_compute::DataType::QSYMM8:
91  case arm_compute::DataType::QSYMM8_PER_CHANNEL:
92  {
93  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int8_t>());
94  break;
95  }
96  case arm_compute::DataType::S32:
97  {
98  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int32_t>());
99  break;
100  }
101  default:
102  {
103  throw InvalidArgumentException("Unknown data type passed to GpuFsaConstantWorkload::Execute()");
104  break;
105  }
106  }
107 
108  m_RanOnce = true;
109  }
110 }

References armnn::CopyArmComputeClTensorData(), ConstTensorHandle::GetConstTensor(), BaseWorkload< ConstantQueueDescriptor >::m_Data, ConstantQueueDescriptor::m_LayerOutput, and QueueDescriptor::m_Outputs.


The documentation for this class was generated from the following files:
armnn::Half
half_float::half Half
Definition: Half.hpp:22
armnn::CopyArmComputeClTensorData
void CopyArmComputeClTensorData(arm_compute::CLTensor &dstTensor, const T *srcData)
Definition: ClWorkloadUtils.hpp:64
armnn::DataType
DataType
Definition: Types.hpp:48
armnn::BaseWorkload< ConstantQueueDescriptor >::m_Data
ConstantQueueDescriptor m_Data
Definition: Workload.hpp:89