ArmNN
 24.08
TosaRefWorkloadFactory Class Reference

#include <TosaRefWorkloadFactory.hpp>

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

Public Member Functions

 TosaRefWorkloadFactory (const std::shared_ptr< TosaRefMemoryManager > &memoryManager)
 
 TosaRefWorkloadFactory ()
 
 ~TosaRefWorkloadFactory ()
 
const BackendIdGetBackendId () const override
 
bool SupportsSubTensors () const override
 
std::unique_ptr< ITensorHandleCreateSubTensorHandle (ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const override
 
std::unique_ptr< ITensorHandleCreateTensorHandle (const TensorInfo &tensorInfo, DataLayout dataLayout, const bool IsMemoryManaged=true) const override
 
std::unique_ptr< IWorkloadCreateWorkload (LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const override
 Backends should implement their own CreateWorkload function with a switch statement. More...
 
- Public Member Functions inherited from IWorkloadFactory
virtual ~IWorkloadFactory ()
 
virtual void AfterWorkloadsCreated ()
 

Static Public Member Functions

static bool IsLayerSupported (const Layer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
 
static bool IsLayerSupported (const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported, const ModelOptions &modelOptions)
 
- Static Public Member Functions inherited from IWorkloadFactory
static bool IsLayerSupported (const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
 
static bool IsLayerSupported (const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
 
static bool IsLayerSupported (const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported, const ModelOptions &modelOptions)
 
static bool IsLayerSupported (const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported, const ModelOptions &modelOptions)
 

Detailed Description

Definition at line 18 of file TosaRefWorkloadFactory.hpp.

Constructor & Destructor Documentation

◆ TosaRefWorkloadFactory() [1/2]

TosaRefWorkloadFactory ( const std::shared_ptr< TosaRefMemoryManager > &  memoryManager)
explicit

Definition at line 49 of file TosaRefWorkloadFactory.cpp.

50  : m_MemoryManager(memoryManager)
51 {
52 }

◆ TosaRefWorkloadFactory() [2/2]

Definition at line 54 of file TosaRefWorkloadFactory.cpp.

55  : m_MemoryManager(new TosaRefMemoryManager())
56 {
57 }

◆ ~TosaRefWorkloadFactory()

Definition at line 24 of file TosaRefWorkloadFactory.hpp.

24 {}

Member Function Documentation

◆ CreateSubTensorHandle()

std::unique_ptr<ITensorHandle> CreateSubTensorHandle ( ITensorHandle parent,
TensorShape const &  subTensorShape,
unsigned int const *  subTensorOrigin 
) const
inlineoverridevirtual

Implements IWorkloadFactory.

Definition at line 40 of file TosaRefWorkloadFactory.hpp.

43  {
44  IgnoreUnused(parent, subTensorShape, subTensorOrigin);
45  return nullptr;
46  }

References armnn::IgnoreUnused().

◆ CreateTensorHandle() [1/2]

std::unique_ptr< ITensorHandle > CreateTensorHandle ( const TensorInfo tensorInfo,
const bool  IsMemoryManaged = true 
) const
overridevirtual

Implements IWorkloadFactory.

Definition at line 79 of file TosaRefWorkloadFactory.cpp.

81 {
82  if (isMemoryManaged)
83  {
84  return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager);
85  }
86  else
87  {
88  return std::make_unique<TosaRefTensorHandle>(tensorInfo, static_cast<unsigned int>(MemorySource::Malloc));
89  }
90 }

References armnn::Malloc.

◆ CreateTensorHandle() [2/2]

std::unique_ptr< ITensorHandle > CreateTensorHandle ( const TensorInfo tensorInfo,
DataLayout  dataLayout,
const bool  IsMemoryManaged = true 
) const
overridevirtual

Implements IWorkloadFactory.

Definition at line 92 of file TosaRefWorkloadFactory.cpp.

95 {
96  // For TosaRef it is okay to make the TensorHandle memory managed as it can also store a pointer
97  // to unmanaged memory. This also ensures memory alignment.
98  IgnoreUnused(isMemoryManaged, dataLayout);
99 
100  if (isMemoryManaged)
101  {
102  return std::make_unique<TosaRefTensorHandle>(tensorInfo, m_MemoryManager);
103  }
104  else
105  {
106  return std::make_unique<TosaRefTensorHandle>(tensorInfo, static_cast<unsigned int>(MemorySource::Malloc));
107  }
108 }

References armnn::IgnoreUnused(), and armnn::Malloc.

◆ CreateWorkload()

std::unique_ptr< IWorkload > CreateWorkload ( LayerType  type,
const QueueDescriptor descriptor,
const WorkloadInfo info 
) const
overridevirtual

Backends should implement their own CreateWorkload function with a switch statement.

The case for the switch should be the LayerType and based on that they will call their specific workload creation functionality.

Implements IWorkloadFactory.

Definition at line 110 of file TosaRefWorkloadFactory.cpp.

113 {
114  switch(type)
115  {
117  {
118  auto precompiledQueueDescriptor = PolymorphicDowncast<const PreCompiledQueueDescriptor*>(&descriptor);
119  return std::make_unique<TosaRefPreCompiledWorkload>(*precompiledQueueDescriptor, info);
120  }
121  default:
122  return nullptr;
123  }
124 }

References armnn::info, and armnn::PreCompiled.

◆ GetBackendId()

const BackendId & GetBackendId ( ) const
overridevirtual

Implements IWorkloadFactory.

Definition at line 59 of file TosaRefWorkloadFactory.cpp.

60 {
61  return s_Id;
62 }

◆ IsLayerSupported() [1/2]

bool IsLayerSupported ( const IConnectableLayer layer,
Optional< DataType dataType,
std::string &  outReasonIfUnsupported,
const ModelOptions modelOptions 
)
static

Definition at line 71 of file TosaRefWorkloadFactory.cpp.

75 {
76  return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported, modelOptions);
77 }

References IWorkloadFactory::IsLayerSupported().

◆ IsLayerSupported() [2/2]

bool IsLayerSupported ( const Layer layer,
Optional< DataType dataType,
std::string &  outReasonIfUnsupported 
)
static

Definition at line 64 of file TosaRefWorkloadFactory.cpp.

67 {
68  return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported);
69 }

References IWorkloadFactory::IsLayerSupported().

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
inlineoverridevirtual

Implements IWorkloadFactory.

Definition at line 37 of file TosaRefWorkloadFactory.hpp.

37 { return false; }

The documentation for this class was generated from the following files:
armnn::MemorySource::Malloc
@ Malloc
armnn::IWorkloadFactory::IsLayerSupported
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
Definition: WorkloadFactory.cpp:1629
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::LayerType::PreCompiled
@ PreCompiled