24.02
|
#include <ClBackend.hpp>
Classes | |
class | ClBackendCustomAllocatorMemoryRegion |
class | ClBackendCustomAllocatorWrapper |
Public Member Functions | |
ClBackend () | |
ClBackend (std::shared_ptr< ICustomAllocator > allocator) | |
~ClBackend ()=default | |
const BackendId & | GetId () const override |
IBackendInternal::IMemoryManagerUniquePtr | CreateMemoryManager () const override |
IBackendInternal::IWorkloadFactoryPtr | CreateWorkloadFactory (const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override |
IBackendInternal::IWorkloadFactoryPtr | CreateWorkloadFactory (TensorHandleFactoryRegistry ®istry) const override |
IWorkloadFactoryPtr | CreateWorkloadFactory (const IMemoryManagerSharedPtr &memoryManager, const ModelOptions &modelOptions) const override |
IWorkloadFactoryPtr | CreateWorkloadFactory (class TensorHandleFactoryRegistry &tensorHandleFactoryRegistry, const ModelOptions &modelOptions) const override |
IWorkloadFactoryPtr | CreateWorkloadFactory (class TensorHandleFactoryRegistry &tensorHandleFactoryRegistry, const ModelOptions &modelOptions, MemorySourceFlags inputFlags, MemorySourceFlags outputFlags) const override |
std::vector< ITensorHandleFactory::FactoryId > | GetHandleFactoryPreferences () const override |
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order. More... | |
void | RegisterTensorHandleFactories (TensorHandleFactoryRegistry ®istry) override |
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor() IWorkloadFactory::CreateSubtensor() methods must be implemented. More... | |
void | RegisterTensorHandleFactories (TensorHandleFactoryRegistry ®istry, MemorySourceFlags inputFlags, MemorySourceFlags outputFlags) override |
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor() IWorkloadFactory::CreateSubtensor() methods must be implemented. More... | |
IBackendInternal::IBackendContextPtr | CreateBackendContext (const IRuntime::CreationOptions &) const override |
Create the runtime context of the backend. More... | |
IBackendInternal::IBackendProfilingContextPtr | CreateBackendProfilingContext (const IRuntime::CreationOptions &, IBackendProfilingPtr &backendProfiling) override |
Create context specifically used for profiling interaction from backends. More... | |
IBackendInternal::ILayerSupportSharedPtr | GetLayerSupport () const override |
IBackendInternal::ILayerSupportSharedPtr | GetLayerSupport (const ModelOptions &modelOptions) const override |
OptimizationViews | OptimizeSubgraphView (const SubgraphView &subgraph, const ModelOptions &modelOptions) const override |
IBackendInternal::IBackendSpecificModelContextPtr | CreateBackendSpecificModelContext (const ModelOptions &modelOptions) const override |
std::unique_ptr< ICustomAllocator > | GetDefaultAllocator () const override |
Returns the default memory allocator for the backend. More... | |
BackendCapabilities | GetCapabilities () const override |
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be inspected to check whether or not that BackendCapability is supported Otherwise returns an EmptyOptional if the BackendCapability is unlisted. More... | |
virtual bool | UseCustomMemoryAllocator (std::shared_ptr< ICustomAllocator > allocator, armnn::Optional< std::string & > errMsg) override |
Signals the backend to use a custom memory allocator provided by the user. More... | |
virtual unsigned int | GetNumberOfCacheFiles () const override |
Returns the number of files cached if backend supports caching. More... | |
Public Member Functions inherited from IBackendInternal | |
~IBackendInternal () override=default | |
Allow backends created by the factory function to be destroyed through IBackendInternal. More... | |
virtual OptimizationViews | OptimizeSubgraphView (const SubgraphView &subgraph) const |
bool | SupportsTensorAllocatorAPI () const |
ITensorHandleFactory::FactoryId | GetBackwardCompatibleFavoriteHandleFactory () |
virtual ExecutionData | CreateExecutionData (WorkingMemDescriptor &workingMemDescriptor) const |
Returns ExecutionData for the backend. More... | |
virtual void | UpdateExecutionData (ExecutionData &executionData, WorkingMemDescriptor &workingMemDescriptor) const |
Update the ExecutionData for a layer. More... | |
Static Public Member Functions | |
static const BackendId & | GetIdStatic () |
Static Public Member Functions inherited from IBackendInternal | |
static constexpr BackendVersion | GetApiVersion () |
Returns the version of the Backend API. More... | |
Public Attributes | |
std::shared_ptr< ClBackendCustomAllocatorWrapper > | m_CustomAllocator |
bool | m_UsingCustomAllocator = false |
Additional Inherited Members | |
Public Types inherited from IBackendInternal | |
using | IWorkloadFactoryPtr = std::unique_ptr< IWorkloadFactory > |
using | IBackendContextPtr = std::unique_ptr< IBackendContext > |
using | IBackendProfilingContextPtr = std::shared_ptr< arm::pipe::IBackendProfilingContext > |
This is the bridge between backend and backend profiling we'll keep it in the backend namespace. More... | |
using | IBackendProfilingPtr = std::unique_ptr< arm::pipe::IBackendProfiling > |
using | ILayerSupportSharedPtr = std::shared_ptr< ILayerSupport > |
using | IBackendSpecificModelContextPtr = std::shared_ptr< IBackendModelContext > |
using | IMemoryManagerUniquePtr = std::unique_ptr< IMemoryManager > |
using | IMemoryManagerSharedPtr = std::shared_ptr< IMemoryManager > |
Protected Member Functions inherited from IBackendInternal | |
IBackendInternal ()=default | |
Creation must be done through a specific backend interface. More... | |
Protected Member Functions inherited from IBackend | |
IBackend () | |
virtual | ~IBackend () |
Definition at line 24 of file ClBackend.hpp.
|
inline |
Definition at line 27 of file ClBackend.hpp.
|
inline |
Definition at line 28 of file ClBackend.hpp.
References ClBackend::UseCustomMemoryAllocator().
|
default |
|
overridevirtual |
Create the runtime context of the backend.
Implementations may return a default-constructed IBackendContextPtr if no context is needed at runtime. Implementations must throw BackendUnavailableException if the backend cannot be used (for example, necessary accelerator hardware is not present). The default implementation always returns a default-constructed pointer.
Reimplemented from IBackendInternal.
Definition at line 236 of file ClBackend.cpp.
|
overridevirtual |
Create context specifically used for profiling interaction from backends.
Reimplemented from IBackendInternal.
Definition at line 241 of file ClBackend.cpp.
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 247 of file ClBackend.cpp.
Referenced by ClBackend::CreateWorkloadFactory(), ClBackend::GetLayerSupport(), and ClBackend::OptimizeSubgraphView().
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 51 of file ClBackend.cpp.
References ClBackend::m_CustomAllocator, and ClBackend::m_UsingCustomAllocator.
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 102 of file ClBackend.cpp.
References ClBackend::CreateBackendSpecificModelContext(), ClBackend::m_CustomAllocator, ClBackend::m_UsingCustomAllocator, armnn::Malloc, TensorHandleFactoryRegistry::RegisterCopyAndImportFactoryPair(), TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 130 of file ClBackend.cpp.
References ClBackend::CreateBackendSpecificModelContext(), ClBackend::m_CustomAllocator, ClBackend::m_UsingCustomAllocator, armnn::Malloc, TensorHandleFactoryRegistry::RegisterCopyAndImportFactoryPair(), TensorHandleFactoryRegistry::RegisterFactory(), TensorHandleFactoryRegistry::RegisterMemoryManager(), and armnn::Undefined.
|
overridevirtual |
Implements IBackendInternal.
Definition at line 60 of file ClBackend.cpp.
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 67 of file ClBackend.cpp.
References ClBackend::CreateBackendSpecificModelContext().
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 74 of file ClBackend.cpp.
References ClBackend::m_CustomAllocator, ClBackend::m_UsingCustomAllocator, armnn::Malloc, TensorHandleFactoryRegistry::RegisterCopyAndImportFactoryPair(), TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().
|
overridevirtual |
Returns a BackendCapability if the backend lists the capability The BackendCapability must then be inspected to check whether or not that BackendCapability is supported Otherwise returns an EmptyOptional if the BackendCapability is unlisted.
Reimplemented from IBackendInternal.
Definition at line 276 of file ClBackend.cpp.
|
overridevirtual |
Returns the default memory allocator for the backend.
Reimplemented from IBackendInternal.
Definition at line 271 of file ClBackend.cpp.
|
overridevirtual |
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
Reimplemented from IBackendInternal.
Definition at line 170 of file ClBackend.cpp.
References ClTensorHandleFactory::GetIdStatic(), and ClImportTensorHandleFactory::GetIdStatic().
|
inlineoverridevirtual |
Implements IBackend.
Definition at line 36 of file ClBackend.hpp.
References ClBackend::GetIdStatic().
|
static |
Definition at line 45 of file ClBackend.cpp.
References armnn::ClBackendId().
Referenced by ClBackend::GetId().
|
overridevirtual |
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 262 of file ClBackend.cpp.
References ClBackend::CreateBackendSpecificModelContext().
|
inlineoverridevirtual |
Returns the number of files cached if backend supports caching.
Reimplemented from IBackendInternal.
Definition at line 94 of file ClBackend.hpp.
|
overridevirtual |
Reimplemented from IBackendInternal.
Definition at line 293 of file ClBackend.cpp.
References armnn::Activation, armnn::Add, armnn::Addition, OptimizationViews::AddUntouchedSubgraph(), armnn::BatchNormalization, SubgraphView::begin(), Layer::BeginOutputSlots(), armnn::ClAdditionValidate(), armnn::ClBatchNormalizationValidate(), armnn::ClConvolution2dWorkloadValidate(), armnn::ClDepthwiseConvolutionWorkloadValidate(), armnn::ClDivisionWorkloadValidate(), armnn::ClFullyConnectedWorkloadValidate(), armnn::ClMultiplicationWorkloadValidate(), armnn::ClSubtractionValidate(), armnn::ConnectedToLayerWithNCHW(), armnn::Convolution2d, ClBackend::CreateBackendSpecificModelContext(), armnn::DepthwiseConvolution2d, armnn::Div, armnn::Division, armnn::ElementwiseBinary, SubgraphView::end(), Layer::EndOutputSlots(), armnn::FullyConnected, Layer::GetAdditionalInformation(), InputSlot::GetConnectedOutputSlot(), OptimizationViews::GetDeletedSubgraphs(), Layer::GetGuid(), Layer::GetInputSlot(), Layer::GetName(), OutputSlot::GetNumConnections(), Layer::GetOutputSlot(), OutputSlot::GetOwningLayer(), LayerWithParameters< Parameters >::GetParameters(), OptimizationViews::GetSubstitutions(), OutputSlot::GetTensorInfo(), Layer::GetType(), ClBackendModelContext::IsFastMathEnabled(), BatchNormalizationLayer::m_Beta, FullyConnectedDescriptor::m_BiasEnabled, Convolution2dDescriptor::m_BiasEnabled, DepthwiseConvolution2dDescriptor::m_BiasEnabled, BatchNormalizationLayer::m_Gamma, BatchNormalizationLayer::m_Mean, ElementwiseBinaryDescriptor::m_Operation, BatchNormalizationLayer::m_Variance, ReduceDescriptor::m_vAxis, armnn::Mul, armnn::Multiplication, armnn::Pad, armnn::Pooling2d, armnn::Reduce, armnn::RemoveReshapeLayer(), armnn::ReportUntouchedLayers(), armnn::Reshape, armnn::Sub, armnn::Subtraction, and armnn::optimizations::pad_fold::TryFoldPadIntoLayer2d().
|
overridevirtual |
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor() IWorkloadFactory::CreateSubtensor() methods must be implemented.
Reimplemented from IBackendInternal.
Definition at line 176 of file ClBackend.cpp.
References ClBackend::m_CustomAllocator, ClBackend::m_UsingCustomAllocator, armnn::Malloc, TensorHandleFactoryRegistry::RegisterCopyAndImportFactoryPair(), TensorHandleFactoryRegistry::RegisterFactory(), and TensorHandleFactoryRegistry::RegisterMemoryManager().
|
overridevirtual |
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFactory::CreateTensor() IWorkloadFactory::CreateSubtensor() methods must be implemented.
Reimplemented from IBackendInternal.
Definition at line 201 of file ClBackend.cpp.
References ClBackend::m_CustomAllocator, ClBackend::m_UsingCustomAllocator, armnn::Malloc, TensorHandleFactoryRegistry::RegisterCopyAndImportFactoryPair(), TensorHandleFactoryRegistry::RegisterFactory(), TensorHandleFactoryRegistry::RegisterMemoryManager(), and armnn::Undefined.
|
inlineoverridevirtual |
Signals the backend to use a custom memory allocator provided by the user.
allocator | - a pointer to the provided ICustomAllocator to use with this backend |
errMsg | - Optional string variable to return error messages |
Reimplemented from IBackendInternal.
Definition at line 82 of file ClBackend.hpp.
References ARMNN_LOG, armnn::IgnoreUnused(), armnn::info, ClBackend::m_CustomAllocator, and ClBackend::m_UsingCustomAllocator.
Referenced by ClBackend::ClBackend().
std::shared_ptr<ClBackendCustomAllocatorWrapper> m_CustomAllocator |
Definition at line 283 of file ClBackend.hpp.
Referenced by ClBackend::CreateMemoryManager(), ClBackend::CreateWorkloadFactory(), ClBackend::RegisterTensorHandleFactories(), and ClBackend::UseCustomMemoryAllocator().
bool m_UsingCustomAllocator = false |
Definition at line 284 of file ClBackend.hpp.
Referenced by ClBackend::CreateMemoryManager(), ClBackend::CreateWorkloadFactory(), ClBackend::RegisterTensorHandleFactories(), and ClBackend::UseCustomMemoryAllocator().