ArmNN
 24.02
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 
61  ARMNN_ASSERT(data.m_LayerOutput != nullptr);
62  arm_compute::CLTensor& output = static_cast<GpuFsaTensorHandle*>(data.m_Outputs[0])->GetTensor();
63  arm_compute::DataType computeDataType = static_cast<GpuFsaTensorHandle*>(data.m_Outputs[0])->GetDataType();
64 
65  switch (computeDataType)
66  {
67  case arm_compute::DataType::F16:
68  {
69  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<Half>());
70  break;
71  }
72  case arm_compute::DataType::F32:
73  {
74  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<float>());
75  break;
76  }
77  case arm_compute::DataType::QASYMM8:
78  {
79  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<uint8_t>());
80  break;
81  }
82  case arm_compute::DataType::QASYMM8_SIGNED:
83  {
84  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int8_t>());
85  break;
86  }
87  case arm_compute::DataType::QSYMM16:
88  {
89  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int16_t>());
90  break;
91  }
92  case arm_compute::DataType::QSYMM8:
93  case arm_compute::DataType::QSYMM8_PER_CHANNEL:
94  {
95  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int8_t>());
96  break;
97  }
98  case arm_compute::DataType::S32:
99  {
100  CopyArmComputeClTensorData(output, data.m_LayerOutput->GetConstTensor<int32_t>());
101  break;
102  }
103  default:
104  {
105  ARMNN_ASSERT_MSG(false, "Unknown data type");
106  break;
107  }
108  }
109 
110  m_RanOnce = true;
111  }
112 }

References ARMNN_ASSERT, ARMNN_ASSERT_MSG, 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_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
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_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