ArmNN
 22.11
TosaRefWorkloadFactory Class Reference

#include <TosaRefWorkloadFactory.hpp>

Inheritance diagram for TosaRefWorkloadFactory:
IWorkloadFactory

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
 
- 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()

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.

References ARMNN_DEPRECATED_MSG, TosaRefWorkloadFactory::CreateTensorHandle(), TosaRefWorkloadFactory::CreateWorkload(), armnn::IgnoreUnused(), and armnn::info.

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

◆ 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.

References armnn::Malloc.

Referenced by TosaRefWorkloadFactory::CreateSubTensorHandle().

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 }

◆ 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.

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

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 }
void IgnoreUnused(Ts &&...)

◆ CreateWorkload()

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

Reimplemented from IWorkloadFactory.

Definition at line 110 of file TosaRefWorkloadFactory.cpp.

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

Referenced by TosaRefWorkloadFactory::CreateSubTensorHandle().

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 }

◆ GetBackendId()

const BackendId & GetBackendId ( ) const
overridevirtual

Implements IWorkloadFactory.

Definition at line 59 of file TosaRefWorkloadFactory.cpp.

Referenced by TosaRefWorkloadFactory::~TosaRefWorkloadFactory().

60 {
61  return s_Id;
62 }

◆ IsLayerSupported() [1/2]

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

Definition at line 64 of file TosaRefWorkloadFactory.cpp.

References IWorkloadFactory::IsLayerSupported().

Referenced by TosaRefWorkloadFactory::~TosaRefWorkloadFactory().

67 {
68  return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported);
69 }
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)

◆ IsLayerSupported() [2/2]

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

Definition at line 71 of file TosaRefWorkloadFactory.cpp.

References IWorkloadFactory::IsLayerSupported().

75 {
76  return IWorkloadFactory::IsLayerSupported(s_Id, layer, dataType, outReasonIfUnsupported, modelOptions);
77 }
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)

◆ SupportsSubTensors()

bool SupportsSubTensors ( ) const
inlineoverridevirtual

Implements IWorkloadFactory.

Definition at line 37 of file TosaRefWorkloadFactory.hpp.

References ARMNN_DEPRECATED_MSG.

37 { return false; }

The documentation for this class was generated from the following files: